From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140085.outbound.protection.outlook.com [40.107.14.85]) by dpdk.org (Postfix) with ESMTP id 778491B4D8 for ; Thu, 21 Mar 2019 13:14:52 +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=3GaX0gGb4pgh70UmSK3TugF72lFjDBaBRlGxM124yUw=; b=ETOUOQfUJydyWdo8S74uZL5D3aHOPZEHEV6HIrpimbKp6NjM0wKaE46b/Vm0nIp+C5edl8+889RRCQagqv5aWAd5zywXuBWa9V3QitQNp+kKIPM1aztQCZmsfvLRZXpNZMfesWYlYkv3NghoqzTF6v2pVrYAmLTspe1JPd+KHWQ= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3827.eurprd05.prod.outlook.com (52.133.47.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Thu, 21 Mar 2019 12:14:51 +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.013; Thu, 21 Mar 2019 12:14:51 +0000 From: Shahaf Shuler To: Slava Ovsiienko , "dev@dpdk.org" Thread-Topic: [PATCH 07/14] net/mlx5: switch to the names in the shared IB context Thread-Index: AQHU373ITm5GTfM/kE2JU6KFoN7c3qYV9EJQ Date: Thu, 21 Mar 2019 12:14:51 +0000 Message-ID: References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-8-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1553155888-27498-8-git-send-email-viacheslavo@mellanox.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-ms-office365-filtering-correlation-id: 6c1d286f-4847-4701-a50c-08d6adf6d1ef 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:AM0PR0502MB3827; x-ms-traffictypediagnostic: AM0PR0502MB3827: x-microsoft-antispam-prvs: x-forefront-prvs: 0983EAD6B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39860400002)(136003)(376002)(189003)(199004)(81166006)(97736004)(33656002)(68736007)(74316002)(25786009)(7736002)(305945005)(110136005)(316002)(14454004)(2906002)(446003)(2501003)(52536014)(11346002)(476003)(71190400001)(256004)(86362001)(486006)(99286004)(186003)(5660300002)(66066001)(26005)(7696005)(53936002)(76176011)(102836004)(55016002)(9686003)(6436002)(71200400001)(229853002)(3846002)(8676002)(8936002)(81156014)(478600001)(6246003)(106356001)(6506007)(6116002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3827; 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: 4nJjq4ZPwDacL1P8vO9R5l7sv89Z5RbYchle1prLaBjq0VQspwkSJjlyePxLO4OPmLAVICIaXK4r5tPtApukx46N1a+CZK3AOc2JA74ryyoIKZWuqBJW9P6U5N87eXSPJGPB/eNSu4n/rpGQseakF23geLGL5iPp7IP05xzYnplfGt0NdFUf3LrAbTQz8t5qTaY8y2ij8Q3TN56YJcT0ZoIv2OgYq4WaAb2wwTv7x3dm4qpP7dasEGP7tYB2Wxfpl6trS29xxl3Gmwm8g/2f47S2b0LuNHmQTWnuBI5yMaupIkrxJSOzkthYKQkgvaqOuTb01ouWuMcf5KkYWm4Qs5YuQualS8zkiLNMclkcSqNLKx2C5ky8DNyN/PWLN+3UFST/N34nWMNx8zpMPUbb6kKZ2/onYwIRfYNrPqJb/bc= 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: 6c1d286f-4847-4701-a50c-08d6adf6d1ef X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2019 12:14:51.4687 (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: AM0PR0502MB3827 Subject: Re: [dpdk-dev] [PATCH 07/14] net/mlx5: switch to the names in the shared IB context 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:14:52 -0000 Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko: > Subject: [PATCH 07/14] net/mlx5: switch to the names in the shared IB > context >=20 > The IB device names are moved from device private data to the shared > context, code involving the names is updated. > The IB port index treatment is added where it is relevant. >=20 > Signed-off-by: Viacheslav Ovsiienko Acked-by: Shahaf Shuler > --- > drivers/net/mlx5/mlx5.h | 2 -- > drivers/net/mlx5/mlx5_ethdev.c | 10 +++++++--- > drivers/net/mlx5/mlx5_stats.c | 22 +++++++++++++--------- > 3 files changed, 20 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > 528ae02..fb9ed3b 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -229,8 +229,6 @@ struct mlx5_priv { > struct ibv_context *ctx; /* Verbs context. */ > struct ibv_device_attr_ex device_attr; /* Device properties. */ > struct ibv_pd *pd; /* Protection Domain. */ > - char ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */ > - char ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for > secondary */ > struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC > addresses. */ > BITFIELD_DECLARE(mac_own, uint64_t, > MLX5_MAX_MAC_ADDRESSES); > /* Bit-field of MAC addresses owned by the PMD. */ diff --git > a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index > 5b44889..2ccc743 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -138,8 +138,10 @@ struct ethtool_link_settings { > unsigned int dev_port_prev =3D ~0u; > char match[IF_NAMESIZE] =3D ""; >=20 > + assert(priv); > + assert(priv->sh); > { > - MKSTR(path, "%s/device/net", priv->ibdev_path); > + MKSTR(path, "%s/device/net", priv->sh->ibdev_path); >=20 > dir =3D opendir(path); > if (dir =3D=3D NULL) { > @@ -159,7 +161,7 @@ struct ethtool_link_settings { > continue; >=20 > MKSTR(path, "%s/device/net/%s/%s", > - priv->ibdev_path, name, > + priv->sh->ibdev_path, name, > (dev_type ? "dev_id" : "dev_port")); >=20 > file =3D fopen(path, "rb"); > @@ -222,7 +224,9 @@ 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, > 1) : 0; > + mlx5_nl_ifindex(priv->nl_socket_rdma, > + priv->sh->ibdev_name, > + priv->ibv_port) : 0; >=20 > if (!ifindex) { > if (!priv->representor) > diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.= c > index 6906dc8..5af199d 100644 > --- a/drivers/net/mlx5/mlx5_stats.c > +++ b/drivers/net/mlx5/mlx5_stats.c > @@ -140,18 +140,22 @@ > mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t > *stat) { > FILE *file; > - MKSTR(path, "%s/ports/1/hw_counters/%s", > - priv->ibdev_path, > - ctr_name); > + if (priv->sh) { > + MKSTR(path, "%s/ports/%d/hw_counters/%s", > + priv->sh->ibdev_path, > + priv->ibv_port, > + ctr_name); >=20 > - file =3D fopen(path, "rb"); > - if (file) { > - int n =3D fscanf(file, "%" SCNu64, stat); > + file =3D fopen(path, "rb"); > + if (file) { > + int n =3D fscanf(file, "%" SCNu64, stat); >=20 > - fclose(file); > - if (n !=3D 1) > - stat =3D 0; > + fclose(file); > + if (n =3D=3D 1) > + return; > + } > } > + *stat =3D 0; > } >=20 > /** > -- > 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 20C2EA00E6 for ; Thu, 21 Mar 2019 13:15:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D44C41B4D8; Thu, 21 Mar 2019 13:14:53 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140085.outbound.protection.outlook.com [40.107.14.85]) by dpdk.org (Postfix) with ESMTP id 778491B4D8 for ; Thu, 21 Mar 2019 13:14:52 +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=3GaX0gGb4pgh70UmSK3TugF72lFjDBaBRlGxM124yUw=; b=ETOUOQfUJydyWdo8S74uZL5D3aHOPZEHEV6HIrpimbKp6NjM0wKaE46b/Vm0nIp+C5edl8+889RRCQagqv5aWAd5zywXuBWa9V3QitQNp+kKIPM1aztQCZmsfvLRZXpNZMfesWYlYkv3NghoqzTF6v2pVrYAmLTspe1JPd+KHWQ= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3827.eurprd05.prod.outlook.com (52.133.47.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Thu, 21 Mar 2019 12:14:51 +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.013; Thu, 21 Mar 2019 12:14:51 +0000 From: Shahaf Shuler To: Slava Ovsiienko , "dev@dpdk.org" Thread-Topic: [PATCH 07/14] net/mlx5: switch to the names in the shared IB context Thread-Index: AQHU373ITm5GTfM/kE2JU6KFoN7c3qYV9EJQ Date: Thu, 21 Mar 2019 12:14:51 +0000 Message-ID: References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-8-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1553155888-27498-8-git-send-email-viacheslavo@mellanox.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-ms-office365-filtering-correlation-id: 6c1d286f-4847-4701-a50c-08d6adf6d1ef 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:AM0PR0502MB3827; x-ms-traffictypediagnostic: AM0PR0502MB3827: x-microsoft-antispam-prvs: x-forefront-prvs: 0983EAD6B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39860400002)(136003)(376002)(189003)(199004)(81166006)(97736004)(33656002)(68736007)(74316002)(25786009)(7736002)(305945005)(110136005)(316002)(14454004)(2906002)(446003)(2501003)(52536014)(11346002)(476003)(71190400001)(256004)(86362001)(486006)(99286004)(186003)(5660300002)(66066001)(26005)(7696005)(53936002)(76176011)(102836004)(55016002)(9686003)(6436002)(71200400001)(229853002)(3846002)(8676002)(8936002)(81156014)(478600001)(6246003)(106356001)(6506007)(6116002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3827; 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: 4nJjq4ZPwDacL1P8vO9R5l7sv89Z5RbYchle1prLaBjq0VQspwkSJjlyePxLO4OPmLAVICIaXK4r5tPtApukx46N1a+CZK3AOc2JA74ryyoIKZWuqBJW9P6U5N87eXSPJGPB/eNSu4n/rpGQseakF23geLGL5iPp7IP05xzYnplfGt0NdFUf3LrAbTQz8t5qTaY8y2ij8Q3TN56YJcT0ZoIv2OgYq4WaAb2wwTv7x3dm4qpP7dasEGP7tYB2Wxfpl6trS29xxl3Gmwm8g/2f47S2b0LuNHmQTWnuBI5yMaupIkrxJSOzkthYKQkgvaqOuTb01ouWuMcf5KkYWm4Qs5YuQualS8zkiLNMclkcSqNLKx2C5ky8DNyN/PWLN+3UFST/N34nWMNx8zpMPUbb6kKZ2/onYwIRfYNrPqJb/bc= 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: 6c1d286f-4847-4701-a50c-08d6adf6d1ef X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2019 12:14:51.4687 (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: AM0PR0502MB3827 Subject: Re: [dpdk-dev] [PATCH 07/14] net/mlx5: switch to the names in the shared IB context 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: <20190321121451.nBGzvpQeMEuHFuFHs4exJPW5D91GJCKFxuQR6qruVB0@z> Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko: > Subject: [PATCH 07/14] net/mlx5: switch to the names in the shared IB > context >=20 > The IB device names are moved from device private data to the shared > context, code involving the names is updated. > The IB port index treatment is added where it is relevant. >=20 > Signed-off-by: Viacheslav Ovsiienko Acked-by: Shahaf Shuler > --- > drivers/net/mlx5/mlx5.h | 2 -- > drivers/net/mlx5/mlx5_ethdev.c | 10 +++++++--- > drivers/net/mlx5/mlx5_stats.c | 22 +++++++++++++--------- > 3 files changed, 20 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > 528ae02..fb9ed3b 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -229,8 +229,6 @@ struct mlx5_priv { > struct ibv_context *ctx; /* Verbs context. */ > struct ibv_device_attr_ex device_attr; /* Device properties. */ > struct ibv_pd *pd; /* Protection Domain. */ > - char ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */ > - char ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for > secondary */ > struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC > addresses. */ > BITFIELD_DECLARE(mac_own, uint64_t, > MLX5_MAX_MAC_ADDRESSES); > /* Bit-field of MAC addresses owned by the PMD. */ diff --git > a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index > 5b44889..2ccc743 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -138,8 +138,10 @@ struct ethtool_link_settings { > unsigned int dev_port_prev =3D ~0u; > char match[IF_NAMESIZE] =3D ""; >=20 > + assert(priv); > + assert(priv->sh); > { > - MKSTR(path, "%s/device/net", priv->ibdev_path); > + MKSTR(path, "%s/device/net", priv->sh->ibdev_path); >=20 > dir =3D opendir(path); > if (dir =3D=3D NULL) { > @@ -159,7 +161,7 @@ struct ethtool_link_settings { > continue; >=20 > MKSTR(path, "%s/device/net/%s/%s", > - priv->ibdev_path, name, > + priv->sh->ibdev_path, name, > (dev_type ? "dev_id" : "dev_port")); >=20 > file =3D fopen(path, "rb"); > @@ -222,7 +224,9 @@ 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, > 1) : 0; > + mlx5_nl_ifindex(priv->nl_socket_rdma, > + priv->sh->ibdev_name, > + priv->ibv_port) : 0; >=20 > if (!ifindex) { > if (!priv->representor) > diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.= c > index 6906dc8..5af199d 100644 > --- a/drivers/net/mlx5/mlx5_stats.c > +++ b/drivers/net/mlx5/mlx5_stats.c > @@ -140,18 +140,22 @@ > mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t > *stat) { > FILE *file; > - MKSTR(path, "%s/ports/1/hw_counters/%s", > - priv->ibdev_path, > - ctr_name); > + if (priv->sh) { > + MKSTR(path, "%s/ports/%d/hw_counters/%s", > + priv->sh->ibdev_path, > + priv->ibv_port, > + ctr_name); >=20 > - file =3D fopen(path, "rb"); > - if (file) { > - int n =3D fscanf(file, "%" SCNu64, stat); > + file =3D fopen(path, "rb"); > + if (file) { > + int n =3D fscanf(file, "%" SCNu64, stat); >=20 > - fclose(file); > - if (n !=3D 1) > - stat =3D 0; > + fclose(file); > + if (n =3D=3D 1) > + return; > + } > } > + *stat =3D 0; > } >=20 > /** > -- > 1.8.3.1