From: Andrew Lunn <andrew@lunn.ch>
To: cedric.jehasse@luminex.be
Cc: Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: add support for credit based shaper
Date: Tue, 26 May 2026 17:49:23 +0200 [thread overview]
Message-ID: <4d270516-a8ae-4bed-b316-c28a321c304e@lunn.ch> (raw)
In-Reply-To: <20260526-net-next-mv88e6xxx-cbs-v2-2-13eb49c29b83@luminex.be>
> +static int mv88e6xxx_setup_tc_cbs(struct dsa_switch *ds, int port,
> + struct tc_cbs_qopt_offload *cbs)
> +{
> + struct mv88e6xxx_chip *chip = ds->priv;
> + const struct mv88e6xxx_ops *ops = chip->info->ops;
> + const struct mv88e6xxx_avb_ops *avb_ops;
> + const struct mv88e6xxx_qav_info *qav;
Reverse Christmas tree. Longest first please.
> + int rate_reg;
> + int hilimit_reg;
> + u8 queue_bit;
> + u16 rate = 0;
> + u16 hi_limit;
> + int err;
> +
> + avb_ops = ops->avb_ops;
> + qav = chip->info->qav;
You might be able to move this into the variable declarations? But not
always, depending on reverse Christmas.
> + if (!qav || !avb_ops || !avb_ops->port_qav_write ||
> + !ops->port_set_scheduling_mode)
> + return -EOPNOTSUPP;
> +
> + if (!dsa_is_user_port(ds, port))
> + return -EOPNOTSUPP;
> +
> + if (cbs->queue < 0 || cbs->queue >= chip->info->num_tx_queues)
> + return -EINVAL;
> +
> + if (!(qav->queue_mask & BIT(cbs->queue)))
> + return -EOPNOTSUPP;
> +
> + queue_bit = BIT(cbs->queue);
> + rate_reg = cbs->queue * 2;
> + hilimit_reg = rate_reg + 1;
> +
> + if (cbs->enable) {
> + if (cbs->idleslope <= 0 ||
> + cbs->idleslope > qav->max_rate ||
> + cbs->sendslope >= 0 || cbs->hicredit <= 0 ||
> + cbs->hicredit > qav->hi_limit_mask)
> + return -ERANGE;
> +
> + rate = DIV_ROUND_UP(cbs->idleslope, qav->rate_unit);
In the commit message, you mentioned 20Mbps, for a 1G link. Does the
link speed actually matter? I don't see it here.
Andrew
next prev parent reply other threads:[~2026-05-26 15:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 11:41 [PATCH net-next v2 0/2] " Cedric Jehasse via B4 Relay
2026-05-26 11:41 ` [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: use the hw tx queues Cedric Jehasse via B4 Relay
2026-05-26 12:30 ` Andrew Lunn
2026-05-26 13:21 ` Cedric Jehasse
2026-05-26 14:15 ` Andrew Lunn
2026-05-26 11:41 ` [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: add support for credit based shaper Cedric Jehasse via B4 Relay
2026-05-26 15:49 ` Andrew Lunn [this message]
2026-05-27 9:38 ` Cedric Jehasse
2026-05-26 12:19 ` [PATCH net-next v2 0/2] " Andrew Lunn
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=4d270516-a8ae-4bed-b316-c28a321c304e@lunn.ch \
--to=andrew@lunn.ch \
--cc=cedric.jehasse@luminex.be \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--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
all inboxes | Powered by JetHome®