/* SPDX-License-Identifier: GPL-2.0 */1/*2* Lan Emulation client header file3*4* Marko Kiiskila <[email protected]>5*/67#ifndef _LEC_H_8#define _LEC_H_910#include <linux/atmdev.h>11#include <linux/netdevice.h>12#include <linux/atmlec.h>1314#define LEC_HEADER_LEN 161516struct lecdatahdr_8023 {17__be16 le_header;18unsigned char h_dest[ETH_ALEN];19unsigned char h_source[ETH_ALEN];20__be16 h_type;21};2223struct lecdatahdr_8025 {24__be16 le_header;25unsigned char ac_pad;26unsigned char fc;27unsigned char h_dest[ETH_ALEN];28unsigned char h_source[ETH_ALEN];29};3031#define LEC_MINIMUM_8023_SIZE 6232#define LEC_MINIMUM_8025_SIZE 163334/*35* Operations that LANE2 capable device can do. Two first functions36* are used to make the device do things. See spec 3.1.3 and 3.1.4.37*38* The third function is intended for the MPOA component sitting on39* top of the LANE device. The MPOA component assigns it's own function40* to (*associate_indicator)() and the LANE device will use that41* function to tell about TLVs it sees floating through.42*43*/44struct lane2_ops {45int (*resolve) (struct net_device *dev, const u8 *dst_mac, int force,46u8 **tlvs, u32 *sizeoftlvs);47int (*associate_req) (struct net_device *dev, const u8 *lan_dst,48const u8 *tlvs, u32 sizeoftlvs);49void (*associate_indicator) (struct net_device *dev, const u8 *mac_addr,50const u8 *tlvs, u32 sizeoftlvs);51};5253/*54* ATM LAN Emulation supports both LLC & Dix Ethernet EtherType55* frames.56*57* 1. Dix Ethernet EtherType frames encoded by placing EtherType58* field in h_type field. Data follows immediately after header.59* 2. LLC Data frames whose total length, including LLC field and data,60* but not padding required to meet the minimum data frame length,61* is less than ETH_P_802_3_MIN MUST be encoded by placing that length62* in the h_type field. The LLC field follows header immediately.63* 3. LLC data frames longer than this maximum MUST be encoded by placing64* the value 0 in the h_type field.65*66*/6768/* Hash table size */69#define LEC_ARP_TABLE_SIZE 167071struct lec_priv {72unsigned short lecid; /* Lecid of this client */73struct hlist_head lec_arp_empty_ones;74/* Used for storing VCC's that don't have a MAC address attached yet */75struct hlist_head lec_arp_tables[LEC_ARP_TABLE_SIZE];76/* Actual LE ARP table */77struct hlist_head lec_no_forward;78/*79* Used for storing VCC's (and forward packets from) which are to80* age out by not using them to forward packets.81* This is because to some LE clients there will be 2 VCCs. Only82* one of them gets used.83*/84struct hlist_head mcast_fwds;85/*86* With LANEv2 it is possible that BUS (or a special multicast server)87* establishes multiple Multicast Forward VCCs to us. This list88* collects all those VCCs. LANEv1 client has only one item in this89* list. These entries are not aged out.90*/91spinlock_t lec_arp_lock;92struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */93struct atm_vcc *lecd;94struct delayed_work lec_arp_work; /* C10 */95unsigned int maximum_unknown_frame_count;96/*97* Within the period of time defined by this variable, the client will send98* no more than C10 frames to BUS for a given unicast destination. (C11)99*/100unsigned 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*/105unsigned long vcc_timeout_period;106/*107* An LE Client MUST not retry an LE_ARP_REQUEST for a108* given frame's LAN Destination more than maximum retry count times,109* after the first LEC_ARP_REQUEST (C13)110*/111unsigned short max_retry_count;112/*113* Max time the client will maintain an entry in its arp cache in114* absence of a verification of that relationship (C17)115*/116unsigned long aging_time;117/*118* Max time the client will maintain an entry in cache when119* topology change flag is true (C18)120*/121unsigned long forward_delay_time; /* Topology change flag (C19) */122int topology_change;123/*124* Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE125* cycle to take (C20)126*/127unsigned long arp_response_time;128/*129* Time limit ot wait to receive an LE_FLUSH_RESPONSE after the130* LE_FLUSH_REQUEST has been sent before taking recover action. (C21)131*/132unsigned long flush_timeout;133/* The time since sending a frame to the bus after which the134* LE Client may assume that the frame has been either discarded or135* delivered to the recipient (C22)136*/137unsigned long path_switching_delay;138139u8 *tlvs; /* LANE2: TLVs are new */140u32 sizeoftlvs; /* The size of the tlv array in bytes */141int lane_version; /* LANE2 */142int itfnum; /* e.g. 2 for lec2, 5 for lec5 */143struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */144int is_proxy; /* bridge between ATM and Ethernet */145};146147struct lec_vcc_priv {148void (*old_pop) (struct atm_vcc *vcc, struct sk_buff *skb);149int xoff;150};151152#define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back))153154#endif /* _LEC_H_ */155156157