All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list
@ 2023-03-07  6:45 AKASHI Takahiro
  2023-03-07 10:46 ` Kurt Kanzenbach
  2023-03-14  8:44 ` naamax.meir
  0 siblings, 2 replies; 4+ messages in thread
From: AKASHI Takahiro @ 2023-03-07  6:45 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen; +Cc: AKASHI Takahiro, kurt, intel-wired-lan

The check introduced in the commit a5fd39464a40 ("igc: Lift TAPRIO schedule
restriction") can detect a false positive error in some corner case.
For instance,
    tc qdisc replace ... taprio num_tc 4
	...
	sched-entry S 0x01 100000	# slot#1
	sched-entry S 0x03 100000	# slot#2
	sched-entry S 0x04 100000	# slot#3
	sched-entry S 0x08 200000	# slot#4
	flags 0x02			# hardware offload

Here the queue#0 (the first queue) is on at the slot#1 and #2,
and off at the slot#3 and #4. Under the current logic, when the slot#4
is examined, validate_schedule() returns *false* since the enablement
count for the queue#0 is two and it is already off at the previous slot
(i.e. #3). But this definition is truely correct.

Let's fix the logic to enforce a strict validation for consecutively-opened
slots.

Fixes: a5fd39464a40 ("igc: Lift TAPRIO schedule restriction")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 2928a6c73692..25fc6c65209b 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -6010,18 +6010,18 @@ static bool validate_schedule(struct igc_adapter *adapter,
 		if (e->command != TC_TAPRIO_CMD_SET_GATES)
 			return false;
 
-		for (i = 0; i < adapter->num_tx_queues; i++) {
-			if (e->gate_mask & BIT(i))
+		for (i = 0; i < adapter->num_tx_queues; i++)
+			if (e->gate_mask & BIT(i)) {
 				queue_uses[i]++;
 
-			/* There are limitations: A single queue cannot be
-			 * opened and closed multiple times per cycle unless the
-			 * gate stays open. Check for it.
-			 */
-			if (queue_uses[i] > 1 &&
-			    !(prev->gate_mask & BIT(i)))
-				return false;
-		}
+				/* There are limitations: A single queue cannot
+				 * be opened and closed multiple times per cycle
+				 * unless the gate stays open. Check for it.
+				 */
+				if (queue_uses[i] > 1 &&
+				    !(prev->gate_mask & BIT(i)))
+					return false;
+			}
 	}
 
 	return true;
-- 
2.37.3

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list
  2023-03-07  6:45 [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list AKASHI Takahiro
@ 2023-03-07 10:46 ` Kurt Kanzenbach
  2023-03-08 21:40   ` Vinicius Costa Gomes
  2023-03-14  8:44 ` naamax.meir
  1 sibling, 1 reply; 4+ messages in thread
From: Kurt Kanzenbach @ 2023-03-07 10:46 UTC (permalink / raw)
  To: AKASHI Takahiro, jesse.brandeburg, anthony.l.nguyen
  Cc: AKASHI Takahiro, intel-wired-lan


[-- Attachment #1.1: Type: text/plain, Size: 1066 bytes --]

On Tue Mar 07 2023, AKASHI Takahiro wrote:
> The check introduced in the commit a5fd39464a40 ("igc: Lift TAPRIO schedule
> restriction") can detect a false positive error in some corner case.
> For instance,
>     tc qdisc replace ... taprio num_tc 4
> 	...
> 	sched-entry S 0x01 100000	# slot#1
> 	sched-entry S 0x03 100000	# slot#2
> 	sched-entry S 0x04 100000	# slot#3
> 	sched-entry S 0x08 200000	# slot#4
> 	flags 0x02			# hardware offload
>
> Here the queue#0 (the first queue) is on at the slot#1 and #2,
> and off at the slot#3 and #4. Under the current logic, when the slot#4
> is examined, validate_schedule() returns *false* since the enablement
> count for the queue#0 is two and it is already off at the previous slot
> (i.e. #3). But this definition is truely correct.
>
> Let's fix the logic to enforce a strict validation for consecutively-opened
> slots.
>
> Fixes: a5fd39464a40 ("igc: Lift TAPRIO schedule restriction")
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Grml. Thanks!

Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

[-- Attachment #2: Type: text/plain, Size: 162 bytes --]

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list
  2023-03-07 10:46 ` Kurt Kanzenbach
@ 2023-03-08 21:40   ` Vinicius Costa Gomes
  0 siblings, 0 replies; 4+ messages in thread
From: Vinicius Costa Gomes @ 2023-03-08 21:40 UTC (permalink / raw)
  To: Kurt Kanzenbach, AKASHI Takahiro, jesse.brandeburg, anthony.l.nguyen
  Cc: AKASHI Takahiro, intel-wired-lan

Kurt Kanzenbach <kurt@linutronix.de> writes:

> On Tue Mar 07 2023, AKASHI Takahiro wrote:
>> The check introduced in the commit a5fd39464a40 ("igc: Lift TAPRIO schedule
>> restriction") can detect a false positive error in some corner case.
>> For instance,
>>     tc qdisc replace ... taprio num_tc 4
>> 	...
>> 	sched-entry S 0x01 100000	# slot#1
>> 	sched-entry S 0x03 100000	# slot#2
>> 	sched-entry S 0x04 100000	# slot#3
>> 	sched-entry S 0x08 200000	# slot#4
>> 	flags 0x02			# hardware offload
>>
>> Here the queue#0 (the first queue) is on at the slot#1 and #2,
>> and off at the slot#3 and #4. Under the current logic, when the slot#4
>> is examined, validate_schedule() returns *false* since the enablement
>> count for the queue#0 is two and it is already off at the previous slot
>> (i.e. #3). But this definition is truely correct.
>>
>> Let's fix the logic to enforce a strict validation for consecutively-opened
>> slots.
>>
>> Fixes: a5fd39464a40 ("igc: Lift TAPRIO schedule restriction")
>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> Grml. Thanks!
>
> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>

Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>


Cheers,
-- 
Vinicius
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list
  2023-03-07  6:45 [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list AKASHI Takahiro
  2023-03-07 10:46 ` Kurt Kanzenbach
@ 2023-03-14  8:44 ` naamax.meir
  1 sibling, 0 replies; 4+ messages in thread
From: naamax.meir @ 2023-03-14  8:44 UTC (permalink / raw)
  To: AKASHI Takahiro, jesse.brandeburg, anthony.l.nguyen; +Cc: kurt, intel-wired-lan

On 3/7/2023 08:45, AKASHI Takahiro wrote:
> The check introduced in the commit a5fd39464a40 ("igc: Lift TAPRIO schedule
> restriction") can detect a false positive error in some corner case.
> For instance,
>      tc qdisc replace ... taprio num_tc 4
> 	...
> 	sched-entry S 0x01 100000	# slot#1
> 	sched-entry S 0x03 100000	# slot#2
> 	sched-entry S 0x04 100000	# slot#3
> 	sched-entry S 0x08 200000	# slot#4
> 	flags 0x02			# hardware offload
> 
> Here the queue#0 (the first queue) is on at the slot#1 and #2,
> and off at the slot#3 and #4. Under the current logic, when the slot#4
> is examined, validate_schedule() returns *false* since the enablement
> count for the queue#0 is two and it is already off at the previous slot
> (i.e. #3). But this definition is truely correct.
> 
> Let's fix the logic to enforce a strict validation for consecutively-opened
> slots.
> 
> Fixes: a5fd39464a40 ("igc: Lift TAPRIO schedule restriction")
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>   drivers/net/ethernet/intel/igc/igc_main.c | 20 ++++++++++----------
>   1 file changed, 10 insertions(+), 10 deletions(-)
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-14  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07  6:45 [Intel-wired-lan] [PATCH] igc: fix the validation logic for taprio's gate list AKASHI Takahiro
2023-03-07 10:46 ` Kurt Kanzenbach
2023-03-08 21:40   ` Vinicius Costa Gomes
2023-03-14  8:44 ` naamax.meir

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.