1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are 4 * created for each DLCI associated with a FRAD. The FRAD driver 5 * is not truly a network device, but the lower level device 6 * handler. This allows other FRAD manufacturers to use the DLCI 7 * code, including its RFC1490 encapsulation alongside the current 8 * implementation for the Sangoma cards. 9 * 10 * Version: @(#)if_ifrad.h 0.15 31 Mar 96 11 * 12 * Author: Mike McLagan <mike.mclagan@linux.org> 13 * 14 * Changes: 15 * 0.15 Mike McLagan changed structure defs (packed) 16 * re-arranged flags 17 * added DLCI_RET vars 18 */ 19 #ifndef _FRAD_H_ 20 #define _FRAD_H_ 21 22 #include <uapi/linux/if_frad.h> 23 24 25 #if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE) 26 27 /* these are the fields of an RFC 1490 header */ 28 struct frhdr 29 { 30 unsigned char control; 31 32 /* for IP packets, this can be the NLPID */ 33 unsigned char pad; 34 35 unsigned char NLPID; 36 unsigned char OUI[3]; 37 __be16 PID; 38 39 #define IP_NLPID pad 40 } __packed; 41 42 /* see RFC 1490 for the definition of the following */ 43 #define FRAD_I_UI 0x03 44 45 #define FRAD_P_PADDING 0x00 46 #define FRAD_P_Q933 0x08 47 #define FRAD_P_SNAP 0x80 48 #define FRAD_P_CLNP 0x81 49 #define FRAD_P_IP 0xCC 50 51 struct dlci_local 52 { 53 struct net_device *master; 54 struct net_device *slave; 55 struct dlci_conf config; 56 int configured; 57 struct list_head list; 58 59 /* callback function */ 60 void (*receive)(struct sk_buff *skb, struct net_device *); 61 }; 62 63 struct frad_local 64 { 65 /* devices which this FRAD is slaved to */ 66 struct net_device *master[CONFIG_DLCI_MAX]; 67 short dlci[CONFIG_DLCI_MAX]; 68 69 struct frad_conf config; 70 int configured; /* has this device been configured */ 71 int initialized; /* mem_start, port, irq set ? */ 72 73 /* callback functions */ 74 int (*activate)(struct net_device *, struct net_device *); 75 int (*deactivate)(struct net_device *, struct net_device *); 76 int (*assoc)(struct net_device *, struct net_device *); 77 int (*deassoc)(struct net_device *, struct net_device *); 78 int (*dlci_conf)(struct net_device *, struct net_device *, int get); 79 80 /* fields that are used by the Sangoma SDLA cards */ 81 struct timer_list timer; 82 struct net_device *dev; 83 int type; /* adapter type */ 84 int state; /* state of the S502/8 control latch */ 85 int buffer; /* current buffer for S508 firmware */ 86 }; 87 88 #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */ 89 90 extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)); 91 92 #endif 93