OSDN Git Service

virtio_net: xdp, add slowpath case for non contiguous buffers
authorJohn Fastabend <john.fastabend@gmail.com>
Thu, 15 Dec 2016 20:14:36 +0000 (12:14 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Dec 2016 16:48:55 +0000 (11:48 -0500)
commit72979a6c35907b6a7ab85e7bc60e0d52dba68f9d
treed622f48e13643a9adc2de081af61042757c5522e
parent56434a01b12e99eb60908f5f2b27b90726d0a183
virtio_net: xdp, add slowpath case for non contiguous buffers

virtio_net XDP support expects receive buffers to be contiguous.
If this is not the case we enable a slowpath to allow connectivity
to continue but at a significan performance overhead associated with
linearizing data. To make it painfully aware to users that XDP is
running in a degraded mode we throw an xdp buffer error.

To linearize packets we allocate a page and copy the segments of
the data, including the header, into it. After this the page can be
handled by XDP code flow as normal.

Then depending on the return code the page is either freed or sent
to the XDP xmit path. There is no attempt to optimize this path.

This case is being handled simple as a precaution in case some
unknown backend were to generate packets in this form. To test this
I had to hack qemu and force it to generate these packets. I do not
expect this case to be generated by "real" backends.

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