[net v2 PATCH] net: stmmac: Update CBS parameters when speed changes after linking up

Vladimir Oltean olteanv at gmail.com
Thu May 30 06:53:35 PDT 2024


On Thu, May 30, 2024 at 02:40:30PM +0100, Russell King (Oracle) wrote:
> On Thu, May 30, 2024 at 04:28:22PM +0300, Vladimir Oltean wrote:
> > On Thu, May 30, 2024 at 02:50:52PM +0200, Xiaolei Wang wrote:
> > > When the port is relinked, if the speed changes, the CBS parameters
> > > should be updated, so saving the user transmission parameters so
> > > that idle_slope and send_slope can be recalculated after the speed
> > > changes after linking up can help reconfigure CBS after the speed
> > > changes.
> > > 
> > > Fixes: 1f705bc61aee ("net: stmmac: Add support for CBS QDISC")
> > > Signed-off-by: Xiaolei Wang <xiaolei.wang at windriver.com>
> > > ---
> > > v1 -> v2
> > >  - Update CBS parameters when speed changes
> > 
> > May I ask what is the point of this patch? The bandwidth fraction, as
> > IEEE 802.1Q defines it, it a function of idleSlope / portTransmitRate,
> > the latter of which is a runtime variant. If the link speed changes at
> > runtime, which is entirely possible, I see no alternative than to let
> > user space figure out that this happened, and decide what to do. This is
> > a consequence of the fact that the tc-cbs UAPI takes the raw idleSlope
> > as direct input, rather than something more high level like the desired
> > bandwidth for the stream itself, which could be dynamically computed by
> > the kernel.
> 
> So what should be the behaviour here? Refuse setting CBS parameters if
> the link is down, and clear the hardware configuration of the CBS
> parameters each and every time there is a link-down event? Isn't that
> going to make the driver's in-use settings inconsistent with what the
> kernel thinks have been set? AFAIK, tc qdisc's don't vanish from the
> kernel just because the link went down.
> 
> I think what you're proposing leads to the hardware being effectively
> "de-programmed" for CBS while "tc qdisc show" will probably report
> that CBS is active on the interface - which clearly would be absurd.

No, just program to hardware right away the idleSlope, sendSlope,
loCredit and hiCredit that were communicated by user space. Those were
computed for a specific link speed and it is user space's business to
monitor that this link speed is maintained for as long as the streams
are necessary (otherwise those parameters are no longer valid).
One could even recover the portTransmitRate that the parameters were
computed for (it should be idleSlope - sendSlope, in Kbps).

AKA keep the driver as it is.

I don't see why the CBS parameters would need to be de-programmed from
hardware on a link down event. Is that some stmmac specific thing?

Xiaolei may have a bone to pick with the fact that tc-cbs takes its
input the way it does, but that's an entirely different matter..



More information about the linux-arm-kernel mailing list