]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bhyve: add backend rx backpressure to virtio-net
authorvmaffione <vmaffione@FreeBSD.org>
Sun, 3 Nov 2019 19:02:32 +0000 (19:02 +0000)
committervmaffione <vmaffione@FreeBSD.org>
Sun, 3 Nov 2019 19:02:32 +0000 (19:02 +0000)
commit621be0aeda544fcf81e80f8ed96faad504aa119e
tree630953ec5b31dfda72ef7c70310c8f5b3856d2a1
parente1bd0b530816ede65c043f01a13cab746fce73ea
bhyve: add backend rx backpressure to virtio-net

If a VM is flooded with more ingress packets than the guest OS
can handle, the current virtio-net code will keep reading those
packets and drop most of them as no space is available in the
receive queue. This is an undesirable receive livelock, which
is a waste of CPU and memory resources and potentially opens to
DoS attacks.
With this change, virtio-net uses the new netbe_rx_disable()
function to disable ingress operation in the backend while the
guest is short on RX buffers. Once the guest makes more buffers
available to the RX virtqueue, ingress operation is enabled again
by calling netbe_rx_enable().

Reviewed by: bryanv, jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20987
usr.sbin/bhyve/mevent.c
usr.sbin/bhyve/mevent.h
usr.sbin/bhyve/net_backends.c
usr.sbin/bhyve/pci_e82545.c
usr.sbin/bhyve/pci_virtio_net.c