RDMA/hns: Do shift on traffic class when using RoCEv2
The high 6 bits of traffic class in GRH is DSCP (Differentiated Services Codepoint), the driver should shift it before the hardware gets it when using RoCEv2. Fixes:606bf89e98
("RDMA/hns: Refactor for hns_roce_v2_modify_qp function") Fixes:fba429fcf9
("RDMA/hns: Fix missing fields in address vector") Link: https://lore.kernel.org/r/1607650657-35992-4-git-send-email-liweihang@huawei.com Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Родитель
4ddeacf68a
Коммит
603bee935f
|
@ -77,7 +77,7 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
|
|||
ah->av.flowlabel = grh->flow_label;
|
||||
ah->av.udp_sport = get_ah_udp_sport(ah_attr);
|
||||
ah->av.sl = rdma_ah_get_sl(ah_attr);
|
||||
ah->av.tclass = grh->traffic_class;
|
||||
ah->av.tclass = get_tclass(grh);
|
||||
|
||||
memcpy(ah->av.dgid, grh->dgid.raw, HNS_ROCE_GID_SIZE);
|
||||
memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);
|
||||
|
|
|
@ -1148,6 +1148,14 @@ static inline u32 to_hr_hem_entries_shift(u32 count, u32 buf_shift)
|
|||
return ilog2(to_hr_hem_entries_count(count, buf_shift));
|
||||
}
|
||||
|
||||
#define DSCP_SHIFT 2
|
||||
|
||||
static inline u8 get_tclass(const struct ib_global_route *grh)
|
||||
{
|
||||
return grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP ?
|
||||
grh->traffic_class >> DSCP_SHIFT : grh->traffic_class;
|
||||
}
|
||||
|
||||
int hns_roce_init_uar_table(struct hns_roce_dev *dev);
|
||||
int hns_roce_uar_alloc(struct hns_roce_dev *dev, struct hns_roce_uar *uar);
|
||||
void hns_roce_uar_free(struct hns_roce_dev *dev, struct hns_roce_uar *uar);
|
||||
|
|
|
@ -4596,15 +4596,11 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp,
|
|||
roce_set_field(qpc_mask->byte_24_mtu_tc, V2_QPC_BYTE_24_HOP_LIMIT_M,
|
||||
V2_QPC_BYTE_24_HOP_LIMIT_S, 0);
|
||||
|
||||
if (is_udp)
|
||||
roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M,
|
||||
V2_QPC_BYTE_24_TC_S, grh->traffic_class >> 2);
|
||||
else
|
||||
roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M,
|
||||
V2_QPC_BYTE_24_TC_S, grh->traffic_class);
|
||||
|
||||
roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M,
|
||||
V2_QPC_BYTE_24_TC_S, get_tclass(&attr->ah_attr.grh));
|
||||
roce_set_field(qpc_mask->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M,
|
||||
V2_QPC_BYTE_24_TC_S, 0);
|
||||
|
||||
roce_set_field(context->byte_28_at_fl, V2_QPC_BYTE_28_FL_M,
|
||||
V2_QPC_BYTE_28_FL_S, grh->flow_label);
|
||||
roce_set_field(qpc_mask->byte_28_at_fl, V2_QPC_BYTE_28_FL_M,
|
||||
|
|
Загрузка…
Ссылка в новой задаче