[dpdk-dev,1/2] net/sfc: check added but not completed descs on EF10 Tx reap

Message ID 1495806644-32725-1-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko May 26, 2017, 1:50 p.m. UTC
  There is not point to check other Tx descriptors.
It is important if Tx datapath does not reset Tx descriptor
mbuf pointer to NULL on completion (EF10 simple Tx will do).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: David Riddoch <driddoch@solarflare.com>
---
 drivers/net/sfc/sfc_ef10_tx.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
  

Comments

Ferruh Yigit May 30, 2017, 12:59 p.m. UTC | #1
On 5/26/2017 2:50 PM, Andrew Rybchenko wrote:
> There is not point to check other Tx descriptors.
> It is important if Tx datapath does not reset Tx descriptor
> mbuf pointer to NULL on completion (EF10 simple Tx will do).
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
> Reviewed-by: David Riddoch <driddoch@solarflare.com>

Series applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index 5482db8..fdeea2c 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -516,12 +516,15 @@  static void
 sfc_ef10_tx_qreap(struct sfc_dp_txq *dp_txq)
 {
 	struct sfc_ef10_txq *txq = sfc_ef10_txq_by_dp_txq(dp_txq);
-	unsigned int txds;
+	unsigned int completed;
 
-	for (txds = 0; txds <= txq->ptr_mask; ++txds) {
-		if (txq->sw_ring[txds].mbuf != NULL) {
-			rte_pktmbuf_free(txq->sw_ring[txds].mbuf);
-			txq->sw_ring[txds].mbuf = NULL;
+	for (completed = txq->completed; completed != txq->added; ++completed) {
+		struct sfc_ef10_tx_sw_desc *txd;
+
+		txd = &txq->sw_ring[completed & txq->ptr_mask];
+		if (txd->mbuf != NULL) {
+			rte_pktmbuf_free(txd->mbuf);
+			txd->mbuf = NULL;
 		}
 	}