Bug 61651

Summary: [regression] Wake-on-LAN broken in alx (AR8161)
Product: Drivers Reporter: bugtracker.apriori
Component: NetworkAssignee: drivers_network (drivers_network)
Status: NEW ---    
Severity: normal CC: A.Fiergolski+kernelBugzilla, acelan, adam.danischewski, antonmeskildsen, bjoern.peters, bostwickbrian, bugtracker.apriori, cdbrendel, cj.wijtmans, dex, dragonn, edward, fiper, francois.courmont, frederic.coiffier, friz64mc, gdm85, guillaume.jab, gustaf.waldemarson, hamrio, haojunyu2012, horvath.zoltan.mobil, johnstonkylew, josla972, jumax9.gently, kernel, lasdka88+kbug928, lazlev, lukaszgosk1995, marcel, masterbroetchen, mblatt, mmesn, mrblooter, myrbourfake, mysterygoat, m_akristiniy, no.0ne.750, noamgit, nolt, pav, penickj, pietia12, pillo787, pqrrj, r.fabbeni, redmcg, ronny.langrock, sebastianpagano, shuyoko, steventheevil, szg00000, tr.ml, ultimateartificer, urbinek, vegorin, verhille.clement, vlcko.p, wninachoquehuayta, YakimenkoEV, zhfreal
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.10 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Enable ALX WoL for 3.17
src files for alx-dkms, kernel version 4.2.0
automatic dkms module installer for patched alx
20160407 [patched] automatic dkms module installer for patched alx
Enable ALX WoL for/since 4.9
20170228 [patched] automatic dkms module installer for patched alx
20170306 [patched] automatic dkms module installer for patched alx
alx WoL ~4.18+
20181017 [patched] automatic dkms module installer for patched alx (supports 4.18)
[patched] automatic dkms module installer for patched alx (supports 5.x)
Enable ALX WoL 5.4.1
alx WoL for 5.14
RHEL/CentOS 8 (Kernel 4.18) Fix
Enable WoL for alx driver, kernel 5.10
Enable WoL for alx driver, kernel 5.10.84
Enable WoL for alx driver, kernel 5.16.5
WOL Patch for 5.13.19-6-pve

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.
Comment 119 bostwickbrian 2018-03-09 19:22:13 UTC
Used the provided DKMS patch and it is not working for me on Arch Linux 4.15.7.

./setup 
Checking dependencies...
Done
Preparing dkms module source...
Using 4.9+ patch...
Done
Adding dkms module

Creating symlink /var/lib/dkms/alx/4.15.7/source ->
                 /usr/src/alx-4.15.7

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...(bad exit status: 2)
make -j8 KERNELRELEASE=4.15.7-1-ARCH -C /usr/lib/modules/4.15.7-1-ARCH/build M=/var/lib/dkms/alx/4.15.7/build/src modules...
cleaning build area...(bad exit status: 2)
Kernel cleanup unnecessary for this kernel.  Skipping...

DKMS: build completed.

alx.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /usr/lib/modules/4.15.7-1-ARCH/kernel/drivers/net/ethernet/atheros/alx//

depmod....

