Skip to content

Commit 39c047d

Browse files
Junxian Huangrleon
authored andcommitted
RDMA/hns: Fix ah error counter in sw stat not increasing
There are several error cases where hns_roce_create_ah() returns directly without jumping to sw stat path, thus leading to a problem that the ah error counter does not increase. Fixes: ee20cc1 ("RDMA/hns: Support DSCP") Fixes: eb7854d ("RDMA/hns: Support SW stats with debugfs") Signed-off-by: Junxian Huang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent cc5b9b4 commit 39c047d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/infiniband/hw/hns/hns_roce_ah.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
6464
u8 tc_mode = 0;
6565
int ret;
6666

67-
if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08 && udata)
68-
return -EOPNOTSUPP;
67+
if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08 && udata) {
68+
ret = -EOPNOTSUPP;
69+
goto err_out;
70+
}
6971

7072
ah->av.port = rdma_ah_get_port_num(ah_attr);
7173
ah->av.gid_index = grh->sgid_index;
@@ -83,16 +85,18 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
8385
ret = 0;
8486

8587
if (ret && grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
86-
return ret;
88+
goto err_out;
8789

8890
if (tc_mode == HNAE3_TC_MAP_MODE_DSCP &&
8991
grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
9092
ah->av.sl = priority;
9193
else
9294
ah->av.sl = rdma_ah_get_sl(ah_attr);
9395

94-
if (!check_sl_valid(hr_dev, ah->av.sl))
95-
return -EINVAL;
96+
if (!check_sl_valid(hr_dev, ah->av.sl)) {
97+
ret = -EINVAL;
98+
goto err_out;
99+
}
96100

97101
memcpy(ah->av.dgid, grh->dgid.raw, HNS_ROCE_GID_SIZE);
98102
memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);

0 commit comments

Comments
 (0)