| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. | 
 | 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 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <linux/if.h> | 
 | 28 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | /* Structures and constants associated with the DLCI device driver */ | 
 | 30 |  | 
 | 31 | struct dlci_add | 
 | 32 | { | 
 | 33 |    char  devname[IFNAMSIZ]; | 
 | 34 |    short dlci; | 
 | 35 | }; | 
 | 36 |  | 
 | 37 | #define DLCI_GET_CONF	(SIOCDEVPRIVATE + 2) | 
 | 38 | #define DLCI_SET_CONF	(SIOCDEVPRIVATE + 3) | 
 | 39 |  | 
 | 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. | 
 | 44 |  */ | 
 | 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;  | 
 | 53 |  | 
 | 54 | /* these are part of the status read */ | 
 | 55 |    short Tc_fwd; | 
 | 56 |    short Tc_bwd; | 
 | 57 |    short Tf_max; | 
 | 58 |    short Tb_max; | 
 | 59 |  | 
 | 60 | /* add any new fields here above is a mirror of sdla_dlci_conf */ | 
 | 61 | }; | 
 | 62 |  | 
 | 63 | #define DLCI_GET_SLAVE	(SIOCDEVPRIVATE + 4) | 
 | 64 |  | 
 | 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 | 
 | 69 |  | 
 | 70 | #define DLCI_VALID_FLAGS	0x000B | 
 | 71 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | /* defines for the actual Frame Relay hardware */ | 
 | 73 | #define FRAD_GET_CONF	(SIOCDEVPRIVATE) | 
 | 74 | #define FRAD_SET_CONF	(SIOCDEVPRIVATE + 1) | 
 | 75 |  | 
 | 76 | #define FRAD_LAST_IOCTL	FRAD_SET_CONF | 
 | 77 |  | 
 | 78 | /* | 
 | 79 |  * Based on the setup for the Sangoma SDLA.  If changes are  | 
 | 80 |  * necessary to this structure, a routine will need to be  | 
 | 81 |  * added to that module to copy fields. | 
 | 82 |  */ | 
 | 83 | struct frad_conf  | 
 | 84 | { | 
 | 85 |    short station; | 
 | 86 |    short flags; | 
 | 87 |    short kbaud; | 
 | 88 |    short clocking; | 
 | 89 |    short mtu; | 
 | 90 |    short T391; | 
 | 91 |    short T392; | 
 | 92 |    short N391; | 
 | 93 |    short N392; | 
 | 94 |    short N393; | 
 | 95 |    short CIR_fwd; | 
 | 96 |    short Bc_fwd; | 
 | 97 |    short Be_fwd; | 
 | 98 |    short CIR_bwd; | 
 | 99 |    short Bc_bwd; | 
 | 100 |    short Be_bwd; | 
 | 101 |  | 
 | 102 | /* Add new fields here, above is a mirror of the sdla_conf */ | 
 | 103 |  | 
 | 104 | }; | 
 | 105 |  | 
 | 106 | #define FRAD_STATION_CPE	0x0000 | 
 | 107 | #define FRAD_STATION_NODE	0x0001 | 
 | 108 |  | 
 | 109 | #define FRAD_TX_IGNORE_CIR	0x0001 | 
 | 110 | #define FRAD_RX_ACCOUNT_CIR	0x0002 | 
 | 111 | #define FRAD_DROP_ABORTED	0x0004 | 
 | 112 | #define FRAD_BUFFERIF		0x0008 | 
 | 113 | #define FRAD_STATS		0x0010 | 
 | 114 | #define FRAD_MCI		0x0100 | 
 | 115 | #define FRAD_AUTODLCI		0x8000 | 
 | 116 | #define FRAD_VALID_FLAGS	0x811F | 
 | 117 |  | 
 | 118 | #define FRAD_CLOCK_INT		0x0001 | 
 | 119 | #define FRAD_CLOCK_EXT		0x0000 | 
 | 120 |  | 
 | 121 | #ifdef __KERNEL__ | 
 | 122 |  | 
