Skip to content

Commit

Permalink
RDMA/mlx5: Fix AH static rate parsing
Browse files Browse the repository at this point in the history
Previously static rate wasn't translated according to our PRM but simply
used the 4 lower bytes.

Correctly translate static rate value passed in AH creation attribute
according to our PRM expected values.

In addition change 800GB mapping to zero, which is the PRM
specified value.

Fixes: e126ba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Link: https://patch.msgid.link/18ef4cc5396caf80728341eb74738cd777596f60.1739187089.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
  • Loading branch information
PatrisiousHaddad authored and rleon committed Feb 20, 2025
1 parent 3d8c6f2 commit c534ffd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion drivers/infiniband/hw/mlx5/ah.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ static void create_ib_ah(struct mlx5_ib_dev *dev, struct mlx5_ib_ah *ah,
ah->av.tclass = grh->traffic_class;
}

ah->av.stat_rate_sl = (rdma_ah_get_static_rate(ah_attr) << 4);
ah->av.stat_rate_sl =
(mlx5r_ib_rate(dev, rdma_ah_get_static_rate(ah_attr)) << 4);

if (ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
if (init_attr->xmit_slave)
Expand Down
6 changes: 3 additions & 3 deletions drivers/infiniband/hw/mlx5/qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3447,11 +3447,11 @@ static int ib_to_mlx5_rate_map(u8 rate)
return 0;
}

static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate)
int mlx5r_ib_rate(struct mlx5_ib_dev *dev, u8 rate)
{
u32 stat_rate_support;

if (rate == IB_RATE_PORT_CURRENT)
if (rate == IB_RATE_PORT_CURRENT || rate == IB_RATE_800_GBPS)
return 0;

if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_800_GBPS)
Expand Down Expand Up @@ -3596,7 +3596,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
sizeof(grh->dgid.raw));
}

err = ib_rate_to_mlx5(dev, rdma_ah_get_static_rate(ah));
err = mlx5r_ib_rate(dev, rdma_ah_get_static_rate(ah));
if (err < 0)
return err;
MLX5_SET(ads, path, stat_rate, err);
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/hw/mlx5/qp.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ int mlx5_core_xrcd_dealloc(struct mlx5_ib_dev *dev, u32 xrcdn);
int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter);
int mlx5_ib_qp_event_init(void);
void mlx5_ib_qp_event_cleanup(void);
int mlx5r_ib_rate(struct mlx5_ib_dev *dev, u8 rate);
#endif /* _MLX5_IB_QP_H */

0 comments on commit c534ffd

Please sign in to comment.