Message ID | 158824572308.2172139.1144470511173466125.stgit@firesoul |
---|---|
State | Changes Requested |
Delegated to: | BPF Maintainers |
Headers | show |
Series | [net-next,v2,01/33] xdp: add frame size to xdp_buff | expand |
On 2020/4/30 下午7:22, Jesper Dangaard Brouer wrote: > 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. > > Cc: Jason Wang <jasowang@redhat.com> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> > --- > drivers/vhost/net.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index 2927f02cc7e1..516519dcc8ff 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -747,6 +747,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; Hi Jesper: As I said in v1, tun will do this for us (patch 19) via hdr->buflen. So it looks to me this is not necessary? Thanks > >
On 2020/5/6 下午2:41, Jason Wang wrote: > > On 2020/4/30 下午7:22, Jesper Dangaard Brouer wrote: >> 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. >> >> Cc: Jason Wang <jasowang@redhat.com> >> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> >> --- >> drivers/vhost/net.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c >> index 2927f02cc7e1..516519dcc8ff 100644 >> --- a/drivers/vhost/net.c >> +++ b/drivers/vhost/net.c >> @@ -747,6 +747,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; > > > Hi Jesper: > > As I said in v1, tun will do this for us (patch 19) via hdr->buflen. > So it looks to me this is not necessary? > > Thanks Miss your reply. So Acked-by: Jason Wang <jasowang@redhat.com>
On Thu, Apr 30, 2020 at 01:22:03PM +0200, Jesper Dangaard Brouer wrote: > 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. > > Cc: Jason Wang <jasowang@redhat.com> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> > --- > drivers/vhost/net.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index 2927f02cc7e1..516519dcc8ff 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -747,6 +747,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; > >
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 2927f02cc7e1..516519dcc8ff 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -747,6 +747,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;
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. Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> --- drivers/vhost/net.c | 1 + 1 file changed, 1 insertion(+)