From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 003B1A09FF; Mon, 28 Dec 2020 03:50:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 399252BA2; Mon, 28 Dec 2020 03:50:38 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id EE11E2B94 for ; Mon, 28 Dec 2020 03:50:34 +0100 (CET) IronPort-SDR: atssTMczBio5qkb4Sbgpqlp64ci/zbCG+EFTeYPo4lcbHTvHWTs431S5h+cRriGhFO8UfLV/0H oR4lvFI451kw== X-IronPort-AV: E=McAfee;i="6000,8403,9847"; a="194816516" X-IronPort-AV: E=Sophos;i="5.78,453,1599548400"; d="scan'208";a="194816516" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2020 18:50:33 -0800 IronPort-SDR: jqEWkZdOUi149nwSMHg4DvO4JwaVZlY0f5MHyLyKldDbA3r0IoYHPg3aO88txna4w47mAUYUr+ 54BSpMV83yRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,453,1599548400"; d="scan'208";a="384420597" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga007.jf.intel.com with ESMTP; 27 Dec 2020 18:50:32 -0800 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 27 Dec 2020 18:50:32 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 28 Dec 2020 10:50:30 +0800 Received: from shsmsx606.ccr.corp.intel.com ([10.109.6.216]) by SHSMSX606.ccr.corp.intel.com ([10.109.6.216]) with mapi id 15.01.1713.004; Mon, 28 Dec 2020 10:50:30 +0800 From: "Hu, Jiayu" To: "Jiang, Cheng1" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "Yang, YvonneX" Thread-Topic: [PATCH v4 1/2] examples/vhost: add ioat ring space count and check Thread-Index: AQHW2paP9p2krDTYy0+9qFF7+s+bjqoL0blg Date: Mon, 28 Dec 2020 02:50:30 +0000 Message-ID: References: <20201218113327.70528-1-Cheng1.jiang@intel.com> <20201225080712.36177-1-Cheng1.jiang@intel.com> <20201225080712.36177-2-Cheng1.jiang@intel.com> In-Reply-To: <20201225080712.36177-2-Cheng1.jiang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 1/2] examples/vhost: add ioat ring space count and check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 Cheng, > -----Original Message----- > From: Jiang, Cheng1 > Sent: Friday, December 25, 2020 4:07 PM > To: maxime.coquelin@redhat.com; Xia, Chenbo > Cc: dev@dpdk.org; Hu, Jiayu ; Yang, YvonneX > ; Jiang, Cheng1 > Subject: [PATCH v4 1/2] examples/vhost: add ioat ring space count and che= ck >=20 > Add ioat ring space count and check, if ioat ring space is not enough > for the next async vhost packet enqueue, then just return to prevent > enqueue failure. >=20 > Signed-off-by: Cheng Jiang > --- > examples/vhost/ioat.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) >=20 > diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c > index 71d8a1f1f..b0b04aa45 100644 > --- a/examples/vhost/ioat.c > +++ b/examples/vhost/ioat.c > @@ -17,6 +17,7 @@ struct packet_tracker { > unsigned short next_read; > unsigned short next_write; > unsigned short last_remain; > + unsigned short ioat_space; > }; >=20 > struct packet_tracker cb_tracker[MAX_VHOST_DEVICE]; > @@ -113,7 +114,7 @@ open_ioat(const char *value) > goto out; > } > rte_rawdev_start(dev_id); > - > + cb_tracker[dev_id].ioat_space =3D IOAT_RING_SIZE; > dma_info->nr++; > i++; > } > @@ -140,13 +141,9 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id, > src =3D descs[i_desc].src; > dst =3D descs[i_desc].dst; > i_seg =3D 0; > + if (cb_tracker[dev_id].ioat_space < src->nr_segs) > + break; > while (i_seg < src->nr_segs) { > - /* > - * TODO: Assuming that the ring space of the > - * IOAT device is large enough, so there is no > - * error here, and the actual error handling > - * will be added later. > - */ > rte_ioat_enqueue_copy(dev_id, > (uintptr_t)(src->iov[i_seg].iov_base) > + src->offset, > @@ -158,7 +155,8 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id, > i_seg++; > } > write &=3D mask; > - cb_tracker[dev_id].size_track[write] =3D i_seg; > + cb_tracker[dev_id].size_track[write] =3D src->nr_segs; > + cb_tracker[dev_id].ioat_space -=3D src->nr_segs; > write++; > } > } else { > @@ -186,6 +184,7 @@ ioat_check_completed_copies_cb(int vid, uint16_t > queue_id, > int dev_id =3D dma_bind[vid].dmas[queue_id * 2 > + VIRTIO_RXQ].dev_id; > n_seg =3D rte_ioat_completed_ops(dev_id, 255, dump, dump); > + cb_tracker[dev_id].ioat_space +=3D n_seg; rte_ioat_completed_ops() may fail. In this case, its return value is -1, wh= ich will cause n_seg to 65534. Thanks, Jiayu > n_seg +=3D cb_tracker[dev_id].last_remain; > if (!n_seg) > return 0; > -- > 2.29.2