2019-04-01 19:13:35 +08:00
|
|
|
// SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
|
|
|
// Copyright (c) 2019 Hisilicon Limited.
|
|
|
|
|
|
|
|
#include <rdma/rdma_cm.h>
|
|
|
|
#include <rdma/restrack.h>
|
|
|
|
#include <uapi/rdma/rdma_netlink.h>
|
|
|
|
#include "hns_roce_common.h"
|
|
|
|
#include "hns_roce_device.h"
|
|
|
|
#include "hns_roce_hw_v2.h"
|
|
|
|
|
2022-08-22 18:44:49 +08:00
|
|
|
int hns_roce_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ib_cq)
|
2019-04-01 19:13:35 +08:00
|
|
|
{
|
|
|
|
struct hns_roce_cq *hr_cq = to_hr_cq(ib_cq);
|
|
|
|
struct nlattr *table_attr;
|
|
|
|
|
|
|
|
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER);
|
2022-08-22 18:44:49 +08:00
|
|
|
if (!table_attr)
|
|
|
|
return -EMSGSIZE;
|
2019-04-01 19:13:35 +08:00
|
|
|
|
RDMA/hns: Add or remove CQ's restrack attributes
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
}
Link: https://lore.kernel.org/r/20220822104455.2311053-3-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:50 +08:00
|
|
|
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))
|
2022-08-22 18:44:49 +08:00
|
|
|
goto err;
|
2019-04-01 19:13:35 +08:00
|
|
|
|
|
|
|
nla_nest_end(msg, table_attr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
2022-08-22 18:44:49 +08:00
|
|
|
nla_nest_cancel(msg, table_attr);
|
|
|
|
|
|
|
|
return -EMSGSIZE;
|
2019-04-01 19:13:35 +08:00
|
|
|
}
|
RDMA/hns: Support CQ's restrack raw ops for hns driver
The CQ raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show cq dev hns_0 cqn 14 -dd -jp -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 1,0,0,0,7,0,0,0,0,0,0,0,0,82,6,0,0,82,6,0,0,82,6,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
6,0,0,0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-4-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:51 +08:00
|
|
|
|
|
|
|
int hns_roce_fill_res_cq_entry_raw(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;
|
|
|
|
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;
|
|
|
|
|
2023-08-16 17:18:10 +08:00
|
|
|
ret = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, sizeof(context), &context);
|
RDMA/hns: Support CQ's restrack raw ops for hns driver
The CQ raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show cq dev hns_0 cqn 14 -dd -jp -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 1,0,0,0,7,0,0,0,0,0,0,0,0,82,6,0,0,82,6,0,0,82,6,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
6,0,0,0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-4-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:51 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
RDMA/hns: Support QP's restrack ops for hns driver
The QP restrack attributes come from the queue information maintained by
the driver.
For example:
$ rdma res show qp link hns_0 lqpn 41 -jp -dd
[ {
"ifindex": 4,
"ifname": "hns_0",
"port": 1,
"lqpn": 41,
"rqpn": 40,
"type": "RC",
"state": "RTR",
"rq-psn": 12474738,
"sq-psn": 0,
"path-mig-state": "ARMED",
"pdn": 9,
"pid": 1523,
"comm": "ib_send_bw"
},
"drv_sq_wqe_cnt": 128,
"drv_sq_max_gs": 1,
"drv_rq_wqe_cnt": 512,
"drv_rq_max_gs": 2,
"drv_ext_sge_sge_cnt": 0
}
Link: https://lore.kernel.org/r/20220822104455.2311053-5-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:52 +08:00
|
|
|
|
|
|
|
int hns_roce_fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ib_qp)
|
|
|
|
{
|
|
|
|
struct hns_roce_qp *hr_qp = to_hr_qp(ib_qp);
|
|
|
|
struct nlattr *table_attr;
|
|
|
|
|
|
|
|
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER);
|
|
|
|
if (!table_attr)
|
|
|
|
return -EMSGSIZE;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "sq_wqe_cnt", hr_qp->sq.wqe_cnt))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "sq_max_gs", hr_qp->sq.max_gs))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "rq_wqe_cnt", hr_qp->rq.wqe_cnt))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "rq_max_gs", hr_qp->rq.max_gs))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "ext_sge_sge_cnt", hr_qp->sge.sge_cnt))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
nla_nest_end(msg, table_attr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
nla_nest_cancel(msg, table_attr);
|
|
|
|
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
RDMA/hns: Support QP's restrack raw ops for hns driver
The QP raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show qp link hns_0 -jp -dd -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,255,156,0,0,63,156,0,0,
7,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,156,0,
0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-6-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:53 +08:00
|
|
|
|
|
|
|
int hns_roce_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ib_qp)
|
|
|
|
{
|
|
|
|
struct hns_roce_dev *hr_dev = to_hr_dev(ib_qp->device);
|
|
|
|
struct hns_roce_qp *hr_qp = to_hr_qp(ib_qp);
|
RDMA/hns: Append SCC context to the raw dump of QPC
SCCC (SCC Context) is a context with QP granularity that contains
information about congestion control. Dump SCCC and QPC together
to improve troubleshooting.
When dumping raw QPC with rdmatool, there will be a total of 576 bytes
data output, where the first 512 bytes is QPC and the last 64 bytes is
SCCC. When congestion control is disabled, the 64 byte SCCC will be all 0.
Example:
$rdma res show qp -jpr
[ {
"ifindex": 0,
"ifname": "hns_0",
"data": [ 67,0,0,0... 512bytes
4,0,2... 64bytes]
},...
} ]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240305055257.823513-1-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2024-03-05 13:52:57 +08:00
|
|
|
struct hns_roce_full_qp_ctx {
|
|
|
|
struct hns_roce_v2_qp_context qpc;
|
|
|
|
struct hns_roce_v2_scc_context sccc;
|
|
|
|
} context = {};
|
RDMA/hns: Support QP's restrack raw ops for hns driver
The QP raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show qp link hns_0 -jp -dd -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,255,156,0,0,63,156,0,0,
7,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,156,0,
0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-6-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:53 +08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!hr_dev->hw->query_qpc)
|
|
|
|
return -EINVAL;
|
|
|
|
|
RDMA/hns: Append SCC context to the raw dump of QPC
SCCC (SCC Context) is a context with QP granularity that contains
information about congestion control. Dump SCCC and QPC together
to improve troubleshooting.
When dumping raw QPC with rdmatool, there will be a total of 576 bytes
data output, where the first 512 bytes is QPC and the last 64 bytes is
SCCC. When congestion control is disabled, the 64 byte SCCC will be all 0.
Example:
$rdma res show qp -jpr
[ {
"ifindex": 0,
"ifname": "hns_0",
"data": [ 67,0,0,0... 512bytes
4,0,2... 64bytes]
},...
} ]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240305055257.823513-1-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2024-03-05 13:52:57 +08:00
|
|
|
ret = hr_dev->hw->query_qpc(hr_dev, hr_qp->qpn, &context.qpc);
|
RDMA/hns: Support QP's restrack raw ops for hns driver
The QP raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show qp link hns_0 -jp -dd -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,255,156,0,0,63,156,0,0,
7,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,156,0,
0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-6-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:53 +08:00
|
|
|
if (ret)
|
RDMA/hns: Append SCC context to the raw dump of QPC
SCCC (SCC Context) is a context with QP granularity that contains
information about congestion control. Dump SCCC and QPC together
to improve troubleshooting.
When dumping raw QPC with rdmatool, there will be a total of 576 bytes
data output, where the first 512 bytes is QPC and the last 64 bytes is
SCCC. When congestion control is disabled, the 64 byte SCCC will be all 0.
Example:
$rdma res show qp -jpr
[ {
"ifindex": 0,
"ifname": "hns_0",
"data": [ 67,0,0,0... 512bytes
4,0,2... 64bytes]
},...
} ]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240305055257.823513-1-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2024-03-05 13:52:57 +08:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* If SCC is disabled or the query fails, the queried SCCC will
|
|
|
|
* be all 0.
|
|
|
|
*/
|
|
|
|
if (!(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) ||
|
|
|
|
!hr_dev->hw->query_sccc)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
ret = hr_dev->hw->query_sccc(hr_dev, hr_qp->qpn, &context.sccc);
|
|
|
|
if (ret)
|
|
|
|
ibdev_warn_ratelimited(&hr_dev->ib_dev,
|
|
|
|
"failed to query SCCC, ret = %d.\n",
|
|
|
|
ret);
|
RDMA/hns: Support QP's restrack raw ops for hns driver
The QP raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show qp link hns_0 -jp -dd -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,255,156,0,0,63,156,0,0,
7,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,156,0,
0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-6-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:53 +08:00
|
|
|
|
RDMA/hns: Append SCC context to the raw dump of QPC
SCCC (SCC Context) is a context with QP granularity that contains
information about congestion control. Dump SCCC and QPC together
to improve troubleshooting.
When dumping raw QPC with rdmatool, there will be a total of 576 bytes
data output, where the first 512 bytes is QPC and the last 64 bytes is
SCCC. When congestion control is disabled, the 64 byte SCCC will be all 0.
Example:
$rdma res show qp -jpr
[ {
"ifindex": 0,
"ifname": "hns_0",
"data": [ 67,0,0,0... 512bytes
4,0,2... 64bytes]
},...
} ]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240305055257.823513-1-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2024-03-05 13:52:57 +08:00
|
|
|
out:
|
2023-08-16 17:18:10 +08:00
|
|
|
ret = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, sizeof(context), &context);
|
RDMA/hns: Support QP's restrack raw ops for hns driver
The QP raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show qp link hns_0 -jp -dd -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,255,156,0,0,63,156,0,0,
7,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,156,0,
0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-6-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:53 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
RDMA/hns: Support MR's restrack ops for hns driver
The MR restrack attributes come from the queue information maintained by
the driver.
For example:
$ rdma res show mr dev hns_0 mrn 6 -dd -jp
[ {
"ifindex": 4,
"ifname": "hns_0",
"mrn": 6,
"rkey": "300",
"lkey": "300",
"mrlen": 131072,
"pdn": 8,
"pid": 1524,
"comm": "ib_send_bw"
},
"drv_pbl_hop_num": 2,
"drv_ba_pg_shift": 14,
"drv_buf_pg_shift": 12
}
Link: https://lore.kernel.org/r/20220822104455.2311053-7-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:54 +08:00
|
|
|
|
|
|
|
int hns_roce_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ib_mr)
|
|
|
|
{
|
|
|
|
struct hns_roce_mr *hr_mr = to_hr_mr(ib_mr);
|
|
|
|
struct nlattr *table_attr;
|
|
|
|
|
|
|
|
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER);
|
|
|
|
if (!table_attr)
|
|
|
|
return -EMSGSIZE;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "pbl_hop_num", hr_mr->pbl_hop_num))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "ba_pg_shift",
|
|
|
|
hr_mr->pbl_mtr.hem_cfg.ba_pg_shift))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "buf_pg_shift",
|
|
|
|
hr_mr->pbl_mtr.hem_cfg.buf_pg_shift))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
nla_nest_end(msg, table_attr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
nla_nest_cancel(msg, table_attr);
|
|
|
|
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
RDMA/hns: Support MR's restrack raw ops for hns driver
The MR raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show mr dev hns_0 mrn 6 -dd -jp -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 1,0,0,0,2,0,0,0,0,3,0,0,0,0,2,0,0,0,0,0,32,0,0,0,2,0,0,0,
2,0,0,0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-8-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:55 +08:00
|
|
|
|
|
|
|
int hns_roce_fill_res_mr_entry_raw(struct sk_buff *msg, struct ib_mr *ib_mr)
|
|
|
|
{
|
|
|
|
struct hns_roce_dev *hr_dev = to_hr_dev(ib_mr->device);
|
|
|
|
struct hns_roce_mr *hr_mr = to_hr_mr(ib_mr);
|
|
|
|
struct hns_roce_v2_mpt_entry context;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!hr_dev->hw->query_mpt)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ret = hr_dev->hw->query_mpt(hr_dev, hr_mr->key, &context);
|
|
|
|
if (ret)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2023-08-16 17:18:10 +08:00
|
|
|
ret = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, sizeof(context), &context);
|
RDMA/hns: Support MR's restrack raw ops for hns driver
The MR raw restrack attributes come from the queue context maintained by
the ROCEE.
For example:
$ rdma res show mr dev hns_0 mrn 6 -dd -jp -r
[ {
"ifindex": 4,
"ifname": "hns_0",
"data": [ 1,0,0,0,2,0,0,0,0,3,0,0,0,0,2,0,0,0,0,0,32,0,0,0,2,0,0,0,
2,0,0,0,0,0,0,0 ]
} ]
Link: https://lore.kernel.org/r/20220822104455.2311053-8-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-08-22 18:44:55 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
RDMA/hns: Support SRQ restrack ops for hns driver
The SRQ restrack attributes come from the context maintained by ROCEE.
Example:
$ rdma res show srq -jp -dd
[ {
"ifindex": 0,
"ifname": "hns_0",
"srqn": 0,
"type": "BASIC",
"lqpn": [ "14-15","22-23" ],
"pdn": 2,
"pid": 1224,
"comm": "ib_send_bw",{
"drv_srqn": 0,
"drv_wqe_cnt": 512,
"drv_max_gs": 2,
"drv_xrcdn": 0
}
} ]
$ rdma res show srq link hns_0 -jpr
[ {
"ifindex": 0,
"ifname": "hns_0",
"data": [ 149,0,0,0,0,0,0,0,0,0,0,0,119,101,120,99,0,
46,62,31,0,0,0,0,3,0,0,1,0,58,62,31,0,0,0,0,
30,159,15,0,0,0,64,5,0,0,0,0,0,0,0,0,0,0,0,
9,0,0,0,0,0,0,0,0 ]
} ]
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Link: https://lore.kernel.org/r/20230918131110.3987498-4-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2023-09-18 21:11:10 +08:00
|
|
|
|
|
|
|
int hns_roce_fill_res_srq_entry(struct sk_buff *msg, struct ib_srq *ib_srq)
|
|
|
|
{
|
|
|
|
struct hns_roce_srq *hr_srq = to_hr_srq(ib_srq);
|
|
|
|
struct nlattr *table_attr;
|
|
|
|
|
|
|
|
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER);
|
|
|
|
if (!table_attr)
|
|
|
|
return -EMSGSIZE;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "srqn", hr_srq->srqn))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "wqe_cnt", hr_srq->wqe_cnt))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "max_gs", hr_srq->max_gs))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (rdma_nl_put_driver_u32_hex(msg, "xrcdn", hr_srq->xrcdn))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
nla_nest_end(msg, table_attr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
nla_nest_cancel(msg, table_attr);
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int hns_roce_fill_res_srq_entry_raw(struct sk_buff *msg, struct ib_srq *ib_srq)
|
|
|
|
{
|
|
|
|
struct hns_roce_dev *hr_dev = to_hr_dev(ib_srq->device);
|
|
|
|
struct hns_roce_srq *hr_srq = to_hr_srq(ib_srq);
|
|
|
|
struct hns_roce_srq_context context;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!hr_dev->hw->query_srqc)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ret = hr_dev->hw->query_srqc(hr_dev, hr_srq->srqn, &context);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, sizeof(context), &context);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|