From 5997f97a236457f2994820d39e3738dfd61076e4 Mon Sep 17 00:00:00 2001 From: Vishwesh M Rudramuni Date: Thu, 8 Jun 2017 02:53:22 +0530 Subject: [l2l3 stack] implements new nd state machine & nd buffering JIRA: SAMPLEVNF-32 This patch implements ~New nd state machine implementing new states like INCOMPLETE, COMPLETE, PROBE, STALE. ~Implementing nd buffering, when nd is unresolved. ~Integratig the new changes with vCGNAPT ~Integrating the new changes with vACL ~Integrating the new changes with vFW. ~Adding locks to synchronize against multiple VNF threads Change-Id: Iaee4f4599ca3016ebb50ee2d9133fd8c39c5cd04 Signed-off-by: Vishwesh M Rudramuni --- common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h | 229 ---------------------- 1 file changed, 229 deletions(-) (limited to 'common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h') diff --git a/common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h b/common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h index cfbbe617..a73dcb29 100644 --- a/common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h +++ b/common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h @@ -44,157 +44,6 @@ f_ah( \ extern struct app_params *myApp; void print_pkt1(struct rte_mbuf *pkt); struct ether_addr *get_link_hw_addr(uint8_t out_port); -#ifdef VNF_ACL - -#include -#include "rte_ether.h" -#include "app.h" - -#if (RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN) -// x86 == little endian -// network == big endian -#define CHECK_ENDIAN_16(x) rte_be_to_cpu_16(x) -#define CHECK_ENDIAN_32(x) rte_be_to_cpu_32(x) -#else -#define CHECK_ENDIAN_16(x) (x) -#define CHECK_ENDIAN_32(x) (x) -#endif - - -#define MAX_ARP_RT_ENTRY 32 -#define MAX_ND_RT_ENTRY 32 - -#define ND_IPV6_ADDR_SIZE 16 /* 16 Byte of IPv6 Address */ - -enum { -ARP_FOUND, -ARP_NOT_FOUND, -NH_NOT_FOUND, -}; - -enum arp_key_type { - ARP_IPV4, - /* ND IPv6 */ - ND_IPV6, -}; - -struct arp_key_ipv4 { - uint32_t ip; - uint8_t port_id; - uint8_t filler1; - uint8_t filler2; - uint8_t filler3; -}; - -/* ND IPv6 */ -struct nd_key_ipv6 { - /*128 Bit of IPv6 Address */ - /*<48bit Network> <16bit Subnet> <64bit Interface> */ - uint8_t ipv6[ND_IPV6_ADDR_SIZE]; - uint8_t port_id; - uint8_t filler1; - uint8_t filler2; - uint8_t filler3; -}; - -struct arp_key { - enum arp_key_type type; - union { - struct arp_key_ipv4 ipv4; - } key; -}; - -struct lib_arp_route_table_entry { - uint32_t ip; - uint32_t mask; - uint32_t port; - uint32_t nh; -}; - -struct lib_nd_route_table_entry { - uint8_t ipv6[16]; - uint8_t depth; - uint32_t port; - uint8_t nhipv6[16]; -}; -extern struct lib_arp_route_table_entry lib_arp_route_table[MAX_ARP_RT_ENTRY]; -extern struct lib_nd_route_table_entry lib_nd_route_table[MAX_ND_RT_ENTRY]; - -extern uint8_t prv_in_port_a[PIPELINE_MAX_PORT_IN]; -extern void convert_prefixlen_to_netmask_ipv6(uint32_t depth, - uint8_t netmask_ipv6[]); -uint32_t get_nh(uint32_t, uint32_t*); -void get_nh_ipv6(uint8_t ipv6[], uint32_t *port, uint8_t nhipv6[]); - -extern uint32_t ARPICMP_DEBUG; - - -/* ARP entry populated and echo reply recieved */ -#define COMPLETE 1 -/* ARP entry populated and either awaiting echo reply or stale entry */ -#define INCOMPLETE 0 - -/* ND IPv6 */ -extern uint32_t NDIPV6_DEBUG; - -/* ICMPv6 entry populated and echo reply recieved */ -#define ICMPv6_COMPLETE 1 -/* ICMPv6 entry populated and either awaiting echo reply or stale entry */ -#define ICMPv6_INCOMPLETE 0 - -struct arp_entry_data { - struct ether_addr eth_addr; - uint8_t port; - uint8_t status; - uint32_t ip; -} __attribute__ ((__packed__)); - -/*ND IPv6*/ -struct nd_entry_data { - struct ether_addr eth_addr; - uint8_t port; - uint8_t status; - uint8_t ipv6[ND_IPV6_ADDR_SIZE]; -} __attribute__ ((__packed__)); - -int get_dest_mac_address(const uint32_t ipaddr, const uint32_t phy_port, - struct ether_addr *hw_addr, uint32_t *nhip); -int get_dest_mac_addr(const uint32_t ipaddr, const uint32_t phy_port, - struct ether_addr *hw_addr); - -int get_dest_mac_address_ipv6(uint8_t ipv6addr[], uint32_t phy_port, - struct ether_addr *hw_addr, uint8_t nhipv6[]); - -void lib_arp_request_arp( - const uint32_t ipaddr, - const uint32_t phy_port, - struct rte_pipeline *rte_p); - -void print_arp_table(void); -void print_nd_table(void); -void remove_arp_entry(uint32_t ipaddr, uint8_t portid); -void remove_nd_entry_ipv6(uint8_t ipv6addr[], uint8_t portid); -void populate_arp_entry(const struct ether_addr *hw_addr, uint32_t ipaddr, - uint8_t portid); -/*ND IPv6*/ -int populate_nd_entry(const struct ether_addr *hw_addr, uint8_t ip[], - uint8_t portid); -void request_arp(uint8_t port_id, uint32_t ip, struct rte_pipeline *rte_p); -void request_arp_wrap(uint8_t port_id, uint32_t ip); -void request_echo(unsigned int port_id, uint32_t ip); - -void process_arpicmp_pkt(struct rte_mbuf *pkt, uint32_t out_port, - uint32_t pkt_num); - -struct arp_entry_data *retrieve_arp_entry(const struct arp_key_ipv4 arp_key); -struct nd_entry_data *retrieve_nd_entry(struct nd_key_ipv6 nd_key); - -struct nd_entry_data *retrieve_nd_entry(struct nd_key_ipv6 nd_key); - -void lib_nd_init(/*struct pipeline_params *params, */ struct app_params *app); -void print_pkt1(struct rte_mbuf *pkt); - -#endif uint8_t lb_outport_id[PIPELINE_MAX_PORT_IN]; struct pipeline *loadb_pipeline[PIPELINE_MAX_PORT_IN]; @@ -203,14 +52,6 @@ uint8_t vnf_to_loadb_map[PIPELINE_MAX_PORT_IN]; uint8_t port_to_loadb_map[PIPELINE_MAX_PORT_IN]; uint8_t loadb_pipeline_nums[PIPELINE_MAX_PORT_IN]; -#if 0 -uint8_t lb_outport_id[PIPELINE_MAX_PORT_IN]; -struct pipeline *arp_pipeline[PIPELINE_MAX_PORT_IN]; -uint8_t vnf_to_arp_map[PIPELINE_MAX_PORT_IN]; -uint8_t port_to_arp_map[PIPELINE_MAX_PORT_IN]; -uint8_t arp_pipeline_nums[PIPELINE_MAX_PORT_IN]; -#endif - void set_port_to_loadb_map(uint8_t pipeline_num); uint8_t get_port_to_loadb_map(uint8_t phy_port_id); /* acts on port_to_loadb_map */ @@ -270,74 +111,4 @@ struct pipeline_arpicmp_entry_dbg_msg_rsp { int status; }; -#ifdef VNF_ACL - - /* ICMPv6 Header */ -struct icmpv6_hdr { - uint8_t icmpv6_type; /* ICMPV6 packet type. */ - uint8_t icmpv6_code; /* ICMPV6 packet code. */ - uint16_t icmpv6_cksum; /* ICMPV6 packet checksum. */ -} __attribute__ ((__packed__)); - - /** - * ICMPV6 Info Header - */ -struct icmpv6_info_hdr { - uint16_t icmpv6_ident; /* ICMPV6 packet identifier. */ - uint16_t icmpv6_seq_nb; /* ICMPV6 packet sequence number. */ -} __attribute__ ((__packed__)); - - /** - * ICMPV6 ND Header - */ -struct icmpv6_nd_hdr { - /*ND Advertisement flags */ - uint32_t icmpv6_reserved; - /* bit31-Router, bit30-Solicited, bit29-Override, bit28-bit0 unused */ - - uint8_t target_ipv6[16]; /**< target IPv6 address */ - /*ICMPv6 Option*/ - uint8_t type; - uint8_t length; - struct ether_addr link_layer_address; -} __attribute__ ((__packed__)); - - /* Icmpv6 types */ - #define ICMPV6_PROTOCOL_ID 58 - #define ICMPV6_ECHO_REQUEST 0x0080 - #define ICMPV6_ECHO_REPLY 0x0081 - #define ICMPV6_NEIGHBOR_SOLICITATION 0x0087 - #define ICMPV6_NEIGHBOR_ADVERTISEMENT 0x0088 - #define IPV6_MULTICAST 0xFF02 - - #define NEIGHBOR_SOLICITATION_SET 0x40000000 -enum icmpv6_link_layer_Address_type { - e_Source_Link_Layer_Address = 1, - e_Target_Link_Layer_Address, - e_Link_Layer_Address -}; - -uint8_t is_multicast_ipv6_addr(uint8_t ipv6[]); -struct icmpv6_port_address { - uint32_t ipv6[16]; - uint64_t mac_addr; -}; - -struct icmpv6_port_address icmpv6_port_addresses[RTE_MAX_ETHPORTS]; - - #define MAX_NUM_ICMPv6_ENTRIES 64 - //struct rte_pipeline *myicmpP; -struct rte_mbuf *lib_icmpv6_pkt; -void request_icmpv6_echo(uint32_t port_id, uint8_t ipv6[]); -void request_icmpv6_echo_message(uint16_t port_id, uint8_t ipv6[], - struct ether_addr *gw_addr); -void -process_icmpv6_pkt(struct rte_mbuf *pkt, uint32_t out_port, uint32_t pkt_num); - -int get_dest_mac_addr_port(const uint32_t ipaddr, - uint32_t *phy_port, struct ether_addr *hw_addr); - -int get_dest_mac_address_ipv6_port(uint8_t ipv6addr[], uint32_t *phy_port, - struct ether_addr *hw_addr, uint8_t nhipv6[]); -#endif #endif -- cgit 1.2.3-korg