blob: 4149db1b7885127db5a3518bf5c944ab5ba9728f [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/atmdev.h>
11#include <linux/netdevice.h>
12#include <linux/atmlec.h>
13
14#define LEC_HEADER_LEN 16
15
16struct lecdatahdr_8023 {
Al Viro30d492d2006-11-14 21:11:29 -080017 __be16 le_header;
Chas Williams1c9d3e72006-09-29 17:13:24 -070018 unsigned char h_dest[ETH_ALEN];
19 unsigned char h_source[ETH_ALEN];
Al Viro30d492d2006-11-14 21:11:29 -080020 __be16 h_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -070021};
22
23struct lecdatahdr_8025 {
Al Viro30d492d2006-11-14 21:11:29 -080024 __be16 le_header;
Chas Williams1c9d3e72006-09-29 17:13:24 -070025 unsigned char ac_pad;
26 unsigned char fc;
27 unsigned char h_dest[ETH_ALEN];
28 unsigned char h_source[ETH_ALEN];
Linus Torvalds1da177e2005-04-16 15:20:36 -070029};
30
31#define LEC_MINIMUM_8023_SIZE 62
32#define LEC_MINIMUM_8025_SIZE 16
33
34/*
35 * Operations that LANE2 capable device can do. Two first functions
36 * are used to make the device do things. See spec 3.1.3 and 3.1.4.
37 *
Lucas De Marchi25985ed2011-03-30 22:57:33 -030038 * The third function is intended for the MPOA component sitting on
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 * top of the LANE device. The MPOA component assigns it's own function
40 * to (*associate_indicator)() and the LANE device will use that
41 * function to tell about TLVs it sees floating through.
42 *
43 */
44struct lane2_ops {
Mitchell Blank Jr61c33e02008-06-17 16:20:06 -070045 int (*resolve) (struct net_device *dev, const u8 *dst_mac, int force,
Chas Williams1c9d3e72006-09-29 17:13:24 -070046 u8 **tlvs, u32 *sizeoftlvs);
Mitchell Blank Jr61c33e02008-06-17 16:20:06 -070047 int (*associate_req) (struct net_device *dev, const u8 *lan_dst,
48 const u8 *tlvs, u32 sizeoftlvs);
49 void (*associate_indicator) (struct net_device *dev, const u8 *mac_addr,
50 const u8 *tlvs, u32 sizeoftlvs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
53/*
54 * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090055 * frames.
Chas Williams1c9d3e72006-09-29 17:13:24 -070056 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 * 1. Dix Ethernet EtherType frames encoded by placing EtherType
Alexandra Vintila61282f32012-03-03 16:20:58 +020058 * field in h_type field. Data follows immediately after header.
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 * 2. LLC Data frames whose total length, including LLC field and data,
YOSHIFUJI Hideakif7d57452007-02-09 23:24:29 +090060 * but not padding required to meet the minimum data frame length,
Simon Hormane5c5d222013-03-28 13:38:25 +090061 * is less than ETH_P_802_3_MIN MUST be encoded by placing that length
Alexandra Vintila61282f32012-03-03 16:20:58 +020062 * in the h_type field. The LLC field follows header immediately.
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 * 3. LLC data frames longer than this maximum MUST be encoded by placing
64 * the value 0 in the h_type field.
65 *
66 */
67
68/* Hash table size */
69#define LEC_ARP_TABLE_SIZE 16
70
71struct lec_priv {
Chas Williams1c9d3e72006-09-29 17:13:24 -070072 unsigned short lecid; /* Lecid of this client */
Chas Williamsd0732f62006-09-29 17:14:27 -070073 struct hlist_head lec_arp_empty_ones;
Chas Williams1c9d3e72006-09-29 17:13:24 -070074 /* Used for storing VCC's that don't have a MAC address attached yet */
Chas Williamsd0732f62006-09-29 17:14:27 -070075 struct hlist_head lec_arp_tables[LEC_ARP_TABLE_SIZE];
Chas Williams1c9d3e72006-09-29 17:13:24 -070076 /* Actual LE ARP table */
Chas Williamsd0732f62006-09-29 17:14:27 -070077 struct hlist_head lec_no_forward;
Chas Williams1c9d3e72006-09-29 17:13:24 -070078 /*
79 * Used for storing VCC's (and forward packets from) which are to
80 * age out by not using them to forward packets.
81 * This is because to some LE clients there will be 2 VCCs. Only
82 * one of them gets used.
83 */
Chas Williamsd0732f62006-09-29 17:14:27 -070084 struct hlist_head mcast_fwds;
Chas Williams1c9d3e72006-09-29 17:13:24 -070085 /*
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 */
91 spinlock_t lec_arp_lock;
92 struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */
93 struct atm_vcc *lecd;
David Howellsc4028952006-11-22 14:57:56 +000094 struct delayed_work lec_arp_work; /* C10 */
Chas Williams1c9d3e72006-09-29 17:13:24 -070095 unsigned int maximum_unknown_frame_count;
96 /*
97 * Within the period of time defined by this variable, the client will send
98 * no more than C10 frames to BUS for a given unicast destination. (C11)
99 */
100 unsigned long max_unknown_frame_time;
101 /*
102 * If no traffic has been sent in this vcc for this period of time,
103 * vcc will be torn down (C12)
104 */
105 unsigned long vcc_timeout_period;
106 /*
107 * An LE Client MUST not retry an LE_ARP_REQUEST for a
108 * given frame's LAN Destination more than maximum retry count times,
109 * after the first LEC_ARP_REQUEST (C13)
110 */
111 unsigned short max_retry_count;
112 /*
113 * Max time the client will maintain an entry in its arp cache in
114 * absence of a verification of that relationship (C17)
115 */
116 unsigned long aging_time;
117 /*
118 * Max time the client will maintain an entry in cache when
119 * topology change flag is true (C18)
120 */
121 unsigned long forward_delay_time; /* Topology change flag (C19) */
122 int topology_change;
123 /*
124 * Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE
125 * cycle to take (C20)
126 */
127 unsigned long arp_response_time;
128 /*
129 * Time limit ot wait to receive an LE_FLUSH_RESPONSE after the
130 * LE_FLUSH_REQUEST has been sent before taking recover action. (C21)
131 */
132 unsigned long flush_timeout;
133 /* The time since sending a frame to the bus after which the
134 * LE Client may assume that the frame has been either discarded or
135 * delivered to the recipient (C22)
136 */
137 unsigned long path_switching_delay;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
Chas Williams1c9d3e72006-09-29 17:13:24 -0700139 u8 *tlvs; /* LANE2: TLVs are new */
140 u32 sizeoftlvs; /* The size of the tlv array in bytes */
141 int lane_version; /* LANE2 */
142 int itfnum; /* e.g. 2 for lec2, 5 for lec5 */
143 struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */
144 int is_proxy; /* bridge between ATM and Ethernet */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145};
146
147struct lec_vcc_priv {
Chas Williams1c9d3e72006-09-29 17:13:24 -0700148 void (*old_pop) (struct atm_vcc *vcc, struct sk_buff *skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 int xoff;
150};
151
152#define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back))
153
Chas Williams1c9d3e72006-09-29 17:13:24 -0700154#endif /* _LEC_H_ */