Wake On LAN with A8N SLI, Linux and nvnet driver

Wake on LAN with the reverse-engineered forcedeth driver on Gentoo Linux amd64 does not work for me. I enabled the Wake up setting in the BIOS and ethtool as well as editing the shutdown script to enable WOL prior to shutdown doesn’t help, see here. The PC won’t wake up, neither on magic packet nor on link change.

So I decided to use NVIDIA’s binary nvnet driver. Wake on LAN works fine with this one, as it is enabled by default. No more fiddling with ethtool and the shutdown scripts. But there is a problem: nvnet sets the network adapter not only to wake on magic packets, but also to wake on link change (e.g. cable disconnects or router reboot). As I’m having my router rebooted every 24h my PC turns on in the middle of the night.

Here’s a fix: extract the NVIDIA nforce drivers with

./NFORCE-Linux-x86_64-1.0-0310-pkg1.run -x

and open the file NFORCE-Linux-x86_64-1.0-0310-pkg1/nvnet/nvenet.c in your favourite editor and search for this line:

power_state.ulLinkChangeWakeUpFlags = POWER_STATE_ALL;

and change it to:

power_state.ulLinkChangeWakeUpFlags = 0;

Now run NFORCE-Linux-x86_64-1.0-0310-pkg1/nforce-installer -s, load the module, restart networking and shut down. Your PC will only wake upon receiving a magic packet!