Blame net/atm/lec.h

Packit 7b02f3
/* SPDX-License-Identifier: GPL-2.0 */
Packit 7b02f3
/*
Packit 7b02f3
 * Lan Emulation client header file
Packit 7b02f3
 *
Packit 7b02f3
 * Marko Kiiskila <mkiiskila@yahoo.com>
Packit 7b02f3
 */
Packit 7b02f3
Packit 7b02f3
#ifndef _LEC_H_
Packit 7b02f3
#define _LEC_H_
Packit 7b02f3
Packit 7b02f3
#include <linux/atmdev.h>
Packit 7b02f3
#include <linux/netdevice.h>
Packit 7b02f3
#include <linux/atmlec.h>
Packit 7b02f3
Packit 7b02f3
#define LEC_HEADER_LEN 16
Packit 7b02f3
Packit 7b02f3
struct lecdatahdr_8023 {
Packit 7b02f3
	__be16 le_header;
Packit 7b02f3
	unsigned char h_dest[ETH_ALEN];
Packit 7b02f3
	unsigned char h_source[ETH_ALEN];
Packit 7b02f3
	__be16 h_type;
Packit 7b02f3
};
Packit 7b02f3
Packit 7b02f3
struct lecdatahdr_8025 {
Packit 7b02f3
	__be16 le_header;
Packit 7b02f3
	unsigned char ac_pad;
Packit 7b02f3
	unsigned char fc;
Packit 7b02f3
	unsigned char h_dest[ETH_ALEN];
Packit 7b02f3
	unsigned char h_source[ETH_ALEN];
Packit 7b02f3
};
Packit 7b02f3
Packit 7b02f3
#define LEC_MINIMUM_8023_SIZE   62
Packit 7b02f3
#define LEC_MINIMUM_8025_SIZE   16
Packit 7b02f3
Packit 7b02f3
/*
Packit 7b02f3
 * Operations that LANE2 capable device can do. Two first functions
Packit 7b02f3
 * are used to make the device do things. See spec 3.1.3 and 3.1.4.
Packit 7b02f3
 *
Packit 7b02f3
 * The third function is intended for the MPOA component sitting on
Packit 7b02f3
 * top of the LANE device. The MPOA component assigns it's own function
Packit 7b02f3
 * to (*associate_indicator)() and the LANE device will use that
Packit 7b02f3
 * function to tell about TLVs it sees floating through.
Packit 7b02f3
 *
Packit 7b02f3
 */
Packit 7b02f3
struct lane2_ops {
Packit 7b02f3
	int (*resolve) (struct net_device *dev, const u8 *dst_mac, int force,
Packit 7b02f3
			u8 **tlvs, u32 *sizeoftlvs);
Packit 7b02f3
	int (*associate_req) (struct net_device *dev, const u8 *lan_dst,
Packit 7b02f3
			      const u8 *tlvs, u32 sizeoftlvs);
Packit 7b02f3
	void (*associate_indicator) (struct net_device *dev, const u8 *mac_addr,
Packit 7b02f3
				     const u8 *tlvs, u32 sizeoftlvs);
Packit 7b02f3
};
Packit 7b02f3
Packit 7b02f3
/*
Packit 7b02f3
 * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
Packit 7b02f3
 * frames.
Packit 7b02f3
 *
Packit 7b02f3
 * 1. Dix Ethernet EtherType frames encoded by placing EtherType
Packit 7b02f3
 *    field in h_type field. Data follows immediately after header.
Packit 7b02f3
 * 2. LLC Data frames whose total length, including LLC field and data,
Packit 7b02f3
 *    but not padding required to meet the minimum data frame length,
Packit 7b02f3
 *    is less than ETH_P_802_3_MIN MUST be encoded by placing that length
Packit 7b02f3
 *    in the h_type field. The LLC field follows header immediately.
Packit 7b02f3
 * 3. LLC data frames longer than this maximum MUST be encoded by placing
Packit 7b02f3
 *    the value 0 in the h_type field.
Packit 7b02f3
 *
Packit 7b02f3
 */
