Skip to content

vhost_net: access ptr ring using tap recvmsg

[email protected] kvm netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tuntap: reorganize tun_msg_ctl usagedrivers/net/tap.c drivers/net/tun.c drivers/vhost/net.c +1 more+17 -102 replies
2/3vhost_net: user tap recvmsg api to access ptr ringdrivers/net/tap.c drivers/net/tun.c drivers/vhost/net.c +1 more+83 -123 replies
3/3tuntap: remove usage of ptr ring in vhost_netdrivers/net/tap.c drivers/net/tun.c drivers/vhost/net.c+4 -530 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/3] vhost_net: access ptr ring using tap recvmsg

From: Prashant Bhole <[email protected]>

vhost_net needs to peek tun packet sizes to allocate virtio buffers. Currently it directly accesses tap ptr ring to do it. Jason Wang suggested to achieve this using msghdr->msg_control and modifying the behavior of tap recvmsg.

This change will be useful in future in case of virtio-net XDP offload. Where packets will be XDP processed in tap recvmsg and vhost will see only non XDP_DROP'ed packets.

Patch 1: reorganizes the tun_msg_ctl so that it can be extended by
the means of different commands. tap sendmsg recvmsg will behave according to commands.

Patch 2: modifies recvmsg implementation to produce packet pointers.
vhost_net uses recvmsg API instead of ptr_ring_consume().

Patch 3: removes ptr ring usage in vhost and functions those export
ptr ring from tun/tap.

Prashant Bhole (3):
tuntap: reorganize tun_msg_ctl usage
vhost_net: user tap recvmsg api to access ptr ring
tuntap: remove usage of ptr ring in vhost_net

 drivers/net/tap.c      | 44 ++++++++++++++---------
 drivers/net/tun.c      | 45 +++++++++++++++---------
 drivers/vhost/net.c    | 79 ++++++++++++++++++++++--------------------
 include/linux/if_tun.h |  9 +++--
 4 files changed, 103 insertions(+), 74 deletions(-)
Signature · 1 line
2.21.0