]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netgraph/atm/ng_atmpif.h
This commit was generated by cvs2svn to compensate for changes in r161351,
[FreeBSD/FreeBSD.git] / sys / netgraph / atm / ng_atmpif.h
1 /*-
2  * Copyright (c) 2003 Harti Brandt.
3  * Copyright (c) 2003 Vincent Jardin.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  * 
27  * $FreeBSD$
28  */
29
30 #ifndef _NETGRAPH_ATM_NG_ATMPIF_H_
31 #define _NETGRAPH_ATM_NG_ATMPIF_H_
32
33 /* Node type name and magic cookie */
34 #define NG_ATMPIF_NODE_TYPE             "atmpif"
35 #define NGM_ATMPIF_COOKIE               967239456
36
37 /*
38  * Physical device name - used to configure HARP devices
39  */
40 #ifndef VATMPIF_DEV_NAME
41 #define VATMPIF_DEV_NAME        "hva"   /* HARP Virtual ATM */
42 #endif
43
44 #define VATMPIF_MAX_VCI         65535
45 #define VATMPIF_MAX_VPI         255
46
47 /* Hook name */
48 #define NG_ATMPIF_HOOK_LINK     "link"   /* virtual link hook */
49
50 /*
51  * Node configuration structure
52  */
53 struct ng_vatmpif_config {
54         uint8_t         debug;          /* debug bit field (see below) */
55         uint32_t        pcr;            /* peak cell rate */
56         Mac_addr        macaddr;        /* Mac Address */
57 };
58 /* Keep this in sync with the above structure definition */
59 #define NG_ATMPIF_CONFIG_TYPE_INFO {                            \
60         { "debug",              &ng_parse_uint8_type    },      \
61         { "pcr",                &ng_parse_uint32_type   },      \
62         { "macaddr",            &ng_mac_addr_type       },      \
63         { NULL }                                                \
64 }
65
66 /*
67  * Debug bit-fields
68  */
69 #define VATMPIF_DEBUG_NONE      0x00
70 #define VATMPIF_DEBUG_PACKET    0x01 /* enable ng_atmpif debugging       */
71
72 #define IS_VATMPIF_DEBUG_PACKET(a)  ( (a)       \
73                                 &&  ((a)->conf.debug & VATMPIF_DEBUG_PACKET)  )
74
75 /*
76  * Statistics
77  */
78 struct hva_stats_ng {
79         uint32_t        ng_errseq;      /* Duplicate or out of order */
80         uint32_t        ng_lostpdu;     /* PDU lost detected */
81         uint32_t        ng_badpdu;      /* Unknown PDU type */
82         uint32_t        ng_rx_novcc;    /* Draining PDU on closed VCC */
83         uint32_t        ng_rx_iqfull;   /* PDU drops, no room in atm_intrq */
84         uint32_t        ng_tx_rawcell;  /* PDU raw cells transmitted */
85         uint32_t        ng_rx_rawcell;  /* PDU raw cells received */
86         uint64_t        ng_tx_pdu;      /* PDU transmitted */
87         uint64_t        ng_rx_pdu;      /* PDU received */
88 };
89 typedef struct hva_stats_ng     Hva_Stats_ng;
90 /* Keep this in sync with the above structure definition */
91 #define HVA_STATS_NG_TYPE_INFO                                  \
92         { "errSeqOrder",        &ng_parse_uint32_type   },      \
93         { "errLostPDU",         &ng_parse_uint32_type   },      \
94         { "recvBadPDU",         &ng_parse_uint32_type   },      \
95         { "ErrATMVC",           &ng_parse_uint32_type   },      \
96         { "ErrQfull",           &ng_parse_uint32_type   },      \
97         { "xmitRawCell",        &ng_parse_uint32_type   },      \
98         { "recvRawCell",        &ng_parse_uint32_type   },      \
99         { "xmitPDU",            &ng_parse_uint64_type   },      \
100         { "recvPDU",            &ng_parse_uint64_type   },
101         
102
103 struct hva_stats_atm {
104         uint64_t        atm_xmit;       /* Cells transmitted */
105         uint64_t        atm_rcvd;       /* Cells received */
106 };
107 typedef struct hva_stats_atm    Hva_Stats_atm;
108 /* Keep this in sync with the above structure definition */
109 #define HVA_STATS_ATM_NG_TYPE_INFO                              \
110         { "xmitATMCells",       &ng_parse_uint64_type   },      \
111         { "recvATMCells",       &ng_parse_uint64_type   },
112
113 struct hva_stats_aal5 {
114         uint64_t        aal5_xmit;      /* Cells transmitted */
115         uint64_t        aal5_rcvd;      /* Cells received */
116         uint32_t        aal5_crc_len;   /* Cells with CRC/length errors */
117         uint32_t        aal5_drops;     /* Cell drops */
118         uint64_t        aal5_pdu_xmit;  /* CS PDUs transmitted */
119         uint64_t        aal5_pdu_rcvd;  /* CS PDUs received */
120         uint32_t        aal5_pdu_crc;   /* CS PDUs with CRC errors */
121         uint32_t        aal5_pdu_errs;  /* CS layer protocol errors */
122         uint32_t        aal5_pdu_drops; /* CS PDUs dropped */
123 };
124 typedef struct hva_stats_aal5   Hva_Stats_aal5;
125 /* Keep this in sync with the above structure definition */
126 #define HVA_STATS_AAL5_NG_TYPE_INFO                             \
127         { "xmitAAL5Cells",              &ng_parse_uint64_type   },      \
128         { "recvAAL5Cells",              &ng_parse_uint64_type   },      \
129         { "AAL5ErrCRCCells",            &ng_parse_uint32_type   },      \
130         { "AAL5DropsCells",             &ng_parse_uint32_type   },      \
131         { "xmitAAL5PDU",                &ng_parse_uint64_type   },      \
132         { "recvAAL5PDU",                &ng_parse_uint64_type   },      \
133         { "AAL5CRCPDU",                 &ng_parse_uint32_type   },      \
134         { "AAL5ErrPDU",                 &ng_parse_uint32_type   },      \
135         { "AAL5DropsPDU",               &ng_parse_uint32_type   },
136
137 struct vatmpif_stats {
138         Hva_Stats_ng    hva_st_ng;      /* Netgraph layer stats */
139         Hva_Stats_atm   hva_st_atm;     /* ATM layer stats */
140         Hva_Stats_aal5  hva_st_aal5;    /* AAL5 layer stats */
141 };
142 typedef struct vatmpif_stats    Vatmpif_stats;
143 /* Keep this in sync with the above structure definition */
144 #define NG_ATMPIF_STATS_TYPE_INFO {     \
145         HVA_STATS_NG_TYPE_INFO          \
146         HVA_STATS_ATM_NG_TYPE_INFO      \
147         HVA_STATS_AAL5_NG_TYPE_INFO     \
148         { NULL }                        \
149 }
150
151 /* Structure returned by NGM_ATMPIF_GET_LINK_STATUS */
152 struct ng_atmpif_link_status {
153         uint32_t        InSeq;          /* last received sequence number + 1 */
154         uint32_t        OutSeq;         /* last sent sequence number */
155         uint32_t        cur_pcr;        /* slot's reserved PCR */
156 };
157 /* Keep this in sync with the above structure definition */
158 #define NG_ATMPIF_LINK_STATUS_TYPE_INFO  {              \
159         { "InSeq",      &ng_parse_uint32_type },        \
160         { "OutSeq",     &ng_parse_uint32_type },        \
161         { "cur_pcr",    &ng_parse_uint32_type },        \
162         { NULL }                                        \
163 }
164
165 /* Netgraph control messages */
166 enum {
167         NGM_ATMPIF_SET_CONFIG = 1,      /* set node configuration */
168         NGM_ATMPIF_GET_CONFIG,          /* get node configuration */
169         NGM_ATMPIF_GET_LINK_STATUS,     /* get link status */
170         NGM_ATMPIF_GET_STATS,           /* get link stats */
171         NGM_ATMPIF_CLR_STATS,           /* clear link stats */
172         NGM_ATMPIF_GETCLR_STATS,        /* atomically get & clear link stats */
173 };
174
175 #endif /* _NETGRAPH_NG_ATMPIF_H_ */