]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/mlx5: Add plane index support when querying PTYS registers
authorMark Zhang <markzhang@nvidia.com>
Sun, 16 Jun 2024 16:08:42 +0000 (19:08 +0300)
committerLeon Romanovsky <leonro@nvidia.com>
Mon, 1 Jul 2024 12:38:05 +0000 (15:38 +0300)
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>
drivers/infiniband/hw/mlx5/main.c
drivers/net/ethernet/mellanox/mlx5/core/en/port.c
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/port.c
include/linux/mlx5/port.h

index 8a1a43700b45df06c8e0028b6d11a40cf34cf378..5de0d95d1f45bde4949e10af9e19b3ad7de16ecb 100644 (file)
@@ -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;
 
index b4efc780e29707795d71efe9667c6d2c010015b8..5f6a0605e4ae88523b988bc88dfda8c13dfae36c 100644 (file)
@@ -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);
index 3320f12ba2dbd3b9709f90568d91c35a7a26dad3..f57e0184c12bda6c42c438cc028e4650f0257b7c 100644 (file)
@@ -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);
index 779d92b762d36c8a08085fc46181cfad2ccbed1b..b8aadbea1312fb740ff966bb9ba7e113c1725d81 100644 (file)
@@ -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;
 
index 7fba1c46e2ac4a46ac1edbe04f04cce0182ae0cd..50931584132b99efafa3ff1a554f1a007a68250b 100644 (file)
@@ -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;
 
index 26092c78a9850eb8060b2f61c4f89bc0ef7c7bc9..e68d42b8ce652c51e6ffeb9c82f9f22f4f6781ec 100644 (file)
@@ -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);