From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: [PATCH v2 0/7] vhost rxtx refactor Date: Thu, 18 Feb 2016 21:49:05 +0800 Message-ID: <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> Cc: "Michael S. Tsirkin" , Victor Kaplansky To: dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id BCC45C358 for ; Thu, 18 Feb 2016 14:48:44 +0100 (CET) In-Reply-To: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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