From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id DD8EF69FB for ; Fri, 19 Aug 2016 09:07:45 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 19 Aug 2016 00:07:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,544,1464678000"; d="scan'208";a="1028211023" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 19 Aug 2016 00:07:46 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 19 Aug 2016 00:07:44 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 19 Aug 2016 00:07:44 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.150]) with mapi id 14.03.0248.002; Fri, 19 Aug 2016 15:07:42 +0800 From: "Wang, Zhihong" To: Yuanhan Liu CC: "dev@dpdk.org" , "maxime.coquelin@redhat.com" Thread-Topic: [PATCH v2 1/6] vhost: rewrite enqueue Thread-Index: AQHR+VY0driASqbME0+6uzanc8SwvaBPDQIAgADQ3eA= Date: Fri, 19 Aug 2016 07:07:42 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE094110772A97@SHSMSX103.ccr.corp.intel.com> References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> <1471501991-37257-1-git-send-email-zhihong.wang@intel.com> <1471501991-37257-2-git-send-email-zhihong.wang@intel.com> <20160819023924.GA30752@yliu-dev.sh.intel.com> In-Reply-To: <20160819023924.GA30752@yliu-dev.sh.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmZhMTY5MGMtZjVjNC00YzYzLTgzNDMtM2VkMWMxY2JlYWY3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImZSdmtjc2EyM2NiVXpkUWYweVwvcjJIUnZHVXZUQVYzSG9KdTBXd2lUSnkwPSJ9 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 v2 1/6] vhost: rewrite enqueue 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: Fri, 19 Aug 2016 07:07:46 -0000 > -----Original Message----- > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > Sent: Friday, August 19, 2016 10:39 AM > To: Wang, Zhihong > Cc: dev@dpdk.org; maxime.coquelin@redhat.com > Subject: Re: [PATCH v2 1/6] vhost: rewrite enqueue >=20 > On Thu, Aug 18, 2016 at 02:33:06AM -0400, Zhihong Wang wrote: > > This patch implements the vhost logic from scratch into a single functi= on > > designed for high performance and better maintainability. > > > > Signed-off-by: Zhihong Wang > > --- > > lib/librte_vhost/vhost_rxtx.c | 212 > ++++++++++++++++++++++++++++++++++++++++-- > > 1 file changed, 205 insertions(+), 7 deletions(-) > > > > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxt= x.c > > index 08a73fd..8e6d782 100644 > > --- a/lib/librte_vhost/vhost_rxtx.c > > +++ b/lib/librte_vhost/vhost_rxtx.c > > @@ -91,7 +91,7 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx, uint= 32_t > qp_nb) > > return (is_tx ^ (idx & 1)) =3D=3D 0 && idx < qp_nb * VIRTIO_QNUM; > > } > > > > -static void > > +static inline void __attribute__((always_inline)) > > virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr > *net_hdr) > > { > > if (m_buf->ol_flags & PKT_TX_L4_MASK) { > > @@ -533,19 +533,217 @@ virtio_dev_merge_rx(struct virtio_net *dev, > uint16_t queue_id, > > return pkt_idx; > > } > > > > +static inline uint32_t __attribute__((always_inline)) > > +loop_check(struct vhost_virtqueue *vq, uint16_t avail_idx, uint32_t pk= t_left) > > +{ > > + if (pkt_left =3D=3D 0 || avail_idx =3D=3D vq->last_used_idx) > > + return 1; > > + > > + return 0; > > +} >=20 > Hmmm, I don't see any benifit from making such simple check into a > function. It's for prefetch code later to be merged into this function. >=20 > > +static inline uint32_t __attribute__((always_inline)) > > +enqueue_packet(struct virtio_net *dev, struct vhost_virtqueue *vq, > > + uint16_t avail_idx, struct rte_mbuf *mbuf, > > + uint32_t is_mrg_rxbuf) > > +{ > > + struct virtio_net_hdr_mrg_rxbuf *virtio_hdr; > > + struct vring_desc *desc; > > + uint64_t desc_host_write_addr =3D 0; > > + uint32_t desc_chain_head =3D 0; > > + uint32_t desc_chain_len =3D 0; > > + uint32_t desc_current =3D 0; > > + uint32_t desc_write_offset =3D 0; > > + uint32_t mbuf_len =3D 0; > > + uint32_t mbuf_len_left =3D 0; > > + uint32_t copy_len =3D 0; >=20 > The dequeue function uses var like desc_addr, desc_avail, desc_offset, > mbuf_avail, ..., I see no reason to use something different here. This > breaks the code consistency. Besides that, var name like desc_host_write_= addr > looks redundant; desc_addr is much cleaner. Okay. >=20 > --yliu