|Summary:||Wake on Lan doesn't work for bge NIC driver|
|Component:||kern||Assignee:||Cy Schubert <cy>|
|Status:||In Progress ---|
|Severity:||Affects Some People||CC:||bourmg, cy, gmc, net, nkulaga, thfrdue, workman.stephen, yntses|
|Priority:||---||Keywords:||needs-qa, patch, regression|
Description pozzugno 2017-04-12 05:58:56 UTC
I use Nas4Free on HP ProLiant MicroServer. Nas4Free is based on FreeBSD and I and some other people have a problem that is related to the bge NIC driver included in the last FreeBSD kernel. We can't use Wake On Lan feature, even if it is enabled in BIOS. It is an issue with FreeBSD, because we can use WOL with other OS (such as Linux) on the same hw. Someone noticed the WOL feature works if the NIC is connected to a Gigabit Ethernet, but not if the link is 100Mbps. Unfortunately I can't test Gigabit on my system. Someone says older Nas4Free versions worked, for example that based on FreeBSD 9.2. You can read much more details on a specific thread present on Nas4Free forum, here (https://www.nas4free.org/forums/viewtopic.php?f=58&t=4756&start=30).
Comment 1 thfrdue 2017-09-27 15:10:36 UTC
The same applies for FreeNAS which is also based on FreeBSD. With my HP ProLiant MicroServer N54L I have the same issue that WOL is not available - even with Gigabit ethernet connected. Patches seem to exist (e.g., https://bitbucket.org/w4w/bge-wol-freebsd-10.1-patch).
Comment 2 thfrdue 2017-10-03 01:55:19 UTC
Created attachment 186870 [details] if_bge.c patched with the bge-WOL patch from https://bitbucket.org/w4w/bge-wol-freebsd-10.1-patch/overview
Comment 3 Cy Schubert 2018-03-02 17:59:36 UTC
Created attachment 191147 [details] WOL patch for bge. This patch was posted to PR 171744. The caveat is listed there, though the problem may simply be my laptop. I'll consider closing either this or 171744 as a dup of the other.
Comment 4 Rodney W. Grimes 2018-03-02 20:59:17 UTC
Please try not remove group assignment when "Taking" bugs.
Comment 5 Koen Martens 2018-03-19 19:31:30 UTC
Not sure what the fix is, and how 171744 is relevant (it's about the wake command, if I understand correctly). Just wanted to chime in. I have a machine with a bge-driven card for which WOL worked perfectly with 10.3-RELEASE. I activated it with 'ifconfig bge0 wol_magic' and then used the wakeonlan utility on a linux (ubuntu 16.04) machine to wake up the freebsd machine. Yesterday I upgraded to 11.1-RELEASE (something I have put off for ages because I was afraid something would break, but with the EOL coming up I decided to take the risk), and WOL just stopped working. It isn't even advertised anymore as a capability in ifconfig: # ifconfig -m bge0 bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE> capabilities=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE> ether 00:1e:c9:5b:75:11 hwaddr 00:1e:c9:5b:75:11 inet 10.1.3.8 netmask 0xffffff00 broadcast 10.1.3.255 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active supported media: media autoselect mediaopt flowcontrol media autoselect media 1000baseT mediaopt full-duplex,master media 1000baseT mediaopt full-duplex media 1000baseT mediaopt master media 1000baseT media 100baseTX mediaopt full-duplex media 100baseTX media 10baseT/UTP mediaopt full-duplex media 10baseT/UTP Needless to say, 'ifconfig bge0 wol_magic' doesn't enable it anymore either.
Comment 6 Cy Schubert 2018-03-19 19:43:23 UTC
I don't understand why it worked on 10.3. The WOL code was not in bge at the time. The patch is for 12-CURRENT. I'll rework it for 11-STABLE.
Comment 7 Cy Schubert 2018-03-20 00:23:25 UTC
The patch attached to this PR also works with stable/11 and releng/11.1.
Comment 8 Koen Martens 2018-04-19 15:34:42 UTC
(In reply to Cy Schubert from comment #6) Hi, thanks for the reply (and the reworked patch). I guess the patch won't go upstream because of the reasons mentioned (ie. potential to blow up boards that can't support enough power when the system is powered down)? I'm also surprised it did work for me. I actually woke up the machine with wake-on-lan to ssh into it and upgrade it to 11.1-RELEASE.
Comment 9 Cy Schubert 2018-04-20 00:56:27 UTC
(In reply to Koen Martens from comment #8) That bug has been fixed in the latest patch I posted here. No worries about drawing too much current when powered off any more. I've been using it and previous versions of this patch on my laptop (only machine I have with bge) for about a year. I suppose I should submit the patch in phabricator for review prior to commit.
Comment 10 NK 2018-08-10 13:08:21 UTC
There still have issue with WOL patch for bge driver on FreeBSD 11.2. It seems there is boot issues, see here: https://www.xigmanas.com/forums/viewtopic.php?f=78&t=13807#p85480
Comment 11 Cy Schubert 2018-10-01 04:04:53 UTC
(In reply to NK from comment #10) Sketchy details. There's nothing to go on. The WOL patch was developed for 12-CURRENT only. The only issue is a system will not halt -p after being woken by WOL, but will after a reboot. I'll try to port it back to 11-STABLE if anyone is interested.
Comment 12 thfrdue 2018-10-01 18:51:04 UTC
(In reply to Cy Schubert from comment #11) I would very much appreciate it. Thanks a lot for your efforts!
Comment 13 Cy Schubert 2018-10-02 01:02:48 UTC
Created attachment 197700 [details] WOL patch for stable/11 Same patch, for stable/11. I haven't tried to build or use this particular patch on stable/11. However a previous version was developed for current/11 at the time. This patch has the same problem as the -CURRENT patch, the system will reboot on halt -p the first time around. I'm not sure of the solution for this yet.
Comment 14 George B 2018-10-25 11:52:56 UTC
I had 11.1 patched with https://github.com/NamTaf/if_bge_wol and it worked can I apply the same patch on 11.2 p4 ? I only need this for WOL.
Comment 15 Yiannis 2020-02-23 15:48:06 UTC
Any hope to make it work please ? I have an old but full functional HP Microserver and I can't upgrade because of this issue. A fix would really appreciated
Comment 16 Cy Schubert 2020-03-13 20:14:51 UTC
Created attachment 212388 [details] Latest WOL patch for bge The patch generally works, I currently use it. However halt -p after a WOL will not power off the machine but reboot it. Only after the next reboot will it be able to power off. I don't know if this is isolated to my laptop only or if this is a general problem. Try the patch if it has the same behavior as on my laptop and report here or back to me your result. Ping me if the patch posted here doesn't apply. I'll backport the one from 13-CURRENT again.