RAW format dumps through RDMAtool
Subsystems (7)
cover RAW format dumps through RDMAtool
From: Leon Romanovsky <[email protected]>
Changelog:
v1:
* Maor dropped controversial change to dummy interface.
v0: https://lore.kernel.org/linux-rdma/[email protected]
Hi,
The following series adds support to get the RDMA resource data in RAW format. The main motivation for doing this is to enable vendors to return the entire QP/CQ/MR data without a need from the vendor to set each field separately.
Thanks
Maor Gottlieb (11):
net/mlx5: Export resource dump interface net/mlx5: Add support in query QP, CQ and MKEY segments RDMA/core: Don't call fill_res_entry for PD
RDMA: Add dedicated MR resource tracker function
RDMA: Add dedicated CQ resource tracker function
RDMA: Add dedicated QP resource tracker function
RDMA: Add dedicated CM_ID resource tracker function
RDMA: Add support to dump resource tracker in RAW format RDMA/mlx5: Add support to get QP resource in raw format RDMA/mlx5: Add support to get CQ resource in RAW format RDMA/mlx5: Add support to get MR resource in RAW format
drivers/infiniband/core/device.c | 7 +-
drivers/infiniband/core/nldev.c | 128 +++++++++---------
drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 7 +-
drivers/infiniband/hw/cxgb4/provider.c | 11 +-
drivers/infiniband/hw/cxgb4/restrack.c | 33 ++---
drivers/infiniband/hw/hns/hns_roce_device.h | 4 +-
drivers/infiniband/hw/hns/hns_roce_main.c | 2 +-
drivers/infiniband/hw/hns/hns_roce_restrack.c | 17 +--
drivers/infiniband/hw/mlx5/main.c | 6 +-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 11 +-
drivers/infiniband/hw/mlx5/restrack.c | 105 +++++++++++---
.../mellanox/mlx5/core/diag/rsc_dump.c | 6 +
.../mellanox/mlx5/core/diag/rsc_dump.h | 33 +----
.../diag => include/linux/mlx5}/rsc_dump.h | 25 ++--
include/rdma/ib_verbs.h | 13 +-
include/uapi/rdma/rdma_netlink.h | 2 +
16 files changed, 225 insertions(+), 185 deletions(-)
copy {drivers/net/ethernet/mellanox/mlx5/core/diag => include/linux/mlx5}/rsc_dump.h (68%)--
2.26.2
PATCH 1/11 net/mlx5: Export resource dump interface
From: Maor Gottlieb <[email protected]>
Export some of the resource dump API, so it could be used by the mlx5_ib driver as well.
---
.../mellanox/mlx5/core/diag/rsc_dump.c | 3 ++
.../mellanox/mlx5/core/diag/rsc_dump.h | 33 +------------------
.../diag => include/linux/mlx5}/rsc_dump.h | 22 ++++---------
3 files changed, 10 insertions(+), 48 deletions(-)
copy {drivers/net/ethernet/mellanox/mlx5/core/diag => include/linux/mlx5}/rsc_dump.h (68%)drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c +3 -0
@@ -130,11 +130,13 @@ struct mlx5_rsc_dump_cmd *mlx5_rsc_dump_cmd_create(struct mlx5_core_dev *dev, cmd->mem_size = key->size;return cmd; } +EXPORT_SYMBOL (mlx5_rsc_dump_cmd_create);void mlx5_rsc_dump_cmd_destroy (struct mlx5_rsc_dump_cmd *cmd) {kfree (cmd); } +EXPORT_SYMBOL (mlx5_rsc_dump_cmd_destroy);int mlx5_rsc_dump_next (struct mlx5_core_dev *dev,struct mlx5_rsc_dump_cmd *cmd,struct page *page,int *size)
@@ -155,6 +157,7 @@ int mlx5_rsc_dump_next(struct mlx5_core_dev *dev, struct mlx5_rsc_dump_cmd *cmd,return more_dump; } +EXPORT_SYMBOL (mlx5_rsc_dump_next);#define MLX5_RSC_DUMP_MENU_SEGMENT 0xffffstatic int mlx5_rsc_dump_menu (struct mlx5_core_dev *dev)
drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h +1 -32
@@ -4,41 +4,10 @@#ifndef __MLX5_RSC_DUMP_H#define __MLX5_RSC_DUMP_H +#include <linux/mlx5/rsc_dump.h> #include <linux/mlx5/driver.h> #include "mlx5_core.h" -enum mlx5_sgmt_type { -MLX5_SGMT_TYPE_HW_CQPC , -MLX5_SGMT_TYPE_HW_SQPC , -MLX5_SGMT_TYPE_HW_RQPC , -MLX5_SGMT_TYPE_FULL_SRQC , -MLX5_SGMT_TYPE_FULL_CQC , -MLX5_SGMT_TYPE_FULL_EQC , -MLX5_SGMT_TYPE_FULL_QPC , -MLX5_SGMT_TYPE_SND_BUFF , -MLX5_SGMT_TYPE_RCV_BUFF , -MLX5_SGMT_TYPE_SRQ_BUFF , -MLX5_SGMT_TYPE_CQ_BUFF , -MLX5_SGMT_TYPE_EQ_BUFF , -MLX5_SGMT_TYPE_SX_SLICE , -MLX5_SGMT_TYPE_SX_SLICE_ALL , -MLX5_SGMT_TYPE_RDB , -MLX5_SGMT_TYPE_RX_SLICE_ALL , -MLX5_SGMT_TYPE_MENU , -MLX5_SGMT_TYPE_TERMINATE , - -MLX5_SGMT_TYPE_NUM ,/* Keep last */ -}; - -struct mlx5_rsc_key { -enum mlx5_sgmt_type rsc; -int index1; -int index2; -int num_of_obj1; -int num_of_obj2; -int size; -}; -#define MLX5_RSC_DUMP_ALL 0xFFFFstruct mlx5_rsc_dump_cmd ;struct mlx5_rsc_dump ;
include/linux/mlx5/rsc_dump.h renamed from drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h +6 -16
@@ -1,11 +1,10 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (c) 2019 Mellanox Technologies. */ - -#ifndef __MLX5_RSC_DUMP_H -#define __MLX5_RSC_DUMP_H +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2020 Mellanox Technologies inc. */ #include <linux/mlx5/driver.h> -#include "mlx5_core.h" + +#ifndef __MLX5_RSC_DUMP +#define __MLX5_RSC_DUMPenum mlx5_sgmt_type { MLX5_SGMT_TYPE_HW_CQPC,
@@ -39,20 +38,11 @@ struct mlx5_rsc_key { int size; }; -#define MLX5_RSC_DUMP_ALL 0xFFFFstruct mlx5_rsc_dump_cmd ; -struct mlx5_rsc_dump ; - -struct mlx5_rsc_dump *mlx5_rsc_dump_create (struct mlx5_core_dev *dev); -void mlx5_rsc_dump_destroy (struct mlx5_core_dev *dev); - -int mlx5_rsc_dump_init (struct mlx5_core_dev *dev); -void mlx5_rsc_dump_cleanup (struct mlx5_core_dev *dev);struct mlx5_rsc_dump_cmd *mlx5_rsc_dump_cmd_create (struct mlx5_core_dev *dev,struct mlx5_rsc_key *key);void mlx5_rsc_dump_cmd_destroy (struct mlx5_rsc_dump_cmd *cmd); -int mlx5_rsc_dump_next (struct mlx5_core_dev *dev,struct mlx5_rsc_dump_cmd *cmd,struct page *page,int *size); -#endif +#endif /* __MLX5_RSC_DUMP */
Signature · 1 line
2.26.2
PATCH 2/11 net/mlx5: Add support in query QP, CQ and MKEY segments
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
Introduce new resource dump segments - PRM_QUERY_QP, PRM_QUERY_CQ and PRM_QUERY_MKEY. These segments contains the resource dump in PRM query format.
--- drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c | 3 +++ include/linux/mlx5/rsc_dump.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c +3 -0
@@ -23,6 +23,9 @@ static const char *const mlx5_rsc_sgmt_name[] = {MLX5_SGMT_STR_ASSING (SX_SLICE_ALL ),MLX5_SGMT_STR_ASSING (RDB ),MLX5_SGMT_STR_ASSING (RX_SLICE_ALL ), +MLX5_SGMT_STR_ASSING (PRM_QUERY_QP ), +MLX5_SGMT_STR_ASSING (PRM_QUERY_CQ ), + MLX5_SGMT_STR_ASSING(PRM_QUERY_MKEY), };struct mlx5_rsc_dump {
include/linux/mlx5/rsc_dump.h +3 -0
@@ -23,6 +23,9 @@ enum mlx5_sgmt_type {MLX5_SGMT_TYPE_SX_SLICE_ALL ,MLX5_SGMT_TYPE_RDB ,MLX5_SGMT_TYPE_RX_SLICE_ALL , +MLX5_SGMT_TYPE_PRM_QUERY_QP , +MLX5_SGMT_TYPE_PRM_QUERY_CQ , +MLX5_SGMT_TYPE_PRM_QUERY_MKEY ,MLX5_SGMT_TYPE_MENU , MLX5_SGMT_TYPE_TERMINATE,
Signature · 1 line
2.26.2
PATCH 3/11 RDMA/core: Don't call fill_res_entry for PD
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
None of the vendor implement it, remove it.
--- drivers/infiniband/core/nldev.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/infiniband/core/nldev.c +1 -8
@@ -653,7 +653,6 @@ static int fill_res_pd_entry(struct sk_buff *msg, bool has_cap_net_admin, struct rdma_restrack_entry *res, uint32_t port) { struct ib_pd *pd = container_of(res, struct ib_pd, res); -struct ib_device *dev = pd->device;if (has_cap_net_admin) { if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY,
@@ -676,13 +675,7 @@ static int fill_res_pd_entry(struct sk_buff *msg, bool has_cap_net_admin, pd->uobject->context->res.id)) goto err; -if (fill_res_name_pid (msg, res)) - goto err; - -if (fill_res_entry (dev, msg, res)) - goto err; - -return 0 ; +return fill_res_name_pid (msg, res); err:return -EMSGSIZE ; }
Signature · 1 line
2.26.2
PATCH 4/11 RDMA: Add dedicated MR resource tracker function
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
In order to avoid double multiplexing of the resource when it's MR, add a dedicated callback function.
--- drivers/infiniband/core/device.c | 3 ++- drivers/infiniband/core/nldev.c | 18 ++++------------- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 1 + drivers/infiniband/hw/cxgb4/provider.c | 1 + drivers/infiniband/hw/cxgb4/restrack.c | 5 +---- drivers/infiniband/hw/mlx5/main.c | 4 ++-- drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 ++---- drivers/infiniband/hw/mlx5/restrack.c | 28 ++++---------------------- include/rdma/ib_verbs.h | 4 ++-- 9 files changed, 19 insertions(+), 51 deletions(-)
drivers/infiniband/core/device.c +2 -1
@@ -2618,7 +2618,8 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, drain_sq);SET_DEVICE_OP (dev_ops, enable_driver);SET_DEVICE_OP (dev_ops, fill_res_entry); -SET_DEVICE_OP (dev_ops, fill_stat_entry); +SET_DEVICE_OP (dev_ops, fill_res_mr_entry); +SET_DEVICE_OP (dev_ops, fill_stat_mr_entry);SET_DEVICE_OP (dev_ops, get_dev_fw_str);SET_DEVICE_OP (dev_ops, get_dma_mr);SET_DEVICE_OP (dev_ops, get_hw_stats);
drivers/infiniband/core/nldev.c +4 -14
@@ -454,14 +454,6 @@ static bool fill_res_entry(struct ib_device *dev, struct sk_buff *msg,return dev->ops.fill_res_entry (msg, res); } -static bool fill_stat_entry (struct ib_device *dev,struct sk_buff *msg, -struct rdma_restrack_entry *res) -{ -if (!dev->ops.fill_stat_entry) -return false; -return dev->ops.fill_stat_entry (msg, res); -} -static int fill_res_qp_entry (struct sk_buff *msg,bool has_cap_net_admin,struct rdma_restrack_entry *res,uint32_t port) {
@@ -641,9 +633,8 @@ static int fill_res_mr_entry(struct sk_buff *msg, bool has_cap_net_admin,if (fill_res_name_pid (msg, res)) goto err; -if (fill_res_entry (dev, msg, res)) - goto err; - +if (dev->ops.fill_res_mr_entry) +return dev->ops.fill_res_mr_entry (msg, mr);return 0 ; err:return -EMSGSIZE ;
@@ -786,9 +777,8 @@ static int fill_stat_mr_entry(struct sk_buff *msg, bool has_cap_net_admin,if (nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_MRN , res->id)) goto err; -if (fill_stat_entry (dev, msg, res)) - goto err; - +if (dev->ops.fill_stat_mr_entry) +return dev->ops.fill_stat_mr_entry (msg, mr);return 0 ; err:
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -0
@@ -1055,6 +1055,7 @@ struct c4iw_wr_wait *c4iw_alloc_wr_wait(gfp_t gfp);typedef int c4iw_restrack_func (struct sk_buff *msg,struct rdma_restrack_entry *res); +int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr);extern c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ];#endif
drivers/infiniband/hw/cxgb4/provider.c +1 -0
@@ -486,6 +486,7 @@ static const struct ib_device_ops c4iw_dev_ops = { .destroy_qp = c4iw_destroy_qp, .destroy_srq = c4iw_destroy_srq, .fill_res_entry = fill_res_entry, + .fill_res_mr_entry = c4iw_fill_res_mr_entry, .get_dev_fw_str = get_dev_fw_str, .get_dma_mr = c4iw_get_dma_mr, .get_hw_stats = c4iw_get_mib,
drivers/infiniband/hw/cxgb4/restrack.c +1 -4
@@ -433,10 +433,8 @@ static int fill_res_cq_entry(struct sk_buff *msg,return -EMSGSIZE ; } -static int fill_res_mr_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr) { - struct ib_mr *ibmr = container_of(res, struct ib_mr, res);struct c4iw_mr *mhp =to_c4iw_mr (ibmr);struct c4iw_dev *dev = mhp->rhp;u32 stag = mhp->attr.stag;
@@ -497,5 +495,4 @@ c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX] = { [RDMA_RESTRACK_QP] = fill_res_qp_entry, [RDMA_RESTRACK_CM_ID] = fill_res_ep_entry, [RDMA_RESTRACK_CQ] = fill_res_cq_entry, - [RDMA_RESTRACK_MR] = fill_res_mr_entry, };
drivers/infiniband/hw/mlx5/main.c +2 -2
@@ -6608,8 +6608,8 @@ static const struct ib_device_ops mlx5_ib_dev_ops = { .drain_rq = mlx5_ib_drain_rq, .drain_sq = mlx5_ib_drain_sq, .enable_driver = mlx5_ib_enable_driver, - .fill_res_entry = mlx5_ib_fill_res_entry, - .fill_stat_entry = mlx5_ib_fill_stat_entry, + .fill_res_mr_entry = mlx5_ib_fill_res_mr_entry, + .fill_stat_mr_entry = mlx5_ib_fill_stat_mr_entry, .get_dev_fw_str = get_dev_fw_str, .get_dma_mr = mlx5_ib_get_dma_mr, .get_link_layer = mlx5_ib_port_link_layer,
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -4
@@ -1383,10 +1383,8 @@ struct mlx5_core_dev *mlx5_ib_get_native_port_mdev(struct mlx5_ib_dev *dev, u8 *native_port_num);void mlx5_ib_put_native_port_mdev (struct mlx5_ib_dev *dev,u8 port_num); -int mlx5_ib_fill_res_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res); -int mlx5_ib_fill_stat_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res); +int mlx5_ib_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr); +int mlx5_ib_fill_stat_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr);extern const struct uapi_definition mlx5_ib_devx_defs[];extern const struct uapi_definition mlx5_ib_flow_defs[];
drivers/infiniband/hw/mlx5/restrack.c +4 -24
@@ -8,10 +8,9 @@#include <rdma/restrack.h> #include "mlx5_ib.h" -static int fill_stat_mr_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int mlx5_ib_fill_stat_mr_entry (struct sk_buff *msg, +struct ib_mr *ibmr) { - struct ib_mr *ibmr = container_of(res, struct ib_mr, res);struct mlx5_ib_mr *mr =to_mmr (ibmr);struct nlattr *table_attr;
@@ -41,10 +40,9 @@ static int fill_stat_mr_entry(struct sk_buff *msg,return -EMSGSIZE ; } -static int fill_res_mr_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int mlx5_ib_fill_res_mr_entry (struct sk_buff *msg, +struct ib_mr *ibmr) { - struct ib_mr *ibmr = container_of(res, struct ib_mr, res);struct mlx5_ib_mr *mr =to_mmr (ibmr);struct nlattr *table_attr;
@@ -70,21 +68,3 @@ static int fill_res_mr_entry(struct sk_buff *msg,nla_nest_cancel (msg, table_attr);return -EMSGSIZE ; } - -int mlx5_ib_fill_res_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) -{ -if (res->type ==RDMA_RESTRACK_MR ) -return fill_res_mr_entry (msg, res); - -return 0 ; -} - -int mlx5_ib_fill_stat_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) -{ -if (res->type ==RDMA_RESTRACK_MR ) -return fill_stat_mr_entry (msg, res); - -return 0 ; -}
include/rdma/ib_verbs.h +2 -2
@@ -2598,6 +2598,7 @@ struct ib_device_ops {*/ int (*fill_res_entry)(struct sk_buff *msg,struct rdma_restrack_entry *entry); +int (*fill_res_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr);/* Device lifecycle callbacks */ /*
@@ -2652,8 +2653,7 @@ struct ib_device_ops {* Allows rdma drivers to add their own restrack attributes * dumped via 'rdma stat' iproute2 command. */ -int (*fill_stat_entry)(struct sk_buff *msg, -struct rdma_restrack_entry *entry); +int (*fill_stat_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr);DECLARE_RDMA_OBJ_SIZE (ib_ah);DECLARE_RDMA_OBJ_SIZE (ib_cq);
Signature · 1 line
2.26.2
PATCH 5/11 RDMA: Add dedicated CQ resource tracker function
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
In order to avoid double multiplexing of the resource when it's CQ, add a dedicated callback function.
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/nldev.c | 5 ++--- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 1 + drivers/infiniband/hw/cxgb4/provider.c | 1 + drivers/infiniband/hw/cxgb4/restrack.c | 5 +---- drivers/infiniband/hw/hns/hns_roce_device.h | 4 ++-- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- drivers/infiniband/hw/hns/hns_roce_restrack.c | 14 ++------------ include/rdma/ib_verbs.h | 1 + 9 files changed, 12 insertions(+), 22 deletions(-)
drivers/infiniband/core/device.c +1 -0
@@ -2617,6 +2617,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, drain_rq);SET_DEVICE_OP (dev_ops, drain_sq);SET_DEVICE_OP (dev_ops, enable_driver); +SET_DEVICE_OP (dev_ops, fill_res_cq_entry);SET_DEVICE_OP (dev_ops, fill_res_entry);SET_DEVICE_OP (dev_ops, fill_res_mr_entry);SET_DEVICE_OP (dev_ops, fill_stat_mr_entry);
drivers/infiniband/core/nldev.c +2 -3
@@ -598,9 +598,8 @@ static int fill_res_cq_entry(struct sk_buff *msg, bool has_cap_net_admin,if (fill_res_name_pid (msg, res)) goto err; -if (fill_res_entry (dev, msg, res)) - goto err; - +if (dev->ops.fill_res_cq_entry) +return dev->ops.fill_res_cq_entry (msg, cq);return 0 ; err:return -EMSGSIZE ;
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -0
@@ -1056,6 +1056,7 @@ struct c4iw_wr_wait *c4iw_alloc_wr_wait(gfp_t gfp);typedef int c4iw_restrack_func (struct sk_buff *msg,struct rdma_restrack_entry *res);int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr); +int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq);extern c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ];#endif
drivers/infiniband/hw/cxgb4/provider.c +1 -0
@@ -485,6 +485,7 @@ static const struct ib_device_ops c4iw_dev_ops = { .destroy_cq = c4iw_destroy_cq, .destroy_qp = c4iw_destroy_qp, .destroy_srq = c4iw_destroy_srq, + .fill_res_cq_entry = c4iw_fill_res_cq_entry, .fill_res_entry = fill_res_entry, .fill_res_mr_entry = c4iw_fill_res_mr_entry, .get_dev_fw_str = get_dev_fw_str,
drivers/infiniband/hw/cxgb4/restrack.c +1 -4
@@ -372,10 +372,8 @@ static int fill_swcqes(struct sk_buff *msg, struct t4_cq *cq,return -EMSGSIZE ; } -static int fill_res_cq_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq) { - struct ib_cq *ibcq = container_of(res, struct ib_cq, res);struct c4iw_cq *chp =to_c4iw_cq (ibcq);struct nlattr *table_attr;struct t4_cqe hwcqes[2 ];
@@ -494,5 +492,4 @@ int c4iw_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ibmr)c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ] = { [RDMA_RESTRACK_QP ] = fill_res_qp_entry, [RDMA_RESTRACK_CM_ID ] = fill_res_ep_entry, - [RDMA_RESTRACK_CQ ] = fill_res_cq_entry, };
drivers/infiniband/hw/hns/hns_roce_device.h +2 -2
@@ -1266,6 +1266,6 @@ void hns_roce_handle_device_err(struct hns_roce_dev *hr_dev);int hns_roce_init (struct hns_roce_dev *hr_dev);void hns_roce_exit (struct hns_roce_dev *hr_dev); -int hns_roce_fill_res_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res); +int hns_roce_fill_res_cq_entry (struct sk_buff *msg, +struct ib_cq *ib_cq);#endif /* _HNS_ROCE_DEVICE_H */
drivers/infiniband/hw/hns/hns_roce_main.c +1 -1
@@ -428,7 +428,7 @@ static const struct ib_device_ops hns_roce_dev_ops = { .destroy_ah = hns_roce_destroy_ah, .destroy_cq = hns_roce_destroy_cq, .disassociate_ucontext = hns_roce_disassociate_ucontext, - .fill_res_entry = hns_roce_fill_res_entry, + .fill_res_cq_entry = hns_roce_fill_res_cq_entry, .get_dma_mr = hns_roce_get_dma_mr, .get_link_layer = hns_roce_get_link_layer, .get_port_immutable = hns_roce_port_immutable,
drivers/infiniband/hw/hns/hns_roce_restrack.c +2 -12
@@ -76,10 +76,9 @@ static int hns_roce_fill_cq(struct sk_buff *msg,return -EMSGSIZE ; } -static int hns_roce_fill_res_cq_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int hns_roce_fill_res_cq_entry (struct sk_buff *msg, +struct ib_cq *ib_cq) { - struct ib_cq *ib_cq = container_of(res, struct ib_cq, res);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;
@@ -119,12 +118,3 @@ static int hns_roce_fill_res_cq_entry(struct sk_buff *msg,kfree (context);return ret; } - -int hns_roce_fill_res_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) -{ -if (res->type ==RDMA_RESTRACK_CQ ) -return hns_roce_fill_res_cq_entry (msg, res); - -return 0 ; -}
include/rdma/ib_verbs.h +1 -0
@@ -2599,6 +2599,7 @@ struct ib_device_ops {int (*fill_res_entry)(struct sk_buff *msg,struct rdma_restrack_entry *entry);int (*fill_res_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr); +int (*fill_res_cq_entry)(struct sk_buff *msg,struct ib_cq *ibcq);/* Device lifecycle callbacks */ /*
Signature · 1 line
2.26.2
PATCH 6/11 RDMA: Add dedicated QP resource tracker function
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
In order to avoid double multiplexing of the resource when it's QP, add a dedicated callback function.
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/nldev.c | 5 ++--- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 1 + drivers/infiniband/hw/cxgb4/restrack.c | 5 +---- include/rdma/ib_verbs.h | 1 + 5 files changed, 6 insertions(+), 7 deletions(-)
drivers/infiniband/core/device.c +1 -0
@@ -2620,6 +2620,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, fill_res_cq_entry);SET_DEVICE_OP (dev_ops, fill_res_entry);SET_DEVICE_OP (dev_ops, fill_res_mr_entry); +SET_DEVICE_OP (dev_ops, fill_res_qp_entry);SET_DEVICE_OP (dev_ops, fill_stat_mr_entry);SET_DEVICE_OP (dev_ops, get_dev_fw_str);SET_DEVICE_OP (dev_ops, get_dma_mr);
drivers/infiniband/core/nldev.c +2 -3
@@ -507,9 +507,8 @@ static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,if (fill_res_name_pid (msg, res)) goto err; -if (fill_res_entry (dev, msg, res)) - goto err; - +if (dev->ops.fill_res_qp_entry) +return dev->ops.fill_res_qp_entry (msg, qp);return 0 ; err:return -EMSGSIZE ;
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -0
@@ -1057,6 +1057,7 @@ typedef int c4iw_restrack_func(struct sk_buff *msg, struct rdma_restrack_entry *res);int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr);int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq); +int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp);extern c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ];#endif
drivers/infiniband/hw/cxgb4/restrack.c +1 -4
@@ -134,10 +134,8 @@ static int fill_swsqes(struct sk_buff *msg, struct t4_sq *sq,return -EMSGSIZE ; } -static int fill_res_qp_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp) { - struct ib_qp *ibqp = container_of(res, struct ib_qp, res);struct t4_swsqe *fsp =NULL , *lsp =NULL ;struct c4iw_qp *qhp =to_c4iw_qp (ibqp);u16 first_sq_idx =0 , last_sq_idx =0 ;
@@ -490,6 +488,5 @@ int c4iw_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ibmr) }c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ] = { - [RDMA_RESTRACK_QP ] = fill_res_qp_entry, [RDMA_RESTRACK_CM_ID ] = fill_res_ep_entry, };
include/rdma/ib_verbs.h +1 -0
@@ -2600,6 +2600,7 @@ struct ib_device_ops { struct rdma_restrack_entry *entry);int (*fill_res_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr);int (*fill_res_cq_entry)(struct sk_buff *msg,struct ib_cq *ibcq); +int (*fill_res_qp_entry)(struct sk_buff *msg,struct ib_qp *ibqp);/* Device lifecycle callbacks */ /*
Signature · 1 line
2.26.2
PATCH 7/11 RDMA: Add dedicated CM_ID resource tracker function
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
In order to avoid double multiplexing of the resource when it's cm id, add a dedicated callback function.
In addition remove fill_res_entry which is not used anymore.
--- drivers/infiniband/core/device.c | 2 +- drivers/infiniband/core/nldev.c | 13 ++----------- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 4 +--- drivers/infiniband/hw/cxgb4/provider.c | 9 +-------- drivers/infiniband/hw/cxgb4/restrack.c | 9 ++------- include/rdma/ib_verbs.h | 4 ++-- 6 files changed, 9 insertions(+), 32 deletions(-)
drivers/infiniband/core/device.c +1 -1
@@ -2617,8 +2617,8 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, drain_rq);SET_DEVICE_OP (dev_ops, drain_sq);SET_DEVICE_OP (dev_ops, enable_driver); +SET_DEVICE_OP (dev_ops, fill_res_cm_id_entry);SET_DEVICE_OP (dev_ops, fill_res_cq_entry); -SET_DEVICE_OP (dev_ops, fill_res_entry);SET_DEVICE_OP (dev_ops, fill_res_mr_entry);SET_DEVICE_OP (dev_ops, fill_res_qp_entry);SET_DEVICE_OP (dev_ops, fill_stat_mr_entry);
drivers/infiniband/core/nldev.c +2 -11
@@ -446,14 +446,6 @@ static int fill_res_name_pid(struct sk_buff *msg,return err ? -EMSGSIZE :0 ; } -static bool fill_res_entry (struct ib_device *dev,struct sk_buff *msg, -struct rdma_restrack_entry *res) -{ -if (!dev->ops.fill_res_entry) -return false; -return dev->ops.fill_res_entry (msg, res); -} -static int fill_res_qp_entry (struct sk_buff *msg,bool has_cap_net_admin,struct rdma_restrack_entry *res,uint32_t port) {
@@ -559,9 +551,8 @@ static int fill_res_cm_id_entry(struct sk_buff *msg, bool has_cap_net_admin,if (fill_res_name_pid (msg, res)) goto err; -if (fill_res_entry (dev, msg, res)) - goto err; - +if (dev->ops.fill_res_cm_id_entry) +return dev->ops.fill_res_cm_id_entry (msg, cm_id);return 0 ; err:return -EMSGSIZE ;
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -3
@@ -1053,11 +1053,9 @@ int c4iw_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, const struct ib_recv_wr **bad_wr);struct c4iw_wr_wait *c4iw_alloc_wr_wait (gfp_t gfp); -typedef int c4iw_restrack_func (struct sk_buff *msg, -struct rdma_restrack_entry *res);int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr);int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq);int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp); -extern c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ]; +int c4iw_fill_res_cm_id_entry (struct sk_buff *msg,struct rdma_cm_id *cm_id);#endif
drivers/infiniband/hw/cxgb4/provider.c +1 -8
@@ -458,13 +458,6 @@ static void get_dev_fw_str(struct ib_device *dev, char *str) FW_HDR_FW_VER_BUILD_G(c4iw_dev->rdev.lldi.fw_vers)); } -static int fill_res_entry (struct sk_buff *msg,struct rdma_restrack_entry *res) -{ -return (res->type <ARRAY_SIZE (c4iw_restrack_funcs) && - c4iw_restrack_funcs[res->type]) ? - c4iw_restrack_funcs[res->type](msg, res) :0 ; -} -static const struct ib_device_ops c4iw_dev_ops = { .owner =THIS_MODULE , .driver_id =RDMA_DRIVER_CXGB4 ,
@@ -486,7 +479,7 @@ static const struct ib_device_ops c4iw_dev_ops = { .destroy_qp = c4iw_destroy_qp, .destroy_srq = c4iw_destroy_srq, .fill_res_cq_entry = c4iw_fill_res_cq_entry, - .fill_res_entry = fill_res_entry, + .fill_res_cm_id_entry = c4iw_fill_res_cm_id_entry, .fill_res_mr_entry = c4iw_fill_res_mr_entry, .get_dev_fw_str = get_dev_fw_str, .get_dma_mr = c4iw_get_dma_mr,
drivers/infiniband/hw/cxgb4/restrack.c +2 -7
@@ -193,10 +193,9 @@ union union_ep {struct c4iw_ep ep; }; -static int fill_res_ep_entry (struct sk_buff *msg, -struct rdma_restrack_entry *res) +int c4iw_fill_res_cm_id_entry (struct sk_buff *msg, +struct rdma_cm_id *cm_id) { -struct rdma_cm_id *cm_id =rdma_res_to_id (res);struct nlattr *table_attr;struct c4iw_ep_common *epcp;struct c4iw_listen_ep *listen_ep =NULL ;
@@ -486,7 +485,3 @@ int c4iw_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ibmr) err:return -EMSGSIZE ; } - -c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX ] = { - [RDMA_RESTRACK_CM_ID ] = fill_res_ep_entry, -};
include/rdma/ib_verbs.h +2 -2
@@ -75,6 +75,7 @@ struct ib_umem_odp;struct ib_uqp_object ;struct ib_usrq_object ;struct ib_uwq_object ; +struct rdma_cm_id ;extern struct workqueue_struct *ib_wq;extern struct workqueue_struct *ib_comp_wq;
@@ -2596,11 +2597,10 @@ struct ib_device_ops {/** * Allows rdma drivers to add their own restrack attributes. */ -int (*fill_res_entry)(struct sk_buff *msg, -struct rdma_restrack_entry *entry);int (*fill_res_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr);int (*fill_res_cq_entry)(struct sk_buff *msg,struct ib_cq *ibcq);int (*fill_res_qp_entry)(struct sk_buff *msg,struct ib_qp *ibqp); +int (*fill_res_cm_id_entry)(struct sk_buff *msg,struct rdma_cm_id *id);/* Device lifecycle callbacks */ /*
Signature · 1 line
2.26.2
PATCH 8/11 RDMA: Add support to dump resource tracker in RAW format
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
Add support to get resource dump in raw format. It enable vendors to return the entire QP/CQ/MR context without a need from the vendor to set each field separately.
When user request to get the data in RAW, we return as key value the generic fields which not require to query the vendor and in addition we return the rest of the data as binary.
Example:
$rdma res show mr dev mlx5_1 mrn 2 -r -j [{"ifindex":7,"ifname":"mlx5_1","mrn":2,"mrlen":4096,"pdn":5, pid":24336, "comm":"ibv_rc_pingpong", "data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,0,216,...]}]
--- drivers/infiniband/core/nldev.c | 86 ++++++++++++------- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 6 +- drivers/infiniband/hw/cxgb4/restrack.c | 15 +++- drivers/infiniband/hw/hns/hns_roce_device.h | 2 +- drivers/infiniband/hw/hns/hns_roce_restrack.c | 5 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 +- drivers/infiniband/hw/mlx5/restrack.c | 5 +- include/rdma/ib_verbs.h | 9 +- include/uapi/rdma/rdma_netlink.h | 2 + 9 files changed, 91 insertions(+), 42 deletions(-)
drivers/infiniband/core/nldev.c +57 -29
@@ -44,7 +44,7 @@#include "uverbs.h" typedef int (*res_fill_func_t )(struct sk_buff *,bool , -struct rdma_restrack_entry *,uint32_t ); +struct rdma_restrack_entry *,uint32_t ,bool );/* * Sort array elements by the netlink attribute name
@@ -114,6 +114,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = { [RDMA_NLDEV_ATTR_RES_PS] = { .type = NLA_U32 }, [RDMA_NLDEV_ATTR_RES_QP] = { .type = NLA_NESTED }, [RDMA_NLDEV_ATTR_RES_QP_ENTRY] = { .type = NLA_NESTED }, + [RDMA_NLDEV_ATTR_RES_RAW] = { .type = NLA_BINARY }, [RDMA_NLDEV_ATTR_RES_RKEY] = { .type = NLA_U32 }, [RDMA_NLDEV_ATTR_RES_RQPN] = { .type = NLA_U32 }, [RDMA_NLDEV_ATTR_RES_RQ_PSN] = { .type = NLA_U32 },
@@ -446,11 +447,11 @@ static int fill_res_name_pid(struct sk_buff *msg,return err ? -EMSGSIZE :0 ; } -static int fill_res_qp_entry (struct sk_buff *msg,bool has_cap_net_admin, -struct rdma_restrack_entry *res,uint32_t port) +static int fill_res_qp_entry_query (struct sk_buff *msg, +struct rdma_restrack_entry *res, +struct ib_device *dev, +struct ib_qp *qp) { - struct ib_qp *qp = container_of(res, struct ib_qp, res); -struct ib_device *dev = qp->device;struct ib_qp_init_attr qp_init_attr;struct ib_qp_attr qp_attr;int ret;
@@ -459,16 +460,6 @@ static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,if (ret)return ret; -if (port && port != qp_attr.port_num) -return -EAGAIN ; - -/* In create_qp() port is not set yet */ -if (qp_attr.port_num && -nla_put_u32 (msg,RDMA_NLDEV_ATTR_PORT_INDEX , qp_attr.port_num)) - goto err; - -if (nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_LQPN , qp->qp_num)) - goto err;if (qp->qp_type ==IB_QPT_RC || qp->qp_type ==IB_QPT_UC ) {if (nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_RQPN , qp_attr.dest_qp_num))
@@ -492,22 +483,49 @@ static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,if (nla_put_u8 (msg,RDMA_NLDEV_ATTR_RES_STATE , qp_attr.qp_state)) goto err; +if (dev->ops.fill_res_qp_entry) +return dev->ops.fill_res_qp_entry (msg, qp, false); + +err:return -EMSGSIZE ; +} + +static int fill_res_qp_entry (struct sk_buff *msg,bool has_cap_net_admin, +struct rdma_restrack_entry *res,uint32_t port, +bool raw) +{ + struct ib_qp *qp = container_of(res, struct ib_qp, res); +struct ib_device *dev = qp->device; +int ret; + +if (port && port != qp->port) +return -EAGAIN ; + +/* In create_qp() port is not set yet */ +if (qp->port &&nla_put_u32 (msg,RDMA_NLDEV_ATTR_PORT_INDEX , qp->port)) +return -EINVAL ; + + ret =nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_LQPN , qp->qp_num); +if (ret) + goto err; +if (!rdma_is_kernel_res (res) &&nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_PDN , qp->pd->res.id)) goto err; -if (fill_res_name_pid (msg, res)) + ret =fill_res_name_pid (msg, res); +if (ret) goto err; -if (dev->ops.fill_res_qp_entry) -return dev->ops.fill_res_qp_entry (msg, qp); -return 0 ; +if (raw && dev->ops.fill_res_qp_entry) +return dev->ops.fill_res_qp_entry (msg, qp, raw); +return fill_res_qp_entry_query (msg, res, dev, qp); err:return -EMSGSIZE ; }static int fill_res_cm_id_entry (struct sk_buff *msg,bool has_cap_net_admin, -struct rdma_restrack_entry *res,uint32_t port) +struct rdma_restrack_entry *res,uint32_t port, +bool raw) {struct rdma_id_private *id_priv = container_of(res, struct rdma_id_private, res);
@@ -559,7 +577,8 @@ err: return -EMSGSIZE; }static int fill_res_cq_entry (struct sk_buff *msg,bool has_cap_net_admin, -struct rdma_restrack_entry *res,uint32_t port) +struct rdma_restrack_entry *res,uint32_t port, +bool raw) { struct ib_cq *cq = container_of(res, struct ib_cq, res);struct ib_device *dev = cq->device;
@@ -589,14 +608,15 @@ static int fill_res_cq_entry(struct sk_buff *msg, bool has_cap_net_admin, goto err;if (dev->ops.fill_res_cq_entry) -return dev->ops.fill_res_cq_entry (msg, cq); +return dev->ops.fill_res_cq_entry (msg, cq, raw);return 0 ; err:return -EMSGSIZE ; }static int fill_res_mr_entry (struct sk_buff *msg,bool has_cap_net_admin, -struct rdma_restrack_entry *res,uint32_t port) +struct rdma_restrack_entry *res,uint32_t port, +bool raw) { struct ib_mr *mr = container_of(res, struct ib_mr, res);struct ib_device *dev = mr->pd->device;
@@ -623,14 +643,15 @@ static int fill_res_mr_entry(struct sk_buff *msg, bool has_cap_net_admin, goto err;if (dev->ops.fill_res_mr_entry) -return dev->ops.fill_res_mr_entry (msg, mr); +return dev->ops.fill_res_mr_entry (msg, mr, raw);return 0 ; err:return -EMSGSIZE ; }static int fill_res_pd_entry (struct sk_buff *msg,bool has_cap_net_admin, -struct rdma_restrack_entry *res,uint32_t port) +struct rdma_restrack_entry *res,uint32_t port, +bool raw) { struct ib_pd *pd = container_of(res, struct ib_pd, res);
@@ -758,7 +779,8 @@ int rdma_nl_stat_hwcounter_entry(struct sk_buff *msg, const char *name,EXPORT_SYMBOL (rdma_nl_stat_hwcounter_entry);static int fill_stat_mr_entry (struct sk_buff *msg,bool has_cap_net_admin, -struct rdma_restrack_entry *res,uint32_t port) +struct rdma_restrack_entry *res,uint32_t port, +bool raw) { struct ib_mr *mr = container_of(res, struct ib_mr, res);struct ib_device *dev = mr->pd->device;
@@ -799,7 +821,7 @@ static int fill_stat_counter_hwcounters(struct sk_buff *msg,static int fill_res_counter_entry (struct sk_buff *msg,bool has_cap_net_admin,struct rdma_restrack_entry *res, -uint32_t port) +uint32_t port,bool raw) {struct rdma_counter *counter = container_of(res, struct rdma_counter, res);
@@ -1213,6 +1235,7 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,u32 index, id, port =0 ;bool has_cap_net_admin;struct sk_buff *msg; +bool raw = false;int ret; ret = nlmsg_parse_deprecated(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
@@ -1220,6 +1243,11 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX ] || !fe->id || !tb[fe->id])return -EINVAL ; +if (tb[RDMA_NLDEV_ATTR_RES_RAW ]) + raw =nla_get_u8 (tb[RDMA_NLDEV_ATTR_RES_RAW ]); +if (raw && res_type ==RDMA_RESTRACK_CM_ID ) +return -EOPNOTSUPP ; + index =nla_get_u32 (tb[RDMA_NLDEV_ATTR_DEV_INDEX ]); device =ib_device_get_by_index (sock_net (skb->sk), index);if (!device)
@@ -1263,7 +1291,7 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh, has_cap_net_admin =netlink_capable (skb,CAP_NET_ADMIN ); - ret =fill_func (msg, has_cap_net_admin, res, port); + ret =fill_func (msg, has_cap_net_admin, res, port, raw);if (ret) goto err_free;
@@ -1369,7 +1397,7 @@ static int res_get_common_dumpit(struct sk_buff *skb, goto msg_full; } - ret =fill_func (skb, has_cap_net_admin, res, port); + ret =fill_func (skb, has_cap_net_admin, res, port, false);rdma_restrack_put (res);
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +3 -3
@@ -1053,9 +1053,9 @@ int c4iw_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, const struct ib_recv_wr **bad_wr);struct c4iw_wr_wait *c4iw_alloc_wr_wait (gfp_t gfp); -int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr); -int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq); -int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp); +int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr,bool raw); +int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq,bool raw); +int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp,bool raw);int c4iw_fill_res_cm_id_entry (struct sk_buff *msg,struct rdma_cm_id *cm_id);#endif
drivers/infiniband/hw/cxgb4/restrack.c +12 -3
@@ -134,7 +134,7 @@ static int fill_swsqes(struct sk_buff *msg, struct t4_sq *sq,return -EMSGSIZE ; } -int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp) +int c4iw_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp,bool raw) {struct t4_swsqe *fsp =NULL , *lsp =NULL ;struct c4iw_qp *qhp =to_c4iw_qp (ibqp);
@@ -143,6 +143,9 @@ int c4iw_fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ibqp)struct nlattr *table_attr;struct t4_wq wq; +if (raw) +return -EOPNOTSUPP ; +/* User qp state is not available, so don't dump user qps */ if (qhp->ucontext)return 0 ;
@@ -369,7 +372,7 @@ static int fill_swcqes(struct sk_buff *msg, struct t4_cq *cq,return -EMSGSIZE ; } -int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq) +int c4iw_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq,bool raw) {struct c4iw_cq *chp =to_c4iw_cq (ibcq);struct nlattr *table_attr;
@@ -378,6 +381,9 @@ int c4iw_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ibcq)struct t4_cq cq;u16 idx; +if (raw) +return -EOPNOTSUPP ; +/* User cq state is not available, so don't dump user cqs */ if (ibcq->uobject)return 0 ;
@@ -428,7 +434,7 @@ int c4iw_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ibcq)return -EMSGSIZE ; } -int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr) +int c4iw_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ibmr,bool raw) {struct c4iw_mr *mhp =to_c4iw_mr (ibmr);struct c4iw_dev *dev = mhp->rhp;
@@ -437,6 +443,9 @@ int c4iw_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ibmr)struct fw_ri_tpte tpte;int ret; +if (raw) +return -EOPNOTSUPP ; +if (!stag)return 0 ;
drivers/infiniband/hw/hns/hns_roce_device.h +1 -1
@@ -1267,5 +1267,5 @@ int hns_roce_init(struct hns_roce_dev *hr_dev);void hns_roce_exit (struct hns_roce_dev *hr_dev);int hns_roce_fill_res_cq_entry (struct sk_buff *msg, -struct ib_cq *ib_cq); +struct ib_cq *ib_cq,bool raw);#endif /* _HNS_ROCE_DEVICE_H */
drivers/infiniband/hw/hns/hns_roce_restrack.c +4 -1
@@ -77,7 +77,7 @@ static int hns_roce_fill_cq(struct sk_buff *msg, }int hns_roce_fill_res_cq_entry (struct sk_buff *msg, -struct ib_cq *ib_cq) +struct ib_cq *ib_cq,bool raw) {struct hns_roce_dev *hr_dev =to_hr_dev (ib_cq->device);struct hns_roce_cq *hr_cq =to_hr_cq (ib_cq);
@@ -85,6 +85,9 @@ int hns_roce_fill_res_cq_entry(struct sk_buff *msg,struct nlattr *table_attr;int ret; +if (raw) +return -EOPNOTSUPP ; +if (!hr_dev->dfx->query_cqc_info)return -EINVAL ;
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -1
@@ -1383,7 +1383,8 @@ struct mlx5_core_dev *mlx5_ib_get_native_port_mdev(struct mlx5_ib_dev *dev, u8 *native_port_num);void mlx5_ib_put_native_port_mdev (struct mlx5_ib_dev *dev,u8 port_num); -int mlx5_ib_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr); +int mlx5_ib_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr, +bool raw);int mlx5_ib_fill_stat_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr);extern const struct uapi_definition mlx5_ib_devx_defs[];
drivers/infiniband/hw/mlx5/restrack.c +4 -1
@@ -41,11 +41,14 @@ int mlx5_ib_fill_stat_mr_entry(struct sk_buff *msg, }int mlx5_ib_fill_res_mr_entry (struct sk_buff *msg, -struct ib_mr *ibmr) +struct ib_mr *ibmr,bool raw) {struct mlx5_ib_mr *mr =to_mmr (ibmr);struct nlattr *table_attr; +if (raw) +return -EOPNOTSUPP ; +if (!(mr->access_flags &IB_ACCESS_ON_DEMAND ))return 0 ;
include/rdma/ib_verbs.h +6 -3
@@ -2597,9 +2597,12 @@ struct ib_device_ops {/** * Allows rdma drivers to add their own restrack attributes. */ -int (*fill_res_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr); -int (*fill_res_cq_entry)(struct sk_buff *msg,struct ib_cq *ibcq); -int (*fill_res_qp_entry)(struct sk_buff *msg,struct ib_qp *ibqp); +int (*fill_res_mr_entry)(struct sk_buff *msg,struct ib_mr *ibmr, +bool raw); +int (*fill_res_cq_entry)(struct sk_buff *msg,struct ib_cq *ibcq, +bool raw); +int (*fill_res_qp_entry)(struct sk_buff *msg,struct ib_qp *ibqp, +bool raw);int (*fill_res_cm_id_entry)(struct sk_buff *msg,struct rdma_cm_id *id);/* Device lifecycle callbacks */
include/uapi/rdma/rdma_netlink.h +2 -0
@@ -525,6 +525,8 @@ enum rdma_nldev_attr {*/ RDMA_NLDEV_ATTR_DEV_DIM ,/* u8 */ + RDMA_NLDEV_ATTR_RES_RAW, /* binary */ +/* * Always the end */
Signature · 1 line
2.26.2
PATCH 9/11 RDMA/mlx5: Add support to get QP resource in raw format
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
Add a generic function that use the resource dump mechanism to get the resource data.
This patch adds the support to QP.
--- drivers/infiniband/hw/mlx5/main.c | 1 + drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 + drivers/infiniband/hw/mlx5/restrack.c | 79 +++++++++++++++++++++++++++ 3 files changed, 82 insertions(+)
drivers/infiniband/hw/mlx5/main.c +1 -0
@@ -6609,6 +6609,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = { .drain_sq = mlx5_ib_drain_sq, .enable_driver = mlx5_ib_enable_driver, .fill_res_mr_entry = mlx5_ib_fill_res_mr_entry, + .fill_res_qp_entry = mlx5_ib_fill_res_qp_entry, .fill_stat_mr_entry = mlx5_ib_fill_stat_mr_entry, .get_dev_fw_str = get_dev_fw_str, .get_dma_mr = mlx5_ib_get_dma_mr,
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -0
@@ -1385,6 +1385,8 @@ void mlx5_ib_put_native_port_mdev(struct mlx5_ib_dev *dev, u8 port_num);int mlx5_ib_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr,bool raw); +int mlx5_ib_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp, +bool raw);int mlx5_ib_fill_stat_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr);extern const struct uapi_definition mlx5_ib_devx_defs[];
drivers/infiniband/hw/mlx5/restrack.c +79 -0
92 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 10/11 RDMA/mlx5: Add support to get CQ resource in RAW format
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
Add support to get CQ resource dump in RAW format.
--- drivers/infiniband/hw/mlx5/main.c | 1 + drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++ drivers/infiniband/hw/mlx5/restrack.c | 10 ++++++++++ 3 files changed, 13 insertions(+)
drivers/infiniband/hw/mlx5/main.c +1 -0
@@ -6610,6 +6610,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = { .enable_driver = mlx5_ib_enable_driver, .fill_res_mr_entry = mlx5_ib_fill_res_mr_entry, .fill_res_qp_entry = mlx5_ib_fill_res_qp_entry, + .fill_res_cq_entry = mlx5_ib_fill_res_cq_entry, .fill_stat_mr_entry = mlx5_ib_fill_stat_mr_entry, .get_dev_fw_str = get_dev_fw_str, .get_dma_mr = mlx5_ib_get_dma_mr,
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -0
@@ -1387,6 +1387,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ib_mr, bool raw);int mlx5_ib_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp,bool raw); +int mlx5_ib_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq, +bool raw);int mlx5_ib_fill_stat_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr);extern const struct uapi_definition mlx5_ib_devx_defs[];
drivers/infiniband/hw/mlx5/restrack.c +10 -0
@@ -141,6 +141,16 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,return -EMSGSIZE ; } +int mlx5_ib_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ibcq,bool raw) +{ +struct mlx5_ib_dev *dev =to_mdev (ibcq->device); +struct mlx5_ib_cq *cq =to_mcq (ibcq); + +if (!raw) +return 0 ; +return fill_res_raw (msg, dev,MLX5_SGMT_TYPE_PRM_QUERY_CQ , cq->mcq.cqn); +} +int mlx5_ib_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ibqp,bool raw) {struct mlx5_ib_dev *dev =to_mdev (ibqp->device);
Signature · 1 line
2.26.2
PATCH 11/11 RDMA/mlx5: Add support to get MR resource in RAW format
In reply to Leon RomanovskyFrom: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
--- drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/restrack.c +2 -1
@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));if (!(mr->access_flags &IB_ACCESS_ON_DEMAND ))return 0 ;
Signature · 1 line
2.26.2
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.c
drivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));
None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
To me this looks like they should should all be a new op 'fill_raw_res_mr_entry' and drop the 'bool'
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 25 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'
I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.
I can agree with you that "bool" is better to be named as "flags", but not sure that it should be done now.
Thanks
Quoted 2 lines
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 26 lines · Leon Romanovsky
Quoted 25 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 6 lines
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.
If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 30 lines · Jason Gunthorpe
Quoted 29 lines · Leon Romanovsky
Quoted 27 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'
Quoted 6 lines
Quoted 3 lines
I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
Thanks
Quoted 2 lines
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 31 lines · Leon Romanovsky
Quoted 30 lines · Jason Gunthorpe
Quoted 29 lines · Leon Romanovsky
Quoted 27 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
I'm starting to think it is also a mistake to have the same netlink op and trigger it by an inbound attribute. Are there other examples of that in netlink? Feels wrong
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 36 lines · Jason Gunthorpe
Quoted 35 lines · Leon Romanovsky
Quoted 34 lines · Jason Gunthorpe
Quoted 32 lines · Leon Romanovsky
Quoted 25 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
I'm starting to think it is also a mistake to have the same netlink op and trigger it by an inbound attribute. Are there other examples of that in netlink? Feels wrong
I have no idea, don't see it in devlink.c
Quoted 2 lines
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 34 lines · Leon Romanovsky
Quoted 33 lines · Jason Gunthorpe
Quoted 32 lines · Leon Romanovsky
Quoted 31 lines · Jason Gunthorpe
Quoted 30 lines · Leon Romanovsky
Quoted 24 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
I'm starting to think it is also a mistake to have the same netlink op and trigger it by an inbound attribute. Are there other examples of that in netlink? Feels wrong
I have no idea, don't see it in
devlink.c
Jason, do you mean trigger the raw by inbound attribute? I don't see a reason why not do that. Netlink attributes used for input and output. What regarding the driver ops, let's converge with the decision, I am okay with the both approaches.
Quoted 2 lines
Quoted 2 lines
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 39 lines · Maor Gottlieb
Quoted 37 lines · Leon Romanovsky
Quoted 36 lines · Jason Gunthorpe
Quoted 35 lines · Leon Romanovsky
Quoted 26 lines · Jason Gunthorpe
Quoted 25 lines · Leon Romanovsky
Quoted 24 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
I'm starting to think it is also a mistake to have the same netlink op and trigger it by an inbound attribute. Are there other examples of that in netlink? Feels wrong
I have no idea, don't see it in
devlink.cJason, do you mean trigger the raw by inbound attribute? I don't see a reason why not do that. Netlink attributes used for input and output.
What examples do you have where the input attribute completely changes the output format?
Jason
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 42 lines · Jason Gunthorpe
Quoted 41 lines · Maor Gottlieb
Quoted 40 lines · Leon Romanovsky
Quoted 39 lines · Jason Gunthorpe
Quoted 27 lines · Leon Romanovsky
Quoted 26 lines · Jason Gunthorpe
Quoted 25 lines · Leon Romanovsky
Quoted 24 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
I'm starting to think it is also a mistake to have the same netlink op and trigger it by an inbound attribute. Are there other examples of that in netlink? Feels wrong
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
I have no idea, don't see it in
devlink.cJason, do you mean trigger the raw by inbound attribute? I don't see a reason why not do that. Netlink attributes used for input and output.
What examples do you have where the input attribute completely changes the output format?
Jason
I don't have. Anyway I am planning to send v2 with new netlink ops.
Re: [PATCH rdma-next v1 11/11] RDMA/mlx5: Add support to get MR resource in RAW format
Quoted 48 lines · Maor Gottlieb
Quoted 46 lines · Jason Gunthorpe
Quoted 45 lines · Maor Gottlieb
Quoted 34 lines · Leon Romanovsky
Quoted 33 lines · Jason Gunthorpe
Quoted 32 lines · Leon Romanovsky
Quoted 31 lines · Jason Gunthorpe
Quoted 30 lines · Leon Romanovsky
Quoted 24 lines · Jason Gunthorpe
Quoted 13 lines · Leon Romanovsky
From: Maor Gottlieb <[email protected]>
Add support to get MR (mkey) resource dump in RAW format.
Signed-off-by Maor Gottlieb <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>drivers/infiniband/hw/mlx5/restrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/restrack.c +1
-0+++ b/drivers/infiniband/hw/mlx5/restrack.cdrivers/infiniband/hw/mlx5/restrack.c int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg, · line 120
Quoted 6 lines
drivers/infiniband/hw/mlx5/restrack.c +2
-1@@ -116,7 +116,8 @@ int mlx5_ib_fill_res_mr_entry(struct sk_buff *msg,struct nlattr *table_attr;if (raw) -return -EOPNOTSUPP ; +return fill_res_raw (msg, mr->dev,MLX5_SGMT_TYPE_PRM_QUERY_MKEY , +mlx5_mkey_to_idx (mr->mmkey.key));None of the raw functions actually share any code with the non raw part, why are the in the same function? In fact all the implemenations just call some other function for raw.
Quoted 2 lines
To me this looks like they should should all be a new op '
fill_raw_res_mr_entry' and drop the 'bool'I don't think that this is right approach, we already created ops per-objects
o remove API multiplexing. Extra de-duplication will create too much ops without any real benefit.Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
If there is no code sharing then they should not be in the same function at all. More ops is not really a problem.
Logically they are the same, user asks to get object property, driver returns.
I'm starting to think it is also a mistake to have the same netlink op and trigger it by an inbound attribute. Are there other examples of that in netlink? Feels wrong
I have no idea, don't see it in
devlink.cJason, do you mean trigger the raw by inbound attribute? I don't see a reason why not do that. Netlink attributes used for input and output.
Quoted 6 lines
Quoted 4 lines
What examples do you have where the input attribute completely changes the output format?
Jason
I don't have. Anyway I am planning to send v2 with new netlink ops.
Well, I think you need to look at the netlink interface side too.
Jason