From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 1EA0D2BAB for ; Thu, 10 Mar 2016 05:30:06 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 09 Mar 2016 20:30:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,314,1455004800"; d="scan'208";a="920667104" Received: from yliu-dev.sh.intel.com ([10.239.66.49]) by fmsmga001.fm.intel.com with ESMTP; 09 Mar 2016 20:30:04 -0800 From: Yuanhan Liu To: dev@dpdk.org Date: Thu, 10 Mar 2016 12:32:38 +0800 Message-Id: <1457584366-3036-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH v3 0/8] vhost rxtx refactor and fixes 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, 10 Mar 2016 04:30:07 -0000 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