Skip to contentSkip to conversation

octeontx2-pf: Free pending and dropped SQEs

PATCH Applied Geetha sowjanya 2 participants 2 messages Oct 31, 2023 – Nov 6, 2023

Subsystems (4)
lore
Share & tools
lore

Geetha sowjanya

author maintainer
#0 lore raw

PATCH 1/1 octeontx2-pf: Free pending and dropped SQEs

On interface down, the pending SQEs in the NIX get dropped or drained out during SMQ flush. But skb's pointed by these SQEs never get free or updated to the stack as respective CQE never get added.
This patch fixes the issue by freeing all valid skb's in SQ SG list.

Fixes b1bc8457e9d0 ("octeontx2-pf: Cleanup all receive buffers in SG descriptor")
---
 .../marvell/octeontx2/nic/otx2_common.c       | 15 +++----
 .../marvell/octeontx2/nic/otx2_common.h       |  1 +
 .../ethernet/marvell/octeontx2/nic/otx2_pf.c  |  1 +
 .../marvell/octeontx2/nic/otx2_txrx.c         | 42 +++++++++++++++++++
 4 files changed, 49 insertions(+), 10 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +5 -10
index 1a42bfded872..7ca6941ea0b9 100644
@@ -818,7 +818,6 @@ void otx2_sqb_flush(struct otx2_nic *pfvf)
 	int qidx, sqe_tail, sqe_head;
 	struct otx2_snd_queue *sq;
 	u64 incr, *ptr, val;
-	int timeout = 1000;
 
 	ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_SQ_OP_STATUS);
 	for (qidx = 0; qidx < otx2_get_total_tx_queues(pfvf); qidx++) {
@@ -827,15 +826,11 @@ void otx2_sqb_flush(struct otx2_nic *pfvf)
 			continue;
 
 		incr = (u64)qidx << 32;
-		while (timeout) {
-			val = otx2_atomic64_add(incr, ptr);
-			sqe_head = (val >> 20) & 0x3F;
-			sqe_tail = (val >> 28) & 0x3F;
-			if (sqe_head == sqe_tail)
-				break;
-			usleep_range(1, 3);
-			timeout--;
-		}
+		val = otx2_atomic64_add(incr, ptr);
+		sqe_head = (val >> 20) & 0x3F;
+		sqe_tail = (val >> 28) & 0x3F;
+		if (sqe_head != sqe_tail)
+			usleep_range(50, 60);
 	}
 }
 
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
index c04a8ee53a82..e7c69b57147e 100644
@@ -977,6 +977,7 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool pfc_en);
 int otx2_txsch_alloc(struct otx2_nic *pfvf);
 void otx2_txschq_stop(struct otx2_nic *pfvf);
 void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq);
+void otx2_free_pending_sqe(struct otx2_nic *pfvf);
 void otx2_sqb_flush(struct otx2_nic *pfvf);
 int otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,
 		    dma_addr_t *dma);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -0
index 6daf4d58c25d..8e82db6092af 100644
@@ -1589,6 +1589,7 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
 		else
 			otx2_cleanup_tx_cqes(pf, cq);
 	}
+	otx2_free_pending_sqe(pf);
 
 	otx2_free_sq_res(pf);
 
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +42 -0

69 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Tue, 31 Oct 2023 16:53:45 +0530 you wrote:

On interface down, the pending SQEs in the NIX get dropped or drained out during SMQ flush. But skb's pointed by these SQEs never get free or updated to the stack as respective CQE never get added.
This patch fixes the issue by freeing all valid skb's in SQ SG list.

Fixes b1bc8457e9d0 ("octeontx2-pf: Cleanup all receive buffers in SG descriptor")

[...]

Here is the summary with links:
- [net] octeontx2-pf: Free pending and dropped SQEs

    https://git.kernel.org/netdev/net/c/3423ca23e08b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html