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