2 // Copyright (c) 2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
16 /* Author - Santosh Sethupathi */
22 #include <rte_common.h>
23 #include <rte_malloc.h>
25 #include <rte_byteorder.h>
26 #include <rte_table_lpm.h>
27 #include <rte_table_hash.h>
28 #include <rte_pipeline.h>
32 #include <rte_jhash.h>
33 #include <rte_cycles.h>
35 #include <rte_pipeline.h>
36 #include "rte_ether.h"
43 uint8_t icmpv6_type; /**< ICMPV6 packet type. */
44 uint8_t icmpv6_code; /**< ICMPV6 packet code. */
45 uint16_t icmpv6_cksum; /**< ICMPV6 packet checksum. */
46 } __attribute__ ((__packed__));
51 struct icmpv6_info_hdr {
52 uint16_t icmpv6_ident; /**< ICMPV6 packet identifier. */
53 uint16_t icmpv6_seq_nb; /**< ICMPV6 packet sequence number. */
54 } __attribute__ ((__packed__));
59 struct icmpv6_nd_hdr {
60 /*ND Advertisement flags */
61 uint32_t icmpv6_reserved; /**< bit31-Router, bit30-Solicited, bit29-Override, bit28-bit0 unused */
63 uint8_t target_ipv6[16]; /**< target IPv6 address */
64 uint8_t type; /**< ICMPv6 Option*/
65 uint8_t length; /**< Length */
66 uint8_t link_layer_addr[6]; /**< Link layer address */
67 } __attribute__ ((__packed__));
70 #define ICMPV6_PROTOCOL_ID 58
71 #define ICMPV6_ECHO_REQUEST 0x0080
72 #define ICMPV6_ECHO_REPLY 0x0081
73 #define ICMPV6_NEIGHBOR_SOLICITATION 0x0087
74 #define ICMPV6_NEIGHBOR_ADVERTISEMENT 0x0088
75 #define IPV6_MULTICAST 0xFF02
77 #define NEIGHBOR_SOLICITATION_SET 0x40000000
78 #define NEIGHBOR_ROUTER_OVERRIDE_SET 0xa0000000
79 enum icmpv6_link_layer_Address_type {
80 e_Source_Link_Layer_Address = 1,
81 e_Target_Link_Layer_Address,
85 /* Checks whether ipv6 is multicast
88 uint8_t is_multicast_ipv6_addr(uint8_t ipv6[]);
93 struct icmpv6_port_address {
94 uint32_t ipv6[16]; /**< Ipv6 address */
95 uint64_t mac_addr; /**< Mac address */
99 * To store Icmpv6 Port address
101 struct icmpv6_port_address icmpv6_port_addresses[RTE_MAX_ETHPORTS];
103 #define MAX_NUM_ICMPv6_ENTRIES 64
104 struct rte_mbuf *lib_icmpv6_pkt;
107 * Processes icmpv6 packets
111 * port - port structure
113 void process_icmpv6_pkt(struct rte_mbuf *pkt, l2_phy_interface_t *port);
114 extern struct rte_mbuf *lib_nd_pkt[MAX_PORTS];