Skip to contentSkip to conversation

idpf: increment completion queue next_to_clean in sw marker wait routine

PATCH In review Li Li 3 participants 6 messages Jan 5

Subsystems (3)
lore
Share & tools
lore

Li Li

author
#0 lore raw

PATCH v2 1/1 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.

---
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(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +3 -3
index 69bab7187e541..452d0a9e83a4f 100644
@@ -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);
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
#1 lore raw
Quoted 49 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Li Li via Intel-wired-lan
Sent: Monday, January 5, 2026 7:47 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>; Li Li <[email protected]>
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.

---
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(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
index 69bab7187e541..452d0a9e83a4f 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const · line 2330

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
@@ -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 7 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
 		u32 ctype_gen, id;
 
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
 		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];
 

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const · line 2356

Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -2
 		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?

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -0
+			break;
 	} while (time_before(jiffies, timeout));
 

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

#2 lore raw
Quoted 51 lines · Aleksandr
Quoted 51 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Li Li via Intel-wired-lan
Sent: Monday, January 5, 2026 7:47 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>; Li Li <[email protected]>
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.

---
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(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
index 69bab7187e541..452d0a9e83a4f 100644
@@ -2326,7 +2326,7 @@ void idpf_wait_for_sw_marker_completion(const
 struct idpf_tx_queue *txq)
 
Quoted 12 lines

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const struct idpf_tx_queue *txq) · line 2329

Quoted 4 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
      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?

That is correct. When the following if statement (line 2341-2343) evaluates to true:

if (FIELD_GET(IDPF_TXD_COMPLQ_COMPL_TYPE_M, ctype_gen) !=
IDPF_TXD_COMPLT_SW_MARKER)

    goto next;

Then the initialization at line 2346:

  target = complq->txq_grp->txqs[id];

would be skipped, making "target" uninitialized.

Therefore, in this patch, I need to initialize "target" to NULL.

Quoted 11 lines
Quoted 11 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
              u32 ctype_gen, id;
 
              tx_desc = flow ? &complq->comp[ntc].common :
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -2
@@ -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;
 
Quoted 9 lines

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const struct idpf_tx_queue *txq) · line 2355

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -0
 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?

Yes, the value of "ntc" is written back to "complq->next_to_clean" at the end of the function
(at line 2360):

  complq->next_to_clean = ntc;
Quoted 9 lines
Quoted 7 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -0
+                     break;
      } while (time_before(jiffies, timeout));
 
      idpf_queue_assign(GEN_CHK, complq, gen_flag);

--
2.52.0.351.gbe84eed79e-goog

#3 lore raw

From: Li Li <[email protected]>
Sent: Monday, January 5, 2026 8:39 AM
To: Loktionov, Aleksandr <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]; [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

Quoted 47 lines · On Sun, Jan 4, 2026 at 11:19 PM Loktionov, Aleksandr…

-----Original Message-----
From: Intel-wired-lan <[email protected]<mailto:[email protected]>> On Behalf Of Li Li via Intel-wired-lan
Sent: Monday, January 5, 2026 7:47 AM
To: Nguyen, Anthony L <[email protected]<mailto:[email protected]>>; Kitszel,
Przemyslaw <[email protected]<mailto:[email protected]>>; David S. Miller <[email protected]<mailto:[email protected]>>; Jakub Kicinski <[email protected]<mailto:[email protected]>>; Eric Dumazet <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; David Decotigny <[email protected]<mailto:[email protected]>>; Singhai, Anjali <[email protected]<mailto:[email protected]>>; Samudrala, Sridhar <[email protected]<mailto:[email protected]>>; Brian Vazquez <[email protected]<mailto:[email protected]>>; Tantilov, Emil S <[email protected]<mailto:[email protected]>>; Li Li <[email protected]<mailto:[email protected]>>
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.

---
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(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
index 69bab7187e541..452d0a9e83a4f 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const · line 2330

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
@@ -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?
That is correct. When the following if statement (line 2341-2343) evaluates to true:

if (FIELD_GET(IDPF_TXD_COMPLQ_COMPL_TYPE_M, ctype_gen) !=
IDPF_TXD_COMPLT_SW_MARKER)

    goto next;

Then the initialization at line 2346:

  target = complq->txq_grp->txqs[id];

would be skipped, making "target" uninitialized.

Therefore, in this patch, I need to initialize "target" to NULL.

The ‘NULL’ target variable can be dereferenced at idpf_queue_clear(SW_MARKER, target)), isn’t it?

Quoted 7 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
              u32 ctype_gen, id;
 
              tx_desc = flow ? &complq->comp[ntc].common :
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
@@ -2346,14 +2346,14 @@ void idpf_wait_for_sw_marker_completion(const
 struct idpf_tx_queue *txq)
              target = complq->txq_grp->txqs[id];
 

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const · line 2356

Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -2
              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?

Yes, the value of "ntc" is written back to "complq->next_to_clean" at the end of the function
(at line 2360):

complq->next_to_clean = ntc;
Thank you, I don’t see it from the patch.

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -0
+                     break;
      } while (time_before(jiffies, timeout));
 
      idpf_queue_assign(GEN_CHK, complq, gen_flag);

