• Eric Dumazet's avatar
    loopback: packet drops accounting · 7eebb0b2
    Eric Dumazet authored
    We can in some situations drop packets in netif_rx()
    loopback driver does not report these (unlikely) drops to its stats,
    and incorrectly change packets/bytes counts.
    After this patch applied, "ifconfig lo" can reports these drops as in :
    # ifconfig lo
    lo        Link encap:Local Loopback
              inet addr:  Mask:
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:692562900 errors:3228 dropped:3228 overruns:0 frame:0
              TX packets:692562900 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:2865674174 (2.6 GiB)  TX bytes:2865674174 (2.6 GiB)
    I initialy chose to reflect those errors only in tx_dropped/tx_errors, but David
    convinced me that it was really RX errors, as loopback_xmit() really starts
    a RX process. (calling eth_type_trans() for example, that itself pulls the ethernet header)
    These errors are accounted in rx_dropped/rx_errors.
    Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
loopback.c 5.47 KB