Skip to content

Commit ea8af0d

Browse files
majdmellanoxjgunthorpe
authored andcommitted
IB/mlx5: Enable ECN capable bits for UD RoCE v2 QPs
When working with RC QPs, the FW sets the ECN capable bits for all the RoCE v2 packets. On the other hand, for UD QPs, the driver needs to set the the ECN capable bits in the Address Handler since the HW generates each packet according to the Address Handler and not the QP context. If ECN is not enabled in NIC or switch, these bits are ignored. Fixes: 2811ba5 ("IB/mlx5: Add RoCE fields to Address Vector") Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Majd Dibbiny <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent be23fb9 commit ea8af0d

File tree

1 file changed

+12
-0
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+12
-0
lines changed

drivers/infiniband/hw/mlx5/ah.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ static struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev,
3636
struct mlx5_ib_ah *ah,
3737
struct rdma_ah_attr *ah_attr)
3838
{
39+
enum ib_gid_type gid_type;
40+
int err;
41+
3942
if (rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH) {
4043
const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
4144

@@ -50,13 +53,22 @@ static struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev,
5053
ah->av.stat_rate_sl = (rdma_ah_get_static_rate(ah_attr) << 4);
5154

5255
if (ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
56+
err = mlx5_get_roce_gid_type(dev, ah_attr->port_num,
57+
ah_attr->grh.sgid_index,
58+
&gid_type);
59+
if (err)
60+
return ERR_PTR(err);
61+
5362
memcpy(ah->av.rmac, ah_attr->roce.dmac,
5463
sizeof(ah_attr->roce.dmac));
5564
ah->av.udp_sport =
5665
mlx5_get_roce_udp_sport(dev,
5766
rdma_ah_get_port_num(ah_attr),
5867
rdma_ah_read_grh(ah_attr)->sgid_index);
5968
ah->av.stat_rate_sl |= (rdma_ah_get_sl(ah_attr) & 0x7) << 1;
69+
if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
70+
#define MLX5_ECN_ENABLED BIT(1)
71+
ah->av.tclass |= MLX5_ECN_ENABLED;
6072
} else {
6173
ah->av.rlid = cpu_to_be16(rdma_ah_get_dlid(ah_attr));
6274
ah->av.fl_mlid = rdma_ah_get_path_bits(ah_attr) & 0x7f;

0 commit comments

Comments
 (0)