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 CC58841B89; Tue, 31 Jan 2023 06:22:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8024410F6; Tue, 31 Jan 2023 06:22:40 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 67A19410F6 for ; Tue, 31 Jan 2023 06:22:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675142559; x=1706678559; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=8M5peXLuDqa/26QVI9/ZN9TZzkbjyMFA+WVUdOKYafc=; b=cpsjfc7IhXT/qPTAQkAWrd4X0e67rccNAUxgd+oxY4z0JGcNXdtJfxSB fZE+8LBM6fHbrppEyAExSQWEK4tm01xRilnFu75cNI9a4WHOD1RPmI3fX I8IpUGw7er31PhHcEP0N8E5SZw38kp2xQTSwOtH8piPgD1bPlsGsnG1RK zPPVpWJ8O4duorOrr8rP3/owNzyCp3JkcyH1Cpe9ULJAnZM00ZEaYqIZO 3fdxadmNRPjf51tHLxXhPDdZKZfMjm+R8qL+fKTrYXoSOZMYYSOV8xi0N Ra+WeUOeEuG+FcVThUzom6q+LM93de8BbK1+d8mg0x0kcJjivHI6tlNAq A==; X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="315716333" X-IronPort-AV: E=Sophos;i="5.97,259,1669104000"; d="scan'208";a="315716333" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 21:22:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="909777857" X-IronPort-AV: E=Sophos;i="5.97,259,1669104000"; d="scan'208";a="909777857" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga006.fm.intel.com with ESMTP; 30 Jan 2023 21:22:38 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.16; Mon, 30 Jan 2023 21:22:37 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 30 Jan 2023 21:22:37 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) 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.2507.16; Mon, 30 Jan 2023 21:22:37 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PxHiqHuPvuSqT/HSgmUtn5z7jt2Hp21UD/stLLEjUtdlTbn63pACmDCRz3OV3U4BtYUGStb71Fg6HmNFVWMCArpiM2b9zaA+BBq0UYohvz/X6xtr9avb5nF1n5I0x1tQNbcFr5c/U8N4mB6fprcgFv+gTKlOpnJ2kUxkahamA/IoDE5D42ePa1HMBr1BNNVQM4UFyfmvs7X1chtLU3F5eWST1et5TQ3RLInLqWfdc74a78kUFINgHd3DbtFLYrmvunjVz5wzkfiUCSOBuW0Ufh9xzC6K9bMiSTITM42fVmltTAGxu5MtCRPVGVNGPtOmKhhrmFy31NgQicwCjL95mQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pjn50PeO10WZTwCWsD5ZxM/L/9G/oBoevN/Yse0QV1Q=; b=eh36jBdz/9UhEpMyx+FCAVdnC0sJ7ga5VwCWw3NDDV4iBtwic6uPXlmg1slAZ8nqoX42BhQbxmdGX32F0kH7d8JXEsYn23jvcQsvBIteYd0qNQBXRCQvxW/hM1D6v3/DQEvDXpTcyTsbhqwlTswb53x25Zocu/Bm/K3pOzlI/5g/+d3lnCD098myOyFIopo/gXHlKARyrshAOq5hPxY84JTfP9O480WV009AD0OVC4IVYC3NIU8iioVyrAPoN6M6peMWsjHaTZoq3NFtOhGbMQw8bc5eiemVn8JauFLMdkI/ZkKJ+DAyZU8ZtwVmI1eY6O8tawQGrKg7cEdPpomnWw== 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 Received: from SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by SA2PR11MB5050.namprd11.prod.outlook.com (2603:10b6:806:fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Tue, 31 Jan 2023 05:22:35 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::c8f8:a3e1:5b23:a9c3]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::c8f8:a3e1:5b23:a9c3%5]) with mapi id 15.20.6043.036; Tue, 31 Jan 2023 05:22:35 +0000 From: "Xia, Chenbo" To: "Coquelin, Maxime" , "dev@dpdk.org" , "david.marchand@redhat.com" , "eperezma@redhat.com" Subject: RE: [PATCH v1 18/21] net/virtio-user: add new callback to enable control queue Thread-Topic: [PATCH v1 18/21] net/virtio-user: add new callback to enable control queue Thread-Index: AQHZBNR0yE8UeKqRm0y0AhbV30butK64XlsA Date: Tue, 31 Jan 2023 05:22:35 +0000 Message-ID: References: <20221130155639.150553-1-maxime.coquelin@redhat.com> <20221130155639.150553-19-maxime.coquelin@redhat.com> In-Reply-To: <20221130155639.150553-19-maxime.coquelin@redhat.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|SA2PR11MB5050:EE_ x-ms-office365-filtering-correlation-id: e9c17ed0-da93-4ea6-6029-08db034b2998 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: U6qhuu4MsickfPWebSG0N4Rxtjeu5RGOJOHpMX297UsJCTdTEkrValDEJHNlN0RGtXj0sub7YIc1OfzEtVCUi+3BSm63+cQnHyArhZaVtD9iUkuoOEUHMznmiuP0U6yiVBoghHZyb8MBiGE8ekMYgk+PO2R7/yYIJyg2hH+YF9mhQbwLcHUQO/XvXwllikO0cV4FRFls5IaqM5Xjcu+LsPcnH9eRzUAe3rirA4ct6tFOzL0r2ahMPHW+BZCHGH3X/1mp9zyhWS0h6kQv4WXUgHF0yoPeS5//QRWq6IAHZ8r1OPNEJcYzmP3Aud7+l8HOxPnNRGwT7ggU/9d7zqUSMFj0RdZXWJRmZDC1GSbAYZqzamjqdxwmxC6nSYX5doPJvS0aXceSi/MRpzulSQZosGkISBGUpYW8qJ0bOAQG8whSjNDGFz74/1AQIlWmhNkOqxKbnt2E09vGbRjD/j/EmNCLecVovEHcHipIgi+j3dtln9xJBcr6YBVmBT+k80GR/MwYHgH9z28zyXCw/Z6QiTMTMI+tFECcbZlgFUAiE3rAKz5BUR251P8cEL82vSZH0UhTkV1ZX/B3IUpCP7uXF6KNJK9uTXK/+uY2fxjkOaKF5jGFmPJ3fy0X5ePsGAtbt6d0qvNBx16qnTOSxabnIpT3IHOybRi9RObtkuOgL3V/gLV1DMt20IetJkmPIIy7gNWKtNj8kNHTOxlUI7pFnQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199018)(122000001)(110136005)(71200400001)(7696005)(33656002)(82960400001)(5660300002)(83380400001)(53546011)(55016003)(6506007)(38100700002)(316002)(52536014)(41300700001)(2906002)(86362001)(8936002)(38070700005)(9686003)(26005)(186003)(8676002)(478600001)(76116006)(64756008)(66556008)(66946007)(66476007)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uywjQ+0pC1+c6wbZfeZimZd1pvH8PfwQAp5MXSGoaz+IlKVwQ3HHULlwlQ5S?= =?us-ascii?Q?XvKqD40ZaAYFsc07fpg7XWTSG4jsEC/bjWLzR8SC3RaeCtpwBt5XKByNuXVq?= =?us-ascii?Q?Q8Z1u3QPp6OuwLYNs2hWkfymELnqA2gVXFEmyagD/sFxPRT6NnxsYZwLrGEf?= =?us-ascii?Q?p5TueZqeXN/EQ7ClGk63OMA+8LcJbAZo4yISSHn5g3cqEAl+Wf6N2wTNOAgM?= =?us-ascii?Q?nsd4e1hbLtczZBc6qviJ5QBpkCDZalSpnLqbpQe1eO/Lcv/VSb0pM4LL1bW6?= =?us-ascii?Q?hWa5/5hoWAKvhZ9QylG+ebb39KrzEGebRgp2AJmk06De/gzizmTD5AP/dxso?= =?us-ascii?Q?cij9e8BA1OlskuF5jd6qm//uXY7RYYrbm8jEtBQaO/5VCdtPYNz9ya6WBivj?= =?us-ascii?Q?79zjygtiwS5xxJntOY/09Z/PP6orWcohRPI6y/toqw0ZT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meTSP4CDQ1YK0gru0tfWGKLlX9OpIE6A0y//O8wom/THNBH7h?= =?us-ascii?Q?aIlc9mNEahrjsfMMw7UrKqksIDbYJFikpO8nVZF7EzCNf+lOoKHfsnV71ngQ?= =?us-ascii?Q?S7FG7amT5zI8THWApEwGKWX6TEUB2SD6dRsq+wXIiieEN3LcENaPgKn4dLxn?= =?us-ascii?Q?oUvVm7n8leOcJgyTVcKGIhMkYs7fZwfYh+6mMh2lggDnIUlu6IflU4y8xxDw?= =?us-ascii?Q?Xw6XW7N6dmzJ4617+BP1G4mG8iqUFMihHDas0A7G?= 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: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9c17ed0-da93-4ea6-6029-08db034b2998 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2023 05:22:35.7870 (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: 4yJyhK+/epuvB0O3nvzLjs5JjPOV4tPcB3Z49WfFfhsXnyQmSOSl3/OYF0CekxkoKlJsn+EkD87jE2f0SwUVzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5050 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Maxime Coquelin > Sent: Wednesday, November 30, 2022 11:57 PM > To: dev@dpdk.org; Xia, Chenbo ; > david.marchand@redhat.com; eperezma@redhat.com > Cc: Maxime Coquelin > Subject: [PATCH v1 18/21] net/virtio-user: add new callback to enable > control queue >=20 > This patch introduces a new callback that is to be called > when the backend supports control virtqueue. >=20 > Implementation for Vhost-vDPA backend is added in this patch. >=20 > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_user/vhost.h | 1 + > drivers/net/virtio/virtio_user/vhost_vdpa.c | 15 +++++++++++++++ > drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 +++ > 3 files changed, 19 insertions(+) >=20 > diff --git a/drivers/net/virtio/virtio_user/vhost.h > b/drivers/net/virtio/virtio_user/vhost.h > index dfbf6be033..f817cab77a 100644 > --- a/drivers/net/virtio/virtio_user/vhost.h > +++ b/drivers/net/virtio/virtio_user/vhost.h > @@ -82,6 +82,7 @@ struct virtio_user_backend_ops { > int (*get_config)(struct virtio_user_dev *dev, uint8_t *data, > uint32_t off, uint32_t len); > int (*set_config)(struct virtio_user_dev *dev, const uint8_t *data, > uint32_t off, > uint32_t len); > + int (*cvq_enable)(struct virtio_user_dev *dev, int enable); > int (*enable_qp)(struct virtio_user_dev *dev, uint16_t pair_idx, int > enable); > int (*dma_map)(struct virtio_user_dev *dev, void *addr, uint64_t > iova, size_t len); > int (*dma_unmap)(struct virtio_user_dev *dev, void *addr, uint64_t > iova, size_t len); > diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c > b/drivers/net/virtio/virtio_user/vhost_vdpa.c > index a0897f8dd1..3fd13d9fac 100644 > --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c > +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c > @@ -564,6 +564,20 @@ vhost_vdpa_destroy(struct virtio_user_dev *dev) > return 0; > } >=20 > +static int > +vhost_vdpa_cvq_enable(struct virtio_user_dev *dev, int enable) > +{ > + struct vhost_vring_state state =3D { > + .index =3D dev->max_queue_pairs * 2, > + .num =3D enable, > + }; > + > + if (vhost_vdpa_set_vring_enable(dev, &state)) > + return -1; > + > + return 0; > +} > + > static int > vhost_vdpa_enable_queue_pair(struct virtio_user_dev *dev, > uint16_t pair_idx, > @@ -629,6 +643,7 @@ struct virtio_user_backend_ops virtio_ops_vdpa =3D { > .set_status =3D vhost_vdpa_set_status, > .get_config =3D vhost_vdpa_get_config, > .set_config =3D vhost_vdpa_set_config, > + .cvq_enable =3D vhost_vdpa_cvq_enable, > .enable_qp =3D vhost_vdpa_enable_queue_pair, > .dma_map =3D vhost_vdpa_dma_map_batch, > .dma_unmap =3D vhost_vdpa_dma_unmap_batch, > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c > b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 1a5386a3f6..b0d603ee12 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -767,6 +767,9 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, > uint16_t q_pairs) > for (i =3D q_pairs; i < dev->max_queue_pairs; ++i) > ret |=3D dev->ops->enable_qp(dev, i, 0); >=20 > + if (dev->scvq) > + ret |=3D dev->ops->cvq_enable(dev, 1); > + > dev->queue_pairs =3D q_pairs; >=20 > return ret; > -- > 2.38.1 Reviewed-by: Chenbo Xia =20