From: Juan Zhou zhoujuan51@h-partners.com
driver inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8EX1J
--------------------------------------------------------------------------
This reverts commit d5a4ca75e7ca2ea363ff5a0fa719433d0de92578.
Signed-off-by: Juan Zhou zhoujuan51@h-partners.com --- drivers/infiniband/hw/hns/hns_roce_ah.c | 8 +- drivers/infiniband/hw/hns/hns_roce_cmd.c | 17 +--- drivers/infiniband/hw/hns/hns_roce_cq.c | 19 ++--- drivers/infiniband/hw/hns/hns_roce_device.h | 22 ----- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 7 -- drivers/infiniband/hw/hns/hns_roce_main.c | 92 ++++----------------- drivers/infiniband/hw/hns/hns_roce_mr.c | 22 ++--- drivers/infiniband/hw/hns/hns_roce_pd.c | 10 +-- drivers/infiniband/hw/hns/hns_roce_qp.c | 16 +--- drivers/infiniband/hw/hns/hns_roce_srq.c | 7 +- 10 files changed, 46 insertions(+), 174 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c index f4ceaeba5601..4404b45c5ab1 100644 --- a/drivers/infiniband/hw/hns/hns_roce_ah.c +++ b/drivers/infiniband/hw/hns/hns_roce_ah.c @@ -84,7 +84,7 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, ret = 0;
if (ret && grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) - goto err_out; + return ret;
if (tc_mode == HNAE3_TC_MAP_MODE_DSCP && grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) @@ -100,7 +100,7 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, ret = rdma_read_gid_l2_fields(ah_attr->grh.sgid_attr, &ah->av.vlan_id, NULL); if (ret) - goto err_out; + return ret;
ah->av.vlan_en = ah->av.vlan_id < VLAN_N_VID; } @@ -112,10 +112,6 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, min(udata->outlen, sizeof(resp))); }
-err_out: - if (ret) - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_AH_CREATE_ERR_CNT]); - return ret; }
diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.c b/drivers/infiniband/hw/hns/hns_roce_cmd.c index a269578c8d89..864413607571 100644 --- a/drivers/infiniband/hw/hns/hns_roce_cmd.c +++ b/drivers/infiniband/hw/hns/hns_roce_cmd.c @@ -41,14 +41,7 @@ static int hns_roce_cmd_mbox_post_hw(struct hns_roce_dev *hr_dev, struct hns_roce_mbox_msg *mbox_msg) { - int ret; - - ret = hr_dev->hw->post_mbox(hr_dev, mbox_msg); - if (ret) - return ret; - - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MBX_POSTED_CNT]); - return 0; + return hr_dev->hw->post_mbox(hr_dev, mbox_msg); }
/* this should be called with "poll_sem" */ @@ -65,12 +58,7 @@ static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, return ret; }
- ret = hr_dev->hw->poll_mbox_done(hr_dev); - if (ret) - return ret; - - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MBX_POLLED_CNT]); - return 0; + return hr_dev->hw->poll_mbox_done(hr_dev); }
static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, @@ -101,7 +89,6 @@ void hns_roce_cmd_event(struct hns_roce_dev *hr_dev, u16 token, u8 status, context->result = (status == HNS_ROCE_CMD_SUCCESS) ? 0 : (-EIO); context->out_param = out_param; complete(&context->done); - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MBX_EVENT_CNT]); }
static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c index 1858b0726c9f..2d6f8c55e2b5 100644 --- a/drivers/infiniband/hw/hns/hns_roce_cq.c +++ b/drivers/infiniband/hw/hns/hns_roce_cq.c @@ -466,34 +466,32 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, struct hns_roce_ib_create_cq ucmd = {}; int ret;
- if (attr->flags) { - ret = -EOPNOTSUPP; - goto err_out; - } + if (attr->flags) + return -EOPNOTSUPP;
ret = verify_cq_create_attr(hr_dev, attr); if (ret) - goto err_out; + return ret;
if (udata) { ret = get_cq_ucmd(hr_cq, udata, &ucmd); if (ret) - goto err_out; + return ret;
}
ret = set_cq_param(hr_cq, attr->cqe, attr->comp_vector, &ucmd); if (ret) - goto err_out; + return ret;
ret = set_cqe_size(hr_cq, udata, &ucmd); if (ret) - goto err_out; + return ret;
ret = alloc_cq_buf(hr_dev, hr_cq, udata, ucmd.buf_addr); if (ret) { ibdev_err(ibdev, "failed to alloc CQ buf, ret = %d.\n", ret); - goto err_out; + return ret; }
ret = alloc_cq_db(hr_dev, hr_cq, udata, ucmd.db_addr, &resp); @@ -541,9 +539,6 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, free_cq_db(hr_dev, hr_cq, udata); err_cq_buf: free_cq_buf(hr_dev, hr_cq); -err_out: - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_CQ_CREATE_ERR_CNT]); - return ret; }
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index 146eafaec5bf..010463d5caa2 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -994,27 +994,6 @@ enum hns_roce_hw_pkt_stat_index { HNS_ROCE_HW_CNT_TOTAL, };
-enum hns_roce_hw_dfx_stat_index { - HNS_ROCE_DFX_AEQE_CNT, - HNS_ROCE_DFX_CEQE_CNT, - HNS_ROCE_DFX_CMDS_CNT, - HNS_ROCE_DFX_CMDS_ERR_CNT, - HNS_ROCE_DFX_MBX_POSTED_CNT, - HNS_ROCE_DFX_MBX_POLLED_CNT, - HNS_ROCE_DFX_MBX_EVENT_CNT, - HNS_ROCE_DFX_QP_CREATE_ERR_CNT, - HNS_ROCE_DFX_QP_MODIFY_ERR_CNT, - HNS_ROCE_DFX_CQ_CREATE_ERR_CNT, - HNS_ROCE_DFX_SRQ_CREATE_ERR_CNT, - HNS_ROCE_DFX_XRCD_ALLOC_ERR_CNT, - HNS_ROCE_DFX_MR_REG_ERR_CNT, - HNS_ROCE_DFX_MR_REREG_ERR_CNT, - HNS_ROCE_DFX_AH_CREATE_ERR_CNT, - HNS_ROCE_DFX_MMAP_ERR_CNT, - HNS_ROCE_DFX_UCTX_ALLOC_ERR_CNT, - HNS_ROCE_DFX_CNT_TOTAL -}; - struct hns_roce_hw { int (*cmq_init)(struct hns_roce_dev *hr_dev); void (*cmq_exit)(struct hns_roce_dev *hr_dev); @@ -1174,7 +1153,6 @@ struct hns_roce_dev {
struct notifier_block bond_nb; struct hns_roce_port port_data[HNS_ROCE_MAX_PORTS]; - atomic64_t *dfx_cnt; struct hns_roce_poe_ctx poe_ctx; /* poe ch array */
struct rdma_notify_mem *notify_tbl; diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 3702d866bc02..12ebe93ff9fb 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -1416,8 +1416,6 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev, /* Write to hardware */ roce_write(hr_dev, ROCEE_TX_CMQ_PI_REG, csq->head);
- atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_CMDS_CNT]); - do { if (hns_roce_cmq_csq_done(hr_dev)) break; @@ -1457,9 +1455,6 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
spin_unlock_bh(&csq->lock);
- if (ret) - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_CMDS_ERR_CNT]); - return ret; }
@@ -6532,7 +6527,6 @@ static irqreturn_t hns_roce_v2_aeq_int(struct hns_roce_dev *hr_dev, eq->sub_type = sub_type; ++eq->cons_index; aeqe_found = IRQ_HANDLED; - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_AEQE_CNT]);
hns_roce_v2_init_irq_work(hr_dev, eq, queue_num);
@@ -6575,7 +6569,6 @@ static irqreturn_t hns_roce_v2_ceq_int(struct hns_roce_dev *hr_dev,
++eq->cons_index; ceqe_found = IRQ_HANDLED; - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_CEQE_CNT]);
ceqe = next_ceqe_sw_v2(eq); } diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 9d67d8e801ce..f9e304296cf0 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -569,10 +569,10 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, struct hns_roce_dev *hr_dev = to_hr_dev(uctx->device); struct hns_roce_ib_alloc_ucontext_resp resp = {}; struct hns_roce_ib_alloc_ucontext ucmd = {}; - int ret = -EAGAIN; + int ret;
if (!hr_dev->active) - goto error_fail_uar_alloc; + return -EAGAIN;
context->pid = current->pid; INIT_LIST_HEAD(&context->list); @@ -580,7 +580,7 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, ret = ib_copy_from_udata(&ucmd, udata, min(udata->inlen, sizeof(ucmd))); if (ret) - goto error_fail_uar_alloc; + return ret;
hns_roce_get_uctx_config(hr_dev, context, &ucmd, &resp);
@@ -629,8 +629,6 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, ida_free(&hr_dev->uar_ida.ida, (int)context->uar.logic_idx);
error_fail_uar_alloc: - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_UCTX_ALLOC_ERR_CNT]); - return ret; }
@@ -693,10 +691,8 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma) int ret;
rdma_entry = rdma_user_mmap_entry_get_pgoff(uctx, vma->vm_pgoff); - if (!rdma_entry) { - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MMAP_ERR_CNT]); + if (!rdma_entry) return -EINVAL; - }
entry = to_hns_mmap(rdma_entry); pfn = entry->address >> PAGE_SHIFT; @@ -728,8 +724,6 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
out: rdma_user_mmap_entry_put(rdma_entry); - if (ret) - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MMAP_ERR_CNT]);
return ret; } @@ -786,30 +780,10 @@ static void hns_roce_get_fw_ver(struct ib_device *device, char *str) sub_minor); }
-#define HNS_ROCE_DFX_STATS(ename, cname) \ - [HNS_ROCE_DFX_##ename##_CNT] = cname - #define HNS_ROCE_HW_CNT(ename, cname) \ - [HNS_ROCE_DFX_CNT_TOTAL + HNS_ROCE_HW_##ename##_CNT] = cname + [HNS_ROCE_HW_##ename##_CNT] = cname
static const char *const hns_roce_port_stats_descs[] = { - HNS_ROCE_DFX_STATS(AEQE, "aeqe"), - HNS_ROCE_DFX_STATS(CEQE, "ceqe"), - HNS_ROCE_DFX_STATS(CMDS, "cmds"), - HNS_ROCE_DFX_STATS(CMDS_ERR, "cmds_err"), - HNS_ROCE_DFX_STATS(MBX_POSTED, "posted_mbx"), - HNS_ROCE_DFX_STATS(MBX_POLLED, "polled_mbx"), - HNS_ROCE_DFX_STATS(MBX_EVENT, "mbx_event"), - HNS_ROCE_DFX_STATS(QP_CREATE_ERR, "qp_create_err"), - HNS_ROCE_DFX_STATS(QP_MODIFY_ERR, "qp_modify_err"), - HNS_ROCE_DFX_STATS(CQ_CREATE_ERR, "cq_create_err"), - HNS_ROCE_DFX_STATS(SRQ_CREATE_ERR, "srq_create_err"), - HNS_ROCE_DFX_STATS(XRCD_ALLOC_ERR, "xrcd_alloc_err"), - HNS_ROCE_DFX_STATS(MR_REG_ERR, "mr_reg_err"), - HNS_ROCE_DFX_STATS(MR_REREG_ERR, "mr_rereg_err"), - HNS_ROCE_DFX_STATS(AH_CREATE_ERR, "ah_create_err"), - HNS_ROCE_DFX_STATS(MMAP_ERR, "mmap_err"), - HNS_ROCE_DFX_STATS(UCTX_ALLOC_ERR, "uctx_alloc_err"), HNS_ROCE_HW_CNT(RX_RC_PKT, "rx_rc_pkt"), HNS_ROCE_HW_CNT(RX_UC_PKT, "rx_uc_pkt"), HNS_ROCE_HW_CNT(RX_UD_PKT, "rx_ud_pkt"), @@ -838,21 +812,19 @@ static struct rdma_hw_stats *hns_roce_alloc_hw_port_stats(struct ib_device *devi u8 port_num) { struct hns_roce_dev *hr_dev = to_hr_dev(device); - int num_counters; + u32 port = port_num - 1;
- if (port_num > hr_dev->caps.num_ports) { + if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08 || + hr_dev->is_vf) + return NULL; + + if (port > hr_dev->caps.num_ports) { ibdev_err(device, "invalid port num.\n"); return NULL; }
- if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09 && - !hr_dev->is_vf) - num_counters = ARRAY_SIZE(hns_roce_port_stats_descs); - else - num_counters = HNS_ROCE_DFX_CNT_TOTAL; - return rdma_alloc_hw_stats_struct(hns_roce_port_stats_descs, - num_counters, + ARRAY_SIZE(hns_roce_port_stats_descs), RDMA_HW_STATS_DEFAULT_LIFESPAN); }
@@ -861,9 +833,8 @@ static int hns_roce_get_hw_stats(struct ib_device *device, u8 port, int index) { struct hns_roce_dev *hr_dev = to_hr_dev(device); - int hw_counters = HNS_ROCE_HW_CNT_TOTAL; + int num_counters = HNS_ROCE_HW_CNT_TOTAL; int ret; - int i;
if (port == 0) return 0; @@ -871,24 +842,19 @@ static int hns_roce_get_hw_stats(struct ib_device *device, if (port > hr_dev->caps.num_ports) return -EINVAL;
- for (i = 0; i < HNS_ROCE_DFX_CNT_TOTAL; i++) - stats->value[i] = atomic64_read(&hr_dev->dfx_cnt[i]); - if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08 || hr_dev->is_vf) - return HNS_ROCE_DFX_CNT_TOTAL; + return -EOPNOTSUPP;
- hw_counters = HNS_ROCE_HW_CNT_TOTAL; - ret = hr_dev->hw->query_hw_counter(hr_dev, - &stats->value[HNS_ROCE_DFX_CNT_TOTAL], - port, &hw_counters); + ret = hr_dev->hw->query_hw_counter(hr_dev, stats->value, port, + &num_counters); if (ret) { ibdev_err(device, "failed to query hw counter, ret = %d.\n", ret); return ret; }
- return hw_counters + HNS_ROCE_DFX_CNT_TOTAL; + return num_counters; }
static void hns_roce_unregister_device(struct hns_roce_dev *hr_dev, @@ -1457,21 +1423,6 @@ static void hns_roce_unregister_poe_ch(struct hns_roce_dev *hr_dev) kvfree(hr_dev->poe_ctx.poe_ch); }
-static int hns_roce_alloc_dfx_cnt(struct hns_roce_dev *hr_dev) -{ - hr_dev->dfx_cnt = kcalloc(HNS_ROCE_DFX_CNT_TOTAL, sizeof(atomic64_t), - GFP_KERNEL); - if (!hr_dev->dfx_cnt) - return -ENOMEM; - - return 0; -} - -static void hns_roce_dealloc_dfx_cnt(struct hns_roce_dev *hr_dev) -{ - kfree(hr_dev->dfx_cnt); -} - int hns_roce_init(struct hns_roce_dev *hr_dev) { struct device *dev = hr_dev->dev; @@ -1479,15 +1430,11 @@ int hns_roce_init(struct hns_roce_dev *hr_dev)
hr_dev->is_reset = false;
- ret = hns_roce_alloc_dfx_cnt(hr_dev); - if (ret) - return ret; - if (hr_dev->hw->cmq_init) { ret = hr_dev->hw->cmq_init(hr_dev); if (ret) { dev_err(dev, "Init RoCE Command Queue failed!\n"); - goto error_failed_alloc_dfx_cnt; + return ret; } }
@@ -1568,9 +1515,6 @@ int hns_roce_init(struct hns_roce_dev *hr_dev) if (hr_dev->hw->cmq_exit) hr_dev->hw->cmq_exit(hr_dev);
-error_failed_alloc_dfx_cnt: - hns_roce_dealloc_dfx_cnt(hr_dev); - return ret; }
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index 0b5108d79219..a2f07a5f9501 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -235,10 +235,8 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, int ret;
mr = kzalloc(sizeof(*mr), GFP_KERNEL); - if (!mr) { - ret = -ENOMEM; - goto err_out; - } + if (!mr) + return ERR_PTR(-ENOMEM);
mr->iova = virt_addr; mr->size = length; @@ -268,9 +266,6 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, free_mr_key(hr_dev, mr); err_alloc_mr: kfree(mr); -err_out: - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MR_REG_ERR_CNT]); - return ERR_PTR(ret); }
@@ -285,15 +280,12 @@ int hns_roce_rereg_user_mr(struct ib_mr *ibmr, int flags, u64 start, u64 length, unsigned long mtpt_idx; int ret;
- if (!mr->enabled) { - ret = -EINVAL; - goto err_out; - } + if (!mr->enabled) + return -EINVAL;
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); - ret = PTR_ERR_OR_ZERO(mailbox); - if (ret) - goto err_out; + if (IS_ERR(mailbox)) + return PTR_ERR(mailbox);
mtpt_idx = key_to_hw_index(mr->key) & (hr_dev->caps.num_mtpts - 1); ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_MPT, @@ -343,8 +335,6 @@ int hns_roce_rereg_user_mr(struct ib_mr *ibmr, int flags, u64 start, u64 length,
free_cmd_mbox: hns_roce_free_cmd_mailbox(hr_dev, mailbox); -err_out: - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MR_REREG_ERR_CNT]);
return ret; } diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c index 6c69e095aa01..a720801eaac9 100644 --- a/drivers/infiniband/hw/hns/hns_roce_pd.c +++ b/drivers/infiniband/hw/hns/hns_roce_pd.c @@ -146,18 +146,16 @@ int hns_roce_alloc_xrcd(struct ib_xrcd *ib_xrcd, struct ib_udata *udata) { struct hns_roce_dev *hr_dev = to_hr_dev(ib_xrcd->device); struct hns_roce_xrcd *xrcd = to_hr_xrcd(ib_xrcd); - int ret = -EINVAL; + int ret;
if (!(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC)) - goto err_out; + return -EINVAL;
ret = hns_roce_xrcd_alloc(hr_dev, &xrcd->xrcdn); - -err_out: if (ret) - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_XRCD_ALLOC_ERR_CNT]); + return ret;
- return ret; + return 0; }
int hns_roce_dealloc_xrcd(struct ib_xrcd *ib_xrcd, struct ib_udata *udata) diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index e8e5641ec692..b1a102970d71 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -1417,13 +1417,11 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
ret = check_qp_type(hr_dev, init_attr->qp_type, !!udata); if (ret) - goto err_out; + return ERR_PTR(ret);
hr_qp = kzalloc(sizeof(*hr_qp), GFP_KERNEL); - if (!hr_qp) { - ret = -ENOMEM; - goto err_out; - } + if (!hr_qp) + return ERR_PTR(-ENOMEM);
if (init_attr->qp_type == IB_QPT_XRC_TGT) hr_qp->xrcdn = to_hr_xrcd(init_attr->xrcd)->xrcdn; @@ -1439,14 +1437,10 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd, init_attr->qp_type, ret);
kfree(hr_qp); - goto err_out; + return ERR_PTR(ret); }
return &hr_qp->ibqp; - -err_out: - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_QP_CREATE_ERR_CNT]); - return ERR_PTR(ret); }
int to_hr_qp_type(int qp_type) @@ -1615,8 +1609,6 @@ int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
out: mutex_unlock(&hr_qp->mutex); - if (ret) - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_QP_MODIFY_ERR_CNT]);
return ret; } diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index e135d2bbe049..24df766d549e 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c @@ -474,11 +474,11 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,
ret = set_srq_param(srq, init_attr, udata); if (ret) - goto err_out; + return ret;
ret = alloc_srq_buf(hr_dev, srq, udata); if (ret) - goto err_out; + return ret;
ret = alloc_srq_db(hr_dev, srq, udata, &resp); if (ret) @@ -516,8 +516,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, free_srq_db(hr_dev, srq, udata); err_srq_buf: free_srq_buf(hr_dev, srq); -err_out: - atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_SRQ_CREATE_ERR_CNT]); + return ret; }