Skip to content

Commit c534ffd

Browse files
PatrisiousHaddadrleon
authored andcommitted
RDMA/mlx5: Fix AH static rate parsing
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>
1 parent 3d8c6f2 commit c534ffd

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

drivers/infiniband/hw/mlx5/ah.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ static void create_ib_ah(struct mlx5_ib_dev *dev, struct mlx5_ib_ah *ah,
6767
ah->av.tclass = grh->traffic_class;
6868
}
6969

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

7273
if (ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
7374
if (init_attr->xmit_slave)

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3447,11 +3447,11 @@ static int ib_to_mlx5_rate_map(u8 rate)
34473447
return 0;
34483448
}
34493449

3450-
static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate)
3450+
int mlx5r_ib_rate(struct mlx5_ib_dev *dev, u8 rate)
34513451
{
34523452
u32 stat_rate_support;
34533453

3454-
if (rate == IB_RATE_PORT_CURRENT)
3454+
if (rate == IB_RATE_PORT_CURRENT || rate == IB_RATE_800_GBPS)
34553455
return 0;
34563456

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

3599-
err = ib_rate_to_mlx5(dev, rdma_ah_get_static_rate(ah));
3599+
err = mlx5r_ib_rate(dev, rdma_ah_get_static_rate(ah));
36003600
if (err < 0)
36013601
return err;
36023602
MLX5_SET(ads, path, stat_rate, err);

drivers/infiniband/hw/mlx5/qp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ int mlx5_core_xrcd_dealloc(struct mlx5_ib_dev *dev, u32 xrcdn);
5656
int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter);
5757
int mlx5_ib_qp_event_init(void);
5858
void mlx5_ib_qp_event_cleanup(void);
59+
int mlx5r_ib_rate(struct mlx5_ib_dev *dev, u8 rate);
5960
#endif /* _MLX5_IB_QP_H */

0 commit comments

Comments
 (0)