From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 7578E8D8B for ; Wed, 14 Sep 2016 10:20:47 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 14 Sep 2016 01:20:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,333,1470726000"; d="scan'208";a="8368481" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga005.jf.intel.com with ESMTP; 14 Sep 2016 01:20:46 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Sep 2016 01:20:27 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Sep 2016 01:20:27 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.102]) by shsmsx102.ccr.corp.intel.com ([169.254.2.109]) with mapi id 14.03.0248.002; Wed, 14 Sep 2016 16:20:20 +0800 From: "Wang, Zhihong" To: Maxime Coquelin , "dev@dpdk.org" CC: "yuanhan.liu@linux.intel.com" , "thomas.monjalon@6wind.com" Thread-Topic: [PATCH v5 2/6] vhost: rewrite enqueue Thread-Index: AQHSCoeNcn9kbXCHkk+YuIauq+7H46B1fWsAgAMu1JA= Date: Wed, 14 Sep 2016 08:20:20 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE09414E70FB1C@SHSMSX103.ccr.corp.intel.com> References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> <1473392368-84903-1-git-send-email-zhihong.wang@intel.com> <1473392368-84903-3-git-send-email-zhihong.wang@intel.com> <2cc970ca-ea2c-8e3b-069a-9f1ec1182b03@redhat.com> In-Reply-To: <2cc970ca-ea2c-8e3b-069a-9f1ec1182b03@redhat.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 v5 2/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: Wed, 14 Sep 2016 08:20:47 -0000 > > + desc_current =3D > > + vq->avail->ring[(vq->last_used_idx) > & > > + (vq->size - 1)]; > > + desc_chain_head =3D desc_current; > > + desc =3D &vq->desc[desc_current]; > > + desc_addr =3D gpa_to_vva(dev, desc->addr); > > + if (unlikely(!desc_addr)) > > + goto error; > > > > - desc =3D &vq->desc[desc->next]; > > - desc_addr =3D gpa_to_vva(dev, desc->addr); > > - if (unlikely(!desc_addr)) > > - return -1; > > - > > - desc_offset =3D 0; > > - desc_avail =3D desc->len; > > + desc_chain_len =3D 0; > > + desc_offset =3D 0; > As I commented on v3, there is code duplication between next flag, and > mrg buf cases: > desc_offset =3D 0; >=20 > and: >=20 > desc =3D &vq->desc[desc_current]; > desc_addr =3D gpa_to_vva(dev, desc->addr); > if (unlikely(!desc_addr)) > goto error; >=20 Do you mean to add something like: static inline int __attribute__((always_inline)) get_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, uint32_t desc_idx, struct vring_desc **desc, uint64_t *desc_addr) { *desc =3D &vq->desc[desc_idx]; *desc_addr =3D gpa_to_vva(dev, (*desc)->addr); if (unlikely(!(*desc_addr))) return -1; return 0; } > Regards, > Maxime