From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9BE82A05D3 for ; Sun, 24 Mar 2019 10:00:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CC361B7E7; Sun, 24 Mar 2019 10:00:17 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60070.outbound.protection.outlook.com [40.107.6.70]) by dpdk.org (Postfix) with ESMTP id 33D821B7E3 for ; Sun, 24 Mar 2019 10:00:16 +0100 (CET) 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=/Oes2O+DQ1egzgBUC+/bMzDmbTzFqlPVukSgHj2bj8A=; b=mQNzpYAzoJu+b5Nyl9KL1NcAu+zntJdY9fXGTEO7SA5ijcOKrHkpuR/j2aHB03sSkLsUmBDhqv38BX+nBWVuzoZSdVZVDbYLkzAevZZ5jCZ3oz0Uzjh0y1lp7hLsWkdoTYM9HVPhqR+6ZbKuiwSQxHlFAQRWzuJoOYwGVleMTwg= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3617.eurprd05.prod.outlook.com (52.133.45.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.17; Sun, 24 Mar 2019 09:00:15 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003%2]) with mapi id 15.20.1730.019; Sun, 24 Mar 2019 09:00:15 +0000 From: Shahaf Shuler To: Slava Ovsiienko , "dev@dpdk.org" Thread-Topic: [PATCH 05/14] net/mlx5: add multiport IB device support to probing Thread-Index: AQHU373H2PfHnJ4WMEK3krmil8qCHKYVzePwgAA9BoCAAAEFAIAEdEKg Date: Sun, 24 Mar 2019 09:00:15 +0000 Message-ID: References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-6-git-send-email-viacheslavo@mellanox.com> In-Reply-To: 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-ms-office365-filtering-correlation-id: c788ea1c-dea0-4309-befd-08d6b0372199 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB3617; x-ms-traffictypediagnostic: AM0PR0502MB3617: x-microsoft-antispam-prvs: x-forefront-prvs: 09860C2161 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(39850400004)(376002)(366004)(189003)(199004)(11346002)(33656002)(14454004)(476003)(14444005)(55016002)(8936002)(25786009)(9686003)(68736007)(186003)(6246003)(256004)(6506007)(76176011)(102836004)(5660300002)(6436002)(229853002)(478600001)(53936002)(26005)(93886005)(7696005)(97736004)(486006)(52536014)(74316002)(66066001)(106356001)(446003)(305945005)(3846002)(6116002)(86362001)(7736002)(99286004)(71190400001)(71200400001)(81156014)(81166006)(2906002)(2501003)(316002)(110136005)(8676002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3617; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: K75XvPznWu43zqMVCwn6qjQo/o9aA1hpcYJ6TF05jgWkCaBcQ4HltL5vQnjxxA3f37mr+XyTM7W7Lx9xDPunr6+7JRAlfqk/HvF8e4073ZufzyuVqd5hOitr1zW10pukruvxbjxtpl1xL1ke7p6g2hogTKskVMrz+i7U9I1O6wucXi4I54DlMmtHJLZAm/U9GvgjIo2zgDgreLJ5SmF06nA4K4QJNWSOPSkU3UFjrCGXqIHmCEutCbApbnxpGiW5dAfIX/uVoWNSKqT2TNcEhuY/6XWJ8z7at9jNEK9DoeGxVvrV7F27AiP1gy5q1jzm+YIryjLllDbIMk/PXYEn/oMeanZBUlOAqKqSdrb624Fw8zSYeSjFbR78SyNJsU/0mGo5CiVHwq9CrgjimWyHmAxw+o1Zc2p1hyCi77WNDhQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: c788ea1c-dea0-4309-befd-08d6b0372199 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Mar 2019 09:00:15.1927 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3617 Subject: Re: [dpdk-dev] [PATCH 05/14] net/mlx5: add multiport IB device support to probing 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190324090015.UXU0NtjJNlaMQstej2jfCTGaqoIQzW_BqsC0JtCwa3E@z> Thursday, March 21, 2019 2:58 PM, Slava Ovsiienko: > Subject: RE: [PATCH 05/14] net/mlx5: add multiport IB device support to > probing >=20 > Sorry, missed some comments. Here is my extra answers. >=20 [...] > > -----Original=20 callback to sort device data. > > > > * > > > > @@ -1380,7 +1381,9 @@ struct mlx5_dev_spawn_data { > > > > struct rte_pci_device *pci_dev) { > > > > struct ibv_device **ibv_list; > > > > - unsigned int n =3D 0; > > > > + unsigned int nd =3D 0; > > > > + unsigned int np =3D 0; > > > > + unsigned int ns =3D 0; > > > > > > This fields names are not informative. Find a better ones. > > > > Would the adding clarifying comments be enough ? Yes it will be OK. > > > > nd - Number of (PCI) Devices (nd !=3D 1 means we have multiple device= s > with > > the same BDF - old schema) > > np - Number of (device) Ports (nd =3D1, np 1...n means we have new > > multiport > > device) ns - Number to Spawn (deduced index - number of iterations) > > > > This names are used as indices, long names may make code less > > readable, IMHO. > > > > > > > > > struct mlx5_dev_config dev_config; > > > > int ret; > > > > > > > > @@ -1392,8 +1395,14 @@ struct mlx5_dev_spawn_data { > > > > DRV_LOG(ERR, "cannot list devices, is ib_uverbs loaded?"); > > > > return -rte_errno; > > > > } > > > > - > > > > + /* > > > > + * First scan the list of all Infiniband devices to find > > > > + * matching ones, gathering into the list. > > > > + */ > > > > struct ibv_device *ibv_match[ret + 1]; > > > > + int nl_route =3D -1; > > > > + int nl_rdma =3D -1; > > > > + unsigned int i; > > > > > > > > while (ret-- > 0) { > > > > struct rte_pci_addr pci_addr; > > > > @@ -1408,77 +1417,183 @@ struct mlx5_dev_spawn_data { > > > > continue; > > > > DRV_LOG(INFO, "PCI information matches for device > \"%s\"", > > > > ibv_list[ret]->name); > > > > - ibv_match[n++] =3D ibv_list[ret]; > > > > + ibv_match[nd++] =3D ibv_list[ret]; > > > > + } > > > > + ibv_match[nd] =3D NULL; > > > > + if (!nd) { > > > > + /* No device macthes, just complain and bail out. */ > > > > + mlx5_glue->free_device_list(ibv_list); > > > > + DRV_LOG(WARNING, > > > > + "no Verbs device matches PCI device " PCI_PRI_FMT > > > > "," > > > > + " are kernel drivers loaded?", > > > > + pci_dev->addr.domain, pci_dev->addr.bus, > > > > + pci_dev->addr.devid, pci_dev->addr.function); > > > > + rte_errno =3D ENOENT; > > > > + ret =3D -rte_errno; > > > > + return ret; > > > > + } > > > > + nl_route =3D mlx5_nl_init(NETLINK_ROUTE); > > > > + nl_rdma =3D mlx5_nl_init(NETLINK_RDMA); > > > > + if (nd =3D=3D 1) { > > > > + /* > > > > + * Found single matching device may have multiple ports. > > > > + * Each port may be representor, we have to check the port > > > > + * number and check the representors existence. > > > > + */ > > > > + if (nl_rdma >=3D 0) > > > > + np =3D mlx5_nl_portnum(nl_rdma, ibv_match[0]- > > > > >name); > > > > + if (!np) > > > > + DRV_LOG(WARNING, "can not get IB device \"%s\"" > > > > + " ports number", ibv_match[0]- > > > > >name); > > > > > > This warning is misleading. On old kernels it is expected to have > > > multiple IB devices instead of a single one w/ multiple ports. > > > The level should be changed for debug, and the syntax to express it > > > is not an error. >=20 > On old kernels we should get np =3D 1. If np =3D=3D 0 it means an error, = even if > there is old kernel. Zero np means that is something is going in wrong wa= y > and we should notify the user. We do not expect this behavior from old/ne= w > kernels, so this message should not be annoying. OK.