From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 648611DB1 for ; Thu, 17 Mar 2016 02:19:42 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 16 Mar 2016 18:19:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,347,1455004800"; d="scan'208";a="925822733" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 16 Mar 2016 18:19:32 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 16 Mar 2016 18:19:32 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by shsmsx102.ccr.corp.intel.com ([169.254.2.232]) with mapi id 14.03.0248.002; Thu, 17 Mar 2016 09:19:30 +0800 From: "Xie, Huawei" To: Yuanhan Liu , "dev@dpdk.org" CC: Thomas Monjalon Thread-Topic: [PATCH] vhost: remove unnecessary memset for virtio net hdr Thread-Index: AdF/6w4UP66kVIB5QwG0/cN2nwlebg== Date: Thu, 17 Mar 2016 01:19:30 +0000 Message-ID: References: <1458110696-4914-1-git-send-email-yuanhan.liu@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: Thu, 17 Mar 2016 01:19:42 -0000 On 3/16/2016 2:44 PM, Yuanhan Liu wrote:=0A= > We have to reset the virtio net hdr at virtio_enqueue_offload()=0A= > before, due to all mbufs share a single virtio_hdr structure:=0A= >=0A= > struct virtio_net_hdr_mrg_rxbuf virtio_hdr =3D {{0, }, 0};=0A= >=0A= > foreach (mbuf) {=0A= > virtio_enqueue_offload(mbuf, &virtio_hdr.hdr);=0A= >=0A= > copy net hdr and mbuf to desc buf=0A= > }=0A= >=0A= > However, after the vhost rxtx refactor, the code looks like:=0A= >=0A= > copy_mbuf_to_desc(mbuf)=0A= > {=0A= > struct virtio_net_hdr_mrg_rxbuf virtio_hdr =3D {{0, }, 0}=0A= >=0A= > virtio_enqueue_offload(mbuf, &virtio_hdr.hdr);=0A= >=0A= > copy net hdr and mbuf to desc buf=0A= > }=0A= >=0A= > foreach (mbuf) {=0A= > copy_mbuf_to_desc(mbuf);=0A= > }=0A= >=0A= > Therefore, the memset at virtio_enqueue_offload() is not necessary=0A= > any more; remove it.=0A= >=0A= > Signed-off-by: Yuanhan Liu =0A= > ---=0A= > lib/librte_vhost/vhost_rxtx.c | 2 --=0A= > 1 file changed, 2 deletions(-)=0A= >=0A= > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.= c=0A= > index a6330f8..b4da665 100644=0A= > --- a/lib/librte_vhost/vhost_rxtx.c=0A= > +++ b/lib/librte_vhost/vhost_rxtx.c=0A= > @@ -94,8 +94,6 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx, uint32= _t qp_nb)=0A= > static void=0A= > virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *ne= t_hdr)=0A= > {=0A= > - memset(net_hdr, 0, sizeof(struct virtio_net_hdr));=0A= > -=0A= > if (m_buf->ol_flags & PKT_TX_L4_MASK) {=0A= > net_hdr->flags =3D VIRTIO_NET_HDR_F_NEEDS_CSUM;=0A= > net_hdr->csum_start =3D m_buf->l2_len + m_buf->l3_len;=0A= =0A= Acked-by: Huawei Xie =0A=