2024-03-19 05:57:53

by Raju Lakkaraju

[permalink] [raw]
Subject: [PATCH net V1 0/2] net: lan743x: Fixes for multiple WOL related issues

This patch series implement the following fixes:
1. Disable WOL upon resume in order to restore full data path operation
2. Support WOL in MAC even when PHY does not

Change List:
------------
V0 -> V1:
- Include the missing maintainer's email ids in 'CC list
- Remove the patch "Address problems with wake option flags configuration
sequences" from this patch series. Will fix this in next patch series.
- Variable "data" change from "int" to "unsigned int"
- Change the "phy does not support WOL" print from netif_info() to
netif_dbg()

Raju Lakkaraju (2):
net: lan743x: disable WOL upon resume to restore full data path
operation
net: lan743x: support WOL in MAC even when PHY does not

.../net/ethernet/microchip/lan743x_ethtool.c | 14 +++++++++--
drivers/net/ethernet/microchip/lan743x_main.c | 24 ++++++++++++++++++-
drivers/net/ethernet/microchip/lan743x_main.h | 24 +++++++++++++++++++
3 files changed, 59 insertions(+), 3 deletions(-)

--
2.34.1



2024-03-19 05:58:01

by Raju Lakkaraju

[permalink] [raw]
Subject: [PATCH net V1 2/2] net: lan743x: support WOL in MAC even when PHY does not

Allow WOL support if MAC supports it, even if the PHY does not support it

Fixes: e9e13b6adc338 ("lan743x: fix for potential NULL pointer dereference with bare card")
Signed-off-by: Raju Lakkaraju <[email protected]>
---
Change List:
------------
- Change the "phy does not support WOL" print from netif_info() to
netif_dbg()

drivers/net/ethernet/microchip/lan743x_ethtool.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index 8a6ae171e375..7509a19269c3 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -1163,6 +1163,17 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
struct ethtool_wolinfo *wol)
{
struct lan743x_adapter *adapter = netdev_priv(netdev);
+ int ret;
+
+ if (netdev->phydev) {
+ ret = phy_ethtool_set_wol(netdev->phydev, wol);
+ if (ret != -EOPNOTSUPP && ret != 0)
+ return ret;
+
+ if (ret == -EOPNOTSUPP)
+ netif_dbg(adapter, drv, adapter->netdev,
+ "phy does not support WOL\n");
+ }

adapter->wolopts = 0;
if (wol->wolopts & WAKE_UCAST)
@@ -1187,8 +1198,7 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,

device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);

- return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
- : -ENETDOWN;
+ return 0;
}
#endif /* CONFIG_PM */

--
2.34.1


2024-03-19 05:58:23

by Raju Lakkaraju

[permalink] [raw]
Subject: [PATCH net V1 3/3] net: lan743x: Address problems with wake option flags configuration sequences

WOL secure-on and magic packet configuration table:
--------------------------------------------------------------------------------
| Ethtool Ops | Send magic packet | Send magic packet | Send magic packet |
| | | with password | with wrong password|
--------------------------------------------------------------------------------
|WAKE_MAGIC (g) | wake | wake | wake |
--------------------------------------------------------------------------------
|WAKE_SECURE_MAGIC| no wake | wake | no wake |
| (s) | | | |
--------------------------------------------------------------------------------
| WAKE_MAGIC & | | | |
|WAKE_SECURE_MAGIC| wake | wake | wake |
| (gs) | | | |
--------------------------------------------------------------------------------

Fixes: 6b3768ac8e2b3 ("net: lan743x: Add support to Secure-ON WOL")
Signed-off-by: Raju Lakkaraju <[email protected]>
---
Change List:
------------
V0 -> V1:
- Fix the wake option flags configuration sequences

drivers/net/ethernet/microchip/lan743x_ethtool.c | 3 +--
drivers/net/ethernet/microchip/lan743x_main.c | 8 +++++++-
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index 4899582b3d1d..442c52aa0b0e 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -1188,8 +1188,7 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
adapter->wolopts |= WAKE_PHY;
if (wol->wolopts & WAKE_ARP)
adapter->wolopts |= WAKE_ARP;
- if (wol->wolopts & WAKE_MAGICSECURE &&
- wol->wolopts & WAKE_MAGIC) {
+ if (wol->wolopts & WAKE_MAGICSECURE) {
memcpy(adapter->sopass, wol->sopass, sizeof(wol->sopass));
adapter->wolopts |= WAKE_MAGICSECURE;
} else {
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 5641b466d70d..43e8e35fe9d0 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -3639,9 +3639,15 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter)
lan743x_csr_write(adapter, MAC_MP_SO_LO, sopass);
sopass = *(u16 *)&adapter->sopass[4];
lan743x_csr_write(adapter, MAC_MP_SO_HI, sopass);
- wucsr |= MAC_MP_SO_EN_;
+ wucsr |= MAC_MP_SO_EN_ | MAC_WUCSR_MPEN_;
+ macrx |= MAC_RX_RXEN_;
+ pmtctl |= PMT_CTL_WOL_EN_ | PMT_CTL_MAC_D3_RX_CLK_OVR_;
}

+ if (adapter->wolopts & WAKE_MAGICSECURE &&
+ adapter->wolopts & WAKE_MAGIC)
+ wucsr &= ~MAC_MP_SO_EN_;
+
lan743x_csr_write(adapter, MAC_WUCSR, wucsr);
lan743x_csr_write(adapter, PMT_CTL, pmtctl);
lan743x_csr_write(adapter, MAC_RX, macrx);
--
2.34.1


2024-03-19 06:00:46

by Raju Lakkaraju

[permalink] [raw]
Subject: RE: [PATCH net V1 3/3] net: lan743x: Address problems with wake option flags configuration sequences

Hello,

Sorry for inconvenience. Please ignore this mail only.
By mistake it was not out.

Thanks,
Raju
> -----Original Message-----
> From: Raju Lakkaraju <[email protected]>
> Sent: Tuesday, March 19, 2024 11:21 AM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Bryan Whitehead -
> C21958 <[email protected]>; UNGLinuxDriver
> <[email protected]>
> Subject: [PATCH net V1 3/3] net: lan743x: Address problems with wake option
> flags configuration sequences
>
> WOL secure-on and magic packet configuration table:
> --------------------------------------------------------------------------------
> | Ethtool Ops | Send magic packet | Send magic packet | Send magic packet
> |
> | | | with password | with wrong password|
> --------------------------------------------------------------------------------
> |WAKE_MAGIC (g) | wake | wake | wake |
> --------------------------------------------------------------------------------
> |WAKE_SECURE_MAGIC| no wake | wake | no wake |
> | (s) | | | |
> --------------------------------------------------------------------------------
> | WAKE_MAGIC & | | | |
> |WAKE_SECURE_MAGIC| wake | wake | wake |
> | (gs) | | | |
> --------------------------------------------------------------------------------
>
> Fixes: 6b3768ac8e2b3 ("net: lan743x: Add support to Secure-ON WOL")
> Signed-off-by: Raju Lakkaraju <[email protected]>
> ---
> Change List:
> ------------
> V0 -> V1:
> - Fix the wake option flags configuration sequences
>
> drivers/net/ethernet/microchip/lan743x_ethtool.c | 3 +--
> drivers/net/ethernet/microchip/lan743x_main.c | 8 +++++++-
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c
> b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> index 4899582b3d1d..442c52aa0b0e 100644
> --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
> +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> @@ -1188,8 +1188,7 @@ static int lan743x_ethtool_set_wol(struct
> net_device *netdev,
> adapter->wolopts |= WAKE_PHY;
> if (wol->wolopts & WAKE_ARP)
> adapter->wolopts |= WAKE_ARP;
> - if (wol->wolopts & WAKE_MAGICSECURE &&
> - wol->wolopts & WAKE_MAGIC) {
> + if (wol->wolopts & WAKE_MAGICSECURE) {
> memcpy(adapter->sopass, wol->sopass, sizeof(wol->sopass));
> adapter->wolopts |= WAKE_MAGICSECURE;
> } else {
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c
> b/drivers/net/ethernet/microchip/lan743x_main.c
> index 5641b466d70d..43e8e35fe9d0 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -3639,9 +3639,15 @@ static void lan743x_pm_set_wol(struct
> lan743x_adapter *adapter)
> lan743x_csr_write(adapter, MAC_MP_SO_LO, sopass);
> sopass = *(u16 *)&adapter->sopass[4];
> lan743x_csr_write(adapter, MAC_MP_SO_HI, sopass);
> - wucsr |= MAC_MP_SO_EN_;
> + wucsr |= MAC_MP_SO_EN_ | MAC_WUCSR_MPEN_;
> + macrx |= MAC_RX_RXEN_;
> + pmtctl |= PMT_CTL_WOL_EN_ |
> PMT_CTL_MAC_D3_RX_CLK_OVR_;
> }
>
> + if (adapter->wolopts & WAKE_MAGICSECURE &&
> + adapter->wolopts & WAKE_MAGIC)
> + wucsr &= ~MAC_MP_SO_EN_;
> +
> lan743x_csr_write(adapter, MAC_WUCSR, wucsr);
> lan743x_csr_write(adapter, PMT_CTL, pmtctl);
> lan743x_csr_write(adapter, MAC_RX, macrx);
> --
> 2.34.1


2024-03-19 17:27:59

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net V1 3/3] net: lan743x: Address problems with wake option flags configuration sequences

On Tue, 19 Mar 2024 06:00:15 +0000 [email protected] wrote:
> Sorry for inconvenience. Please ignore this mail only.
> By mistake it was not out.

Unfortunately patchwork decided to include it in the series,
please repost.