Reputation: 891
As I know, there's a ring buffer for Network Interface Card, and if such buffer is overflow, the incoming packet will be dropped unless kernel drains packet and free space in buffer.
My question is how to detect such NIC ring buffer overflow on Linux?
How to simulate such ring buffer overflow on Linux? Modification of /proc is acceptable if necessary.
Updated at Feb 2, 2016:
I will accept John Zwinck's explanation as answer, while if anyone have knowledge of simulating the ring buffer overflow, please also let me know, thanks in advance.
Upvotes: 1
Views: 8449
Reputation: 11
I tried to fill the buffer by sudo ethtool -C eth0 rx-usecs 10000
and sudo ethtool -G eth0 rx 48
. The first command sets how many usecs to delay an RX interrupt after a packet arrives. And the second command sets the RX ring buffer size. Then I opened some websites and watched some videos,the ring buffer was full then the dropped packet count increased.
And it seems that the minimum ring buffer size is 48, as no matter how small I set it, ethtool -g eth0
always shows that the current buffer size is 48.
Upvotes: 1
Reputation: 105
1) You can detect buffer overflow by examination of NIC statistics: ethtool -s eno1
. There will be a lot of information in output. Field's name are driver depended. For example in tg3 driver filed "rx_discards" - is one you are looking for. It store the amount of packets which was dropped due to full buffer.
2) When I need to get packets dropping, I set buffer size into very small value (2 for example): ethtool -G eno1 rx 2
. And load the network card with netperf.
Upvotes: 2
Reputation: 249293
I don't think you can (portably) detect or simulate this. There may be ways to do it using a specific NIC driver, but you'd have to specify exactly what you're using, and I suspect for consumer-grade products it won't be possible. You can measure and adjust the size of the ring buffers using ethtool -g
however, which is explained here: http://www.scottalanmiller.com/linux/2011/06/20/working-with-nic-ring-buffers/
Upvotes: 1