From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 18 Feb 2016 05:48:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,465,1449561600"; d="scan'208";a="655017099" Received: from yliu-dev.sh.intel.com ([10.239.66.49]) by FMSMGA003.fm.intel.com with ESMTP; 18 Feb 2016 05:48:42 -0800 From: Yuanhan Liu To: dev@dpdk.org Date: Thu, 18 Feb 2016 21:49:05 +0800 Message-Id: <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1449122773-25510-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 Subject: [dpdk-dev] [PATCH v2 0/7] vhost rxtx refactor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2016 13:48:45 -0000 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