162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Lec arp cache
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Marko Kiiskila <mkiiskila@yahoo.com>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef _LEC_ARP_H_
862306a36Sopenharmony_ci#define _LEC_ARP_H_
962306a36Sopenharmony_ci#include <linux/atm.h>
1062306a36Sopenharmony_ci#include <linux/atmdev.h>
1162306a36Sopenharmony_ci#include <linux/if_ether.h>
1262306a36Sopenharmony_ci#include <linux/atmlec.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct lec_arp_table {
1562306a36Sopenharmony_ci	struct hlist_node next;		/* Linked entry list */
1662306a36Sopenharmony_ci	unsigned char atm_addr[ATM_ESA_LEN];	/* Atm address */
1762306a36Sopenharmony_ci	unsigned char mac_addr[ETH_ALEN];	/* Mac address */
1862306a36Sopenharmony_ci	int is_rdesc;			/* Mac address is a route descriptor */
1962306a36Sopenharmony_ci	struct atm_vcc *vcc;		/* Vcc this entry is attached */
2062306a36Sopenharmony_ci	struct atm_vcc *recv_vcc;	/* Vcc we receive data from */
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci	void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb);
2362306a36Sopenharmony_ci					/* Push that leads to daemon */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci	void (*old_recv_push) (struct atm_vcc *vcc, struct sk_buff *skb);
2662306a36Sopenharmony_ci					/* Push that leads to daemon */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	unsigned long last_used;	/* For expiry */
2962306a36Sopenharmony_ci	unsigned long timestamp;	/* Used for various timestamping things:
3062306a36Sopenharmony_ci					 * 1. FLUSH started
3162306a36Sopenharmony_ci					 *    (status=ESI_FLUSH_PENDING)
3262306a36Sopenharmony_ci					 * 2. Counting to
3362306a36Sopenharmony_ci					 *    max_unknown_frame_time
3462306a36Sopenharmony_ci					 *    (status=ESI_ARP_PENDING||
3562306a36Sopenharmony_ci					 *     status=ESI_VC_PENDING)
3662306a36Sopenharmony_ci					 */
3762306a36Sopenharmony_ci	unsigned char no_tries;		/* No of times arp retry has been tried */
3862306a36Sopenharmony_ci	unsigned char status;		/* Status of this entry */
3962306a36Sopenharmony_ci	unsigned short flags;		/* Flags for this entry */
4062306a36Sopenharmony_ci	unsigned short packets_flooded;	/* Data packets flooded */
4162306a36Sopenharmony_ci	unsigned long flush_tran_id;	/* Transaction id in flush protocol */
4262306a36Sopenharmony_ci	struct timer_list timer;	/* Arping timer */
4362306a36Sopenharmony_ci	struct lec_priv *priv;		/* Pointer back */
4462306a36Sopenharmony_ci	u8 *tlvs;
4562306a36Sopenharmony_ci	u32 sizeoftlvs;			/*
4662306a36Sopenharmony_ci					 * LANE2: Each MAC address can have TLVs
4762306a36Sopenharmony_ci					 * associated with it.  sizeoftlvs tells
4862306a36Sopenharmony_ci					 * the length of the tlvs array
4962306a36Sopenharmony_ci					 */
5062306a36Sopenharmony_ci	struct sk_buff_head tx_wait;	/* wait queue for outgoing packets */
5162306a36Sopenharmony_ci	refcount_t usage;		/* usage count */
5262306a36Sopenharmony_ci};
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/*
5562306a36Sopenharmony_ci * LANE2: Template tlv struct for accessing
5662306a36Sopenharmony_ci * the tlvs in the lec_arp_table->tlvs array
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_cistruct tlv {
5962306a36Sopenharmony_ci	u32 type;
6062306a36Sopenharmony_ci	u8 length;
6162306a36Sopenharmony_ci	u8 value[255];
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/* Status fields */
6562306a36Sopenharmony_ci#define ESI_UNKNOWN 0		/*
6662306a36Sopenharmony_ci				 * Next packet sent to this mac address
6762306a36Sopenharmony_ci				 * causes ARP-request to be sent
6862306a36Sopenharmony_ci				 */
6962306a36Sopenharmony_ci#define ESI_ARP_PENDING 1	/*
7062306a36Sopenharmony_ci				 * There is no ATM address associated with this
7162306a36Sopenharmony_ci				 * 48-bit address.  The LE-ARP protocol is in
7262306a36Sopenharmony_ci				 * progress.
7362306a36Sopenharmony_ci				 */
7462306a36Sopenharmony_ci#define ESI_VC_PENDING 2	/*
7562306a36Sopenharmony_ci				 * There is a valid ATM address associated with
7662306a36Sopenharmony_ci				 * this 48-bit address but there is no VC set
7762306a36Sopenharmony_ci				 * up to that ATM address.  The signaling
7862306a36Sopenharmony_ci				 * protocol is in process.
7962306a36Sopenharmony_ci				 */
8062306a36Sopenharmony_ci#define ESI_FLUSH_PENDING 4	/*
8162306a36Sopenharmony_ci				 * The LEC has been notified of the FLUSH_START
8262306a36Sopenharmony_ci				 * status and it is assumed that the flush
8362306a36Sopenharmony_ci				 * protocol is in process.
8462306a36Sopenharmony_ci				 */
8562306a36Sopenharmony_ci#define ESI_FORWARD_DIRECT 5	/*
8662306a36Sopenharmony_ci				 * Either the Path Switching Delay (C22) has
8762306a36Sopenharmony_ci				 * elapsed or the LEC has notified the Mapping
8862306a36Sopenharmony_ci				 * that the flush protocol has completed.  In
8962306a36Sopenharmony_ci				 * either case, it is safe to forward packets
9062306a36Sopenharmony_ci				 * to this address via the data direct VC.
9162306a36Sopenharmony_ci				 */
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* Flag values */
9462306a36Sopenharmony_ci#define LEC_REMOTE_FLAG      0x0001
9562306a36Sopenharmony_ci#define LEC_PERMANENT_FLAG   0x0002
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci#endif /* _LEC_ARP_H_ */
98