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

Vladimir Oltean olteanv at gmail.com
Thu May 30 07:35:22 PDT 2024


On Thu, May 30, 2024 at 03:14:48PM +0100, Russell King (Oracle) wrote:
> > 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?
> 
> If the driver is having to do computation on the parameters based on
> the link speed, then when the link speed changes, the parameters
> no longer match what the kernel _thinks_ those parameters were
> programmed with.
> 
> What I'm trying to get over to you is that what you propose causes
> an inconsistency between how the hardware is _programmed_ to behave
> for CBS and what the kernel reports the CBS settings are if the
> link speed changes.
> 
> It's all very well saying that userspace should basically reconstruct
> the tc settings when the link changes, but not everyone is aware of
> that. I'm saying it's a problem if one isn't aware of this issue with
> this hardware, and one looks at tc qdisc show output, and assumes
> that reflects what is actually being used when it isn't.
> 
> It's quality of implmentation - as far as I'm concerned, the kernel
> should *not* mislead the user like this.

I was saying that the tc-cbs parameters input into the kernel should
already have the link speed baked into them:
portTransmitRate = idleSlope - sendSlope. In theory one could feed any
data into the kernel, but this is based on the IEEE 802.1Q formulas.

I had missed the fact that there is a calculation dependent on
priv->speed within tc_setup_cbs(), and I'm sorry for that. I thought
that the values were passed unaltered down to stmmac_config_cbs(). So
"make no change to the driver" is no longer my recommendation.

In that case, my recommendation is to do as sja1105_setup_tc_cbs() does:
replace priv->speed with the portTransmitRate recovered from the tc-cbs
parameters, and fully expect that when the link speed changes, user
space comes along and changes those parameters.



More information about the linux-arm-kernel mailing list