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 57655A0547; Mon, 27 Sep 2021 08:34:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE83D40686; Mon, 27 Sep 2021 08:34:01 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 325D34003D for ; Mon, 27 Sep 2021 08:34:00 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10119"; a="211664763" X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="211664763" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2021 23:33:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="586666826" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga004.jf.intel.com with ESMTP; 26 Sep 2021 23:33:58 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) 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.2242.12; Sun, 26 Sep 2021 23:33:58 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 26 Sep 2021 23:33:57 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sun, 26 Sep 2021 23:33:57 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.42) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Sun, 26 Sep 2021 23:33:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1nzz9Hs66/lc1l4uaCUoQfXh+m42LHeGd72fkHyo30xBM7m7S/fhpgbbrLA3gyYrXft1tym9VIZNb+ZEXMZTtQeEOUX+RkVPE1dZHnqYPEGibL2c5NeQxzROHD/uIBalOP0Lahyut4aZGRXu6vDPaHM0zC3ySWj8wTNEwlgwi9iZ7nYqwRbw7EjDMa9O4NOlQaMpJMb//H6elsYEXQ3RggVNR7UXR5X+kTa4egyD2rdd34wX3MbSl7w8FP46tu3KRX62BCRkTywr8Fv6vhQddSx+zaWG0cf+FcbbA87CI8fIL/WIFCcjh91I1wxY/V0/8Lt1HMp0QX5x8i1pVJObQ== 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; bh=Ef2wsyCijSFVa0ptK8EBVwy/Hj29V8kCeWO8Q0NCv9E=; b=Tv1oYo9bzuhP0vto/JjJaEePTJgg6u9cRBWEAOAwRzwOCMAqjBv6O+zSn4wffiyBQLtCH1qp6zfaaaPsjp5uylqm/MjFfORjWJI9c50ZJIRdTfyP/eN5/3iWBrn0pQ0v56hcbp3TFwPgQxAVkBNlXjcKLSHSskl7ReFyqlWUSviC3C+Co86wV6+W5XDKh8sLsn/rF3nW0nTUqZ/B6dHAlbtJ6MzYoABPCX8uOLH9gO6WS5U+atTg+HjP9wl0oiMqYdwWht7wwrkWlh6XPVAqZe5ewNj2kcTXoquEG0ypLpaiFoTfz2S9gMLwJwT7R/W8WF1OP511qKcHK5CoJ2k/8A== 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=Ef2wsyCijSFVa0ptK8EBVwy/Hj29V8kCeWO8Q0NCv9E=; b=vdWiOIyEZJZYC21zdanMwh4Jn6VOKSuIJsy7aOSFEc9L+e7g//lZdoxxEtrCFB7UTtrxpxIEilPQrvBMlaPYEzpODAylKz+X0/tDDt/qpHGBf/oLfu0nJk47fkUK18PzFoKz5qa8YOqkdiipnbvSxSeR3N9Xw4229pb8x4D9BUs= Received: from SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) by BYAPR11MB3190.namprd11.prod.outlook.com (2603:10b6:a03:7b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Mon, 27 Sep 2021 06:33:55 +0000 Received: from SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::71ad:768b:b8af:ae80]) by SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::71ad:768b:b8af:ae80%5]) with mapi id 15.20.4544.021; Mon, 27 Sep 2021 06:33:55 +0000 From: "Jiang, Cheng1" To: "Ma, WenwuX" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "Hu, Jiayu" , "Pai G, Sunil" , "Yang, YvonneX" , "Wang, YuanX" , "Wang, Yinan" Thread-Topic: [PATCH v2 1/4] vhost: support async dequeue for split ring Thread-Index: AQHXq5aI0waJNY1+OUuGEyQa60TPAau3NY1A Date: Mon, 27 Sep 2021 06:33:54 +0000 Message-ID: References: <20210906204837.112466-1-wenwux.ma@intel.com> <20210917192703.385510-1-wenwux.ma@intel.com> <20210917192703.385510-2-wenwux.ma@intel.com> In-Reply-To: <20210917192703.385510-2-wenwux.ma@intel.com> 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-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 94d7434a-388c-48eb-9415-08d98180c771 x-ms-traffictypediagnostic: BYAPR11MB3190: 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:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CL8teI/4sSW5sHWcukqiRdYw5XZrNFAuKsrjKkyGVIPceq9epYij+Fpy4AaHVD+ly0gg06SecnDBTqP2ZNrztspaPeXqCJCq1TpHYt5cVzREelrrlWsBgw4Y8wJHk6wTY6lFltfIddEyeGj8tGzJYu38ofskmNwKzDYLUhRVRIUMW3NorH2OFRkrcyTvebjqFSnx8iioQK0D/c5LeXSzkOZp48m9T0opP7k0EO6/xggheV6rSxd7MjtOW6CXVMksdoYi1gX/uYYgcE2qYBlja9MyZPlPqoS4oiaffyxtcoa2qDdOaauRmuodyUM6xTMsD/1lf4D8RIaWWeyO8DZRRV2hSO0XTASMj9GAIJs4qZaPPQH9wNpE/hSZI23vzFVw5xD25a9ee+4eAyJK+TePzWzxmGeO0DMkjTlp22bQdrthwxlaAsoSXRuJsfA7QdUjdOWr6Mcaad7Bwl4id6EP0S+xV4wvYPbjhBJ/xeepqIGLD9hzw3UAD72aAcu9TQT3tiSZXXeVudAQr3b7yZXkcmsN+s26tHa7LCOhJ6jM2ftbTEKfASenLkAkhDBc5jVUBsDWsrq5S0i1yAdSpu83VIdgNkvox+wCCFjzF7zvtjNkrCrTv9cuTRoHGki8vnU0OXtCvnqAgC2d0nOxEgu02Xnp/7f/0HZUVqR8KGtxJ4Cn+w5N4D+45QtdCzHqQNzkpsWltadV2602idNJp6EnWg== 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:(4636009)(366004)(71200400001)(6506007)(55016002)(508600001)(122000001)(107886003)(186003)(26005)(7696005)(9686003)(83380400001)(33656002)(53546011)(86362001)(2906002)(38070700005)(66476007)(66556008)(64756008)(66446008)(8676002)(52536014)(66946007)(76116006)(4326008)(8936002)(38100700002)(110136005)(316002)(5660300002)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Nwg/hoIKGR9Cpbqqv8HGWB1v7mr3JhHDAK7xLN2wlbRTnj/ZEn1kIO4ev1Qf?= =?us-ascii?Q?9sNNsRnuaGLv25u0FOBR8e0EpWL9fF/48uNNvtSDPk9Ch9y5b6u61rx/y43k?= =?us-ascii?Q?qAHlQJ32PSvU75BbetB5JyGzkNgcAUt90795iETABLbGDSKKm0VAcWiR39df?= =?us-ascii?Q?R1/rnPiuGYuSI31DWM9kUEHfXEgKtmL57uwbqYKhf/jgRawNNpOvdGP9+aFc?= =?us-ascii?Q?fHj3PBFMqUH3msVwpFpkUx6PcPvrZqcmWDS/4rS2utiad3G2O0vkRWpSznJ/?= =?us-ascii?Q?0Q/M63zx0+6UN5zsCmpMutA0onxpXKM3Aq1NPw3sbqDEgKNjvgS7OBsNYvC8?= =?us-ascii?Q?ePEDdcn4P4lAif2u1yFNfvIj5g/7yFvS4OkTr3+wANxntXKBxQKN2XBxvVsJ?= =?us-ascii?Q?QecHHZEKeyf6epc9kMwRvEKXPjWKD9ZGQwvXFgn8D6pqivKRhtuMtGWDbP+9?= =?us-ascii?Q?L8pPGmVB2vN8lmXRz32kxgyBvPSty7cf7/DzRu2BZ+a4DlxH7zUnkcDlz6+e?= =?us-ascii?Q?DqMEllenCnMMUQYUKo1+2iObVurIxjC1RUxDqhQS1AKiiGl0yZkWuyhV0x4k?= =?us-ascii?Q?oERqLFZCcukOAKfTMBcu3Ge3VuHk80+ZUTK46lR/rWpIMFhsaCZLHCk25TZC?= =?us-ascii?Q?CngITubSO3kC3tmv901H9Bc+tlQ4eDXJW/n81T74NWnXuDyY9hswLIudl8aa?= =?us-ascii?Q?7PgSWM2myNV3f/LMKlpDm9YW0rFZcxDvsOmqEA4UISZ3MC4IZXe0iz5krcd3?= =?us-ascii?Q?x2Jej7ITZ2+P+3LtdXBEzFr1LfYIkkaLfY5XUhjbh1reFzLPYv/dYxOlPSOu?= =?us-ascii?Q?U1Py75ivyDrwEY5h6dEeiQvMWO3TUdV8jXETz1RSDF3U7U5spjUsY5oDwjp7?= =?us-ascii?Q?N4uD15Qx7ZNhQ7luSMzXyoY1uocrkmfwgCalJ+X5dfFA4sHV6GsZxoTworED?= =?us-ascii?Q?s03u9kJ6zpdwG1t13/xnukKrkYRmUI8bX7e8RB9tEQktLrZZpIvXzDf89QYs?= =?us-ascii?Q?3+DhpgPwrW4myL3hkDIE1LDzaF70ZypE62jekxMAabhFRzQ6G7Qp537xq5ho?= =?us-ascii?Q?D3dMlGNeXPoPrXFGPV5qsiS1BRLQZ6xtRpOe56xaYzODhJldWZNE+NEs1Bhq?= =?us-ascii?Q?45eRxuTycWu3Fy5gyHh9DO9BItnkzc1dMW4zgp/0UToXRW3bq9u7A8dIbrDY?= =?us-ascii?Q?YHYAjLjAmlyihWZzPU534weykDxeQr8fXi3Hd3ExOv0gGmxRM6PcoOj6HJCa?= =?us-ascii?Q?dDJCIKCpvzHoq8zEbdtuuh1QIARZxzisGzHn5ZQeZG1N2XF4II45jBUV1H8A?= =?us-ascii?Q?Lhs=3D?= 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: 94d7434a-388c-48eb-9415-08d98180c771 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2021 06:33:54.9640 (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: uTHI6TZCpsd/+d6AX6BrUhSd0elSlEeZzDq9yCMkZHYqhkyfplWBD91luPGU6ZluBnS6hpF2YKJs2DUumoa9yQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3190 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 1/4] vhost: support async dequeue for split ring 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 Wenwu, Comments are inline. > -----Original Message----- > From: Ma, WenwuX > Sent: Saturday, September 18, 2021 3:27 AM > To: dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Xia, Chenbo ; > Jiang, Cheng1 ; Hu, Jiayu ; > Pai G, Sunil ; Yang, YvonneX > ; Wang, YuanX ; Ma, > WenwuX ; Wang, Yinan > Subject: [PATCH v2 1/4] vhost: support async dequeue for split ring >=20 > From: Yuan Wang >=20 > This patch implements asynchronous dequeue data path for split ring. > A new asynchronous dequeue function is introduced. With this function, th= e > application can try to receive packets from the guest with offloading cop= ies > to the async channel, thus saving precious CPU cycles. >=20 > Signed-off-by: Yuan Wang > Signed-off-by: Jiayu Hu > Signed-off-by: Wenwu Ma > Tested-by: Yinan Wang > Tested-by: Yvonne Yang > --- > doc/guides/prog_guide/vhost_lib.rst | 9 + > lib/vhost/rte_vhost_async.h | 33 +- > lib/vhost/version.map | 3 + > lib/vhost/vhost.h | 3 +- > lib/vhost/virtio_net.c | 530 ++++++++++++++++++++++++++++ > 5 files changed, 575 insertions(+), 3 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/vhost_lib.rst > b/doc/guides/prog_guide/vhost_lib.rst > index 171e0096f6..9ed544db7a 100644 > --- a/doc/guides/prog_guide/vhost_lib.rst > +++ b/doc/guides/prog_guide/vhost_lib.rst > @@ -303,6 +303,15 @@ The following is an overview of some key Vhost API > functions: > Clear inflight packets which are submitted to DMA engine in vhost asyn= c > data > path. Completed packets are returned to applications through ``pkts``. >=20 > +* ``rte_vhost_async_try_dequeue_burst(vid, queue_id, mbuf_pool, pkts, > +count, nr_inflight)`` > + > + This function tries to receive packets from the guest with offloading > + copies to the async channel. The packets that are transfer completed > + are returned in ``pkts``. The other packets that their copies are > + submitted to the async channel but not completed are called "in-flight > packets". > + This function will not return in-flight packets until their copies > + are completed by the async channel. > + > Vhost-user Implementations > -------------------------- >=20 > diff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h in= dex > ad71555a7f..973efa19b1 100644 > --- a/lib/vhost/rte_vhost_async.h > +++ b/lib/vhost/rte_vhost_async.h > @@ -84,11 +84,12 @@ struct rte_vhost_async_channel_ops { }; >=20 > /** > - * inflight async packet information > + * in-flight async packet information > */ > struct async_inflight_info { > struct rte_mbuf *mbuf; > - uint16_t descs; /* num of descs inflight */ > + struct virtio_net_hdr nethdr; > + uint16_t descs; /* num of descs in-flight */ > uint16_t nr_buffers; /* num of buffers inflight for packed ring */ }; >=20 > @@ -255,5 +256,33 @@ int rte_vhost_async_get_inflight(int vid, uint16_t > queue_id); __rte_experimental uint16_t > rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t queue_id, > struct rte_mbuf **pkts, uint16_t count); Blank line is needed here. > +/** > + * This function tries to receive packets from the guest with > +offloading > + * copies to the async channel. The packets that are transfer completed > + * are returned in "pkts". The other packets that their copies are > +submitted to > + * the async channel but not completed are called "in-flight packets". > + * This function will not return in-flight packets until their copies > +are > + * completed by the async channel. > + * > + * @param vid > + * id of vhost device to dequeue data The Initials should be in uppercase. The following also needs to be changed= . > + * @param queue_id > + * queue id to dequeue data Should be 'ID of virtqueue ......'. Thanks, Cheng > + * @param mbuf_pool > + * mbuf_pool where host mbuf is allocated. > + * @param pkts > + * blank array to keep successfully dequeued packets > + * @param count > + * size of the packet array > + * @param nr_inflight > + * the amount of in-flight packets. If error occurred, its value is set= to -1. > + * @return > + * num of successfully dequeued packets */ __rte_experimental > +uint16_t rte_vhost_async_try_dequeue_burst(int vid, uint16_t queue_id, > + struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t > count, > + int *nr_inflight); >=20 > #endif /* _RTE_VHOST_ASYNC_H_ */ > diff --git a/lib/vhost/version.map b/lib/vhost/version.map index > c92a9d4962..1e033ad8e2 100644 > --- a/lib/vhost/version.map > +++ b/lib/vhost/version.map > @@ -85,4 +85,7 @@ EXPERIMENTAL { > rte_vhost_async_channel_register_thread_unsafe; > rte_vhost_async_channel_unregister_thread_unsafe; > rte_vhost_clear_queue_thread_unsafe; > + > + # added in 21.11 > + rte_vhost_async_try_dequeue_burst; > };