18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Lec arp cache
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Marko Kiiskila <mkiiskila@yahoo.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _LEC_ARP_H_
88c2ecf20Sopenharmony_ci#define _LEC_ARP_H_
98c2ecf20Sopenharmony_ci#include <linux/atm.h>
108c2ecf20Sopenharmony_ci#include <linux/atmdev.h>
118c2ecf20Sopenharmony_ci#include <linux/if_ether.h>
128c2ecf20Sopenharmony_ci#include <linux/atmlec.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct lec_arp_table {
158c2ecf20Sopenharmony_ci	struct hlist_node next;		/* Linked entry list */
168c2ecf20Sopenharmony_ci	unsigned char atm_addr[ATM_ESA_LEN];	/* Atm address */
178c2ecf20Sopenharmony_ci	unsigned char mac_addr[ETH_ALEN];	/* Mac address */
188c2ecf20Sopenharmony_ci	int is_rdesc;			/* Mac address is a route descriptor */
198c2ecf20Sopenharmony_ci	struct atm_vcc *vcc;		/* Vcc this entry is attached */
208c2ecf20Sopenharmony_ci	struct atm_vcc *recv_vcc;	/* Vcc we receive data from */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb);
238c2ecf20Sopenharmony_ci					/* Push that leads to daemon */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	void (*old_recv_push) (struct atm_vcc *vcc, struct sk_buff *skb);
268c2ecf20Sopenharmony_ci					/* Push that leads to daemon */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	unsigned long last_used;	/* For expiry */
298c2ecf20Sopenharmony_ci	unsigned long timestamp;	/* Used for various timestamping things:
308c2ecf20Sopenharmony_ci					 * 1. FLUSH started
318c2ecf20Sopenharmony_ci					 *    (status=ESI_FLUSH_PENDING)
328c2ecf20Sopenharmony_ci					 * 2. Counting to
338c2ecf20Sopenharmony_ci					 *    max_unknown_frame_time
348c2ecf20Sopenharmony_ci					 *    (status=ESI_ARP_PENDING||
358c2ecf20Sopenharmony_ci					 *     status=ESI_VC_PENDING)
368c2ecf20Sopenharmony_ci					 */
378c2ecf20Sopenharmony_ci	unsigned char no_tries;		/* No of times arp retry has been tried */
388c2ecf20Sopenharmony_ci	unsigned char status;		/* Status of this entry */
398c2ecf20Sopenharmony_ci	unsigned short flags;		/* Flags for this entry */
408c2ecf20Sopenharmony_ci	unsigned short packets_flooded;	/* Data packets flooded */
418c2ecf20Sopenharmony_ci	unsigned long flush_tran_id;	/* Transaction id in flush protocol */
428c2ecf20Sopenharmony_ci	struct timer_list timer;	/* Arping timer */
438c2ecf20Sopenharmony_ci	struct lec_priv *priv;		/* Pointer back */
448c2ecf20Sopenharmony_ci	u8 *tlvs;
458c2ecf20Sopenharmony_ci	u32 sizeoftlvs;			/*
468c2ecf20Sopenharmony_ci					 * LANE2: Each MAC address can have TLVs
478c2ecf20Sopenharmony_ci					 * associated with it.  sizeoftlvs tells
488c2ecf20Sopenharmony_ci					 * the length of the tlvs array
498c2ecf20Sopenharmony_ci					 */
508c2ecf20Sopenharmony_ci	struct sk_buff_head tx_wait;	/* wait queue for outgoing packets */
518c2ecf20Sopenharmony_ci	refcount_t usage;		/* usage count */
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*
558c2ecf20Sopenharmony_ci * LANE2: Template tlv struct for accessing
568c2ecf20Sopenharmony_ci * the tlvs in the lec_arp_table->tlvs array
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_cistruct tlv {
598c2ecf20Sopenharmony_ci	u32 type;
608c2ecf20Sopenharmony_ci	u8 length;
618c2ecf20Sopenharmony_ci	u8 value[255];
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/* Status fields */
658c2ecf20Sopenharmony_ci#define ESI_UNKNOWN 0		/*
668c2ecf20Sopenharmony_ci				 * Next packet sent to this mac address
678c2ecf20Sopenharmony_ci				 * causes ARP-request to be sent
688c2ecf20Sopenharmony_ci				 */
698c2ecf20Sopenharmony_ci#define ESI_ARP_PENDING 1	/*
708c2ecf20Sopenharmony_ci				 * There is no ATM address associated with this
718c2ecf20Sopenharmony_ci				 * 48-bit address.  The LE-ARP protocol is in
728c2ecf20Sopenharmony_ci				 * progress.
738c2ecf20Sopenharmony_ci				 */
748c2ecf20Sopenharmony_ci#define ESI_VC_PENDING 2	/*
758c2ecf20Sopenharmony_ci				 * There is a valid ATM address associated with
768c2ecf20Sopenharmony_ci				 * this 48-bit address but there is no VC set
778c2ecf20Sopenharmony_ci				 * up to that ATM address.  The signaling
788c2ecf20Sopenharmony_ci				 * protocol is in process.
798c2ecf20Sopenharmony_ci				 */
808c2ecf20Sopenharmony_ci#define ESI_FLUSH_PENDING 4	/*
818c2ecf20Sopenharmony_ci				 * The LEC has been notified of the FLUSH_START
828c2ecf20Sopenharmony_ci				 * status and it is assumed that the flush
838c2ecf20Sopenharmony_ci				 * protocol is in process.
848c2ecf20Sopenharmony_ci				 */
858c2ecf20Sopenharmony_ci#define ESI_FORWARD_DIRECT 5	/*
868c2ecf20Sopenharmony_ci				 * Either the Path Switching Delay (C22) has
878c2ecf20Sopenharmony_ci				 * elapsed or the LEC has notified the Mapping
888c2ecf20Sopenharmony_ci				 * that the flush protocol has completed.  In
898c2ecf20Sopenharmony_ci				 * either case, it is safe to forward packets
908c2ecf20Sopenharmony_ci				 * to this address via the data direct VC.
918c2ecf20Sopenharmony_ci				 */
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* Flag values */
948c2ecf20Sopenharmony_ci#define LEC_REMOTE_FLAG      0x0001
958c2ecf20Sopenharmony_ci#define LEC_PERMANENT_FLAG   0x0002
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#endif /* _LEC_ARP_H_ */
98