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 0C593A0548; Fri, 9 Sep 2022 07:56:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98E6B40DDC; Fri, 9 Sep 2022 07:56:34 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id AA9E540A7E for ; Fri, 9 Sep 2022 07:56:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662702992; x=1694238992; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=4yn86lxVjfNcpaKRClrWNmceN6Ly8dBP+eRpmCKF9Rc=; b=DTMWDa1hOW0NL0hhzBgbjzpJg8nwQimP2eC0TNbwckYvU8fW99cL5KGY HpDu1QoppCmOlgDMZ3CLHF9f1qFU2+PUDzDxqZhXLBP9Ek2lw1TTp1N4w 3XjM5N5wgOVNEF7SHYmswpRfKWEXeizh6vCVVx9AhLyDav5MusDfP5sqE Fz77P5W0O6Sjkbz/1NRF9sct/K8mUQfMZGJLlstFWcDSF02lskjPoaQxs hYJpX7kMDZ5S1fUf6Dw+FeUuIVPLcdzkBrxZofg0IKQ+e5vBb8mgSnVUW LUMmPlgkJiF2G02sc/GUBGF+/u7y7YMLPQkc6yCzONA9LL/YVU+/UfQSV Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="296140733" X-IronPort-AV: E=Sophos;i="5.93,302,1654585200"; d="scan'208";a="296140733" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 22:56:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,302,1654585200"; d="scan'208";a="610950435" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga007.jf.intel.com with ESMTP; 08 Sep 2022 22:56:31 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 8 Sep 2022 22:56:30 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 8 Sep 2022 22:56:30 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.2375.31 via Frontend Transport; Thu, 8 Sep 2022 22:56:30 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) 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.2375.31; Thu, 8 Sep 2022 22:56:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XllFqLK8QTXItLpqaVfvRvqlkllAGB5wD9z0wNyC/Q+9D6gCW07lKGJnw5lqw0BliTDfRovTeAUL1SmVoaSARh/COZ5W/r7N+5dHSpoM5PAgsO0wVO6fxB3X3fs7U2Aclo6oW3PM3vHyUSgARDM6+fBaTI/PrvfMDAiOM1nwJjNZBO0FZTdpYnLMTzfdgW/E8WUYxXHT9TKgMu0hLzItHUGWRUTFHC9cgoADo1LK9o5kwJVf/LuUh0zEj5ULmmGn1Lvv2Ic2xBrqFOtfksF6sP2EWSU6AQVu7qu+fZR2kpOZWtlNbvGISoIYkFQccBGF6xw4/3TD35X5bLqYoks9bg== 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=YAj1lAx2lF9VTUZ+Ji6I4jkUPUP1kfOv64G8P2Wcy5Q=; b=mZfWruAaCLc0Lm973x3dFvNPUlE4fb/nX61d7vp2KRHzZmMvST5e3CqM0ushLHix5z7Pm7ORBH2GkoFLksUi3M10mNcb/Ymtujs8tkNwliG621Lom/EIPcmVelnjvjNShr++WKpg6MgMsZ0v1v5Pqxc1012v4ktqupFA/59YwvqCy1AIfnvIZx7IwecnMHebcbvSgptQ9QONL6WorHQ2MHAyQaw36dlapYpTawSGRgghMyLmzHmMsxKy4vVTZFgM0mJpFpfvcEQZFLkstGB05GlkaFvJK4TNZvb+q3HXh8w6FTUmbu/NqmtgOk6OU5hffhAmTxnZ/SNZ2/nm6vXtDw== 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 DM6PR11MB3499.namprd11.prod.outlook.com (2603:10b6:5:61::24) by MN2PR11MB4648.namprd11.prod.outlook.com (2603:10b6:208:26f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Fri, 9 Sep 2022 05:56:27 +0000 Received: from DM6PR11MB3499.namprd11.prod.outlook.com ([fe80::a879:d1a:5443:a35]) by DM6PR11MB3499.namprd11.prod.outlook.com ([fe80::a879:d1a:5443:a35%7]) with mapi id 15.20.5588.018; Fri, 9 Sep 2022 05:56:27 +0000 From: "Xia, Chenbo" To: "Pei, Andy" , "dev@dpdk.org" CC: "Xu, Rosen" , "Huang, Wei" , "Cao, Gang" , "maxime.coquelin@redhat.com" Subject: RE: [PATCH v2 3/8] vdpa/ifc: set max queues according to HW spec Thread-Topic: [PATCH v2 3/8] vdpa/ifc: set max queues according to HW spec Thread-Index: AQHYw0dX6O6RvKKb/0KOIEpOV4OHZ63WaBZQ Date: Fri, 9 Sep 2022 05:56:27 +0000 Message-ID: References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1662616458-164613-1-git-send-email-andy.pei@intel.com> <1662616458-164613-4-git-send-email-andy.pei@intel.com> In-Reply-To: <1662616458-164613-4-git-send-email-andy.pei@intel.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 300c6ba7-b61e-4464-916a-08da922808da x-ms-traffictypediagnostic: MN2PR11MB4648:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ce1FPIfFP+XWkcHj5+TBmdhAUZDIxJ6nf/6AFefyMzdrFWRRUQ9MsLQ0nsD/V+tGntZ5kS9YNdBXkVa/1UB/Hx9otterxA8MY5qDrgjFTcysdLUhLGBduTEJkBY4QAyOL15nZQ0QaUxTDH4PPaLSzvXmBmGuVkXuNU/fKb4+Q8NtdjhO7jydSzfFbhV7n6mxDkrVtsQDQL2lub84wNZfyX0vzszImPAwYTOdYbHhFPzekfodZjCt6/4iJ2uPoOj/B5ad2yOjFnjGpB/ft86zf3LdDqJ3jMkpvtLyKbcEeIPnpnNc4WXok3s08dY3zqCv2uSzKpUJGt47fUAfqvaPksRnhX+wLKjAriPreLL2k4rah9SI9T/FnQjP124sMXuQh03XKcBHS5yrDQcj7PVu03DER0NisAeDfciwRnCfKOmRNAa4t1ombU+uD8eJi4bw71Iwb2iZv0QTvWx1LF9oVX3lryrzKDI4hFVCBEHPKeNp3OajEwPEL7xVk1pZgG0gXzUiXgKTsZhZHm6gYotIEGaTVbC42d4t6HhIRCBjWT3RNyUC65SV1eqEjiP0Fxr6A7u2R34xtp4xdpOf9L3H5biGobEkpdVnn37E0Zx0Bm4v6Iy188TPt46x7bUth0/JiIF4zTL8VuGYR6TnVOZ5GoKNEzIOi7UMINTxgXud+H/b1YodtmcszLxSMgqHYeFgzXOOvwd4e/ATWIuF+2N06rsfAHFnC572lTuK9H1nLpzOlXi81lqq7JA6RaE0bP4/MDb4FP9Jynwm3FvQ3Jq1Mw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3499.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(346002)(376002)(396003)(136003)(366004)(53546011)(38070700005)(9686003)(26005)(71200400001)(86362001)(110136005)(54906003)(6506007)(7696005)(41300700001)(478600001)(122000001)(186003)(82960400001)(38100700002)(83380400001)(33656002)(8936002)(5660300002)(2906002)(52536014)(55016003)(4326008)(66476007)(64756008)(66556008)(66946007)(8676002)(76116006)(316002)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?x4oTOj0d6oMI2DXd56lwDhW+PhMIcep9Zq26N9NJbkQ/2G0xTW1N4gjnZjBj?= =?us-ascii?Q?GMYeazYWOBHX1IA2YfUnZxNQ9J4AYIZfD4/HkVbVg6WWCJ0439+3+sOiZjW6?= =?us-ascii?Q?g78VgXfXGVJraxR9PWFLfmrsR2+e3E8K96Z28kQZtNGZtjbJiI0iL00Aq1GP?= =?us-ascii?Q?LYcZtTWECaZpK7ZthTl1WzDmVElYeFC30HP3Tp7fs2sUSIKuSqWOEF7FHf46?= =?us-ascii?Q?dW4JSISMveGl3M5s7D/ev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=?us-ascii?Q?ucq98tU3xQYEeESyGXT+HRrENPx2YGUPrfSCHr0c4dXRO5mKjBq0Pbzkc6e+?= =?us-ascii?Q?p7b7Aeq8HDqUc2HIV3q1SEPQpwCAxXLqg64tQctHgQ+W4YTn96ML1P0P/d72?= =?us-ascii?Q?+wpvXY5/2a87bswQ8V2+V8D7R9p24mJw7IO1lPgLKMxXmz2jqiX8MIcNSDQg?= =?us-ascii?Q?Vr/4gP7IB+FcSNCVfbWyK1u7OyDixy/keX+dYuzfzrTUoJzNW1Ij5Ut2e5/Z?= =?us-ascii?Q?HwyjMv9NRrq8FELaxxFBUqd6kEy92WCNNJ0trmBKGlYYGFrC3eJnhc3vKfgx?= =?us-ascii?Q?xJYJz0pN3cB9VwI3A15F4U7kxgilX7Pcg1puIQzjtvKN9nE4bmMJVhhbyJ+k?= =?us-ascii?Q?Av2UZsRydgi9S+SCxHrXl1f4ShsqrDQH6kAaDJZQGDchoUMd5EIn3GdJAB37?= =?us-ascii?Q?gSkfAsdkp9yYn8A8fpVfh4qZC7vNmt01EBTkYpgH?= 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: DM6PR11MB3499.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 300c6ba7-b61e-4464-916a-08da922808da X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Sep 2022 05:56:27.0922 (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: 81cpsd/va1rdK8MFk+Ancbt3EUv3faGGFBrpEvmtACwrXUaI3r92J2auxP8eNjXlX2gBr9Tu+/Vmu91PTi0YNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4648 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: Pei, Andy > Sent: Thursday, September 8, 2022 1:54 PM > To: dev@dpdk.org > Cc: Xia, Chenbo ; Xu, Rosen ; > Huang, Wei ; Cao, Gang ; > maxime.coquelin@redhat.com; Huang Wei > Subject: [PATCH v2 3/8] vdpa/ifc: set max queues according to HW spec vdpa/ifc: set max queues based on virtio spec >=20 > Set max_queues according to virtio HW spec. > For virtio BLK device, set max_queues to the value of "num_queues". > "num_queues" is element of struct virtio_blk_config. Both virtio-net/blk should be described. >=20 > Signed-off-by: Andy Pei > Signed-off-by: Huang Wei Email is wrong, please fix all in next version > --- > drivers/vdpa/ifc/base/ifcvf.h | 2 +- > drivers/vdpa/ifc/ifcvf_vdpa.c | 21 ++++++++++++++++++++- > 2 files changed, 21 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.= h > index ad505f1..c17bf2a 100644 > --- a/drivers/vdpa/ifc/base/ifcvf.h > +++ b/drivers/vdpa/ifc/base/ifcvf.h > @@ -21,7 +21,7 @@ > #define IFCVF_NET_DEVICE_ID 0x0001 > #define IFCVF_BLK_DEVICE_ID 0x0002 >=20 > -#define IFCVF_MAX_QUEUES 1 > +#define IFCVF_MAX_QUEUES 32 >=20 > #ifndef VIRTIO_F_IOMMU_PLATFORM > #define VIRTIO_F_IOMMU_PLATFORM 33 > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.= c > index 2d165c0..2b42850 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -26,6 +26,18 @@ >=20 > #include "base/ifcvf.h" >=20 > +/* > + * RTE_MAX() and RTE_MIN() cannot be used since braced-group within > + * expression allowed only inside a function, but MAX() is used as > + * a number of elements in array. > + */ > +#ifndef MAX > +#define MAX(v1, v2) ((v1) > (v2) ? (v1) : (v2)) > +#endif > +#ifndef MIN > +#define MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2)) > +#endif Above ifndef is not needed? Seems MAX is not used, so remove it > + > RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE); > #define DRV_LOG(level, fmt, args...) \ > rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \ > @@ -1512,6 +1524,7 @@ struct rte_vdpa_dev_info dev_info[] =3D { > uint64_t capacity =3D 0; > uint8_t *byte; > uint32_t i; > + uint16_t queue_pairs; >=20 > if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) > return 0; > @@ -1559,7 +1572,6 @@ struct rte_vdpa_dev_info dev_info[] =3D { > } >=20 > internal->configured =3D 0; > - internal->max_queues =3D IFCVF_MAX_QUEUES; > features =3D ifcvf_get_features(&internal->hw); >=20 > device_id =3D ifcvf_pci_get_device_type(pci_dev); > @@ -1570,6 +1582,10 @@ struct rte_vdpa_dev_info dev_info[] =3D { >=20 > if (device_id =3D=3D VIRTIO_ID_NET) { > internal->hw.device_type =3D IFCVF_NET; > + queue_pairs =3D (internal->hw.common_cfg->num_queues - 1) / 2; Please note this logic assumes CTRL_VQ is always there, if for the read har= dware, that is the case, then it's fine. You can decide yourself to check CTRL_VQ = feature is there or not. Thanks, Chenbo > + DRV_LOG(INFO, "%s support %u queue pairs", pci_dev->name, > + queue_pairs); > + internal->max_queues =3D MIN(IFCVF_MAX_QUEUES, queue_pairs); > internal->features =3D features & > ~(1ULL << VIRTIO_F_IOMMU_PLATFORM); > internal->features |=3D dev_info[IFCVF_NET].features; > @@ -1609,6 +1625,9 @@ struct rte_vdpa_dev_info dev_info[] =3D { > internal->hw.blk_cfg->geometry.sectors); > DRV_LOG(DEBUG, "num_queues: 0x%08x", > internal->hw.blk_cfg->num_queues); > + > + internal->max_queues =3D MIN(IFCVF_MAX_QUEUES, > + internal->hw.blk_cfg->num_queues); > } >=20 > list->internal =3D internal; > -- > 1.8.3.1