[PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

Subsystems: intel ethernet drivers, networking drivers, the rest

STALE256d

2 messages, 2 authors, 2026-01-05 · open the first message on its own page

[PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

From: Li Li <hidden>
Date: 2026-01-05 06:47:38

Currently, in idpf_wait_for_sw_marker_completion(), when an
IDPF_TXD_COMPLT_SW_MARKER packet is found, the routine breaks out of
the for loop and does not increment the next_to_clean counter. This
causes the subsequent NAPI polls to run into the same
IDPF_TXD_COMPLT_SW_MARKER packet again and print out the following:

    [   23.261341] idpf 0000:05:00.0 eth1: Unknown TX completion type: 5

Instead, we should increment next_to_clean regardless when an
IDPF_TXD_COMPLT_SW_MARKER packet is found.

Tested: with the patch applied, we do not see the errors above from NAPI
polls anymore.

Signed-off-by: Li Li <redacted>
---
Changes in v2:
 - Initialize idpf_tx_queue *target to NULL to suppress the "'target'
   uninitialized when 'if' statement is true warning".

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index 69bab7187e541..452d0a9e83a4f 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -2326,7 +2326,7 @@ void idpf_wait_for_sw_marker_completion(const struct idpf_tx_queue *txq)
 
 	do {
 		struct idpf_splitq_4b_tx_compl_desc *tx_desc;
-		struct idpf_tx_queue *target;
+		struct idpf_tx_queue *target = NULL;
 		u32 ctype_gen, id;
 
 		tx_desc = flow ? &complq->comp[ntc].common :
@@ -2346,14 +2346,14 @@ void idpf_wait_for_sw_marker_completion(const struct idpf_tx_queue *txq)
 		target = complq->txq_grp->txqs[id];
 
 		idpf_queue_clear(SW_MARKER, target);
-		if (target == txq)
-			break;
 
 next:
 		if (unlikely(++ntc == complq->desc_count)) {
 			ntc = 0;
 			gen_flag = !gen_flag;
 		}
+		if (target == txq)
+			break;
 	} while (time_before(jiffies, timeout));
 
 	idpf_queue_assign(GEN_CHK, complq, gen_flag);
-- 
2.52.0.351.gbe84eed79e-goog

RE: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

From: Loktionov, Aleksandr <hidden>
Date: 2026-01-05 07:19:17

quoted hunk
-----Original Message-----
From: Intel-wired-lan <redacted> On Behalf
Of Li Li via Intel-wired-lan
Sent: Monday, January 5, 2026 7:47 AM
To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
Przemyslaw [off-list ref]; David S. Miller
[off-list ref]; Jakub Kicinski [off-list ref]; Eric Dumazet
[off-list ref]; intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; David
Decotigny [off-list ref]; Singhai, Anjali
[off-list ref]; Samudrala, Sridhar
[off-list ref]; Brian Vazquez [off-list ref];
Tantilov, Emil S [off-list ref]; Li Li
[off-list ref]
Subject: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue
next_to_clean in sw marker wait routine

Currently, in idpf_wait_for_sw_marker_completion(), when an
IDPF_TXD_COMPLT_SW_MARKER packet is found, the routine breaks out of
the for loop and does not increment the next_to_clean counter. This
causes the subsequent NAPI polls to run into the same
IDPF_TXD_COMPLT_SW_MARKER packet again and print out the following:

    [   23.261341] idpf 0000:05:00.0 eth1: Unknown TX completion type:
5

Instead, we should increment next_to_clean regardless when an
IDPF_TXD_COMPLT_SW_MARKER packet is found.

Tested: with the patch applied, we do not see the errors above from
NAPI polls anymore.

Signed-off-by: Li Li <redacted>
---
Changes in v2:
 - Initialize idpf_tx_queue *target to NULL to suppress the "'target'
   uninitialized when 'if' statement is true warning".

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index 69bab7187e541..452d0a9e83a4f 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -2326,7 +2326,7 @@ void idpf_wait_for_sw_marker_completion(const
struct idpf_tx_queue *txq)

 	do {
 		struct idpf_splitq_4b_tx_compl_desc *tx_desc;
-		struct idpf_tx_queue *target;
+		struct idpf_tx_queue *target = NULL;
Linux kernel is against premature initialization just to silence a compiler.
The target variable is dereferenced at idpf_queue_clear(SW_MARKER, target))
but can remain uninitialized if execution jumps to the next: label via a goto
before target is assigned.
Isn't it?
quoted hunk
 		u32 ctype_gen, id;

 		tx_desc = flow ? &complq->comp[ntc].common :
@@ -2346,14 +2346,14 @@ void idpf_wait_for_sw_marker_completion(const
struct idpf_tx_queue *txq)
 		target = complq->txq_grp->txqs[id];

 		idpf_queue_clear(SW_MARKER, target);
-		if (target == txq)
-			break;

 next:
 		if (unlikely(++ntc == complq->desc_count)) {
 			ntc = 0;
 			gen_flag = !gen_flag;
 		}
+		if (target == txq)
Are tou sure that incremented ntc value is ever written back to complq->next_to_clean?
+			break;
 	} while (time_before(jiffies, timeout));

 	idpf_queue_assign(GEN_CHK, complq, gen_flag);
--
2.52.0.351.gbe84eed79e-goog

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help