From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28E96A0524; Tue, 13 Apr 2021 05:26:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06027160A01; Tue, 13 Apr 2021 05:26:50 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 46BE31609F1 for ; Tue, 13 Apr 2021 05:26:48 +0200 (CEST) IronPort-SDR: Q/XoPVjySdmr6oXRR5ybr7PaSW4jNlVWFhezf+DNupTUegpJBvdKn/3Kg4qnFid3hH7Owi3sGP 1zSPegzyVcpw== X-IronPort-AV: E=McAfee;i="6200,9189,9952"; a="181456163" X-IronPort-AV: E=Sophos;i="5.82,218,1613462400"; d="scan'208";a="181456163" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 20:26:45 -0700 IronPort-SDR: 6JbKk3nLnx0o6/YZ66P7tHMsQi8gscTwxwurRmBf9QGWOV9qaytlwGCQfKj9a3Y3iTcsqhCAoz GopceuXTmZ3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,218,1613462400"; d="scan'208";a="451766782" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga002.fm.intel.com with ESMTP; 12 Apr 2021 20:26:45 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 12 Apr 2021 20:26:44 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Mon, 12 Apr 2021 20:26:44 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Mon, 12 Apr 2021 20:26:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LFAHy8FDSOnPb7e0LCRMNwTHKOGZfebJUYLx/RfUfySp2CqQ6rQeQ/a7rq1id3/P5wv6TKUMsCndh8wQ8a+5iTBakN1URM8ECRLWpB+/TiCWubF0VDOzkuAwvTqbMr2NnKjjRXyB/uB2zjoP9iNXt93rUcMNpqU46IDBK6/sgGGAMDAEMpPBmUhwJB49doFJhhtCAHcaCo6eAuXdrpErK0rX+f4cfUJz6pUEEWwguhMpnEPWF/2WdoluAfSkH+hDvpKK7t53QZmElO0MqZcM6qWu/Es4lXgza8dfnBMpfWkPSJhIrzpnRtXw+KkqnKZ/kGtSqVSrM7cz4/4SwKvfXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QB7z+NPXpr7xTRIAmGyCRTRsIBPRTXOMIs/ElAmtauU=; b=nnhY6CvLK1TiUaiExTseTDxp0ly0YWh41E2r8+eUFUKVOG1iPKbA6LTaWkewyUUB7XlPdmX/h9Qo3s3QxGDUfXe5lRrOBIEOD2sR0pP8bcNfKQhS6absM64qSumqSLZh3+Aa2o/lREQF3aYxGTbFvENoLspN8OGZvzw9wnyN6EYXJolUXBd3UUWqofbhtw4eaxCayn4ogv+L9QyMee9J4x/HnR2Pedo970cHwZYwrhPaAGjOWXySs3G051DUWdd67emjnWKqmSzaAz3U5yeo3+p2zkR6to//8QqzlXMPRxwpIUNfmjvAD58lHFQU9raJH43i+5WOpERNZxHYLcMdmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QB7z+NPXpr7xTRIAmGyCRTRsIBPRTXOMIs/ElAmtauU=; b=DjykyF447hYPV0tCaLvMEgHWa0n/aa5Kb0L1zY40w/ptRrmKi/6h+EAdSZbc4IxCOmKqhCnyHWUOf0ze9eiA/M1H5q9GuZ6tEVx/7SaBmQia7UZzhSmOxIz8Ceo7eNgFdvFtaPGRI3cUtLp+GgqytSUry1Aj65Urv4fwaEoRmFo= Received: from SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) by BY5PR11MB4150.namprd11.prod.outlook.com (2603:10b6:a03:190::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 03:26:41 +0000 Received: from SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::522:5b2:4210:a4b3]) by SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::522:5b2:4210:a4b3%7]) with mapi id 15.20.4020.022; Tue, 13 Apr 2021 03:26:41 +0000 From: "Jiang, Cheng1" To: "Hu, Jiayu" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "Yang, YvonneX" , "Wang, Yinan" , "Liu, Yong" Thread-Topic: [PATCH v5 1/4] vhost: abstract and reorganize async split ring code Thread-Index: AQHXL5Gts8KlbL2ZXE+6VMg7Yn9WJKqxvpuAgAAKwkA= Date: Tue, 13 Apr 2021 03:26:41 +0000 Message-ID: References: <20210317085426.10119-1-Cheng1.jiang@intel.com> <20210412113430.17587-1-Cheng1.jiang@intel.com> <20210412113430.17587-2-Cheng1.jiang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4e75c9e3-a400-4554-51ad-08d8fe2bf49c x-ms-traffictypediagnostic: BY5PR11MB4150: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:262; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4clSI1oSZwXlTXikOKEp3xfCToa/An4F+N8zeClaa56wMq/5MrBnkXu3ZpfQf+GB+MQsSjwVO7CC5bPbkrRbOQAgZgKhMwrrau+uviVlvHDT5BKLg5SaFDOOI+TiYV0O8KynYF41fpLmx6uoL0+8MTHBzzU/hpiyv5wvOcl5BCaSw1s3U2UdWBYg1L3QNXzwB8IPgj/bNzYpKecNiBLMThHdBWJQqO3GMaIu30F59W4x/etLB6fsmLFpSEPGRhUDwxbuQYAziCsIloV5gIKKlJ8WZ7KXGrlyr6vSLoUS5W+qINTqPBJ2rar5Qt/2f8t/wYX71mOQCDjSrScoPiboG3rzJWEuB3jgxmzThaiANp2l+W8S20j3orEZffxqEgzQyCY00ruZEM6GG2a84beGJnhX3K548JxBcBU6e25S2tlkga++PgJmzo7eKTcBKg6iTLBhW9v7lfCIsgs9MDDV5gaPRB9aJACjNUxzKjeFSKnvLU1xOat6tq3TwMqNlQk0EBDAP4flSWbUcjvk/arpJI5Vdixrvu9Lvpskc3hv40Hf6ypLclpPc49OBPfTZoBDVxRNGOZemIupI9KZU0VTTy4jDv5mnCUqQUl1CBgLLvM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5006.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(366004)(346002)(396003)(136003)(39860400002)(71200400001)(4326008)(33656002)(6506007)(8676002)(52536014)(6636002)(9686003)(76116006)(122000001)(107886003)(86362001)(110136005)(8936002)(83380400001)(26005)(186003)(53546011)(55016002)(66476007)(64756008)(54906003)(66946007)(66446008)(66556008)(7696005)(38100700002)(2906002)(316002)(478600001)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?uOOtgZ0d+fS+h22l6ui01RGXXlVWYfnGy1KiewQXfBel28P6VvYFEDjSBM/t?= =?us-ascii?Q?71T24c8slLhgNT4VGGOvvv4g1E4mvgoyJuZbe9+E+tt9k3LqP5qFsaF68n8v?= =?us-ascii?Q?SNbFnC98B+A/h3jeqqFIsC8EWdM5IEWkv5roTQIDkYE8OF5KcpyfKcuNBzf1?= =?us-ascii?Q?NNZppwbV5lHxr4twgLs/r2+Cxqtj9pPrc0MVNdNXsf+aVu0Vwy3ToRPprilH?= =?us-ascii?Q?+YA52iAMGDef5/YaGf9aOCuEbbFdjfSBXq9RZro+RtMZdBmsFyrK0u+p+rnL?= =?us-ascii?Q?+pN6jqdtlfKRiQy4xZC61/Z6PpHpNEfs0LJgBeu21w54KUtW/9OEex3u4uCx?= =?us-ascii?Q?2wz20bXIuLjJC+J9elj6122wYwcKuoOJ9F858t/3F8MDLBQB67pRf1tH5Gym?= =?us-ascii?Q?b0CIB3XOHYbU8A+BBTz4rGozBWuWlgFs4TcOtIfvesWY4K3A8Th2j4xDThBn?= =?us-ascii?Q?VNi8F063SU8ScfxLpcnLlh5kU8MoAs7XknlmTpenZ8O3o3mXdDd3zlNf2u/S?= =?us-ascii?Q?hvlkjb6GJ73HEiCtHWQTxXI9OT5FAmcUmjs7mUhOdofUXxOTDk8y1MQ/L5q3?= =?us-ascii?Q?GryURQoCe40BeK5rMomSGZDBF1EgyjdwoIR9XGhcbCVtggk+IrjP/m3Nm7jJ?= =?us-ascii?Q?dSgvqud7otbgpsqHS8OtivxJxVVdVaPTA4usffj4m4EM2fqUheuHjbdNoFqy?= =?us-ascii?Q?PzgjaydGrWo752NX1SEmtvjfL7UaHxq+HNdIn/ecmJYwQ5Obzd2BYdS8lvxS?= =?us-ascii?Q?EI1Jn47wjsJOY4qgHloP76DY8eO7sFNin6cguZG9AnH8+WRUTWtXFnKMxFRI?= =?us-ascii?Q?vjHn0K0vTL6RfzlVTaSFUEdzsA9gwaVjCPFBb3XcG5ZUTBxHBJCuzD4Y8Zdy?= =?us-ascii?Q?2ZmyyMDW5JryeThC+bANVxv6f45RAavcgWn3lgl9C1Tbgbl//vwAxZyyzwGs?= =?us-ascii?Q?EYjBAnkP85FVQdM0hvwVMsr8XIKZLhNebt9AcaN9JO4x/EVECES1LDNeeaUW?= =?us-ascii?Q?ShdrVc7JjR67OdkMYV5RI9FTJSvINbe3tLVNJp/PU7q/N93HwRFpd71qPPab?= =?us-ascii?Q?LxFhkom0hQsxpT6svFVP+EQ8iePAatVX1kTOfeCkupsP6e3UCQG2p0FzNupq?= =?us-ascii?Q?ACipaKp1tcX9VYcxlkAeP6vMV4k1bJFAKC0zZAKUBdWCH6olCIXS6sl8XjuT?= =?us-ascii?Q?Yj2xWDyMLIXtNokzIA9bW+nXvohFw6YL5xErvB5PqqHkx+o/kjTBmvQePCxr?= =?us-ascii?Q?GH1KzhBZSOj3Yv0oLy2Fdy6Y4Y8xlbPJ8mgaubpdXHAoWuGhndIELTShA4NM?= =?us-ascii?Q?QjQJ44CBPruGQ/Gc4Gvc6azF?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5006.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e75c9e3-a400-4554-51ad-08d8fe2bf49c X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Apr 2021 03:26:41.2445 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 83x0aLhPK/Gs4IX4WJ4es60Hihm7WsNOlsku7RSZnIrrT9qq/PHXbxQXGzT1OvTTI0s34lLV0UdHZUW/49xzuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4150 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 1/4] vhost: abstract and reorganize async split ring code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Jiayu, > -----Original Message----- > From: Hu, Jiayu > Sent: Tuesday, April 13, 2021 10:44 AM > To: Jiang, Cheng1 ; maxime.coquelin@redhat.com; > Xia, Chenbo > Cc: dev@dpdk.org; Yang, YvonneX ; Wang, Yinan > ; Liu, Yong > Subject: RE: [PATCH v5 1/4] vhost: abstract and reorganize async split ri= ng > code >=20 > Hi Cheng, >=20 > Some comments inline. >=20 > > -----Original Message----- > > From: Jiang, Cheng1 > > Sent: Monday, April 12, 2021 7:34 PM > > To: maxime.coquelin@redhat.com; Xia, Chenbo > > Cc: dev@dpdk.org; Hu, Jiayu ; Yang, YvonneX > > ; Wang, Yinan ; Liu, > > Yong ; Jiang, Cheng1 > > Subject: [PATCH v5 1/4] vhost: abstract and reorganize async split > > ring code > > > > In order to improve code efficiency and readability when async packed > > ring support is enabled. This patch abstract some functions like > > shadow_ring_store and write_back_completed_descs_split. And improve > > the efficiency of some pointer offset calculation. >=20 > Need to improve grammar for commit log, as there is typo and incomplete > sentence. >=20 Sure, I'll fix it in the next version. > > > > Signed-off-by: Cheng Jiang > > --- > > lib/librte_vhost/virtio_net.c | 146 > > +++++++++++++++++++--------------- > > 1 file changed, 84 insertions(+), 62 deletions(-) > > > > diff --git a/lib/librte_vhost/virtio_net.c > > b/lib/librte_vhost/virtio_net.c index ff3987860..c43ab0093 100644 > > --- a/lib/librte_vhost/virtio_net.c > > +++ b/lib/librte_vhost/virtio_net.c > > @@ -1458,6 +1458,29 @@ virtio_dev_rx_async_get_info_idx(uint16_t > > pkts_idx, > > (vq_size - n_inflight + pkts_idx) & (vq_size - 1); } > > > > +static __rte_always_inline void > > +shadow_ring_store(struct vhost_virtqueue *vq, void *shadow_ring, > > +void > > *d_ring, > > +uint16_t s_idx, uint16_t d_idx, > > +uint16_t count, uint16_t elem_size) > > +{ > > +if (d_idx + count <=3D vq->size) { > > +rte_memcpy((void *)((uintptr_t)d_ring + d_idx * elem_size), (void > > +*)((uintptr_t)shadow_ring + s_idx * elem_size), count * elem_size); } > > +else { uint16_t size =3D vq->size - d_idx; > > + > > +rte_memcpy((void *)((uintptr_t)d_ring + d_idx * elem_size), (void > > +*)((uintptr_t)shadow_ring + s_idx * elem_size), size * elem_size); > > + > > +rte_memcpy((void *)((uintptr_t)d_ring), (void > > +*)((uintptr_t)shadow_ring + (s_idx + size) * elem_size), (count - > > +size) * elem_size); } } > > + > > static __rte_noinline uint32_t > > virtio_dev_rx_async_submit_split(struct virtio_net *dev, struct > > vhost_virtqueue *vq, uint16_t queue_id, @@ -1478,6 +1501,7 @@ > > virtio_dev_rx_async_submit_split(struct virtio_net *dev, struct > > rte_vhost_iov_iter *dst_it =3D it_pool + 1; uint16_t slot_idx =3D 0; > > uint16_t segs_await =3D 0; > > +uint16_t iovec_idx =3D 0, it_idx =3D 0; > > struct async_inflight_info *pkts_info =3D vq->async_pkts_info; > > uint32_t n_pkts =3D 0, pkt_err =3D 0; uint32_t num_async_pkts =3D 0, > > num_done_pkts =3D 0; @@ -1513,27 +1537,32 @@ > > virtio_dev_rx_async_submit_split(struct > > virtio_net *dev, > > > > if (async_mbuf_to_desc(dev, vq, pkts[pkt_idx], buf_vec, nr_vec, > > num_buffers, -src_iovec, dst_iovec, src_it, dst_it) < 0) { > > +&src_iovec[iovec_idx], > > +&dst_iovec[iovec_idx], > > +&src_it[it_idx], > > +&dst_it[it_idx]) < 0) { >=20 > When use index, it's strange to get src and dst iov_iter from dst_it and = src_it > respectively, as they are not start addresses of two separated iov_iter a= rrays > but have overlapped elements. IMO, there is no need to use src/dst_it, as > they can be simply indexed by it_pool[it_idx] and it_pool[it_idx+1]. Yes, I think it make sense, I'll fix it in the next version. >=20 > > vq->shadow_used_idx -=3D num_buffers; > > break; > > } > > > > slot_idx =3D (vq->async_pkts_idx + num_async_pkts) & (vq->size - 1); > > -if (src_it->count) { > > +if (src_it[it_idx].count) { > > uint16_t from, to; > > > > -async_fill_desc(&tdes[pkt_burst_idx++], src_it, dst_it); > > +async_fill_desc(&tdes[pkt_burst_idx++], > > +&src_it[it_idx], > > +&dst_it[it_idx]); > > pkts_info[slot_idx].descs =3D num_buffers; pkts_info[slot_idx].mbuf = =3D > > pkts[pkt_idx]; async_pkts_log[num_async_pkts].pkt_idx =3D pkt_idx; > > async_pkts_log[num_async_pkts++].last_avail_idx =3D vq->last_avail_idx= ; > > -src_iovec +=3D src_it->nr_segs; -dst_iovec +=3D dst_it->nr_segs; -src_= it > > +=3D 2; -dst_it +=3D 2; -segs_await +=3D src_it->nr_segs; > > + > > +iovec_idx +=3D src_it[it_idx].nr_segs; > > +it_idx +=3D 2; > > + > > +segs_await +=3D src_it[it_idx].nr_segs; > > > > /** > > * recover shadow used ring and keep DMA-occupied @@ -1541,23 > > +1570,12 @@ virtio_dev_rx_async_submit_split(struct > > virtio_net *dev, > > */ > > from =3D vq->shadow_used_idx - num_buffers; to =3D vq->async_desc_idx= & > > (vq->size - 1); -if (num_buffers + to <=3D vq->size) { > > -rte_memcpy(&vq->async_descs_split[to], > > -&vq- > > >shadow_used_split[from], > > -num_buffers * > > -sizeof(struct > > vring_used_elem)); > > -} else { > > -int size =3D vq->size - to; > > - > > -rte_memcpy(&vq->async_descs_split[to], > > -&vq- > > >shadow_used_split[from], > > -size * > > -sizeof(struct > > vring_used_elem)); > > -rte_memcpy(vq->async_descs_split, > > -&vq- > > >shadow_used_split[from + > > -size], (num_buffers - size) * > > - sizeof(struct vring_used_elem)); > > -} > > + > > +shadow_ring_store(vq, vq->shadow_used_split, > > +vq->async_descs_split, > > +from, to, num_buffers, > > +sizeof(struct vring_used_elem)); >=20 > This function is to store DMA-occupied desc, but " shadow_ring_store" is = not > a good name for it. In addition, I think there is no need to pass vq as a > parameter. What you need is the size of shadow ring and async desc ring. Ok, I think we can use the name " store_dma_desc_info()". Thanks a lot. Cheng >=20 > Thanks, > Jiayu > > + > > vq->async_desc_idx +=3D num_buffers; > > vq->shadow_used_idx -=3D num_buffers; > > } else > > @@ -1575,10 +1593,9 @@ virtio_dev_rx_async_submit_split(struct > > virtio_net *dev, > > BUF_VECTOR_MAX))) { > > n_pkts =3D vq->async_ops.transfer_data(dev->vid, > > queue_id, tdes, 0, pkt_burst_idx); > > -src_iovec =3D vec_pool; > > -dst_iovec =3D vec_pool + (VHOST_MAX_ASYNC_VEC >> 1); -src_it =3D it_po= ol; > > -dst_it =3D it_pool + 1; > > +iovec_idx =3D 0; > > +it_idx =3D 0; > > + > > segs_await =3D 0; > > vq->async_pkts_inflight_n +=3D n_pkts; > > > > @@ -1639,6 +1656,43 @@ virtio_dev_rx_async_submit_split(struct > > virtio_net *dev, > > return pkt_idx; > > } > > > > +static __rte_always_inline void > > +write_back_completed_descs_split(struct vhost_virtqueue *vq, uint16_t > > n_descs) > > +{ > > +uint16_t nr_left =3D n_descs; > > +uint16_t nr_copy; > > +uint16_t to, from; > > + > > +do { > > +from =3D vq->last_async_desc_idx & (vq->size - 1); nr_copy =3D nr_left= + > > +from <=3D vq->size ? nr_left : > > +vq->size - from; > > +to =3D vq->last_used_idx & (vq->size - 1); > > + > > +if (to + nr_copy <=3D vq->size) { > > +rte_memcpy(&vq->used->ring[to], > > +&vq->async_descs_split[from], > > +nr_copy * > > +sizeof(struct vring_used_elem)); > > +} else { > > +uint16_t size =3D vq->size - to; > > + > > +rte_memcpy(&vq->used->ring[to], > > +&vq->async_descs_split[from], > > +size * > > +sizeof(struct vring_used_elem)); > > +rte_memcpy(vq->used->ring, > > +&vq->async_descs_split[from + > > +size], (nr_copy - size) * > > +sizeof(struct vring_used_elem)); > > +} > > + > > +vq->last_async_desc_idx +=3D nr_copy; > > +vq->last_used_idx +=3D nr_copy; > > +nr_left -=3D nr_copy; > > +} while (nr_left > 0); > > +} > > + > > uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, > > struct rte_mbuf **pkts, uint16_t count) { @@ -1695,39 +1749,7 @@ > > uint16_t rte_vhost_poll_enqueue_completed(int > > vid, uint16_t queue_id, > > vq->async_pkts_inflight_n -=3D n_pkts_put; > > > > if (likely(vq->enabled && vq->access_ok)) { -uint16_t nr_left =3D > > n_descs; -uint16_t nr_copy; -uint16_t to; > > - > > -/* write back completed descriptors to used ring */ -do { -from =3D > > vq->last_async_desc_idx & (vq->size - 1); -nr_copy =3D nr_left + from <= =3D > > vq->size ? nr_left : > > -vq->size - from; > > -to =3D vq->last_used_idx & (vq->size - 1); > > - > > -if (to + nr_copy <=3D vq->size) { > > -rte_memcpy(&vq->used->ring[to], > > -&vq- > > >async_descs_split[from], > > -nr_copy * > > -sizeof(struct > > vring_used_elem)); > > -} else { > > -uint16_t size =3D vq->size - to; > > - > > -rte_memcpy(&vq->used->ring[to], > > -&vq- > > >async_descs_split[from], > > -size * > > -sizeof(struct > > vring_used_elem)); > > -rte_memcpy(vq->used->ring, > > -&vq->async_descs_split[from > > + > > -size], (nr_copy - size) * > > -sizeof(struct > > vring_used_elem)); > > -} > > - > > -vq->last_async_desc_idx +=3D nr_copy; > > -vq->last_used_idx +=3D nr_copy; > > -nr_left -=3D nr_copy; > > -} while (nr_left > 0); > > +write_back_completed_descs_split(vq, n_descs); > > > > __atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE); > > vhost_vring_call_split(dev, vq); > > -- > > 2.29.2 >=20