From: Jakub Kicinski <kuba@kernel.org>
To: mmyangfl@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
jhs@mojatatu.com, jiri@resnulli.us, horms@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/3] net: dsa: yt921x: Add port qdisc tbf support
Date: Wed, 6 May 2026 18:22:25 -0700 [thread overview]
Message-ID: <20260507012225.2187535-1-kuba@kernel.org> (raw)
In-Reply-To: <20260504101258.1608004-4-mmyangfl@gmail.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: dsa: yt921x: Add port qdisc tbf support
This patch enables port shaping and adds support for limiting the rate of
outgoing traffic using the TBF qdisc offload.
> diff --git a/drivers/net/dsa/yt921x.c b/drivers/net/dsa/yt921x.c
> index 42dca9617fb1..dc38e0dd22ee 100644
> --- a/drivers/net/dsa/yt921x.c
> +++ b/drivers/net/dsa/yt921x.c
[ ... ]
> @@ -1378,6 +1390,112 @@ yt921x_dsa_port_policer_add(struct dsa_switch *ds, int port,
> return res;
> }
>
> +static int
> +yt921x_tbf_validate(struct yt921x_priv *priv,
> + const struct tc_tbf_qopt_offload *qopt)
> +{
[ ... ]
> + switch (qopt->command) {
> + case TC_TBF_REPLACE: {
> + const struct tc_tbf_qopt_offload_replace_params *p;
> +
> + p = &qopt->replace_params;
> +
> + if (p->mtu || p->peak.rate_bytes_ps) {
The userspace tc utility unconditionally sets a default MTU (typically 2047)
when adding a TBF qdisc, which is passed to the driver via p->mtu. Since
p->mtu is never zero, will this unconditionally reject all offload requests?
> + NL_SET_ERR_MSG_MOD(extack,
> + "Offload not supported when mtu/peakrate is configured");
> + return -EOPNOTSUPP;
> + }
> +
> + if (!p->rate.mpu) {
Does this code miss validation for p->rate.overhead?
The TC TBF layer allows configuring overhead to account for additional
headers. If the hardware relies on fixed wire frame sizes and the driver
ignores p->rate.overhead, could this lead to a silent misconfiguration
where the hardware shapes traffic at a different effective rate than
requested?
> + NL_SET_ERR_MSG_MOD(extack, "Assuming mpu = 64");
> + } else if (p->rate.mpu != 64) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "Offload not supported when mpu is other than 64");
> + return -EOPNOTSUPP;
> + }
next prev parent reply other threads:[~2026-05-07 1:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 10:12 [PATCH net-next v2 0/3] net: dsa: yt921x: Add port qdisc tbf support David Yang
2026-05-04 10:12 ` [PATCH net-next v2 1/3] net: sched: tbf: add extack to offload params David Yang
2026-05-04 10:12 ` [PATCH net-next v2 2/3] net: sched: tbf: pass all params to offload users David Yang
2026-05-07 1:22 ` Jakub Kicinski
2026-05-07 1:23 ` Jakub Kicinski
2026-05-07 3:11 ` David Yang
2026-05-07 14:37 ` Jakub Kicinski
2026-05-04 10:12 ` [PATCH net-next v2 3/3] net: dsa: yt921x: Add port qdisc tbf support David Yang
2026-05-07 1:22 ` Jakub Kicinski [this message]
2026-05-07 1:23 ` Jakub Kicinski
2026-05-07 3:42 ` David Yang
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=20260507012225.2187535-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox