From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBB08A09FF; Tue, 5 Jan 2021 07:56:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 585AE1607B7; Tue, 5 Jan 2021 07:56:54 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 7EBFF1607B6 for ; Tue, 5 Jan 2021 07:56:52 +0100 (CET) IronPort-SDR: iKXZQs/ih9G4uqjSqlHBYxOF2DPALXqu3znMRODILlaOwobh9pFyANG9mX7WLqFkk/Z14leqsL hL9DyaxRnUiw== X-IronPort-AV: E=McAfee;i="6000,8403,9854"; a="164135392" X-IronPort-AV: E=Sophos;i="5.78,476,1599548400"; d="scan'208";a="164135392" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2021 22:56:50 -0800 IronPort-SDR: CrwlSKlu90O/YKhuqZRRwDLjTMWyFtEfVCwh/Uzh3O1+xGXwZuifucV2nVknlzIM4zHuIFqGeK ROgkLbdyWJng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,476,1599548400"; d="scan'208";a="349772020" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga006.jf.intel.com with ESMTP; 04 Jan 2021 22:56:50 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 Jan 2021 22:56:49 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 5 Jan 2021 14:56:48 +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; Tue, 5 Jan 2021 14:56:48 +0800 From: "Hu, Jiayu" To: "Jiang, Cheng1" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "Yang, YvonneX" , "Wang, Yinan" Thread-Topic: [PATCH v7 1/2] examples/vhost: add ioat ring space count and check Thread-Index: AQHW4wn2ovDNToeCN06O+5VJNbhboqoYmarA Date: Tue, 5 Jan 2021 06:56:48 +0000 Message-ID: <3d5539874c934cf5a5ae5c551c52690b@intel.com> References: <20201218113327.70528-1-Cheng1.jiang@intel.com> <20210105021502.33158-1-Cheng1.jiang@intel.com> <20210105021502.33158-2-Cheng1.jiang@intel.com> In-Reply-To: <20210105021502.33158-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 v7 1/2] examples/vhost: add ioat ring space count and check 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" Reviewed-by: Jiayu Hu > -----Original Message----- > From: Jiang, Cheng1 > Sent: Tuesday, January 5, 2021 10:15 AM > To: maxime.coquelin@redhat.com; Xia, Chenbo > Cc: dev@dpdk.org; Hu, Jiayu ; Yang, YvonneX > ; Wang, Yinan ; Jiang, > Cheng1 > Subject: [PATCH v7 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. Add rte_ioat_completed_ops() fail handler. >=20 > Signed-off-by: Cheng Jiang > --- > examples/vhost/ioat.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) >=20 > diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c > index 71d8a1f1f5..dbad28d43e 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 { > @@ -178,17 +176,21 @@ ioat_check_completed_copies_cb(int vid, uint16_t > queue_id, > { > if (!opaque_data) { > uintptr_t dump[255]; > - unsigned short n_seg; > + int n_seg; > unsigned short read, write; > unsigned short nb_packet =3D 0; > unsigned short mask =3D MAX_ENQUEUED_SIZE - 1; > unsigned short i; > + > 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); > - n_seg +=3D cb_tracker[dev_id].last_remain; > - if (!n_seg) > + if (n_seg <=3D 0) > return 0; > + > + cb_tracker[dev_id].ioat_space +=3D n_seg; > + n_seg +=3D cb_tracker[dev_id].last_remain; > + > read =3D cb_tracker[dev_id].next_read; > write =3D cb_tracker[dev_id].next_write; > for (i =3D 0; i < max_packets; i++) { > -- > 2.29.2