summaryrefslogtreecommitdiffstats
path: root/common/VIL/pipeline_arpicmp
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-07-20 11:22:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-20 11:22:33 +0000
commitd923180e4af2612361dd7d4bf1627092a4d552d8 (patch)
tree6809880ce8c96365778514f3c820f08588910ae5 /common/VIL/pipeline_arpicmp
parent51759157a499326cfe69ec0eecb00b1c5879bf50 (diff)
parent5997f97a236457f2994820d39e3738dfd61076e4 (diff)
Merge "[l2l3 stack] implements new nd state machine & nd buffering"
Diffstat (limited to 'common/VIL/pipeline_arpicmp')
-rw-r--r--common/VIL/pipeline_arpicmp/pipeline_arpicmp.c47
-rw-r--r--common/VIL/pipeline_arpicmp/pipeline_arpicmp_be.h229
2 files changed, 15 insertions, 261 deletions
diff --git a/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c b/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c
index 43e0be2d..6b42ad77 100644
--- a/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c
+++ b/common/VIL/pipeline_arpicmp/pipeline_arpicmp.c
@@ -28,9 +28,7 @@
#include "app.h"
#include "vnf_common.h"
-#ifndef VNF_ACL
#include "lib_arp.h"
-#endif
#include <rte_ip.h>
#include <rte_udp.h>
@@ -97,9 +95,7 @@ cmd_arp_add_parsed(void *parsed_result,
} else {
memcpy(ipv6, params->ip.addr.ipv6.s6_addr, 16);
populate_nd_entry(&params->macaddr, ipv6, params->port_id
- #ifndef VNF_ACL
, STATIC_ND
- #endif
);
}
}
@@ -155,30 +151,25 @@ cmd_arp_del_parsed(void *parsed_result,
__rte_unused struct cmdline *cl, __rte_unused void *data)
{
struct cmd_arp_del_result *params = parsed_result;
- uint8_t ipv6[16];
-
- #if 0
- struct pipeline_arp_icmp_arp_key key;
- key.type = PIPELINE_ARP_ICMP_ARP_IPV4;
- key.key.ipv4.ip = rte_cpu_to_be_32(params->ip.addr.ipv4.s_addr);
- key.key.ipv4.port_id = params->port_id;
- remove_arp_entry(rte_bswap32(req->key.key.ipv4.ip),
- req->key.key.ipv4.port_id);
- #endif
- struct arp_key_ipv4 arp_key;
- arp_key.port_id = params->port_id;
- arp_key.ip = rte_cpu_to_be_32(params->ip.addr.ipv4.s_addr);
- arp_key.filler1 = 0;
- arp_key.filler2 = 0;
- arp_key.filler3 = 0;
-
- struct arp_entry_data *new_arp_data = retrieve_arp_entry(arp_key, STATIC_ARP);
if (params->ip.family == AF_INET) {
+ struct arp_key_ipv4 arp_key;
+ arp_key.port_id = params->port_id;
+ arp_key.ip = rte_cpu_to_be_32(params->ip.addr.ipv4.s_addr);
+ arp_key.filler1 = 0;
+ arp_key.filler2 = 0;
+ arp_key.filler3 = 0;
+ struct arp_entry_data *new_arp_data = retrieve_arp_entry(arp_key, STATIC_ARP);
remove_arp_entry(new_arp_data, &arp_key);
} else {
- memcpy(ipv6, params->ip.addr.ipv6.s6_addr, 16);
- remove_nd_entry_ipv6(ipv6, params->port_id);
+ struct nd_key_ipv6 nd_key;
+ nd_key.port_id = params->port_id;
+ memcpy(&nd_key.ipv6[0], params->ip.addr.ipv6.s6_addr, 16);
+ nd_key.filler1 = 0;
+ nd_key.filler2 = 0;
+ nd_key.filler3 = 0;
+ struct nd_entry_data *new_nd_data = retrieve_nd_entry(nd_key, STATIC_ND);
+ remove_nd_entry_ipv6(new_nd_data, &nd_key);
}
}
@@ -250,11 +241,7 @@ cmd_arp_req_parsed(void *parsed_result,
printf("ARP - requesting arp for ip 0x%x, port %d\n",
params->ip.addr.ipv4.s_addr, params->port_id);
- #ifdef VNF_ACL
- request_arp_wrap(params->port_id, params->ip.addr.ipv4.s_addr);
- #else
request_arp(params->port_id, params->ip.addr.ipv4.s_addr);
- #endif
/*give pipeline number too*/
}
@@ -401,7 +388,6 @@ static cmdline_parse_inst_t cmd_show_ports_info = {
},
};
-#ifndef VNF_ACL
struct cmd_arp_dbg_result {
cmdline_fixed_string_t arpdbg_str;
uint32_t flag;
@@ -479,7 +465,6 @@ cmdline_parse_inst_t cmd_arp_timer = {
NULL,
},
};
-#endif
/*
* Forwarding of packets in I/O mode.
@@ -2106,10 +2091,8 @@ static cmdline_parse_ctx_t pipeline_cmds[] = {
/* (cmdline_parse_inst_t *) & cmd_set_hash_input_set_5,*/
(cmdline_parse_inst_t *) &cmd_set_hash_global_config,
(cmdline_parse_inst_t *) &cmd_set_sym_hash_ena_per_port,
- #ifndef VNF_ACL
(cmdline_parse_inst_t *) &cmd_arp_dbg,
(cmdline_parse_inst_t *) &cmd_arp_timer,
- #endif
NULL,
};
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 <rte_pipeline.h>
-#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