Saturday, July 9, 2011

Tip: Fixing Atheros L2 driver attachment on FreeBSD

My personal server, a low-powered system based on an integrated motherboard ASUS I220GC, is using a D-Link DGE-528 Ethernet PCI card which runs fine on FreeBSD 7.4. However while toying with the system I decided to active the integrated Atheros L2 10/100 Ethernet device that I had disabled a long time ago.

Upon enabling the device on the BIOS and booting the system I came across an odd situation: ae(4) which is Atheros L2 driver wasn't loading properly.
# dmesg | less
Jul 8 22:07:22 flumen kernel: pci2: on pcib2
Jul 8 22:07:22 flumen kernel: pci2: at device 0.0 (no driver attached)
# pciconf -lv
none2@pci0:2:0:0: class=0x020000 card=0x82331043 chip=0x20481969 rev=0xa0 hdr=0x00
vendor = 'Attansic (Now owned by Atheros)'
device = 'Fast Ethernet 10/100 Base-T Controller (Atheros L2)'
class = network
subclass = ethernet
To fix this ae(4) driver has to be loaded and then it will attach himself to the PCI device (pci2 in my system):
# kldload -v if_ae
ae0: mem 0xdffc0000-0xdfffffff irq 17 at device 0.0 on pci2
ae0: Using MSI messages.
miibus1: on ae0
atphy0: PHY 0 on miibus1
atphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ae0: Ethernet address: 00:1f:c6:dd:15:72
ae0: [FILTER]
Loaded if_ae, id=5
By running pciconf(8) we can confirm that the driver is now successfully attached:
# pciconf -lv
ae0@pci0:2:0:0: class=0x020000 card=0x82331043 chip=0x20481969 rev=0xa0 hdr=0x00
vendor = 'Attansic (Now owned by Atheros)'
device = 'Fast Ethernet 10/100 Base-T Controller (Atheros L2)'
class = network
subclass = ethernet
To load the driver as a module at boot time loader.conf(5) needs to be edited.
# echo 'if_ae_load="YES"' >> /boot/loader.conf
Now that the driver attachment at boot is solved rc.conf(5) needs to be edited so that FreeBSD assigns an interface to Atheros L2 device at boot:
# vim /etc/rc.conf
ifconfig_ae0="inet 192.168.1.1 netmask 255.255.255.0"
The next time the system is booted the next settings are applied and Atheros L2 is properly working (make sure you use your own network settings namely netmask and inet).

Sources:
man ae
man ifconfig
man loader.conf
man pciconf
man rc.conf

No comments: