]> git.droids-corp.org - dpdk.git/commitdiff
net/sfc: prepare EF10 Rx event parser to be reused
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 19 Apr 2018 11:36:50 +0000 (12:36 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 17:00:58 +0000 (18:00 +0100)
Equal stride super-buffer Rx mode will be handled by the dedicated
Rx datapath and the mode has almost the same Rx event structure as
single packet Rx mode.

Restructure the code to allow the common parts to be shared.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
drivers/net/sfc/sfc_ef10_rx.c

index 92e1ef0edb5401c1f3a2e360281c89c71959dab2..f8eb3c18f3f417e17d7ca55ab285c50e5afac4a6 100644 (file)
@@ -199,8 +199,8 @@ sfc_ef10_rx_prepared(struct sfc_ef10_rxq *rxq, struct rte_mbuf **rx_pkts,
 }
 
 static void
-sfc_ef10_rx_ev_to_offloads(struct sfc_ef10_rxq *rxq, const efx_qword_t rx_ev,
-                          struct rte_mbuf *m)
+sfc_ef10_rx_ev_to_offloads(const efx_qword_t rx_ev, struct rte_mbuf *m,
+                          uint64_t ol_mask)
 {
        uint32_t tun_ptype = 0;
        /* Which event bit is mapped to PKT_RX_IP_CKSUM_* */
@@ -330,12 +330,8 @@ sfc_ef10_rx_ev_to_offloads(struct sfc_ef10_rxq *rxq, const efx_qword_t rx_ev,
                SFC_ASSERT(false);
        }
 
-       /* Remove RSS hash offload flag if RSS is not enabled */
-       if (~rxq->flags & SFC_EF10_RXQ_RSS_HASH)
-               ol_flags &= ~PKT_RX_RSS_HASH;
-
 done:
-       m->ol_flags = ol_flags;
+       m->ol_flags = ol_flags & ol_mask;
        m->packet_type = tun_ptype | l2_ptype | l3_ptype | l4_ptype;
 }
 
@@ -397,7 +393,10 @@ sfc_ef10_rx_process_event(struct sfc_ef10_rxq *rxq, efx_qword_t rx_ev,
        m->rearm_data[0] = rxq->rearm_data;
 
        /* Classify packet based on Rx event */
-       sfc_ef10_rx_ev_to_offloads(rxq, rx_ev, m);
+       /* Mask RSS hash offload flag if RSS is not enabled */
+       sfc_ef10_rx_ev_to_offloads(rx_ev, m,
+                                  (rxq->flags & SFC_EF10_RXQ_RSS_HASH) ?
+                                  ~0ull : ~PKT_RX_RSS_HASH);
 
        /* data_off already moved past pseudo header */
        pseudo_hdr = (uint8_t *)m->buf_addr + RTE_PKTMBUF_HEADROOM;