From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shahaf Shuler Subject: Re: [PATCH 05/14] net/mlx5: add multiport IB device support to probing 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: Slava Ovsiienko , "dev@dpdk.org" Return-path: 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) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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.