Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Lan Emulation client header file |
| 4 | * |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 5 | * Marko Kiiskila <mkiiskila@yahoo.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _LEC_H_ |
| 9 | #define _LEC_H_ |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/atmdev.h> |
| 12 | #include <linux/netdevice.h> |
| 13 | #include <linux/atmlec.h> |
| 14 | |
| 15 | #define LEC_HEADER_LEN 16 |
| 16 | |
| 17 | struct lecdatahdr_8023 { |
Al Viro | 30d492d | 2006-11-14 21:11:29 -0800 | [diff] [blame] | 18 | __be16 le_header; |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 19 | unsigned char h_dest[ETH_ALEN]; |
| 20 | unsigned char h_source[ETH_ALEN]; |
Al Viro | 30d492d | 2006-11-14 21:11:29 -0800 | [diff] [blame] | 21 | __be16 h_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | struct lecdatahdr_8025 { |
Al Viro | 30d492d | 2006-11-14 21:11:29 -0800 | [diff] [blame] | 25 | __be16 le_header; |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 26 | unsigned char ac_pad; |
| 27 | unsigned char fc; |
| 28 | unsigned char h_dest[ETH_ALEN]; |
| 29 | unsigned char h_source[ETH_ALEN]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | }; |
| 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 | * |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 39 | * The third function is intended for the MPOA component sitting on |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ |
| 45 | struct lane2_ops { |
Mitchell Blank Jr | 61c33e0 | 2008-06-17 16:20:06 -0700 | [diff] [blame] | 46 | int (*resolve) (struct net_device *dev, const u8 *dst_mac, int force, |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 47 | u8 **tlvs, u32 *sizeoftlvs); |
Mitchell Blank Jr | 61c33e0 | 2008-06-17 16:20:06 -0700 | [diff] [blame] | 48 | int (*associate_req) (struct net_device *dev, const u8 *lan_dst, |
| 49 | const u8 *tlvs, u32 sizeoftlvs); |
| 50 | void (*associate_indicator) (struct net_device *dev, const u8 *mac_addr, |
| 51 | const u8 *tlvs, u32 sizeoftlvs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | /* |
| 55 | * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType |
YOSHIFUJI Hideaki | f7d5745 | 2007-02-09 23:24:29 +0900 | [diff] [blame] | 56 | * frames. |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 57 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | * 1. Dix Ethernet EtherType frames encoded by placing EtherType |
Alexandra Vintila | 61282f3 | 2012-03-03 16:20:58 +0200 | [diff] [blame] | 59 | * field in h_type field. Data follows immediately after header. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | * 2. LLC Data frames whose total length, including LLC field and data, |
YOSHIFUJI Hideaki | f7d5745 | 2007-02-09 23:24:29 +0900 | [diff] [blame] | 61 | * but not padding required to meet the minimum data frame length, |
Simon Horman | e5c5d22 | 2013-03-28 13:38:25 +0900 | [diff] [blame] | 62 | * is less than ETH_P_802_3_MIN MUST be encoded by placing that length |
Alexandra Vintila | 61282f3 | 2012-03-03 16:20:58 +0200 | [diff] [blame] | 63 | * in the h_type field. The LLC field follows header immediately. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 72 | struct lec_priv { |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 73 | unsigned short lecid; /* Lecid of this client */ |
Chas Williams | d0732f6 | 2006-09-29 17:14:27 -0700 | [diff] [blame] | 74 | struct hlist_head lec_arp_empty_ones; |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 75 | /* Used for storing VCC's that don't have a MAC address attached yet */ |
Chas Williams | d0732f6 | 2006-09-29 17:14:27 -0700 | [diff] [blame] | 76 | struct hlist_head lec_arp_tables[LEC_ARP_TABLE_SIZE]; |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 77 | /* Actual LE ARP table */ |
Chas Williams | d0732f6 | 2006-09-29 17:14:27 -0700 | [diff] [blame] | 78 | struct hlist_head lec_no_forward; |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 79 | /* |
| 80 | * Used for storing VCC's (and forward packets from) which are to |
| 81 | * age out by not using them to forward packets. |
| 82 | * This is because to some LE clients there will be 2 VCCs. Only |
| 83 | * one of them gets used. |
| 84 | */ |
Chas Williams | d0732f6 | 2006-09-29 17:14:27 -0700 | [diff] [blame] | 85 | struct hlist_head mcast_fwds; |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 86 | /* |
| 87 | * With LANEv2 it is possible that BUS (or a special multicast server) |
| 88 | * establishes multiple Multicast Forward VCCs to us. This list |
| 89 | * collects all those VCCs. LANEv1 client has only one item in this |
| 90 | * list. These entries are not aged out. |
| 91 | */ |
| 92 | spinlock_t lec_arp_lock; |
| 93 | struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */ |
| 94 | struct atm_vcc *lecd; |
David Howells | c402895 | 2006-11-22 14:57:56 +0000 | [diff] [blame] | 95 | struct delayed_work lec_arp_work; /* C10 */ |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 96 | unsigned int maximum_unknown_frame_count; |
| 97 | /* |
| 98 | * Within the period of time defined by this variable, the client will send |
| 99 | * no more than C10 frames to BUS for a given unicast destination. (C11) |
| 100 | */ |
| 101 | unsigned long max_unknown_frame_time; |
| 102 | /* |
| 103 | * If no traffic has been sent in this vcc for this period of time, |
| 104 | * vcc will be torn down (C12) |
| 105 | */ |
| 106 | unsigned long vcc_timeout_period; |
| 107 | /* |
| 108 | * An LE Client MUST not retry an LE_ARP_REQUEST for a |
| 109 | * given frame's LAN Destination more than maximum retry count times, |
| 110 | * after the first LEC_ARP_REQUEST (C13) |
| 111 | */ |
| 112 | unsigned short max_retry_count; |
| 113 | /* |
| 114 | * Max time the client will maintain an entry in its arp cache in |
| 115 | * absence of a verification of that relationship (C17) |
| 116 | */ |
| 117 | unsigned long aging_time; |
| 118 | /* |
| 119 | * Max time the client will maintain an entry in cache when |
| 120 | * topology change flag is true (C18) |
| 121 | */ |
| 122 | unsigned long forward_delay_time; /* Topology change flag (C19) */ |
| 123 | int topology_change; |
| 124 | /* |
| 125 | * Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE |
| 126 | * cycle to take (C20) |
| 127 | */ |
| 128 | unsigned long arp_response_time; |
| 129 | /* |
| 130 | * Time limit ot wait to receive an LE_FLUSH_RESPONSE after the |
| 131 | * LE_FLUSH_REQUEST has been sent before taking recover action. (C21) |
| 132 | */ |
| 133 | unsigned long flush_timeout; |
| 134 | /* The time since sending a frame to the bus after which the |
| 135 | * LE Client may assume that the frame has been either discarded or |
| 136 | * delivered to the recipient (C22) |
| 137 | */ |
| 138 | unsigned long path_switching_delay; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 140 | u8 *tlvs; /* LANE2: TLVs are new */ |
| 141 | u32 sizeoftlvs; /* The size of the tlv array in bytes */ |
| 142 | int lane_version; /* LANE2 */ |
| 143 | int itfnum; /* e.g. 2 for lec2, 5 for lec5 */ |
| 144 | struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */ |
| 145 | int is_proxy; /* bridge between ATM and Ethernet */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | struct lec_vcc_priv { |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 149 | void (*old_pop) (struct atm_vcc *vcc, struct sk_buff *skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | int xoff; |
| 151 | }; |
| 152 | |
| 153 | #define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back)) |
| 154 | |
Chas Williams | 1c9d3e7 | 2006-09-29 17:13:24 -0700 | [diff] [blame] | 155 | #endif /* _LEC_H_ */ |