From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50068.outbound.protection.outlook.com [40.107.5.68]) by dpdk.org (Postfix) with ESMTP id 764201B4D1 for ; Thu, 21 Mar 2019 13:58:25 +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=qTOVa8+i3yY+DLAMKKwWrZaOAO8vPYPhFptuI3iP5Ho=; b=HLb2UGfLoriiUddX3RSsXZd74A3B4Cg3Scun03waj03gUeP6BnpixVP7s5qBJl9OLSVQYMcYH0pbxhuJxi3dfWMuaKIDzaQlXwMIUoulYCFEKpw71zaXojiyotOpbvjHSvYAvutOsObBtFI8xW6RCHjQ9KKcXoFbmAo3rCpbaSk= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3345.eurprd05.prod.outlook.com (10.171.189.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Thu, 21 Mar 2019 12:58:24 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02%3]) with mapi id 15.20.1709.015; Thu, 21 Mar 2019 12:58:24 +0000 From: Slava Ovsiienko To: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB Thread-Index: AQHU39+b+QlCTCld5ESAtqO/h3hxtaYWBt8g Date: Thu, 21 Mar 2019 12:58:24 +0000 Message-ID: References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-4-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=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fbed805d-a03e-41c5-d726-08d6adfce73c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3345; x-ms-traffictypediagnostic: AM4PR05MB3345: x-microsoft-antispam-prvs: x-forefront-prvs: 0983EAD6B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(366004)(396003)(136003)(346002)(13464003)(199004)(189003)(99286004)(256004)(229853002)(8936002)(6116002)(11346002)(446003)(7696005)(110136005)(3846002)(25786009)(53936002)(76176011)(26005)(71190400001)(71200400001)(2906002)(6506007)(68736007)(55016002)(53546011)(476003)(86362001)(6246003)(9686003)(6436002)(102836004)(186003)(316002)(52536014)(8676002)(486006)(305945005)(7736002)(81156014)(97736004)(106356001)(81166006)(5660300002)(478600001)(2501003)(74316002)(66066001)(93886005)(105586002)(33656002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3345; H:AM4PR05MB3265.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hIHxwQVDCxdsRY9cb8DnznMK0KkvU0YJbgn7SCHrdoVaZbuxualPlMuXcQegjlfuCGurTVe94bjJoL/qFCDBnUx4oFkYk9akCyRj1L/jQJa3tXwPI6fdOnf7VNXzL7Q2uEJoPW5uatojNyd8Ohz5pdFnq/PfgjkeIkIkfNQUh6Bgz5RYpCJnEYQ+srX2aNpPp/TZ0tFn8QQqENNk/UW56YMO3SFTfd/6e7pmZbfMGlrBV5HTYHec23Fqh3kzEDH1rVWM/rNW5jz5bBB4McmQObv5XvAIPwlMHdc1mcckkNjrtc2cmnhKOpKAS+B83CjY8PWiPQIgpzJFY82X37Xad57ta6PNiRVqrszvn4zkf916iIR+BHEZ0o6hqoxx36aCOkvWtwGBA+xw3TLw5hxNyKpY8LApueUsd8oannVsFeY= 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: fbed805d-a03e-41c5-d726-08d6adfce73c X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2019 12:58:24.1681 (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: AM4PR05MB3345 Subject: Re: [dpdk-dev] [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB 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, 21 Mar 2019 12:58:25 -0000 > -----Original Message----- > From: Shahaf Shuler > Sent: Thursday, March 21, 2019 14:14 > To: Slava Ovsiienko ; dev@dpdk.org > Subject: RE: [PATCH 03/14] net/mlx5: modify get ifindex routine for multi= port > IB >=20 > Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko: > > Subject: [PATCH 03/14] net/mlx5: modify get ifindex routine for > > multiport IB > > > > There is the routine mlx5_nl_ifindex() returning the network interface > > index associated with Infiniband device. > > We are going to support multiport IB devices, now function takes the > > IB port as argument and returns ifindex associated with tuple > device, IB port> > > > > Signed-off-by: Viacheslav Ovsiienko > > --- > > drivers/net/mlx5/mlx5.c | 2 +- > > drivers/net/mlx5/mlx5.h | 2 +- > > drivers/net/mlx5/mlx5_ethdev.c | 2 +- > > drivers/net/mlx5/mlx5_nl.c | 20 +++++++++++++------- > > 4 files changed, 16 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > > ea3d00c..89c30af 100644 > > --- a/drivers/net/mlx5/mlx5.c > > +++ b/drivers/net/mlx5/mlx5.c > > @@ -1441,7 +1441,7 @@ struct mlx5_dev_spawn_data { > > list[i].ifindex =3D 0; > > else > > list[i].ifindex =3D mlx5_nl_ifindex > > - (nl_rdma, list[i].ibv_dev->name); > > + (nl_rdma, list[i].ibv_dev->name, 1); >=20 > Why hardcoded to 1? Because the given part of patchset regards only mlx5_nl_ifindex() change. We are not introducing the multiport Infiniband device right now and here, it is coming in the next parts of the patchset. This "hardcoded 1" will be replaced by actual index (please, see the next parts). >=20 > > if (nl_route < 0 || > > !list[i].ifindex || > > mlx5_nl_switch_info(nl_route, list[i].ifindex, diff --git > > a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > > 1716cd1..f5e29ca 100644 > > --- a/drivers/net/mlx5/mlx5.h > > +++ b/drivers/net/mlx5/mlx5.h > > @@ -470,7 +470,7 @@ int mlx5_nl_mac_addr_remove(struct rte_eth_dev > > *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_flush(struct > > rte_eth_dev *dev); int mlx5_nl_promisc(struct rte_eth_dev *dev, int > > enable); int mlx5_nl_allmulti(struct rte_eth_dev *dev, int enable); - > > unsigned int mlx5_nl_ifindex(int nl, const char *name); > > +unsigned int mlx5_nl_ifindex(int nl, const char *name, uint32_t > > +pindex); > > int mlx5_nl_switch_info(int nl, unsigned int ifindex, > > struct mlx5_switch_info *info); > > > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > > b/drivers/net/mlx5/mlx5_ethdev.c index 81f2a42..5b44889 100644 > > --- a/drivers/net/mlx5/mlx5_ethdev.c > > +++ b/drivers/net/mlx5/mlx5_ethdev.c > > @@ -222,7 +222,7 @@ struct ethtool_link_settings { > > struct mlx5_priv *priv =3D dev->data->dev_private; > > unsigned int ifindex =3D > > priv->nl_socket_rdma >=3D 0 ? > > - mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name) : > > 0; > > + mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name, > > 1) : 0; > > > > if (!ifindex) { > > if (!priv->representor) > > diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c > > index aa49cb4..6e9145a 100644 > > --- a/drivers/net/mlx5/mlx5_nl.c > > +++ b/drivers/net/mlx5/mlx5_nl.c > > @@ -85,11 +85,12 @@ struct mlx5_nl_mac_addr { > > int mac_n; /**< Number of addresses in the array. */ }; > > > > -/** Data structure used by mlx5_nl_ifindex_cb(). */ > > +/** Data structure used by mlx5_nl_cmdget_cb(). */ > > struct mlx5_nl_ifindex_data { > > const char *name; /**< IB device name (in). */ > > uint32_t ibindex; /**< IB device index (out). */ > > uint32_t ifindex; /**< Network interface index (out). */ > > + uint32_t portnum; /**< IB device max port number. */ >=20 > What happen w/ old kernel which don't support it? the portnum is ignored? On old kernels there is always port 1 exists. So, it os OK to use 1 for thi= s only port. >=20 > > }; > > > > /** > > @@ -695,12 +696,13 @@ struct mlx5_nl_ifindex_data { > > * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > */ > > static int > > -mlx5_nl_ifindex_cb(struct nlmsghdr *nh, void *arg) > > +mlx5_nl_cmdget_cb(struct nlmsghdr *nh, void *arg) > > { > > struct mlx5_nl_ifindex_data *data =3D arg; > > size_t off =3D NLMSG_HDRLEN; > > uint32_t ibindex =3D 0; > > uint32_t ifindex =3D 0; > > + uint32_t portnum =3D 0; > > int found =3D 0; > > > > if (nh->nlmsg_type !=3D > > @@ -725,6 +727,9 @@ struct mlx5_nl_ifindex_data { > > case RDMA_NLDEV_ATTR_NDEV_INDEX: > > ifindex =3D *(uint32_t *)payload; > > break; > > + case RDMA_NLDEV_ATTR_PORT_INDEX: > > + portnum =3D *(uint32_t *)payload; > > + break; > > default: > > break; > > } > > @@ -733,6 +738,7 @@ struct mlx5_nl_ifindex_data { > > if (found) { > > data->ibindex =3D ibindex; > > data->ifindex =3D ifindex; > > + data->portnum =3D portnum; > > } > > return 0; > > error: > > @@ -751,15 +757,15 @@ struct mlx5_nl_ifindex_data { > > * Netlink socket of the RDMA kind (NETLINK_RDMA). > > * @param[in] name > > * IB device name. > > - * > > + * @param[in] pindex > > + * IB device port index, starting from 1 > > * @return > > * A valid (nonzero) interface index on success, 0 otherwise and rte= _errno > > * is set. > > */ > > unsigned int > > -mlx5_nl_ifindex(int nl, const char *name) > > +mlx5_nl_ifindex(int nl, const char *name, uint32_t pindex) > > { > > - static const uint32_t pindex =3D 1; > > uint32_t seq =3D random(); > > struct mlx5_nl_ifindex_data data =3D { > > .name =3D name, > > @@ -785,7 +791,7 @@ struct mlx5_nl_ifindex_data { > > ret =3D mlx5_nl_send(nl, &req.nh, seq); > > if (ret < 0) > > return 0; > > - ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_ifindex_cb, &data); > > + ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_cmdget_cb, &data); > > if (ret < 0) > > return 0; > > if (!data.ibindex) > > @@ -808,7 +814,7 @@ struct mlx5_nl_ifindex_data { > > ret =3D mlx5_nl_send(nl, &req.nh, seq); > > if (ret < 0) > > return 0; > > - ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_ifindex_cb, &data); > > + ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_cmdget_cb, &data); > > if (ret < 0) > > return 0; > > if (!data.ifindex) > > -- > > 1.8.3.1 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 A0B4FA00E6 for ; Thu, 21 Mar 2019 13:58:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89CBF1B4EE; Thu, 21 Mar 2019 13:58:27 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50068.outbound.protection.outlook.com [40.107.5.68]) by dpdk.org (Postfix) with ESMTP id 764201B4D1 for ; Thu, 21 Mar 2019 13:58:25 +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=qTOVa8+i3yY+DLAMKKwWrZaOAO8vPYPhFptuI3iP5Ho=; b=HLb2UGfLoriiUddX3RSsXZd74A3B4Cg3Scun03waj03gUeP6BnpixVP7s5qBJl9OLSVQYMcYH0pbxhuJxi3dfWMuaKIDzaQlXwMIUoulYCFEKpw71zaXojiyotOpbvjHSvYAvutOsObBtFI8xW6RCHjQ9KKcXoFbmAo3rCpbaSk= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3345.eurprd05.prod.outlook.com (10.171.189.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Thu, 21 Mar 2019 12:58:24 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02%3]) with mapi id 15.20.1709.015; Thu, 21 Mar 2019 12:58:24 +0000 From: Slava Ovsiienko To: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB Thread-Index: AQHU39+b+QlCTCld5ESAtqO/h3hxtaYWBt8g Date: Thu, 21 Mar 2019 12:58:24 +0000 Message-ID: References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-4-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=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fbed805d-a03e-41c5-d726-08d6adfce73c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3345; x-ms-traffictypediagnostic: AM4PR05MB3345: x-microsoft-antispam-prvs: x-forefront-prvs: 0983EAD6B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(366004)(396003)(136003)(346002)(13464003)(199004)(189003)(99286004)(256004)(229853002)(8936002)(6116002)(11346002)(446003)(7696005)(110136005)(3846002)(25786009)(53936002)(76176011)(26005)(71190400001)(71200400001)(2906002)(6506007)(68736007)(55016002)(53546011)(476003)(86362001)(6246003)(9686003)(6436002)(102836004)(186003)(316002)(52536014)(8676002)(486006)(305945005)(7736002)(81156014)(97736004)(106356001)(81166006)(5660300002)(478600001)(2501003)(74316002)(66066001)(93886005)(105586002)(33656002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3345; H:AM4PR05MB3265.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hIHxwQVDCxdsRY9cb8DnznMK0KkvU0YJbgn7SCHrdoVaZbuxualPlMuXcQegjlfuCGurTVe94bjJoL/qFCDBnUx4oFkYk9akCyRj1L/jQJa3tXwPI6fdOnf7VNXzL7Q2uEJoPW5uatojNyd8Ohz5pdFnq/PfgjkeIkIkfNQUh6Bgz5RYpCJnEYQ+srX2aNpPp/TZ0tFn8QQqENNk/UW56YMO3SFTfd/6e7pmZbfMGlrBV5HTYHec23Fqh3kzEDH1rVWM/rNW5jz5bBB4McmQObv5XvAIPwlMHdc1mcckkNjrtc2cmnhKOpKAS+B83CjY8PWiPQIgpzJFY82X37Xad57ta6PNiRVqrszvn4zkf916iIR+BHEZ0o6hqoxx36aCOkvWtwGBA+xw3TLw5hxNyKpY8LApueUsd8oannVsFeY= 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: fbed805d-a03e-41c5-d726-08d6adfce73c X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2019 12:58:24.1681 (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: AM4PR05MB3345 Subject: Re: [dpdk-dev] [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB 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: <20190321125824.SroengA1dJjzYQ4ipIwDQRskYFbYX2fG7bSv-9V7YjU@z> > -----Original Message----- > From: Shahaf Shuler > Sent: Thursday, March 21, 2019 14:14 > To: Slava Ovsiienko ; dev@dpdk.org > Subject: RE: [PATCH 03/14] net/mlx5: modify get ifindex routine for multi= port > IB >=20 > Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko: > > Subject: [PATCH 03/14] net/mlx5: modify get ifindex routine for > > multiport IB > > > > There is the routine mlx5_nl_ifindex() returning the network interface > > index associated with Infiniband device. > > We are going to support multiport IB devices, now function takes the > > IB port as argument and returns ifindex associated with tuple > device, IB port> > > > > Signed-off-by: Viacheslav Ovsiienko > > --- > > drivers/net/mlx5/mlx5.c | 2 +- > > drivers/net/mlx5/mlx5.h | 2 +- > > drivers/net/mlx5/mlx5_ethdev.c | 2 +- > > drivers/net/mlx5/mlx5_nl.c | 20 +++++++++++++------- > > 4 files changed, 16 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > > ea3d00c..89c30af 100644 > > --- a/drivers/net/mlx5/mlx5.c > > +++ b/drivers/net/mlx5/mlx5.c > > @@ -1441,7 +1441,7 @@ struct mlx5_dev_spawn_data { > > list[i].ifindex =3D 0; > > else > > list[i].ifindex =3D mlx5_nl_ifindex > > - (nl_rdma, list[i].ibv_dev->name); > > + (nl_rdma, list[i].ibv_dev->name, 1); >=20 > Why hardcoded to 1? Because the given part of patchset regards only mlx5_nl_ifindex() change. We are not introducing the multiport Infiniband device right now and here, it is coming in the next parts of the patchset. This "hardcoded 1" will be replaced by actual index (please, see the next parts). >=20 > > if (nl_route < 0 || > > !list[i].ifindex || > > mlx5_nl_switch_info(nl_route, list[i].ifindex, diff --git > > a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > > 1716cd1..f5e29ca 100644 > > --- a/drivers/net/mlx5/mlx5.h > > +++ b/drivers/net/mlx5/mlx5.h > > @@ -470,7 +470,7 @@ int mlx5_nl_mac_addr_remove(struct rte_eth_dev > > *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_flush(struct > > rte_eth_dev *dev); int mlx5_nl_promisc(struct rte_eth_dev *dev, int > > enable); int mlx5_nl_allmulti(struct rte_eth_dev *dev, int enable); - > > unsigned int mlx5_nl_ifindex(int nl, const char *name); > > +unsigned int mlx5_nl_ifindex(int nl, const char *name, uint32_t > > +pindex); > > int mlx5_nl_switch_info(int nl, unsigned int ifindex, > > struct mlx5_switch_info *info); > > > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > > b/drivers/net/mlx5/mlx5_ethdev.c index 81f2a42..5b44889 100644 > > --- a/drivers/net/mlx5/mlx5_ethdev.c > > +++ b/drivers/net/mlx5/mlx5_ethdev.c > > @@ -222,7 +222,7 @@ struct ethtool_link_settings { > > struct mlx5_priv *priv =3D dev->data->dev_private; > > unsigned int ifindex =3D > > priv->nl_socket_rdma >=3D 0 ? > > - mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name) : > > 0; > > + mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name, > > 1) : 0; > > > > if (!ifindex) { > > if (!priv->representor) > > diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c > > index aa49cb4..6e9145a 100644 > > --- a/drivers/net/mlx5/mlx5_nl.c > > +++ b/drivers/net/mlx5/mlx5_nl.c > > @@ -85,11 +85,12 @@ struct mlx5_nl_mac_addr { > > int mac_n; /**< Number of addresses in the array. */ }; > > > > -/** Data structure used by mlx5_nl_ifindex_cb(). */ > > +/** Data structure used by mlx5_nl_cmdget_cb(). */ > > struct mlx5_nl_ifindex_data { > > const char *name; /**< IB device name (in). */ > > uint32_t ibindex; /**< IB device index (out). */ > > uint32_t ifindex; /**< Network interface index (out). */ > > + uint32_t portnum; /**< IB device max port number. */ >=20 > What happen w/ old kernel which don't support it? the portnum is ignored? On old kernels there is always port 1 exists. So, it os OK to use 1 for thi= s only port. >=20 > > }; > > > > /** > > @@ -695,12 +696,13 @@ struct mlx5_nl_ifindex_data { > > * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > */ > > static int > > -mlx5_nl_ifindex_cb(struct nlmsghdr *nh, void *arg) > > +mlx5_nl_cmdget_cb(struct nlmsghdr *nh, void *arg) > > { > > struct mlx5_nl_ifindex_data *data =3D arg; > > size_t off =3D NLMSG_HDRLEN; > > uint32_t ibindex =3D 0; > > uint32_t ifindex =3D 0; > > + uint32_t portnum =3D 0; > > int found =3D 0; > > > > if (nh->nlmsg_type !=3D > > @@ -725,6 +727,9 @@ struct mlx5_nl_ifindex_data { > > case RDMA_NLDEV_ATTR_NDEV_INDEX: > > ifindex =3D *(uint32_t *)payload; > > break; > > + case RDMA_NLDEV_ATTR_PORT_INDEX: > > + portnum =3D *(uint32_t *)payload; > > + break; > > default: > > break; > > } > > @@ -733,6 +738,7 @@ struct mlx5_nl_ifindex_data { > > if (found) { > > data->ibindex =3D ibindex; > > data->ifindex =3D ifindex; > > + data->portnum =3D portnum; > > } > > return 0; > > error: > > @@ -751,15 +757,15 @@ struct mlx5_nl_ifindex_data { > > * Netlink socket of the RDMA kind (NETLINK_RDMA). > > * @param[in] name > > * IB device name. > > - * > > + * @param[in] pindex > > + * IB device port index, starting from 1 > > * @return > > * A valid (nonzero) interface index on success, 0 otherwise and rte= _errno > > * is set. > > */ > > unsigned int > > -mlx5_nl_ifindex(int nl, const char *name) > > +mlx5_nl_ifindex(int nl, const char *name, uint32_t pindex) > > { > > - static const uint32_t pindex =3D 1; > > uint32_t seq =3D random(); > > struct mlx5_nl_ifindex_data data =3D { > > .name =3D name, > > @@ -785,7 +791,7 @@ struct mlx5_nl_ifindex_data { > > ret =3D mlx5_nl_send(nl, &req.nh, seq); > > if (ret < 0) > > return 0; > > - ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_ifindex_cb, &data); > > + ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_cmdget_cb, &data); > > if (ret < 0) > > return 0; > > if (!data.ibindex) > > @@ -808,7 +814,7 @@ struct mlx5_nl_ifindex_data { > > ret =3D mlx5_nl_send(nl, &req.nh, seq); > > if (ret < 0) > > return 0; > > - ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_ifindex_cb, &data); > > + ret =3D mlx5_nl_recv(nl, seq, mlx5_nl_cmdget_cb, &data); > > if (ret < 0) > > return 0; > > if (!data.ifindex) > > -- > > 1.8.3.1