> -----Original Message----- > From: Stephen Hemminger [mailto:[email protected]] > Sent: Saturday, December 21, 2024 12:36 AM > To: Wangyunjian(wangyunjian,TongTu) <[email protected]> > Cc: [email protected]; [email protected]; [email protected]; > Lilijun (Jerry) <[email protected]>; xiawei (H) <[email protected]>; > wangzengyuan <[email protected]>; [email protected] > Subject: Re: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading > > On Thu, 19 Dec 2024 14:38:28 +0800 > Yunjian Wang <[email protected]> wrote: > > > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c > > index 69901ab3b5..5c40ae7069 100644 > > --- a/lib/vhost/virtio_net.c > > +++ b/lib/vhost/virtio_net.c > > @@ -2914,10 +2914,12 @@ desc_to_mbuf(struct virtio_net *dev, struct > vhost_virtqueue *vq, > > * in a contiguous virtual area. > > */ > > copy_vnet_hdr_from_desc(&tmp_hdr, buf_vec); > > - hdr = &tmp_hdr; > > } else { > > - hdr = (struct virtio_net_hdr > > *)((uintptr_t)buf_vec[0].buf_addr); > > + rte_memcpy((void *)(uintptr_t)&tmp_hdr, > > + (void *)(uintptr_t)buf_vec[0].buf_addr, > > + sizeof(struct virtio_net_hdr)); > > } > > + hdr = &tmp_hdr; > > Since this if block is just an optimization of the case where vnet header > is contiguous why not just always use copy_vnet_hdr_from_desc? and inline it? I also considered using the copy_vnet_hdr_from_desc function directly. However, in most cases, the vnet header is continuous, and reusing copy_vnet_hdr_from_desc results in additional operations. Thanks, Yunjian
RE: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading
Wangyunjian(wangyunjian,TongTu) Sun, 22 Dec 2024 18:45:59 -0800
- [PATCH 1/1] vhost: fix a double fetch when... Yunjian Wang
- Re: [PATCH 1/1] vhost: fix a double f... David Marchand
- RE: [PATCH 1/1] vhost: fix a doub... Wangyunjian(wangyunjian,TongTu)
- Re: [PATCH 1/1] vhost: fix a double f... Stephen Hemminger
- RE: [PATCH 1/1] vhost: fix a doub... Wangyunjian(wangyunjian,TongTu)
- Re: [PATCH 1/1] vhost: fix a ... Stephen Hemminger
- [PATCH v2 1/1] vhost: fix a double fe... Yunjian Wang
- Re: [PATCH v2 1/1] vhost: fix a d... Stephen Hemminger
- Re: [PATCH 1/1] vhost: fix a double f... Stephen Hemminger
- RE: [PATCH 1/1] vhost: fix a doub... Wangyunjian(wangyunjian,TongTu)