--
2.52.0.351.gbe84eed79e-goog

author
#4 lore raw
Quoted 102 lines · Aleksandr

From: Li Li <[email protected]>
Sent: Monday, January 5, 2026 8:39 AM
To: Loktionov, Aleksandr <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]; [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

Quoted 47 lines · Aleksandr

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Li Li via Intel-wired-lan
Sent: Monday, January 5, 2026 7:47 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>; Li Li <[email protected]>
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.

---
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(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
index 69bab7187e541..452d0a9e83a4f 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const · line 2330

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
@@ -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?

That is correct. When the following if statement (line 2341-2343) evaluates to true:

if (FIELD_GET(IDPF_TXD_COMPLQ_COMPL_TYPE_M, ctype_gen) !=
IDPF_TXD_COMPLT_SW_MARKER)

    goto next;

Then the initialization at line 2346:

  target = complq->txq_grp->txqs[id];

would be skipped, making "target" uninitialized.

Quoted 5 lines

Therefore, in this patch, I need to initialize "target" to NULL.

The ‘NULL’ target variable can be dereferenced at idpf_queue_clear(SW_MARKER, target)), isn’t it?

That would not be possible, because right before
"idpf_queue_clear(SW_MARKER, target))", "target"
is initialized to "complq->txq_grp->txqs[id]":

if (FIELD_GET(IDPF_TXD_COMPLQ_COMPL_TYPE_M, ctype_gen) !=

    IDPF_TXD_COMPLT_SW_MARKER)
    goto next;
  id = FIELD_GET(IDPF_TXD_COMPLQ_QID_M, ctype_gen);
  target = complq->txq_grp->txqs[id];

  idpf_queue_clear(SW_MARKER, target);

"target" only remains uninitialized if the if statement above evaluates to true and skips the initialization.

Quoted 46 lines
Quoted 13 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
              u32 ctype_gen, id;
 
              tx_desc = flow ? &complq->comp[ntc].common :
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
@@ -2346,14 +2346,14 @@ void idpf_wait_for_sw_marker_completion(const
 struct idpf_tx_queue *txq)
              target = complq->txq_grp->txqs[id];
 

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const · line 2356

Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -2
              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?

Yes, the value of "ntc" is written back to "complq->next_to_clean" at the end of the function

(at line 2360):

  complq->next_to_clean = ntc;

Thank you, I don’t see it from the patch.

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -0
+                     break;
      } while (time_before(jiffies, timeout));
 
      idpf_queue_assign(GEN_CHK, complq, gen_flag);

--
2.52.0.351.gbe84eed79e-goog

#5 lore raw
Quoted 191 lines

