blob: 3c94b1736570157b0e81d87c6ec86640305e1633 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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.
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#include <linux/config.h>
28#include <linux/if.h>
29
30#if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
31
32/* Structures and constants associated with the DLCI device driver */
33
34struct dlci_add
35{
36 char devname[IFNAMSIZ];
37 short dlci;
38};
39
40#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2)
41#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3)
42
43/*
44 * These are related to the Sangoma SDLA and should remain in order.
45 * Code within the SDLA module is based on the specifics of this
46 * structure. Change at your own peril.
47 */
48struct dlci_conf {
49 short flags;
50 short CIR_fwd;
51 short Bc_fwd;
52 short Be_fwd;
53 short CIR_bwd;
54 short Bc_bwd;
55 short Be_bwd;
56
57/* these are part of the status read */
58 short Tc_fwd;
59 short Tc_bwd;
60 short Tf_max;
61 short Tb_max;
62
63/* add any new fields here above is a mirror of sdla_dlci_conf */
64};
65
66#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
67
68/* configuration flags for DLCI */
69#define DLCI_IGNORE_CIR_OUT 0x0001
70#define DLCI_ACCOUNT_CIR_IN 0x0002
71#define DLCI_BUFFER_IF 0x0008
72
73#define DLCI_VALID_FLAGS 0x000B
74
75/* FRAD driver uses these to indicate what it did with packet */
76#define DLCI_RET_OK 0x00
77#define DLCI_RET_ERR 0x01
78#define DLCI_RET_DROP 0x02
79
80/* defines for the actual Frame Relay hardware */
81#define FRAD_GET_CONF (SIOCDEVPRIVATE)
82#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
83
84#define FRAD_LAST_IOCTL FRAD_SET_CONF
85
86/*
87 * Based on the setup for the Sangoma SDLA. If changes are
88 * necessary to this structure, a routine will need to be
89 * added to that module to copy fields.
90 */
91struct frad_conf
92{
93 short station;
94 short flags;
95 short kbaud;
96 short clocking;
97 short mtu;
98 short T391;
99 short T392;
100 short N391;
101 short N392;
102 short N393;
103 short CIR_fwd;
104 short Bc_fwd;
105 short Be_fwd;
106 short CIR_bwd;
107 short Bc_bwd;
108 short Be_bwd;
109
110/* Add new fields here, above is a mirror of the sdla_conf */
111
112};
113
114#define FRAD_STATION_CPE 0x0000
115#define FRAD_STATION_NODE 0x0001
116
117#define FRAD_TX_IGNORE_CIR 0x0001
118#define FRAD_RX_ACCOUNT_CIR 0x0002
119#define FRAD_DROP_ABORTED 0x0004
120#define FRAD_BUFFERIF 0x0008
121#define FRAD_STATS 0x0010
122#define FRAD_MCI 0x0100
123#define FRAD_AUTODLCI 0x8000
124#define FRAD_VALID_FLAGS 0x811F
125
126#define FRAD_CLOCK_INT 0x0001
127#define FRAD_CLOCK_EXT 0x0000
128
129#ifdef __KERNEL__
130
131/* these are the fields of an RFC 1490 header */
132struct frhdr
133{
134 unsigned char control __attribute__((packed));
135
136 /* for IP packets, this can be the NLPID */
137 unsigned char pad __attribute__((packed));
138
139 unsigned char NLPID __attribute__((packed));
140 unsigned char OUI[3] __attribute__((packed));
141 unsigned short PID __attribute__((packed));
142
143#define IP_NLPID pad
144};
145
146/* see RFC 1490 for the definition of the following */
147#define FRAD_I_UI 0x03
148
149#define FRAD_P_PADDING 0x00
150#define FRAD_P_Q933 0x08
151#define FRAD_P_SNAP 0x80
152#define FRAD_P_CLNP 0x81
153#define FRAD_P_IP 0xCC
154
155struct dlci_local
156{
157 struct net_device_stats stats;
158 struct net_device *master;
159 struct net_device *slave;
160 struct dlci_conf config;
161 int configured;
162 struct list_head list;
163
164 /* callback function */
165 void (*receive)(struct sk_buff *skb, struct net_device *);
166};
167
168struct frad_local
169{
170 struct net_device_stats stats;
171
172 /* devices which this FRAD is slaved to */
173 struct net_device *master[CONFIG_DLCI_MAX];
174 short dlci[CONFIG_DLCI_MAX];
175
176 struct frad_conf config;
177 int configured; /* has this device been configured */
178 int initialized; /* mem_start, port, irq set ? */
179
180 /* callback functions */
181 int (*activate)(struct net_device *, struct net_device *);
182 int (*deactivate)(struct net_device *, struct net_device *);
183 int (*assoc)(struct net_device *, struct net_device *);
184 int (*deassoc)(struct net_device *, struct net_device *);
185 int (*dlci_conf)(struct net_device *, struct net_device *, int get);
186
187 /* fields that are used by the Sangoma SDLA cards */
188 struct timer_list timer;
189 int type; /* adapter type */
190 int state; /* state of the S502/8 control latch */
191 int buffer; /* current buffer for S508 firmware */
192};
193
194extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
195
196#endif /* __KERNEL__ */
197
198#endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
199
200#endif