xref: /dflybsd-src/sys/netgraph/async/ng_async.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino 
2*86d7f5d3SJohn Marino /*
3*86d7f5d3SJohn Marino  * ng_async.h
4*86d7f5d3SJohn Marino  *
5*86d7f5d3SJohn Marino  * Copyright (c) 1996-1999 Whistle Communications, Inc.
6*86d7f5d3SJohn Marino  * All rights reserved.
7*86d7f5d3SJohn Marino  *
8*86d7f5d3SJohn Marino  * Subject to the following obligations and disclaimer of warranty, use and
9*86d7f5d3SJohn Marino  * redistribution of this software, in source or object code forms, with or
10*86d7f5d3SJohn Marino  * without modifications are expressly permitted by Whistle Communications;
11*86d7f5d3SJohn Marino  * provided, however, that:
12*86d7f5d3SJohn Marino  * 1. Any and all reproductions of the source or object code must include the
13*86d7f5d3SJohn Marino  *    copyright notice above and the following disclaimer of warranties; and
14*86d7f5d3SJohn Marino  * 2. No rights are granted, in any manner or form, to use Whistle
15*86d7f5d3SJohn Marino  *    Communications, Inc. trademarks, including the mark "WHISTLE
16*86d7f5d3SJohn Marino  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
17*86d7f5d3SJohn Marino  *    such appears in the above copyright notice or in the software.
18*86d7f5d3SJohn Marino  *
19*86d7f5d3SJohn Marino  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
20*86d7f5d3SJohn Marino  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
21*86d7f5d3SJohn Marino  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
22*86d7f5d3SJohn Marino  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
23*86d7f5d3SJohn Marino  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24*86d7f5d3SJohn Marino  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
25*86d7f5d3SJohn Marino  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
26*86d7f5d3SJohn Marino  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
27*86d7f5d3SJohn Marino  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
28*86d7f5d3SJohn Marino  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
29*86d7f5d3SJohn Marino  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30*86d7f5d3SJohn Marino  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
31*86d7f5d3SJohn Marino  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32*86d7f5d3SJohn Marino  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33*86d7f5d3SJohn Marino  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34*86d7f5d3SJohn Marino  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35*86d7f5d3SJohn Marino  * OF SUCH DAMAGE.
36*86d7f5d3SJohn Marino  *
37*86d7f5d3SJohn Marino  * Author: Archie Cobbs <archie@freebsd.org>
38*86d7f5d3SJohn Marino  *
39*86d7f5d3SJohn Marino  * $FreeBSD: src/sys/netgraph/ng_async.h,v 1.6.2.3 2002/07/02 23:44:02 archie Exp $
40*86d7f5d3SJohn Marino  * $DragonFly: src/sys/netgraph/async/ng_async.h,v 1.2 2003/06/17 04:28:49 dillon Exp $
41*86d7f5d3SJohn Marino  * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $
42*86d7f5d3SJohn Marino  */
43*86d7f5d3SJohn Marino 
44*86d7f5d3SJohn Marino #ifndef _NETGRAPH_ASYNC_H_
45*86d7f5d3SJohn Marino #define _NETGRAPH_ASYNC_H_
46*86d7f5d3SJohn Marino 
47*86d7f5d3SJohn Marino /* Type name and cookie */
48*86d7f5d3SJohn Marino #define NG_ASYNC_NODE_TYPE	"async"
49*86d7f5d3SJohn Marino #define NGM_ASYNC_COOKIE	886473717
50*86d7f5d3SJohn Marino 
51*86d7f5d3SJohn Marino /* Hook names */
52*86d7f5d3SJohn Marino #define NG_ASYNC_HOOK_SYNC	"sync"	/* Sync frames */
53*86d7f5d3SJohn Marino #define NG_ASYNC_HOOK_ASYNC	"async"	/* Async-encoded frames */
54*86d7f5d3SJohn Marino 
55*86d7f5d3SJohn Marino /* Maximum receive size bounds (for both sync and async sides) */
56*86d7f5d3SJohn Marino #define NG_ASYNC_MIN_MRU	1
57*86d7f5d3SJohn Marino #define NG_ASYNC_MAX_MRU	8192
58*86d7f5d3SJohn Marino #define NG_ASYNC_DEFAULT_MRU	1600
59*86d7f5d3SJohn Marino 
60*86d7f5d3SJohn Marino /* Frame statistics */
61*86d7f5d3SJohn Marino struct ng_async_stat {
62*86d7f5d3SJohn Marino 	u_int32_t	syncOctets;
63*86d7f5d3SJohn Marino 	u_int32_t	syncFrames;
64*86d7f5d3SJohn Marino 	u_int32_t	syncOverflows;
65*86d7f5d3SJohn Marino 	u_int32_t	asyncOctets;
66*86d7f5d3SJohn Marino 	u_int32_t	asyncFrames;
67*86d7f5d3SJohn Marino 	u_int32_t	asyncRunts;
68*86d7f5d3SJohn Marino 	u_int32_t	asyncOverflows;
69*86d7f5d3SJohn Marino 	u_int32_t	asyncBadCheckSums;
70*86d7f5d3SJohn Marino };
71*86d7f5d3SJohn Marino 
72*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */
73*86d7f5d3SJohn Marino #define NG_ASYNC_STATS_TYPE_INFO	{			\
74*86d7f5d3SJohn Marino 	  { "syncOctets",	&ng_parse_uint32_type	},	\
75*86d7f5d3SJohn Marino 	  { "syncFrames",	&ng_parse_uint32_type	},	\
76*86d7f5d3SJohn Marino 	  { "syncOverflows",	&ng_parse_uint32_type	},	\
77*86d7f5d3SJohn Marino 	  { "asyncOctets",	&ng_parse_uint32_type	},	\
78*86d7f5d3SJohn Marino 	  { "asyncFrames",	&ng_parse_uint32_type	},	\
79*86d7f5d3SJohn Marino 	  { "asyncRunts",	&ng_parse_uint32_type	},	\
80*86d7f5d3SJohn Marino 	  { "asyncOverflows",	&ng_parse_uint32_type	},	\
81*86d7f5d3SJohn Marino 	  { "asyncBadCheckSums",&ng_parse_uint32_type	},	\
82*86d7f5d3SJohn Marino 	  { NULL }						\
83*86d7f5d3SJohn Marino }
84*86d7f5d3SJohn Marino 
85*86d7f5d3SJohn Marino /* Configuration for this node */
86*86d7f5d3SJohn Marino struct ng_async_cfg {
87*86d7f5d3SJohn Marino 	u_char		enabled;	/* Turn encoding on/off */
88*86d7f5d3SJohn Marino 	u_int16_t	amru;		/* Max receive async frame length */
89*86d7f5d3SJohn Marino 	u_int16_t	smru;		/* Max receive sync frame length */
90*86d7f5d3SJohn Marino 	u_int32_t	accm;		/* ACCM encoding */
91*86d7f5d3SJohn Marino };
92*86d7f5d3SJohn Marino 
93*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */
94*86d7f5d3SJohn Marino #define NG_ASYNC_CONFIG_TYPE_INFO	{			\
95*86d7f5d3SJohn Marino 	  { "enabled",		&ng_parse_int8_type	},	\
96*86d7f5d3SJohn Marino 	  { "amru",		&ng_parse_uint16_type	},	\
97*86d7f5d3SJohn Marino 	  { "smru",		&ng_parse_uint16_type	},	\
98*86d7f5d3SJohn Marino 	  { "accm",		&ng_parse_hint32_type	},	\
99*86d7f5d3SJohn Marino 	  { NULL }						\
100*86d7f5d3SJohn Marino }
101*86d7f5d3SJohn Marino 
102*86d7f5d3SJohn Marino /* Commands */
103*86d7f5d3SJohn Marino enum {
104*86d7f5d3SJohn Marino 	NGM_ASYNC_CMD_GET_STATS = 1,	/* returns struct ng_async_stat */
105*86d7f5d3SJohn Marino 	NGM_ASYNC_CMD_CLR_STATS,
106*86d7f5d3SJohn Marino 	NGM_ASYNC_CMD_SET_CONFIG,	/* takes struct ng_async_cfg */
107*86d7f5d3SJohn Marino 	NGM_ASYNC_CMD_GET_CONFIG,	/* returns struct ng_async_cfg */
108*86d7f5d3SJohn Marino };
109*86d7f5d3SJohn Marino 
110*86d7f5d3SJohn Marino #endif /* _NETGRAPH_ASYNC_H_ */
111