From: "Karumanchi, Vineeth" <vineeth@amd.com>
To: "Théo Lebrun" <theo.lebrun@bootlin.com>,
"Vineeth Karumanchi" <vineeth.karumanchi@amd.com>,
conor.dooley@microchip.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: git@amd.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/4] net: macb: Add MQPRIO qdisc hardware offload support
Date: Thu, 17 Sep 2026 19:27:23 +0530 [thread overview]
Message-ID: <546c2117-2d8a-4c97-879c-e03f73d3d080@amd.com> (raw)
In-Reply-To: <DLHHCJ7NP756.3S1PWCQHV5Q3V@bootlin.com>
Hi Théo,
On 9/17/2026 2:52 PM, Théo Lebrun wrote:
> Hello Vineeth,
>
> On Wed Sep 9, 2026 at 4:20 PM CEST, Vineeth Karumanchi wrote:
>> Add support for TC_SETUP_QDISC_MQPRIO hardware offload, allowing
>> traffic class to queue mapping via the mqprio qdisc.
>>
>> Implement macb_setup_mqprio() which configures TC-to-queue mappings
>> through netdev_set_num_tc() and netdev_set_tc_queue(), and resets
>> them when num_tc is zero. The driver advertises TC_MQPRIO_HW_OFFLOAD_TCS
>> offload level.
>>
>> Add macb_tc_query_caps() to report mqprio capabilities. Setting
>> validate_queue_counts to true delegates queue count and overlap
>> validation to the mqprio core via mqprio_validate_queue_counts(),
>> avoiding redundant checks in the driver.
>>
>> Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
>> ---
>> Changes in v2:
>> - No functional change; rebased on net-next, which renamed the
>> struct net_device pointer to "netdev" (was "dev"/"ndev").
>>
>> drivers/net/ethernet/cadence/macb_main.c | 59 ++++++++++++++++++++++++
>> 1 file changed, 59 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index ff7e02d3fab8..67150ff03066 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -4492,6 +4492,60 @@ static int macb_setup_taprio(struct net_device *netdev,
>> return err;
>> }
>>
>> +static int macb_setup_mqprio(struct net_device *netdev,
>> + struct tc_mqprio_qopt_offload *mqprio)
>> +{
>> + struct tc_mqprio_qopt *qopt = &mqprio->qopt;
>> + u8 num_tc = qopt->num_tc;
>> + int err;
>> + u8 i;
>> +
>> + /* Handle reset case early */
>> + if (!num_tc) {
>> + netdev_reset_tc(netdev);
>> + return 0;
>> + }
>> +
>> + /* Configure traffic classes */
>> + qopt->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
>> +
>> + err = netdev_set_num_tc(netdev, num_tc);
>> + if (err)
>> + return err;
>> +
>> + for (i = 0; i < num_tc; i++) {
>> + err = netdev_set_tc_queue(netdev, i, qopt->count[i],
>> + qopt->offset[i]);
>> + if (err)
>> + goto err_reset_tc;
>> +
>> + netdev_dbg(netdev, "MQPRIO: TC%d -> queue %u (count=%u)\n",
>> + i, qopt->offset[i], qopt->count[i]);
>> + }
>
> MACB queue N is always higher priority than queue M if N > M. Here we
> should refuse the setup if mqprio->qopt->offset[i] isn't sorted no?
>
yes, thanks for pointing it out.
I will fix in next version.
Thanks,
> I asked an LLM and it found a precedent in igc:
> igc_tsn_is_tc_to_queue_priority_ordered()
> https://elixir.bootlin.com/linux/v7.2.5/source/drivers/net/ethernet/intel/igc/igc_main.c#L6797-L6801
>
>> +
>> + return 0;
>> +
>> +err_reset_tc:
>> + netdev_reset_tc(netdev);
>> + return err;
>> +}
>
> Thanks,
>
> --
> Théo Lebrun, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
--
🙏 Vineeth
next prev parent reply other threads:[~2026-09-17 13:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 14:20 [PATCH net-next v2 0/4] net: macb: Add TSN MQPRIO and CBS traffic-class offload Vineeth Karumanchi
2026-09-09 14:20 ` [PATCH net-next v2 1/4] net: macb: Rename MACB_CAPS_QBV to MACB_CAPS_TC Vineeth Karumanchi
2026-09-17 9:37 ` Théo Lebrun
2026-09-09 14:20 ` [PATCH net-next v2 2/4] net: macb: Move TC capability and PM checks to macb_setup_tc() Vineeth Karumanchi
2026-09-10 14:44 ` netdev-bot+sashiko
2026-09-15 13:40 ` Karumanchi, Vineeth
2026-09-09 14:20 ` [PATCH net-next v2 3/4] net: macb: Add MQPRIO qdisc hardware offload support Vineeth Karumanchi
2026-09-10 14:44 ` netdev-bot+sashiko
2026-09-17 9:22 ` Théo Lebrun
2026-09-17 13:57 ` Karumanchi, Vineeth [this message]
2026-09-09 14:20 ` [PATCH net-next v2 4/4] net: macb: Add TSN CBS TC " Vineeth Karumanchi
2026-09-10 14:44 ` netdev-bot+sashiko
2026-09-17 9:32 ` Théo Lebrun
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=546c2117-2d8a-4c97-879c-e03f73d3d080@amd.com \
--to=vineeth@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=conor.dooley@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=git@amd.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=theo.lebrun@bootlin.com \
--cc=vineeth.karumanchi@amd.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®