All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: David Yang <mmyangfl@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 4/4] net: dsa: yt921x: Add port qdisc tbf support
Date: Mon, 13 Apr 2026 15:32:48 -0700	[thread overview]
Message-ID: <20260413153248.0588690b@kernel.org> (raw)
In-Reply-To: <20260409171209.2575583-5-mmyangfl@gmail.com>

On Fri, 10 Apr 2026 01:12:04 +0800 David Yang wrote:
> +static int
> +yt921x_tbf_validate(struct yt921x_priv *priv,
> +		    const struct tc_tbf_qopt_offload *qopt, int *queuep)
> +{
> +	struct device *dev = to_device(priv);
> +	int queue = -1;
> +
> +	/* TODO: queue support */
> +	if (qopt->parent != TC_H_ROOT) {
> +		dev_err(dev, "Parent should be \"root\"\n");

Let's add extack to the offload struct like htb does and report this to
the user instead of the logs?

> +		return -EOPNOTSUPP;
> +	}
> +
> +	switch (qopt->command) {
> +	case TC_TBF_REPLACE: {
> +		const struct tc_tbf_qopt_offload_replace_params *p;
> +
> +		p = &qopt->replace_params;
> +
> +		if (!p->rate.mpu) {
> +			dev_info(dev, "Assuming you want mpu = 64\n");

BTW we can use extack for "warnings" like this, too

> +		} else if (p->rate.mpu != 64) {
> +			dev_err(dev, "mpu other than 64 not supported\n");
> +			return -EINVAL;
> +		}
> +		break;
> +	}
> +	default:
> +		break;
> +	}
> +
> +	*queuep = queue;
> +	return 0;
> +}
> +
> +static int
> +yt921x_dsa_port_setup_tc_tbf_port(struct dsa_switch *ds, int port,
> +				  const struct tc_tbf_qopt_offload *qopt)
> +{
> +	struct yt921x_priv *priv = to_yt921x_priv(ds);
> +	u32 ctrls[2];
> +	int res;
> +
> +	switch (qopt->command) {
> +	case TC_TBF_DESTROY:
> +		ctrls[0] = 0;
> +		ctrls[1] = 0;
> +		break;
> +	case TC_TBF_REPLACE: {
> +		const struct tc_tbf_qopt_offload_replace_params *p;
> +		struct yt921x_marker marker;
> +		u64 burst;
> +
> +		p = &qopt->replace_params;
> +
> +		/* where is burst??? */

Why not add it?

> +		burst = div_u64(priv->port_shape_slot_ns * p->rate.rate_bytes_ps,
> +				1000000000) + 10000;
-- 
pw-bot: cr

      reply	other threads:[~2026-04-13 22:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 17:12 [PATCH net-next v4 0/4] net: dsa: yt921x: Add port police/tbf support David Yang
2026-04-09 17:12 ` [PATCH net-next v4 1/4] net: dsa: pass extack to user tc policers David Yang
2026-04-09 17:12 ` [PATCH net-next v4 2/4] net: dsa: yt921x: Refactor long register helpers David Yang
2026-04-09 17:12 ` [PATCH net-next v4 3/4] net: dsa: yt921x: Add port police support David Yang
2026-04-09 17:12 ` [PATCH net-next v4 4/4] net: dsa: yt921x: Add port qdisc tbf support David Yang
2026-04-13 22:32   ` Jakub Kicinski [this message]

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=20260413153248.0588690b@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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 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.