From: Wenpeng Liang <liangwenpeng@huawei.com>
To: <jgg@nvidia.com>, <leon@kernel.org>
Cc: <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>,
<liangwenpeng@huawei.com>
Subject: [PATCH v2 for-next 2/7] RDMA/hns: Add or remove CQ's restrack attributes
Date: Mon, 22 Aug 2022 18:44:50 +0800 [thread overview]
Message-ID: <20220822104455.2311053-3-liangwenpeng@huawei.com> (raw)
In-Reply-To: <20220822104455.2311053-1-liangwenpeng@huawei.com>
Remove the resttrack attributes from the queue context held by ROCEE, and
add the resttrack attributes from the queue information maintained by the
driver.
For example:
$ rdma res show cq dev hns_0 cqn 14 -dd -jp
[ {
"ifindex": 4,
"ifname": "hns_0",
"cqn": 14,
"cqe": 127,
"users": 1,
"adaptive-moderation": false,
"ctxn": 8,
"pid": 1524,
"comm": "ib_send_bw"
},
"drv_cq_depth": 128,
"drv_cons_index": 0,
"drv_cqe_size": 32,
"drv_arm_sn": 1
}
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_restrack.c | 67 +++----------------
1 file changed, 10 insertions(+), 57 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_restrack.c b/drivers/infiniband/hw/hns/hns_roce_restrack.c
index 83417be15d3f..2e8299784bc2 100644
--- a/drivers/infiniband/hw/hns/hns_roce_restrack.c
+++ b/drivers/infiniband/hw/hns/hns_roce_restrack.c
@@ -9,72 +9,25 @@
#include "hns_roce_device.h"
#include "hns_roce_hw_v2.h"
-static int hns_roce_fill_cq(struct sk_buff *msg,
- struct hns_roce_v2_cq_context *context)
-{
- if (rdma_nl_put_driver_u32(msg, "state",
- hr_reg_read(context, CQC_ARM_ST)))
-
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "ceqn",
- hr_reg_read(context, CQC_CEQN)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "cqn",
- hr_reg_read(context, CQC_CQN)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "hopnum",
- hr_reg_read(context, CQC_CQE_HOP_NUM)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "pi",
- hr_reg_read(context, CQC_CQ_PRODUCER_IDX)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "ci",
- hr_reg_read(context, CQC_CQ_CONSUMER_IDX)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "coalesce",
- hr_reg_read(context, CQC_CQ_MAX_CNT)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "period",
- hr_reg_read(context, CQC_CQ_PERIOD)))
- goto err;
-
- if (rdma_nl_put_driver_u32(msg, "cnt",
- hr_reg_read(context, CQC_CQE_CNT)))
- goto err;
-
- return 0;
-
-err:
- return -EMSGSIZE;
-}
-
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 nlattr *table_attr;
- int ret;
-
- if (!hr_dev->hw->query_cqc)
- return -EINVAL;
-
- ret = hr_dev->hw->query_cqc(hr_dev, hr_cq->cqn, &context);
- if (ret)
- return -EINVAL;
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER);
if (!table_attr)
return -EMSGSIZE;
- if (hns_roce_fill_cq(msg, &context))
+ if (rdma_nl_put_driver_u32(msg, "cq_depth", hr_cq->cq_depth))
+ goto err;
+
+ if (rdma_nl_put_driver_u32(msg, "cons_index", hr_cq->cons_index))
+ goto err;
+
+ if (rdma_nl_put_driver_u32(msg, "cqe_size", hr_cq->cqe_size))
+ goto err;
+
+ if (rdma_nl_put_driver_u32(msg, "arm_sn", hr_cq->arm_sn))
goto err;
nla_nest_end(msg, table_attr);
--
2.30.0
next prev parent reply other threads:[~2022-08-22 10:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 10:44 [PATCH v2 for-next 0/7] RDMA/hns: Add more restrack attributes to hns driver Wenpeng Liang
2022-08-22 10:44 ` [PATCH v2 for-next 1/7] RDMA/hns: Remove redundant DFX file and DFX ops structure Wenpeng Liang
2022-08-22 10:44 ` Wenpeng Liang [this message]
2022-08-22 10:44 ` [PATCH v2 for-next 3/7] RDMA/hns: Support CQ's restrack raw ops for hns driver Wenpeng Liang
2022-08-22 10:44 ` [PATCH v2 for-next 4/7] RDMA/hns: Support QP's restrack " Wenpeng Liang
2022-08-22 10:44 ` [PATCH v2 for-next 5/7] RDMA/hns: Support QP's restrack raw " Wenpeng Liang
2022-08-22 10:44 ` [PATCH v2 for-next 6/7] RDMA/hns: Support MR's restrack " Wenpeng Liang
2022-08-22 10:44 ` [PATCH v2 for-next 7/7] RDMA/hns: Support MR's restrack raw " Wenpeng Liang
2022-08-23 8:37 ` [PATCH v2 for-next 0/7] RDMA/hns: Add more restrack attributes to " Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220822104455.2311053-3-liangwenpeng@huawei.com \
--to=liangwenpeng@huawei.com \
--cc=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.