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