DKMS: install completed.
Comment 120 Kyle Johnston 2018-03-10 16:06:45 UTC
(In reply to bostwickbrian from comment #119)

Did you try reloading the module after installing?
```
$ modprobe -r alx
$ modprobe alx
```
Comment 121 Marcus 2018-03-13 11:22:38 UTC
For me (using the automated installer) the patch appears to install fine but is not working. Ethtool is still unable to access WOL settings. I tried to manually remove and re-add the module as per comment 120, but adding it back failed because I have UEFI secure boot enabled:

- Ubuntu 17.10
- Kernel 4.13.0-36-generic
- Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller (rev 10)
- BIOS: Deep sleep disabled, Wake-on-lan enabled.

> modinfo -n alx
/lib/modules/4.13.0-36-generic/updates/dkms/alx.ko

> sudo ethtool enp4s0
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: 100Mb/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

(Note: Running with without sudo gives the additional message "Cannot get wake-on-lan settings: Operation not permitted", so it is trying at least.)

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

> sudo modprobe -r alx
> sudo modprobe alx
modprobe: ERROR: could not insert 'alx': Required key not available
Comment 122 Laz Lev 2018-03-13 12:53:45 UTC
In my system the kernel switched to compressed kernel modules, so currently I have to manually run something like this after every kernel update:
sudo xz -f /usr/lib/modules/4.15.8-1-ARCH/kernel/drivers/net/ethernet/atheros/alx/alx.ko

With the next dkms version compressed modules seem be supported:
https://github.com/dell/dkms/pull/39
Comment 123 Marcus 2018-03-15 09:01:20 UTC
*Update* The patch is working for me after all. I had to disable UEFI secure boot for it to work though. It would be great if this patch could be (re-)applied to the mainline kernel so that I didn't need to disable secure boot and apply such a patch. Thanks.
Comment 124 Michał Miarka 2018-03-15 09:05:03 UTC
I agree, so far i didn't see any report that shows this patch having negative impact on system so far.
Comment 125 Anton Mølbjerg Eskildsen 2018-03-24 01:58:28 UTC
Just want to add an easier option for Arch users: use the following package on AUR (https://aur.archlinux.org/packages/alx-wol-dkms/) - works for me on kernel version 4.15.11-1.

Also, I couldn't build the package myself using the automatic installer, getting the same error as in comment #31 (got the same error message)
Comment 126 Guillaume de Jabrun 2018-05-27 15:12:54 UTC
I am using this patch for a long time. I was experiencing the "wake up twice" bug, but with recent kernel version, I don't have this issue anymore.
I can't tell which version actually fix the bug (I don't remember..).
Comment 127 AceLan Kao 2018-05-31 02:19:22 UTC
Guillaume,
great to hear that.
I'm working on reverting back the alx wol feature to upstream,
could you describe more about your hardware(NIC name and ID) and on which kernel version you found the issue is gone?
I also need to grant the permission from you to put your name in tested-by: field, is it okay?
Thanks.
Comment 128 Daniel Exner 2018-05-31 13:58:14 UTC
We have that patch in distro kernel for Frugalware since 4.8.1 and I never had the "wake up twice" bug.

06:00.0 Ethernet controller: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller (rev 10)
        Subsystem: ASRock Incorporation Killer E2400 Gigabit Ethernet Controller

06:00.0 0200: 1969:e0a1 (rev 10)
        Subsystem: 1849:e0a1

If you want you may add my name to "tested-by".
Comment 129 Michał Miarka 2018-05-31 14:08:55 UTC
Same here, I am using this patch since 4.9.0-3 (Debian) and "wake up twice" bug never occoured. 

# lspci -k
03:00.0 Ethernet controller: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller (rev 10)
        Subsystem: Micro-Star International Co., Ltd. [MSI] Killer E2400 Gigabit Ethernet Controller
        Flags: bus master, fast devsel, latency 0, IRQ 18
        Memory at df300000 (64-bit, non-prefetchable) [size=256K]
        I/O ports at d000 [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-05-90-13-4c-cc-6a-ff
        Kernel driver in use: alx
        Kernel modules: alx

# dmesg | grep 03:00
[    0.078146] pci 0000:03:00.0: [1969:e0a1] type 00 class 0x020000
[    0.078173] pci 0000:03:00.0: reg 0x10: [mem 0xdf300000-0xdf33ffff 64bit]
[    0.078182] pci 0000:03:00.0: reg 0x18: [io  0xd000-0xd07f]
[    0.078277] pci 0000:03:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.775328] alx 0000:03:00.0 eth0: Qualcomm Atheros AR816x/AR817x Ethernet [4c:cc:6a:05:90:13]
[    0.906154] alx 0000:03:00.0 enp3s0: renamed from eth0
[    7.900102] alx 0000:03:00.0 enp3s0: NIC Up: 1 Gbps Full
[    7.935617] alx 0000:03:00.0 enp3s0: NIC Up: 1 Gbps Full

If you want you may add my name to "tested-by
Comment 130 AceLan Kao 2018-06-01 02:57:19 UTC
Thanks for all your kindness reports, but the maintainer would like to see if the wake up issue would no longer be reproducible by the new kernel.

I can't reproduce the wake up issue at my side, either, but this can't convince the maintainer. He would like to fix the wake up issue before we can revert back the wol feature. So, we need some reports from the witnesses who had encountered the issue and no longer suffers from it now. Then we can convince the maintain that this issue is gone and can revert back the wol feature.
Comment 131 AceLan Kao 2018-07-09 02:19:02 UTC
Guillaume,
Do you have a chance to give me those info about your machine? The maintainer would like to see the issue has been fixed by newer kernel, so please provide the NIC PCI ID you have, and on which kernel(doesn't necessary to a specific version) you found the issue is gone.
Thanks.
Comment 132 JumaX9 2018-07-27 17:26:17 UTC
Same here, I have been using this patch for a while now and never encountered the wake up twice bug. I never witnessed the original issue though,

I'm using 4.17.8 (with the patch)

~$ lspci -nvv

03:00.0 0200: 1969:e0a1 (rev 10)
	Subsystem: 1462:7976
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx+
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 18
	Region 0: Memory at de100000 (64-bit, non-prefetchable) [size=256K]
	Region 2: I/O ports at d000 [size=128]


Let me know if you need any more information.
Comment 133 JumaX9 2018-08-21 08:33:32 UTC
Just updated to 4.18.3 and the patch is not working anymore...
Comment 134 phonics 2018-10-09 19:39:22 UTC
Created attachment 278971 [details]
alx WoL ~4.18+

this patch is working for me on 4.18. the code changed ever so slightly in alx_resume
Comment 135 Markus Blatt 2018-10-17 14:58:05 UTC
Created attachment 279075 [details]
20181017 [patched] automatic dkms module installer for patched alx (supports 4.18)

This an extension of the work by marcel sackermann inluding the patch upladed by phonics. Tested on Debian Buster (testing)
Comment 136 Ronny Langrock 2018-10-24 13:13:53 UTC
I can confirm, that the patch is working fine, without the wake up twice bug, on fedora 28 with the following kernel versions with onboard Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 10) on Gigabyte Z170X-Gaming 3 EU (rev 1.0):

4.18.14-250.vanilla.knurd.1.fc28 @kernel-vanilla-stable
4.18.15-250.vanilla.knurd.1.fc28 @kernel-vanilla-stable
4.18.16-250.vanilla.knurd.1.fc28 @kernel-vanilla-stable
4.19.0-1.vanilla.knurd.1.fc28    @kernel-vanilla-stable

The module installer from markus blatt works fine so far, but I have to run "modprobe -r alx && modprobe alx" after every powercycle.
Comment 137 Daniel Exner 2018-11-09 09:30:46 UTC
Patch still applies for 4.20-rc1 but fails to wakeup the PC.
Comment 138 phonics 2019-04-15 18:27:59 UTC
update: same patch for 4.18 is still working fine 6mo later on 5.0
Comment 139 DocMAX 2019-05-05 07:12:54 UTC
No, 5.0.9 isn't working...

Checking dependencies...
Done
Preparing dkms module source...
2 out of 8 hunks FAILED
Comment 140 DocMAX 2019-05-05 07:16:49 UTC
Let's bring back WOL in the official kernel! Where are the kernel developers?
Comment 141 Kyle Johnston 2019-07-15 00:02:12 UTC
I have the same issue as DocMAX: "2 out of 8 hunks FAILED". My kernel version is 5.1.16. Has anyone had success on 5.0.9 or later?
Comment 142 pillo787 2019-09-07 11:08:30 UTC
Created attachment 284877 [details]
[patched] automatic dkms module installer for patched alx (supports 5.x)

I updated the previous script adding an or to the sh for supporting kernel 5 version. I got working wol with 5.2.11 acs patch and the script that i have uploaded
Comment 143 Kyle Johnston 2019-09-14 01:01:15 UTC
Thanks pillo787! Works for me too. I had to delete all of `/var/lib/dkms/alx/` first, otherwise running `dkms status` or the above patch would return:

```
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/alx/4.13.12/source/dkms.conf does not exist.
```

Once I deleted `/var/lib/dkms/alx/`, running `dkms status` worked as expected and the patch installed correctly. WOL works again!
Comment 144 Adam Danischewski 2019-10-30 22:28:05 UTC
pillo787's patch in Comment #142 worked for me using kernel 5.0.0-29-generic. One note I found that I had a script /usr/lib/pm-utils/sleep.d/50unload_alx that unloads the alx driver when going to sleep. After removing it, the magic broadcast packets worked fine. 

Unfortunately I had a problem with an X driver in searching for the latest driver got DRM tip kernel 5.4.0-994-lowlatency. No match yet with the existing git repo.
Comment 145 puhnast 2019-11-13 20:22:51 UTC
Does anyone have a patch that could apply to the master branch tip (RC of linux-5.4.0)? Thanks.
Comment 146 masterbroetchen 2019-11-14 12:47:44 UTC
I applied pillo787's patch and dkms said its working on kernel 5.3.10, but when I want to enable wol with ethtool, there is still not the entry "supports wol" and when trying to activate it, there is still the error, that its not supported.

Does anyone have an idea?
Comment 147 Edward P 2019-12-03 09:26:05 UTC
Created attachment 286157 [details]
Enable ALX WoL 5.4.1
Comment 148 Adam Danischewski 2019-12-03 14:46:06 UTC
Works for me on 5.3.0-19-lowlatency (Comment #147). (Not sure if the attachment has the entire previous patch, I just hacked in the patch script in my previous "setup".)
Comment 149 Christ Jan Wijtmans 2019-12-11 22:52:15 UTC
UNSUBSCRIBE
Comment 150 Maxim 2020-04-07 11:52:55 UTC
I suggest move patch for dirty enable WOL to git ?
https://github.com/AMV007/alx_dkms_installer

p.s. at my laptop (killer 2500) I can enable WOL, but after suspend laptop no waking up with it.
ubutnu 18, 5.3.0-45-generic.
Comment 151 Maxim 2020-04-07 15:29:26 UTC
(In reply to Maxim from comment #150)
> I suggest move patch for dirty enable WOL to git ?
> https://github.com/AMV007/alx_dkms_installer
> 
> p.s. at my laptop (killer 2500) I can enable WOL, but after suspend laptop
> no waking up with it.
> ubutnu 18, 5.3.0-45-generic.

update - WOL working with, was need to set WOL_DISABLE=N in /etc/default/tlp
Comment 152 Maxim 2020-04-15 08:15:55 UTC
update:
 - removed custom dkms alx from system.
 - removed WOL from tlp WOL_DISABLE=Y in /etc/default/tlp
 - update-initramfs -u
ubuntu 18, 5.3.0-45-generic, (killer 2500)

and WOL magic packet still working.

sudo ethtool enp61s0
*
 Supports Wake-on: d
 Wake-on: d
Comment 153 Eugene 2021-01-17 13:24:26 UTC
(In reply to Maxim from comment #150)
> I suggest move patch for dirty enable WOL to git ?
> https://github.com/AMV007/alx_dkms_installer
> 
> p.s. at my laptop (killer 2500) I can enable WOL, but after suspend laptop
> no waking up with it.
> ubutnu 18, 5.3.0-45-generic.

I have same issue, without path laptop wakes up from every network activity, not only magic package. After patch applied, first sleep after power on works fine, other second wake up sticks with black screen.
Tried workaround 
https://bugzilla.kernel.org/show_bug.cgi?id=61651#c136
it helps, but not always any way.
I have Killer E2400, MSI laptop, kubuntu 20.04 kernel 5.4.0.62
Appreciate any help.
Comment 154 Laz Lev 2021-01-22 22:56:29 UTC
Did someone get this to work with kernel 5.10? It builds without errors with patch 5.4.x and also correctly reports the wake-on-lan functionality:

# ethtool enp3s0 | grep Wake-on
        Supports Wake-on: pg
        Wake-on: pg

But sending WOL packets does not wake the server anymore. This used to work fine for me until kernel 5.0.

There are also reports here that it already stopped working with kernels 5.6/5.7:
https://github.com/AMV007/alx_dkms_installer/issues/1

I failed to test it on older kernels like 5.5/5.6/5.7 due to some gcc mismatch error when trying to build the module:
cc1: error: incompatible gcc/plugin versions
Comment 155 Laz Lev 2021-01-24 23:42:00 UTC
Got it working now. The problem was that the patch provided in the Git repository (https://github.com/AMV007/alx_dkms_installer) does not work correctly.

After trying it with the one from comment #147 (https://bugzilla.kernel.org/show_bug.cgi?id=61651#c147) everything works again as expected with latest kernel 5.10.
Comment 156 Arne 2021-09-17 09:14:15 UTC
The patch isn't working for me on kernel 5.11.22. I get the following output: "1 out of 6 hunks FAILED"
Comment 157 phonics 2021-09-22 22:01:52 UTC
Created attachment 298925 [details]
alx WoL for 5.14

(In reply to Arne from comment #156)
> The patch isn't working for me on kernel 5.11.22. I get the following
> output: "1 out of 6 hunks FAILED"
I believe this is due to the commit "alx: use fine-grained locking instead of RTNL", which adds mutex locking in favor of using the RTNL.
Here's the patch I'm using currently on 5.14. aside from a RTNL assert warning on wake, it works.
Comment 158 redmcg 2021-10-16 03:27:27 UTC
I didn't see this mentioned, so I wanted to point out that the Ubuntu kernel has the WoL feature enabled behind a module parameter (off by default). You can run the following to see the value:
cat /sys/module/alx/parameters/enable_wol

'N' = off, 'Y' = on

To turn it on, you just need to add:
options alx enable_wol=Y

to modeprobe. For example, by running:
sudo bash -c 'echo options alx enable_wol=Y > /etc/modprobe.d/alx.conf'

You can then test this by running:
sudo bash -c 'modprobe -r alx && modprobe alx' && \
cat /sys/module/alx/parameters/enable_wol

Finally, to ensure the modprobe config change is present during startup, update your initramfs with:
sudo update-initramfs -u
Comment 159 mohammadalisadraei 2021-11-25 03:33:11 UTC
Created attachment 299707 [details]
RHEL/CentOS 8 (Kernel 4.18) Fix

I created a RHEL/CentOS 8 specific script to fix this problem.

The git repo is: https://github.com/mohalisad/CentOS-RHEL-8-alx-driver
Comment 160 Daniel 2021-12-13 00:51:38 UTC
Created attachment 300003 [details]
Enable WoL for alx driver, kernel 5.10

This is the updated patch that applies cleanly on kernel 5.10.70 (the current stable one for Debian).

On my configuration it works from suspend, hibernate and shutdown (although not when shutting down using the power button) and no broadcast is needed.

The RTNL assert failure is there, haven't tried solving it.
Comment 161 Fabian Ritzmann 2021-12-25 17:02:15 UTC
Created attachment 300149 [details]
Enable WoL for alx driver, kernel 5.10.84

Daniel's patch was an excellent starting point but unfortunately hunk #4 for main.c fails with kernel 5.10.84 in the latest Debian 11 point release. Here is a patch that applies cleanly.
Comment 162 ultimateartificer 2022-02-05 07:08:26 UTC
Created attachment 300398 [details]
Enable WoL for alx driver, kernel 5.16.5

Updated Fabian's patch to apply cleanly on 5.16.5.
Comment 163 PeterV 2022-04-19 19:01:46 UTC
Created attachment 300778 [details]
WOL Patch for 5.13.19-6-pve

Due the running of Proxmox Ve i did some changes, as none of the patches was working for me, also its proxmox-headers needed to be installed then its working as expected.
Comment 164 Michał Miarka 2022-04-19 20:05:25 UTC
I wonder when this regression will be fixed, i dont even own motherboard with AR8161 chip anymore as it quite obsolete
Comment 165 mrblooter 2022-06-20 19:22:53 UTC
I have managed to apply Fabian Ritzmann's patch from comment #161 on my Debian 11 install with kernel "Linux debian 5.10.0-15-amd64" using the script from comment #142.

However, I cannot get the computer to power on. I have tested the same computer on Windows and wake-on-lan works, so I can rule out faulty hardware.
Could it be that the patch, despite showing that wake-on-lan (on magic packet) is on, isn't actually working?

I am trying to get this to work on an Acer Aspire E1-522 laptop. Is there anything else I could try?

$ lspci
01:00.0 Ethernet controller: Qualcomm Atheros QCA8171 Gigabit Ethernet (rev 13)

$ modinfo -n alx
/lib/modules/5.10.0-15-amd64/updates/dkms/alx.ko

$ sudo ethtool enp1s0f0
Settings for enp1s0f0:
	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
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: internal
	MDI-X: Unknown
	Supports Wake-on: pg
	Wake-on: pg
        Current message level: 0x000060e4 (24804)
                               link ifup rx_err tx_err hw wol
	Link detected: yes
Comment 166 Eugene 2022-07-24 09:40:28 UTC
Hi everyone

I don't remember when, but in some moment after update to kernal 5.10 (ubuntu 21.10) wakeOnLan started working. In June i upgraded to 22.04, and it stoped working again! new kernal is 5.15

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
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: Twisted Pair
        PHYAD: 0

does someone know how to fix it?
        Transceiver: internal
        MDI-X: Unknown
        Current message level: 0x000060e4 (24804)
                               link ifup rx_err tx_err hw wol
        Link detected: yes
Comment 167 piaoyi 2022-10-16 18:32:35 UTC
(In reply to Eugene from comment #166)
> Hi everyone
> 
> I don't remember when, but in some moment after update to kernal 5.10
> (ubuntu 21.10) wakeOnLan started working. In June i upgraded to 22.04, and
> it stoped working again! new kernal is 5.15
> 
> 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
>         Supported FEC modes: Not reported
>         Advertised link modes:  10baseT/Half 10baseT/Full
>                                 100baseT/Half 100baseT/Full
>                                 1000baseT/Full
>         Advertised pause frame use: Symmetric
>         Advertised auto-negotiation: Yes
>         Advertised FEC modes: Not reported
>         Speed: 1000Mb/s
>         Duplex: Full
>         Auto-negotiation: on
>         Port: Twisted Pair
>         PHYAD: 0
> 
> does someone know how to fix it?
>         Transceiver: internal
>         MDI-X: Unknown
>         Current message level: 0x000060e4 (24804)
>                                link ifup rx_err tx_err hw wol
>         Link detected: yes

me too
Comment 168 piaoyi 2022-10-17 15:48:25 UTC
(In reply to Eugene from comment #166)
> Hi everyone
> 
> I don't remember when, but in some moment after update to kernal 5.10
> (ubuntu 21.10) wakeOnLan started working. In June i upgraded to 22.04, and
> it stoped working again! new kernal is 5.15
> 
> 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
>         Supported FEC modes: Not reported
>         Advertised link modes:  10baseT/Half 10baseT/Full
>                                 100baseT/Half 100baseT/Full
>                                 1000baseT/Full
>         Advertised pause frame use: Symmetric
>         Advertised auto-negotiation: Yes
>         Advertised FEC modes: Not reported
>         Speed: 1000Mb/s
>         Duplex: Full
>         Auto-negotiation: on
>         Port: Twisted Pair
>         PHYAD: 0
> 
> does someone know how to fix it?
>         Transceiver: internal
>         MDI-X: Unknown
>         Current message level: 0x000060e4 (24804)
>                                link ifup rx_err tx_err hw wol
>         Link detected: yes

I have solved it. the reason is new kernel(5.15).
you can do like this:
1. upgrade kernel 5.16.3
2. download git repo: https://github.com/AMV007/alx_dkms_installer.git
3. sudo ./setup
Comment 169 Eugene 2022-10-23 11:39:33 UTC
(In reply to piaoyi from comment #168)
> (In reply to Eugene from comment #166)
> > Hi everyone
> > 
> > I don't remember when, but in some moment after update to kernal 5.10
> > (ubuntu 21.10) wakeOnLan started working. In June i upgraded to 22.04, and
> > it stoped working again! new kernal is 5.15
> > 
> > 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
> >         Supported FEC modes: Not reported
> >         Advertised link modes:  10baseT/Half 10baseT/Full
> >                                 100baseT/Half 100baseT/Full
> >                                 1000baseT/Full
> >         Advertised pause frame use: Symmetric
> >         Advertised auto-negotiation: Yes
> >         Advertised FEC modes: Not reported
> >         Speed: 1000Mb/s
> >         Duplex: Full
> >         Auto-negotiation: on
> >         Port: Twisted Pair
> >         PHYAD: 0
> > 
> > does someone know how to fix it?
> >         Transceiver: internal
> >         MDI-X: Unknown
> >         Current message level: 0x000060e4 (24804)
> >                                link ifup rx_err tx_err hw wol
> >         Link detected: yes
> 
> I have solved it. the reason is new kernel(5.15).
> you can do like this:
> 1. upgrade kernel 5.16.3
> 2. download git repo: https://github.com/AMV007/alx_dkms_installer.git
> 3. sudo ./setup

thanks, could you advice how to revert that changes if something went wrong?
Comment 170 piaoyi 2022-10-31 16:04:37 UTC
 I have same concern before i try script in https://github.com/AMV007/alx_dkms_installer.git, but serveal person in this post solved this problem by this reposity。so i do this and make it。In order to help someone like this, i make a request(https://github.com/AMV007/alx_dkms_installer/pull/5) to merge。
Comment 171 verhille.clement 2022-12-05 14:36:17 UTC
(In reply to PeterV from comment #163)
> Created attachment 300778 [details]
> WOL Patch for 5.13.19-6-pve
> 
> Due the running of Proxmox Ve i did some changes, as none of the patches was
> working for me, also its proxmox-headers needed to be installed then its
> working as expected.

I install proxmox-headers, and use the 5.16 patch, its works but when my proxmox is shutdown it doesn't wake .

When i try to send magic packet i see them on my proxmox with tcpdump.

My proxmox kernel version is 5.15.74-1-pve.

is there a patch for this ?
Comment 172 tomrey 2023-01-31 18:36:34 UTC
git repo: https://github.com/AMV007/alx_dkms_installer.git

worked for me in bullseye with 5.10.0-21

did not work for bookworm with 5.19.0-1 or 6.10-2

howto apply a patch without the ./setup?

is there a solution for bookworm yet?
Thnx for your precious work!
Comment 173 renato 2023-04-10 07:07:18 UTC
New ubuntu kernel 6.2 and no wol yet

https://www.linuxquestions.org/questions/slackware-14/alx-wol-working-in-6-1-x-4175722247/
https://github.com/torvalds/linux/tree/master/drivers/net/ethernet/atheros
https://www.linuxquestions.org/questions/slackware-14/alx-wol-working-in-6-1-x-4175722247/

after doing some google search i have found these patches, maybe someone can help out to get the drives compiled and working ?
Comment 174 cptX 2023-06-26 18:44:57 UTC
Hi to all!

I recently upgraded my pc to linux mint 21.1 (ubuntu 22.04) with kernel 5.15.0.75 and I realized that wol functionality is not working.
I have a Killer E2400 Gigabit Ethernet Controller with Qualcomm Atheros AR816x/AR817x chipset.
I need the wol functionality asap! It's very important to my work!

I don't understand why they dropped support in the new kernels. It doesn't make sense even if there were some bugs (as I read - I never had any issue). Not having the functionality at all is much worse than having a waking event twice for example... I really am frustrated.
What can we do? Where should we report the issue to have this functionality back in core?
What can I do to enable this functionality to my kernel? I saw some patches but I have no clue to do with them. Also, if I apply the patches what will happen every time a new kernel comes out and the system makes an autoupdate?
Comment 175 cptX 2023-06-26 18:59:18 UTC
Just to add some extra info, before upgrading it was correctly working with linux mint 20.3 (ubuntu 20.04).
I don't understand why this thread dates back to 2013 if it was working in 20.04.
I downloaded a tar.gz file with a script and some patches. I have no clue how can i modify it in order to apply the patches found here https://github.com/AMV007/alx_dkms_installer

Any help will be much appreciated!
Comment 176 cptX 2023-06-26 19:03:48 UTC
So I ran the setup script and I got this:

Checking dependencies...
Done
Downloading kernel source for 5.15.0 by git...
Cloning into 'linux-5.15.0'...
warning: Could not find remote branch v5.15.0 to clone.
fatal: Remote branch v5.15.0 not found in upstream origin
git failed to download the source. Check the output for information.



What can I do now??
Comment 177 cptX 2023-07-03 15:43:08 UTC
As this bug here is opened since 2013, I decided to open a new one as I see that many people still have the same problem with me.
https://bugzilla.kernel.org/show_bug.cgi?id=217629
Comment 178 renato 2023-07-03 22:04:11 UTC
https://github.com/AndiWeiss/alx-wol
Check this .. there is even an update to kernel 6.4 and the patch works fine
Comment 179 cptX 2023-07-05 08:31:44 UTC
Hi, I have linux mint 21 (ubuntu 22.04) with kernel 5.15 and is not working.
Before upgrade I had linux mint 20.3 (ubuntu 20.04) but I don't remember the kernel.
I would like to fix my system with the existing kernel versions that are long term supported.

@renato your suggestion can be applied to kernel 5.x?
I see in the link, that he tested it with 5.19 but I don't know how to use the patch?
Should I select from my kernels the 5.19 and then use the patch? What if I want to have a long term supported kernel?
Comment 180 renato 2023-07-05 10:58:35 UTC
You could try kernel 6.4 from mainline.. that one will work
Comment 181 cptX 2023-07-05 11:21:08 UTC
@renato but I'm afraid kernel 6.4 in ubuntu 22.04 will have other issues as it is not officially supported by ubuntu.
Comment 182 renato 2023-07-05 22:18:35 UTC
@cptX 

solution 1
https://ubuntuhandbook.org/index.php/2023/06/install-linux-kernel-6-4-ubuntu/
https://github.com/AndiWeiss/alx-wol/files/11910657/alx-wol-master.6.4.zip
cd into alx-wol
execute as root ./install_alx-wol.sh
i dont see any other way (at the moment) to fix this.. i have 6.4
--------------------------------------------------------------------
solution 2
You could try cloning that https://github.com/AndiWeiss/alx-wol or download zip file and test it on your kernel as i see that 5.19 seems to be supported but not tested.

ifneq "$(filter 5.1%,$(kernelver))" ""
obj-m += alx_5.19/
endif
--------------------------------------------------------------------

i know it's not official solutions, but if you solve a problem who cares about official at this point the most important is make it work properly!
Comment 183 renato 2024-01-31 07:50:11 UTC
https://github.com/AndiWeiss/alx-wol

up to kernel 6.7 works !
Comment 184 Eugene 2024-01-31 18:46:46 UTC
(In reply to renato from comment #183)
> https://github.com/AndiWeiss/alx-wol
> 
> up to kernel 6.7 works !

confirm it works on ubuntu 22.04 6.5.0-15-generic
Comment 185 renato 2024-01-31 19:36:55 UTC
You must use the generic branch because the master branch is still the old version. The new version works for 23.10 and later and fixes the initramfs problem.
I believe that the generic will be pushed up as soon he reads the mail that bug is solved !
Comment 186 diabe 2024-08-27 07:18:42 UTC
Works on 24.04 6.8.0 kernel