2024-05-29 00:58:22

by Andrew Lunn

[permalink] [raw]
Subject: Re: [net PATCH] net: stmmac: update priv->speed to SPEED_UNKNOWN when link down

On Wed, May 29, 2024 at 08:22:01AM +0800, xiaolei wang wrote:
>
> On 5/28/24 21:20, Andrew Lunn wrote:
> > CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> >
> > On Tue, May 28, 2024 at 05:20:10PM +0800, Xiaolei Wang wrote:
> > > The CBS parameter can still be configured when the port is
> > > currently disconnected and link down. This is unreasonable.
> > This sounds like a generic problem. Can the core check the carrier
> > status and error out there? Maybe return a useful extack message.
> >
> > If you do need to return an error code, ENETDOWN seems more
>
> Currently cbs does not check link status. If ops->ndo_setup_tc() returns
> failure, there will only be an output of "Specified device failed to setup
> cbs hardware offload".

So it sounds like we should catch this in the core then, not the
driver. And cbs_enable_offload() takes an extack, so you can report a
user friendly reason for failing, the at the carrier is off.

Andrew

---
pw-bot: cr


2024-05-29 08:52:43

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [net PATCH] net: stmmac: update priv->speed to SPEED_UNKNOWN when link down

On Wed, May 29, 2024 at 02:57:27AM +0200, Andrew Lunn wrote:
> On Wed, May 29, 2024 at 08:22:01AM +0800, xiaolei wang wrote:
> >
> > On 5/28/24 21:20, Andrew Lunn wrote:
> > > CAUTION: This email comes from a non Wind River email account!
> > > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > >
> > > On Tue, May 28, 2024 at 05:20:10PM +0800, Xiaolei Wang wrote:
> > > > The CBS parameter can still be configured when the port is
> > > > currently disconnected and link down. This is unreasonable.
> > > This sounds like a generic problem. Can the core check the carrier
> > > status and error out there? Maybe return a useful extack message.
> > >
> > > If you do need to return an error code, ENETDOWN seems more
> >
> > Currently cbs does not check link status. If ops->ndo_setup_tc() returns
> > failure, there will only be an output of "Specified device failed to setup
> > cbs hardware offload".
>
> So it sounds like we should catch this in the core then, not the
> driver. And cbs_enable_offload() takes an extack, so you can report a
> user friendly reason for failing, the at the carrier is off.

It's worse than that (see my other reply.) If the link speed changes,
there's nothing that deals with updating the CBS configuration for the
new speed. CBS here is basically buggy - unless one reconfigures CBS
each time the link comes up.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!