Mar 10
em Driver Debug
icon1 admin | icon2 FreeBSD, Networking | icon4 03 10th, 2008| icon3No Comments »

If you’ve used FreeBSD chances are you’ve used the em driver (for Intel gigabit network cards). Debugging packet loss and link errors can be difficult, so here’s a handy tip for those of you using the driver –

Using sysctl, you can get “debug” information off of your cards.  Execute “sysctl hw.em0.stats=1” and “sysctl hw.em0.debug_info=1” each time you want the information to be logged to /var/log/messages (or dmesg). You can replace “em0″ with whichever network card you want, for a quick list of what seems to be available you can run “sysctl -a hw.”

Here’s what you can expect to see –

/kernel: em0: Adapter hardware address = 0xc62931e0
/kernel: em0:CTRL  = 0×3c0249
/kernel: em0:RCTL  = 0×0 PS=(0×8402)
/kernel: em0:tx_int_delay = 0, tx_abs_int_delay = 0
/kernel: em0:rx_int_delay = 0, rx_abs_int_delay = 0
/kernel: em0: fifo workaround = 0, fifo_reset = 0
/kernel: em0: hw tdh = 0, hw tdt = 0
/kernel: em0: Num Tx descriptors avail = 0
/kernel: em0: Tx Descriptors not avail1 = 0
/kernel: em0: Tx Descriptors not avail2 = 0
/kernel: em0: Std mbuf failed = 0
/kernel: em0: Std mbuf cluster failed = 0
/kernel: em0: Driver dropped packets = 0
/kernel: em0: Excessive collisions = 0
/kernel: em0: Symbol errors = 0
/kernel: em0: Sequence errors = 0
/kernel: em0: Defer count = 0
/kernel: em0: Missed Packets = 0
/kernel: em0: Receive No Buffers = 0
/kernel: em0: Receive length errors = 0
/kernel: em0: Receive errors = 0
/kernel: em0: Crc errors = 0
/kernel: em0: Alignment errors = 0
/kernel: em0: Carrier extension errors = 0
/kernel: em0: XON Rcvd = 0
/kernel: em0: XON Xmtd = 0
/kernel: em0: XOFF Rcvd = 0
/kernel: em0: XOFF Xmtd = 0
/kernel: em0: Good Packets Rcvd = 0
/kernel: em0: Good Packets Xmtd = 0