All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <linux-kernel@vger.kernel.org>,
	<bryan.whitehead@microchip.com>, <UNGLinuxDriver@microchip.com>
Subject: [PATCH net V1 3/3] net: lan743x: Address problems with wake option flags configuration sequences
Date: Tue, 19 Mar 2024 11:21:10 +0530	[thread overview]
Message-ID: <20240319055110.764002-4-Raju.Lakkaraju@microchip.com> (raw)
In-Reply-To: <20240319055110.764002-1-Raju.Lakkaraju@microchip.com>

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 <Raju.Lakkaraju@microchip.com>
---
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


  parent reply	other threads:[~2024-03-19  5:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  5:51 [PATCH net V1 0/2] net: lan743x: Fixes for multiple WOL related issues Raju Lakkaraju
2024-03-19  5:51 ` [PATCH net V1 1/2] net: lan743x: disable WOL upon resume to restore full data path operation Raju Lakkaraju
2024-03-19  5:51 ` [PATCH net V1 2/2] net: lan743x: support WOL in MAC even when PHY does not Raju Lakkaraju
2024-03-19  5:51 ` Raju Lakkaraju [this message]
2024-03-19  6:00   ` [PATCH net V1 3/3] net: lan743x: Address problems with wake option flags configuration sequences Raju.Lakkaraju
2024-03-19 17:26     ` 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=20240319055110.764002-4-Raju.Lakkaraju@microchip.com \
    --to=raju.lakkaraju@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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.