Does Linux count dropped packets in rx_packets and tx_packets?

iLL

New Member
Good morning,

I'm doing some network measurements with a program that collects data from the folder /sys/class/net/<if>/statistics.
In my measurement program, I have a line of code stating that, in a 1 second reading, the rx_dropped and tx_dropped values cannot be higher than the rx_packets and tx_packets values, respectively.

In other words, in 1 second of measurement, the number of received packets that are dropped by the system cannot be higher than the total received packets in that moment (and the same for transmitted packets).

However, I started questioning this logic. In Linux systems, are dropped packets counted in the rx_packets file, or are they dropped before they are even counted has a received packet? The same for the transmitted packets.

If those packets are indeed counted in rx_packets and tx_packets, since my logic applies to 1 second measurements, is it ok to state that the refresh time between the values in rx_dropped and rx_packets is way below 1 second? Otherwise, in 1 second the packets could be counted to rx_packets, but only in the following second would they be dropped and counted for rx_dropped.

Any kind of help is very much appreciated, since I've been doing some research and can't find absolutely nothing on the matter.
 


dos2unix

Active Member
depends on how you run the commands.

[[email protected] ~]# netstat -i
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enp0s31f6 1500 226967 0 0 0 21510 0 0 0 BMRU
enp1s0 1500 0 0 0 0 0 0 0 0 BMU
lo 65536 13666 0 0 0 13666 0 0 0 LRU
wlp3s0 1500 0 0 0 0 17333 0 0 0 BMU
 



Members online


Latest posts


Top