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 B26D6A0547; Mon, 27 Sep 2021 08:56:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 332A640686; Mon, 27 Sep 2021 08:56:15 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id E38324003D for ; Mon, 27 Sep 2021 08:56:13 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10119"; a="309972277" X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="309972277" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2021 23:56:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="706978887" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 26 Sep 2021 23:56:11 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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:56:11 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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:56:11 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Sun, 26 Sep 2021 23:56:11 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) by edgegateway.intel.com (192.55.55.68) 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:56:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lISE0kMwg6q/cl3v35ISUJzfeIwIDSNtgfBl60yYWjEGcvVgsu6Av52zqrYHgh+29Q8pAykXvk0fWkRguRdxZ7EXvHqcxXta8RTS8uZ+Nos2xb0GnzsUxJQxSRw2NBMGs36MFYMntPewnzNSCREDA99LSFFi4JtwmnyS8cjKbxUqI4FX7By4rXZgOxt98LgZDoXK58hq7rr2XdiZ768if6fpoJNpiCBZGzPzHIKbRAgF64wWdM8+Kp1nZnsYplk6wC5g4CZ1bN6MbM1ZWVXdwc/crtKlR07nzDPIwdzH0AE7aHGTC2raaEri7oYvBzxy257ihEj577ScCbACRV9UTA== 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=NH0x2SYP+nyuN5LEX0Cv0QqCYOTtbRDdtuFzfsTjsVM=; b=VkSbLxyjnBz3ZUc/hkmv+IUQFhs/c5BZnMJbD+CThfa6xsEPdZ4qOUTaBJ/h8b++pcnr0qpSD/sIAaxwyHSadFwgY+UDJPz5NO4PisxQiY0HuXy6SiAfm7051t5xOE6ry46ByZqW10q/BCzjZ/WxCxLoIDUTWdkSxp8Db5TNZfHZYiqAxlrUAMxtgCNjdSzhyndp8gngkQx7TxKfbBWLVnHkq5Rt4dp2IWHVF9mNfnBEa+6Rs+IiBlz/IL7qJ6BXWRtcYbrVUdPr5KfhyhNRd5KZ8panHOE76bzYcBWQ5cx4XwsBvnjhCQ/6xWF+PNJr3CESM9K9JTijUmGXWrzFKA== 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=NH0x2SYP+nyuN5LEX0Cv0QqCYOTtbRDdtuFzfsTjsVM=; b=okK+Lq71t5lcsNvfLC5rXcwgIy0u83kxuyKhksrgkt+DGLHHUTiGQflhZx+QtbkyBYj9MQ/BtpXNoWVQl/DP90NmsVb/qgBjsA7muIHX++tuPCNALbrSsdseKiGKFRNOqdKPnunTlCPZXPbodzaVV+KPoyEHEzVk4DCpw+ysjMA= Received: from SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) by BYAPR11MB2805.namprd11.prod.outlook.com (2603:10b6:a02:c1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Mon, 27 Sep 2021 06:56:05 +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:56:05 +0000 From: "Jiang, Cheng1" To: "Ma, WenwuX" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "Hu, Jiayu" , "Pai G, Sunil" , "Yang, YvonneX" Thread-Topic: [PATCH v2 2/4] examples/vhost: refactor vhost enqueue and dequeue datapaths Thread-Index: AQHXq5aKezXf7pNq0kyc5QFoiuUW/qu3fYVA Date: Mon, 27 Sep 2021 06:56:05 +0000 Message-ID: References: <20210906204837.112466-1-wenwux.ma@intel.com> <20210917192703.385510-1-wenwux.ma@intel.com> <20210917192703.385510-3-wenwux.ma@intel.com> In-Reply-To: <20210917192703.385510-3-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: 64319485-da9c-4c62-7748-08d98183e076 x-ms-traffictypediagnostic: BYAPR11MB2805: 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:4125; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AlodvS74Df80N05GpThZ5PxAJ8B4+4bjJ5GfZe6k+Wqc8Y0Q46bQ7pmkppvaEhs9DvNtPBDqIVDalD0rM94OVxV1jpANaHZN9IecWgKyaQuS25YojzkcU2S8nJd+XvCE+HlR+BIlPxxkg2fjEp96scXYswAzpPn233gWVVmxljXzmwgwSYegqZ0VCilsPB8jyz/2qwWHaRGvXWYqtwSivS7LtGHfGStwdemeQ/XDSXSJimomWpvnPCeffsnQV6r2YpMxuzyoA7qgBEjsPaUgxUi5LE/GTY2+PjBHk1rGvdVHxmhMB5JIQLkAt2UFGmGKJIxAkj23hoNYtLKlKFB5DdwS8XgNdkuZfgQz5bYyC/hvFTlKoS1iOJ8gbClP24rfona+x4mmi0ik09TI3Mi0VThIYi68JqLhweTGTO7U3HnSNSFm2ct+csNJtpevTCXLMV8LwgpW+LIEwheiNn+Zfu0od+J8/8n3l7VUPjsxi30YqBt9KyiCW8LudET9m9C5IoL/KtKH3pqf+eJGm5MvkD7qMMRONVKSycjWGymsmn0DdmVkbwlrBG/0KtSCbMpm3PLsTiFjPnk7YrobxASgPua8QsAq2/P/Ww+svwc+I0Db1izdxu6Ax6FFfO9sn8pNSAJWksDyqqmwGHxVM1IIv6EbMv2TV1mpZ12CnB6tzN6bQI50B1oLW/2a5pIeBlugmjqDBfSxnFOgEBnsBSRv7A== 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)(53546011)(508600001)(186003)(38100700002)(83380400001)(71200400001)(55016002)(7696005)(33656002)(6506007)(316002)(66446008)(66946007)(107886003)(2906002)(8936002)(122000001)(64756008)(8676002)(5660300002)(4326008)(26005)(66476007)(66556008)(9686003)(54906003)(110136005)(86362001)(38070700005)(52536014)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1qgKPbtDGvGdqsyBf6s6l4MhlQkzWJE3es4oozjKJ9XQJ3BGOWTzCV2sbEsm?= =?us-ascii?Q?+mMAXylfY1dP3DecLlDJGCocRlMij3sIAXo6DbSeKcoRCUqwgp8tbcBKciFG?= =?us-ascii?Q?y+Aqvsg2GFxywZQW1QvbC1vGRTZa+T5gaSMBQLo3DOxZH4PDITYrK+IpbsoB?= =?us-ascii?Q?G4dhX4NY0hZMAsQRPXFy2biIrLsv2lNZeAm/xlAIf79fZ3WCeQbfHNvpHF4C?= =?us-ascii?Q?pDD0u8lOKaBYujyQxqacAx0uAbob5f7VAPsK06so55tTBA2rjENaPJ6o1EGz?= =?us-ascii?Q?yg/rjFXlMWy8nJUAPCcIWcmGWIumDH+Y7wZkI/rQAyy0O2ciCBQNSunt5fjf?= =?us-ascii?Q?rm/n7Hm3/JHEE9mcE5MWz8/e1+/vZDR+eUxHayiRPvTsYCC+aIvDGt+M18d5?= =?us-ascii?Q?GZcYVEIMvrvbDHeFZPslRb7C+DDfo2cJ2GEb1MBOljfPP45I6IiTOfsjFs9O?= =?us-ascii?Q?V58uX91U9TnoOFjXzC62eCcdsZYP1raVx/eUYDBUHd2TU+kSm4o2jd3jwOe4?= =?us-ascii?Q?8cqoMu2OxVdPMQ79SOU0NlOP+031Atc5VUqXaG0XePpL+D5dboe0m7Bx46bg?= =?us-ascii?Q?YFkcJz1J4jkWSzj0R3Vp8xbkPx8JWJL1HkkkXYtnXeQ/+EmYeoVJ0GUC23WE?= =?us-ascii?Q?WN3TmLhmgafLKsUAfDU5G8/QE55T7w6SiiUZcfHQHBW0fZAeSC+LJ1mqH23j?= =?us-ascii?Q?ljvK7sRvnw7bvg6x42T33qW6cZAosP+4VSsSmUU0U2SxnQ/n2B5Nr0MUppOw?= =?us-ascii?Q?5UtelvM1vFjcQynzfi7bPlxqbZM1ortfsb38we8UgtnSjIa+aBZD/q6I4nEL?= =?us-ascii?Q?E9LS8+oG5ktfaojG72LQ66S4hsENjFLDqNihxkSgwmAvnS1baQ2EGAOcBexg?= =?us-ascii?Q?3HP+IMf/xJL0cwfhYdG/CjBPo4MrJ4hPn/+1Y6GG6TKTrab7Zg5avBOoXQP6?= =?us-ascii?Q?T6DGGuXsC/0DQ4gLnA7FT3KpK7pQ7clqtzr5dEidYJiPFlfp95iLC4QxTsR+?= =?us-ascii?Q?OT2dvtB3gwbrixlsNjAZdtZ6UcIGzEWv4fzQsszK6vaRtCKFEtcvZDyOd/T6?= =?us-ascii?Q?iuVfPvMTSTNUO/ukX9494A5hvsb3J0MulYfUUaWlJ8OuuJA2z8EXZ/emIN8b?= =?us-ascii?Q?m9/qNLhNiWTpU0n5D2vmja9zYH+qf2E1Xe89JyfxLyw7RdjuxeM4Wp4NcZnr?= =?us-ascii?Q?GEBcsEmdoDAls5cb0fQe71nO2E6Vz0A8ulI9L1x4Xy8R45iyGV1Vmf6lHROA?= =?us-ascii?Q?dRcs1slyxHGg1cUpYkcwK57YMRJ1tQx45BMcvlxHvY5QP8wvwitYv80LxjDb?= =?us-ascii?Q?UoU=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: 64319485-da9c-4c62-7748-08d98183e076 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2021 06:56:05.4243 (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: w8D46KFR6FkOEGhk+HQlxs1KS1sxAHkYHArvQe3qwfAL0ornTBI4yHj43XLovLbpAmg82EIAdt+3cwK9+rN1XQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2805 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 2/4] examples/vhost: refactor vhost enqueue and dequeue datapaths 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, > -----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 > ; Ma, WenwuX > Subject: [PATCH v2 2/4] examples/vhost: refactor vhost enqueue and > dequeue datapaths >=20 > Previously, by judging the flag, we call different enqueue/dequeue > functions in data path. >=20 > Now, we use an ops that was initialized when Vhost was created, > so that we can call ops directly in Vhost data path without any more > flag judgment. >=20 > Signed-off-by: Wenwu Ma > Reviewed-by: Maxime Coquelin > Tested-by: Yvonne Yang > --- > examples/vhost/main.c | 100 +++++++++++++++++++++--------------- > examples/vhost/main.h | 28 ++++++++-- > examples/vhost/virtio_net.c | 16 +++++- > 3 files changed, 98 insertions(+), 46 deletions(-) >=20 > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index d0bf1f31e3..254f7097bc 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -106,6 +106,8 @@ static uint32_t burst_rx_retry_num =3D > BURST_RX_RETRIES; > static char *socket_files; > static int nb_sockets; >=20 > +static struct vhost_queue_ops vdev_queue_ops[MAX_VHOST_DEVICE]; > + > /* empty vmdq configuration structure. Filled in programatically */ > static struct rte_eth_conf vmdq_conf_default =3D { > .rxmode =3D { > @@ -879,22 +881,8 @@ drain_vhost(struct vhost_dev *vdev) > uint16_t nr_xmit =3D vhost_txbuff[buff_idx]->len; > struct rte_mbuf **m =3D vhost_txbuff[buff_idx]->m_table; >=20 > - if (builtin_net_driver) { > - ret =3D vs_enqueue_pkts(vdev, VIRTIO_RXQ, m, nr_xmit); > - } else if (async_vhost_driver) { > - uint16_t enqueue_fail =3D 0; > - > - complete_async_pkts(vdev); > - ret =3D rte_vhost_submit_enqueue_burst(vdev->vid, > VIRTIO_RXQ, m, nr_xmit); > - __atomic_add_fetch(&vdev->pkts_inflight, ret, > __ATOMIC_SEQ_CST); > - > - enqueue_fail =3D nr_xmit - ret; > - if (enqueue_fail) > - free_pkts(&m[ret], nr_xmit - ret); > - } else { > - ret =3D rte_vhost_enqueue_burst(vdev->vid, VIRTIO_RXQ, > - m, nr_xmit); > - } > + ret =3D vdev_queue_ops[vdev->vid].enqueue_pkt_burst(vdev, > + VIRTIO_RXQ, m, nr_xmit); >=20 Now, the line char number limit is 100, so you don't have to put it in 2 li= nes. > if (enable_stats) { > __atomic_add_fetch(&vdev->stats.rx_total_atomic, nr_xmit, > @@ -1173,6 +1161,33 @@ drain_mbuf_table(struct mbuf_table *tx_q) > } > } >=20 > +uint16_t > +async_enqueue_pkts(struct vhost_dev *vdev, uint16_t queue_id, > + struct rte_mbuf **pkts, uint32_t rx_count) > +{ > + uint16_t enqueue_count; > + uint16_t enqueue_fail =3D 0; > + > + complete_async_pkts(vdev); > + enqueue_count =3D rte_vhost_submit_enqueue_burst(vdev->vid, > + queue_id, pkts, rx_count); Same here. > + __atomic_add_fetch(&vdev->pkts_inflight, enqueue_count, > + __ATOMIC_SEQ_CST); Same here. > + > + enqueue_fail =3D rx_count - enqueue_count; > + if (enqueue_fail) > + free_pkts(&pkts[enqueue_count], enqueue_fail); > + > + return enqueue_count; > +} > + > +uint16_t > +sync_enqueue_pkts(struct vhost_dev *vdev, uint16_t queue_id, > + struct rte_mbuf **pkts, uint32_t rx_count) > +{ > + return rte_vhost_enqueue_burst(vdev->vid, queue_id, pkts, > rx_count); > +} > + > static __rte_always_inline void > drain_eth_rx(struct vhost_dev *vdev) > { > @@ -1203,25 +1218,8 @@ drain_eth_rx(struct vhost_dev *vdev) > } > } >=20 > - if (builtin_net_driver) { > - enqueue_count =3D vs_enqueue_pkts(vdev, VIRTIO_RXQ, > - pkts, rx_count); > - } else if (async_vhost_driver) { > - uint16_t enqueue_fail =3D 0; > - > - complete_async_pkts(vdev); > - enqueue_count =3D rte_vhost_submit_enqueue_burst(vdev- > >vid, > - VIRTIO_RXQ, pkts, rx_count); > - __atomic_add_fetch(&vdev->pkts_inflight, enqueue_count, > __ATOMIC_SEQ_CST); > - > - enqueue_fail =3D rx_count - enqueue_count; > - if (enqueue_fail) > - free_pkts(&pkts[enqueue_count], enqueue_fail); > - > - } else { > - enqueue_count =3D rte_vhost_enqueue_burst(vdev->vid, > VIRTIO_RXQ, > - pkts, rx_count); > - } > + enqueue_count =3D vdev_queue_ops[vdev- > >vid].enqueue_pkt_burst(vdev, > + VIRTIO_RXQ, pkts, rx_count); >=20 > if (enable_stats) { > __atomic_add_fetch(&vdev->stats.rx_total_atomic, > rx_count, > @@ -1234,6 +1232,14 @@ drain_eth_rx(struct vhost_dev *vdev) > free_pkts(pkts, rx_count); > } >=20 > +uint16_t sync_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mempool *mbuf_pool, > + struct rte_mbuf **pkts, uint16_t count) > +{ > + return rte_vhost_dequeue_burst(dev->vid, queue_id, > + mbuf_pool, pkts, count); Same here. > +} > + > static __rte_always_inline void > drain_virtio_tx(struct vhost_dev *vdev) > { > @@ -1241,13 +1247,8 @@ drain_virtio_tx(struct vhost_dev *vdev) > uint16_t count; > uint16_t i; >=20 > - if (builtin_net_driver) { > - count =3D vs_dequeue_pkts(vdev, VIRTIO_TXQ, mbuf_pool, > - pkts, MAX_PKT_BURST); > - } else { > - count =3D rte_vhost_dequeue_burst(vdev->vid, VIRTIO_TXQ, > - mbuf_pool, pkts, MAX_PKT_BURST); > - } > + count =3D vdev_queue_ops[vdev->vid].dequeue_pkt_burst(vdev, > + VIRTIO_TXQ, mbuf_pool, pkts, > MAX_PKT_BURST); >=20 > /* setup VMDq for the first packet */ > if (unlikely(vdev->ready =3D=3D DEVICE_MAC_LEARNING) && count) { > @@ -1432,6 +1433,21 @@ new_device(int vid) > } > } >=20 > + if (builtin_net_driver) { > + vdev_queue_ops[vid].enqueue_pkt_burst =3D > builtin_enqueue_pkts; > + vdev_queue_ops[vid].dequeue_pkt_burst =3D > builtin_dequeue_pkts; > + } else { > + if (async_vhost_driver) { > + vdev_queue_ops[vid].enqueue_pkt_burst =3D > + async_enqueue_pkts; Same here. > + } else { > + vdev_queue_ops[vid].enqueue_pkt_burst =3D > + sync_enqueue_pkts; > + } Same here. And it seems we don't need '{ }' here. Thanks, Cheng > + > + vdev_queue_ops[vid].dequeue_pkt_burst =3D > sync_dequeue_pkts; > + } > + > if (builtin_net_driver) > vs_vhost_net_setup(vdev); >=20 > diff --git a/examples/vhost/main.h b/examples/vhost/main.h > index e7b1ac60a6..2c5a558f12 100644 > --- a/examples/vhost/main.h > +++ b/examples/vhost/main.h > @@ -61,6 +61,19 @@ struct vhost_dev { > struct vhost_queue queues[MAX_QUEUE_PAIRS * 2]; > } __rte_cache_aligned; >=20 > +typedef uint16_t (*vhost_enqueue_burst_t)(struct vhost_dev *dev, > + uint16_t queue_id, struct rte_mbuf **pkts, > + uint32_t count); > + > +typedef uint16_t (*vhost_dequeue_burst_t)(struct vhost_dev *dev, > + uint16_t queue_id, struct rte_mempool *mbuf_pool, > + struct rte_mbuf **pkts, uint16_t count); > + > +struct vhost_queue_ops { > + vhost_enqueue_burst_t enqueue_pkt_burst; > + vhost_dequeue_burst_t dequeue_pkt_burst; > +}; > + > TAILQ_HEAD(vhost_dev_tailq_list, vhost_dev); >=20 >=20 > @@ -87,7 +100,16 @@ void vs_vhost_net_remove(struct vhost_dev *dev); > uint16_t vs_enqueue_pkts(struct vhost_dev *dev, uint16_t queue_id, > struct rte_mbuf **pkts, uint32_t count); >=20 > -uint16_t vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, > - struct rte_mempool *mbuf_pool, > - struct rte_mbuf **pkts, uint16_t count); > +uint16_t builtin_enqueue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mbuf **pkts, uint32_t count); > +uint16_t builtin_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mempool *mbuf_pool, > + struct rte_mbuf **pkts, uint16_t count); > +uint16_t sync_enqueue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mbuf **pkts, uint32_t count); > +uint16_t sync_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mempool *mbuf_pool, > + struct rte_mbuf **pkts, uint16_t count); > +uint16_t async_enqueue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mbuf **pkts, uint32_t count); > #endif /* _MAIN_H_ */ > diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c > index 9064fc3a82..2432a96566 100644 > --- a/examples/vhost/virtio_net.c > +++ b/examples/vhost/virtio_net.c > @@ -238,6 +238,13 @@ vs_enqueue_pkts(struct vhost_dev *dev, uint16_t > queue_id, > return count; > } >=20 > +uint16_t > +builtin_enqueue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mbuf **pkts, uint32_t count) > +{ > + return vs_enqueue_pkts(dev, queue_id, pkts, count); > +} > + > static __rte_always_inline int > dequeue_pkt(struct vhost_dev *dev, struct rte_vhost_vring *vr, > struct rte_mbuf *m, uint16_t desc_idx, > @@ -363,7 +370,7 @@ dequeue_pkt(struct vhost_dev *dev, struct > rte_vhost_vring *vr, > return 0; > } >=20 > -uint16_t > +static uint16_t > vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, > struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t > count) > { > @@ -440,3 +447,10 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t > queue_id, >=20 > return i; > } > + > +uint16_t > +builtin_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id, > + struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t > count) > +{ > + return vs_dequeue_pkts(dev, queue_id, mbuf_pool, pkts, count); > +} > -- > 2.25.1