All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: netdev@vger.kernel.org
Cc: Francois Romieu <romieu@fr.zoreil.com>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>
Subject: [PATCH] r8169: Don't claim WoL works if LanWake flag is not set
Date: Wed,  9 Dec 2015 11:08:50 +0100	[thread overview]
Message-ID: <1449655730-3328-1-git-send-email-vinschen@redhat.com> (raw)

The __rtl8169_get_wol function returns the state of the various WoL
method bits (MagicPaket, Unicast, etc.).  While the PMEnable bit is
tested at entry, the function doesn't check the LanWake flag.  Even if
any one of the WoL bits is set, WoL is deactivated as a whole if LanWake
isn't set.  The return value from __rtl8169_get_wol doesn't reflect
that.

Unfortunately BIOS exist (HP T620) which set the MagicPaket bit to 1 but
the LanWake flag to 0 when switching on WoL in the BIOS.  On those
machines, ethtool wrongly claims that WoL via MagicPaket is activated
while in fact it isn't, unless you explicitely called

This patch is supposed to fix this behaviour.  If LanWake is 0, the
function now returns 0.  Thus ethtool correctly reports "Wake-on: d".

The patch is against Dave's net-next tree.


Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
---
 drivers/net/ethernet/realtek/r8169.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 79ef799..813ad2b 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1705,6 +1705,10 @@ static u32 __rtl8169_get_wol(struct rtl8169_private *tp)
 	if (!(options & PMEnable))
 		return 0;
 
+	options = RTL_R8(Config5);
+	if (!(options & LanWake))
+		return 0;
+
 	options = RTL_R8(Config3);
 	if (options & LinkUp)
 		wolopts |= WAKE_PHY;
-- 
2.1.0

             reply	other threads:[~2015-12-09 10:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 10:08 Corinna Vinschen [this message]
2015-12-09 10:43 ` [PATCH v2] r8169: Don't claim WoL works if LanWake flag is not set Corinna Vinschen
2015-12-09 22:43   ` Francois Romieu
2015-12-10  9:51     ` Corinna Vinschen
2015-12-10 20:40       ` Francois Romieu
2015-12-10 22:02         ` Corinna Vinschen
2015-12-11  0:06           ` Francois Romieu
2015-12-11  9:42             ` Corinna Vinschen

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=1449655730-3328-1-git-send-email-vinschen@redhat.com \
    --to=vinschen@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=romieu@fr.zoreil.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.