From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DECAD2BA4 for ; Wed, 15 Feb 2017 07:24:45 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2017 22:24:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,164,1484035200"; d="scan'208";a="1094927464" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga001.jf.intel.com with ESMTP; 14 Feb 2017 22:24:44 -0800 From: Yuanhan Liu To: Yuanhan Liu Cc: Maxime Coquelin , "Michael S. Tsirkin" , dpdk stable Date: Wed, 15 Feb 2017 14:26:18 +0800 Message-Id: <1487140012-13314-6-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1487140012-13314-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1487140012-13314-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-stable] patch 'net/virtio: optimize header reset on any layout' has been queued to stable release 16.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2017 06:24:46 -0000 Hi, FYI, your patch has been queued to stable release 16.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/18/17. So please shout if anyone has objections. Thanks. --yliu --- >>From a60c9fe6a40e162fd25faaebd3eee950a3591306 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Wed, 11 Jan 2017 12:27:12 +0800 Subject: [PATCH] net/virtio: optimize header reset on any layout [ upstream commit 16994abee215e55dcccf19114b324d5c407b3f56 ] When any layout is used, the header is stored in the head room of mbuf. mbuf is allocated and filled by user, means there is no gurateen the header is all zero for non TSO case. Therefore, we have to do the reset by ourself: memest(hdr, 0, head_size); The memset has two impacts on performance: - memset could not be inlined, which is a bit costly. - more importantly, it touches the mbuf, which could introduce severe cache issues as described by former patch. Similiary, we could do the same trick: reset just when necessary, when the corresponding field is already 0, which is likely true for a simple l2 forward case. It could boost the performance up to 20+% in micro benchmarking. Cc: Maxime Coquelin Cc: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_rxtx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index edbd3cd..a33ef1a 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -292,8 +292,14 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie, hdr = (struct virtio_net_hdr *) rte_pktmbuf_prepend(cookie, head_size); /* if offload disabled, it is not zeroed below, do it now */ - if (offload == 0) - memset(hdr, 0, head_size); + if (offload == 0) { + ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0); + ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0); + ASSIGN_UNLESS_EQUAL(hdr->flags, 0); + ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0); + ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0); + ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0); + } } else if (use_indirect) { /* setup tx ring slot to point to indirect * descriptor list stored in reserved region. -- 1.9.0