Improve l3fwd performance 19/61819/2
authorXavier Simonart <xavier.simonart@intel.com>
Tue, 4 Sep 2018 09:58:36 +0000 (11:58 +0200)
committerXavier Simonart <xavier.simonart@intel.com>
Fri, 14 Sep 2018 14:30:36 +0000 (14:30 +0000)
JIRA: SAMPLEVNF-128

Improve performance of l3fwd use-case.
L3fwd did not disable TX offload flags, which resulted in
non-vector mode to be used in pmd in some cases like bare-metal.
Note that in some cases such as virtio, vector mode was already
used as OVS reports that it does not support TX-offload, hence
TX-offload was already disabled on virtio.
Using vector mode usually brings higher performance.

Change-Id: I102b846d604a9cf28c6b7dae8bedbe918ccfcf6c
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
VNFs/DPPD-PROX/handle_routing.c

index 9dd45ed..8cdc842 100644 (file)
@@ -48,7 +48,6 @@ struct task_routing {
        struct lcore_cfg                *lconf;
        struct rte_lpm                  *ipv4_lpm;
        struct next_hop                 *next_hops;
-       int                             offload_crc;
        uint32_t                        number_free_rules;
        uint16_t                        qinq_tag;
        uint32_t                        marking[4];
@@ -144,9 +143,6 @@ static void init_task_routing(struct task_base *tbase, struct task_args *targ)
        }
 
        struct prox_port_cfg *port = find_reachable_port(targ);
-       if (port) {
-               task->offload_crc = port->capabilities.tx_offload_cksum;
-       }
 
        targ->lconf->ctrl_func_m[targ->task] = routing_update;
        targ->lconf->ctrl_timeout = freq_to_tsc(20);
@@ -186,11 +182,9 @@ static void set_l2(struct task_routing *task, struct rte_mbuf *mbuf, uint8_t nh_
        *((uint64_t *)(&peth->s_addr)) = task->src_mac[task->next_hops[nh_idx].mac_port.out_idx];
 }
 
-static void set_l2_mpls(struct task_routing *task, struct rte_mbuf *mbuf, uint8_t nh_idx, uint16_t l2_len)
+static void set_l2_mpls(struct task_routing *task, struct rte_mbuf *mbuf, uint8_t nh_idx)
 {
        struct ether_hdr *peth = (struct ether_hdr *)rte_pktmbuf_prepend(mbuf, sizeof(struct mpls_hdr));
-       l2_len += sizeof(struct mpls_hdr);
-       prox_ip_cksum(mbuf, (struct ipv4_hdr *)((uint8_t *)peth + l2_len), l2_len, sizeof(struct ipv4_hdr), task->offload_crc);
 
        *((uint64_t *)(&peth->d_addr)) = task->next_hops[nh_idx].mac_port_8bytes;
        *((uint64_t *)(&peth->s_addr)) = task->src_mac[task->next_hops[nh_idx].mac_port.out_idx];
@@ -255,7 +249,7 @@ static uint8_t route_ipv4(struct task_routing *task, uint8_t *beg, uint32_t ip_o
                        rte_pktmbuf_trim(mbuf, padlen);
                 }
 
-                set_l2_mpls(task, mbuf, next_hop_index, ip_offset);
+                set_l2_mpls(task, mbuf, next_hop_index);
         }
        else {
                set_l2(task, mbuf, next_hop_index);
@@ -311,7 +305,7 @@ static struct task_init task_init_routing = {
        .mode_str = "routing",
        .init = init_task_routing,
        .handle = handle_routing_bulk,
-       .flag_features = TASK_FEATURE_ROUTING,
+       .flag_features = TASK_FEATURE_ROUTING|TASK_FEATURE_TXQ_FLAGS_NOOFFLOADS,
        .size = sizeof(struct task_routing)
 };