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 294361C52 for ; Mon, 7 Mar 2016 06:24:55 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 06 Mar 2016 21:24:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,549,1449561600"; d="scan'208";a="918299336" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2016 21:24:53 -0800 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Mar 2016 21:24:53 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Mar 2016 21:24:53 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.42]) with mapi id 14.03.0248.002; Mon, 7 Mar 2016 13:24:51 +0800 From: "Xie, Huawei" To: Stephen Hemminger , Yuanhan Liu Thread-Topic: [dpdk-dev] [PATCH v2 4/7] vhost: do not use rte_memcpy for virtio_hdr copy Thread-Index: AdF4MawSDStR0DVMTfKxmPLX5cduww== Date: Mon, 7 Mar 2016 05:24:50 +0000 Message-ID: References: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> <1455803352-5518-5-git-send-email-yuanhan.liu@linux.intel.com> <20160306202000.68ce5514@xeon-e3> 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 Cc: "dev@dpdk.org" , Victor Kaplansky , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: do not use rte_memcpy for virtio_hdr copy 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: Mon, 07 Mar 2016 05:24:55 -0000 On 3/7/2016 12:20 PM, Stephen Hemminger wrote:=0A= > On Thu, 18 Feb 2016 21:49:09 +0800=0A= > Yuanhan Liu wrote:=0A= >=0A= >> +static inline void=0A= >> +copy_virtio_net_hdr(struct vhost_virtqueue *vq, uint64_t desc_addr,=0A= >> + struct virtio_net_hdr_mrg_rxbuf hdr)=0A= >> +{=0A= >> + if (vq->vhost_hlen =3D=3D sizeof(struct virtio_net_hdr_mrg_rxbuf)) {= =0A= >> + *(struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)desc_addr =3D hdr;=0A= >> + } else {=0A= >> + *(struct virtio_net_hdr *)(uintptr_t)desc_addr =3D hdr.hdr;=0A= >> + }=0A= >> +}=0A= >> +=0A= > Don't use {} around single statements.=0A= There are other cs issues, like=0A= used_idx =3D vq->last_used_idx & (vq->size -1);=0A= ^ space needed=0A= Please run checkpatch against your patch.=0A= > Since you are doing all this casting, why not just use regular old memcpy= =0A= > which will be inlined by Gcc into same instructions anyway.=0A= > And since are always casting the desc_addr, why not pass a type that=0A= > doesn't need the additional cast (like void *)=0A= >=0A= =0A=