-----Original Message-----
From: Li Li <[email protected]>
Sent: Monday, January 5, 2026 8:49 AM
To: Loktionov, Aleksandr <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]; [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

Quoted 11 lines · Aleksandr

From: Li Li <[email protected]>
Sent: Monday, January 5, 2026 8:39 AM
To: Loktionov, Aleksandr <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric

Dumazet

Quoted 2 lines

<[email protected]>; [email protected]; [email protected]; [email protected]; David

Decotigny

Quoted 13 lines

<[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

On Sun, Jan 4, 2026 at 11:19 PM Loktionov, Aleksandr

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On

Behalf

Quoted 15 lines
Quoted 15 lines

Of Li Li via Intel-wired-lan
Sent: Monday, January 5, 2026 7:47 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Tantilov, Emil S <[email protected]>; Li Li <[email protected]>
Subject: [Intel-wired-lan] [PATCH v2] idpf: increment completion queue next_to_clean in sw marker wait routine

Quoted 2 lines
Quoted 2 lines

Currently, in idpf_wait_for_sw_marker_completion(), when an IDPF_TXD_COMPLT_SW_MARKER packet is found, the routine breaks out

of

Quoted 1 line
Quoted 1 line

the for loop and does not increment the next_to_clean counter.

This

Quoted 2 lines
Quoted 2 lines

causes the subsequent NAPI polls to run into the same IDPF_TXD_COMPLT_SW_MARKER packet again and print out the

following:

Quoted 2 lines
Quoted 2 lines
    [   23.261341] idpf 0000:05:00.0 eth1: Unknown TX completion

type:

Quoted 6 lines
Quoted 6 lines

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

Quoted 6 lines
Quoted 6 lines

NAPI polls anymore.

---
Changes in v2:
- Initialize idpf_tx_queue *target to NULL to suppress the

"'target'

Quoted 11 lines

drivers/net/ethernet/intel/idpf/idpf_txrx.c void

Quoted 11 lines

uninitialized when 'if' statement is true warning".

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
index 69bab7187e541..452d0a9e83a4f 100644
@@ -2326,7 +2326,7 @@ void

idpf_wait_for_sw_marker_completion(const

Quoted 7 lines

drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_wait_for_sw_marker_completion(const struct idpf_tx_queue *txq) · line 2329

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
 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.

Quoted 2 lines

The target variable is dereferenced at idpf_queue_clear(SW_MARKER, target)) but can remain uninitialized if execution jumps to the

next:

Quoted 4 lines

label via a goto before target is assigned.
Isn't it?

That is correct. When the following if statement (line 2341-2343)

evaluates to true:

Quoted 21 lines

if (FIELD_GET(IDPF_TXD_COMPLQ_COMPL_TYPE_M, ctype_gen) !=
IDPF_TXD_COMPLT_SW_MARKER)

    goto next;

Then the initialization at line 2346:

  target = complq->txq_grp->txqs[id];

would be skipped, making "target" uninitialized.

Quoted 5 lines

Therefore, in this patch, I need to initialize "target" to NULL.

The ‘NULL’ target variable can be dereferenced at

idpf_queue_clear(SW_MARKER, target)), isn’t it?

That would not be possible, because right before
"idpf_queue_clear(SW_MARKER, target))", "target"
is initialized to "complq->txq_grp->txqs[id]":

if (FIELD_GET(IDPF_TXD_COMPLQ_COMPL_TYPE_M, ctype_gen) !=

    IDPF_TXD_COMPLT_SW_MARKER)
    goto next;
  id = FIELD_GET(IDPF_TXD_COMPLQ_QID_M, ctype_gen);
  target = complq->txq_grp->txqs[id];

  idpf_queue_clear(SW_MARKER, target);

"target" only remains uninitialized if the if statement above evaluates to true and skips the initialization.

Quoted 18 lines
Quoted 18 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
              u32 ctype_gen, id;
 
              tx_desc = flow ? &complq->comp[ntc].common :
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
@@ -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);
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -2
-             if (target == txq)
-                     break;
Quoted 7 lines
Quoted 6 lines

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

Quoted 25 lines

complq->next_to_clean?

Quoted 4 lines

Yes, the value of "ntc" is written back to "complq->next_to_clean"

at

Quoted 19 lines

the end of the function

(at line 2360):

  complq->next_to_clean = ntc;

Thank you, I don’t see it from the patch.

Quoted 6 lines
+                     break;
      } while (time_before(jiffies, timeout));

      idpf_queue_assign(GEN_CHK, complq, gen_flag);

--
2.52.0.351.gbe84eed79e-goog

Thank you for the clarifications