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