xref: /openbmc/linux/net/atm/lec_arpc.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  * Lec arp cache
41da177e4SLinus Torvalds  *
51c9d3e72SChas Williams  * Marko Kiiskila <mkiiskila@yahoo.com>
61da177e4SLinus Torvalds  */
71c9d3e72SChas Williams #ifndef _LEC_ARP_H_
81c9d3e72SChas Williams #define _LEC_ARP_H_
91da177e4SLinus Torvalds #include <linux/atm.h>
101da177e4SLinus Torvalds #include <linux/atmdev.h>
111da177e4SLinus Torvalds #include <linux/if_ether.h>
121da177e4SLinus Torvalds #include <linux/atmlec.h>
131da177e4SLinus Torvalds 
141da177e4SLinus Torvalds struct lec_arp_table {
15d0732f64SChas Williams 	struct hlist_node next;		/* Linked entry list */
161da177e4SLinus Torvalds 	unsigned char atm_addr[ATM_ESA_LEN];	/* Atm address */
171da177e4SLinus Torvalds 	unsigned char mac_addr[ETH_ALEN];	/* Mac address */
181da177e4SLinus Torvalds 	int is_rdesc;			/* Mac address is a route descriptor */
191da177e4SLinus Torvalds 	struct atm_vcc *vcc;		/* Vcc this entry is attached */
201da177e4SLinus Torvalds 	struct atm_vcc *recv_vcc;	/* Vcc we receive data from */
211c9d3e72SChas Williams 
221da177e4SLinus Torvalds 	void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb);
231da177e4SLinus Torvalds 					/* Push that leads to daemon */
241c9d3e72SChas Williams 
251da177e4SLinus Torvalds 	void (*old_recv_push) (struct atm_vcc *vcc, struct sk_buff *skb);
261da177e4SLinus Torvalds 					/* Push that leads to daemon */
271c9d3e72SChas Williams 
281da177e4SLinus Torvalds 	unsigned long last_used;	/* For expiry */
291c9d3e72SChas Williams 	unsigned long timestamp;	/* Used for various timestamping things:
301da177e4SLinus Torvalds 					 * 1. FLUSH started
311da177e4SLinus Torvalds 					 *    (status=ESI_FLUSH_PENDING)
321da177e4SLinus Torvalds 					 * 2. Counting to
331da177e4SLinus Torvalds 					 *    max_unknown_frame_time
341da177e4SLinus Torvalds 					 *    (status=ESI_ARP_PENDING||
351da177e4SLinus Torvalds 					 *     status=ESI_VC_PENDING)
361da177e4SLinus Torvalds 					 */
371c9d3e72SChas Williams 	unsigned char no_tries;		/* No of times arp retry has been tried */
381da177e4SLinus Torvalds 	unsigned char status;		/* Status of this entry */
391da177e4SLinus Torvalds 	unsigned short flags;		/* Flags for this entry */
401da177e4SLinus Torvalds 	unsigned short packets_flooded;	/* Data packets flooded */
411da177e4SLinus Torvalds 	unsigned long flush_tran_id;	/* Transaction id in flush protocol */
421da177e4SLinus Torvalds 	struct timer_list timer;	/* Arping timer */
431da177e4SLinus Torvalds 	struct lec_priv *priv;		/* Pointer back */
441c9d3e72SChas Williams 	u8 *tlvs;
451c9d3e72SChas Williams 	u32 sizeoftlvs;			/*
461c9d3e72SChas Williams 					 * LANE2: Each MAC address can have TLVs
47*dfd5ec1bSRandy Dunlap 					 * associated with it.  sizeoftlvs tells
481c9d3e72SChas Williams 					 * the length of the tlvs array
491c9d3e72SChas Williams 					 */
501da177e4SLinus Torvalds 	struct sk_buff_head tx_wait;	/* wait queue for outgoing packets */
5178893664SReshetova, Elena 	refcount_t usage;		/* usage count */
521da177e4SLinus Torvalds };
531da177e4SLinus Torvalds 
541c9d3e72SChas Williams /*
551c9d3e72SChas Williams  * LANE2: Template tlv struct for accessing
561c9d3e72SChas Williams  * the tlvs in the lec_arp_table->tlvs array
571c9d3e72SChas Williams  */
581c9d3e72SChas Williams struct tlv {
591da177e4SLinus Torvalds 	u32 type;
601da177e4SLinus Torvalds 	u8 length;
611da177e4SLinus Torvalds 	u8 value[255];
621da177e4SLinus Torvalds };
631da177e4SLinus Torvalds 
641da177e4SLinus Torvalds /* Status fields */
651da177e4SLinus Torvalds #define ESI_UNKNOWN 0		/*
661da177e4SLinus Torvalds 				 * Next packet sent to this mac address
671da177e4SLinus Torvalds 				 * causes ARP-request to be sent
681da177e4SLinus Torvalds 				 */
691da177e4SLinus Torvalds #define ESI_ARP_PENDING 1	/*
701da177e4SLinus Torvalds 				 * There is no ATM address associated with this
711da177e4SLinus Torvalds 				 * 48-bit address.  The LE-ARP protocol is in
721da177e4SLinus Torvalds 				 * progress.
731da177e4SLinus Torvalds 				 */
741da177e4SLinus Torvalds #define ESI_VC_PENDING 2	/*
751da177e4SLinus Torvalds 				 * There is a valid ATM address associated with
761da177e4SLinus Torvalds 				 * this 48-bit address but there is no VC set
771da177e4SLinus Torvalds 				 * up to that ATM address.  The signaling
781da177e4SLinus Torvalds 				 * protocol is in process.
791da177e4SLinus Torvalds 				 */
801da177e4SLinus Torvalds #define ESI_FLUSH_PENDING 4	/*
811da177e4SLinus Torvalds 				 * The LEC has been notified of the FLUSH_START
821da177e4SLinus Torvalds 				 * status and it is assumed that the flush
831da177e4SLinus Torvalds 				 * protocol is in process.
841da177e4SLinus Torvalds 				 */
851da177e4SLinus Torvalds #define ESI_FORWARD_DIRECT 5	/*
861da177e4SLinus Torvalds 				 * Either the Path Switching Delay (C22) has
871da177e4SLinus Torvalds 				 * elapsed or the LEC has notified the Mapping
881da177e4SLinus Torvalds 				 * that the flush protocol has completed.  In
891da177e4SLinus Torvalds 				 * either case, it is safe to forward packets
901da177e4SLinus Torvalds 				 * to this address via the data direct VC.
911da177e4SLinus Torvalds 				 */
921da177e4SLinus Torvalds 
931da177e4SLinus Torvalds /* Flag values */
941da177e4SLinus Torvalds #define LEC_REMOTE_FLAG      0x0001
951da177e4SLinus Torvalds #define LEC_PERMANENT_FLAG   0x0002
961da177e4SLinus Torvalds 
971c9d3e72SChas Williams #endif /* _LEC_ARP_H_ */
98