1

On FreeBSD what's the difference between Drop and Idrop in the netstat output?

$ netstat -di 
Name    Mtu Network       Address              Ipkts Ierrs Idrop    Opkts Oerrs  Coll Drop
bge0*  1500 <Link#1>      00:16:d4:e3:49:31        0     0     0        0     0     0    0 
wpi0   2290 <Link#2>      00:1b:77:86:2d:fa        0 53068     0   179587     3     0    0 

Also, does netstat get the drop count from the NIC or from a kernel buffer? For instance, if the NIC can't accept any more packets because of the lack of descriptors, will the packets lost be reported as one of the drop values in netstat?

I ask because in Linux, ifconfig reads from /proc/net/dev and as for as I know, it drops only when the kernel buffer is full. So if the NIC wouldn't accept packets due to lack of descriptors you wouldn't know about it i.e. it hasn't made it's way into kernel memory.

that and netstat on FreeBSD has the -B option for the BPF buffer stats, so right now it makes sense that netstat -di reports the drop count from the NIC/driver itself.

Right/Wrong?

Any help is appreciated, Thanks

jon
  • 181
  • 1
  • 9

1 Answers1

2

Lack of software decsriptors (i.e mbuf clusters) can be observed via:

# vmstat -z

Look at FAIL column.

Lack of hardware descriptors can be observed only via driver-specific interface e.g for Intel e1000 cards via:

# sysctl dev.em.0.debug=1 && dmesg | tail
...
em0: Tx Descriptors avail failure = 0
em0: RX discarded packets = 0
...

Also descriptor count can be tuned via loader.conf in some NICs

Regarding your question "idrops vs. drops" you should look sources for

if_data.ifi_iqdrops
if_snd.ifq_drops

If I understood correctly one is for input drops other for output drops (i.e ALTQ).

PS. For additional information refer to Section 3.3 "ifnet structure" of the TCP/IP Illustrated Volume 2, Stevens & Wright. Or source code of you OS.

SaveTheRbtz
  • 5,621
  • 4
  • 29
  • 45
  • I did look through the sources, my problem was that I couldn't tell the purpose of the members of those structs or the structs themselves. On another note the sysctl setting and the vmstat -z is useful, thanks. – jon Oct 14 '11 at 22:35