mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
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 <markzhang@nvidia.com> Link: https://lore.kernel.org/r/1f703c36306aa46917fcd88eadbb23b3e380d526.1718553901.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
parent
294424839b
commit
3b43399b29
|
|
@ -511,10 +511,10 @@ static int mlx5_query_port_roce(struct ib_device *device, u32 port_num,
|
|||
*/
|
||||
if (dev->is_rep)
|
||||
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
|
||||
1);
|
||||
1, 0);
|
||||
else
|
||||
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
|
||||
mdev_port_num);
|
||||
mdev_port_num, 0);
|
||||
if (err)
|
||||
goto out;
|
||||
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,
|
|||
struct mlx5_ib_dev *dev = to_mdev(ibdev);
|
||||
struct mlx5_core_dev *mdev = dev->mdev;
|
||||
struct mlx5_hca_vport_context *rep;
|
||||
u8 vl_hw_cap, plane_index = 0;
|
||||
u16 max_mtu;
|
||||
u16 oper_mtu;
|
||||
int err;
|
||||
u16 ib_link_width_oper;
|
||||
u8 vl_hw_cap;
|
||||
|
||||
rep = kzalloc(sizeof(*rep), GFP_KERNEL);
|
||||
if (!rep) {
|
||||
|
|
@ -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 */
|
||||
|
||||
if (ibdev->type == RDMA_DEVICE_TYPE_SMI)
|
||||
if (ibdev->type == RDMA_DEVICE_TYPE_SMI) {
|
||||
plane_index = port;
|
||||
port = smi_to_native_portnum(dev, port);
|
||||
}
|
||||
|
||||
err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep);
|
||||
if (err)
|
||||
|
|
@ -1388,7 +1390,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u32 port,
|
|||
props->port_cap_flags2 = rep->cap_mask2;
|
||||
|
||||
err = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper,
|
||||
&props->active_speed, port);
|
||||
&props->active_speed, port, plane_index);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void mlx5_port_query_eth_autoneg(struct mlx5_core_dev *dev, u8 *an_status,
|
|||
*an_disable_cap = 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;
|
||||
|
||||
*an_status = MLX5_GET(ptys_reg, out, an_status);
|
||||
|
|
|
|||
|
|
@ -1195,7 +1195,7 @@ static int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
|
|||
bool ext;
|
||||
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) {
|
||||
netdev_err(priv->netdev, "%s: query port ptys failed: %d\n",
|
||||
__func__, err);
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
|
|||
int speed, ret;
|
||||
|
||||
ret = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, &ib_proto_oper,
|
||||
1);
|
||||
1, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
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};
|
||||
|
||||
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);
|
||||
return mlx5_core_access_reg(dev, in, sizeof(in), ptys,
|
||||
ptys_size, MLX5_REG_PTYS, 0, 0);
|
||||
|
|
@ -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,
|
||||
u16 *proto_oper, u8 local_port)
|
||||
u16 *proto_oper, u8 local_port, u8 plane_index)
|
||||
{
|
||||
u32 out[MLX5_ST_SZ_DW(ptys_reg)];
|
||||
int err;
|
||||
|
||||
err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_IB,
|
||||
local_port);
|
||||
local_port, plane_index);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
@ -1114,7 +1116,7 @@ int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext,
|
|||
if (!eproto)
|
||||
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)
|
||||
return err;
|
||||
|
||||
|
|
|
|||
|
|
@ -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_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,
|
||||
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);
|
||||
int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
|
||||
enum mlx5_port_status status);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user