]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/net/virtio_net.c
virtio_net: XDP support for adjust_head
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 3 Feb 2017 03:16:29 +0000 (19:16 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Feb 2017 15:05:12 +0000 (10:05 -0500)
commit2de2f7f40ef92313d76c3df7f545be5d0899b1aa
tree73e9b6dacb26981643c86a6eb9327bf546eb3bd9
parent9fe7bfce8b3e112e8e08c40deb72ee7e24c6f072
virtio_net: XDP support for adjust_head

Add support for XDP adjust head by allocating a 256B header region
that XDP programs can grow into. This is only enabled when a XDP
program is loaded.

In order to ensure that we do not have to unwind queue headroom push
queue setup below bpf_prog_add. It reads better to do a prog ref
unwind vs another queue setup call.

At the moment this code must do a full reset to ensure old buffers
without headroom on program add or with headroom on program removal
are not used incorrectly in the datapath. Ideally we would only
have to disable/enable the RX queues being updated but there is no
API to do this at the moment in virtio so use the big hammer. In
practice it is likely not that big of a problem as this will only
happen when XDP is enabled/disabled changing programs does not
require the reset. There is some risk that the driver may either
have an allocation failure or for some reason fail to correctly
negotiate with the underlying backend in this case the driver will
be left uninitialized. I have not seen this ever happen on my test
systems and for what its worth this same failure case can occur
from probe and other contexts in virtio framework.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c