[PATCH net] virtio_net: Account for tx bytes and packets on sending xdp_frames

Jesper Dangaard Brouer
Fri, 08 Feb 2019 16:02:41 -0000

On Wed, 6 Feb 2019 00:06:33 +0000 Saeed Mahameed <saeedm at mellanox.com>
wrote:

> 2) Driver should keep track of XDP decisions statistics, report them in
> ethtool and in the new API suggested by David. track even (XDP_PASS) ?
>
> Maybe instead of having all drivers track the statistics on their own,
> we should move the responsibility to upper layer.
>
> Idea: since we already have rxq_info structure per XDP ring (no false
> sharing) and available per xdp_buff we can do:
>
> +++ b/include/linux/filter.h
> @@ -651,7 +651,9 @@ static __always_inline u32 bpf_prog_run_xdp(const
> struct bpf_prog *prog,
>          * already takes rcu_read_lock() when fetching the program, so
>          * it's not necessary here anymore.
>          */
> -       return BPF_PROG_RUN(prog, xdp);
> +       u32 ret = BPF_PROG_RUN(prog, xdp);
> +       xdp->xdp_rxq_info.stats[ret]++
> +       return ret;
>  }
>
> still we need a way (API) to report the rxq_info to whoever needs to
> read current XDP stats

I'm capturing this as tasks under the XDP-project github page:
 https://github.com/xdp-project/xdp-project/pull/13/files

--
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer