From: Andrew Lunn <andrew@lunn.ch>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux@armlinux.org.uk, olteanv@gmail.com,
hkallweit1@gmail.com, f.fainelli@gmail.com, saeedm@nvidia.com,
michael.chan@broadcom.com
Subject: Re: [RFC net-next] net: track locally triggered link loss
Date: Fri, 20 May 2022 14:24:47 +0200 [thread overview]
Message-ID: <YoeIj2Ew5MPvPcvA@lunn.ch> (raw)
In-Reply-To: <20220520004500.2250674-1-kuba@kernel.org>
> +/**
> + * 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.
> 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().
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.
Please could you pick a few drivers, and convert them? Maybe include a
driver which makes use of phylib, which should be doing control of the
carrier based on the actual link status.
Andrew
next prev parent reply other threads:[~2022-05-20 12:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 0:45 [RFC net-next] net: track locally triggered link loss Jakub Kicinski
2022-05-20 12:24 ` Andrew Lunn [this message]
2022-05-20 18:14 ` Jakub Kicinski
2022-05-20 18:48 ` Andrew Lunn
2022-05-20 22:02 ` Jakub Kicinski
2022-05-21 14:23 ` Andrew Lunn
2022-05-21 18:26 ` Jakub Kicinski
2022-05-20 22:08 ` Saeed Mahameed
2022-05-20 23:03 ` Jakub Kicinski
2022-05-21 5:08 ` Saeed Mahameed
2022-05-21 18:38 ` Jakub Kicinski
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=YoeIj2Ew5MPvPcvA@lunn.ch \
--to=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=saeedm@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.