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

Ita*_*esi 2 linux wake-on-lan linux-mint ubuntu

我根本无法让局域网唤醒在我的机器上工作。我是 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
Run Code Online (Sandbox Code Playgroud)

我的系统配置:

$ 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, <nic-devel@qualcomm.com>
author:         Johannes Berg <johannes@sipsolutions.net>
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
Run Code Online (Sandbox Code Playgroud)

2016 年 1 月 22 日在@MariusMatutiae大投入后的其他信息:

我得到了最新的3.19.8 内核,并且只对 Atheros alx 驱动程序进行了 tar'ed(按照这些说明我能够做到这一点):

$ 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
Run Code Online (Sandbox Code Playgroud)

该内核上的 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, <nic-devel@qualcomm.com>
author:         Johannes Berg <johannes@sipsolutions.net>
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
Run Code Online (Sandbox Code Playgroud)

2016 年 1 月 30 日的附加信息

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

$ sudo iw phy0 wowlan enable magic-packet
$ sudo iw phy0 wowlan show
  WoWLAN is enabled:
   * wake up on magic packet
Run Code Online (Sandbox Code Playgroud)

帮助我开始工作的人将获得一包 250 克最好的巴西咖啡 :)

Ita*_*esi 5

终于有了一些进步,但还是不够。当我使用内核“3.19.0-32-generic”时,我已经从 kernel.org 下载了 alx 驱动器的源代码,编辑了文件以应用补丁(单击此处获取补丁) 按照@MariusMatutiae 的建议,然后编译并用修补过的新驱动程序替换驱动程序。现在我终于可以在 ethtool 命令的输出中看到“Supports Wake-on: pg”了,但是我无法唤醒机器(关机、休眠、挂起)。已尝试使用我的路由器(均具有 aiCloud 功能和路由器的本地唤醒功能)和来自另一个 linux 机器的 etherwake。我会继续挖掘,现在看看我做了什么。另一件事是,启动 alx 驱动程序后不会加载,所以我在 rc.local 上创建了一个脚本来加载它。我可能正在以最糟糕的方式做这件事,但我会到达那里。

下载内核(与我目前使用的内核相同)

cd ~/Downloads
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.tar.gz
Run Code Online (Sandbox Code Playgroud)

仅解压缩 alx 驱动程序文件

tar xf linux-3.19.tar.gz linux-3.19/drivers/net/ethernet/atheros/alx
Run Code Online (Sandbox Code Playgroud)

转到包含源代码的文件夹

cd linux-3.19/drivers/net/ethernet/atheros/alx
Run Code Online (Sandbox Code Playgroud)

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

编译

sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install
Run Code Online (Sandbox Code Playgroud)

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

sudo rmmod alx
Run Code Online (Sandbox Code Playgroud)

重新插入alx驱动

sudo insmod alx.ko
Run Code Online (Sandbox Code Playgroud)

删除并复制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
Run Code Online (Sandbox Code Playgroud)

在这一刻,如果您尝试“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
Run Code Online (Sandbox Code Playgroud)