Re: [PATCH net] virtio_net: Account for tx bytes and packets on sending xdp_frames
From: Jakub Kicinski <hidden>
Date: 2019-02-06 15:52:36
On Wed, 6 Feb 2019 14:48:14 +0100, Jesper Dangaard Brouer wrote:
On Wed, 6 Feb 2019 00:06:33 +0000 Saeed Mahameed [off-list ref] wrote:quoted
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.
FWIW that's my understanding as well. My understanding of Linux stats is that they are incrementing one counter per packet. I.e. in RX direction success packets are those given to the stack, and for TX those given to the hardware. Standards (IETF/IEEE) usually count stats on the same layer boundary, but I think software generally counts when it's done with the packet. I haven't seen it documented anywhere, yet. I have tried to document it in the docs of the recent RFC: https://patchwork.ozlabs.org/patch/1032332/ Incidentally XDP_DROP may have been better named XDP_DISCARD from stats perspective ;)