From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80044.outbound.protection.outlook.com [40.107.8.44]) by dpdk.org (Postfix) with ESMTP id 5944A3772 for ; Thu, 28 Jun 2018 07:57:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qbI0qjqsWZ7AJEjrOMcOzZx0PreniTI1cqzuydssIJc=; b=dWbrFhet38R71I1laueFiwCkcTHY9lGZPBiaFvc9AeXl+HEpiSaEx9fr1Fg0/QC+4zRjnlUZuwULb4MkUG8jIC4c7+MWgBY5L2rF2eFTXLfwN+e8zOba+SD9DXCN9tw8FqCjrngbCSHijRMvAxSE7f5A1NqY2VIIfSQYUA/jfQo= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4458.eurprd05.prod.outlook.com (52.134.109.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.24; Thu, 28 Jun 2018 05:57:04 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::4c94:2db9:b8c5:cc6b]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::4c94:2db9:b8c5:cc6b%5]) with mapi id 15.20.0884.025; Thu, 28 Jun 2018 05:57:04 +0000 From: Shahaf Shuler To: Adrien Mazarguil CC: "Xueming(Steven) Li" , "dev@dpdk.org" , Guillaume Gaudonville , Wisam Monther , Raslan Darawsheh , Olga Shern Thread-Topic: [dpdk-dev] [PATCH v2 6/7] net/mlx5: probe all port representors Thread-Index: AQHUA7qglxyeqjm7kUStlpk5b3NHZ6RimMCAgAGgu8CACz2rAIAEuAKAgAEP2qA= Date: Thu, 28 Jun 2018 05:57:03 +0000 Message-ID: References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> <20180614083047.10812-1-adrien.mazarguil@6wind.com> <20180614083047.10812-7-adrien.mazarguil@6wind.com> <20180627133235.GW4025@6wind.com> In-Reply-To: <20180627133235.GW4025@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4458; 7:km4U6br1+07FwQAdgZPDQkcyu1vB9N+35VIm429IwkvECaoLk682ffuIZt4nUhXFkTqw66VX5GoCZpYxZ//rR81MmEAFRya6cNfvcegAY0r1OwZjtF1XKFaeaFgLG8LPn+SdBmLCLt3BMkyXl7A65TSrTO7cJpyjg4Yh1uCi+UBG/EjxXYx/p/gskqQ+XpgwkXrOUB1EMX/JCap3mMH+r7/QEcGL0vEWijxF+LRZB2u+8CMQT7J9q29nc0gJe3Li x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 64b012bf-bd5d-49f4-84ef-08d5dcbbf93c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4458; x-ms-traffictypediagnostic: DB7PR05MB4458: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4458; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4458; x-forefront-prvs: 0717E25089 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(376002)(396003)(346002)(136003)(52314003)(199004)(189003)(74316002)(102836004)(6916009)(5660300001)(68736007)(305945005)(476003)(66066001)(76176011)(446003)(11346002)(2900100001)(7696005)(97736004)(33656002)(6506007)(2906002)(316002)(229853002)(186003)(8936002)(99286004)(5250100002)(81166006)(81156014)(6436002)(26005)(86362001)(8676002)(107886003)(256004)(14444005)(6246003)(3846002)(6116002)(54906003)(25786009)(478600001)(4326008)(105586002)(55016002)(7736002)(53936002)(14454004)(9686003)(93886005)(106356001)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4458; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: f9lhfdAbQ52eyIGSueD8az99UrNMHOU4ABUJ9ZoKZTzXqKkhDKS0XnW5UjnAC1SK6k7cB/1zzSEbpQUAp1qbfqH2EtpKQqf38xyeDJRKE/gT+Wx/BIP1MlosofVd+aCmAgzVcOTYGzTNliYCmInzqUOkYKsd8EDYCX9tofDmvW5xi83IWLB6Xxt8S09i0wKEJUlcQt+2XZHLz5xsbpEG2vOlk3zLe2fLxwJeKCHSC4OUXIN8A82hA+7hGaui8LBUiMW8zXmErfnBniEjdo9xp/USFbTNfza3IFFhAJQ9olUeK5yezx8R5KnkRQrkh9ouQ/gtk3g8PBgR4Jj9yOV7FlHxbkgDUndPSguitBmUkNs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64b012bf-bd5d-49f4-84ef-08d5dcbbf93c X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2018 05:57:04.0020 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4458 Subject: Re: [dpdk-dev] [PATCH v2 6/7] net/mlx5: probe all port representors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 05:57:05 -0000 Wednesday, June 27, 2018 4:33 PM, Adrien Mazarguil: > Subject: Re: [dpdk-dev] [PATCH v2 6/7] net/mlx5: probe all port represent= ors >=20 > On Sun, Jun 24, 2018 at 01:33:31PM +0000, Shahaf Shuler wrote: > > One more input, > > > > Sunday, June 17, 2018 1:15 PM, Shahaf Shuler: > > > Subject: RE: [dpdk-dev] [PATCH v2 6/7] net/mlx5: probe all port > > > representors > > > > [...] > > > > > > > + eth_list =3D tmp; > > > > > for (i =3D 0; i < attr.orig_attr.phys_port_cnt; ++i) { > > > > > - eth_list[i] =3D mlx5_dev_spawn_one(dpdk_dev, > ibv_dev, vf, > > > > > - &attr, i + 1); > > > > > - if (eth_list[i]) > > > > > - continue; > > > > > - /* Save rte_errno and roll back in case of failure. */ > > > > > - ret =3D rte_errno; > > > > > - while (i--) { > > > > > - mlx5_dev_close(eth_list[i]); > > > > > - if (rte_eal_process_type() =3D=3D > RTE_PROC_PRIMARY) > > > > > - rte_free(eth_list[i]->data- > >dev_private); > > > > > - > claim_zero(rte_eth_dev_release_port(eth_list[i])); > > > > > - } > > > > > - free(eth_list); > > > > > - rte_errno =3D ret; > > > > > - return NULL; > > > > > + eth_list[n] =3D mlx5_dev_spawn_one(dpdk_dev, > ibv_dev[j], > > > > vf, > > > > > + &attr, i + 1, > > > > > + j ? eth_list[0] : NULL, > > > > > + j - 1); > > > > > > The representor id is according to the sort made by qsort (based on > > > device names). > > > A better way may be to set it according to the sysfs information, > > > like you do in the mlx5_get_ifname function. > > > What do you think? > > > > In fact relaying on linear increasing port numbers is dangerous. In may > break on special scenarios like BlueField. > > In BlueField there are representors between the x86 and the ARM cores. > Those are not VF representors. The phys_port_name of those is -1 and each > of them belongs to different phys_switch_id. > > > > We can argue whether it is correct/not to assign them w/ -1 value, but = I > think the suggested approach above can detect the right "vf_id" for those > and not break the current behavior on x86. > > Let me know if you have other suggestions. >=20 > I didn't know that. Assuming that with these, there is exactly only one > representor per device, I think we can manage, the main issue being that = "- > 1" will be difficult to parse as a valid "representor" argument which use= s "-" > for ranges. The -1 value is not for the representor id, It is for the id of the entity = which exists on the other size of the representor.=20 The repesentor index is still 0, meaning the command line -w ,repr= esentor=3D0 is correct on this case. The problems comes from the assumption you do in your code about the repres= entor id. What you do currently is to receive the representors and qsort them by devi= ce name. then you assign the priv->rep_id based on the qsort output. Later on when querying the if_name (mlx5_get_ifname) you assume that the ph= ys_port_name of representor (which include the enumeration of what exists o= n its other side) is the same. For x86 it probably works. On BlueField it breaks, as from some reason the = phys_port_name is -1.=20 My suggestion is to set the priv->rep_id based on the phys_port_name instea= d of qsort output.=20 >=20 > Anyway, I suggest to deal with Bluefield specifics in a subsequent series= . > This one focuses on and is validated with VF representors only. It is related to VF representors only. BlueField is just an example.=20 >=20 > -- > Adrien Mazarguil > 6WIND