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 63ACC558A for ; Wed, 16 Mar 2016 07:43:58 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 15 Mar 2016 23:43:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,343,1455004800"; d="scan'208";a="934872893" Received: from yliu-dev.sh.intel.com ([10.239.66.49]) by orsmga002.jf.intel.com with ESMTP; 15 Mar 2016 23:43:56 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: huawei.xie@intel.com, Thomas Monjalon , Yuanhan Liu Date: Wed, 16 Mar 2016 14:44:56 +0800 Message-Id: <1458110696-4914-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 Subject: [dpdk-dev] [PATCH] vhost: remove unnecessary memset for virtio net hdr 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: Wed, 16 Mar 2016 06:43:58 -0000 We have to reset the virtio net hdr at virtio_enqueue_offload() before, due to all mbufs share a single virtio_hdr structure: struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, }, 0}; foreach (mbuf) { virtio_enqueue_offload(mbuf, &virtio_hdr.hdr); copy net hdr and mbuf to desc buf } However, after the vhost rxtx refactor, the code looks like: copy_mbuf_to_desc(mbuf) { struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, }, 0} virtio_enqueue_offload(mbuf, &virtio_hdr.hdr); copy net hdr and mbuf to desc buf } foreach (mbuf) { copy_mbuf_to_desc(mbuf); } Therefore, the memset at virtio_enqueue_offload() is not necessary any more; remove it. Signed-off-by: Yuanhan Liu --- lib/librte_vhost/vhost_rxtx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index a6330f8..b4da665 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -94,8 +94,6 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx, uint32_t qp_nb) static void virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) { - memset(net_hdr, 0, sizeof(struct virtio_net_hdr)); - if (m_buf->ol_flags & PKT_TX_L4_MASK) { net_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; net_hdr->csum_start = m_buf->l2_len + m_buf->l3_len; -- 1.9.0