Re: [PATCH net-next v7 7/9] vhost-net: vhost-net: replace rx_ring with tun/tap ring wrappers
From: Jason Wang <jasowang@redhat.com>
Date: 2026-01-08 04:38:49
Also in:
kvm, lkml, virtualization
From: Jason Wang <jasowang@redhat.com>
Date: 2026-01-08 04:38:49
Also in:
kvm, lkml, virtualization
On Thu, Jan 8, 2026 at 5:06 AM Simon Schippers [off-list ref] wrote:
Replace the direct use of ptr_ring in the vhost-net virtqueue with tun/tap ring wrapper helpers. Instead of storing an rx_ring pointer, the virtqueue now stores the interface type (IF_TUN, IF_TAP, or IF_NONE) and dispatches to the corresponding tun/tap helpers for ring produce, consume, and unconsume operations. Routing ring operations through the tun/tap helpers enables netdev queue wakeups, which are required for upcoming netdev queue flow control support shared by tun/tap and vhost-net. No functional change is intended beyond switching to the wrapper helpers. Co-developed-by: Tim Gebauer <redacted> Signed-off-by: Tim Gebauer <redacted> Co-developed by: Jon Kohler [off-list ref] Signed-off-by: Jon Kohler <redacted> Signed-off-by: Simon Schippers <redacted> --- drivers/vhost/net.c | 92 +++++++++++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 32 deletions(-)diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 7f886d3dba7d..215556f7cd40 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c@@ -90,6 +90,12 @@ enum { VHOST_NET_VQ_MAX = 2, }; +enum if_type { + IF_NONE = 0, + IF_TUN = 1, + IF_TAP = 2, +};
This looks not elegant, can we simply export objects we want to use to vhost like get_tap_socket()? Thanks