]> git.droids-corp.org - dpdk.git/commitdiff
net/ena: perform Tx cleanup before sending packets
authorMichal Krawczyk <mk@semihalf.com>
Wed, 23 Feb 2022 12:19:31 +0000 (13:19 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 23 Feb 2022 18:01:03 +0000 (19:01 +0100)
To increase likelihood that current burst will fit in the HW rings,
perform Tx cleanup before pushing packets to the HW. It may increase
latency a bit for sparse bursts, but the Tx flow now should be more
smooth.

It's also common order in the Tx burst function for other PMDs.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Dawid Gorecki <dgr@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
drivers/net/ena/ena_ethdev.c

index 4b82372155b4adf9469f216bda4c674b18761cc3..ed3dd162ba58595a587b61926ac6b5705a299fd3 100644 (file)
@@ -2776,6 +2776,10 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        }
 #endif
 
+       available_desc = ena_com_free_q_entries(tx_ring->ena_com_io_sq);
+       if (available_desc < tx_ring->tx_free_thresh)
+               ena_tx_cleanup(tx_ring);
+
        for (sent_idx = 0; sent_idx < nb_pkts; sent_idx++) {
                if (ena_xmit_mbuf(tx_ring, tx_pkts[sent_idx]))
                        break;
@@ -2784,9 +2788,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                        tx_ring->size_mask)]);
        }
 
-       available_desc = ena_com_free_q_entries(tx_ring->ena_com_io_sq);
-       tx_ring->tx_stats.available_desc = available_desc;
-
        /* If there are ready packets to be xmitted... */
        if (likely(tx_ring->pkts_without_db)) {
                /* ...let HW do its best :-) */
@@ -2795,9 +2796,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                tx_ring->pkts_without_db = false;
        }
 
-       if (available_desc < tx_ring->tx_free_thresh)
-               ena_tx_cleanup(tx_ring);
-
        tx_ring->tx_stats.available_desc =
                ena_com_free_q_entries(tx_ring->ena_com_io_sq);
        tx_ring->tx_stats.tx_poll++;