new retransmit part 3
[cor_2_6_31.git] / include / linux / if_frad.h
blob673f2209453d9e2237a15d848e29ff9ae2381f21
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 its RFC1490 encapsulation alongside the current
7 * implementation for the Sangoma cards.
9 * Version: @(#)if_ifrad.h 0.15 31 Mar 96
11 * Author: Mike McLagan <mike.mclagan@linux.org>
13 * Changes:
14 * 0.15 Mike McLagan changed structure defs (packed)
15 * re-arranged flags
16 * added DLCI_RET vars
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.
24 #ifndef _FRAD_H_
25 #define _FRAD_H_
27 #include <linux/if.h>
29 /* Structures and constants associated with the DLCI device driver */
31 struct dlci_add
33 char devname[IFNAMSIZ];
34 short dlci;
37 #define DLCI_GET_CONF (SIOCDEVPRIVATE + 2)
38 #define DLCI_SET_CONF (SIOCDEVPRIVATE + 3)
40 /*
41 * These are related to the Sangoma SDLA and should remain in order.
42 * Code within the SDLA module is based on the specifics of this
43 * structure. Change at your own peril.
45 struct dlci_conf {
46 short flags;
47 short CIR_fwd;
48 short Bc_fwd;
49 short Be_fwd;
50 short CIR_bwd;
51 short Bc_bwd;
52 short Be_bwd;
54 /* these are part of the status read */
55 short Tc_fwd;
56 short Tc_bwd;
57 short Tf_max;
58 short Tb_max;
60 /* add any new fields here above is a mirror of sdla_dlci_conf */
63 #define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
65 /* configuration flags for DLCI */
66 #define DLCI_IGNORE_CIR_OUT 0x0001
67 #define DLCI_ACCOUNT_CIR_IN 0x0002
68 #define DLCI_BUFFER_IF 0x0008
70 #define DLCI_VALID_FLAGS 0x000B
72 /* FRAD driver uses these to indicate what it did with packet */
73 #define DLCI_RET_OK 0x00
74 #define DLCI_RET_ERR 0x01
75 #define DLCI_RET_DROP 0x02
77 /* defines for the actual Frame Relay hardware */
78 #define FRAD_GET_CONF (SIOCDEVPRIVATE)
79 #define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
81 #define FRAD_LAST_IOCTL FRAD_SET_CONF
84 * Based on the setup for the Sangoma SDLA. If changes are
85 * necessary to this structure, a routine will need to be
86 * added to that module to copy fields.
88 struct frad_conf
90 short station;
91 short flags;
92 short kbaud;
93 short clocking;
94 short mtu;
95 short T391;
96 short T392;
97 short N391;
98 short N392;
99 short N393;
100 short CIR_fwd;
101 short Bc_fwd;
102 short Be_fwd;
103 short CIR_bwd;
104 short Bc_bwd;
105 short Be_bwd;
107 /* Add new fields here, above is a mirror of the sdla_conf */
111 #define FRAD_STATION_CPE 0x0000
112 #define FRAD_STATION_NODE 0x0001
114 #define FRAD_TX_IGNORE_CIR 0x0001
115 #define FRAD_RX_ACCOUNT_CIR 0x0002
116 #define FRAD_DROP_ABORTED 0x0004
117 #define FRAD_BUFFERIF 0x0008
118 #define FRAD_STATS 0x0010
119 #define FRAD_MCI 0x0100
120 #define FRAD_AUTODLCI 0x8000
121 #define FRAD_VALID_FLAGS 0x811F
123 #define FRAD_CLOCK_INT 0x0001
124 #define FRAD_CLOCK_EXT 0x0000
126 #ifdef __KERNEL__
128 #if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
130 /* these are the fields of an RFC 1490 header */
131 struct frhdr
133 unsigned char control;
135 /* for IP packets, this can be the NLPID */
136 unsigned char pad;
138 unsigned char NLPID;
139 unsigned char OUI[3];
140 __be16 PID;
142 #define IP_NLPID pad
143 } __attribute__((packed));
145 /* see RFC 1490 for the definition of the following */
146 #define FRAD_I_UI 0x03
148 #define FRAD_P_PADDING 0x00
149 #define FRAD_P_Q933 0x08
150 #define FRAD_P_SNAP 0x80
151 #define FRAD_P_CLNP 0x81
152 #define FRAD_P_IP 0xCC
154 struct dlci_local
156 struct net_device *master;
157 struct net_device *slave;
158 struct dlci_conf config;
159 int configured;
160 struct list_head list;
162 /* callback function */
163 void (*receive)(struct sk_buff *skb, struct net_device *);
166 struct frad_local
168 struct net_device_stats stats;
170 /* devices which this FRAD is slaved to */
171 struct net_device *master[CONFIG_DLCI_MAX];
172 short dlci[CONFIG_DLCI_MAX];
174 struct frad_conf config;
175 int configured; /* has this device been configured */
176 int initialized; /* mem_start, port, irq set ? */
178 /* callback functions */
179 int (*activate)(struct net_device *, struct net_device *);
180 int (*deactivate)(struct net_device *, struct net_device *);
181 int (*assoc)(struct net_device *, struct net_device *);
182 int (*deassoc)(struct net_device *, struct net_device *);
183 int (*dlci_conf)(struct net_device *, struct net_device *, int get);
185 /* fields that are used by the Sangoma SDLA cards */
186 struct timer_list timer;
187 int type; /* adapter type */
188 int state; /* state of the S502/8 control latch */
189 int buffer; /* current buffer for S508 firmware */
192 #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
194 extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
196 #endif /* __KERNEL__ */
198 #endif