Commit 3b43399b authored by Mark Zhang's avatar Mark Zhang Committed by Leon Romanovsky

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: default avatarMark Zhang <markzhang@nvidia.com>
Link: https://lore.kernel.org/r/1f703c36306aa46917fcd88eadbb23b3e380d526.1718553901.git.leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
parent 29442483
...@@ -511,10 +511,10 @@ static int mlx5_query_port_roce(struct ib_device *device, u32 port_num, ...@@ -511,10 +511,10 @@ static int mlx5_query_port_roce(struct ib_device *device, u32 port_num,
*/ */
if (dev->is_rep) if (dev->is_rep)
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
1); 1, 0);
else else
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
mdev_port_num); mdev_port_num, 0);
if (err) if (err)
goto out; goto out;
ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability); 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, ...@@ -1341,11 +1341,11 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
struct mlx5_ib_dev *dev = to_mdev(ibdev); struct mlx5_ib_dev *dev = to_mdev(ibdev);
struct mlx5_core_dev *mdev = dev->mdev; struct mlx5_core_dev *mdev = dev->mdev;
struct mlx5_hca_vport_context *rep; struct mlx5_hca_vport_context *rep;
u8 vl_hw_cap, plane_index = 0;
u16 max_mtu; u16 max_mtu;
u16 oper_mtu; u16 oper_mtu;
int err; int err;
u16 ib_link_width_oper; u16 ib_link_width_oper;
u8 vl_hw_cap;
rep = kzalloc(sizeof(*rep), GFP_KERNEL); rep = kzalloc(sizeof(*rep), GFP_KERNEL);
if (!rep) { if (!rep) {
...@@ -1355,8 +1355,10 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port, ...@@ -1355,8 +1355,10 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
/* props being zeroed by the caller, avoid zeroing it here */ /* props being zeroed by the caller, avoid zeroing it here */
if (ibdev->type == RDMA_DEVICE_TYPE_SMI) if (ibdev->type == RDMA_DEVICE_TYPE_SMI) {
plane_index = port;
port = smi_to_native_portnum(dev, port); port = smi_to_native_portnum(dev, port);
}
err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep); err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep);
if (err) if (err)
...@@ -1388,7 +1390,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port, ...@@ -1388,7 +1390,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
props->port_cap_flags2 = rep->cap_mask2; props->port_cap_flags2 = rep->cap_mask2;
err = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, err = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper,
&props->active_speed, port); &props->active_speed, port, plane_index);
if (err) if (err)
goto out; goto out;
......
...@@ -41,7 +41,7 @@ void mlx5_port_query_eth_autoneg(struct mlx5_core_dev *dev, u8 *an_status, ...@@ -41,7 +41,7 @@ void mlx5_port_query_eth_autoneg(struct mlx5_core_dev *dev, u8 *an_status,
*an_disable_cap = 0; *an_disable_cap = 0;
*an_disable_admin = 0; *an_disable_admin = 0;
if (mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, 1)) if (mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, 1, 0))
return; return;
*an_status = MLX5_GET(ptys_reg, out, an_status); *an_status = MLX5_GET(ptys_reg, out, an_status);
......
...@@ -1195,7 +1195,7 @@ static int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, ...@@ -1195,7 +1195,7 @@ static int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
bool ext; bool ext;
int err; int err;
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1); err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1, 0);
if (err) { if (err) {
netdev_err(priv->netdev, "%s: query port ptys failed: %d\n", netdev_err(priv->netdev, "%s: query port ptys failed: %d\n",
__func__, err); __func__, err);
......
...@@ -215,7 +215,7 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev, ...@@ -215,7 +215,7 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
int speed, ret; int speed, ret;
ret = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, &ib_proto_oper, ret = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, &ib_proto_oper,
1); 1, 0);
if (ret) if (ret)
return ret; return ret;
......
...@@ -144,11 +144,13 @@ int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps) ...@@ -144,11 +144,13 @@ int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps)
EXPORT_SYMBOL_GPL(mlx5_set_port_caps); EXPORT_SYMBOL_GPL(mlx5_set_port_caps);
int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys, int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
int ptys_size, int proto_mask, u8 local_port) int ptys_size, int proto_mask,
u8 local_port, u8 plane_index)
{ {
u32 in[MLX5_ST_SZ_DW(ptys_reg)] = {0}; u32 in[MLX5_ST_SZ_DW(ptys_reg)] = {0};
MLX5_SET(ptys_reg, in, local_port, local_port); MLX5_SET(ptys_reg, in, local_port, local_port);
MLX5_SET(ptys_reg, in, plane_ind, plane_index);
MLX5_SET(ptys_reg, in, proto_mask, proto_mask); MLX5_SET(ptys_reg, in, proto_mask, proto_mask);
return mlx5_core_access_reg(dev, in, sizeof(in), ptys, return mlx5_core_access_reg(dev, in, sizeof(in), ptys,
ptys_size, MLX5_REG_PTYS, 0, 0); ptys_size, MLX5_REG_PTYS, 0, 0);
...@@ -167,13 +169,13 @@ int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration) ...@@ -167,13 +169,13 @@ int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration)
} }
int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper, int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper,
u16 *proto_oper, u8 local_port) u16 *proto_oper, u8 local_port, u8 plane_index)
{ {
u32 out[MLX5_ST_SZ_DW(ptys_reg)]; u32 out[MLX5_ST_SZ_DW(ptys_reg)];
int err; int err;
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_IB, err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_IB,
local_port); local_port, plane_index);
if (err) if (err)
return err; return err;
...@@ -1114,7 +1116,7 @@ int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext, ...@@ -1114,7 +1116,7 @@ int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext,
if (!eproto) if (!eproto)
return -EINVAL; return -EINVAL;
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port); err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port, 0);
if (err) if (err)
return err; return err;
......
...@@ -155,10 +155,11 @@ struct mlx5_port_eth_proto { ...@@ -155,10 +155,11 @@ struct mlx5_port_eth_proto {
int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps); int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys, int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
int ptys_size, int proto_mask, u8 local_port); int ptys_size, int proto_mask,
u8 local_port, u8 plane_index);
int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper, int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper,
u16 *proto_oper, u8 local_port); u16 *proto_oper, u8 local_port, u8 plane_index);
void mlx5_toggle_port_link(struct mlx5_core_dev *dev); void mlx5_toggle_port_link(struct mlx5_core_dev *dev);
int mlx5_set_port_admin_status(struct mlx5_core_dev *dev, int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
enum mlx5_port_status status); enum mlx5_port_status status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment