[dpdk-dev] [PATCH v2 0/7] vhost rxtx refactor

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Feb 18 14:49:05 CET 2016


Here is a patchset for refactoring vhost rxtx code, mainly for
improving readability.

The first 3 patches refactor 3 major functions at vhost_rxtx.c,
respectively. It simplifies the code logic, making it more readable.
On the other hand, it reduces binary code size, due to a lot of
duplicate code are removed.

Patch 4 gets rid of the rte_memcpy for virtio_hdr copy, which nearly
saves 12K bytes of binary code size!

Till now, the code has been greatly reduced: 39k vs 24k.

Patch 5 removes "unlikely" for VIRTIO_NET_F_MRG_RXBUF detection.

Patch 6 and 7 do some sanity check for two desc fields, to make vhost
robust and be protected from malicious guest or abnormal use cases.

It's key data path changes, and I have done some test to make sure it
doesn't break something. However, more test are welcome!

---
Yuanhan Liu (7):
  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

 lib/librte_vhost/vhost_rxtx.c | 1000 ++++++++++++++++++-----------------------
 1 file changed, 442 insertions(+), 558 deletions(-)

-- 
1.9.0



More information about the dev mailing list