Packit 7b02f3
Packit 7b02f3
/* Hash table size */
Packit 7b02f3
#define LEC_ARP_TABLE_SIZE 16
Packit 7b02f3
Packit 7b02f3
struct lec_priv {
Packit 7b02f3
	unsigned short lecid;			/* Lecid of this client */
Packit 7b02f3
	struct hlist_head lec_arp_empty_ones;
Packit 7b02f3
						/* Used for storing VCC's that don't have a MAC address attached yet */
Packit 7b02f3
	struct hlist_head lec_arp_tables[LEC_ARP_TABLE_SIZE];
Packit 7b02f3
						/* Actual LE ARP table */
Packit 7b02f3
	struct hlist_head lec_no_forward;
Packit 7b02f3
						/*
Packit 7b02f3
						 * Used for storing VCC's (and forward packets from) which are to
Packit 7b02f3
						 * age out by not using them to forward packets.
Packit 7b02f3
						 * This is because to some LE clients there will be 2 VCCs. Only
Packit 7b02f3
						 * one of them gets used.
Packit 7b02f3
						 */
Packit 7b02f3
	struct hlist_head mcast_fwds;
Packit 7b02f3
						/*
Packit 7b02f3
						 * With LANEv2 it is possible that BUS (or a special multicast server)
Packit 7b02f3
						 * establishes multiple Multicast Forward VCCs to us. This list
Packit 7b02f3
						 * collects all those VCCs. LANEv1 client has only one item in this
Packit 7b02f3
						 * list. These entries are not aged out.
Packit 7b02f3
						 */
Packit 7b02f3
	spinlock_t lec_arp_lock;
Packit 7b02f3
	struct atm_vcc *mcast_vcc;		/* Default Multicast Send VCC */
Packit 7b02f3
	struct atm_vcc *lecd;
Packit 7b02f3
	struct delayed_work lec_arp_work;	/* C10 */
Packit 7b02f3
	unsigned int maximum_unknown_frame_count;
Packit 7b02f3
						/*
Packit 7b02f3
						 * Within the period of time defined by this variable, the client will send
Packit 7b02f3
						 * no more than C10 frames to BUS for a given unicast destination. (C11)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long max_unknown_frame_time;
Packit 7b02f3
						/*
Packit 7b02f3
						 * If no traffic has been sent in this vcc for this period of time,
Packit 7b02f3
						 * vcc will be torn down (C12)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long vcc_timeout_period;
Packit 7b02f3
						/*
Packit 7b02f3
						 * An LE Client MUST not retry an LE_ARP_REQUEST for a
Packit 7b02f3
						 * given frame's LAN Destination more than maximum retry count times,
Packit 7b02f3
						 * after the first LEC_ARP_REQUEST (C13)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned short max_retry_count;
Packit 7b02f3
						/*
Packit 7b02f3
						 * Max time the client will maintain an entry in its arp cache in
Packit 7b02f3
						 * absence of a verification of that relationship (C17)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long aging_time;
Packit 7b02f3
						/*
Packit 7b02f3
						 * Max time the client will maintain an entry in cache when
Packit 7b02f3
						 * topology change flag is true (C18)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long forward_delay_time;	/* Topology change flag (C19) */
Packit 7b02f3
	int topology_change;
Packit 7b02f3
						/*
Packit 7b02f3
						 * Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE
Packit 7b02f3
						 * cycle to take (C20)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long arp_response_time;
Packit 7b02f3
						/*
Packit 7b02f3
						 * Time limit ot wait to receive an LE_FLUSH_RESPONSE after the
Packit 7b02f3
						 * LE_FLUSH_REQUEST has been sent before taking recover action. (C21)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long flush_timeout;
Packit 7b02f3
						/* The time since sending a frame to the bus after which the
Packit 7b02f3
						 * LE Client may assume that the frame has been either discarded or
Packit 7b02f3
						 * delivered to the recipient (C22)
Packit 7b02f3
						 */
Packit 7b02f3
	unsigned long path_switching_delay;
Packit 7b02f3
Packit 7b02f3
	u8 *tlvs;				/* LANE2: TLVs are new */
Packit 7b02f3
	u32 sizeoftlvs;				/* The size of the tlv array in bytes */
Packit 7b02f3
	int lane_version;			/* LANE2 */
Packit 7b02f3
	int itfnum;				/* e.g. 2 for lec2, 5 for lec5 */
Packit 7b02f3
	struct lane2_ops *lane2_ops;		/* can be NULL for LANE v1 */
Packit 7b02f3
	int is_proxy;				/* bridge between ATM and Ethernet */
Packit 7b02f3
};
Packit 7b02f3
Packit 7b02f3
struct lec_vcc_priv {
Packit 7b02f3
	void (*old_pop) (struct atm_vcc *vcc, struct sk_buff *skb);
Packit 7b02f3
	int xoff;
Packit 7b02f3
};
Packit 7b02f3
Packit 7b02f3
#define LEC_VCC_PRIV(vcc)	((struct lec_vcc_priv *)((vcc)->user_back))
Packit 7b02f3
Packit 7b02f3
#endif				/* _LEC_H_ */