All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
@ 2022-09-28  6:58 jianghaoran
  2022-09-30  2:18 ` Jakub Kicinski
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: jianghaoran @ 2022-09-28  6:58 UTC (permalink / raw)
  To: vinicius.gomes
  Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* Re: [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
@ 2022-09-30  2:18 ` Jakub Kicinski
  2022-09-30 11:18   ` jianghaoran
                     ` (4 more replies)
  2022-10-01  1:10 ` jianghaoran
                   ` (9 subsequent siblings)
  10 siblings, 5 replies; 23+ messages in thread
From: Jakub Kicinski @ 2022-09-30  2:18 UTC (permalink / raw)
  To: jianghaoran
  Cc: vinicius.gomes, jhs, xiyou.wangcong, jiri, davem, edumazet,
	pabeni, netdev, linux-kernel

On Wed, 28 Sep 2022 14:58:30 +0800 jianghaoran wrote:
> If the value of picos_per_byte is set after fill sched_entry,
> as a result, the min_duration calculated by length_to_duration is 0,
> and the validity of the input interval cannot be judged,
> too small intervals couldn't allow any packet to be transmitted.

Meaning an invalid configuration is accepted but no packets
can ever be transmitted?  Could you make the user-visible 
issue clearer?

> It will appear like commit b5b73b26b3ca ("taprio:
> Fix allowing too small intervals") described problem.
> Here is a further modification of this problem.
> 
> example:

Here as well it seems worthwhile to mention what this is an example of.
e.g. "example configuration which will not be able to transmit packets"

> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>               num_tc 3 \
>               map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>               queues 1@0 1@1 2@2 \
>               base-time  1528743495910289987 \
>               sched-entry S 01 9 \
> 	      sched-entry S 02 9 \
> 	      sched-entry S 04 9 \
>               clockid CLOCK_TAI

Please add a Fixes tag pointing to the first commit where the issue was
present, and CC Vladimir Oltean <vladimir.oltean@nxp.com> on the next
version.

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

* Re: [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-30  2:18 ` Jakub Kicinski
@ 2022-09-30 11:18   ` jianghaoran
  2022-09-30 13:46   ` jianghaoran
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-09-30 11:18 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: vinicius.gomes, jhs, xiyou.wangcong, jiri, davem, edumazet,
	pabeni, netdev, linux-kernel, vladimir.oltean



在 2022/9/30 上午10:18, Jakub Kicinski 写道:
> On Wed, 28 Sep 2022 14:58:30 +0800 jianghaoran wrote:
>> If the value of picos_per_byte is set after fill sched_entry,
>> as a result, the min_duration calculated by length_to_duration is 0,
>> and the validity of the input interval cannot be judged,
>> too small intervals couldn't allow any packet to be transmitted.
> 
> Meaning an invalid configuration is accepted but no packets
> can ever be transmitted?  Could you make the user-visible
> issue clearer?
   Yes, It's possible that the user specifies an too small interval that 
couldn't allow any packet to be transmitted.According to the following 
example, the interval is set to 9, and the network port enp5s0f0 cannot 
send any data
> 
>> It will appear like commit b5b73b26b3ca ("taprio:
>> Fix allowing too small intervals") described problem.
>> Here is a further modification of this problem.
>>
>> example:
> 
> Here as well it seems worthwhile to mention what this is an example of.
> e.g. "example configuration which will not be able to transmit packets"
> 
>> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>>                num_tc 3 \
>>                map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>>                queues 1@0 1@1 2@2 \
>>                base-time  1528743495910289987 \
>>                sched-entry S 01 9 \
>> 	      sched-entry S 02 9 \
>> 	      sched-entry S 04 9 \
>>                clockid CLOCK_TAI
> 
> Please add a Fixes tag pointing to the first commit where the issue was
> present, and CC Vladimir Oltean <vladimir.oltean@nxp.com> on the next
> version.
> 
Thank you for your suggestion. I will modify it as suggested

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

* Re: [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-30  2:18 ` Jakub Kicinski
  2022-09-30 11:18   ` jianghaoran
@ 2022-09-30 13:46   ` jianghaoran
  2022-09-30 13:58   ` test jianghaoran
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-09-30 13:46 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: vinicius.gomes, jhs, xiyou.wangcong, jiri, davem, edumazet,
	pabeni, netdev, linux-kernel, vladimir.oltean



在 2022/9/30 上午10:18, Jakub Kicinski 写道:
> On Wed, 28 Sep 2022 14:58:30 +0800 jianghaoran wrote:
>> If the value of picos_per_byte is set after fill sched_entry,
>> as a result, the min_duration calculated by length_to_duration is 0,
>> and the validity of the input interval cannot be judged,
>> too small intervals couldn't allow any packet to be transmitted.
> 
> Meaning an invalid configuration is accepted but no packets
> can ever be transmitted?  Could you make the user-visible
> issue clearer?

Yes, It's possible that the user specifies an too small interval that 
couldn't allow any packet to be transmitted.According to the following 
example, the interval is set to 9, and the network port enp5s0f0 cannot 
send any data
> 
>> It will appear like commit b5b73b26b3ca ("taprio:
>> Fix allowing too small intervals") described problem.
>> Here is a further modification of this problem.
>>
>> example:
> 
> Here as well it seems worthwhile to mention what this is an example of.
> e.g. "example configuration which will not be able to transmit packets"
> 
>> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>>                num_tc 3 \
>>                map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>>                queues 1@0 1@1 2@2 \
>>                base-time  1528743495910289987 \
>>                sched-entry S 01 9 \
>> 	      sched-entry S 02 9 \
>> 	      sched-entry S 04 9 \
>>                clockid CLOCK_TAI
> 
> Please add a Fixes tag pointing to the first commit where the issue was
> present, and CC Vladimir Oltean <vladimir.oltean@nxp.com> on the next
> version.
> 
Thank you for your suggestion. I will modify it as suggested

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

* test
  2022-09-30  2:18 ` Jakub Kicinski
  2022-09-30 11:18   ` jianghaoran
  2022-09-30 13:46   ` jianghaoran
@ 2022-09-30 13:58   ` jianghaoran
  2022-09-30 14:16   ` [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
  2022-10-01  0:42   ` jianghaoran
  4 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-09-30 13:58 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel



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

* Re: [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-30  2:18 ` Jakub Kicinski
                     ` (2 preceding siblings ...)
  2022-09-30 13:58   ` test jianghaoran
@ 2022-09-30 14:16   ` jianghaoran
  2022-10-01  0:42   ` jianghaoran
  4 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-09-30 14:16 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: vinicius.gomes, jhs, xiyou.wangcong, jiri, davem, edumazet,
	pabeni, netdev, linux-kernel, vladimir.oltean

> On Wed, 28 Sep 2022 14:58:30 +0800 jianghaoran wrote:
>> If the value of picos_per_byte is set after fill sched_entry,
>> as a result, the min_duration calculated by length_to_duration is 0,
>> and the validity of the input interval cannot be judged,
>> too small intervals couldn't allow any packet to be transmitted.
> 
> Meaning an invalid configuration is accepted but no packets
> can ever be transmitted?  Could you make the user-visible
> issue clearer?
> 
Yes, It's possible that the user specifies an too small interval that 
couldn't allow any packet to be transmitted.According to the following 
example, the interval is set to 9, and the network port enp5s0f0 cannot 
send any data
>> It will appear like commit b5b73b26b3ca ("taprio:
>> Fix allowing too small intervals") described problem.
>> Here is a further modification of this problem.
>>
>> example:
> 
> Here as well it seems worthwhile to mention what this is an example of.
> e.g. "example configuration which will not be able to transmit packets"
> 
>> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>>                num_tc 3 \
>>                map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>>                queues 1@0 1@1 2@2 \
>>                base-time  1528743495910289987 \
>>                sched-entry S 01 9 \
>> 	      sched-entry S 02 9 \
>> 	      sched-entry S 04 9 \
>>                clockid CLOCK_TAI
> 
> Please add a Fixes tag pointing to the first commit where the issue was
> present, and CC Vladimir Oltean <vladimir.oltean@nxp.com> on the next
> version.
> 
Thank you for your suggestion. I will modify it as suggested

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

* Re: [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-30  2:18 ` Jakub Kicinski
                     ` (3 preceding siblings ...)
  2022-09-30 14:16   ` [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
@ 2022-10-01  0:42   ` jianghaoran
  2022-10-01  0:44     ` jianghaoran
                       ` (3 more replies)
  4 siblings, 4 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  0:42 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: vinicius.gomes, jhs, jiri, davem, edumazet, pabeni, netdev,
	linux-kernel, vladimir.oltean


在 2022/9/30 上午10:18, Jakub Kicinski 写道:
> On Wed, 28 Sep 2022 14:58:30 +0800 jianghaoran wrote:
>> If the value of picos_per_byte is set after fill sched_entry,
>> as a result, the min_duration calculated by length_to_duration is 0,
>> and the validity of the input interval cannot be judged,
>> too small intervals couldn't allow any packet to be transmitted.
> 
> Meaning an invalid configuration is accepted but no packets
> can ever be transmitted?  Could you make the user-visible
> issue clearer?

Yes, It's possible that the user specifies an too small interval that 
couldn't allow
  any packet to be transmitted.According to the following example,
the interval is set to 9, and the network port enp5s0f0 cannot send any data

>> It will appear like commit b5b73b26b3ca ("taprio:
>> Fix allowing too small intervals") described problem.
>> Here is a further modification of this problem.
>>
>> example:
> 
> Here as well it seems worthwhile to mention what this is an example of.
> e.g. "example configuration which will not be able to transmit packets"
> 
>> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>>                num_tc 3 \
>>                map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>>                queues 1@0 1@1 2@2 \
>>                base-time  1528743495910289987 \
>>                sched-entry S 01 9 \
>> 	      sched-entry S 02 9 \
>> 	      sched-entry S 04 9 \
>>                clockid CLOCK_TAI
> 
> Please add a Fixes tag pointing to the first commit where the issue was
> present, and CC Vladimir Oltean <vladimir.oltean@nxp.com> on the next
> version.
>
Thank you for your suggestion. I will modify it as suggested

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

* Re: [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-10-01  0:42   ` jianghaoran
@ 2022-10-01  0:44     ` jianghaoran
  2022-10-01  0:49     ` jianghaoran
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  0:44 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: vinicius.gomes, jhs, jiri, davem, edumazet, pabeni, netdev,
	linux-kernel, vladimir.oltean



在 2022/10/1 上午8:42, jianghaoran 写道:
> 
> 在 2022/9/30 上午10:18, Jakub Kicinski 写道:
>> On Wed, 28 Sep 2022 14:58:30 +0800 jianghaoran wrote:
>>> If the value of picos_per_byte is set after fill sched_entry,
>>> as a result, the min_duration calculated by length_to_duration is 0,
>>> and the validity of the input interval cannot be judged,
>>> too small intervals couldn't allow any packet to be transmitted.
>>
>> Meaning an invalid configuration is accepted but no packets
>> can ever be transmitted?  Could you make the user-visible
>> issue clearer?
> 
> Yes, It's possible that the user specifies an too small interval that 
> couldn't allow any packet to be transmitted.According to the following example,
> the interval is set to 9, and the network port enp5s0f0 cannot send any 
> data
> 
>>> It will appear like commit b5b73b26b3ca ("taprio:
>>> Fix allowing too small intervals") described problem.
>>> Here is a further modification of this problem.
>>>
>>> example:
>>
>> Here as well it seems worthwhile to mention what this is an example of.
>> e.g. "example configuration which will not be able to transmit packets"
>>
>>> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>>>                num_tc 3 \
>>>                map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>>>                queues 1@0 1@1 2@2 \
>>>                base-time  1528743495910289987 \
>>>                sched-entry S 01 9 \
>>>           sched-entry S 02 9 \
>>>           sched-entry S 04 9 \
>>>                clockid CLOCK_TAI
>>
>> Please add a Fixes tag pointing to the first commit where the issue was
>> present, and CC Vladimir Oltean <vladimir.oltean@nxp.com> on the next
>> version.
>>
> Thank you for your suggestion. I will modify it as suggested

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

* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-10-01  0:42   ` jianghaoran
  2022-10-01  0:44     ` jianghaoran
@ 2022-10-01  0:49     ` jianghaoran
  2022-10-01  0:57     ` jianghaoran
  2022-10-01  0:59     ` jianghaoran
  3 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  0:49 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-10-01  0:42   ` jianghaoran
  2022-10-01  0:44     ` jianghaoran
  2022-10-01  0:49     ` jianghaoran
@ 2022-10-01  0:57     ` jianghaoran
  2022-10-01  0:59     ` jianghaoran
  3 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  0:57 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-10-01  0:42   ` jianghaoran
                       ` (2 preceding siblings ...)
  2022-10-01  0:57     ` jianghaoran
@ 2022-10-01  0:59     ` jianghaoran
  3 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  0:59 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, vladimir.oltean, 591891520

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
  2022-09-30  2:18 ` Jakub Kicinski
@ 2022-10-01  1:10 ` jianghaoran
  2022-10-01  1:17 ` jianghaoran
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  1:10 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
  2022-09-30  2:18 ` Jakub Kicinski
  2022-10-01  1:10 ` jianghaoran
@ 2022-10-01  1:17 ` jianghaoran
  2022-10-01  1:23 ` jianghaoran
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  1:17 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (2 preceding siblings ...)
  2022-10-01  1:17 ` jianghaoran
@ 2022-10-01  1:23 ` jianghaoran
  2022-10-01  7:48 ` [PATCH V2] " jianghaoran
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  1:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: jianghaoran, netdev

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (3 preceding siblings ...)
  2022-10-01  1:23 ` jianghaoran
@ 2022-10-01  7:48 ` jianghaoran
  2022-10-01  7:51 ` jianghaoran
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  7:48 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (4 preceding siblings ...)
  2022-10-01  7:48 ` [PATCH V2] " jianghaoran
@ 2022-10-01  7:51 ` jianghaoran
  2022-10-01  7:51 ` jianghaoran
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  7:51 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (5 preceding siblings ...)
  2022-10-01  7:51 ` jianghaoran
@ 2022-10-01  7:51 ` jianghaoran
  2022-10-01  7:53 ` jianghaoran
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  7:51 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (6 preceding siblings ...)
  2022-10-01  7:51 ` jianghaoran
@ 2022-10-01  7:53 ` jianghaoran
  2022-10-01  8:00 ` jianghaoran
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  7:53 UTC (permalink / raw)
  To: jianghaoran
  Cc: davem, edumazet, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	vinicius.gomes, xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (7 preceding siblings ...)
  2022-10-01  7:53 ` jianghaoran
@ 2022-10-01  8:00 ` jianghaoran
  2022-10-01  8:06 ` jianghaoran
  2022-10-01  8:29 ` jianghaoran
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  8:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (8 preceding siblings ...)
  2022-10-01  8:00 ` jianghaoran
@ 2022-10-01  8:06 ` jianghaoran
  2022-10-01 11:44   ` Vladimir Oltean
  2022-10-03 15:08   ` Jakub Kicinski
  2022-10-01  8:29 ` jianghaoran
  10 siblings, 2 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  8:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
                   ` (9 preceding siblings ...)
  2022-10-01  8:06 ` jianghaoran
@ 2022-10-01  8:29 ` jianghaoran
  10 siblings, 0 replies; 23+ messages in thread
From: jianghaoran @ 2022-10-01  8:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: davem, edumazet, jhs, jiri, kuba, netdev, pabeni, vinicius.gomes,
	xiyou.wangcong, vladimir.oltean

If the value of picos_per_byte is set after fill sched_entry,
as a result, the min_duration calculated by length_to_duration is 0,
and the validity of the input interval cannot be judged,
too small intervals couldn't allow any packet to be transmitted.
It will appear like commit b5b73b26b3ca ("taprio:
Fix allowing too small intervals") described problem.
Here is a further modification of this problem.

example configuration which will not be able to transmit:

tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
              num_tc 3 \
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
              queues 1@0 1@1 2@2 \
              base-time  1528743495910289987 \
              sched-entry S 01 9 \
	      sched-entry S 02 9 \
	      sched-entry S 04 9 \
              clockid CLOCK_TAI

Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
---
v2:
1,Add an explanation of what this is an example.
2,add a Fixes tag pointing to the first commit
where the issue was presen.
---
 net/sched/sch_taprio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 86675a79da1e..d95ec2250f24 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1507,6 +1507,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 		goto free_sched;
 	}
 
+	taprio_set_picos_per_byte(dev, q);
+
 	err = parse_taprio_schedule(q, tb, new_admin, extack);
 	if (err < 0)
 		goto free_sched;
@@ -1521,8 +1523,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (err < 0)
 		goto free_sched;
 
-	taprio_set_picos_per_byte(dev, q);
-
 	if (mqprio) {
 		err = netdev_set_num_tc(dev, mqprio->num_tc);
 		if (err)
-- 
2.25.1


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

* Re: [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-10-01  8:06 ` jianghaoran
@ 2022-10-01 11:44   ` Vladimir Oltean
  2022-10-03 15:08   ` Jakub Kicinski
  1 sibling, 0 replies; 23+ messages in thread
From: Vladimir Oltean @ 2022-10-01 11:44 UTC (permalink / raw)
  To: jianghaoran; +Cc: linux-kernel, netdev, Vinicius Costa Gomes, Jakub Kicinski

Hi Jianghao,

On Sat, Oct 01, 2022 at 04:06:26PM +0800, jianghaoran wrote:
> If the value of picos_per_byte is set after fill sched_entry,
> as a result, the min_duration calculated by length_to_duration is 0,
> and the validity of the input interval cannot be judged,
> too small intervals couldn't allow any packet to be transmitted.
> It will appear like commit b5b73b26b3ca ("taprio:
> Fix allowing too small intervals") described problem.
> Here is a further modification of this problem.
> 
> example configuration which will not be able to transmit:
> 
> tc qdisc replace dev enp5s0f0 parent root handle 100 taprio \
>               num_tc 3 \
>               map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
>               queues 1@0 1@1 2@2 \
>               base-time  1528743495910289987 \
>               sched-entry S 01 9 \
> 	      sched-entry S 02 9 \
> 	      sched-entry S 04 9 \
>               clockid CLOCK_TAI
> 
> Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
> Signed-off-by: jianghaoran <jianghaoran@kylinos.cn>
> ---

I think this is just a symptomatic treatment of a bigger problem with
the solution Vinicius tried to implement.

One can still change the qdisc on an interface whose link is down, and
the determination logic will still be bypassed, thereby allowing the 9
ns schedule intervals to be accepted as valid.

Is your problem that the 9 ns intervals will kill the kernel due to the
frequent hrtimers, or that no packets will be dequeued from the qdisc?

If the latter, I was working on a feature called queueMaxSDU, where one
can limit the MTU per traffic class. Packets exceeding the max MTU are
dropped at the enqueue() level (therefore, before being accepted into
the Qdisc queues). The problem here, really, is that we accept packets
in enqueue() which will never be eligible in dequeue(). We have the
exact same problem with gates which are forever closed (in your own
example, that would be gates 3 and higher).

Currently, I only added support for user space to input queueMaxSDU into
the kernel over netlink, as well as for the basic qdisc_drop() mechanism
based on skb->len. But I was thinking that the kernel should have a
mechanism to automatically reduce the queueMaxSDU to an even lower value
than specified by the user, if the gate intervals don't accept MTU sized
packets. The "operational" queueMaxSDU is determined by the current link
speed and the smallest contiguous interval corresponding to each traffic
class.

In fact, if you search for vsc9959_tas_guard_bands_update(), you'll see
most of the logic already being written, but just for an offloading
device driver. I was thinking I should generalize this logic and push it
into taprio.

If your problem is the former (9ns hrtimers kill the kernel, how do we
avoid them?), then it's pretty hard to make a judgement that works for
all link speeds (taprio will still accept the interval as valid for a
100Gbps interface, because theoretically, the transmission time of
ETH_ZLEN bytes is still below 9 ns. I don't know how one can realistically
deal with that in a generic way.

Given that it's so easy to bypass taprio's restriction by having the
link down, I don't think it makes much sense to keep pretending that it
works, and submit this as a bug fix :)

I was going to move vsc9959_tas_guard_bands_update() into taprio anyway,
although I'm not sure if in this kernel development cycle. If you're
interested, I can keep you on CC.

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

* Re: [PATCH V2] taprio: Set the value of picos_per_byte before fill sched_entry
  2022-10-01  8:06 ` jianghaoran
  2022-10-01 11:44   ` Vladimir Oltean
@ 2022-10-03 15:08   ` Jakub Kicinski
  1 sibling, 0 replies; 23+ messages in thread
From: Jakub Kicinski @ 2022-10-03 15:08 UTC (permalink / raw)
  To: jianghaoran; +Cc: linux-kernel, netdev, Joe Perches

On Sat,  1 Oct 2022 16:06:26 +0800 jianghaoran wrote:
> Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")

Please note that whenever you put a Fixes tag in a patch you should CC
the authors of the commit in question. get_maintainer will point them
out to you (when run on the patch).

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

end of thread, other threads:[~2022-10-08  0:58 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28  6:58 [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
2022-09-30  2:18 ` Jakub Kicinski
2022-09-30 11:18   ` jianghaoran
2022-09-30 13:46   ` jianghaoran
2022-09-30 13:58   ` test jianghaoran
2022-09-30 14:16   ` [PATCH] taprio: Set the value of picos_per_byte before fill sched_entry jianghaoran
2022-10-01  0:42   ` jianghaoran
2022-10-01  0:44     ` jianghaoran
2022-10-01  0:49     ` jianghaoran
2022-10-01  0:57     ` jianghaoran
2022-10-01  0:59     ` jianghaoran
2022-10-01  1:10 ` jianghaoran
2022-10-01  1:17 ` jianghaoran
2022-10-01  1:23 ` jianghaoran
2022-10-01  7:48 ` [PATCH V2] " jianghaoran
2022-10-01  7:51 ` jianghaoran
2022-10-01  7:51 ` jianghaoran
2022-10-01  7:53 ` jianghaoran
2022-10-01  8:00 ` jianghaoran
2022-10-01  8:06 ` jianghaoran
2022-10-01 11:44   ` Vladimir Oltean
2022-10-03 15:08   ` Jakub Kicinski
2022-10-01  8:29 ` jianghaoran

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.