3 * Lan Emulation client header file
5 * Marko Kiiskila mkiiskila@yahoo.com
12 #include <linux/config.h>
13 #include <linux/atmdev.h>
14 #include <linux/netdevice.h>
15 #include <linux/atmlec.h>
17 #if defined (CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
18 #include <linux/if_bridge.h>
20 extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
22 extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
23 #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
25 #define LEC_HEADER_LEN 16
27 struct lecdatahdr_8023 {
28 unsigned short le_header;
29 unsigned char h_dest[ETH_ALEN];
30 unsigned char h_source[ETH_ALEN];
31 unsigned short h_type;
34 struct lecdatahdr_8025 {
35 unsigned short le_header;
38 unsigned char h_dest[ETH_ALEN];
39 unsigned char h_source[ETH_ALEN];
42 #define LEC_MINIMUM_8023_SIZE 62
43 #define LEC_MINIMUM_8025_SIZE 16
46 * Operations that LANE2 capable device can do. Two first functions
47 * are used to make the device do things. See spec 3.1.3 and 3.1.4.
49 * The third function is intented for the MPOA component sitting on
50 * top of the LANE device. The MPOA component assigns it's own function
51 * to (*associate_indicator)() and the LANE device will use that
52 * function to tell about TLVs it sees floating through.
56 int (*resolve)(struct net_device *dev, u8 *dst_mac, int force,
57 u8 **tlvs, u32 *sizeoftlvs);
58 int (*associate_req)(struct net_device *dev, u8 *lan_dst,
59 u8 *tlvs, u32 sizeoftlvs);
60 void (*associate_indicator)(struct net_device *dev, u8 *mac_addr,
61 u8 *tlvs, u32 sizeoftlvs);
65 * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
67 * 1. Dix Ethernet EtherType frames encoded by placing EtherType
68 * field in h_type field. Data follows immediatelly after header.
69 * 2. LLC Data frames whose total length, including LLC field and data,
70 * but not padding required to meet the minimum data frame length,
71 * is less than 1536(0x0600) MUST be encoded by placing that length
72 * in the h_type field. The LLC field follows header immediatelly.
73 * 3. LLC data frames longer than this maximum MUST be encoded by placing
74 * the value 0 in the h_type field.
79 #define LEC_ARP_TABLE_SIZE 16
82 struct net_device_stats stats;
83 unsigned short lecid; /* Lecid of this client */
84 struct lec_arp_table *lec_arp_empty_ones;
85 /* Used for storing VCC's that don't have a MAC address attached yet */
86 struct lec_arp_table *lec_arp_tables[LEC_ARP_TABLE_SIZE];
87 /* Actual LE ARP table */
88 struct lec_arp_table *lec_no_forward;
89 /* Used for storing VCC's (and forward packets from) which are to
90 age out by not using them to forward packets.
91 This is because to some LE clients there will be 2 VCCs. Only
92 one of them gets used. */
93 struct lec_arp_table *mcast_fwds;
94 /* With LANEv2 it is possible that BUS (or a special multicast server)
95 establishes multiple Multicast Forward VCCs to us. This list
96 collects all those VCCs. LANEv1 client has only one item in this
97 list. These entries are not aged out. */
98 spinlock_t lec_arp_lock;
99 struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */
100 struct atm_vcc *lecd;
101 struct timer_list lec_arp_timer;
103 unsigned int maximum_unknown_frame_count;
104 /* Within the period of time defined by this variable, the client will send
105 no more than C10 frames to BUS for a given unicast destination. (C11) */
106 unsigned long max_unknown_frame_time;
107 /* If no traffic has been sent in this vcc for this period of time,
108 vcc will be torn down (C12)*/
109 unsigned long vcc_timeout_period;
110 /* An LE Client MUST not retry an LE_ARP_REQUEST for a
111 given frame's LAN Destination more than maximum retry count times,
112 after the first LEC_ARP_REQUEST (C13)*/
113 unsigned short max_retry_count;
114 /* Max time the client will maintain an entry in its arp cache in
115 absence of a verification of that relationship (C17)*/
116 unsigned long aging_time;
117 /* Max time the client will maintain an entry in cache when
118 topology change flag is true (C18) */
119 unsigned long forward_delay_time;
120 /* Topology change flag (C19)*/
122 /* Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE
123 cycle to take (C20)*/
124 unsigned long arp_response_time;
125 /* Time limit ot wait to receive an LE_FLUSH_RESPONSE after the
126 LE_FLUSH_REQUEST has been sent before taking recover action. (C21)*/
127 unsigned long flush_timeout;
128 /* The time since sending a frame to the bus after which the
129 LE Client may assume that the frame has been either discarded or
130 delivered to the recipient (C22) */
131 unsigned long path_switching_delay;
133 u8 *tlvs; /* LANE2: TLVs are new */
134 u32 sizeoftlvs; /* The size of the tlv array in bytes */
135 int lane_version; /* LANE2 */
136 int itfnum; /* e.g. 2 for lec2, 5 for lec5 */
137 struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */
138 int is_proxy; /* bridge between ATM and Ethernet */
139 int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */
142 struct lec_vcc_priv {
143 void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb);
147 #define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back))
149 int lecd_attach(struct atm_vcc *vcc, int arg);
150 int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg);
151 int lec_mcast_attach(struct atm_vcc *vcc, int arg);
152 struct net_device *get_dev_lec(int itf);
153 int send_to_lecd(struct lec_priv *priv,
154 atmlec_msg_type type, unsigned char *mac_addr,
155 unsigned char *atm_addr, struct sk_buff *data);
156 void lec_push(struct atm_vcc *vcc, struct sk_buff *skb);