]> git.droids-corp.org - dpdk.git/commit
vhost: fix packed ring descriptor update in async enqueue
authorJiayu Hu <jiayu.hu@intel.com>
Tue, 16 Nov 2021 15:17:56 +0000 (10:17 -0500)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 16 Nov 2021 10:21:48 +0000 (11:21 +0100)
commitaf4d7ad5d90baf21e99d0ab91058fcdf8ae90f96
treeada019161da5bd65eb1154a9fe976a5b13d1cf52
parente9511a26e1c4fed566c3c2ea33ca895b7ab4f724
vhost: fix packed ring descriptor update in async enqueue

If the packet uses multiple descriptors and its descriptor indices are
wrapped, the first descriptor flag is not updated last, which may cause
virtio read the incomplete packet. For example, given a packet uses 64
descriptors, and virtio ring size is 256, and its descriptor indices are
224~255 and 0~31, current implementation will update 224~255 descriptor
flags earlier than 0~31 descriptor flags.

This patch fixes this issue by updating descriptor flags in one loop,
so that the first descriptor flag is always updated last.

Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath")
Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/vhost/virtio_net.c