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