]> git.droids-corp.org - dpdk.git/commitdiff
net/iavf: count continuous DD bits for Arm
authorKathleen Capella <kathleen.capella@arm.com>
Sat, 5 Feb 2022 00:26:29 +0000 (00:26 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 9 Feb 2022 02:00:19 +0000 (03:00 +0100)
On Arm platforms, reading of descriptors may be re-ordered causing the
status of DD bits to be discontinuous. Add logic to only process
continuous descriptors by checking DD bits.

Fixes: 1060591eada5 ("net/avf: enable bulk allocate Rx")
Cc: stable@dpdk.org
Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_rxtx.c

index 715893864349c2f6e70b27cd006c710444cb8ee9..f07d886821908a28b8fa2fb98dd17e003d76a824 100644 (file)
@@ -1897,7 +1897,7 @@ iavf_rx_scan_hw_ring(struct iavf_rx_queue *rxq)
        uint16_t pkt_len;
        uint64_t qword1;
        uint32_t rx_status;
-       int32_t s[IAVF_LOOK_AHEAD], nb_dd;
+       int32_t s[IAVF_LOOK_AHEAD], var, nb_dd;
        int32_t i, j, nb_rx = 0;
        uint64_t pkt_flags;
        const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
@@ -1928,9 +1928,27 @@ iavf_rx_scan_hw_ring(struct iavf_rx_queue *rxq)
 
                rte_smp_rmb();
 
-               /* Compute how many status bits were set */
-               for (j = 0, nb_dd = 0; j < IAVF_LOOK_AHEAD; j++)
-                       nb_dd += s[j] & (1 << IAVF_RX_DESC_STATUS_DD_SHIFT);
+               /* Compute how many contiguous DD bits were set */
+               for (j = 0, nb_dd = 0; j < IAVF_LOOK_AHEAD; j++) {
+                       var = s[j] & (1 << IAVF_RX_DESC_STATUS_DD_SHIFT);
+#ifdef RTE_ARCH_ARM
+                       /* For Arm platforms, count only contiguous descriptors
+                        * whose DD bit is set to 1. On Arm platforms, reads of
+                        * descriptors can be reordered. Since the CPU may
+                        * be reading the descriptors as the NIC updates them
+                        * in memory, it is possbile that the DD bit for a
+                        * descriptor earlier in the queue is read as not set
+                        * while the DD bit for a descriptor later in the queue
+                        * is read as set.
+                        */
+                       if (var)
+                               nb_dd += 1;
+                       else
+                               break;
+#else
+                       nb_dd += var;
+#endif
+               }
 
                nb_rx += nb_dd;