[SRU][F:linux-bluefield][PATCH 07/21] vhost_net: Also populate XDP frame size

Bodong Wang bodong at nvidia.com
Mon Jul 5 15:39:45 UTC 2021


From: Jesper Dangaard Brouer <brouer at redhat.com>

BugLink: https://bugs.launchpad.net/bugs/1934499

In vhost_net_build_xdp() the 'buf' that gets queued via an xdp_buff
have embedded a struct tun_xdp_hdr (located at xdp->data_hard_start)
which contains the buffer length 'buflen' (with tailroom for
skb_shared_info). Also storing this buflen in xdp->frame_sz, does not
obsolete struct tun_xdp_hdr, as it also contains a struct
virtio_net_hdr with other information.

Signed-off-by: Jesper Dangaard Brouer <brouer at redhat.com>
Signed-off-by: Alexei Starovoitov <ast at kernel.org>
Acked-by: Michael S. Tsirkin <mst at redhat.com>
Acked-by: Jason Wang <jasowang at redhat.com>
Link: https://lore.kernel.org/bpf/158945343928.97035.4620233649151726289.stgit@firesoul
(cherry picked from commit 05afee298afc2f2497b7400b53e9d60fcc24d525)
Signed-off-by: Maxim Mikityanskiy <maximmi at nvidia.com>
Reviewed-by: Moshe Shemesh <moshe at nvidia.com>
Signed-off-by: Bodong Wang <bodong at nvidia.com>
---
 drivers/vhost/net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 48e574a..bc102da 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -745,6 +745,7 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
 	xdp->data = buf + pad;
 	xdp->data_end = xdp->data + len;
 	hdr->buflen = buflen;
+	xdp->frame_sz = buflen;
 
 	--net->refcnt_bias;
 	alloc_frag->offset += buflen;
-- 
1.8.3.1




More information about the kernel-team mailing list