v3: - quite few minor changes, including using likely/unlikely when possible.
- Added a new patch 8 to avoid desc dead loop chain The first 3 patches refactor 3 major functions at vhost_rxtx.c. It simplifies the code logic, making it more readable. OTOH, it reduces binary code size, due to a lot of duplicate code are removed, as well as some huge inline functions are diminished. Patch 4 gets rid of the rte_memcpy for virtio_hdr copy, which nearly saves 12K bytes of binary code size! Patch 5 removes "unlikely" for VIRTIO_NET_F_MRG_RXBUF detection. Patch 6, 7 and 8 do some sanity check for two desc fields, to make vhost robust and be protected from malicious guest or abnormal use cases. --- Yuanhan Liu (8): vhost: refactor rte_vhost_dequeue_burst vhost: refactor virtio_dev_rx vhost: refactor virtio_dev_merge_rx vhost: do not use rte_memcpy for virtio_hdr copy vhost: don't use unlikely for VIRTIO_NET_F_MRG_RXBUF detection vhost: do sanity check for desc->len vhost: do sanity check for desc->next against with vq->size vhost: avoid dead loop chain. lib/librte_vhost/vhost_rxtx.c | 1027 ++++++++++++++++++----------------------- 1 file changed, 453 insertions(+), 574 deletions(-) -- 1.9.0