mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 22:23:55 +00:00
RDMA/mlx5: Introduce UAPI to query PD attributes
Introduce UAPI to query PD attributes, this can be used to retrieve PD attributes by having the PD handle of the created one and owning the command FD for the ucontxet. Link: https://lore.kernel.org/r/20200630093916.332097-7-leon@kernel.org Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
0fb556b2b5
commit
05f71ef979
@ -23,4 +23,5 @@ mlx5_ib-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += odp.o
|
||||
mlx5_ib-$(CONFIG_MLX5_ESWITCH) += ib_rep.o
|
||||
mlx5_ib-$(CONFIG_INFINIBAND_USER_ACCESS) += devx.o \
|
||||
flow.o \
|
||||
qos.o
|
||||
qos.o \
|
||||
std_types.o
|
||||
|
@ -6401,6 +6401,7 @@ static const struct uapi_definition mlx5_ib_defs[] = {
|
||||
UAPI_DEF_CHAIN(mlx5_ib_devx_defs),
|
||||
UAPI_DEF_CHAIN(mlx5_ib_flow_defs),
|
||||
UAPI_DEF_CHAIN(mlx5_ib_qos_defs),
|
||||
UAPI_DEF_CHAIN(mlx5_ib_std_types_defs),
|
||||
|
||||
UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION,
|
||||
&mlx5_ib_flow_action),
|
||||
|
@ -1384,6 +1384,8 @@ 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[];
|
||||
extern const struct uapi_definition mlx5_ib_qos_defs[];
|
||||
extern const struct uapi_definition mlx5_ib_std_types_defs[];
|
||||
|
||||
|
||||
#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
|
||||
int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user);
|
||||
|
45
drivers/infiniband/hw/mlx5/std_types.c
Normal file
45
drivers/infiniband/hw/mlx5/std_types.c
Normal file
@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
|
||||
/*
|
||||
* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <rdma/uverbs_ioctl.h>
|
||||
#include <rdma/mlx5_user_ioctl_cmds.h>
|
||||
#include <rdma/mlx5_user_ioctl_verbs.h>
|
||||
#include <linux/mlx5/driver.h>
|
||||
#include "mlx5_ib.h"
|
||||
|
||||
#define UVERBS_MODULE_NAME mlx5_ib
|
||||
#include <rdma/uverbs_named_ioctl.h>
|
||||
|
||||
static int UVERBS_HANDLER(MLX5_IB_METHOD_PD_QUERY)(
|
||||
struct uverbs_attr_bundle *attrs)
|
||||
{
|
||||
struct ib_pd *pd =
|
||||
uverbs_attr_get_obj(attrs, MLX5_IB_ATTR_QUERY_PD_HANDLE);
|
||||
struct mlx5_ib_pd *mpd = to_mpd(pd);
|
||||
|
||||
return uverbs_copy_to(attrs, MLX5_IB_ATTR_QUERY_PD_RESP_PDN,
|
||||
&mpd->pdn, sizeof(mpd->pdn));
|
||||
}
|
||||
|
||||
DECLARE_UVERBS_NAMED_METHOD(
|
||||
MLX5_IB_METHOD_PD_QUERY,
|
||||
UVERBS_ATTR_IDR(MLX5_IB_ATTR_QUERY_PD_HANDLE,
|
||||
UVERBS_OBJECT_PD,
|
||||
UVERBS_ACCESS_READ,
|
||||
UA_MANDATORY),
|
||||
UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_QUERY_PD_RESP_PDN,
|
||||
UVERBS_ATTR_TYPE(u32),
|
||||
UA_MANDATORY));
|
||||
|
||||
ADD_UVERBS_METHODS(mlx5_ib_pd,
|
||||
UVERBS_OBJECT_PD,
|
||||
&UVERBS_METHOD(MLX5_IB_METHOD_PD_QUERY));
|
||||
|
||||
const struct uapi_definition mlx5_ib_std_types_defs[] = {
|
||||
UAPI_DEF_CHAIN_OBJ_TREE(
|
||||
UVERBS_OBJECT_PD,
|
||||
&mlx5_ib_pd),
|
||||
{},
|
||||
};
|
@ -290,4 +290,14 @@ enum mlx5_ib_create_flow_action_create_packet_reformat_attrs {
|
||||
MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_DATA_BUF,
|
||||
};
|
||||
|
||||
enum mlx5_ib_query_pd_attrs {
|
||||
MLX5_IB_ATTR_QUERY_PD_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
|
||||
MLX5_IB_ATTR_QUERY_PD_RESP_PDN,
|
||||
};
|
||||
|
||||
enum mlx5_ib_pd_methods {
|
||||
MLX5_IB_METHOD_PD_QUERY = (1U << UVERBS_ID_NS_SHIFT),
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user