Bug 61651 - [regression] Wake-on-LAN broken in alx (AR8161)
Summary: [regression] Wake-on-LAN broken in alx (AR8161)
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Network (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: drivers_network@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-19 06:08 UTC by bugtracker.apriori
Modified: 2018-01-02 08:38 UTC (History)
38 users (show)

See Also:
Kernel Version: 4.10
Tree: Mainline
Regression: Yes


Attachments
Enable ALX WoL for 3.17 (12.88 KB, patch)
2014-11-05 15:43 UTC, Frédéric COIFFIER
Details | Diff
src files for alx-dkms, kernel version 4.2.0 (56.62 KB, application/x-targz)
2016-02-05 18:33 UTC, Marcel Sackermann
Details
automatic dkms module installer for patched alx (4.13 KB, application/x-targz)
2016-02-17 21:32 UTC, Marcel Sackermann
Details
20160407 [patched] automatic dkms module installer for patched alx (4.80 KB, application/x-targz)
2016-04-07 18:43 UTC, Marcel Sackermann
Details
Enable ALX WoL for/since 4.9 (12.11 KB, patch)
2016-12-13 12:59 UTC, Marcel Sackermann
Details | Diff
20170228 [patched] automatic dkms module installer for patched alx (5.53 KB, application/gzip)
2017-02-28 15:25 UTC, Marcel Sackermann
Details
20170306 [patched] automatic dkms module installer for patched alx (5.54 KB, application/gzip)
2017-03-06 12:31 UTC, Marcel Sackermann
Details

Description bugtracker.apriori 2013-09-19 06:08:45 UTC
Using the alx driver on my AR8161, setting Wake-on-LAN is no longer working.

> $ sudo ethtool -s enp6s0 wol g
> Cannot get current wake-on-lan settings: Operation not supported
>  not setting wol
Comment 1 bugtracker.apriori 2013-10-08 06:46:06 UTC
Any additional info needed? Is alx still being maintained, at all?
Comment 2 bugtracker.apriori 2013-11-03 09:20:25 UTC
Still current in 3.11.6.
Comment 3 bugtracker.apriori 2013-11-03 09:22:58 UTC
It has come to my attention that Wake-on-LAN has been explicitly disabled due to another bug, which would make the system wake-up twice for each magic packet.
(http://www.spinics.net/lists/netdev/msg242477.html)

Working around the "wake up twice" bug is preferable to not having Wake-on-LAN at all.
Comment 4 Frédéric COIFFIER 2014-11-05 15:43:40 UTC
Created attachment 156751 [details]
Enable ALX WoL for 3.17

It's just the inverse patch of the 'remove WoL' commit, adapted to 3.17.
Comment 5 Frédéric COIFFIER 2014-11-05 15:44:59 UTC
I don't know how it's possible but I cannot reproduce the "wake up twice" bug since 3.17.

So, I use the attached patch to enable the WoL in alx driver and until now, everything works fine.
Comment 6 François Courmont 2014-12-11 12:38:45 UTC
I can reproduce the "wake up twice" bug with my dual boot, when I shut down my computer from Windows (with WoL set up) and wake it up on Linux.

But it's still better than not having WoL at all. Thanks for the patch !
Comment 7 Christ Jan Wijtmans 2015-01-18 17:57:12 UTC
Is it possible we can get this patch in 3.18 and later to get wol back in alx?
I am pretty sure that removing an entire feature because it has a small bug for some people in some scenarios is not the best way to deal about it.
Comment 8 Christ Jan Wijtmans 2015-01-18 18:01:05 UTC
(In reply to bugtracker.apriori from comment #1)
> Any additional info needed? Is alx still being maintained, at all?

On my Z87M i have an Qualcomm Atheros Killer E220x Gigabit Ethernet Controller. Why would people stop maintaining such an important driver that is on still on some relatively modern hardware.
Comment 9 bugtracker.apriori 2015-01-20 07:57:23 UTC
(In reply to Christ Jan Wijtmans from comment #7)
> Is it possible we can get this patch in 3.18 and later to get wol back in
> alx?
> I am pretty sure that removing an entire feature because it has a small bug
> for some people in some scenarios is not the best way to deal about it.

I would also find it useful if the feature could be patched back in, even if the wake-up-twice bug is still there.
Comment 10 Christ Jan Wijtmans 2015-01-22 11:07:58 UTC
Can you modify the kernel version?
Comment 11 Christ Jan Wijtmans 2015-02-22 16:14:29 UTC
Would be useful if we could select this feature in menuconfig.
Comment 12 François Courmont 2015-04-08 13:44:35 UTC
Since 3.19.3-1 (with Archlinux) it seems that I cannot reproduce the "wake up twice" bug anymore. I'm using Frédéric COIFFIER's patch.
Comment 13 Christ Jan Wijtmans 2015-05-09 09:30:25 UTC
seems like we wont have this patch mainlined.
Comment 14 Daniel Cervenkov 2015-11-08 13:58:19 UTC
To further expand on François Courmont's finding - I'm running a bit older kernel than he - 3.19.0 (Ubuntu 15.04 current default) and also can't reproduce the "wake up twice" bug with Frédéric Coiffier's patch. WOL is working perfectly with the patched module.
Comment 15 Marcel Sackermann 2016-01-02 23:55:00 UTC
Cannot reproduce the bug either, running Ubuntu 15.10 (kernel: 4.2.0, NIC: Qualcomm Atheros Killer E220x [1969:e091] on ASrock Z97M OC Formula).
Using the 'revert' patch and dkms to apply patch on kernel update will work for me.
Comment 16 Wilder 2016-02-05 17:10:36 UTC
Hi, i have same problem with WOL. I want to apply path via dkms but i don't know how to use and configure.  I have installed ubuntu 15.10/64 bits (kernel 4.2.0-27-generic, NIC: Qualcomm Atheros Killer E220x on G1.SNIPER H6).
Comment 17 Marcel Sackermann 2016-02-05 18:33:48 UTC
Created attachment 202981 [details]
src files for alx-dkms, kernel version 4.2.0

extract it to /usr/src and run:

$ dkms add alx/4.2.0

to enable dms-module
Comment 18 Horváth Zoltán 2016-02-13 00:03:15 UTC
I did everything as you wrote, but it still not works:

horvathzoltan@ubul:~$ sudo ethtool -s eth1 wol ug
Cannot set new wake-on-lan settings: Operation not supported
  not setting wol

horvathzoltan@ubul:~$ ethtool eth1 
Settings for eth1:
...
Cannot get wake-on-lan settings: Operation not permitted
	Current message level: 0x000060e4 (24804)
			       link ifup rx_err tx_err hw wol


horvathzoltan@ubul:~$ modinfo alx
filename:       /lib/modules/4.2.0-27-generic/updates/dkms/alx.ko

So, I think everything seems good, but the facts shows it isn't.
Comment 19 Mateusz 2016-02-14 11:45:14 UTC
On 4.4.1 this patch works fine. I really think this should get into mainline. No "wake up twice" and suspend works too. I think maybe some manufacturers did something wrong in they UEFI implementation - my MSI GAMING 3 Z97 works fine.
Comment 20 Christ Jan Wijtmans 2016-02-14 20:49:50 UTC
Should we start a petition or something? How to get this noticed and pushed.
Comment 21 Horváth Zoltán 2016-02-14 21:09:56 UTC
Something has happened today, but I do not know exactly what, but it it has started work for me today. I restarted my system many times before when I tried this, but it has not helped. But now I can confirm that it is working without any bug.

horvathzoltan@ubul:~$ ethtool eth1 
Settings for eth1:
...
Supports Wake-on: pg
	Wake-on: g 
	Current message level: 0x000060e4 (24804)
			       link ifup rx_err tx_err hw wol
Comment 22 Horváth Zoltán 2016-02-14 21:10:58 UTC
(In reply to Christ Jan Wijtmans from comment #20)
> Should we start a petition or something? How to get this noticed and pushed.

first :)
Comment 23 Jerad Penick 2016-02-17 15:00:59 UTC
(In reply to Mateusz from comment #19)
> On 4.4.1 this patch works fine. I really think this should get into
> mainline. No "wake up twice" and suspend works too. I think maybe some
> manufacturers did something wrong in they UEFI implementation - my MSI
> GAMING 3 Z97 works fine.

Which patch are you referring to -- Frédéric COIFFIER or Marcel Sackermann? 

I am on Ubuntu Server 15.10 64 bit (gnome gui)with the 4.4.1 mainline kernel.  My motherboard is the Gigabyte GA-Z170MX Gaming 5 with the Killer e2200 gig ethernet.
Comment 24 Marcel Sackermann 2016-02-17 15:17:57 UTC
(In reply to Jerad Penick from comment #23)
> (In reply to Mateusz from comment #19)
> > On 4.4.1 this patch works fine. I really think this should get into
> > mainline. No "wake up twice" and suspend works too. I think maybe some
> > manufacturers did something wrong in they UEFI implementation - my MSI
> > GAMING 3 Z97 works fine.
> 
> Which patch are you referring to -- Frédéric COIFFIER or Marcel Sackermann? 
> 
> I am on Ubuntu Server 15.10 64 bit (gnome gui)with the 4.4.1 mainline
> kernel.  My motherboard is the Gigabyte GA-Z170MX Gaming 5 with the Killer
> e2200 gig ethernet.

That should'nt matter. I used the patch uploaded here.

@Jerad Penick if you are at Ubuntu 15.10 you could safely use the dkms files uploaded by me IF you were using the kernel from the ubuntu repositories (4.2.0). While the 4.4.1 kernel may work with the older alx module, i would not recommend it.

If you want to use mainline from a deb repo, you should get your hands on your kernel versions source, copy and patch the alx related source and update the dkms tree with those files.
Comment 25 Mateusz 2016-02-17 15:23:20 UTC
(In reply to Jerad Penick from comment #23)
> (In reply to Mateusz from comment #19)
> > On 4.4.1 this patch works fine. I really think this should get into
> > mainline. No "wake up twice" and suspend works too. I think maybe some
> > manufacturers did something wrong in they UEFI implementation - my MSI
> > GAMING 3 Z97 works fine.
> 
> Which patch are you referring to -- Frédéric COIFFIER or Marcel Sackermann? 
> 
> I am on Ubuntu Server 15.10 64 bit (gnome gui)with the 4.4.1 mainline
> kernel.  My motherboard is the Gigabyte GA-Z170MX Gaming 5 with the Killer
> e2200 gig ethernet.

Marcel Sackermann patch didn't compile on 4.4.1 for me, I just patched the kernel source direct with the patch from Frédéric COIFFIER and it worked.
Comment 26 Jerad Penick 2016-02-17 15:26:40 UTC
Thank you Mateusz.  I will give it a go and report back if WOL works with my Killer networking.
Comment 27 Jerad Penick 2016-02-17 15:54:22 UTC
(In reply to Marcel Sackermann from comment #24)
> (In reply to Jerad Penick from comment #23)
> > (In reply to Mateusz from comment #19)
> > > On 4.4.1 this patch works fine. I really think this should get into
> > > mainline. No "wake up twice" and suspend works too. I think maybe some
> > > manufacturers did something wrong in they UEFI implementation - my MSI
> > > GAMING 3 Z97 works fine.
> > 
> > Which patch are you referring to -- Frédéric COIFFIER or Marcel Sackermann? 
> > 
> > I am on Ubuntu Server 15.10 64 bit (gnome gui)with the 4.4.1 mainline
> > kernel.  My motherboard is the Gigabyte GA-Z170MX Gaming 5 with the Killer
> > e2200 gig ethernet.
> 
> That should'nt matter. I used the patch uploaded here.
> 
> @Jerad Penick if you are at Ubuntu 15.10 you could safely use the dkms files
> uploaded by me IF you were using the kernel from the ubuntu repositories
> (4.2.0). While the 4.4.1 kernel may work with the older alx module, i would
> not recommend it.
> 
> If you want to use mainline from a deb repo, you should get your hands on
> your kernel versions source, copy and patch the alx related source and
> update the dkms tree with those files.

I missed your post. Thank you for the info.
Comment 28 Jerad Penick 2016-02-17 18:30:57 UTC
I need some assistance.  I am not able to use Marcel Sackermann patch for the 4.2 kernel. I am going to have keep my 4.4.1 kernel because I'm on an Intel Skylake cpu and Z170 motherboard.  

How do I download the patch from Frédéric COIFFIER? When I click on the link for the patch, all I get is the raw data (diff). I do not have the knowledge to use that data to patch my 4.4.1 kernel. I would like help to place the data into my kernel or a link to the actual patch download. Thanks.
Comment 29 Marcel Sackermann 2016-02-17 21:32:00 UTC
Created attachment 203841 [details]
automatic dkms module installer for patched alx

This is a quick and dirty setup that will automatically setup the dkms module for your specific kernel version. This will only work on debian/ubuntu and other derivates and requires dkms and patch to be setup already.

The setup uses sudo and thus you are asked for your password once. It will then attempt to download your kernels source, copy and patch the alx related files and place a "alx-<kernel-version>" in your /usr/src directory, enable and compile the module and finally rebuild your initrd. Currently the the very first compilation somehow fails, thats why it's run twice.

The last lines of output should look like this:
<code>
...
DKMS: build completed.

alx.ko:
Running module version sanity check.
 - Original module
 - Installation
   - Installing to /lib/modules/4.2.0-27-generic/updates/dkms/

depmod....

DKMS: install completed.
update-initramfs: Generating /boot/initrd.img-4.2.0-27-generic
</code>
Comment 30 Jerad Penick 2016-02-17 23:54:40 UTC
Thanks for the script.  I don't think it worked.  This is the output I get after running it.  There's a lot more output, but this is the end of the output.

Building module:
cleaning build area....(bad exit status: 2)
make KERNELRELEASE=4.4.1-040401-generic -C /lib/modules/4.4.1-040401-generic/build M=/usr/src/alx-4.4.1/src modules....(bad exit status: 2)
ERROR (dkms apport): binary package for alx: 4.4.1 not found
Error! Bad return status for module build on kernel: 4.4.1-040401-generic (x86_64)
Consult /var/lib/dkms/alx/4.4.1/build/make.log for more information.
update-initramfs: Generating /boot/initrd.img-4.4.1-040401-generic
W: Possible missing firmware /lib/firmware/i915/skl_guc_ver4.bin for module i915
Comment 31 Jerad Penick 2016-02-17 23:56:41 UTC
Here is the make.log output.

DKMS make.log for alx-4.4.1 for kernel 4.4.1-040401-generic (x86_64)
Wed Feb 17 17:47:09 CST 2016
make: Entering directory '/usr/src/linux-headers-4.4.1-040401-generic'
scripts/Makefile.build:44: /usr/src/alx-4.4.1/src/Makefile: No such file or directory
make[1]: *** No rule to make target '/usr/src/alx-4.4.1/src/Makefile'.  Stop.
Makefile:1384: recipe for target '_module_/usr/src/alx-4.4.1/src' failed
make: *** [_module_/usr/src/alx-4.4.1/src] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.1-040401-generic'
Comment 32 Marcel Sackermann 2016-02-18 08:55:09 UTC
(In reply to Jerad Penick from comment #31)
> Here is the make.log output.
> 
> DKMS make.log for alx-4.4.1 for kernel 4.4.1-040401-generic (x86_64)
> Wed Feb 17 17:47:09 CST 2016
> make: Entering directory '/usr/src/linux-headers-4.4.1-040401-generic'
> scripts/Makefile.build:44: /usr/src/alx-4.4.1/src/Makefile: No such file or
> directory
> make[1]: *** No rule to make target '/usr/src/alx-4.4.1/src/Makefile'.  Stop.
> Makefile:1384: recipe for target '_module_/usr/src/alx-4.4.1/src' failed
> make: *** [_module_/usr/src/alx-4.4.1/src] Error 2
> make: Leaving directory '/usr/src/linux-headers-4.4.1-040401-generic'

This looks completely wrong. Make sure to run the setup from within the "alx-dkms-installer" directory. Otherwise it won't find neither the dkms.conf nor the patch.
But before you run the setup again, remove the dkms module with "sudo dkms remove alx/4.4.1 --all". Then you're free to run it again. 
If it does not work, get the FULL output and save it to http://pastebin.com/ and share the link.
Comment 33 Jerad Penick 2016-02-18 13:19:29 UTC
I will give it a go again, but a quick note. When the script went out to fetch the kernel, it came back with 4.2 instead of 4.4.1. I forgot to save the entire output to show that, but after removing the said dkms and rerunning the script, I'll save the terminal output to pastebin.
Comment 34 Marcel Sackermann 2016-02-18 13:22:00 UTC
(In reply to Jerad Penick from comment #33)
> I will give it a go again, but a quick note. When the script went out to
> fetch the kernel, it came back with 4.2 instead of 4.4.1. I forgot to save
> the entire output to show that, but after removing the said dkms and
> rerunning the script, I'll save the terminal output to pastebin.

In that case it won't work. You'll need the correct deb-src line for the repository you get your kernel from in your apt/sources.list
Comment 35 Jerad Penick 2016-02-18 13:23:19 UTC
Noted. Thanks.
Comment 36 Jerad Penick 2016-02-18 19:01:03 UTC
(In reply to Marcel Sackermann from comment #34)
> (In reply to Jerad Penick from comment #33)
> > I will give it a go again, but a quick note. When the script went out to
> > fetch the kernel, it came back with 4.2 instead of 4.4.1. I forgot to save
> > the entire output to show that, but after removing the said dkms and
> > rerunning the script, I'll save the terminal output to pastebin.
> 
> In that case it won't work. You'll need the correct deb-src line for the
> repository you get your kernel from in your apt/sources.list

I'm finding the apt/sources.list on my system and can open the file in gedit.  What am I pulling from there and where am putting in your script / files?
Comment 37 Marcel Sackermann 2016-02-19 13:48:31 UTC
(In reply to Jerad Penick from comment #36)
> (In reply to Marcel Sackermann from comment #34)
> > (In reply to Jerad Penick from comment #33)
> > > I will give it a go again, but a quick note. When the script went out to
> > > fetch the kernel, it came back with 4.2 instead of 4.4.1. I forgot to
> save
> > > the entire output to show that, but after removing the said dkms and
> > > rerunning the script, I'll save the terminal output to pastebin.
> > 
> > In that case it won't work. You'll need the correct deb-src line for the
> > repository you get your kernel from in your apt/sources.list
> 
> I'm finding the apt/sources.list on my system and can open the file in
> gedit.  What am I pulling from there and where am putting in your script /
> files?

This is getting far from beeing related to the bug report. I'll mail you directly.
Comment 38 mmesn 2016-03-31 18:16:05 UTC
Hello,

I find here exactly what I'm looking for but I'm not able to make it work with a 4.2.0-34-generic kernel.

Once setup is executed and driver is compiled after a restart no more network !

modinfo alx give me :
vermagic:       4.2.0-27-generic SMP mod_unload modversions

and dmesg :
[    0.393516] alx: disagrees about version of symbol module_layout

Is the setup only for 4.2.0-27 kernel ?

Thanks and regards.

mmesn
Comment 39 Marcel Sackermann 2016-03-31 19:00:25 UTC
(In reply to mmesn from comment #38)
> Hello,
> 
> I find here exactly what I'm looking for but I'm not able to make it work
> with a 4.2.0-34-generic kernel.
> 
> Once setup is executed and driver is compiled after a restart no more
> network !
> 
> modinfo alx give me :
> vermagic:       4.2.0-27-generic SMP mod_unload modversions
> 
> and dmesg :
> [    0.393516] alx: disagrees about version of symbol module_layout
> 
> Is the setup only for 4.2.0-27 kernel ?
> 
> Thanks and regards.
> 
> mmesn

This is a problem related to dkms install magic. The compiled module "/usr/src/alx-4.2.0/src/alx.ko" works just fine if you use 

$ insmod /usr/src/alx-4.2.0/src/alx.ko

Fix this by deleting the copied module "/lib/modules/$(uname -r)/updates/dkms/alx.ko" and the compiler output ("*.o", "*.ko", ".*.cmd") in "/usr/src/alx-4.2.0/src/" and run dkms build and dkms install again.

This has happened to me to, but i thought i might have done something bad myself. Maybe i'll have a look again what's causing this.
Comment 40 Marcel Sackermann 2016-04-07 18:43:02 UTC
Created attachment 212051 [details]
20160407 [patched] automatic dkms module installer for patched alx

This is a patched version of the known auto-installer. Now with output and not restricted to kernel version 4.2.0
I updated the setup and dkms.conf because I ran into the same error today when I updated the kernel today mentioned by mmesn again.


Changelog:
20160407
-more chatty
-setup will now need to download the kernel source of you currently used kernel version from git.kernel.org. It makes a shallow copy of the current release and thus requires to download appr. 150mb
-no need to build twice, fixed
-no disagreement about module_layout mentioned by mmesn
Comment 41 Marcin 2016-04-12 17:20:11 UTC
This fix works just great, unfortunately WOL is missing after reboot or shutdown idk why. I had to everytime remove and load modules, so I've added "modprobe -r alx && modprobe alx" to rc.local and mine QCA8171 WOL works now.

http://pastebin.com/mVstz2fb (with ethtool and modinfo outputs).
Comment 42 Dylan Simowitz 2016-04-24 08:55:38 UTC
(In reply to Marcel Sackermann from comment #40)
> Created attachment 212051 [details]
> 20160407 [patched] automatic dkms module installer for patched alx
> 
> This is a patched version of the known auto-installer. Now with output and
> not restricted to kernel version 4.2.0
> I updated the setup and dkms.conf because I ran into the same error today
> when I updated the kernel today mentioned by mmesn again.
> 
> 
> Changelog:
> 20160407
> -more chatty
> -setup will now need to download the kernel source of you currently used
> kernel version from git.kernel.org. It makes a shallow copy of the current
> release and thus requires to download appr. 150mb
> -no need to build twice, fixed
> -no disagreement about module_layout mentioned by mmesn

Used this patch on 4.5.1 and successfully enabled wol. Any fix for the double wakeup bug yet?
Comment 43 Marcel Sackermann 2016-04-24 13:55:02 UTC
(In reply to Dylan Simowitz from comment #42)
> (In reply to Marcel Sackermann from comment #40)
> > Created attachment 212051 [details]
> > 20160407 [patched] automatic dkms module installer for patched alx
> > 
> > This is a patched version of the known auto-installer. Now with output and
> > not restricted to kernel version 4.2.0
> > I updated the setup and dkms.conf because I ran into the same error today
> > when I updated the kernel today mentioned by mmesn again.
> > 
> > 
> > Changelog:
> > 20160407
> > -more chatty
> > -setup will now need to download the kernel source of you currently used
> > kernel version from git.kernel.org. It makes a shallow copy of the current
> > release and thus requires to download appr. 150mb
> > -no need to build twice, fixed
> > -no disagreement about module_layout mentioned by mmesn
> 
> Used this patch on 4.5.1 and successfully enabled wol. Any fix for the
> double wakeup bug yet?

Are you surely affected from the double wakeup bug? Could not reproduce this bug on the 'Qualcomm Atheros Killer E220x [1969:e091]'

What NIC are you using?
Comment 44 Dylan Simowitz 2016-04-24 20:04:59 UTC
Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
Comment 45 Dylan Simowitz 2016-04-24 20:05:53 UTC
(In reply to Marcel Sackermann from comment #43)
> (In reply to Dylan Simowitz from comment #42)
> > (In reply to Marcel Sackermann from comment #40)
> > > Created attachment 212051 [details]
> > > 20160407 [patched] automatic dkms module installer for patched alx
> > > 
> > > This is a patched version of the known auto-installer. Now with output
> and
> > > not restricted to kernel version 4.2.0
> > > I updated the setup and dkms.conf because I ran into the same error today
> > > when I updated the kernel today mentioned by mmesn again.
> > > 
> > > 
> > > Changelog:
> > > 20160407
> > > -more chatty
> > > -setup will now need to download the kernel source of you currently used
> > > kernel version from git.kernel.org. It makes a shallow copy of the
> current
> > > release and thus requires to download appr. 150mb
> > > -no need to build twice, fixed
> > > -no disagreement about module_layout mentioned by mmesn
> > 
> > Used this patch on 4.5.1 and successfully enabled wol. Any fix for the
> > double wakeup bug yet?
> 
> Are you surely affected from the double wakeup bug? Could not reproduce this
> bug on the 'Qualcomm Atheros Killer E220x [1969:e091]'
> 
> What NIC are you using?

Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
Comment 46 Igor 2016-05-20 17:46:14 UTC
Patch is working for me.

Kernel: 4.6.0-gentoo
Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)

I don't found any negative effects so far.

Thanks!
Comment 47 Christ Jan Wijtmans 2016-05-21 14:53:23 UTC
(In reply to Igor from comment #46)
> Patch is working for me.
> 
> Kernel: 4.6.0-gentoo
> Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
> 
> I don't found any negative effects so far.
> 
> Thanks!

Which patch did you use and how? can i just drop it in /etc/portage/patches? Not in the mood to run something outside of portage.
Comment 48 Robinns zz 2016-06-16 07:44:35 UTC
(In reply to Marcel Sackermann from comment #17)
> Created attachment 202981 [details]
> src files for alx-dkms, kernel version 4.2.0
> 
> extract it to /usr/src and run:
> 
> $ dkms add alx/4.2.0
> 
> to enable dms-module


Could you please patch it on 4.4.0?
I've tried your scripts on 4.4.0/Ubuntu 16.04. But I have no lucky.
And I'm not familiar with C code.
So, thanks
Comment 49 Marcel Sackermann 2016-06-16 07:53:44 UTC
(In reply to Robinns zz from comment #48)
> (In reply to Marcel Sackermann from comment #17)
> > Created attachment 202981 [details]
> > src files for alx-dkms, kernel version 4.2.0
> > 
> > extract it to /usr/src and run:
> > 
> > $ dkms add alx/4.2.0
> > 
> > to enable dms-module
> 
> 
> Could you please patch it on 4.4.0?
> I've tried your scripts on 4.4.0/Ubuntu 16.04. But I have no lucky.
> And I'm not familiar with C code.
> So, thanks

please use "20160407 [patched] automatic dkms module installer for patched alx" attachement (https://bugzilla.kernel.org/attachment.cgi?id=212051). I'm using this myself for the Ubuntu 4.4.0 Kernel.
Comment 50 Robinns zz 2016-06-16 08:01:24 UTC
(In reply to Marcel Sackermann from comment #49)
> (In reply to Robinns zz from comment #48)
> > (In reply to Marcel Sackermann from comment #17)
> > > Created attachment 202981 [details]
> > > src files for alx-dkms, kernel version 4.2.0
> > > 
> > > extract it to /usr/src and run:
> > > 
> > > $ dkms add alx/4.2.0
> > > 
> > > to enable dms-module
> > 
> > 
> > Could you please patch it on 4.4.0?
> > I've tried your scripts on 4.4.0/Ubuntu 16.04. But I have no lucky.
> > And I'm not familiar with C code.
> > So, thanks
> 
> please use "20160407 [patched] automatic dkms module installer for patched
> alx" attachement (https://bugzilla.kernel.org/attachment.cgi?id=212051). I'm
> using this myself for the Ubuntu 4.4.0 Kernel.


I just tried to patch on 4.4.0. But I found it just patched 'main.c' while it would patch "ethtool.c, hw.h, main.c" for 3.13.0. Does it work correctly on 4.4.0?
Comment 51 Marcel Sackermann 2016-06-16 08:05:08 UTC
Yes it does. If you want i'd mail you my version of the dkms-module. But i'd suggest you unpack the auto-installer and try to run the setup. If you already have done that and it failed, i'd like to see the output.
Comment 52 Robinns zz 2016-06-16 08:30:39 UTC
(In reply to Marcel Sackermann from comment #51)
> Yes it does. If you want i'd mail you my version of the dkms-module. But i'd
> suggest you unpack the auto-installer and try to run the setup. If you
> already have done that and it failed, i'd like to see the output.

Mail it to me, please! Thanks.

Plus: I just found a little bug in your auto-scripts and make it no work on some kernel(eg, 3.xx.x, 3.x.xx, 3.xx.xx). This is my patch for the "setup" file.
“
--- setup	2016-04-08 02:31:56.000000000 +0800
+++ setup.new	2016-06-16 14:42:38.066439400 +0800
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-kv=$(uname -r | egrep -o '[0-9]\.[0-9](\.[1-9])?')
+kv=$(uname -r | egrep -o '[0-9]\.([0-9]|([1-9][0-9]))(\.([1-9]|([1-9][0-9])))?')
 linux_dir="linux-$kv"
 alx_driver_path="drivers/net/ethernet/atheros/alx"
 dkms_dir="/usr/src/alx-$kv"
”

Thanks again!
Comment 53 Dave 2016-07-22 04:34:15 UTC
I need some help. First off I'm brand new to Linux. I installed it as the base OS for a media server. I want to use the WOL feature so the machine doesn't stay fully powered when not in use. Unfortunately the obvious issue lead me here.

I don't know if I'm doing something wrong, it feels like I am, but I think I need a complete step by step to get this fix working. I'm using the updated installer from Marcel and it seems to be working but the WOL feature still shows up as not supported. In fact, when I check it using ethtool it's not even listed for my NIC.

So I download the installer package, the .gz, and I extract everything in a new folder. I run setup. I've now done that through both the command line and the GUI I'm using, Mate to be exact. (when I ran it a second time I did the alx remove process, or at least I did what I could, there's some files I couldn't find) Both times it downloaded stuff and even the example above of what the last few lines should look like all looked similar. But I run the ethtool for WOL and it still says not supported. And like I said it doesn't show up when I check it using ethtool.

Oh, and before it's asked, I've made sure all BIOS is set up for WOL. I even have the deep sleep feature enabled, for S4-S5 if that makes any difference.

Again, any help is appreciated. I'm very disappointed the WOL has been disabled. I'm a little proud of myself for getting everything else with the server set up but this is the last hurdle and it seems to be bigger than I can figure out.
Comment 54 Dave 2016-07-22 04:36:41 UTC
Sorry for the double comment but I'm not sure how to edit on here.

I forgot to add I'm using Ubuntu 16.04. And I think I have kernel 4.4.0.
Comment 55 Marcel Sackermann 2016-07-22 07:42:56 UTC
(In reply to Dave from comment #54)
> Sorry for the double comment but I'm not sure how to edit on here.
> 
> I forgot to add I'm using Ubuntu 16.04. And I think I have kernel 4.4.0.

Hello Dave!

a checklist for starters ;)

1. run 'modinfo -n alx' on your machine
  - if it's like '/lib/modules/4.4.0-XX-generic/updates/dkms/alx.ko' the patched driver is loaded (if ethtool still doesn't show wol-capabilities something stranger is going on)
  - if it's like '/lib/modules/4.4.0-XX-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko' the patched driver is currently NOT loaded, proceed to 2.

2. run 'ls /lib/modules/$(uname -r)/updates/dkms/alx.ko'
  - if file does not exist proceed to 4.
  - if file exists proceed to 3.

3. run 'sudo rmmod alx && sudo insmod /lib/modules/$(uname -r)/updates/dkms/alx.ko'
  - if it succeded it's probably your initrd that's loading the default driver. run 'sudo update-initramfs -u' to update your initrds, reboot and go back to 1.
  - if it's unsuccessful you need to rerun the build-process:
    - run 'sudo rm -rf /var/lib/dkms/alx/4.4/$(uname -r)' to clean up
    - run 'sudo rm /var/lib/dkms/alx/kernel-$(uname -r)-$(uname -m)' to clean up
    - run 'sudo rm /lib/modules/$(uname -r)/updates/dkms/alx.ko' to clean up
    - run 'sudo dkms autoinstall build alx/4.4' to build and install kernel module
    - run 'sudo update-initramfs -u' to rebuild initrd, reboot and go back to 1.

4. run 'dkms status alx'
  - if shows something similar to: 'alx, 4.4, 4.4.0-28-generic, x86_64: installed' proceed with rebuild step of 3.
  - if it shows 'alx, 4.4: added' install process did not run yet
    - run 'sudo dkms autoinstall build alx/4.4'
    - run 'sudo update-initramfs -u' to rebuild initrd, reboot and go back to 1.
  - if it does not show anything the dkms module was not properly installed, rerun the autinstaller and go back to 1.

Hope this helps!

Cheers,
Marcel Sackermann
Comment 56 Dave 2016-07-22 20:30:18 UTC
You're a genius mate, that did the trick! Seems it was loading the default driver so your walk through got it going. Thank you so much!

Now I just need to get Emby and Kodi to play nice. :D
Comment 57 Marcel Sackermann 2016-07-22 21:13:04 UTC
Glad I could help. Good luck with your setup!

(In reply to Dave from comment #56)
> You're a genius mate, that did the trick! Seems it was loading the default
> driver so your walk through got it going. Thank you so much!
> 
> Now I just need to get Emby and Kodi to play nice. :D
Comment 58 Josef Larsson 2016-07-27 22:18:07 UTC
Frédéric COIFFIER's patch fixed WoL for my Qualcomm Atheros AR816x/AR817x Ethernet card. Applied cleanly on Linux kernel 4.4.11. I have not noticed any bad side-effects.
Comment 59 Vitaly Ivanov 2016-11-04 20:34:54 UTC
The patch works on Ubuntu 16.04.1, kernel 4.4.0, but it didn't work on Ubuntu 16.10 with kernel 4.8.0. WOL works with full shutdown and hibernate, but not with suspend :( Motherboard AsRock Fatal1ty Z170 Gaming K4, Ethernet controller: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller
Comment 60 Noam 2016-12-07 11:07:09 UTC
Thank you very much for your work Frédéric COIFFIER and Marcel Sackermann. 
Wake-On-Lan now works on my system. 
Ubuntu 16.04.1 LTS, kernel 4.4.0-53-generic, Qualcomm Atheros QCA8171 network interface controller.  
Just ran setup file from https://bugzilla.kernel.org/attachment.cgi?id=212051 and then followed https://bugzilla.kernel.org/show_bug.cgi?id=61651#c55
Comment 61 Christ Jan Wijtmans 2016-12-13 11:57:55 UTC
The patch does not work with kernel 4.9.
Comment 62 Marcel Sackermann 2016-12-13 12:59:37 UTC
Created attachment 247541 [details]
Enable ALX WoL for/since 4.9
Comment 63 Christ Jan Wijtmans 2016-12-15 20:09:02 UTC
Thank you Marcel, i was getting a bit excited when the patch broke that they finally did some work on ALX and fixed WOL but i guess not.
Comment 64 tomrey 2017-02-22 11:04:29 UTC
Hi Marcel,
I am with Jessie still at 3.10.72, the last uncastrated version of alx.
In order to update to the actual Jessie-Kernel, I would need your patch for 3.16.0
Is there any possibility to automate the patchin process so when a newer kernel is installed, you just have to run an update script or does one always need a kernel-specific version of your patch?
Thanks+Regards 
Thomas
Comment 65 bugtracker.apriori 2017-02-22 11:13:34 UTC
The nicest solution would be if this were un-castrated upstream.
Comment 66 Marcel Sackermann 2017-02-22 12:31:43 UTC
@tomrey That's what dkms is for. It'll get invoked upon kernel installation and build the patched module.

Try the installer https://bugzilla.kernel.org/attachment.cgi?id=202981 and read the checklist of https://bugzilla.kernel.org/show_bug.cgi?id=61651#c55

The same patch should work up until Kernel version 4.9 - for 4.9+ there is an updated patch attached to this report.
Comment 67 Marcel Sackermann 2017-02-22 12:33:06 UTC
I'm awfully sorry, the auto-installer is this one of course... https://bugzilla.kernel.org/attachment.cgi?id=212051
Comment 68 tomrey 2017-02-22 13:17:35 UTC
@Marcel: Thanks a lot, I'll try with the 4.2 sources next time I am near the server (Austria) as I'm not able to change the grub2 order through vnc. DKMS is already installed and working for some DVB2 drivers.
Comment 69 tomrey 2017-02-28 08:48:07 UTC
@Marcel: Hi Marcel, I've tried your autoinstaller but ran into a problem:
Apparently the 1. line of setup doesn't make the desired replacement:

running setup gives:
...
git (1:2.1.4-2.1+deb8u2) wird eingerichtet ...
Done
./setup: Zeile 10: [: linux-3.1: Zweistelliger (binärer) Operator erwartet.
./setup: Zeile 22: [: linux-3.1: Zweistelliger (binärer) Operator erwartet.
Preparing dkms module source...
sed: -e Ausdruck #1, Zeichen 20: Nicht beendeter `s'-Befehl
tee: /usr/src/alx-3.1: Ist ein Verzeichnis

let me try to translate:
...
git... is installed
.
./setup: line 10: ...2-digit (binary) Operator expected
.
sed: -e Expression #1, character 20: not ended `s'-Command
tee:...: Is a Directory

after running setup, a new directory is created:
/usr/src/alx-3.1/

In my case 
root@terra:~# uname -r gives:
3.16.0-4-amd64
and
root@terra:~# uname -r | egrep -o '[0-9]\.[0-9](\.[1-9])?' gives:
3.1
6.0

This goes beyond my possibilities....
Regards
Thomas
Comment 70 tomrey 2017-02-28 10:27:48 UTC
@Marcel: I think, I made a step foreward modifying in your setup:
#kv=$(uname -r | egrep -o '[0-9]\.[0-9](\.[1-9])?')
kv='3.16'
setup ran through without errors, your checklist shows everything ok but:
root@terra:~# ethtool eth0 shows:
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
I do see wol at the Current message level but should'nt there be a:
Supports Wake-on: pumbg
       Wake-on: g
or something similar?
I don't dare to try it out as I am 400km away from the server...
Comment 71 Marcel Sackermann 2017-02-28 14:48:12 UTC
(In reply to tomrey from comment #70)
> @Marcel: I think, I made a step foreward modifying in your setup:
> #kv=$(uname -r | egrep -o '[0-9]\.[0-9](\.[1-9])?')
> kv='3.16'
> setup ran through without errors, your checklist shows everything ok but:
> root@terra:~# ethtool eth0 shows:
> 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
> I do see wol at the Current message level but should'nt there be a:
> Supports Wake-on: pumbg
>        Wake-on: g
> or something similar?
> I don't dare to try it out as I am 400km away from the server...

What's the output of `uname -r`?
Comment 72 tomrey 2017-02-28 14:54:45 UTC
In my case 
root@terra:~# uname -r gives:
3.16.0-4-amd64
and
root@terra:~# uname -r | egrep -o '[0-9]\.[0-9](\.[1-9])?' gives:
3.1
6.0
Comment 73 Marcel Sackermann 2017-02-28 15:25:02 UTC
Created attachment 254985 [details]
20170228 [patched] automatic dkms module installer for patched alx

fixed kernel-version detection and included detection for 4.9+ patch
Comment 74 Marcel Sackermann 2017-02-28 15:28:20 UTC
(In reply to Marcel Sackermann from comment #73)
> Created attachment 254985 [details]
> 20170228 [patched] automatic dkms module installer for patched alx
> 
> fixed kernel-version detection and included detection for 4.9+ patch

I updated the autoinstaller.

https://bugzilla.kernel.org/attachment.cgi?id=254985

It'll now correctly detect your kernel version. Please try this one in future (for now your static variable shoud work).
Basically you're right. ethtool should show a line like "Supports Wake-on: [...]". If not, it probably won't work.

What's `modinfo -n alx` telling you?
Comment 75 tomrey 2017-02-28 15:37:18 UTC
Thanks
root@terra:~# modinfo -n alx
/lib/modules/3.16.0-4-amd64/updates/dkms/alx.ko
Comment 76 Marcel Sackermann 2017-02-28 16:35:18 UTC
(In reply to tomrey from comment #75)
> Thanks
> root@terra:~# modinfo -n alx
> /lib/modules/3.16.0-4-amd64/updates/dkms/alx.ko

That looks fine. Did you reboot the machine or reload the module after installing the patched module?

To ensure your initrd contains the new module aswell, please paste the output of:

`gunzip -c <your-current-initrd> | cpio -t | grep -i alx`

(if you're using Debian: `gunzip -c /boot/initrd.img-$(uname -r) | cpio -t | grep -i alx` should work)
Comment 77 tomrey 2017-02-28 16:45:18 UTC
root@terra:~# gunzip -c /boot/initrd.img-$(uname -r) | cpio -t | grep -i alx
lib/modules/3.16.0-4-amd64/updates/dkms/alx.ko
156959 blocks
And in addition here all alx.ko in my system:
/lib/modules/3.10.72/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/3.16.0-4-amd64/updates/dkms/alx.ko
/var/lib/dkms/alx/3.16/3.16.0-4-amd64/x86_64/module/alx.ko
/var/lib/dkms/alx/3.16/build/src/alx.ko
the first one has a size of 972,2kb, the second has 55,9kb and all the others have 59,9kb.
Yes I am on Debian Jessie
Regards
Comment 78 tomrey 2017-02-28 16:47:32 UTC
sorry, and yes, I rebooted after installing...
Comment 79 Marcel Sackermann 2017-02-28 16:58:05 UTC
That looks all fine.

In this case you may be "out of luck" could you show us the details of your chip?
For instance the alx-related part of `lspci -v`?
Comment 80 tomrey 2017-02-28 17:03:31 UTC
Thanks for your time, remember that I do have full WOL-functionality with the last "uncastrated" alx with kernel= 3.10.72


root@terra:~# lspci -v
00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, fast devsel, latency 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>
	Kernel driver in use: hsw_uncore

00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06) (prog-if 00 [VGA controller])
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, fast devsel, latency 0, IRQ 45
	Memory at f7800000 (64-bit, non-prefetchable) [size=4M]
	Memory at e0000000 (64-bit, prefetchable) [size=256M]
	I/O ports at f000 [size=64]
	Expansion ROM at <unassigned> [disabled]
	Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [d0] Power Management version 2
	Capabilities: [a4] PCI Advanced Features
	Kernel driver in use: i915

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, fast devsel, latency 0, IRQ 47
	Memory at f7f14000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
	Kernel driver in use: snd_hda_intel

00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05) (prog-if 30 [XHCI])
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, medium devsel, latency 0, IRQ 43
	Memory at f7f00000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: [70] Power Management version 2
	Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
	Kernel driver in use: xhci_hcd

00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, fast devsel, latency 0, IRQ 46
	Memory at f7f1e000 (64-bit, non-prefetchable) [size=16]
	Capabilities: [50] Power Management version 3
	Capabilities: [8c] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Kernel driver in use: mei_me

00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05) (prog-if 20 [EHCI])
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, medium devsel, latency 0, IRQ 16
	Memory at f7f1c000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 2
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
	Kernel driver in use: ehci-pci

00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device d816
	Flags: bus master, fast devsel, latency 0, IRQ 44
	Memory at f7f10000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	Memory behind bridge: f7e00000-f7efffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Capabilities: [a0] Power Management version 3
	Kernel driver in use: pcieport

00:1c.1 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #2 (rev d5) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
	I/O behind bridge: 0000e000-0000efff
	Memory behind bridge: f7d00000-f7dfffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Capabilities: [a0] Power Management version 3
	Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d5) (prog-if 01 [Subtractive decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=03, subordinate=04, sec-latency=0
	I/O behind bridge: 0000d000-0000dfff
	Memory behind bridge: f7c00000-f7cfffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Capabilities: [a0] Power Management version 3

00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05) (prog-if 20 [EHCI])
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, medium devsel, latency 0, IRQ 23
	Memory at f7f1b000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 2
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
	Kernel driver in use: ehci-pci

00:1f.0 ISA bridge: Intel Corporation H87 Express LPC Controller (rev 05)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, medium devsel, latency 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>
	Kernel driver in use: lpc_ich

00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05) (prog-if 01 [AHCI 1.0])
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 42
	I/O ports at f0b0 [size=8]
	I/O ports at f0a0 [size=4]
	I/O ports at f090 [size=8]
	I/O ports at f080 [size=4]
	I/O ports at f060 [size=32]
	Memory at f7f1a000 (32-bit, non-prefetchable) [size=2K]
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [70] Power Management version 3
	Capabilities: [a8] SATA HBA v1.0
	Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: medium devsel, IRQ 18
	Memory at f7f19000 (64-bit, non-prefetchable) [size=256]
	I/O ports at f040 [size=32]

01:00.0 Multimedia controller: Digital Devices GmbH Octopus DVB Adapter
	Subsystem: Digital Devices GmbH Cine S2 V6.5 DVB adapter
	Flags: fast devsel, IRQ 16
	Memory at f7e00000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: [50] Power Management version 3
	Capabilities: [70] MSI: Enable- Count=1/2 Maskable- 64bit+
	Capabilities: [90] Express Endpoint, MSI 00
	Capabilities: [100] Vendor Specific Information: ID=0000 Rev=0 Len=00c <?>
	Kernel driver in use: ddbridge

02:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Flags: bus master, fast devsel, latency 0, IRQ 48
	Memory at f7d00000 (64-bit, non-prefetchable) [size=256K]
	I/O ports at e000 [size=128]
	Capabilities: [40] Power Management version 3
	Capabilities: [58] Express Endpoint, MSI 00
	Capabilities: [c0] MSI: Enable+ Count=1/16 Maskable+ 64bit+
	Capabilities: [d8] MSI-X: Enable- Count=16 Masked-
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [180] Device Serial Number ff-e4-e3-c4-d4-3d-7e-ff
	Kernel driver in use: alx

03:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 03) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=03, secondary=04, subordinate=04, sec-latency=32
	I/O behind bridge: 0000d000-0000dfff
	Memory behind bridge: f7c00000-f7cfffff
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [78] Power Management version 3
	Capabilities: [80] Express PCI-Express to PCI/PCI-X Bridge, MSI 00
	Capabilities: [c0] Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7816
	Capabilities: [100] Virtual Channel

04:00.0 RAID bus controller: VIA Technologies, Inc. VT6421 IDE/SATA Controller (rev 50)
	Subsystem: VIA Technologies, Inc. VT6421 IDE/SATA Controller
	Flags: bus master, medium devsel, latency 32, IRQ 19
	I/O ports at d350 [size=16]
	I/O ports at d340 [size=16]
	I/O ports at d330 [size=16]
	I/O ports at d320 [size=16]
	I/O ports at d300 [size=32]
	I/O ports at d200 [size=256]
	Expansion ROM at f7c00000 [disabled] [size=64K]
	Capabilities: [e0] Power Management version 2
	Kernel driver in use: sata_via

04:01.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10)
	Subsystem: TERRATEC Electronic GmbH Aureon 5.1
	Flags: bus master, stepping, medium devsel, latency 32, IRQ 16
	I/O ports at d100 [size=256]
	Capabilities: [c0] Power Management version 2
	Kernel driver in use: snd_cmipci

04:02.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10)
	Subsystem: TERRATEC Electronic GmbH Aureon 5.1
	Flags: bus master, stepping, medium devsel, latency 32, IRQ 17
	I/O ports at d000 [size=256]
	Capabilities: [c0] Power Management version 2
	Kernel driver in use: snd_cmipci
Comment 81 tomrey 2017-03-01 07:14:40 UTC
@Marcel: Good news, the patched alx is working correctly and gives:
root@terra:~# ethtool eth0
Settings for eth0:
...
	Supports Wake-on: pg
	Wake-on: pg
...
Apparently a shut down and restart made the difference, several previous reboots were fruitless.
Anyhow, thanks a lot again for your precious time taken and support given for my challenge!
Comment 82 Erminio Ottone 2017-03-06 10:58:04 UTC
Hello. 

I wanted only to say that thanks to this thread I got my Qualcomm Atheros QCA8171 chip to receive WOL. Now it is working as a charm. 

I also want to contribute to this thread by pointing out that in my case (Ubuntu 16.04 and kernel 4.4.0-64) the new "20170228 [patched] automatic dkms module installer for patched alx" is not patching correctly the module and I had to use the older version posted in comment #40 (attachment 212051 [details]) that is working as a charm.

I am sorry that I didn't saved the error output of the patch command of the new automatic installer. Anyways it was trying to patch the wrong files (the ones of gentoo kernel 3.17). Maybe the part of the script that lool for the kernel version was not working in my case.

Thanks again for everything.
Comment 83 Marcel Sackermann 2017-03-06 12:31:43 UTC
Created attachment 255097 [details]
20170306 [patched] automatic dkms module installer for patched alx

fixed patch-offset for kernel-version < 4.9
Comment 84 Marcel Sackermann 2017-03-06 12:33:35 UTC
(In reply to Erminio Ottone from comment #82)
> Hello. 
> 
> I wanted only to say that thanks to this thread I got my Qualcomm Atheros
> QCA8171 chip to receive WOL. Now it is working as a charm. 
> 
> I also want to contribute to this thread by pointing out that in my case
> (Ubuntu 16.04 and kernel 4.4.0-64) the new "20170228 [patched] automatic
> dkms module installer for patched alx" is not patching correctly the module
> and I had to use the older version posted in comment #40 (attachment 212051 [details]
> [details]) that is working as a charm.
> 
> I am sorry that I didn't saved the error output of the patch command of the
> new automatic installer. Anyways it was trying to patch the wrong files (the
> ones of gentoo kernel 3.17). Maybe the part of the script that lool for the
> kernel version was not working in my case.
> 
> Thanks again for everything.

Thanks for the hint, I fixed the patch-offset. Seems like I got that one wrong for kernels < 4.9
Comment 85 Noam 2017-03-14 01:04:45 UTC
Seems like a recent update from 4.4.0-64 to 4.4.0-66 broke WOL for me. 
Tried to recreate the installation process using the latest auto-installer https://bugzilla.kernel.org/attachment.cgi?id=255097 but it doesn't seem to work properly. 

I'm able to see and set Wake-on:
$ ethtool eth0
	Supports Wake-on: pg
	Wake-on: pg

And the module is loaded:
$ modinfo -n alx
/lib/modules/4.4.0-66-generic/updates/dkms/alx.ko

$ dkms status alx
alx, 4.4, 4.4.0-64-generic, x86_64: installed
alx, 4.4, 4.4.0-66-generic, x86_64: installed

Following a reboot, suspend, or poweroff, ethtool shows:
	Wake-on: d

WOL doesn't work at any point. 

Could a complete clean and rebuild solve this issue? 

Anything to clean other than these?
$ sudo rm -rf /var/lib/dkms/alx/4.4/$(uname -r)
$ sudo rm /var/lib/dkms/alx/kernel-$(uname -r)-$(uname -m)
$ sudo rm /lib/modules/$(uname -r)/updates/dkms/alx.ko

Thank you.
Comment 86 Marcel Sackermann 2017-03-14 11:37:52 UTC
[...]
      wol p|u|m|b|a|g|s|d...
             Set Wake-on-LAN options.  Not all  devices  support  this.   The
             argument  to  this  option  is a string of characters specifying
             which options to enable.
             p  Wake on phy activity
             u  Wake on unicast messages
             m  Wake on multicast messages
             b  Wake on broadcast messages
             a  Wake on ARP
             g  Wake on MagicPacket(tm)
             s  Enable SecureOn(tm) password for MagicPacket(tm)
             d  Disable (wake on nothing).  This option clears  all  previous
                options.
[...]

could you try running `ethtool -s eth0 wol g`? Because "Wake-on: d" definetly means that WOL is disabled.
Comment 87 Noam 2017-03-14 12:22:52 UTC
Thanks for your reply Marcel.
After running `ethtool -s eth0 wol g` I get "Wake-on: g", but after reboot it reverts back to "Wake-on: d". Tested WOL to make sure and indeed does not work.
Comment 88 Noam 2017-03-22 10:55:49 UTC
Just to update on the issue I was having where Wake-on was reverting to "d" after suspend... I've been tackling this issue for the past week, trying pretty much every possible suggestion I could find online. I actually started off by removing 2 packages I had recently installed
`sudo apt-get sudo apt-get purge --auto-remove lm-sensors fancontrol`
But after that didn't make a difference, I continued with:
 - Removing and rebuilding the module
 - Different BIOS settings
 - Scripts in /etc/pm/sleep.d/ for calling `ethtool ... wol g` on suspend/resume, scripts in /etc/rc.local, 
 - Managing NetworkManager via terminal using `nmcli c modify "wired1" 802-3-ethernet.wake-on-lan magic`
 - Disabling NetworkManager and managing the interfaces manually with various different settings
 - Setting `NETDOWN=no` in /etc/init.d/halt

It was only today when I came back to this thread searching for solutions in previous comments, that I took into account the date this issue initially appeared. So I looked back at the packages I had installed on that day `less /var/log/apt/history.log`... and behold: tlp. 

`sudo apt-get purge --auto-remove tlp` and the problem went away. Something with tlp's power management must have broken WOL - I didn't really need it anyway, only used it once to test something out. Hopefully this helps someone out there. :)
Comment 89 Noam 2017-03-22 12:01:13 UTC
For those who need TLP and also WOL, I stumbled on this just minutes after finding the remove-tlp solution: http://askubuntu.com/questions/764158/how-to-enable-wake-on-lan-wol-in-ubuntu-16-04 
Set WOL_DISABLE=N in /etc/default/tlp to avoid getting WOL disabled by TLP power management.
Still can't believe I only noticed this just now. 5th result on Google. :|
Comment 90 Steven Xu 2017-04-05 23:07:46 UTC
@Marcel Hello, I'm running Arch Linux with kernel 4.10.6. I ran your autoinstall and I'm going through your checklist. 'modinfo -n alx' shows '/lib/modules/4.10.6-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko.gz', so I procceded to setup 4. 'dkms status alx' shows 'alx, 4.10.6, 4.10.6-1-ARCH, x86_64: installed (original_module exists)', so I went to do the rebuild in step 3, but nothing changed after I rebooted.

Pls help!
Comment 91 Steven Xu 2017-04-05 23:08:38 UTC
I am using the latest autoinstaller.
Comment 92 Marcel Sackermann 2017-04-06 07:33:23 UTC
(In reply to Steven Xu from comment #90)
> @Marcel Hello, I'm running Arch Linux with kernel 4.10.6. I ran your
> autoinstall and I'm going through your checklist. 'modinfo -n alx' shows
> '/lib/modules/4.10.6-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko.
> gz', so I procceded to setup 4. 'dkms status alx' shows 'alx, 4.10.6,
> 4.10.6-1-ARCH, x86_64: installed (original_module exists)', so I went to do
> the rebuild in step 3, but nothing changed after I rebooted.
> 
> Pls help!

Could you please post the output of: `find /lib/modules/4.10.6-1-ARCH/ -name "alx.*"` ?
Comment 93 Steven Xu 2017-04-07 23:18:08 UTC
@Marcel

[steventheevil@Steven-PC ~]$ find /lib/modules/4.10.6-1-ARCH/ -name "alx.*"
/lib/modules/4.10.6-1-ARCH/build/include/config/alx.h
/lib/modules/4.10.6-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko.gz
/lib/modules/4.10.6-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko
Comment 94 Christian Brendel 2017-06-15 19:19:45 UTC
(In reply to Steven Xu from comment #93)
> @Marcel
> 
> [steventheevil@Steven-PC ~]$ find /lib/modules/4.10.6-1-ARCH/ -name "alx.*"
> /lib/modules/4.10.6-1-ARCH/build/include/config/alx.h
> /lib/modules/4.10.6-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko.gz
> /lib/modules/4.10.6-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko

Disclaimer: I know very little about the kernel. I'm running arch 4.11.4, and I had your problem too. The problem for me was that the compressed alx.ko.gz (the unpatched version) was being loaded in preference to the alx.ko (produced by the patched version). You could experiment with `rmmod alx` and `insmod alx.ko' to test before reboot. If you run ethtool on your device, you should now see the wol options.

I'm not sure of the best practice, but to make it persistant, I just removed the old alx.ko.gz from the directory and replaced it with a gzipped version of the patched alx.ko and did a `mkinitcpio --allpresets`. Working fine now.
Comment 95 Michał Miarka 2017-07-27 08:01:17 UTC
Hello there!

I was using attached alx-dmks-installer script and it worked in 4.9.0-3-amd64 whoever in 4.11.0-1-amd64 it stopped. 

For some reason DMKS didnt rebuild driver so i had to re-download script and re-compile it. 

Module is re-build and installed:
root@haruko:/ssd/sources/alx-dmks-installer# dkms status
alx, 4.11, 4.11.0-1-amd64, x86_64: installed
alx, 4.8, 4.9.0-3-amd64, x86_64: installed
nvidia, 381.22, 4.11.0-1-amd64, x86_64: installed
nvidia, 381.22, 4.9.0-3-amd64, x86_64: installed

Propper module is loaded:
root@haruko:/ssd/sources/alx-dmks-installer#  modinfo -n alx
/lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko

There is no extra modules:
root@haruko:/ssd/sources/alx-dmks-installer# find /lib -name "alx.*"
/lib/modules/4.9.0-3-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/4.9.0-3-amd64/updates/dkms/alx.ko
/lib/modules/4.11.0-1-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko


But there is no Wake-on position on my card (and also wol is not working)
root@haruko:/ssd/sources/alx-dmks-installer# ethtool enp3s0
Settings for enp3s0:
        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


Am i doing something wrong or it just not working anymore :)?
Comment 96 Marcel Sackermann 2017-08-01 14:25:46 UTC
(In reply to Michał Miarka from comment #95)
> Hello there!
> 
> I was using attached alx-dmks-installer script and it worked in
> 4.9.0-3-amd64 whoever in 4.11.0-1-amd64 it stopped. 
> 
> For some reason DMKS didnt rebuild driver so i had to re-download script and
> re-compile it. 
> 
> Module is re-build and installed:
> root@haruko:/ssd/sources/alx-dmks-installer# dkms status
> alx, 4.11, 4.11.0-1-amd64, x86_64: installed
> alx, 4.8, 4.9.0-3-amd64, x86_64: installed
> nvidia, 381.22, 4.11.0-1-amd64, x86_64: installed
> nvidia, 381.22, 4.9.0-3-amd64, x86_64: installed
> 
> Propper module is loaded:
> root@haruko:/ssd/sources/alx-dmks-installer#  modinfo -n alx
> /lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko
> 
> There is no extra modules:
> root@haruko:/ssd/sources/alx-dmks-installer# find /lib -name "alx.*"
> /lib/modules/4.9.0-3-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
> /lib/modules/4.9.0-3-amd64/updates/dkms/alx.ko
> /lib/modules/4.11.0-1-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
> /lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko
> 
> 
> But there is no Wake-on position on my card (and also wol is not working)
> root@haruko:/ssd/sources/alx-dmks-installer# ethtool enp3s0
> Settings for enp3s0:
>         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
> 
> 
> Am i doing something wrong or it just not working anymore :)?


Did not work for me either, but it's not dkms fault. The patch does not result in WOL availability when applied directly to kernel 4.11.0 (mainline) either.

Did you try using a new version? (one that's not marked [EOL])
Comment 97 Michał Miarka 2017-08-02 07:01:25 UTC
> Did not work for me either, but it's not dkms fault. 
yeah, it shoudnt be dkms fault

> The patch does not result in WOL availability when applied directly to 
> kernel 4.11.0 (mainline) either.
> Did you try using a new version? (one that's not marked [EOL])
New version of what? I didn't saw any new version of this patch
Comment 98 Marcel Sackermann 2017-08-02 07:44:20 UTC
(In reply to Michał Miarka from comment #97)
> > Did not work for me either, but it's not dkms fault. 
> yeah, it shoudnt be dkms fault
> 
> > The patch does not result in WOL availability when applied directly to 
> > kernel 4.11.0 (mainline) either.
> > Did you try using a new version? (one that's not marked [EOL])
> New version of what? I didn't saw any new version of this patch

more recent/newer kernel version
Comment 99 Michał Miarka 2017-08-02 08:28:00 UTC
> more recent/newer kernel version
Oh, no. I am using stock version on Debian Testing. I'll try later.


Did you manage to make it work?
Comment 100 Marcel Sackermann 2017-08-02 08:32:40 UTC
(In reply to Michał Miarka from comment #99)
> > more recent/newer kernel version
> Oh, no. I am using stock version on Debian Testing. I'll try later.
> 
> 
> Did you manage to make it work?

I'm still using 4.9.x which works. Just tested the 4.11.0 once to verify WOL-availability.
Comment 101 Laz Lev 2017-08-02 17:20:00 UTC
Still works for me with latest patch on Arch Linux. Current kernel version is 4.12.3-1-ARCH but it also worked with older 4.11.x versions.
Comment 102 Sebastián Pagano 2017-08-02 23:23:59 UTC
I'm trying to make it work on E2500 with the 4.10.x version on Ubuntu.
I have already run the installer ok.
But i'm still stuck here without have wol availability

root@srvnns:/home/naleon# dkms status
alx, 4.10, 4.10.0-28-generic, x86_64: installed
root@srvnns:/home/naleon# ethtool enp5s0
Settings for enp5s0:
	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

Any help will be appreciated, thanks!!
Comment 103 Marcel Sackermann 2017-08-03 08:14:42 UTC
(In reply to Laz Lev from comment #101)
> Still works for me with latest patch on Arch Linux. Current kernel version
> is 4.12.3-1-ARCH but it also worked with older 4.11.x versions.

Yeah, well. I jumped the gun on this one. Somewhere in the half-assed process of testing i forgot to actually apply the patch... 

$ patch -V never -r - -t -N -p0 < ../alx-enable-wol-linux-4.9.patch 
patching file drivers/net/ethernet/atheros/alx/ethtool.c
Hunk #1 succeeded at 310 with fuzz 2 (offset 11 lines).
Hunk #2 succeeded at 349 (offset 9 lines).
patching file drivers/net/ethernet/atheros/alx/hw.c
patching file drivers/net/ethernet/atheros/alx/hw.h
Hunk #1 succeeded at 487 (offset -1 lines).
Hunk #2 succeeded at 551 (offset -1 lines).
Hunk #3 succeeded at 567 (offset -1 lines).
patching file drivers/net/ethernet/atheros/alx/main.c
Hunk #1 succeeded at 1095 with fuzz 1 (offset 201 lines).
Hunk #2 succeeded at 1366 (offset 215 lines).
Hunk #3 succeeded at 1921 (offset 224 lines).
Hunk #4 succeeded at 1965 (offset 224 lines).
Hunk #5 succeeded at 1987 (offset 224 lines).
Hunk #6 succeeded at 2073 (offset 224 lines).
Hunk #7 succeeded at 2126 (offset 224 lines).

Hunks succeeded and voilà: WOL

But nonetheless you'd be better off not using EOL kernels.
Comment 104 Michał Miarka 2017-08-03 08:34:47 UTC
So... if patch is working why this feature is not on my side?
Comment 105 Christian Brendel 2017-08-04 23:29:11 UTC
Hi all,

Marcel's patch has been working well for me (as a dkms module) until I recently upgraded to kernel 4.12.3 (running Arch). The dkms autoinstall fails; here is the make log.

make: Entering directory '/usr/lib/modules/4.12.3-1-ARCH/build'
  CC [M]  /var/lib/dkms/alx/4.11.4/build/src/main.o
  CC [M]  /var/lib/dkms/alx/4.11.4/build/src/ethtool.o
  CC [M]  /var/lib/dkms/alx/4.11.4/build/src/hw.o
/var/lib/dkms/alx/4.11.4/build/src/main.c: In function ‘alx_enable_msix’:
/var/lib/dkms/alx/4.11.4/build/src/main.c:849:8: error: implicit declaration of function ‘pci_enable_msix’; did you mean ‘pci_enable_msi’? [-Werror=implicit-function-declaration]
  err = pci_enable_msix(alx->hw.pdev, alx->msix_entries, num_vec);
        ^~~~~~~~~~~~~~~
        pci_enable_msi
cc1: some warnings being treated as errors

Any help would be appreciated here. I'm assuming it's not as simple as just changing "msix" to "msi". :)
Comment 106 Laz Lev 2017-08-05 09:28:29 UTC
You need to update the kernel sources to 4.12.3 (make sure to reboot so you're on the latest kernel). This is my manual process if the auto-build does not work:

sudo su -
kv=$(uname -r | egrep -o '[0-9]\.[0-9]+(\.[1-9]+)?')
linux_dir="linux-$kv"
alx_driver_path="drivers/net/ethernet/atheros/alx"
dkms_dir="/usr/src/alx-$kv"
git clone --depth 1 -b "v$kv" git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git $linux_dir
mkdir -p $dkms_dir/src
cp $linux_dir/$alx_driver_path/* $dkms_dir/src
patch -d $dkms_dir/src -V never -r - -t -s -N -p5 < alx-dkms-installer/000-enable-alx-wol-4.9.patch
# replace PACKAGE_VERSION value with $kv
vi alx-dkms-installer/dkms.conf
cp alx-dkms-installer/dkms.conf $dkms_dir/
dkms add alx/$kv
dkms build alx/$kv
dkms install alx/$kv
Comment 107 Michał Miarka 2017-08-19 10:12:14 UTC
I've done some tests and it doesn't mater if i use experimental or latest kernel, WOL is still not working

root@haruko:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux testing (buster)
Release:        testing
Codename:       buster

root@haruko:~# uname -a
Linux haruko 4.12.0-1-amd64 #1 SMP Debian 4.12.6-1 (2017-08-12) x86_64 GNU/Linux

root@haruko:~# dkms status
alx, 4.11, 4.11.0-1-amd64, x86_64: installed
alx, 4.12, 4.12.0-1-amd64, x86_64: installed
alx, 4.8, 4.9.0-3-amd64, x86_64: installed
nvidia, 381.22, 4.11.0-1-amd64, x86_64: installed
nvidia, 381.22, 4.12.0-1-amd64, x86_64: installed
nvidia, 381.22, 4.12.0-trunk-amd64, x86_64: installed
nvidia, 381.22, 4.9.0-3-amd64, x86_64: installed

root@haruko:~#  modinfo -n alx
/lib/modules/4.12.0-1-amd64/updates/dkms/alx.ko
root@haruko:~# /lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko
bash: /lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko: Brak dostępu

root@haruko:~# find /lib -name "alx.*"
/lib/modules/4.9.0-3-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/4.9.0-3-amd64/updates/dkms/alx.ko
/lib/modules/4.12.0-1-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/4.12.0-1-amd64/updates/dkms/alx.ko
/lib/modules/4.11.0-1-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/4.11.0-1-amd64/updates/dkms/alx.ko
/lib/modules/4.12.0-trunk-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko

root@haruko:~# ethtool enp3s0
Settings for enp3s0:
        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

root@haruko:~# ethtool -s enp3s0 wol g
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol
Comment 108 Michał Miarka 2017-09-05 06:38:43 UTC
Well, it seems that is magically started to work... I didn't do anything more that clean old dkms modules, even kernel is same. System is not receiving magic packet and WoL works


root@haruko:~# uname -a
Linux haruko 4.12.0-1-amd64 #1 SMP Debian 4.12.6-1 (2017-08-12) x86_64 GNU/Linux

root@haruko:~# dkms status
alx, 4.12, 4.12.0-1-amd64, x86_64: installed
nvidia, 381.22, 4.12.0-1-amd64, x86_64: installed

root@haruko:~# modinfo -n alx
/lib/modules/4.12.0-1-amd64/updates/dkms/alx.ko

root@haruko:~# find /lib -name "alx.*"
/lib/modules/4.12.0-1-amd64/kernel/drivers/net/ethernet/atheros/alx/alx.ko
/lib/modules/4.12.0-1-amd64/updates/dkms/alx.ko

root@haruko:~# ethtool enp3s0
Settings for enp3s0:
        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
        Supports Wake-on: pg
        Wake-on: g
        Current message level: 0x000060e4 (24804)
                               link ifup rx_err tx_err hw wol
        Link detected: yes

root@haruko:~# ethtool -s enp3s0 wol g
root@haruko:~#
Comment 109 Geemo 2017-10-28 00:37:26 UTC
Hi all,

I am new to linux and I am having some hard fun. I tried installing the lastest patch but WOL is not working. This used to work on windows but not in ubuntu.

Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)

Settings for enp4s0:
	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


I have followed every single guide that I have found without any luck. Installed this patch and nothing. I still receive the error:

gero@4790k:~$ sudo ethtool -s enp4s0 wol g
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol

Pls help
Comment 110 pietia12 2017-10-30 20:19:42 UTC
(In reply to Marcin from comment #41)
> This fix works just great, unfortunately WOL is missing after reboot or
> shutdown idk why. I had to everytime remove and load modules, so I've added
> "modprobe -r alx && modprobe alx" to rc.local and mine QCA8171 WOL works now.
> 
> http://pastebin.com/mVstz2fb (with ethtool and modinfo outputs).

First of all, Marcel, thank you a lot for this fix! It really helps me a lot :)

So I'd like to note that the issue above also happens for me and the above answer helps solve this.
Comment 111 Kyle Johnston 2017-11-19 19:58:33 UTC
Thanks to everyone for the help, especially Marcel, Marcin, and pietia12. I was able to get this working on Ubuntu 17.10 and Fedora 27 using kernel 4.13.12. I had some trouble figuring out the steps, so I'm listing them below to help anyone who comes across this page. I'm new to this level of editing Linux, so there may be a better way to do some of this.

**INSTALL PATCH**
Save `alx-dmks-installer.tar.gz` in `/usr/src/`.
```
$ cd /usr/src/
$ sudo tar -xf alx-dmks-installer.tar.gz
$ cd alx-dmks-installer/
$ sudo ./setup
```

Accept any packages it asks you to install. The setup should end with lines that look like this:
```
DKMS: build completed.

alx.ko:
Running module version sanity check.
 - Original module
 - Installation
   - Installing to /lib/modules/4.2.0-27-generic/updates/dkms/

depmod....

DKMS: install completed.
```

If you need to remove patch and try again, run this:
```
$ dkms status # check current status
$ sudo dkms remove -m alx/4.13.12 --all
$ cd /usr/src/
$ sudo rm -rf alx-4.13.12/ alx-dmks-installer alx-4.13.12/
$ dkms status # check new status
```

**RELOAD MODULE**
As Marcin and pietia pointed out, running the setup isn't enough. You must reload the module as well.
```
$ modprobe -r alx
$ modprboe alx
```

**ENABLE WOL**
WOL might work at this point. If not, it might need to be enabled. Find name of ethernet connection. Run `ifconfig`. The name will be something like `enp5s0` or `eth0` and listed as the first word of a line.

Check status of connection. Use your connection's name instead of `enp5s0`.
`$ sudo ethtool enp5s0`

There should be a category titled "Wake-on". If there isn't, the patch is not working.
If "Wake-on" is a category but there is no "g" in the "Wake-on" category, run this:
`$ sudo ethtool -s enp5s0 wol g`

Finally, run this again to check for the "g".
`$ sudo ethtool enp5s0`

**STARTUP**
You will have to run `modprobe -r alx && modprobe alx` to reload the module each time you reboot. Schedule these commands to run during startup. I did this on Fedora by creating a systemd service.

1.Create script to reload module.
`$ sudo vim /etc/fix_alx_wol.sh`
Create the following file:
```
#!/bin/sh

modprobe -r alx
modprobe alx
```

2.Make script executable.
`$ sudo chmod +x /etc/fix_alx_wol.sh`

3.Create service to run script on startup.
`$ sudo vim /etc/systemd/system/fix-alx-wol.service`
Create the following file:
```
[Unit]
Description=Reloads alx module to enable wake-on-LAN.
After=multi-user.target

[Service]
ExecStart=/etc/fix_alx_wol.sh

[Install]
WantedBy=default.target
```

4.Enable and start service.
```
$ sudo systemctl enable fix-alx-wol.service # service to launch script will run on startup
$ sudo systemctl start fix-alx-wol.service # start service to launch script now
```
Comment 112 bjoern.peters 2017-12-03 13:09:19 UTC
Hi, I would like to install this patch but I got this error msg:

[root@BackupServer alx-dmks-installer]# ./setup 
Checking dependencies...
Done
Downloading kernel source for 3.10 by git...
Klone nach 'linux-3.10'...
remote: Counting objects: 45457, done.
remote: Compressing objects: 100% (44067/44067), done.
Empfange Objekte: 100% (45457/45457), 122.44 MiB | 3.99 MiB/s, done.
remote: Total 45457 (delta 3456), reused 10420 (delta 845)
Löse Unterschiede auf: 100% (3456/3456), done.
Note: checking out '8bb495e3f02401ee6f76d1b1d77f3ac9f079e376'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

Checking out files: 100% (43018/43018), done.
Done
Preparing dkms module source...
1 out of 2 hunks FAILED
Reversed (or previously applied) patch detected!  Skipping patch.
4 out of 4 hunks ignored
2 out of 3 hunks FAILED
5 out of 8 hunks FAILED


Here some information of my system:

[root@BackupServer alx-dmks-installer]# uname -a
Linux BackupServer 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux


[root@BackupServer alx-dmks-installer]# yum update
Geladene Plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.daniel-jost.net
 * epel: vesta.informatik.rwth-aachen.de
 * extras: mirror.fra10.de.leaseweb.net
 * updates: mirror.fra10.de.leaseweb.net
No packages marked for update

It's a cantos 7.4
Comment 113 RockT 2017-12-25 20:18:17 UTC
(In reply to Geemo from comment #109)

> Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
> 
> gero@4790k:~$ sudo ethtool -s enp4s0 wol g
> Cannot get current wake-on-lan settings: Operation not supported
>   not setting wol

Exactly the same here, Ubuntu 17.10 with kernel 4.13:

04:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 10)

rtraut@jones:~$ uname -a
Linux jones 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
rtraut@jones:~$ sudo ethtool -s enp4s0 wol g
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol

Please fix this...
Comment 114 Marcel Sackermann 2017-12-27 08:54:24 UTC
(In reply to bjoern.peters from comment #112)
> Hi, I would like to install this patch but I got this error msg:
> 
> [root@BackupServer alx-dmks-installer]# ./setup 
> Checking dependencies...
> Done
> Downloading kernel source for 3.10 by git...
> Klone nach 'linux-3.10'...
> remote: Counting objects: 45457, done.
> remote: Compressing objects: 100% (44067/44067), done.
> Empfange Objekte: 100% (45457/45457), 122.44 MiB | 3.99 MiB/s, done.
> remote: Total 45457 (delta 3456), reused 10420 (delta 845)
> Löse Unterschiede auf: 100% (3456/3456), done.
> Note: checking out '8bb495e3f02401ee6f76d1b1d77f3ac9f079e376'.
> 
> You are in 'detached HEAD' state. You can look around, make experimental
> changes and commit them, and you can discard any commits you make in this
> state without impacting any branches by performing another checkout.
> 
> If you want to create a new branch to retain commits you create, you may
> do so (now or later) by using -b with the checkout command again. Example:
> 
>   git checkout -b new_branch_name
> 
> Checking out files: 100% (43018/43018), done.
> Done
> Preparing dkms module source...
> 1 out of 2 hunks FAILED
> Reversed (or previously applied) patch detected!  Skipping patch.
> 4 out of 4 hunks ignored
> 2 out of 3 hunks FAILED
> 5 out of 8 hunks FAILED
> 
> 
> Here some information of my system:
> 
> [root@BackupServer alx-dmks-installer]# uname -a
> Linux BackupServer 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC
> 2017 x86_64 x86_64 x86_64 GNU/Linux
> 
> 
> [root@BackupServer alx-dmks-installer]# yum update
> Geladene Plugins: fastestmirror
> Loading mirror speeds from cached hostfile
>  * base: mirror.daniel-jost.net
>  * epel: vesta.informatik.rwth-aachen.de
>  * extras: mirror.fra10.de.leaseweb.net
>  * updates: mirror.fra10.de.leaseweb.net
> No packages marked for update
> 
> It's a cantos 7.4

You should not need the patch for a 3.10 Kernel, WOL was removed later on. However, centos 7.4 might have removed WOL on their own (did not check).

You could try using the 3.10 vanilla alx module: just comment or remove line 66 in the setup script where it says "sudo patch [...]". Then you'll get a vanilla alx driver as a dkms module.
Comment 115 Marcel Sackermann 2017-12-27 09:06:52 UTC
(In reply to RockT from comment #113)
> (In reply to Geemo from comment #109)
> 
> > Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
> > 
> > gero@4790k:~$ sudo ethtool -s enp4s0 wol g
> > Cannot get current wake-on-lan settings: Operation not supported
> >   not setting wol
> 
> Exactly the same here, Ubuntu 17.10 with kernel 4.13:
> 
> 04:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet
> Controller (rev 10)
> 
> rtraut@jones:~$ uname -a
> Linux jones 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017
> x86_64 x86_64 x86_64 GNU/Linux
> rtraut@jones:~$ sudo ethtool -s enp4s0 wol g
> Cannot get current wake-on-lan settings: Operation not supported
>   not setting wol
> 
> Please fix this...

If `$ modinfo -n alx` points you to your dkms directory, you may be out of luck. If not, the module was not installed correctly. 

What board do you use? (If it's an onboard NIC)
Maybe someone with the same board can provide their experience with WOL.
Comment 116 RockT 2017-12-27 10:04:18 UTC
(In reply to Marcel Sackermann from comment #115)

> > Exactly the same here, Ubuntu 17.10 with kernel 4.13:
> > 
> > 04:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet
> > Controller (rev 10)
> > 
> > rtraut@jones:~$ uname -a
> > Linux jones 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017
> > x86_64 x86_64 x86_64 GNU/Linux
> > rtraut@jones:~$ sudo ethtool -s enp4s0 wol g
> > Cannot get current wake-on-lan settings: Operation not supported
> >   not setting wol
> > 
> > Please fix this...
> 
> If `$ modinfo -n alx` points you to your dkms directory, you may be out of
> luck. If not, the module was not installed correctly. 
> 
> What board do you use? (If it's an onboard NIC)
> Maybe someone with the same board can provide their experience with WOL.

Hi Marcel, thx for your reply.
No, I don't use dkms and will not fiddle with it.

It's the stock ubuntu kernel module which does not work with the onboard nic on a Gigabyte G1.Sniper M5 mainboard.
The sad thing is my former board with a sky2 module did not work either.

Fwiw I plugged a broadcom card in (tg3 module), this works with magic packet.

It seems server grade hardware gets much more attention than sky2 and alx module nics. :(
Comment 117 AceLan Kao 2018-01-02 05:46:43 UTC
Hi Marcel,

Are you planing to upstream your wol patch?
Since there are so many successful stories, I think it would be fine to upstream it with an enable or disable wol parameter.
Comment 118 Marcel Sackermann 2018-01-02 08:38:21 UTC
(In reply to AceLan Kao from comment #117)
> Hi Marcel,
> 
> Are you planing to upstream your wol patch?
> Since there are so many successful stories, I think it would be fine to
> upstream it with an enable or disable wol parameter.

Please don't misunderstand, it's not MY patch. I didn't do anything. 
All that magic is just reapplying the patch that removed WOL in the first place.

> Working around the "wake up twice" bug is preferable to not having
> Wake-on-LAN at all.

This a perfectly valid reason to disable WOL, even if just a small subset of devices may be affected. I do not own an affected NIC and am unable to verify whether the issue persists. 

I'm not sure about the module parameter, since it's not an experimental feature nor should it be globally enabled or disabled. It may be unlikely, but imagine a machine with two NICs driven by the alx-module. One is affected of the root cause and the other isn't.

Although you could whitelist pci-ids of known-to-work NICs (or inversely blacklist), I'm not a kernel dev either an would need to check whether this complies with the guidelines (I could think of some reasons why both choices wouldn't be as nice as it sounds).  

I will do some research and feed back the outcome to this issue.

Note You need to log in before you can comment on or make changes to this bug.