Skip to content

Commit 3b43399

Browse files
MarkZhang81rleon
authored andcommitted
RDMA/mlx5: Add plane index support when querying PTYS registers
Support the new "plane_ind" field when querying port PTYS registers. This is needed when querying the rate of a plane port. Signed-off-by: Mark Zhang <[email protected]> Link: https://lore.kernel.org/r/1f703c36306aa46917fcd88eadbb23b3e380d526.1718553901.git.leon@kernel.org Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 2944248 commit 3b43399

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ static int mlx5_query_port_roce(struct ib_device *device, u32 port_num,
511511
*/
512512
if (dev->is_rep)
513513
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
514-
1);
514+
1, 0);
515515
else
516516
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
517-
mdev_port_num);
517+
mdev_port_num, 0);
518518
if (err)
519519
goto out;
520520
ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability);
@@ -1341,11 +1341,11 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
13411341
struct mlx5_ib_dev *dev = to_mdev(ibdev);
13421342
struct mlx5_core_dev *mdev = dev->mdev;
13431343
struct mlx5_hca_vport_context *rep;
1344+
u8 vl_hw_cap, plane_index = 0;
13441345
u16 max_mtu;
13451346
u16 oper_mtu;
13461347
int err;
13471348
u16 ib_link_width_oper;
1348-
u8 vl_hw_cap;
13491349

13501350
rep = kzalloc(sizeof(*rep), GFP_KERNEL);
13511351
if (!rep) {
@@ -1355,8 +1355,10 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
13551355

13561356
/* props being zeroed by the caller, avoid zeroing it here */
13571357

1358-
if (ibdev->type == RDMA_DEVICE_TYPE_SMI)
1358+
if (ibdev->type == RDMA_DEVICE_TYPE_SMI) {
1359+
plane_index = port;
13591360
port = smi_to_native_portnum(dev, port);
1361+
}
13601362

13611363
err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep);
13621364
if (err)
@@ -1388,7 +1390,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
13881390
props->port_cap_flags2 = rep->cap_mask2;
13891391

13901392
err = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper,
1391-
&props->active_speed, port);
1393+
&props->active_speed, port, plane_index);
13921394
if (err)
13931395
goto out;
13941396

drivers/net/ethernet/mellanox/mlx5/core/en/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void mlx5_port_query_eth_autoneg(struct mlx5_core_dev *dev, u8 *an_status,
4141
*an_disable_cap = 0;
4242
*an_disable_admin = 0;
4343

44-
if (mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, 1))
44+
if (mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, 1, 0))
4545
return;
4646

4747
*an_status = MLX5_GET(ptys_reg, out, an_status);

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ static int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
11951195
bool ext;
11961196
int err;
11971197

1198-
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1);
1198+
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1, 0);
11991199
if (err) {
12001200
netdev_err(priv->netdev, "%s: query port ptys failed: %d\n",
12011201
__func__, err);

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
215215
int speed, ret;
216216

217217
ret = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, &ib_proto_oper,
218-
1);
218+
1, 0);
219219
if (ret)
220220
return ret;
221221

drivers/net/ethernet/mellanox/mlx5/core/port.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,13 @@ int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps)
144144
EXPORT_SYMBOL_GPL(mlx5_set_port_caps);
145145

146146
int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
147-
int ptys_size, int proto_mask, u8 local_port)
147+
int ptys_size, int proto_mask,
148+
u8 local_port, u8 plane_index)
148149
{
149150
u32 in[MLX5_ST_SZ_DW(ptys_reg)] = {0};
150151

151152
MLX5_SET(ptys_reg, in, local_port, local_port);
153+
MLX5_SET(ptys_reg, in, plane_ind, plane_index);
152154
MLX5_SET(ptys_reg, in, proto_mask, proto_mask);
153155
return mlx5_core_access_reg(dev, in, sizeof(in), ptys,
154156
ptys_size, MLX5_REG_PTYS, 0, 0);
@@ -167,13 +169,13 @@ int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration)
167169
}
168170

169171
int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper,
170-
u16 *proto_oper, u8 local_port)
172+
u16 *proto_oper, u8 local_port, u8 plane_index)
171173
{
172174
u32 out[MLX5_ST_SZ_DW(ptys_reg)];
173175
int err;
174176

175177
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_IB,
176-
local_port);
178+
local_port, plane_index);
177179
if (err)
178180
return err;
179181

@@ -1114,7 +1116,7 @@ int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext,
11141116
if (!eproto)
11151117
return -EINVAL;
11161118

1117-
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port);
1119+
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port, 0);
11181120
if (err)
11191121
return err;
11201122

include/linux/mlx5/port.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ struct mlx5_port_eth_proto {
155155

156156
int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
157157
int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
158-
int ptys_size, int proto_mask, u8 local_port);
158+
int ptys_size, int proto_mask,
159+
u8 local_port, u8 plane_index);
159160

160161
int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper,
161-
u16 *proto_oper, u8 local_port);
162+
u16 *proto_oper, u8 local_port, u8 plane_index);
162163
void mlx5_toggle_port_link(struct mlx5_core_dev *dev);
163164
int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
164165
enum mlx5_port_status status);

0 commit comments

Comments
 (0)