xref: /OK3568_Linux_fs/kernel/net/atm/lec_arpc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Lec arp cache
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Marko Kiiskila <mkiiskila@yahoo.com>
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun #ifndef _LEC_ARP_H_
8*4882a593Smuzhiyun #define _LEC_ARP_H_
9*4882a593Smuzhiyun #include <linux/atm.h>
10*4882a593Smuzhiyun #include <linux/atmdev.h>
11*4882a593Smuzhiyun #include <linux/if_ether.h>
12*4882a593Smuzhiyun #include <linux/atmlec.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun struct lec_arp_table {
15*4882a593Smuzhiyun 	struct hlist_node next;		/* Linked entry list */
16*4882a593Smuzhiyun 	unsigned char atm_addr[ATM_ESA_LEN];	/* Atm address */
17*4882a593Smuzhiyun 	unsigned char mac_addr[ETH_ALEN];	/* Mac address */
18*4882a593Smuzhiyun 	int is_rdesc;			/* Mac address is a route descriptor */
19*4882a593Smuzhiyun 	struct atm_vcc *vcc;		/* Vcc this entry is attached */
20*4882a593Smuzhiyun 	struct atm_vcc *recv_vcc;	/* Vcc we receive data from */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun 	void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb);
23*4882a593Smuzhiyun 					/* Push that leads to daemon */
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun 	void (*old_recv_push) (struct atm_vcc *vcc, struct sk_buff *skb);
26*4882a593Smuzhiyun 					/* Push that leads to daemon */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun 	unsigned long last_used;	/* For expiry */
29*4882a593Smuzhiyun 	unsigned long timestamp;	/* Used for various timestamping things:
30*4882a593Smuzhiyun 					 * 1. FLUSH started
31*4882a593Smuzhiyun 					 *    (status=ESI_FLUSH_PENDING)
32*4882a593Smuzhiyun 					 * 2. Counting to
33*4882a593Smuzhiyun 					 *    max_unknown_frame_time
34*4882a593Smuzhiyun 					 *    (status=ESI_ARP_PENDING||
35*4882a593Smuzhiyun 					 *     status=ESI_VC_PENDING)
36*4882a593Smuzhiyun 					 */
37*4882a593Smuzhiyun 	unsigned char no_tries;		/* No of times arp retry has been tried */
38*4882a593Smuzhiyun 	unsigned char status;		/* Status of this entry */
39*4882a593Smuzhiyun 	unsigned short flags;		/* Flags for this entry */
40*4882a593Smuzhiyun 	unsigned short packets_flooded;	/* Data packets flooded */
41*4882a593Smuzhiyun 	unsigned long flush_tran_id;	/* Transaction id in flush protocol */
42*4882a593Smuzhiyun 	struct timer_list timer;	/* Arping timer */
43*4882a593Smuzhiyun 	struct lec_priv *priv;		/* Pointer back */
44*4882a593Smuzhiyun 	u8 *tlvs;
45*4882a593Smuzhiyun 	u32 sizeoftlvs;			/*
46*4882a593Smuzhiyun 					 * LANE2: Each MAC address can have TLVs
47*4882a593Smuzhiyun 					 * associated with it.  sizeoftlvs tells
48*4882a593Smuzhiyun 					 * the length of the tlvs array
49*4882a593Smuzhiyun 					 */
50*4882a593Smuzhiyun 	struct sk_buff_head tx_wait;	/* wait queue for outgoing packets */
51*4882a593Smuzhiyun 	refcount_t usage;		/* usage count */
52*4882a593Smuzhiyun };
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun /*
55*4882a593Smuzhiyun  * LANE2: Template tlv struct for accessing
56*4882a593Smuzhiyun  * the tlvs in the lec_arp_table->tlvs array
57*4882a593Smuzhiyun  */
58*4882a593Smuzhiyun struct tlv {
59*4882a593Smuzhiyun 	u32 type;
60*4882a593Smuzhiyun 	u8 length;
61*4882a593Smuzhiyun 	u8 value[255];
62*4882a593Smuzhiyun };
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun /* Status fields */
65*4882a593Smuzhiyun #define ESI_UNKNOWN 0		/*
66*4882a593Smuzhiyun 				 * Next packet sent to this mac address
67*4882a593Smuzhiyun 				 * causes ARP-request to be sent
68*4882a593Smuzhiyun 				 */
69*4882a593Smuzhiyun #define ESI_ARP_PENDING 1	/*
70*4882a593Smuzhiyun 				 * There is no ATM address associated with this
71*4882a593Smuzhiyun 				 * 48-bit address.  The LE-ARP protocol is in
72*4882a593Smuzhiyun 				 * progress.
73*4882a593Smuzhiyun 				 */
74*4882a593Smuzhiyun #define ESI_VC_PENDING 2	/*
75*4882a593Smuzhiyun 				 * There is a valid ATM address associated with
76*4882a593Smuzhiyun 				 * this 48-bit address but there is no VC set
77*4882a593Smuzhiyun 				 * up to that ATM address.  The signaling
78*4882a593Smuzhiyun 				 * protocol is in process.
79*4882a593Smuzhiyun 				 */
80*4882a593Smuzhiyun #define ESI_FLUSH_PENDING 4	/*
81*4882a593Smuzhiyun 				 * The LEC has been notified of the FLUSH_START
82*4882a593Smuzhiyun 				 * status and it is assumed that the flush
83*4882a593Smuzhiyun 				 * protocol is in process.
84*4882a593Smuzhiyun 				 */
85*4882a593Smuzhiyun #define ESI_FORWARD_DIRECT 5	/*
86*4882a593Smuzhiyun 				 * Either the Path Switching Delay (C22) has
87*4882a593Smuzhiyun 				 * elapsed or the LEC has notified the Mapping
88*4882a593Smuzhiyun 				 * that the flush protocol has completed.  In
89*4882a593Smuzhiyun 				 * either case, it is safe to forward packets
90*4882a593Smuzhiyun 				 * to this address via the data direct VC.
91*4882a593Smuzhiyun 				 */
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun /* Flag values */
94*4882a593Smuzhiyun #define LEC_REMOTE_FLAG      0x0001
95*4882a593Smuzhiyun #define LEC_PERMANENT_FLAG   0x0002
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun #endif /* _LEC_ARP_H_ */
98