From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 98725A0A03;
	Tue, 19 Jan 2021 09:11:47 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 273D4140CEF;
	Tue, 19 Jan 2021 09:11:47 +0100 (CET)
Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com
 [216.228.121.65])
 by mails.dpdk.org (Postfix) with ESMTP id 99DE5140CEA
 for <dev@dpdk.org>; Tue, 19 Jan 2021 09:11:45 +0100 (CET)
Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by
 hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA)
 id <B600694400001>; Tue, 19 Jan 2021 00:11:44 -0800
Received: from HQMAIL105.nvidia.com ([172.20.161.6])
 by hqpgpgate102.nvidia.com (PGP Universal service);
 Tue, 19 Jan 2021 00:11:44 -0800
X-PGP-Universal: processed;
 by hqpgpgate102.nvidia.com on Tue, 19 Jan 2021 00:11:44 -0800
Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL105.nvidia.com
 (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 19 Jan
 2021 08:11:43 +0000
Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com
 (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 19 Jan
 2021 08:11:32 +0000
Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.106)
 by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id
 15.0.1473.3 via Frontend Transport; Tue, 19 Jan 2021 08:11:32 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=BmhD8eIJvMMCJABhj7KUDDGXnL2vkubsEYaleUBfhKVNZaSTHIwlxNs9kAj03X55mccI/ZE9Bi8MRL0FFC53hODoTv5gyMvV71R6YB5OWszFGDJZmMQRiVBosX1szbLba2Rg/M/xSGipl4mKMf96FKTrwM3UOT2luAamnP0ldt3b97YPqP6EddILUlslYhms2viVA8HTjTZH4QD2vvwD45zFa5H933cPglPiVGl6Ka6X+7U+n18gtipOzJ2UpP8SSMBJ1Zays6np2BA0E1yQQ5pCsPI3QO74AXse8oHPooJjDHMMksGG0ts4DtrwaeplX/B8vLTvHkMbfsk02YrVUg==
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=mF/uJXVB40G3ZBR20XlLU8Nclwax57HqFvT1wl8nGgg=;
 b=Hd1eFfxzLcfFGzYlN8CaTs+ezAIh9lmNWQD0xBy4O3j/+yL+0ajDEnK+tMFGjKSx6IQtxhHAlIoUeOpoo0+i9aaz3tZvZQ6wmrUiuKyvGBG6w3/5gv8lUluZKqpNDHa5HSl2kwGqy5X4H19ZG/eYcIo+7kiy812BEiBIPXG+S2ZITevOubJhTbaDPTB+yg/Z0Z3L9dlH1sPg9ilwXsVFHwZ3hadZ+98BhaHCt2tb/ZjizJ8OFl/CHs43Pu055/rxson1Nr8j3pwsDLu8nf/l0BheJqjgMOWvn1Gx64B078BjWqtVpveV8S6POk3hsu/+pgItDa7Gd9QCk1zpPQsTBg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
 dkim=pass header.d=nvidia.com; arc=none
Received: from BY5PR12MB4324.namprd12.prod.outlook.com (2603:10b6:a03:209::10)
 by BY5PR12MB3907.namprd12.prod.outlook.com (2603:10b6:a03:1ad::16)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Tue, 19 Jan
 2021 08:11:30 +0000
Received: from BY5PR12MB4324.namprd12.prod.outlook.com
 ([fe80::8d03:2ada:5add:965d]) by BY5PR12MB4324.namprd12.prod.outlook.com
 ([fe80::8d03:2ada:5add:965d%3]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021
 08:11:30 +0000
From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: "Wang, Haiyue" <haiyue.wang@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, Slava Ovsiienko <viacheslavo@nvidia.com>,
 Asaf Penso <asafp@nvidia.com>, Ajit Khaparde <ajit.khaparde@broadcom.com>,
 Somnath Kotur <somnath.kotur@broadcom.com>, "Daley, John"
 <johndale@cisco.com>, Hyong Youb Kim <hyonkim@cisco.com>, "Xing, Beilei"
 <beilei.xing@intel.com>, "Guo, Jia" <jia.guo@intel.com>, Matan Azrad
 <matan@nvidia.com>, Shahaf Shuler <shahafs@nvidia.com>, "NBU-Contact-Thomas
 Monjalon" <thomas@monjalon.net>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, Ray Kinsella
 <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>
Thread-Topic: [PATCH v5 7/9] devarg: change representor ID to bitmap
Thread-Index: AQHW7jL/vyA5VEbadUS9aFDT0zrPxqoujz+AgAAJlIA=
Date: Tue, 19 Jan 2021 08:11:30 +0000
Message-ID: <BY5PR12MB43240B4EB6C810D238A00A64A1A30@BY5PR12MB4324.namprd12.prod.outlook.com>
References: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com>
 <1611040501-11666-7-git-send-email-xuemingl@nvidia.com>
 <BN8PR11MB37958565131DFDEB9AE100EDF7A30@BN8PR11MB3795.namprd11.prod.outlook.com>
In-Reply-To: <BN8PR11MB37958565131DFDEB9AE100EDF7A30@BN8PR11MB3795.namprd11.prod.outlook.com>
Accept-Language: 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=nvidia.com;
x-originating-ip: [180.162.33.127]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 528d09b0-f48e-46ff-dee4-08d8bc51d3f4
x-ms-traffictypediagnostic: BY5PR12MB3907:
x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BY5PR12MB390763FA1267BBD18E158ADAA1A30@BY5PR12MB3907.namprd12.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: e+ht69h2cNyoOjLEfq71Zi1JoHSa7IlRkHOkHQiNWKb2KKBKOpblOCo6WlnlHNlQM8JdfIT5KOlRCoPWPxwuLKqQmI6zpa1tMhTiLkqmKiJWs34/N+1SvGfrsA2U2Aiv9GJgjgWSl8CmToJzGVQaDedRxd+A23oy+XJYoqnRPbaBqbeya8yOvG45edfyl95k7nhBXBWTHSSQLYZIEgGvZKp17NadlxgSkiZRPv7eWI/roDxy+W+INuvHI8UNaN+ogkBh1XYjirIRBtJNHwhDXQzLehrP7AzvfvJ6QBPX2SamprkhS7p67Mx/QsBZ6/PZP8prbDD5JoEkaFGSsm6BXHmZeDkb8+hIT5mW6q7/xJGSb4J0H/o0J6vK0Gfci8v58/bIUIO5xVl1vo323rykGQ==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BY5PR12MB4324.namprd12.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(396003)(376002)(346002)(39860400002)(136003)(366004)(54906003)(8676002)(316002)(478600001)(2906002)(7696005)(8936002)(55016002)(9686003)(6916009)(71200400001)(52536014)(7416002)(66476007)(66946007)(66446008)(64756008)(6506007)(5660300002)(186003)(83380400001)(33656002)(76116006)(26005)(66556008)(86362001)(4326008);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?us-ascii?Q?rUAQUgSILNkCTiA46nim7rXBdVTXM7WrTujuec82O+STHTfwTJ1vbO6rm9uL?=
 =?us-ascii?Q?CVHVzHpznNKvdtD7FmQOZQaMsxFI9ooHSTaus4rHF6zbTbJlI0q5gYEtg89I?=
 =?us-ascii?Q?HWsyfDMzyhrAB8vsbzFNlp9Xwo/EFyFiVaM009STFHjQTfbhiq4EoM/HxoDz?=
 =?us-ascii?Q?RptIQDb/OvRo5jJlf9f7SrvbXtI1jWQzqig/TbTO2YN04iCyMqlzwTVkuf0O?=
 =?us-ascii?Q?8yj7FSmo6k5rCcRP6gdnJ33fSo1nRNdmWT9/LHRkKapEnQ9Jeal7a7cEiseu?=
 =?us-ascii?Q?+GSG2otPIdGgz/SCGx5PKVr2mo4D6z2V+lo+K4UGvK3oOOxw/qmUay6ElS5Z?=
 =?us-ascii?Q?2qaou1ovothmQCxwa88GENpFhtU85S535h0F8Kfftz/qdGcoy6o/RE2ljs5O?=
 =?us-ascii?Q?+mmWwTd2zg/hi14bY4MRm8u7ZJ8LfJ80UDiBa4rNDJpcOdHqB56bJAc8iylA?=
 =?us-ascii?Q?JE8LwdixTbCUnEX6xdOF4g88/sE5M+BvqvCFOEv9vSQJ6rTyZuVio8gU21Ld?=
 =?us-ascii?Q?42GB3eLawvRmThlzdCtR5XvILZRFxGfKbVTlpyj+xcBao7Li10pKdyRSjpQJ?=
 =?us-ascii?Q?48GltmaDS/HlNCdH77lyJL9Eu7LbHnw352ly8tqtntbbiqy0SEG6Rl7OzNcK?=
 =?us-ascii?Q?TSjKE/b8qfbzJWWstF72OkgLAJueE/PtY5RZaLyzqnQIEyFHVv5MMNfqDllr?=
 =?us-ascii?Q?r+xwmtbC3SgsXPQuJ6DsSI00lGI+jZYwZpNJL3A+YXyWRitM9IeDeZzofTYv?=
 =?us-ascii?Q?pEqRgEzE81qfnahrkjLkIXD3rdSe1x8l2MofSEUX+2ljaUgjFRUpO3Nhplqm?=
 =?us-ascii?Q?mB2Z5srbZG7+QGfJ74UiKidpgU9Hjj4BdvWNgnW3Fw20JWfOC620ITgT6CXy?=
 =?us-ascii?Q?romHbjQ88/ouhz6d+Yc77PPIo4u0qDfdZZtSjPiVQUGWagRG+Mw2MhLE22Dt?=
 =?us-ascii?Q?MtFtVR6PTVGDfIc0Bf/4CyYkOyTT31i0diLvsYXAMbw=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: BY5PR12MB4324.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 528d09b0-f48e-46ff-dee4-08d8bc51d3f4
X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2021 08:11:30.4978 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: nVxeZAm0YfwlDDAsBmu8vqA9loAXq9fA6iM2+LPn7vp+ml7yIWlMeEg5aYfWYUOX13AnhxzS8SmaQrmItSEs4Q==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3907
X-OriginatorOrg: Nvidia.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1;
 t=1611043904; bh=mF/uJXVB40G3ZBR20XlLU8Nclwax57HqFvT1wl8nGgg=;
 h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature:
 ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:
 Thread-Index:Date:Message-ID:References:In-Reply-To:
 Accept-Language:Content-Language:X-MS-Has-Attach:
 X-MS-TNEF-Correlator:authentication-results:x-originating-ip:
 x-ms-publictraffictype:x-ms-office365-filtering-correlation-id:
 x-ms-traffictypediagnostic:x-ld-processed:
 x-ms-exchange-transport-forked:x-microsoft-antispam-prvs:
 x-ms-oob-tlc-oobclassifiers:x-ms-exchange-senderadcheck:
 x-microsoft-antispam:x-microsoft-antispam-message-info:
 x-forefront-antispam-report:x-ms-exchange-antispam-messagedata:
 Content-Type:Content-Transfer-Encoding:MIME-Version:
 X-MS-Exchange-CrossTenant-AuthAs:
 X-MS-Exchange-CrossTenant-AuthSource:
 X-MS-Exchange-CrossTenant-Network-Message-Id:
 X-MS-Exchange-CrossTenant-originalarrivaltime:
 X-MS-Exchange-CrossTenant-fromentityheader:
 X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype:
 X-MS-Exchange-CrossTenant-userprincipalname:
 X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg;
 b=ZOWafuw9Rm0/52k2ylf+W8ieeSJBdTCksAp6moKTQBqA1piKNEyh8f45CFgDSruiT
 ULZ+d04cJDl0utbCLO0JRYTP3PPbfNvTWDYEYldjwRmvpy+WmVrpyhyp2Be/iwEPED
 8VKi6skKlQuR0xvAX1GaSR/NEJ6DoQCKEKzhU4c2oYKFBltw4ZVcR4lfpSYoZ4u45L
 JRATAFog2h8yBJbqeZMJuzFoCsmkBXaT2kUJ2LfEW8agmpfRs8+ItPucRzWMv0xPV8
 gK+BA3MBOby25awZ2OA05KH2kech4WiGaUPlpR4Omc1rNhs1vaUptV3a9AHDniwU9i
 5Vcc7r/gTSnjw==
Subject: Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to
 bitmap
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi Haiyue,

>-----Original Message-----
>From: Wang, Haiyue <haiyue.wang@intel.com>
>Sent: Tuesday, January 19, 2021 3:37 PM
>To: Xueming(Steven) Li <xuemingl@nvidia.com>
>Cc: dev@dpdk.org; Slava Ovsiienko <viacheslavo@nvidia.com>; Asaf Penso
><asafp@nvidia.com>; Ajit Khaparde <ajit.khaparde@broadcom.com>;
>Somnath Kotur <somnath.kotur@broadcom.com>; Daley, John
><johndale@cisco.com>; Hyong Youb Kim <hyonkim@cisco.com>; Xing, Beilei
><beilei.xing@intel.com>; Guo, Jia <jia.guo@intel.com>; Matan Azrad
><matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; NBU-Contact-
>Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
><ferruh.yigit@intel.com>; Andrew Rybchenko
><andrew.rybchenko@oktetlabs.ru>; Ray Kinsella <mdr@ashroe.eu>; Neil
>Horman <nhorman@tuxdriver.com>
>Subject: RE: [PATCH v5 7/9] devarg: change representor ID to bitmap
>
>> -----Original Message-----
>> From: Xueming Li <xuemingl@nvidia.com>
>> Sent: Tuesday, January 19, 2021 15:15
>> Cc: dev@dpdk.org; Viacheslav Ovsiienko <viacheslavo@nvidia.com>;
>> xuemingl@nvidia.com; Asaf Penso <asafp@nvidia.com>; Ajit Khaparde
>> <ajit.khaparde@broadcom.com>; Somnath Kotur
>> <somnath.kotur@broadcom.com>; Daley, John <johndale@cisco.com>;
>Hyong
>> Youb Kim <hyonkim@cisco.com>; Xing, Beilei <beilei.xing@intel.com>;
>> Guo, Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>;
>> Matan Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
>> Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
>> <ferruh.yigit@intel.com>; Andrew Rybchenko
>> <andrew.rybchenko@oktetlabs.ru>; Ray Kinsella <mdr@ashroe.eu>; Neil
>> Horman <nhorman@tuxdriver.com>
>> Subject: [PATCH v5 7/9] devarg: change representor ID to bitmap
>>
>> The NIC can have multiple PCIe links and can be attached to multiple
>> hosts, for example the same single NIC can be shared for multiple
>> server units in the rack. On each PCIe link NIC can provide multiple
>> PFs and VFs/SFs based on these ones. The full representor identifier
>> consists of three indices - controller index, PF index, and VF or SF ind=
ex (if
>any).
>>
>> SR-IOV and SubFunction are created on top of PF. PF index is
>> introduced because there might be multiple PFs in the bonding
>> configuration and only bonding device is probed.
>>
>> In eth representor comparator callback, ethdev was compared with devarg.
>> Since ethdev representor port didn't contain controller index and PF
>> index information, callback returned representor from other PF or
>> controller.
>>
>> This patch changes representor ID to bitmap so that the ethdev
>> representor comparer callback returns correct ethdev by comparing full
>> representor information including: controller index, PF index,
>> representor type, SF or VF index.
>>
>> Representor ID bitmap definition:
>>  xxxx xxxx xxxx xxxx
>>  |||| |LLL LLLL LLLL vf/sf id
>>  |||| L 1:sf, 0:vf
>>  ||LL pf id
>>  LL controller(host) id
>>
>> This approach keeps binary compatibility with all drivers, VF
>> representor id matches with simple id for non-bonding and
>> non-multi-host configurations.
>>
>> In the future, the representor ID field and each section should extend
>> to bigger width to support more devices.
>>
>> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
>> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
>> Acked-by: Thomas Monjalon <thomas@monjalon.net>
>> ---
>>  drivers/net/bnxt/bnxt_reps.c             |  3 +-
>>  drivers/net/enic/enic_vf_representor.c   |  3 +-
>>  drivers/net/i40e/i40e_vf_representor.c   |  3 +-
>>  drivers/net/ixgbe/ixgbe_vf_representor.c |  3 +-
>>  drivers/net/mlx5/linux/mlx5_os.c         |  4 +-
>>  lib/librte_ethdev/rte_class_eth.c        | 38 +++++++++++++----
>>  lib/librte_ethdev/rte_ethdev.c           | 26 ++++++++++++
>>  lib/librte_ethdev/rte_ethdev_driver.h    | 53 ++++++++++++++++++++++++
>>  lib/librte_ethdev/version.map            |  2 +
>>  9 files changed, 122 insertions(+), 13 deletions(-)
>>
>
>
>> +uint16_t
>> +rte_eth_representor_id_encode(uint16_t controller, uint16_t pf,
>> +			      enum rte_eth_representor_type type,
>> +			      uint16_t representor_port)
>> +{
>> +	return (((controller & 3) << 14) |
>> +		((pf & 3) << 12) |
>> +		(!!(type =3D=3D RTE_ETH_REPRESENTOR_SF) << 11) |
>> +		(representor_port & 0x7ff));
>> +}
>> +
>> +uint16_t
>> +rte_eth_representor_id_parse(const uint16_t representor_id,
>> +			     uint16_t *controller, uint16_t *pf,
>> +			     enum rte_eth_representor_type *type) {
>> +	if (controller)
>> +		*controller =3D (representor_id >> 14) & 3;
>> +	if (pf)
>> +		*pf =3D (representor_id >> 12) & 3;
>> +	if (type)
>> +		*type =3D ((representor_id >> 11) & 1) ?
>> +			RTE_ETH_REPRESENTOR_SF :
>RTE_ETH_REPRESENTOR_VF;
>> +	return representor_id & 0x7ff;
>> +}
>> +
>
>Rename 'parse' to 'decode' ? Since not parse from string. ;-) The these tw=
o
>functions are pair style.
>
>rte_eth_representor_id_encode / rte_eth_representor_id_decode ?

Nice catch, thanks!
>
>> 2.25.1