e1000: indicate dropped packets in HW counters
commit1001cf45a7ca22d990e19a81029319ca763cad4f
authorJason Wang <jasowang@redhat.com>
Tue, 16 Oct 2018 09:40:45 +0000 (16 17:40 +0800)
committerJason Wang <jasowang@redhat.com>
Fri, 19 Oct 2018 03:15:04 +0000 (19 11:15 +0800)
treef2a8bb1c7b8e3e9318fae5e9f72f453037598955
parent1592a9947036d60dde5404204a5d45975133caf5
e1000: indicate dropped packets in HW counters

The e1000 emulation silently discards RX packets if there's
insufficient space in the ring buffer. This leads to errors
on higher-level protocols in the guest, with no indication
about the error cause.

This patch increments the "Missed Packets Count" (MPC) and
"Receive No Buffers Count" (RNBC) HW counters in this case.
As the emulation has no FIFO for buffering packets that can't
immediately be pushed to the guest, these two registers are
practically equivalent (see 10.2.7.4, 10.2.7.33 in
https://www.intel.com/content/www/us/en/embedded/products/networking/82574l-gbe-controller-datasheet.html).

On a Linux guest, the register content  will be reflected in
the "rx_missed_errors" and "rx_no_buffer_count" stats from
"ethtool -S", and in the "missed" stat from "ip -s -s link show",
giving at least some hint about the error cause inside the guest.

If the cause is known, problems like this can often be avoided
easily, by increasing the number of RX descriptors in the guest
e1000 driver (e.g under Linux, "e1000.RxDescriptors=1024").

The patch also adds a qemu trace message for this condition.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/e1000.c
hw/net/trace-events