All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
To: sebastian.hesselbarth@gmail.com, netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org,
	Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Subject: [PATCH net] net: mv643xx_eth: implement descriptor cleanup in txq_submit_tso
Date: Fri, 24 Jan 2025 11:54:14 +0530	[thread overview]
Message-ID: <20250124062414.195101-1-dheeraj.linuxdev@gmail.com> (raw)

Implement cleanup of used descriptors in the error path of txq_submit_tso.

Fixes: 3ae8f4e0b98b ("net: mv643xx_eth: Implement software TSO")
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 67a6ff07c83d..8d217f8d451e 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -881,10 +881,20 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb,
 	txq_enable(txq);
 	txq->tx_desc_count += desc_count;
 	return 0;
+
 err_release:
-	/* TODO: Release all used data descriptors; header descriptors must not
+	/* Release all used data descriptors; header descriptors must not
 	 * be DMA-unmapped.
 	 */
+	for (int i = 0; i < desc_count; i++) {
+		int desc_index = (txq->tx_curr_desc + i) % txq->tx_ring_size;
+		struct tx_desc *desc = &txq->tx_desc_area[desc_index];
+		desc->cmd_sts = 0; /* Reset the descriptor */
+	}
+
+	/* Adjust the descriptor count */
+	txq->tx_desc_count -= desc_count;
+
 	return ret;
 }
 
-- 
2.34.1


             reply	other threads:[~2025-01-24  6:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24  6:24 Dheeraj Reddy Jonnalagadda [this message]
2025-01-28 10:47 ` [PATCH net] net: mv643xx_eth: implement descriptor cleanup in txq_submit_tso Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250124062414.195101-1-dheeraj.linuxdev@gmail.com \
    --to=dheeraj.linuxdev@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sebastian.hesselbarth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.