1 /* 2 * Fundamental constants relating to ARP Protocol 3 * 4 * Copyright (C) 2020, Broadcom. 5 * 6 * Unless you and Broadcom execute a separate written software license 7 * agreement governing use of this software, this software is licensed to you 8 * under the terms of the GNU General Public License version 2 (the "GPL"), 9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 * following added to such license: 11 * 12 * As a special exception, the copyright holders of this software give you 13 * permission to link this software with independent modules, and to copy and 14 * distribute the resulting executable under terms of your choice, provided that 15 * you also meet, for each linked independent module, the terms and conditions of 16 * the license of that module. An independent module is a module which is not 17 * derived from this software. The special exception does not apply to any 18 * modifications of the software. 19 * 20 * 21 * <<Broadcom-WL-IPTag/Dual:>> 22 */ 23 24 #ifndef _bcmarp_h_ 25 #define _bcmarp_h_ 26 27 #ifndef _TYPEDEFS_H_ 28 #include <typedefs.h> 29 #endif 30 #include <bcmip.h> 31 32 /* This marks the start of a packed structure section. */ 33 #include <packed_section_start.h> 34 35 #define ARP_OPC_OFFSET 6 /* option code offset */ 36 #define ARP_SRC_ETH_OFFSET 8 /* src h/w address offset */ 37 #define ARP_SRC_IP_OFFSET 14 /* src IP address offset */ 38 #define ARP_TGT_ETH_OFFSET 18 /* target h/w address offset */ 39 #define ARP_TGT_IP_OFFSET 24 /* target IP address offset */ 40 41 #define ARP_OPC_REQUEST 1 /* ARP request */ 42 #define ARP_OPC_REPLY 2 /* ARP reply */ 43 44 #define ARP_DATA_LEN 28 /* ARP data length */ 45 46 #define HTYPE_ETHERNET 1 /* htype for ethernet */ 47 BWL_PRE_PACKED_STRUCT struct bcmarp { 48 uint16 htype; /* Header type (1 = ethernet) */ 49 uint16 ptype; /* Protocol type (0x800 = IP) */ 50 uint8 hlen; /* Hardware address length (Eth = 6) */ 51 uint8 plen; /* Protocol address length (IP = 4) */ 52 uint16 oper; /* ARP_OPC_... */ 53 uint8 src_eth[ETHER_ADDR_LEN]; /* Source hardware address */ 54 uint8 src_ip[IPV4_ADDR_LEN]; /* Source protocol address (not aligned) */ 55 uint8 dst_eth[ETHER_ADDR_LEN]; /* Destination hardware address */ 56 uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination protocol address */ 57 } BWL_POST_PACKED_STRUCT; 58 59 /* Ethernet header + Arp message */ 60 BWL_PRE_PACKED_STRUCT struct bcmetharp { 61 struct ether_header eh; 62 struct bcmarp arp; 63 } BWL_POST_PACKED_STRUCT; 64 65 /* IPv6 Neighbor Advertisement */ 66 #define NEIGHBOR_ADVERTISE_SRC_IPV6_OFFSET 8 /* src IPv6 address offset */ 67 #define NEIGHBOR_ADVERTISE_TYPE_OFFSET 40 /* type offset */ 68 #define NEIGHBOR_ADVERTISE_CHECKSUM_OFFSET 42 /* check sum offset */ 69 #define NEIGHBOR_ADVERTISE_FLAGS_OFFSET 44 /* R,S and O flags offset */ 70 #define NEIGHBOR_ADVERTISE_TGT_IPV6_OFFSET 48 /* target IPv6 address offset */ 71 #define NEIGHBOR_ADVERTISE_OPTION_OFFSET 64 /* options offset */ 72 #define NEIGHBOR_ADVERTISE_TYPE 136 73 #define NEIGHBOR_SOLICITATION_TYPE 135 74 75 #define OPT_TYPE_SRC_LINK_ADDR 1 76 #define OPT_TYPE_TGT_LINK_ADDR 2 77 78 #define NEIGHBOR_ADVERTISE_DATA_LEN 72 /* neighbor advertisement data length */ 79 #define NEIGHBOR_ADVERTISE_FLAGS_VALUE 0x60 /* R=0, S=1 and O=1 */ 80 81 /* This marks the end of a packed structure section. */ 82 #include <packed_section_end.h> 83 84 #endif /* !defined(_bcmarp_h_) */ 85