From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Vineeth Karumanchi" <vineeth.karumanchi@amd.com>,
"Conor Dooley" <conor.dooley@microchip.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Nicolai Buchwitz" <nb@tipi-net.de>,
"Paolo Valerio" <pvalerio@redhat.com>,
"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Benoît Monin" <benoit.monin@bootlin.com>,
"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH net-next v7 1/3] net: macb: cache ENST config across link down/up
Date: Mon, 23 Nov 2026 18:51:23 +0100 [thread overview]
Message-ID: <DN2S4TWF22LW.1ZF2FB4STUM0W@bootlin.com> (raw)
In-Reply-To: <0933f10c-8d74-4d98-afdd-1a83409c2402@amd.com>
On Fri Nov 20, 2026 at 7:44 AM CET, Vineeth Karumanchi wrote:
> On 11/19/2026 9:10 PM, Théo Lebrun wrote:
> <...>
>>>> @@ -972,6 +1010,7 @@ static void macb_mac_link_up(struct phylink_config *config,
>>>> spin_lock_irqsave(&bp->lock, flags);
>>>>
>>>> bp->link_up = true;
>>>> + bp->speed_mbps = speed > 0 ? speed : 0;
>>>>
>>>> ctrl = macb_or_gem_readl(bp, NCFGR);
>>>>
>>>> @@ -1009,6 +1048,15 @@ static void macb_mac_link_up(struct phylink_config *config,
>>>>
>>>> spin_unlock_irqrestore(&bp->lock, flags);
>>>>
>>>> + if (bp->enst.speed_mbps && speed != bp->enst.speed_mbps) {
>>> Why drop the schedule on a speed change? The taprio qdisc stays
>>> installed, so the user's configuration is still valid;
>>> Could we instead recompute the ON/OFF times for the new speed on
>>> link-up, and only disable (with a warning) the queues whose intervals no
>>> longer fit the hardware range at that speed?
>> See explanation above. It felt like a good local maximum: simple code
>> that probably doesn't introduce rounding bugs and solves it for most
>> usecases.
>>
>> In any case, we will sometimes have to drop the qdisc and warn about it.
>>
>
> yes agreed!.
>
> I also looked at a few usage scenarios and at how other implementations
> handle this (with some AI assistance). They lean towards recalculating
> on link-up:
>
> - taprio core: keeps the schedule on a speed change and recalculates its
> speed dependent values (picos_per_byte, max frame durations) from its
> NETDEV_UP/NETDEV_CHANGE notifier.
>
> - felix / VSC9959 TAS: gates are in ns; on a speed change,
> vsc9959_sched_speed_set() updates the TAS link speed and calls
> vsc9959_tas_guard_bands_update() to recalculate the speed dependent parts.
>
> Typical scenario:
>
> - Autoneg downshift 1G -> 100M (damaged cable, 2-pair or M12 cabling,
> PHY downshift): fairly common in the field. Users expect best-effort
> traffic to keep flowing, a clear warning, and recovery once the cable is
> fixed.
>
> That said, I am fine with either approach.
The more I think about it, the more I feel it is fine to drop the TAPRIO
schedule as is being done by this patch.
Really, EnST on an unstable link that got downgraded to a lower speed
makes no sense. It is used on Time Sensitive Networks and the link down
is the major issue in that case, not the EnST schedule being off.
Userspace must give us a new schedule that is computed from the link
speed. It is just a bit sad we cannot report the qdisc got dropped.
Anyway, this patch is way better than the current situation, and we
don't have an easy way to a perfect solution. So I say we go with this
and improve if we feel like it is needed later on.
>
>>>> + netdev_warn(bp->netdev,
>>>> + "TAPRIO dropped because link speed changed\n");
>>>> +
>>>> + memset(&bp->enst, 0, sizeof(bp->enst));
>>>> + }
>>>> +
>>>> + macb_apply_enst_config(bp);
>>>> +
>>> Could this be a single macb_apply_tc_config() (or similar) that
>>> reprograms every enabled tc offload? CBS needs exactly the same
>>> handling, since idleslope is also relative to the link rate.
>> Yes sure!
>>
>> Do you want to take over and handle this? You seem to be interested in
>> those TC features. You can either copy the patch as-is or modify it
>> under your own authorship, I don't mind.
>>
>> Or if you prefer, I keep it here and iterate. But if I keep it, I'll
>> continue with ENST and then at a later stage we'll add CBS & co onto
>> it. This patch looks like a good starting point to add more onto it.
>>
>
> Your changes look good to me (after generic struct/api), and I am happy
> with either option. I can take over the patch and make any necessary
> adjustments alongside the CBS changes, or add CBS support after this
> series is merged.
>
> Please let me know which you prefer.
Now that I have the patch I'll iterate on it! Thanks for the quick
feedback; I'll make sure to CC you from now on.
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-11-23 17:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 20:53 [PATCH net-next v7 0/3] net: macb: implement ethtool set channels count operation Théo Lebrun
2026-11-18 20:53 ` [PATCH net-next v7 1/3] net: macb: cache ENST config across link down/up Théo Lebrun
2026-11-19 11:49 ` Nicolai Buchwitz
2026-11-19 12:36 ` Vineeth Karumanchi
2026-11-19 15:40 ` Théo Lebrun
2026-11-19 16:10 ` Théo Lebrun
2026-11-20 6:44 ` Vineeth Karumanchi
2026-11-23 17:51 ` Théo Lebrun [this message]
2026-11-22 20:01 ` netdev-bot+sashiko
2026-11-23 15:37 ` Théo Lebrun
2026-11-18 20:53 ` [PATCH net-next v7 2/3] net: macb: implement ethtool_ops.get|set_channels() Théo Lebrun
2026-11-19 11:54 ` Nicolai Buchwitz
2026-11-19 16:19 ` Théo Lebrun
2026-11-22 20:01 ` netdev-bot+sashiko
2026-11-23 16:04 ` Théo Lebrun
2026-11-18 20:53 ` [PATCH net-next v7 3/3] net: macb: distribute evenly Tx SRAM segments Théo Lebrun
2026-11-19 11:45 ` Nicolai Buchwitz
2026-11-22 20:01 ` netdev-bot+sashiko
2026-11-23 16:16 ` 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=DN2S4TWF22LW.1ZF2FB4STUM0W@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=benoit.monin@bootlin.com \
--cc=conor.dooley@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pvalerio@redhat.com \
--cc=tawfik.bayouk@mobileye.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vineeth.karumanchi@amd.com \
--cc=vladimir.kondratiev@mobileye.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