blob: 8052641b2ec055d3b395b3df52c5bc79a829d44a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Lan Emulation client header file
3 *
Chas Williams1c9d3e72006-09-29 17:13:24 -07004 * Marko Kiiskila <mkiiskila@yahoo.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 */
6
7#ifndef _LEC_H_
8#define _LEC_H_
9
Chas Williams1c9d3e72006-09-29 17:13:24 -070010#include <linux/config.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/atmdev.h>
12#include <linux/netdevice.h>
13#include <linux/atmlec.h>
14
15#define LEC_HEADER_LEN 16
16
17struct lecdatahdr_8023 {
Chas Williams1c9d3e72006-09-29 17:13:24 -070018 unsigned short le_header;
19 unsigned char h_dest[ETH_ALEN];
20 unsigned char h_source[ETH_ALEN];
21 unsigned short h_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022};
23
24struct lecdatahdr_8025 {
Chas Williams1c9d3e72006-09-29 17:13:24 -070025 unsigned short le_header;
26 unsigned char ac_pad;
27 unsigned char fc;
28 unsigned char h_dest[ETH_ALEN];
29 unsigned char h_source[ETH_ALEN];
Linus Torvalds1da177e2005-04-16 15:20:36 -070030};
31
32#define LEC_MINIMUM_8023_SIZE 62
33#define LEC_MINIMUM_8025_SIZE 16
34
35/*
36 * Operations that LANE2 capable device can do. Two first functions
37 * are used to make the device do things. See spec 3.1.3 and 3.1.4.
38 *
39 * The third function is intented for the MPOA component sitting on
40 * top of the LANE device. The MPOA component assigns it's own function
41 * to (*associate_indicator)() and the LANE device will use that
42 * function to tell about TLVs it sees floating through.
43 *
44 */
45struct lane2_ops {
Chas Williams1c9d3e72006-09-29 17:13:24 -070046 int (*resolve) (struct net_device *dev, u8 *dst_mac, int force,
47 u8 **tlvs, u32 *sizeoftlvs);
48 int (*associate_req) (struct net_device *dev, u8 *lan_dst,
49 u8 *tlvs, u32 sizeoftlvs);
50 void (*associate_indicator) (struct net_device *dev, u8 *mac_addr,
51 u8 *tlvs, u32 sizeoftlvs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052};
53
54/*
55 * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
56 * frames.
Chas Williams1c9d3e72006-09-29 17:13:24 -070057 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 * 1. Dix Ethernet EtherType frames encoded by placing EtherType
59 * field in h_type field. Data follows immediatelly after header.
60 * 2. LLC Data frames whose total length, including LLC field and data,
61 * but not padding required to meet the minimum data frame length,
62 * is less than 1536(0x0600) MUST be encoded by placing that length
63 * in the h_type field. The LLC field follows header immediatelly.
64 * 3. LLC data frames longer than this maximum MUST be encoded by placing
65 * the value 0 in the h_type field.
66 *
67 */
68
69/* Hash table size */
70#define LEC_ARP_TABLE_SIZE 16
71
72struct lec_priv {
Chas Williams1c9d3e72006-09-29 17:13:24 -070073 struct net_device_stats stats;
74 unsigned short lecid; /* Lecid of this client */
Chas Williamsd0732f62006-09-29 17:14:27 -070075 struct hlist_head lec_arp_empty_ones;
Chas Williams1c9d3e72006-09-29 17:13:24 -070076 /* Used for storing VCC's that don't have a MAC address attached yet */
Chas Williamsd0732f62006-09-29 17:14:27 -070077 struct hlist_head lec_arp_tables[LEC_ARP_TABLE_SIZE];
Chas Williams1c9d3e72006-09-29 17:13:24 -070078 /* Actual LE ARP table */
Chas Williamsd0732f62006-09-29 17:14:27 -070079 struct hlist_head lec_no_forward;
Chas Williams1c9d3e72006-09-29 17:13:24 -070080 /*
81 * Used for storing VCC's (and forward packets from) which are to
82 * age out by not using them to forward packets.
83 * This is because to some LE clients there will be 2 VCCs. Only
84 * one of them gets used.
85 */
Chas Williamsd0732f62006-09-29 17:14:27 -070086 struct hlist_head mcast_fwds;
Chas Williams1c9d3e72006-09-29 17:13:24 -070087 /*
88 * With LANEv2 it is possible that BUS (or a special multicast server)
89 * establishes multiple Multicast Forward VCCs to us. This list
90 * collects all those VCCs. LANEv1 client has only one item in this
91 * list. These entries are not aged out.
92 */
93 spinlock_t lec_arp_lock;
94 struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */
95 struct atm_vcc *lecd;
96 struct timer_list lec_arp_timer; /* C10 */
97 unsigned int maximum_unknown_frame_count;
98 /*
99 * Within the period of time defined by this variable, the client will send
100 * no more than C10 frames to BUS for a given unicast destination. (C11)
101 */
102 unsigned long max_unknown_frame_time;
103 /*
104 * If no traffic has been sent in this vcc for this period of time,
105 * vcc will be torn down (C12)
106 */
107 unsigned long vcc_timeout_period;
108 /*
109 * An LE Client MUST not retry an LE_ARP_REQUEST for a
110 * given frame's LAN Destination more than maximum retry count times,
111 * after the first LEC_ARP_REQUEST (C13)
112 */
113 unsigned short max_retry_count;
114 /*
115 * Max time the client will maintain an entry in its arp cache in
116 * absence of a verification of that relationship (C17)
117 */
118 unsigned long aging_time;
119 /*
120 * Max time the client will maintain an entry in cache when
121 * topology change flag is true (C18)
122 */
123 unsigned long forward_delay_time; /* Topology change flag (C19) */
124 int topology_change;
125 /*
126 * Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE
127 * cycle to take (C20)
128 */
129 unsigned long arp_response_time;
130 /*
131 * Time limit ot wait to receive an LE_FLUSH_RESPONSE after the
132 * LE_FLUSH_REQUEST has been sent before taking recover action. (C21)
133 */
134 unsigned long flush_timeout;
135 /* The time since sending a frame to the bus after which the
136 * LE Client may assume that the frame has been either discarded or
137 * delivered to the recipient (C22)
138 */
139 unsigned long path_switching_delay;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140
Chas Williams1c9d3e72006-09-29 17:13:24 -0700141 u8 *tlvs; /* LANE2: TLVs are new */
142 u32 sizeoftlvs; /* The size of the tlv array in bytes */
143 int lane_version; /* LANE2 */
144 int itfnum; /* e.g. 2 for lec2, 5 for lec5 */
145 struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */
146 int is_proxy; /* bridge between ATM and Ethernet */
147 int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148};
149
150struct lec_vcc_priv {
Chas Williams1c9d3e72006-09-29 17:13:24 -0700151 void (*old_pop) (struct atm_vcc *vcc, struct sk_buff *skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 int xoff;
153};
154
155#define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back))
156
Chas Williams1c9d3e72006-09-29 17:13:24 -0700157#endif /* _LEC_H_ */