summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2018-06-03 03:36:25 +0530
committerDeepak S <deepak.s@linux.intel.com>2018-06-03 03:36:41 +0530
commit552f5992678ad6a226e0c8216eafed9a795c96ee (patch)
treec147df2c02ee1dbaafe04117cc62e9679639e688
parentb18290d21a28cabbb8b7a31b9c54b7c30e62ec19 (diff)
Temp Fix for vFW perf issue
Change-Id: I324fcac7a65c0d221d5d422f419deb9c0f864172 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
-rw-r--r--VNFs/vFW/pipeline/pipeline_vfw_be.c17
-rw-r--r--common/VIL/gateway/gateway.c21
-rw-r--r--common/VIL/gateway/gateway.h46
-rw-r--r--common/VIL/l2l3_stack/lib_arp.c10
4 files changed, 56 insertions, 38 deletions
diff --git a/VNFs/vFW/pipeline/pipeline_vfw_be.c b/VNFs/vFW/pipeline/pipeline_vfw_be.c
index 71fd5cde..23e2aa04 100644
--- a/VNFs/vFW/pipeline/pipeline_vfw_be.c
+++ b/VNFs/vFW/pipeline/pipeline_vfw_be.c
@@ -1163,7 +1163,13 @@ static void vfw_fwd_pkts_ipv4(struct rte_mbuf **pkts, uint64_t *pkts_mask,
src_phy_port = pkt->port;
uint32_t dst_phy_port = INVALID_DESTIF;
- if(is_gateway()){
+ if(is_phy_port_privte(src_phy_port))
+ dst_phy_port = prv_to_pub_map[src_phy_port];
+ else
+ dst_phy_port = pub_to_prv_map[src_phy_port];
+
+
+ if(likely(is_gateway())){
struct ipv4_hdr *ipv4hdr = (struct ipv4_hdr *)
RTE_MBUF_METADATA_UINT32_PTR(pkt, IP_START);
@@ -1174,13 +1180,13 @@ static void vfw_fwd_pkts_ipv4(struct rte_mbuf **pkts, uint64_t *pkts_mask,
uint32_t nhip = 0;
uint32_t dst_ip_addr = rte_bswap32(ipv4hdr->dst_addr);
- gw_get_nh_port_ipv4(dst_ip_addr, &dst_phy_port, &nhip);
+ gw_get_route_nh_port_ipv4(dst_ip_addr, &dst_phy_port, &nhip, dst_phy_port);
ret_arp_data = get_dest_mac_addr_ipv4(nhip, dst_phy_port, &dst_mac);
/* Gateway Proc Ends */
- if (arp_cache_dest_mac_present(dst_phy_port)) {
+ if (likely(arp_cache_dest_mac_present(dst_phy_port))) {
ether_addr_copy(&dst_mac, &ehdr->d_addr);
ether_addr_copy(get_link_hw_addr(dst_phy_port), &ehdr->s_addr);
@@ -1221,11 +1227,6 @@ static void vfw_fwd_pkts_ipv4(struct rte_mbuf **pkts, uint64_t *pkts_mask,
}
} else {
/* IP Pkt forwarding based on pub/prv mapping */
- if(is_phy_port_privte(src_phy_port))
- dst_phy_port = prv_to_pub_map[src_phy_port];
- else
- dst_phy_port = pub_to_prv_map[src_phy_port];
-
meta_data_addr->output_port = vfw_pipe->outport_id[dst_phy_port];
if(VFW_DEBUG) {
diff --git a/common/VIL/gateway/gateway.c b/common/VIL/gateway/gateway.c
index baf22cf5..7ec3c68f 100644
--- a/common/VIL/gateway/gateway.c
+++ b/common/VIL/gateway/gateway.c
@@ -122,29 +122,16 @@ uint32_t is_gateway(void)
*/
void gw_get_nh_port_ipv4(uint32_t dst_ip_addr,
- uint32_t *dst_port, uint32_t *nhip)
+ uint32_t *dst_port, uint32_t *nhip)
{
- int i;
uint32_t j;
*nhip = 0;
*dst_port = 0xff;
- for(j = 0; j < gw_get_num_ports(); j++){
-
- for (i = 0; i < p_route_data[j]->route_ent_cnt; i++) {
-
- if ((p_route_data[j]->route_table[i].nh_mask) ==
- (dst_ip_addr &
- p_route_data[j]->route_table[i].mask)) {
-
- *dst_port = p_route_data[j]->route_table[i].port;
- *nhip = p_route_data[j]->route_table[i].nh;
-
- lib_arp_nh_found++;
- return;
- }
- }
+ for(j = 0; j < num_out_ports; j++) {
+ if (gw_get_route_nh_port_ipv4(dst_ip_addr, dst_port, nhip, j))
+ return;
}
}
diff --git a/common/VIL/gateway/gateway.h b/common/VIL/gateway/gateway.h
index 47a3b8a7..2da8ff64 100644
--- a/common/VIL/gateway/gateway.h
+++ b/common/VIL/gateway/gateway.h
@@ -68,17 +68,17 @@ struct route_table_entry {
struct route_data {
struct route_table_entry route_table[MAX_ROUTE_ENTRY_SIZE];
uint8_t route_ent_cnt;
-};
+}__rte_cache_aligned;
/**
* A structure for Route table entires of IPv6
*
*/
struct nd_route_table_entry {
+ uint32_t port; /**< Port */
uint8_t nhipv6[16]; /**< next hop Ipv6 */
uint8_t depth; /**< Depth */
- uint32_t port; /**< Port */
-};
+}__rte_cache_aligned;
/**
* Routing table for IPv6
@@ -87,7 +87,7 @@ struct nd_route_table_entry {
struct nd_route_data {
struct nd_route_table_entry nd_route_table[MAX_ND_ROUTE_ENTRY_SIZE];
uint8_t nd_route_ent_cnt;
-};
+}__rte_cache_aligned;
extern void gw_init(uint32_t num_ports);
@@ -95,6 +95,44 @@ extern uint32_t gw_get_num_ports(void);
extern uint32_t is_gateway(void);
+/**
+ * Get the route next hop ip address and port number for IPv4
+ * @param dst_ip_addr
+ * Destination IPv4 address
+ * @param dst_port
+ * A pointer to destination port
+ * @param nhip
+ * A pointer to next hop ip address
+ */
+
+static inline int gw_get_route_nh_port_ipv4(uint32_t dst_ip_addr,
+ uint32_t *dst_port, uint32_t *nhip, uint32_t nport)
+{
+ int i = 0;
+ uint32_t j = nport;
+
+ while(likely(i < p_route_data[j]->route_ent_cnt)) {
+ if (likely((p_route_data[j]->route_table[i].nh_mask) ==
+ (dst_ip_addr &
+ p_route_data[j]->route_table[i].mask))) {
+
+ *dst_port = p_route_data[j]->route_table[i].port;
+ *nhip = p_route_data[j]->route_table[i].nh;
+
+#ifdef ARPICMP_DEBUG
+ lib_arp_nh_found++;
+#endif
+ return 1;
+ }
+ i++;
+ }
+
+ *nhip = 0;
+ *dst_port = 0xff;
+ return 0;
+}
+
+
extern void gw_get_nh_port_ipv4(uint32_t dst_ip_addr,
uint32_t *dst_port, uint32_t *nhip);
diff --git a/common/VIL/l2l3_stack/lib_arp.c b/common/VIL/l2l3_stack/lib_arp.c
index d59f4b79..9ea57d77 100644
--- a/common/VIL/l2l3_stack/lib_arp.c
+++ b/common/VIL/l2l3_stack/lib_arp.c
@@ -294,20 +294,12 @@ struct arp_entry_data *get_dest_mac_addr_ipv4(const uint32_t nhip,
uint32_t phy_port, struct ether_addr *hw_addr)
{
struct arp_entry_data *ret_arp_data = NULL;
- struct ether_addr *x;
uint8_t index;
/* as part of optimization we store mac address in cache
* & thus can be sent without having to retrieve
*/
- if (arp_cache_dest_mac_present(phy_port)) {
- x = get_local_cache_hw_addr(phy_port, nhip);
- if (!x) {
- printf("local copy of address not stored\n");
- return NULL;
- }
-
- ether_addr_copy(x, hw_addr);
+ if (likely(arp_cache_dest_mac_present(phy_port))) {
return &arp_entry_data_default;
}