aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/hns/hns_roce_restrack.c
diff options
context:
space:
mode:
authorWenpeng Liang <liangwenpeng@huawei.com>2022-08-22 18:44:49 +0800
committerLeon Romanovsky <leonro@nvidia.com>2022-08-23 11:34:42 +0300
commit40b4b79c866ffc1414a3989cc480263e76f28589 (patch)
tree5be58ce4696a2be21644679be636c45e1f5feeaa /drivers/infiniband/hw/hns/hns_roce_restrack.c
parentIB/mlx5: Remove duplicate header inclusion related to ODP (diff)
downloadlinux-dev-40b4b79c866ffc1414a3989cc480263e76f28589.tar.xz
linux-dev-40b4b79c866ffc1414a3989cc480263e76f28589.zip
RDMA/hns: Remove redundant DFX file and DFX ops structure
There is no need to use a dedicated DXF file and DFX structure to manage the interface of the query queue context. Link: https://lore.kernel.org/r/20220822104455.2311053-2-liangwenpeng@huawei.com Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_restrack.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_restrack.c b/drivers/infiniband/hw/hns/hns_roce_restrack.c
index 24a154d64630..83417be15d3f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_restrack.c
+++ b/drivers/infiniband/hw/hns/hns_roce_restrack.c
@@ -55,45 +55,34 @@ err:
return -EMSGSIZE;
}
-int hns_roce_fill_res_cq_entry(struct sk_buff *msg,
- struct ib_cq *ib_cq)
+int hns_roce_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ib_cq)
{
struct hns_roce_dev *hr_dev = to_hr_dev(ib_cq->device);
struct hns_roce_cq *hr_cq = to_hr_cq(ib_cq);
- struct hns_roce_v2_cq_context *context;
+ struct hns_roce_v2_cq_context context;
struct nlattr *table_attr;
int ret;
- if (!hr_dev->dfx->query_cqc_info)
+ if (!hr_dev->hw->query_cqc)
return -EINVAL;
- context = kzalloc(sizeof(struct hns_roce_v2_cq_context), GFP_KERNEL);
- if (!context)
- return -ENOMEM;
-
- ret = hr_dev->dfx->query_cqc_info(hr_dev, hr_cq->cqn, (int *)context);
+ ret = hr_dev->hw->query_cqc(hr_dev, hr_cq->cqn, &context);
if (ret)
- goto err;
+ return -EINVAL;
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER);
- if (!table_attr) {
- ret = -EMSGSIZE;
- goto err;
- }
+ if (!table_attr)
+ return -EMSGSIZE;
- if (hns_roce_fill_cq(msg, context)) {
- ret = -EMSGSIZE;
- goto err_cancel_table;
- }
+ if (hns_roce_fill_cq(msg, &context))
+ goto err;
nla_nest_end(msg, table_attr);
- kfree(context);
return 0;
-err_cancel_table:
- nla_nest_cancel(msg, table_attr);
err:
- kfree(context);
- return ret;
+ nla_nest_cancel(msg, table_attr);
+
+ return -EMSGSIZE;
}