| Krzysztof Hałasa | 3121a48 | 2009-01-26 12:30:12 -0800 | [diff] [blame] | 123 | #if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE) | 
 | 124 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | /* these are the fields of an RFC 1490 header */ | 
 | 126 | struct frhdr | 
 | 127 | { | 
| Jan Blunck | 6a87818 | 2006-01-08 01:05:07 -0800 | [diff] [blame] | 128 |    unsigned char  control; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 |  | 
 | 130 |    /* for IP packets, this can be the NLPID */ | 
| Jan Blunck | 6a87818 | 2006-01-08 01:05:07 -0800 | [diff] [blame] | 131 |    unsigned char  pad; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 |  | 
| Jan Blunck | 6a87818 | 2006-01-08 01:05:07 -0800 | [diff] [blame] | 133 |    unsigned char  NLPID; | 
 | 134 |    unsigned char  OUI[3]; | 
| Al Viro | 9045840 | 2007-12-22 17:52:52 +0000 | [diff] [blame] | 135 |    __be16 PID; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 |  | 
 | 137 | #define IP_NLPID pad  | 
| Eric Dumazet | bc10502 | 2010-06-03 03:21:52 -0700 | [diff] [blame] | 138 | } __packed; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 |  | 
 | 140 | /* see RFC 1490 for the definition of the following */ | 
 | 141 | #define FRAD_I_UI		0x03 | 
 | 142 |  | 
 | 143 | #define FRAD_P_PADDING		0x00 | 
 | 144 | #define FRAD_P_Q933		0x08 | 
 | 145 | #define FRAD_P_SNAP		0x80 | 
 | 146 | #define FRAD_P_CLNP		0x81 | 
 | 147 | #define FRAD_P_IP		0xCC | 
 | 148 |  | 
 | 149 | struct dlci_local | 
 | 150 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 |    struct net_device      *master; | 
 | 152 |    struct net_device      *slave; | 
 | 153 |    struct dlci_conf       config; | 
 | 154 |    int                    configured; | 
 | 155 |    struct list_head	  list; | 
 | 156 |  | 
 | 157 |    /* callback function */ | 
 | 158 |    void              (*receive)(struct sk_buff *skb, struct net_device *); | 
 | 159 | }; | 
 | 160 |  | 
 | 161 | struct frad_local | 
 | 162 | { | 
 | 163 |    struct net_device_stats stats; | 
 | 164 |  | 
 | 165 |    /* devices which this FRAD is slaved to */ | 
 | 166 |    struct net_device     *master[CONFIG_DLCI_MAX]; | 
 | 167 |    short             dlci[CONFIG_DLCI_MAX]; | 
 | 168 |  | 
 | 169 |    struct frad_conf  config; | 
 | 170 |    int               configured;	/* has this device been configured */ | 
 | 171 |    int               initialized;	/* mem_start, port, irq set ? */ | 
 | 172 |  | 
 | 173 |    /* callback functions */ | 
 | 174 |    int               (*activate)(struct net_device *, struct net_device *); | 
 | 175 |    int               (*deactivate)(struct net_device *, struct net_device *); | 
 | 176 |    int               (*assoc)(struct net_device *, struct net_device *); | 
 | 177 |    int               (*deassoc)(struct net_device *, struct net_device *); | 
 | 178 |    int               (*dlci_conf)(struct net_device *, struct net_device *, int get); | 
 | 179 |  | 
 | 180 |    /* fields that are used by the Sangoma SDLA cards */ | 
 | 181 |    struct timer_list timer; | 
 | 182 |    int               type;		/* adapter type */ | 
 | 183 |    int               state;		/* state of the S502/8 control latch */ | 
 | 184 |    int               buffer;		/* current buffer for S508 firmware */ | 
 | 185 | }; | 
 | 186 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */ | 
 | 188 |  | 
| Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 189 | extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)); | 
| Krzysztof Hałasa | 3121a48 | 2009-01-26 12:30:12 -0800 | [diff] [blame] | 190 |  | 
 | 191 | #endif /* __KERNEL__ */ | 
| Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 192 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | #endif |