]> git.droids-corp.org - dpdk.git/commitdiff
vhost: fix sync dequeue offload
authorXuan Ding <xuan.ding@intel.com>
Fri, 24 Jun 2022 05:38:24 +0000 (05:38 +0000)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Fri, 1 Jul 2022 13:49:49 +0000 (15:49 +0200)
This patch fixes the missing virtio net header copy in sync
dequeue path caused by refactoring, which affects dequeue
offloading.

Fixes: 6d823bb302c7 ("vhost: prepare sync for descriptor to mbuf refactoring")
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
lib/vhost/virtio_net.c

index f7ced96cbf36c05b072433e1f1150efe5f7d587b..d0b5e76153c5c69fb1b4f900b365cc2b3071999a 100644 (file)
@@ -2724,9 +2724,17 @@ desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
                                           buf_iova + buf_offset, cpy_len, false) < 0)
                                goto error;
                } else {
-                       sync_fill_seg(dev, vq, cur, mbuf_offset,
-                                     buf_addr + buf_offset,
-                                     buf_iova + buf_offset, cpy_len, false);
+                       if (hdr && cur == m) {
+                               rte_memcpy(rte_pktmbuf_mtod_offset(cur, void *, mbuf_offset),
+                                       (void *)((uintptr_t)(buf_addr + buf_offset)),
+                                       cpy_len);
+                               vhost_log_cache_write_iova(dev, vq, buf_iova + buf_offset, cpy_len);
+                               PRINT_PACKET(dev, (uintptr_t)(buf_addr + buf_offset), cpy_len, 0);
+                       } else {
+                               sync_fill_seg(dev, vq, cur, mbuf_offset,
+                                       buf_addr + buf_offset,
+                                       buf_iova + buf_offset, cpy_len, false);
+                       }
                }
 
                mbuf_avail  -= cpy_len;