RE: [PATCH RFC v2 12/33] hv_netvsc: add XDP frame size to driver

Haiyang Zhang
2020-04-08T14:56:20Z

> -----Original Message-----
> From: Jesper Dangaard Brouer <brouer@redhat.com>
> Sent: Wednesday, April 8, 2020 7:52 AM
> To: sameehj@amazon.com
> Cc: Wei Liu <wei.liu@kernel.org>; KY Srinivasan <kys@microsoft.com>;
> Haiyang Zhang <haiyangz@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; Jesper Dangaard Brouer
> <brouer@redhat.com>; netdev@vger.kernel.org; bpf@vger.kernel.org;
> zorik@amazon.com; akiyano@amazon.com; gtzalik@amazon.com; Toke
> Høiland-Jørgensen <toke@redhat.com>; Daniel Borkmann
> <borkmann@iogearbox.net>; Alexei Starovoitov
> <alexei.starovoitov@gmail.com>; John Fastabend
> <john.fastabend@gmail.com>; Alexander Duyck
> <alexander.duyck@gmail.com>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>;
> David Ahern <dsahern@gmail.com>; Willem de Bruijn
> <willemdebruijn.kernel@gmail.com>; Ilias Apalodimas
> <ilias.apalodimas@linaro.org>; Lorenzo Bianconi <lorenzo@kernel.org>;
> Saeed Mahameed <saeedm@mellanox.com>
> Subject: [PATCH RFC v2 12/33] hv_netvsc: add XDP frame size to driver
>
> The hyperv NIC drivers XDP implementation is rather disappointing as it
> will be a slowdown to enable XDP on this driver, given it will allocate a
> new page for each packet and copy over the payload, before invoking the
> XDP BPF-prog.

As explained when I submit the XDP support for hv_netvsc -- without XDP,
this driver already allocates memory and does a copy for every packet. So
the page allocation for XDP data buf is not slower than the existing code
path. Also, an optimization that only allocates a PAGE once, and re-uses it
in a NAPI cycle will be done.

And, my XDP implementation for hv_netvsc transparently passes xdp_prog
to the associated VF NIC. Many of the Azure VMs are using SRIOV, so
majority of the data are actually processed directly on the VF driver's XDP
path. So the overhead of the synthetic data path (hv_netvsc) is minimal.

Thanks,
- Haiyang