diff mbox series

[net] net: mv643xx_eth: implement descriptor cleanup in txq_submit_tso

Message ID 20250124062414.195101-1-dheeraj.linuxdev@gmail.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net] net: mv643xx_eth: implement descriptor cleanup in txq_submit_tso | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch warning WARNING: Missing a blank line after declarations
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-01-25--09-00 (tests: 885)

Commit Message

Dheeraj Reddy Jonnalagadda Jan. 24, 2025, 6:24 a.m. UTC
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 mbox series

Patch

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;
 }