summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeihang Li <liweihang@huawei.com>2020-11-16 19:33:23 +0800
committerJason Gunthorpe <jgg@nvidia.com>2020-11-26 15:24:47 -0400
commitfba429fcf9a5e0c4ec2523ecf4cf18bc0507fcbc (patch)
tree5eb3df77b0821312f1d86f9de37b3224bdc3ce60
parent7406c0036f851ee1cd93cb08349f24b051b4cbf8 (diff)
downloadlinux-stable-fba429fcf9a5e0c4ec2523ecf4cf18bc0507fcbc.tar.gz
linux-stable-fba429fcf9a5e0c4ec2523ecf4cf18bc0507fcbc.tar.bz2
linux-stable-fba429fcf9a5e0c4ec2523ecf4cf18bc0507fcbc.zip
RDMA/hns: Fix missing fields in address vector
Traffic class and hop limit in address vector is not assigned from GRH, but it will be filled into UD SQ WQE. So the hardware will get a wrong value. Fixes: 82e620d9c3a0 ("RDMA/hns: Modify the data structure of hns_roce_av") Link: https://lore.kernel.org/r/1605526408-6936-3-git-send-email-liweihang@huawei.com Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_ah.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c
index 3be80d42e03a..d65ff6aa322f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_ah.c
+++ b/drivers/infiniband/hw/hns/hns_roce_ah.c
@@ -64,18 +64,20 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
struct hns_roce_ah *ah = to_hr_ah(ibah);
int ret = 0;
- memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);
-
ah->av.port = rdma_ah_get_port_num(ah_attr);
ah->av.gid_index = grh->sgid_index;
if (rdma_ah_get_static_rate(ah_attr))
ah->av.stat_rate = IB_RATE_10_GBPS;
- memcpy(ah->av.dgid, grh->dgid.raw, HNS_ROCE_GID_SIZE);
- ah->av.sl = rdma_ah_get_sl(ah_attr);
+ ah->av.hop_limit = grh->hop_limit;
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;
+
+ memcpy(ah->av.dgid, grh->dgid.raw, HNS_ROCE_GID_SIZE);
+ memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);
/* HIP08 needs to record vlan info in Address Vector */
if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08) {