Re: [PATCH net] virtio_net: Account for tx bytes and packets on sending xdp_frames
From: Jesper Dangaard Brouer <hidden>
Date: 2019-02-06 13:48:32
From: Jesper Dangaard Brouer <hidden>
Date: 2019-02-06 13:48:32
On Wed, 6 Feb 2019 00:06:33 +0000 Saeed Mahameed [off-list ref] wrote:
3) Unrelated, In non XDP case, if skb allocation fails or driver fails to pass the skb up to the stack for somereason, should the driver increase rx packets ? IMHO the answer should be yes if we want to have similar behavior between XDP and non XDP cases.
I don't think "skb allocation fails" should increase rx packets counter. The difference is that these events are outside sysadm/users control, and is an error detected inside the driver. The XDP program takes a policy choice to XDP_DROP a packet, which can be accounted inside the XDP prog (as the samples show) or as we also discuss via a more generic XDP-action counters. That said, I took at quick look at driver code, and it seems this behavior differs per driver... ixgbe and mlx5 does not count "skb allocation fails" as RX-ed packets, while mlx4 seems to count them.
But this could result in netdev->stats.rx_packets + netdev->stats.rx_dropped to be more than the actual rx-ed packets, is this acceptable ?
This is one reasons I think this is wrong. --Jesper