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 1A93BA0A0F; Mon, 5 Jul 2021 16:58:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF78040040; Mon, 5 Jul 2021 16:58:32 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 946B24003C for ; Mon, 5 Jul 2021 16:58:30 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10036"; a="189368330" X-IronPort-AV: E=Sophos;i="5.83,325,1616482800"; d="scan'208";a="189368330" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2021 07:58:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,325,1616482800"; d="scan'208";a="456745587" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga008.jf.intel.com with ESMTP; 05 Jul 2021 07:58:29 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Mon, 5 Jul 2021 07:58:28 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 5 Jul 2021 07:58:28 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Mon, 5 Jul 2021 07:58:28 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) 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.2242.4; Mon, 5 Jul 2021 07:58:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U66NFDam2hbxj5PtvObFQI5eRsZxD/+mB5jmfWALhARFXpQooUiZrmQXisdXNGtt6C1qOd1HPe7yI2BXWiLVwfeaUxzU0PTohwyxNOpJ3AqoZtO0H5rI5pTOut4LEQ9tUqqEK6bHgpItW7BBvmugK4oB8emuLZ/mv2BVgc4CUayaERTfjT7MR1InbVQd49l1wzbrz3XUBmf6o+IQ4JcoesXGBuHtgF/JcGNWaIGCh2kMv3KM/5H7TyPLaNuRFD63ZYFWoqai8QEMCbGWlVU1zvxdrOCaHZ4+8iLKZ4hKDFzYLTvlRv8bxOZQUqkUrKuTnhv+Ct5rVrkdMVlkhl42yA== 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=u5fEzgCPySZTXaW1eT4hcL9+63r8SWw5YESRHKpLYBs=; b=FNpZLhf2SzDsX5yxVOaWibOHRB90Wz/ibF7WJ7vAiqhZ8BxEB2+l99cY9+bDcKYdjLR+ttVEPaGM9cS6BN9c2qETRLlvyvKdqA+ZCzdulauxxqkc5z7wff7ZK/gGrgzagOIEqdpuPvtGEtGXVBg7G9G3cDW/9mApTTU+49IPANEGsr8IYpMFZwxX9lwXTtaQrctlZikoWUK7j5Byo4W+fl1F3oRDY54eQct84iYUv54njPtJX7uxsitAGJgwlUWgO/C7+YEFq2pAy55pM0AvOT9ONnuECMvaO6nMd45bHcM5fzzCYh6l9CIX/kgBrG6qHTWVcWPI/AAB3McgPcJl4A== 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=u5fEzgCPySZTXaW1eT4hcL9+63r8SWw5YESRHKpLYBs=; b=M36subWUftbcSqd1fnGf1YCq4nZmEeURUIl/reg9N3Dqk3Q6xbIkqsuS66e9CqK0WCQgS4ZZGo35qgzrS2mDF8/EvT0QUr7U5zDNoUZa0JjzTHh1Ny5DhvvC9xpYrmcu2Lvf6siyo7TeyMSp/cXq+EBNFku27IWiMNsbsqjcVNQ= Received: from BYAPR11MB3814.namprd11.prod.outlook.com (2603:10b6:a03:fb::11) by SJ0PR11MB4960.namprd11.prod.outlook.com (2603:10b6:a03:2ac::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.31; Mon, 5 Jul 2021 14:58:25 +0000 Received: from BYAPR11MB3814.namprd11.prod.outlook.com ([fe80::94:dc85:65f6:596c]) by BYAPR11MB3814.namprd11.prod.outlook.com ([fe80::94:dc85:65f6:596c%5]) with mapi id 15.20.4287.033; Mon, 5 Jul 2021 14:58:25 +0000 From: "Pai G, Sunil" To: "Jiang, Cheng1" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "Hu, Jiayu" , "Yang, YvonneX" , "Jiang, Cheng1" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] vhost: add unsafe API to drain pkts in async vhost Thread-Index: AQHXYfNGO3Z9xPt3jk+5d2tEX85xwKs0XEhA Date: Mon, 5 Jul 2021 14:58:25 +0000 Message-ID: References: <20210602042802.31943-1-cheng1.jiang@intel.com> <20210615141513.16163-1-cheng1.jiang@intel.com> <20210615141513.16163-2-cheng1.jiang@intel.com> In-Reply-To: <20210615141513.16163-2-cheng1.jiang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 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: [157.45.122.94] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 848c9e9b-635c-4a21-9524-08d93fc55733 x-ms-traffictypediagnostic: SJ0PR11MB4960: 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:1148; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZinacjixcywM8KAX8a65owdiL0Cd047vr5vIaLFRL8/m2RnECcTeWioMj+heJcYZZIb+eRwrfh42rBvH7e1c5RZwXNf8InpNkmfi1ozLgMGHoQsaOvItYU60+M2QD3xXg0hilT5nVEjmoRLqzLLPGrFgbAa2ldHDFfBEoMbb2hgGC5P29wWm1zRpiFxzXmGoeEERKGLUYjhsaDxy5geBV+U09uyJb8NlNsydFCsqFgjfv0qp7AlxGJGvDF22lIb9U/uCgG4D28bRajDN0M4jLSL2jp2Nwx33jeCyQ/7ZE9/dXjOuCwIbsxpvSEORtqvkN7bCB7lcOg8rN9uQ08Q5htCWEsiZTKOG/ztBytMctjgIAcEnC3Iw65qP0cX39VmUSr6zO4KGAwoa8ylvReZflU//HDRNaohnGD3fYoAylMlGIRs48XVP2mdDZh97tWXwMj1rHRR6TqTyYSVBG9T6CCtsta7rTeTAukswUKiPIikEwndVoJUv/pVloh88BgWPKqQQ2IorY2p0j7R8qmh8sikeRrPn3KrfHOAuSQQRZCg02EAWlwecpzhHwSI044O0tR75shrkC+izkszmrM+wk1PNMtLuPbYTv3SKw+/Rk/ZT4x2oN7Hf5DOP2Y2K0NBa2ioPpDZTeimGqzuUYvHZGA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3814.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(366004)(39860400002)(346002)(376002)(136003)(122000001)(8676002)(316002)(2906002)(9686003)(33656002)(38100700002)(55016002)(71200400001)(52536014)(6506007)(478600001)(186003)(86362001)(8936002)(7696005)(107886003)(66446008)(64756008)(66556008)(66476007)(6636002)(5660300002)(110136005)(26005)(54906003)(4326008)(76116006)(66946007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?c9dK3wr8DFuh9UTtU6Q3RMiQ2a60m0YqlFoQZ1PTh2fif/iiw+OEwTu4OfPS?= =?us-ascii?Q?7Nkh0dDFdp0qutHWFNlnT7aBBsV6iv83pTuGmRWeJSouLrtXkh02rLBH6BbA?= =?us-ascii?Q?w7cuEs4aZAEpKdQBkEBPhHR6XXbeHJ17aFfy2485kHYQGRHSDwPYXO9GL7mW?= =?us-ascii?Q?kPJ9y13wyAzaQhX3PT5qcVlshKny0gsSfn4E5O02ikFHkLt7Y2JcnmvA2j8u?= =?us-ascii?Q?l4yY1OwqhGoO0MXWGnOHJSNg1T6cbcO5UBuKVTBx1IWE1YOsq6H1kt5Pyn/B?= =?us-ascii?Q?tiay1DwHuxEe0xkkISlPx1WPHSxBt8Ppdko3eJmyLz6hZzDt5JKkNDu9Y34I?= =?us-ascii?Q?Xl2bXkT+ktoir71lJ3AwX3KfI49KAbUBENgBHJHGHOULj/67j4edTOP5pbOV?= =?us-ascii?Q?U86C1thmgTuPfodDuhf/eH5H8DyU0Srn+Nkta/lEgUDnZQs3Fa3G1P77+liP?= =?us-ascii?Q?h1EOIlNA5LjPgXZ1A4gRJ3oZ0Ttj17m27QnGqx10JF5gsb+V9/XIwMYuz18F?= =?us-ascii?Q?mr2yo5Af0QlcgNKUZIUA2P6QYL4wAQ4P5HRFCo9qpd+eCza1Vnu24Tk2nJ7S?= =?us-ascii?Q?+hJd2JMmzbqd4j7hHlKR09894+E0VOz6/9v5SyP/XQD70WpI7kXIqBWboUiy?= =?us-ascii?Q?aZ54G4XzojXhE599nT6BPejoSF95x7nRH1qewUC93+avKTSVhtZab2Z9rFly?= =?us-ascii?Q?IedVoK9A9eix1wu4scPTSFzd3IeRnsqrLH6gcnEFJj1Xq6h84IimoVDZ2+OV?= =?us-ascii?Q?itctyFLQX4902a1pqYzyNryTXULSk2lnj9XtEGlILU0qT+O36nw3/fg8nXxm?= =?us-ascii?Q?ML1eR/a3Awv4FDIpuZElxjQbuM4NuU8b5QmZEHsxwYQAxR+HFCSjv5Vg3dcl?= =?us-ascii?Q?aUwSKh8I+mumZATjpSaX5hka1apfnUTDtBFqdsa5MmkX0khhdmcQ+v75sIbX?= =?us-ascii?Q?Cp8dSdDBtIq0IqRS6bp/h7zxoYmLt1FdwqgouSdZ1cIEK5LosGDzBz4LGUge?= =?us-ascii?Q?IhKHdb6TUumq11/yntyjr8R7rsp6VsEPo0A00xc3pDW4Uzwvfu5Ke4jlC67p?= =?us-ascii?Q?izR2C1xhRgygA+jdHgzCSpf32anUWtesrPNDwAbggsMWhJIEyw/8miBrjRyb?= =?us-ascii?Q?DNiRTxeIJfeqCVuDta7TOlsH7sTKPQ0LiyJsZasIOT/THoh82rKzQNTzuSiA?= =?us-ascii?Q?gzRyd+h/KoEqPzEGxO1p+NniO1Arh9Oqh0sA9hdpqz7imqj5uPx92/sCllzo?= =?us-ascii?Q?5a8bSvQ6KrkL6QBzqgVcr7Uhz+lXWL7N+G1H4EQzr1dVwqDVlANzDygTxkoj?= =?us-ascii?Q?ai6e6uTmY4KLn6RaePVl7fZb?= 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: BYAPR11MB3814.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 848c9e9b-635c-4a21-9524-08d93fc55733 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2021 14:58:25.1982 (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: gDaCM5zFVskSaLp1as8fOYr65Q+3+aLlBPr2gIBSylHHV3KfjbvLROb3mdKvmoXKsq4KLd0aduY0mzeZrs2xKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4960 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 1/3] vhost: add unsafe API to drain pkts in async vhost 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 Cheng,=20 Comments inline. > +uint16_t rte_vhost_drain_queue_thread_unsafe(int vid, uint16_t > queue_id, > + struct rte_mbuf **pkts, uint16_t count) { > + struct virtio_net *dev =3D get_device(vid); > + struct vhost_virtqueue *vq; > + uint16_t n_pkts =3D count; > + > + if (!dev) > + return 0; > + > + VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__); > + if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) { > + VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx > %d.\n", > + dev->vid, __func__, queue_id); > + return 0; > + } > + > + vq =3D dev->virtqueue[queue_id]; > + > + if (unlikely(!vq->async_registered)) { > + VHOST_LOG_DATA(ERR, "(%d) %s: async not registered for > queue id %d.\n", > + dev->vid, __func__, queue_id); > + return 0; > + } > + > + while (count) > + count -=3D vhost_poll_enqueue_completed(dev, queue_id, > pkts, count); I think the drain API here assumes there is per virtqueue assignment of DMA= device which need not be true. If there are multiple DMA devices per virtqueue , the application would nee= d a mechanism to change the device id per call to the drain API.=20 So, its probably better to just call vhost_poll_enqueue_completed here and = return to the application ? and have the loop in the application instead ? > + > + return n_pkts; > +} > +