Wake on LAN with FreeBSD and Broadcom Ethernet

To be fair, the Broadcom Ethernet adapter chips aren’t the best supported by FreeBSD. They’re okay, but for FreeBSD Intel rules the roost at 1-Gig and Chelsio at 10-Gig plus.

Unfortunately you may have no choice, as Broadcom chips are built in to the motherboards on some HP servers; notably the Microservers.

The Microserver Gen 7 is a great little box. I love them. I’m not so keen on the Gen 8 or Gen 10, as they’ve dropped a lot of the features that make the Gen 7 so adaptable.
So after much investigation, I decided to either forego WoL support, or bung in a cheap Realtek card simply to wake them up, but with only two PCIe slots, it was a pity to waste one on a better supported Ethernet NIC. That was a long time ago, and I’ve had one eye out for a fix for a while.

And then last year someone looked at it, and I found references to this in bug tracker. Unfortunately I don’t know who to credit with the fix, and it hasn’t made it to the kernel yet as it’s not 100%, but if you need it I’ve patched the 12.1 driver based on all the notes I could find.

There’s a question about the new driver’s correct operation on laptops. Why you’d be using WoL on a laptop eludes me; but for the Microservers it just works.

Download the patched driver ‘C’ file above (as edited by yours truly – no guarantees), and copy it to /usr/src/sys/dev/bge/if_bge.c, rebuild the kernel and away you go. As it was a bug with the state the chip was left on shutdown, you have to reboot the NEW kernel to shut down in the correct state for WoL to work. Don’t forget to enable WoL in the Microserver BIOS too.

Although this fixes the WoL issue, I know the Broadcom chips are capable of more than the driver – for example jumbo packets. If you want better network performance with a Microserver, add a dual-port Intel Ethernet card instead. Sorry, HP/Broadcom.

4 Replies to “Wake on LAN with FreeBSD and Broadcom Ethernet”

  1. Hello,
    thank you for the post. I have a Xigmanas NAS based on FreeBSD and I can’t find the corresponding folder: /usr/src/sys/dev/bge/if_bge.c
    and I don’t know how to “rebuild the kenel”… could you please explain?
    Best

    1. Hi Tony,

      I’m afraid I lose track of these NAS GUIs, and just had to look this one up. It’s actually very easy to set up FreeBSD as a storage server without a GUI, and when I tried FreeNAS a few years back I gave up -everything took so long and it was too inflexible.

      So – unfortunately I’m not able to give you instructions for compiling a new kernel under on Xigmanas NAS specifically. For FreeBSD in general you can read the manual starting here:

      https://docs.freebsd.org/en/books/handbook/kernelconfig/

      However, it’s not exactly friendly, so…

      My guess is that you don’t have the kernel source anyway. If you do it’ll be in /usr/src. The directory is always there, but it might be empty, and it might have the wrong stuff in it.

      To check out the source, find out which version you want. “uname -r” will print out the release, something like “12.2-RELEASE”.

      Then use svnlite to check it out from the source repository. Unfortunately FreeBSD development is switching away from trusty svn to something more shiney, so this may not work forever. But assuming you have 12.2-RELEASE from above, run:

      svnlite checkout https://svn.freebsd.org/base/releng/12.2 /usr/src

      Then you’ll have the file I’m talking about, or an unexpected error message :-)

      Incidentally, I haven’t produced a new driver for 13.0 yet – I haven’t installed 13.0 yet!

      So to build the kernel, go to /usr/src and type “make kernel”. This will compile it (with the new if_bge) and install it. Reboot and you’re done. Most people split this operation into two: “make buildkernel” followed by “make installkernel”, but there’s little point in this case.

      HOWEVER – I don’t know what rebuilding the kernel would do to Xigmanas NAS. For all I know it has a custom kernel, and this will bugger it up. My guess is that if “uname -r” suggests a standard FreeBSD RELEASE kernel you’ll be okay. If not, when it fails to boot use the backup kernel from the bootloader. It’s created automatically and it’s called “/boot/kernel.old”. Once booted (or if you boot from a memory stick), just copy /boot/kernel.old back over /boot/kernel.

      Alternatively, if you’re using this as a storage server, you might want to consider splashing out £30 on an Intel NIC. Even the cheap ones are a lot better than Broadcom – the drivers offload stuff to the NIC and save processor time.

      Hope this helps – by all means come back with any questions, or to let me know how you got on.

  2. I managed to get a second-hand 4-port Intel gigabit card for my Gen7 microserver allowing it to act as an extra switch. It stays on all the time so I never tried WoL.

    Have you ever used the remaining PCIx1 or the x4 that’s meant for a remote access module? I pondered getting some sort of PCIe->M.2/NVME adapter and using it for an extra storage SSD. I don’t know if that’d be too slow to be worth doing or not work under FreeBSD. But I can’t think of much else to use it for.

    A remote access card could be useful but they’re not cheap even as old/used. For remote access, I wish someone would sell a raspberry pi in PCIe card form.

    1. Sorry – missed this comment!

      I have a remote access card somewhere – came in one I bought from eBay. I’ve never found them that useful; I guess they’re for when Windoze stops working.

      I thought the slot was intended for the remote access card only; I don’t think it can be used for anything else but I never tried. The 1x slot is pretty useful – I often put USB 3 cards in them, leaving the 16x for a SAS HBA.

      Ever wished there were more than 4 slots in the drive cage? Get another G7 with a dead/useless motherboard, park it next door and run a SAS cable to it – drive cage with PSU on the cheap!

Leave a Reply

Your email address will not be published. Required fields are marked *