diff mbox series

[net-next,v4] net: core: add member ncsi_enabled to net_device

Message ID E807CF57548EE44C+20230718022057.30806-1-mengyuanlou@net-swift.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v4] net: core: add member ncsi_enabled to net_device | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5488 this patch: 5488
netdev/cc_maintainers fail 7 maintainers not CCed: kuba@kernel.org linux@armlinux.org.uk davem@davemloft.net pabeni@redhat.com edumazet@google.com hkallweit1@gmail.com andrew@lunn.ch
netdev/build_clang success Errors and warnings before: 2273 this patch: 2273
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5728 this patch: 5728
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Mengyuan Lou July 18, 2023, 2:20 a.m. UTC
Add flag ncsi_enabled to struct net_device indicating whether
NCSI is enabled. Phy_suspend() will use it to decide whether PHY
can be suspended or not.

Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
---
 drivers/net/phy/phy_device.c | 4 +++-
 include/linux/netdevice.h    | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Andrew Lunn July 18, 2023, 2:43 p.m. UTC | #1
On Tue, Jul 18, 2023 at 10:20:57AM +0800, Mengyuan Lou wrote:
> Add flag ncsi_enabled to struct net_device indicating whether
> NCSI is enabled. Phy_suspend() will use it to decide whether PHY
> can be suspended or not.
> 
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
> ---
>  drivers/net/phy/phy_device.c | 4 +++-
>  include/linux/netdevice.h    | 3 +++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 2cad9cc3f6b8..6587b35071e9 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1859,7 +1859,9 @@ int phy_suspend(struct phy_device *phydev)
>  		return 0;
>  
>  	phy_ethtool_get_wol(phydev, &wol);
> -	phydev->wol_enabled = wol.wolopts || (netdev && netdev->wol_enabled);
> +	phydev->wol_enabled = wol.wolopts ||
> +			      (netdev && netdev->wol_enabled) ||
> +			      (netdev && netdev->ncsi_enabled);

I don't really like this. phydev->wol_enabled no longer means
wol_enabled. Please rename phydev->wol_enabled to indicate that the
PHY should not be suspended because it is being used for something.

>  	/* If the device has WOL enabled, we cannot suspend the PHY */
>  	if (phydev->wol_enabled && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND))
>  		return -EBUSY;

This comment also needs updating.

     Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2cad9cc3f6b8..6587b35071e9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1859,7 +1859,9 @@  int phy_suspend(struct phy_device *phydev)
 		return 0;
 
 	phy_ethtool_get_wol(phydev, &wol);
-	phydev->wol_enabled = wol.wolopts || (netdev && netdev->wol_enabled);
+	phydev->wol_enabled = wol.wolopts ||
+			      (netdev && netdev->wol_enabled) ||
+			      (netdev && netdev->ncsi_enabled);
 	/* If the device has WOL enabled, we cannot suspend the PHY */
 	if (phydev->wol_enabled && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND))
 		return -EBUSY;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index acf706d49c2b..5dfccfe10177 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2024,6 +2024,8 @@  enum netdev_ml_priv_type {
  *
  *	@wol_enabled:	Wake-on-LAN is enabled
  *
+ *	@ncsi_enabled:	NCSI is enabled
+ *
  *	@threaded:	napi threaded mode is enabled
  *
  *	@net_notifier_list:	List of per-net netdev notifier block
@@ -2393,6 +2395,7 @@  struct net_device {
 	struct lock_class_key	*qdisc_tx_busylock;
 	bool			proto_down;
 	unsigned		wol_enabled:1;
+	unsigned		ncsi_enabled:1;
 	unsigned		threaded:1;
 
 	struct list_head	net_notifier_list;