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 E392FA0C4E; Wed, 7 Jul 2021 16:03:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA69B413B6; Wed, 7 Jul 2021 16:03:07 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 7ABCF413A8 for ; Wed, 7 Jul 2021 16:03:05 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10037"; a="196474355" X-IronPort-AV: E=Sophos;i="5.83,331,1616482800"; d="scan'208";a="196474355" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2021 07:02:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,331,1616482800"; d="scan'208";a="497945993" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga002.fm.intel.com with ESMTP; 07 Jul 2021 07:02:32 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) 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.10; Wed, 7 Jul 2021 07:02:32 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 7 Jul 2021 07:02:32 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Wed, 7 Jul 2021 07:02:32 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) 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.4; Wed, 7 Jul 2021 07:02:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PsNsp9kcy6F+gubkYq88dBCzHeyupe8TOf+IPQB8QaA9xFHkfdO5Q7CaiLuLOthUbLYdtyyjxc0UslFJpdaMrQ1HxAPaWXL28r0AtbYPPHiofQQrMEH3KrMjOq3UJVdLPAhERVomvZCk3TZj5JkTsLszt6L0XaJ1snS+2FN4w2aG4obnAxFJx9V1RciClxKTiLtId8ovoajCYbQ/gutb8hWa91DJpLExVtYJAxyihtLQjNXd2/g5Y+Lzb5x+vihdpnvmMtpjVCbNtRdOQ5hA3ar0QikSj/NL7iEr24bHhwsDdKMJZzlgJLQ1cb34AXaaVGL2E+hOnzFX+ay6P4cIhQ== 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=itXPVCSJMtAca2I7sM6fu4tKPD+Y2X0QfMxSGxX0AvM=; b=WjtPatVJaboJy5TJQmJrrB7qJffGYogR/LWJCzZfz4ZB2/hl4cuF88wufPDSf+xWAVKPDBnnKXncGem3AIWuS2Gt/zJLCnruCIb6xPXKiMeVW+p7LWgo6o7ypKZ2yh0kla9RFud5BVDoclqMl14AZ/nFnwbA/IgwFu9KTPMf6DS9UlR/FkVV7Id2EKjuR73yWI8oE+n+eT1PuWJ17dUULp3o/INR7uKQqFYixWROACqiT4lVafyLOVD/N/sHJusuU+dioV8bNwEHjxJlBYLl1wimSKkLzIZWIFXSQZ/sVkYhKVKhxWRojeGQM+oEIIlpdM1f71sgJuTnDjnT/v9ZgQ== 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=itXPVCSJMtAca2I7sM6fu4tKPD+Y2X0QfMxSGxX0AvM=; b=W6q7eWZgpzo4N5NRA1O54lZdyRI2BAtrujy+QCGJKdpTbUBtGMyFLDgYIa1sUZXqbjHYiKrXSeXUyt6HNch4bKULQyFnM7Qe9Gzyy0+uoqgBYZ1S9pHj8k8/YmXN8bQ8+UsKxN7tTZhx8ujv3MrYbUzjxia+P9n6ycP/ZbzTVzA= Received: from SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) by SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.31; Wed, 7 Jul 2021 14:02:29 +0000 Received: from SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::2005:352e:369a:e5f9]) by SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::2005:352e:369a:e5f9%7]) with mapi id 15.20.4287.033; Wed, 7 Jul 2021 14:02:29 +0000 From: "Jiang, Cheng1" To: "Pai G, Sunil" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "Hu, Jiayu" , "Yang, YvonneX" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] vhost: add unsafe API to drain pkts in async vhost Thread-Index: AQHXYfMypZzXJBgBeUKN6fjBolWyqqs0mIKAgAMRdoA= Date: Wed, 7 Jul 2021 14:02:29 +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: 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: 61765375-2c0c-430b-7e63-08d9414fdbe8 x-ms-traffictypediagnostic: SJ0PR11MB5006: 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-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1MLiDiGpFwW6TEXrycb/Vg25YsT+ICNtl1LflfFXErHnlXII8v3sdKkNzT4O1yofpUQ3ncTzbyqCLcNqruNts9xUYGfM7bJP50KpuIjG3N/ux3k0vaRMDl3nrItu9v3Zwvuz9ShTJZ9b/INJK+JNhdIcbTVR0eTSYvw2MNvpX4MnKv2zcd0VVJ0PCeiE7rTGeX/ZIlzbsfVvuGp8ENjgcc14cWSAn3EsdEjLRYEXcoI18nVNAZVJH2r0GWYAC8752nP8SedT+bgiyCU9VY7duLldW8gxQw3ovkXyNwkjUEbJZHSb01Ad0ymT1XqFBbqXdLapb+xGV9qYcjYhsYnFnVh7x0cm+8aQigirNAkpEH5fcUWbXhKl2jV73+XFZQNV9D9J16Jo7EvEDUiGLiWokHhnx6X1qJ1FbQOHOrsxIukkzDdz9gpySOBTsgr6W1JiAgFwL76Z+HNeGJC8w+/8nqtNZVZqBvXwRitjA1qCF3MEkWvzemidca/Xi3E8fbAtewnI7nTwD6auI0gSYUc/besuXMXdq5qQaRU8JMfej1WU2qojijpEBtIvI+C0v4Wnv8ja2Y3Tafk0hU53Vg+iip40j7MqHhQIrMaaVvt51BretnPlvoyJK9uvAQp94ENCsf+RW/F3lYwHS8IQoTVg7g== 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:(39860400002)(136003)(366004)(346002)(396003)(376002)(4326008)(66946007)(66476007)(66556008)(316002)(478600001)(64756008)(122000001)(9686003)(54906003)(107886003)(110136005)(7696005)(71200400001)(6636002)(66446008)(86362001)(8676002)(8936002)(33656002)(52536014)(26005)(83380400001)(2906002)(6506007)(38100700002)(53546011)(5660300002)(186003)(55016002)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TK0nU5kOZy4I3LDoVOjkG6L1CYh3uGHqWDDJ6yXUvVGSFBqz/nLbPhRgBANS?= =?us-ascii?Q?gN2AYmDsywDUoFxE1yqgwqk9z9e/bOGoDa483bwd1AVJZWom2NwUj+RVOrOD?= =?us-ascii?Q?kLgdnzvxLtTfhi5FPEMjw3AzrT5ydMcbXD/TR1Xubqjcdaafw7NGnJc8mUhc?= =?us-ascii?Q?sr/Tj+vdCyoDTlvJOmnYsQ37hDZbeWnmj1vor6T4HNmI/aSAsGVVPCC5j3VE?= =?us-ascii?Q?amv7ZQXHRlDXpc6B/pz90kKlXYhvmU5neLE/4ssr8CpD/Vf3dV+9X/tlRD3G?= =?us-ascii?Q?RzB8RJqZgpc+eToegetrmNdbybJEQkYZ8IRQnNZOuzrGubtXBC4GjNwL+pmI?= =?us-ascii?Q?K8G4rNFENWoYnViko3Ee6W4PdRkyHSNqzwFmj8QVJIwjFCYgs3mnshrJBihH?= =?us-ascii?Q?kI12LJdyMppgn/6PRq7BVlDP6SB+LDcn39ZLBBOynzIGD690uRi6I+GrtY7T?= =?us-ascii?Q?S7uKSxE8Rm41VMCvE+UwbklsZixEkoMdn6Pnc14N7b0xF5PIW6DGxEzQchfj?= =?us-ascii?Q?NDLCcI+/dI1eRFv2vQwT0LNZZDBT5QyTkRGafXr+39eTFnwAYsgFFwzz6Ado?= =?us-ascii?Q?YPZwlyLElvR5yAo/rmldXzPFF2QHJ0+4KbXC0v+CpoYf/ntsUbZThlKu56bV?= =?us-ascii?Q?JpVsIY/hVD22sjrNJaV5h+db+oifCdstmBh1hYKyS7PDPcwXT6zAlif8B9JO?= =?us-ascii?Q?UWKlYNAG0fqhtGs3PGkuMRzyBxKQN/d5G2ItyLPaPth7Epd/CnjEeVVp5Uzt?= =?us-ascii?Q?qId5THlQ0DaxLK4FfTNbmUagtyOTsBl7ZfzUN/08OTIE0aCrycngiZiZ/dwX?= =?us-ascii?Q?vCDAC3aJvlZ2mBglKrEeBfrIUtZa/i2NBRZrKUfCr4npVDMCmAE0G8GCHH8c?= =?us-ascii?Q?f4SP7mtX5cuOj30gcY7njCMkD6n/VWZRswGy+AUgRhsvkFrfuP6Xqunc/9Df?= =?us-ascii?Q?ZqMUtyb1jJFnbMAXnM2WQ5NPoibsdcao+DIDCHZFzdN//pkW9TaKC+jezmPv?= =?us-ascii?Q?SAp5z7mbEzUPT38sv2bu6MQbJXafDxRSYhXftLBS3NH0f/HgZX76EmSWk3H7?= =?us-ascii?Q?IvG4ITQeP1Fo/Yh4T7kZb86Bql7icyqx9Sm6LUFhI/W0E1X8WExtpJPArG7+?= =?us-ascii?Q?oxB7XRciUqjsRsjfA7vdal68nuHQ/uceXC+cdsXMaB0YQ/KZsCSczocdSiLA?= =?us-ascii?Q?40OYPFC1a4V4aF1yjrOcHW4uCwNK4GDq6lsKP48/0y9SkZnxDo0lCMCx1a8e?= =?us-ascii?Q?BsLOxJxftJQzVCszEXFse5oTUkdY/dWOEttiXjeL6bISlDp+MVTRbKQhK2N+?= =?us-ascii?Q?0PU=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: 61765375-2c0c-430b-7e63-08d9414fdbe8 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2021 14:02:29.6378 (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: tMC3sY4Fk/Zkgmq2GLQIi6m1pjuNzcPhI85BtqtnxNw28pG3lp0YJMPNauH0E9Bn4AxE8x9rHHweYSi33XfVwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5006 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 Sunil, Replies are inline. > -----Original Message----- > From: Pai G, Sunil > Sent: Monday, July 5, 2021 10:58 PM > To: Jiang, Cheng1 ; maxime.coquelin@redhat.com; > Xia, Chenbo > Cc: dev@dpdk.org; Hu, Jiayu ; Yang, YvonneX > ; Jiang, Cheng1 > Subject: RE: [dpdk-dev] [PATCH v2 1/3] vhost: add unsafe API to drain pkt= s in > async vhost >=20 > Hi Cheng, >=20 > Comments inline. >=20 > >=20 > > +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); >=20 > I think the drain API here assumes there is per virtqueue assignment of D= MA > device which need not be true. > If there are multiple DMA devices per virtqueue , the application would n= eed > a mechanism to change the device id per call to the drain API. For now our async vhost didn't have the support for the usage of multiple D= MA devices per virtqueue. It's better that we change all the APIs at once in the future for the consi= stency if you need it. > So, its probably better to just call vhost_poll_enqueue_completed here an= d > return to the application ? and have the loop in the application instead = ? As for this one, I'm not sure why we need have the loop in the application. The function of this API is that caller need to drain all the inflight pkts= , it should be called only once to get the job done. Don't you think? Thanks. Cheng >=20 > > + > > + return n_pkts; > > +} > > + >=20 > >=20 >=20