lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 20 May 2022 11:14:07 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     netdev@...r.kernel.org, linux@...linux.org.uk, olteanv@...il.com,
        hkallweit1@...il.com, f.fainelli@...il.com, saeedm@...dia.com,
        michael.chan@...adcom.com
Subject: Re: [RFC net-next] net: track locally triggered link loss

On Fri, 20 May 2022 14:24:47 +0200 Andrew Lunn wrote:
> > +/**
> > + * netif_carrier_local_changes_start() - enter local link reconfiguration
> > + * @dev: network device
> > + *
> > + * Mark link as unstable due to local administrative actions. This will
> > + * cause netif_carrier_off() to behave like netif_carrier_admin_off() until
> > + * netif_carrier_local_changes_end() is called.
> > + */
> > +static inline void netif_carrier_local_changes_start(struct net_device *dev)
> > +{
> > +	set_bit(__LINK_STATE_NOCARRIER_LOCAL, &dev->state);
> > +}
> > +
> > +static inline void netif_carrier_local_changes_end(struct net_device *dev)
> > +{
> > +	clear_bit(__LINK_STATE_NOCARRIER_LOCAL, &dev->state);
> > +}
> > +  
> 
> Since these don't perform reference counting, maybe a WARN_ON() if the
> bit is already set/not set.

Good idea.

> >  void netif_carrier_on(struct net_device *dev);
> >  void netif_carrier_off(struct net_device *dev);
> > +void netif_carrier_admin_off(struct net_device *dev);
> >  void netif_carrier_event(struct net_device *dev);  
> 
> I need some examples of how you see this used. I can see two ways:
> 
> At the start of a reconfigure, the driver calls
> netif_carrier_local_changes_start() and once it is all over and ready
> to do work again, it calls netif_carrier_local_changes_end().

I was looking at bnxt because it's relatively standard for DC NICs and
doesn't have 10M lines of code.. then again I could be misinterpreting
the code, I haven't tested this theory:

In bnxt_set_pauseparam() for example the driver will send a request to
the FW which will result in the link coming down and back up with
different settings (e.g. when pause autoneg was changed). Since the
driver doesn't call netif_carrier_off() explicitly as part of sending
the FW message but the link down gets reported thru the usual interrupt
(as if someone yanked the cable out) - we need to wrap the FW call with
the __LINK_STATE_NOCARRIER_LOCAL

> The driver has a few netif_carrier_off() calls changed to
> netif_carrier_admin_off(). It is then unclear looking at the code
> which of the calls to netif_carrier_on() match the off.

Right, for bnxt again the carrier_off in bnxt_tx_disable() would become
an admin_carrier_off, since it's basically part of closing the netdev.

> Please could you pick a few drivers, and convert them? 

Will do -- unless someone has concerns about this approach or a better
idea.

> Maybe include a driver which makes use of phylib, which should be
> doing control of the carrier based on the actual link status.

For phylib I was thinking of modifying phy_stop()... but I can't
grep out where carrier_off gets called. I'll take a closer look.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