Linux 上的 Qualcomm Atheros QCA8171 上的 WOL 不起作用

Linux 上的 Qualcomm Atheros QCA8171 上的 WOL 不起作用

我就是无法在我的计算机上使用局域网唤醒功能。我是 Linux 新手,所以可能我遗漏了一些东西。下面是我的配置。任何意见都非常感谢。谢谢。

我的硬件配置:

AsRock FM2A88X-ITX+
AMD A10-7800
Running Linux Mint 17.3 64bits

BIOS configured for wake-on-lan:
    Boot From Onboard LAN: Enabled
    PCIE Device Power On: Enabled

我的系统配置:

$ uname -a
Linux home-server 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


$ lspci -nnk | grep -i net -A2
01:00.0 Network controller [0280]: Qualcomm Atheros AR9462 Wireless Network 
Adapter [168c:0034] (rev 01)
        Subsystem: AzureWave Device [1a3b:2110]
        Kernel driver in use: ath9k
        03:00.0 Ethernet controller [0200]: Qualcomm Atheros QCA8171 Gigabit Ethernet [1969:10a1] (rev 10)
        Subsystem: ASRock Incorporation Device [1849:10a1]
        Kernel driver in use: alx


$ modinfo alx
filename:       /lib/modules/3.19.0-32-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko
license:        GPL
description:    Qualcomm Atheros(R) AR816x/AR817x PCI-E Ethernet Network Driver
author:         Qualcomm Corporation, <[email protected]>
author:         Johannes Berg <[email protected]>
srcversion:     1917D292620190CB7319BDE
alias:          pci:v00001969d000010A0sv*sd*bc*sc*i*
alias:          pci:v00001969d000010A1sv*sd*bc*sc*i*
alias:          pci:v00001969d00001090sv*sd*bc*sc*i*
alias:          pci:v00001969d0000E091sv*sd*bc*sc*i*
alias:          pci:v00001969d00001091sv*sd*bc*sc*i*
depends:        mdio
intree:         Y
vermagic:       3.19.0-32-generic SMP mod_unload modversions
signer:         Magrathea: Glacier signing key
sig_key:        0C:8B:EF:E0:C1:E2:89:E4:D8:99:09:26:11:7A:DA:3B:DF:EB:41:9C
sig_hashalgo:   sha512


$ sudo ethtool eth0
    Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Current message level: 0x000060e4 (24804)
                           link ifup rx_err tx_err hw wol
    Link detected: yes


$ cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
PB21      S4    *disabled
PB22      S4    *disabled
PB31      S4    *disabled  pci:0000:00:03.1
PB32      S4    *disabled
PB33      S4    *disabled
PB34      S4    *disabled
SBAZ      S4    *disabled  pci:0000:00:14.2
ECIR      S4    *disabled
PS2K      S4    *disabled
PS2M      S4    *disabled
P0PC      S4    *disabled  pci:0000:00:14.4
OHC1      S4    *enabled   pci:0000:00:12.0
EHC1      S4    *enabled   pci:0000:00:12.2
OHC2      S4    *enabled   pci:0000:00:13.0
EHC2      S4    *enabled   pci:0000:00:13.2
OHC3      S4    *disabled
EHC3      S4    *disabled
OHC4      S4    *enabled   pci:0000:00:14.5
XHC0      S4    *enabled   pci:0000:00:10.0
XHC1      S4    *enabled   pci:0000:00:10.1
PE20      S4    *disabled  pci:0000:00:15.0
PE21      S4    *disabled
PE22      S4    *disabled
PE23      S4    *disabled


$ ifconfig
eth0      Link encap:Ethernet  HWaddr ------HAVE_DELETED_THAT_MYSELF-----
          inet addr:192.168.1.98  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::d250:99ff:fe85:92e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17749 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10035 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22733189 (22.7 MB)  TX bytes:846896 (846.8 KB)
          Interrupt:16


$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


$ sudo ethtool -s eth0 wol g
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol

2016 年 1 月 22 日 @ 后的附加信息马里乌斯·马图蒂亚很棒的输入:

我得到了最新的3.19.8 内核并只对 Atheros alx 驱动程序进行 tar 处理(我能够按照以下步骤进行操作这些说明):

