summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/atm/ng_atm.h
blob: 6b42d721c4cd781e3eb18a040c0c78daa85b36d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/*-
 * Copyright (c) 2001-2003
 *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
 * 	All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * Author: Harti Brandt <harti@freebsd.org>
 */

/*
 * Netgraph module to connect NATM interfaces to netgraph.
 *
 * $FreeBSD$
 */
#ifndef _NETGRAPH_ATM_NG_ATM_H_
#define _NETGRAPH_ATM_NG_ATM_H_

#define NG_ATM_NODE_TYPE "atm"
#define NGM_ATM_COOKIE	960802260

/* Netgraph control messages */
enum {
	NGM_ATM_GET_IFNAME = 1,		/* get the interface name */
	NGM_ATM_GET_CONFIG,		/* get configuration */
	NGM_ATM_GET_VCCS,		/* get a list of all active vccs */
	NGM_ATM_CPCS_INIT,		/* start the channel */
	NGM_ATM_CPCS_TERM,		/* stop the channel */
	NGM_ATM_GET_VCC,		/* get VCC config */
	NGM_ATM_GET_VCCID,		/* get VCC by VCI/VPI */
	NGM_ATM_GET_STATS,		/* get global statistics */

	/* messages from the node */
	NGM_ATM_CARRIER_CHANGE = 1000,	/* UNUSED: carrier changed */
	NGM_ATM_VCC_CHANGE,		/* permanent VCC changed */
	NGM_ATM_ACR_CHANGE,		/* ABR ACR has changed */
	NGM_ATM_IF_CHANGE,		/* interface state change */
};

/*
 * Hardware interface configuration
 */
struct ngm_atm_config {
	uint32_t	pcr;		/* peak cell rate */
	uint32_t	vpi_bits;	/* number of active VPI bits */
	uint32_t	vci_bits;	/* number of active VCI bits */
	uint32_t	max_vpcs;	/* maximum number of VPCs */
	uint32_t	max_vccs;	/* maximum number of VCCs */
};
#define NGM_ATM_CONFIG_INFO 					\
	{							\
	  { "pcr",	&ng_parse_uint32_type },		\
	  { "vpi_bits",	&ng_parse_uint32_type },		\
	  { "vci_bits",	&ng_parse_uint32_type },		\
	  { "max_vpcs",	&ng_parse_uint32_type },		\
	  { "max_vccs",	&ng_parse_uint32_type },		\
	  { NULL }						\
	}

/*
 * Information about an open VCC
 * See net/if_atm.h. Keep in sync.
 */
#define NGM_ATM_TPARAM_INFO 					\
	{							\
	  { "pcr",	&ng_parse_uint32_type },		\
	  { "scr",	&ng_parse_uint32_type },		\
	  { "mbs",	&ng_parse_uint32_type },		\
	  { "mcr",	&ng_parse_uint32_type },		\
	  { "icr",	&ng_parse_uint32_type },		\
	  { "tbe",	&ng_parse_uint32_type },		\
	  { "nrm",	&ng_parse_uint8_type },			\
	  { "trm",	&ng_parse_uint8_type },			\
	  { "adtf",	&ng_parse_uint16_type },		\
	  { "rif",	&ng_parse_uint8_type },			\
	  { "rdf",	&ng_parse_uint8_type },			\
	  { "cdf",	&ng_parse_uint8_type },			\
	  { NULL }						\
	}

#define NGM_ATM_VCC_INFO 					\
	{							\
	  { "flags",	&ng_parse_hint16_type },		\
	  { "vpi",	&ng_parse_uint16_type },		\
	  { "vci",	&ng_parse_uint16_type },		\
	  { "rmtu",	&ng_parse_uint16_type },		\
	  { "tmtu",	&ng_parse_uint16_type },		\
	  { "aal",	&ng_parse_uint8_type },			\
	  { "traffic",	&ng_parse_uint8_type },			\
	  { "tparam",	&ng_atm_tparam_type },			\
	  { NULL }						\
	}

#define NGM_ATM_VCCARRAY_INFO					\
	{							\
	  &ng_atm_vcc_type,					\
	  ng_atm_vccarray_getlen,				\
	  NULL							\
	}

#define NGM_ATM_VCCTABLE_INFO 					\
	{							\
	  { "count",	&ng_parse_uint32_type },		\
	  { "vccs",	&ng_atm_vccarray_type },		\
	  { NULL }						\
	}

/*
 * Structure to open a VCC.
 */
struct ngm_atm_cpcs_init {
	char		name[NG_HOOKSIZ];
	uint32_t	flags;		/* flags. (if_atm.h) */
	uint16_t	vci;		/* VCI to open */
	uint16_t	vpi;		/* VPI to open */
	uint16_t	rmtu;		/* Receive maximum CPCS size */
	uint16_t	tmtu;		/* Transmit maximum CPCS size */
	uint8_t		aal;		/* AAL type (if_atm.h) */
	uint8_t		traffic;	/* traffic type (if_atm.h) */
	uint32_t	pcr;		/* Peak cell rate */
	uint32_t	scr;		/* VBR: Sustainable cell rate */
	uint32_t	mbs;		/* VBR: Maximum burst rate */
	uint32_t	mcr;		/* UBR+: Minimum cell rate */
	uint32_t	icr;		/* ABR: Initial cell rate */
	uint32_t	tbe;		/* ABR: Transmit buffer exposure */
	uint8_t		nrm;		/* ABR: Nrm */
	uint8_t		trm;		/* ABR: Trm */
	uint16_t	adtf;		/* ABR: ADTF */
	uint8_t		rif;		/* ABR: RIF */
	uint8_t		rdf;		/* ABR: RDF */
	uint8_t		cdf;		/* ABR: CDF */
};

#define NGM_ATM_CPCS_INIT_INFO 					\
	{							\
	  { "name",	&ng_parse_hookbuf_type },		\
	  { "flags",	&ng_parse_hint32_type },		\
	  { "vci",	&ng_parse_uint16_type },		\
	  { "vpi",	&ng_parse_uint16_type },		\
	  { "rmtu",	&ng_parse_uint16_type },		\
	  { "tmtu",	&ng_parse_uint16_type },		\
	  { "aal",	&ng_parse_uint8_type },			\
	  { "traffic",	&ng_parse_uint8_type },			\
	  { "pcr",	&ng_parse_uint32_type },		\
	  { "scr",	&ng_parse_uint32_type },		\
	  { "mbs",	&ng_parse_uint32_type },		\
	  { "mcr",	&ng_parse_uint32_type },		\
	  { "icr",	&ng_parse_uint32_type },		\
	  { "tbe",	&ng_parse_uint32_type },		\
	  { "nrm",	&ng_parse_uint8_type },			\
	  { "trm",	&ng_parse_uint8_type },			\
	  { "adtf",	&ng_parse_uint16_type },		\
	  { "rif",	&ng_parse_uint8_type },			\
	  { "rdf",	&ng_parse_uint8_type },			\
	  { "cdf",	&ng_parse_uint8_type },			\
	  { NULL }						\
	}

/*
 * Structure to close a VCI without disconnecting the hook
 */
struct ngm_atm_cpcs_term {
	char		name[NG_HOOKSIZ];
};
#define NGM_ATM_CPCS_TERM_INFO 					\
	{							\
	  { "name",	&ng_parse_hookbuf_type },		\
	  { NULL }						\
	}

struct ngm_atm_stats {
	uint64_t	in_packets;
	uint64_t	in_errors;
	uint64_t	out_packets;
	uint64_t	out_errors;
};
#define NGM_ATM_STATS_INFO					\
	{							\
	  { "in_packets",	&ng_parse_uint64_type },	\
	  { "in_errors",	&ng_parse_uint64_type },	\
	  { "out_packets",	&ng_parse_uint64_type },	\
	  { "out_errors",	&ng_parse_uint64_type },	\
	  { NULL }						\
	}

struct ngm_atm_if_change {
	uint32_t	node;
	uint8_t		carrier;
	uint8_t		running;
};
#define NGM_ATM_IF_CHANGE_INFO 					\
	{							\
	  { "node",	&ng_parse_hint32_type },		\
	  { "carrier",	&ng_parse_uint8_type },			\
	  { "running",	&ng_parse_uint8_type },			\
	  { NULL }						\
	}

struct ngm_atm_vcc_change {
	uint32_t	node;
	uint16_t	vci;
	uint8_t		vpi;
	uint8_t		state;
};
#define NGM_ATM_VCC_CHANGE_INFO 				\
	{							\
	  { "node",	&ng_parse_hint32_type },		\
	  { "vci",	&ng_parse_uint16_type },		\
	  { "vpi",	&ng_parse_uint8_type },			\
	  { "state",	&ng_parse_uint8_type },			\
	  { NULL }						\
	}

struct ngm_atm_acr_change {
	uint32_t	node;
	uint16_t	vci;
	uint8_t		vpi;
	uint32_t	acr;
};
#define NGM_ATM_ACR_CHANGE_INFO					\
	{							\
	  { "node",	&ng_parse_hint32_type },		\
	  { "vci",	&ng_parse_uint16_type },		\
	  { "vpi",	&ng_parse_uint8_type },			\
	  { "acr",	&ng_parse_uint32_type },		\
	  { NULL }						\
	}

#endif /* _NETGRAPH_ATM_NG_ATM_H */
OpenPOWER on IntegriCloud