mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
RDMA/mlx5: Use UMEM attribute for QP doorbell record
Add an optional mlx5 driver-namespace UMEM attribute on QP create so userspace can supply the doorbell record umem explicitly, symmetric to the CQ side. Resolve it inside mlx5_ib_db_map_user() and use it as a private DBR page when present; otherwise take the existing UHW share-or-pin path that preserves per-page DBR sharing across CQ/QP/SRQ in the same process. Add mlx5's first UVERBS_OBJECT_QP UAPI definition chain to attach the new attr. Link: https://patch.msgid.link/r/20260529134312.2836341-17-jiri@resnulli.us Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
committed by
Jason Gunthorpe
parent
d6ab1d2439
commit
93ce776a5b
@@ -4456,6 +4456,7 @@ static const struct uapi_definition mlx5_ib_defs[] = {
|
||||
UAPI_DEF_CHAIN(mlx5_ib_std_types_defs),
|
||||
UAPI_DEF_CHAIN(mlx5_ib_dm_defs),
|
||||
UAPI_DEF_CHAIN(mlx5_ib_create_cq_defs),
|
||||
UAPI_DEF_CHAIN(mlx5_ib_create_qp_defs),
|
||||
|
||||
UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_DEVICE, &mlx5_ib_query_context),
|
||||
UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_MR, &mlx5_ib_reg_dmabuf_mr),
|
||||
|
||||
@@ -1511,6 +1511,7 @@ 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[];
|
||||
extern const struct uapi_definition mlx5_ib_create_cq_defs[];
|
||||
extern const struct uapi_definition mlx5_ib_create_qp_defs[];
|
||||
|
||||
static inline int is_qp1(enum ib_qp_type qp_type)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
#include "qp.h"
|
||||
#include "wr.h"
|
||||
|
||||
#define UVERBS_MODULE_NAME mlx5_ib
|
||||
#include <rdma/uverbs_named_ioctl.h>
|
||||
|
||||
enum {
|
||||
MLX5_IB_ACK_REQ_FREQ = 8,
|
||||
};
|
||||
@@ -1053,7 +1056,9 @@ static int _create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
|
||||
resp->bfreg_index = MLX5_IB_INVALID_BFREG;
|
||||
qp->bfregn = bfregn;
|
||||
|
||||
err = mlx5_ib_db_map_user(context, NULL, 0, ucmd->db_addr, &qp->db);
|
||||
err = mlx5_ib_db_map_user(context, attrs,
|
||||
MLX5_IB_ATTR_CREATE_QP_DBR_BUF_UMEM,
|
||||
ucmd->db_addr, &qp->db);
|
||||
if (err) {
|
||||
mlx5_ib_dbg(dev, "map failed\n");
|
||||
goto err_free;
|
||||
@@ -5877,3 +5882,15 @@ void mlx5_ib_qp_event_cleanup(void)
|
||||
{
|
||||
destroy_workqueue(mlx5_ib_qp_event_wq);
|
||||
}
|
||||
|
||||
ADD_UVERBS_ATTRIBUTES_SIMPLE(
|
||||
mlx5_ib_qp_create,
|
||||
UVERBS_OBJECT_QP,
|
||||
UVERBS_METHOD_QP_CREATE,
|
||||
UVERBS_ATTR_UMEM(MLX5_IB_ATTR_CREATE_QP_DBR_BUF_UMEM,
|
||||
UA_OPTIONAL));
|
||||
|
||||
const struct uapi_definition mlx5_ib_create_qp_defs[] = {
|
||||
UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_QP, &mlx5_ib_qp_create),
|
||||
{},
|
||||
};
|
||||
|
||||
@@ -277,6 +277,10 @@ enum mlx5_ib_create_cq_attrs {
|
||||
MLX5_IB_ATTR_CREATE_CQ_DBR_BUF_UMEM,
|
||||
};
|
||||
|
||||
enum mlx5_ib_create_qp_attrs {
|
||||
MLX5_IB_ATTR_CREATE_QP_DBR_BUF_UMEM = UVERBS_ID_DRIVER_NS_WITH_UHW,
|
||||
};
|
||||
|
||||
enum mlx5_ib_reg_dmabuf_mr_attrs {
|
||||
MLX5_IB_ATTR_REG_DMABUF_MR_ACCESS_FLAGS = (1U << UVERBS_ID_NS_SHIFT),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user