$ tar xf linux-3.19.8.tar.xz linux-3.19.8/drivers/net/ethernet/atheros/alx
$ cd linux-3.19.8/drivers/net/ethernet/atheros/alx
$ make -C /lib/modules/`uname -r`/build M=`pwd` modules
$ sudo cp /lib/modules/3.19.0-32-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko /lib/modules/3.19.0-32-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko.old
$ sudo cp alx.ko /lib/modules/3.19.0-32-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko
$ sudo reboot

该内核上的 alx 驱动程序已恢复 WOL 设置(我注意到的唯一区别是驱动器上缺少签名密钥 - 比较上面和下面的“modinfo alx”的输出),但又没运气了!!!我仍然无法让 WOL 在我的计算机上工作。我已经检查并重新检查了 BIOS 设置中的所有内容。我甚至可以使用 USB 键盘唤醒它,但不能通过 WOL 唤醒。

$ sudo modinfo alx
filename:       /lib/modules/3.19.0-32-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko
license:        GPL
description:    Qualcomm Atheros(R) AR816x/AR817x PCI-E Ethernet Network     Driver
author:         Qualcomm Corporation, <[email protected]>
author:         Johannes Berg <[email protected]>
srcversion:     1917D292620190CB7319BDE
alias:          pci:v00001969d000010A0sv*sd*bc*sc*i*
alias:          pci:v00001969d000010A1sv*sd*bc*sc*i*
alias:          pci:v00001969d00001090sv*sd*bc*sc*i*
alias:          pci:v00001969d0000E091sv*sd*bc*sc*i*
alias:          pci:v00001969d00001091sv*sd*bc*sc*i*
depends:        mdio
vermagic:       3.19.0-32-generic SMP mod_unload modversions

2016 年 1 月 30 日的附加信息

仍然没有运气。我能够设置 WoWLAN 功能,但我的 Linux 无法从断电、休眠或挂起模式唤醒。我尝试通过路由器和 LAN 中的其他计算机将其唤醒。

$ sudo iw phy0 wowlan enable magic-packet
$ sudo iw phy0 wowlan show
  WoWLAN is enabled:
   * wake up on magic packet

帮助我实现这一目标的人将获得一包 250 克的优质巴西咖啡 :)

答案1

终于取得了一些进展,但还不够。由于我使用的是内核“3.19.0-32-generic”,因此我从 kernel.org 下载了 alx 驱动器的源代码,编辑了文件以应用补丁(点击此处获取补丁),正如@MariusMatutiae 大力建议的那样,然后编译并用修补的新驱动程序替换该驱动程序。现在我终于可以在 ethtool 命令的输出中看到“支持唤醒:pg”,但我无法唤醒机器(关机、休眠、挂起)。我尝试使用我的路由器(具有 aiCloud 功能和路由器的局域网唤醒功能)和另一个 Linux 机器的 etherwake。我将继续挖掘,现在请看下面我做了什么。另一件事是启动后 alx 驱动程序无法加载,因此我在 rc.local 上创建了一个脚本来加载它。我可能以最糟糕的方式做到这一点,但我会做到的。

下载内核(与我现在使用的相同)

cd ~/Downloads
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.tar.gz

仅解压 alx 驱动程序文件

tar xf linux-3.19.tar.gz linux-3.19/drivers/net/ethernet/atheros/alx

进入包含源代码的文件夹

cd linux-3.19/drivers/net/ethernet/atheros/alx

重要的:这里需要按照以下说明编辑 alx 源代码文件https://bugzilla.kernel.org/attachment.cgi?id=156751&action=diff

编译

sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install

删除 alx 驱动程序(如果您是远程/ssh,您的连接将会断开,并且需要直接登录到机器)

sudo rmmod alx

重新插入 alx 驱动程序

sudo insmod alx.ko

删除并复制 alx.ko 文件

sudo cp /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/alx.ko /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/alx.ko.good
sudo rm /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/alx.ko
sudo cp alx.ko /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/alx.ko

此时,如果您尝试“ethtool -s eth0 wol pg”,它应该可以工作,但是这不会持续到您再次启动。因此,我必须将以下内容添加到我的 /etc/rc.local 文件中(请注意,我已将创建的文件“alx.ko”移动到 /Drivers/alx.ko):

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#
exec 2> /tmp/rc.local.log
exec 1>&2
set -x
####################################################
# Enable WOL on eth0 at start-up
rmmod alx
insmod /Drivers/alx.ko
rm /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/alx.ko
cp /Drivers/alx.ko /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/alx.ko
ethtool -s eth0 wol pg
iw phy0 wowlan enable magic-packet
# End
####################################################

exit 0

相关内容