1 /* 2 * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are 3 * created for each DLCI associated with a FRAD. The FRAD driver 4 * is not truly a network device, but the lower level device 5 * handler. This allows other FRAD manufacturers to use the DLCI 6 * code, including it's RFC1490 encapsulation along side the current 7 * implementation for the Sangoma cards. 8 * 9 * Version: @(#)if_ifrad.h 0.15 31 Mar 96 10 * 11 * Author: Mike McLagan <mike.mclagan@linux.org> 12 * 13 * Changes: 14 * 0.15 Mike McLagan changed structure defs (packed) 15 * re-arranged flags 16 * added DLCI_RET vars 17 * 18 * This program is free software; you can redistribute it and/or 19 * modify it under the terms of the GNU General Public License 20 * as published by the Free Software Foundation; either version 21 * 2 of the License, or (at your option) any later version. 22 */ 23
24 #ifndef_FRAD_H_ 25 #define_FRAD_H_ 26
27 /* Structures and constants associated with the DLCI device driver */ 28
29 #defineDLCI_DEVADD (SIOCDEVPRIVATE)
30 #defineDLCI_DEVDEL (SIOCDEVPRIVATE + 1)
31
32 structdlci_add 33 { 34 chardevname[IFNAMSIZ];
35 shortdlci;
36 };
37
38 #defineDLCI_GET_CONF (SIOCDEVPRIVATE + 2)
39 #defineDLCI_SET_CONF (SIOCDEVPRIVATE + 3)
40
41 /* 42 * These are related to the Sangoma SDLA and should remain in order. 43 * Code within the SDLA module is based on the specifics of this 44 * structure. Change at your own peril. 45 */ 46 structdlci_conf{ 47 shortflags;
48 shortCIR_fwd;
49 shortBc_fwd;
50 shortBe_fwd;
51 shortCIR_bwd;
52 shortBc_bwd;
53 shortBe_bwd;
54
55 /* these are part of the status read */ 56 shortTc_fwd;
57 shortTc_bwd;
58 shortTf_max;
59 shortTb_max;
60
61 /* add any new fields here above is a mirror of sdla_dlci_conf */ 62 };
63
64 #defineDLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
65
66 /* configuration flags for DLCI */ 67 #define DLCI_IGNORE_CIR_OUT 0x0001
68 #define DLCI_ACCOUNT_CIR_IN 0x0002
69 #define DLCI_BUFFER_IF 0x0008
70
71 #defineDLCI_VALID_FLAGS 0x000B
72
73 /* FRAD driver uses these to indicate what it did with packet */ 74 #defineDLCI_RET_OK 0x00
75 #defineDLCI_RET_ERR 0x01
76 #defineDLCI_RET_DROP 0x02
77
78 /* defines for the actual Frame Relay hardware */ 79 #defineFRAD_GET_CONF (SIOCDEVPRIVATE)
80 #defineFRAD_SET_CONF (SIOCDEVPRIVATE + 1)
81
82 #defineFRAD_LAST_IOCTLFRAD_SET_CONF 83
84 /* 85 * Based on the setup for the Sangoma SDLA. If changes are 86 * necessary to this structure, a routine will need to be 87 * added to that module to copy fields. 88 */ 89 structfrad_conf 90 { 91 shortstation;
92 shortflags;
93 shortkbaud;
94 shortclocking;
95 shortmtu;
96 shortT391;
97 shortT392;
98 shortN391;
99 shortN392;
100 shortN393;
101 shortCIR_fwd;
102 shortBc_fwd;
103 shortBe_fwd;
104 shortCIR_bwd;
105 shortBc_bwd;
106 shortBe_bwd;
107
108 /* Add new fields here, above is a mirror of the sdla_conf */ 109
110 };
111
112 #defineFRAD_STATION_CPE 0x0000
113 #defineFRAD_STATION_NODE 0x0001
114
115 #define FRAD_TX_IGNORE_CIR 0x0001
116 #define FRAD_RX_ACCOUNT_CIR 0x0002
117 #define FRAD_DROP_ABORTED 0x0004
118 #define FRAD_BUFFERIF 0x0008
119 #define FRAD_STATS 0x0010
120 #define FRAD_MCI 0x0100
121 #define FRAD_AUTODLCI 0x8000
122 #defineFRAD_VALID_FLAGS 0x811F
123
124 #defineFRAD_CLOCK_INT 0x0001
125 #define FRAD_CLOCK_EXT 0x0000
126
127 #ifdef__KERNEL__ 128
129 /* these are the fields of an RFC 1490 header */ 130 structfrhdr 131 { 132 unsignedcharcontrol__attribute__((packed));
133
134 /* for IP packets, this can be the NLPID */ 135 unsignedcharpad__attribute__((packed));
136
137 unsignedcharNLPID__attribute__((packed));
138 unsignedcharOUI[3] __attribute__((packed));
139 unsignedshortPID__attribute__((packed));
140
141 #defineIP_NLPIDpad 142 };
143
144 /* see RFC 1490 for the definition of the following */ 145 #defineFRAD_I_UI 0x03
146
147 #defineFRAD_P_PADDING 0x00
148 #defineFRAD_P_Q933 0x08
149 #defineFRAD_P_SNAP 0x80
150 #defineFRAD_P_CLNP 0x81
151 #defineFRAD_P_IP 0xCC
152
153 structdlci_local 154 { 155 structenet_statisticsstats;
156 structdevice *slave;
157 structdlci_confconfig;
158 intconfigured;
159
160 /* callback function */ 161 void (*receive)(structsk_buff *skb, structdevice *);
162 };
163
164 structfrad_local 165 { 166 structenet_statisticsstats;
167
168 /* devices which this FRAD is slaved to */ 169 structdevice *master[CONFIG_DLCI_MAX];
170 shortdlci[CONFIG_DLCI_MAX];
171
172 structfrad_confconfig;
173 intconfigured; /* has this device been configured */ 174 intinitialized; /* mem_start, port, irq set ? */ 175
176 /* callback functions */ 177 int (*activate)(structdevice *, structdevice *);
178 int (*deactivate)(structdevice *, structdevice *);
179 int (*assoc)(structdevice *, structdevice *);
180 int (*deassoc)(structdevice *, structdevice *);
181 int (*dlci_conf)(structdevice *, structdevice *, intget);
182
183 /* fields that are used by the Sangoma SDLA cards */ 184 structtimer_listtimer;
185 inttype; /* adapter type */ 186 intstate; /* state of the S502/8 control latch */ 187 intbuffer; /* current buffer for S508 firmware */ 188 };
189
190 intregister_frad(constchar *name);
191 intunregister_frad(constchar *name);
192
193 #endif__KERNEL__ 194
195 #endif