From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Jiri Pirko <jiri@resnulli.us>,
Pedro Tammela <pctammela@mojatatu.com>,
netdev@vger.kernel.org,
Richard Cochran <richardcochran@gmail.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
linux-kernel@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
intel-wired-lan@lists.osuosl.org,
Maxim Georgiev <glipus@gmail.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Peilin Ye <yepeilin.cs@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Zhengchao Shao <shaozhengchao@huawei.com>,
Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH v2 net-next 7/9] net: netdevsim: mimic tc-taprio offload
Date: Tue, 01 Aug 2023 10:39:23 -0700 [thread overview]
Message-ID: <87o7jq64s4.fsf@intel.com> (raw)
In-Reply-To: <20230801164534.2nklcql2nh6x6p7y@skbuf>
Hi Vladimir,
Vladimir Oltean <vladimir.oltean@nxp.com> writes:
> On Wed, Jun 14, 2023 at 05:06:24PM -0700, Vinicius Costa Gomes wrote:
>> > +static int nsim_setup_tc_taprio(struct net_device *dev,
>> > + struct tc_taprio_qopt_offload *offload)
>> > +{
>> > + int err = 0;
>> > +
>> > + switch (offload->cmd) {
>> > + case TAPRIO_CMD_REPLACE:
>> > + case TAPRIO_CMD_DESTROY:
>> > + break;
>>
>> I was thinking about how useful would proper validation of the
>> parameters be? Thinking that we could detect "driver API" breakages
>> earlier, and we want it documented that the drivers should check for the
>> things that it supports.
>>
>> Makes sense?
>
> Sorry, I lack imagination as to what the netdevsim driver may check for.
> The taprio offload parameters should always be valid, properly speaking,
> otherwise the Qdisc wouldn't be passing them on to the driver. At least
> that would be the intention. The rest are hardware specific checks for
> hardware specific limitations. Here there is no hardware.
>
Trying to remember what was going through my mind when I said that.
What I seem to recall is something that would help us "keep honest":
I was worrying about someone (perhaps myself ;-) sneaking a new feature
in taprio and forgetting to update other drivers.
I thought that adding a check for the existing parameters would help
detect those kind of things. If anything unknown was there in the
offload struct, netdevsim would complain loudly.
Perhaps I was worrying too much. And the way to solve that is to keep
active attention against that during review.
> The parameters passed to TAPRIO_CMD_REPLACE are:
>
> struct tc_mqprio_qopt_offload mqprio:
> struct tc_mqprio_qopt qopt: validated by taprio_parse_mqprio_opt() for flags 0x2
> u16 mode: always set to TC_MQPRIO_MODE_DCB
> u16 shaper: always set to TC_MQPRIO_SHAPER_DCB
> u32 flags: always set to 0
> u64 min_rate[TC_QOPT_MAX_QUEUE]: always set to [0,]
> u64 max_rate[TC_QOPT_MAX_QUEUE]: always set to [0,]
> unsigned long preemptible_tcs: always set to 0, because ethtool_dev_mm_supported() returns false
>
> ktime_t base_time: any value is valid
>
> u64 cycle_time: any value is valid
>
> u64 cycle_time_extension: any value <= cycle_time is valid. According to 802.1Q
> "Q.5 CycleTimeExtension variables", it's the maximum
> amount by which the penultimate cycle can be extended
> to avoid a very short cycle upon a ConfigChange event.
> But if CycleTimeExtension is larger than one CycleTime,
> then we're not even talking about the penultimate cycle
> anymore, but about ones previous to that?! Maybe this
> should be limited to 0 <= cycle_time_extension <= cycle_time
> by taprio, certainly not by offloading drivers.
>
Good point. I have to review 802.1Q, but from what I remember that
sounds right, cycle_time_extension greater than cycle_time doesn't make
much sense. Having a check for it in taprio itself sounds good.
> u32 max_sdu[TC_MAX_QUEUE]: limited to a value <= dev->max_mtu by taprio
>
> size_t num_entries: any value is valid
>
> struct tc_taprio_sched_entry entries[]:
> u8 command: will be either one of: TC_TAPRIO_CMD_SET_GATES, TC_TAPRIO_CMD_SET_AND_HOLD
> or TC_TAPRIO_CMD_SET_AND_RELEASE. However 802.1Q "Table 8-7—Gate operations"
> says "If frame preemption is not supported or not enabled (preemptionActive is
> FALSE), this operation behaves the same as SetGateStates.". So I
> see no reason to enforce any restriction here either?
>
> u32 gate_mask: technically can have bits set, which correspond
> to traffic classes larger than dev->num_tc.
> Taprio can enforce this, so I wouldn't see
> drivers beginning to feel paranoid about it.
> Actually I had a patch about this:
> https://patchwork.kernel.org/project/netdevbpf/patch/20230130173145.475943-15-vladimir.oltean@nxp.com/
> but I decided to drop it because I didn't have
> any strong case for it.
> u32 interval: any value is valid. If the sum of entry intervals
> is less than the cycle_time, again that's taprio's
> problem to check for, in its netlink attribute
> validation method rather than offloading drivers.
>
Thank you for the time it took to give this amount of detail.
Cheers,
--
Vinicius
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
WARNING: multiple messages have this Message-ID (diff)
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>,
Peilin Ye <yepeilin.cs@gmail.com>,
Pedro Tammela <pctammela@mojatatu.com>,
Richard Cochran <richardcochran@gmail.com>,
Zhengchao Shao <shaozhengchao@huawei.com>,
Maxim Georgiev <glipus@gmail.com>
Subject: Re: [PATCH v2 net-next 7/9] net: netdevsim: mimic tc-taprio offload
Date: Tue, 01 Aug 2023 10:39:23 -0700 [thread overview]
Message-ID: <87o7jq64s4.fsf@intel.com> (raw)
In-Reply-To: <20230801164534.2nklcql2nh6x6p7y@skbuf>
Hi Vladimir,
Vladimir Oltean <vladimir.oltean@nxp.com> writes:
> On Wed, Jun 14, 2023 at 05:06:24PM -0700, Vinicius Costa Gomes wrote:
>> > +static int nsim_setup_tc_taprio(struct net_device *dev,
>> > + struct tc_taprio_qopt_offload *offload)
>> > +{
>> > + int err = 0;
>> > +
>> > + switch (offload->cmd) {
>> > + case TAPRIO_CMD_REPLACE:
>> > + case TAPRIO_CMD_DESTROY:
>> > + break;
>>
>> I was thinking about how useful would proper validation of the
>> parameters be? Thinking that we could detect "driver API" breakages
>> earlier, and we want it documented that the drivers should check for the
>> things that it supports.
>>
>> Makes sense?
>
> Sorry, I lack imagination as to what the netdevsim driver may check for.
> The taprio offload parameters should always be valid, properly speaking,
> otherwise the Qdisc wouldn't be passing them on to the driver. At least
> that would be the intention. The rest are hardware specific checks for
> hardware specific limitations. Here there is no hardware.
>
Trying to remember what was going through my mind when I said that.
What I seem to recall is something that would help us "keep honest":
I was worrying about someone (perhaps myself ;-) sneaking a new feature
in taprio and forgetting to update other drivers.
I thought that adding a check for the existing parameters would help
detect those kind of things. If anything unknown was there in the
offload struct, netdevsim would complain loudly.
Perhaps I was worrying too much. And the way to solve that is to keep
active attention against that during review.
> The parameters passed to TAPRIO_CMD_REPLACE are:
>
> struct tc_mqprio_qopt_offload mqprio:
> struct tc_mqprio_qopt qopt: validated by taprio_parse_mqprio_opt() for flags 0x2
> u16 mode: always set to TC_MQPRIO_MODE_DCB
> u16 shaper: always set to TC_MQPRIO_SHAPER_DCB
> u32 flags: always set to 0
> u64 min_rate[TC_QOPT_MAX_QUEUE]: always set to [0,]
> u64 max_rate[TC_QOPT_MAX_QUEUE]: always set to [0,]
> unsigned long preemptible_tcs: always set to 0, because ethtool_dev_mm_supported() returns false
>
> ktime_t base_time: any value is valid
>
> u64 cycle_time: any value is valid
>
> u64 cycle_time_extension: any value <= cycle_time is valid. According to 802.1Q
> "Q.5 CycleTimeExtension variables", it's the maximum
> amount by which the penultimate cycle can be extended
> to avoid a very short cycle upon a ConfigChange event.
> But if CycleTimeExtension is larger than one CycleTime,
> then we're not even talking about the penultimate cycle
> anymore, but about ones previous to that?! Maybe this
> should be limited to 0 <= cycle_time_extension <= cycle_time
> by taprio, certainly not by offloading drivers.
>
Good point. I have to review 802.1Q, but from what I remember that
sounds right, cycle_time_extension greater than cycle_time doesn't make
much sense. Having a check for it in taprio itself sounds good.
> u32 max_sdu[TC_MAX_QUEUE]: limited to a value <= dev->max_mtu by taprio
>
> size_t num_entries: any value is valid
>
> struct tc_taprio_sched_entry entries[]:
> u8 command: will be either one of: TC_TAPRIO_CMD_SET_GATES, TC_TAPRIO_CMD_SET_AND_HOLD
> or TC_TAPRIO_CMD_SET_AND_RELEASE. However 802.1Q "Table 8-7—Gate operations"
> says "If frame preemption is not supported or not enabled (preemptionActive is
> FALSE), this operation behaves the same as SetGateStates.". So I
> see no reason to enforce any restriction here either?
>
> u32 gate_mask: technically can have bits set, which correspond
> to traffic classes larger than dev->num_tc.
> Taprio can enforce this, so I wouldn't see
> drivers beginning to feel paranoid about it.
> Actually I had a patch about this:
> https://patchwork.kernel.org/project/netdevbpf/patch/20230130173145.475943-15-vladimir.oltean@nxp.com/
> but I decided to drop it because I didn't have
> any strong case for it.
> u32 interval: any value is valid. If the sum of entry intervals
> is less than the cycle_time, again that's taprio's
> problem to check for, in its netlink attribute
> validation method rather than offloading drivers.
>
Thank you for the time it took to give this amount of detail.
Cheers,
--
Vinicius
next prev parent reply other threads:[~2023-08-01 17:39 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 21:54 [Intel-wired-lan] [PATCH v2 net-next 0/9] Improve the taprio qdisc's relationship with its children Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 1/9] net/sched: taprio: don't access q->qdiscs[] in unoffloaded mode during attach() Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 2/9] net/sched: taprio: keep child Qdisc refcount elevated at 2 in offload mode Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 3/9] net/sched: taprio: try again to report q->qdiscs[] to qdisc_leaf() Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 4/9] net/sched: taprio: delete misleading comment about preallocating child qdiscs Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 5/9] net/sched: taprio: dump class stats for the actual q->qdiscs[] Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 6/9] net: netdevsim: create a mock-up PTP Hardware Clock driver Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-14 13:11 ` [Intel-wired-lan] " Simon Horman
2023-06-14 13:11 ` Simon Horman
2023-06-14 22:17 ` [Intel-wired-lan] " Vladimir Oltean
2023-06-14 22:17 ` Vladimir Oltean
2023-06-15 7:58 ` [Intel-wired-lan] " Simon Horman
2023-06-15 7:58 ` Simon Horman
2023-06-15 14:02 ` [Intel-wired-lan] " Dan Carpenter
2023-06-15 14:02 ` Dan Carpenter
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 7/9] net: netdevsim: mimic tc-taprio offload Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-15 0:06 ` [Intel-wired-lan] " Vinicius Costa Gomes
2023-06-15 0:06 ` Vinicius Costa Gomes
2023-08-01 16:45 ` [Intel-wired-lan] " Vladimir Oltean
2023-08-01 16:45 ` Vladimir Oltean
2023-08-01 17:39 ` Vinicius Costa Gomes [this message]
2023-08-01 17:39 ` Vinicius Costa Gomes
2023-08-01 17:43 ` [Intel-wired-lan] " Vladimir Oltean
2023-08-01 17:43 ` Vladimir Oltean
2023-08-01 18:06 ` [Intel-wired-lan] " Vinicius Costa Gomes
2023-08-01 18:06 ` Vinicius Costa Gomes
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 8/9] selftests/tc-testing: test that taprio can only be attached as root Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-14 16:44 ` [Intel-wired-lan] " Pedro Tammela
2023-06-14 16:44 ` Pedro Tammela
2023-06-13 21:54 ` [Intel-wired-lan] [PATCH v2 net-next 9/9] selftests/tc-testing: verify that a qdisc can be grafted onto a taprio class Vladimir Oltean
2023-06-13 21:54 ` Vladimir Oltean
2023-06-14 16:45 ` [Intel-wired-lan] " Pedro Tammela
2023-06-14 16:45 ` Pedro Tammela
2023-08-01 16:53 ` [Intel-wired-lan] " Vladimir Oltean
2023-08-01 16:53 ` Vladimir Oltean
2023-06-14 16:47 ` [Intel-wired-lan] [PATCH v2 net-next 0/9] Improve the taprio qdisc's relationship with its children Pedro Tammela
2023-06-14 16:47 ` Pedro Tammela
2023-08-01 16:06 ` [Intel-wired-lan] " Vladimir Oltean
2023-08-01 16:06 ` Vladimir Oltean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7jq64s4.fsf@intel.com \
--to=vinicius.gomes@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=glipus@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pctammela@mojatatu.com \
--cc=richardcochran@gmail.com \
--cc=shaozhengchao@huawei.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yepeilin.cs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.