net/fm10k: fix vector Rx
authorJeff Guo <jia.guo@intel.com>
Fri, 16 Oct 2020 09:44:30 +0000 (17:44 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:24:26 +0000 (23:24 +0100)
The scattered receive path should use a wrapper function to achieve the
goal of burst maximizing.

Bugzilla ID: 516
Fixes: fe65e1e1ce61 ("fm10k: add vector scatter Rx")
Cc: stable@dpdk.org
Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/fm10k/fm10k_rxtx_vec.c

index eff3933..6fcc939 100644 (file)
@@ -645,18 +645,15 @@ fm10k_reassemble_packets(struct fm10k_rx_queue *rxq,
        return pkt_idx;
 }
 
-/*
- * vPMD receive routine that reassembles scattered packets
+/**
+ * vPMD receive routine that reassembles single burst of 32 scattered packets
  *
  * Notice:
  * - don't support ol_flags for rss and csum err
- * - nb_pkts > RTE_FM10K_MAX_RX_BURST, only scan RTE_FM10K_MAX_RX_BURST
- *   numbers of DD bit
  */
-uint16_t
-fm10k_recv_scattered_pkts_vec(void *rx_queue,
-                               struct rte_mbuf **rx_pkts,
-                               uint16_t nb_pkts)
+static uint16_t
+fm10k_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+                              uint16_t nb_pkts)
 {
        struct fm10k_rx_queue *rxq = rx_queue;
        uint8_t split_flags[RTE_FM10K_MAX_RX_BURST] = {0};
@@ -691,6 +688,32 @@ fm10k_recv_scattered_pkts_vec(void *rx_queue,
                &split_flags[i]);
 }
 
+/**
+ * vPMD receive routine that reassembles scattered packets.
+ */
+uint16_t
+fm10k_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+                             uint16_t nb_pkts)
+{
+       uint16_t retval = 0;
+
+       while (nb_pkts > RTE_FM10K_MAX_RX_BURST) {
+               uint16_t burst;
+
+               burst = fm10k_recv_scattered_burst_vec(rx_queue,
+                                                      rx_pkts + retval,
+                                                      RTE_FM10K_MAX_RX_BURST);
+               retval += burst;
+               nb_pkts -= burst;
+               if (burst < RTE_FM10K_MAX_RX_BURST)
+                       return retval;
+       }
+
+       return retval + fm10k_recv_scattered_burst_vec(rx_queue,
+                                                      rx_pkts + retval,
+                                                      nb_pkts);
+}
+
 static const struct fm10k_txq_ops vec_txq_ops = {
        .reset = fm10k_reset_tx_queue,
 };