Commit 9a119cd5 authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA/uverbs: Get rid of the & in method specifications

Hide it inside the macros. The & is confusing and interferes with using
this as a generic DSL in later patches.

Since this also touches almost every line, also run the specs through
clang-format (with 'BinPackParameters: false') to make the maintenance
easier.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent 6c61d2a5
...@@ -248,45 +248,50 @@ void create_udata(struct uverbs_attr_bundle *ctx, struct ib_udata *udata) ...@@ -248,45 +248,50 @@ void create_udata(struct uverbs_attr_bundle *ctx, struct ib_udata *udata)
} }
} }
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_COMP_CHANNEL, DECLARE_UVERBS_NAMED_OBJECT(
&UVERBS_TYPE_ALLOC_FD(sizeof(struct ib_uverbs_completion_event_file), UVERBS_OBJECT_COMP_CHANNEL,
uverbs_hot_unplug_completion_event_file, UVERBS_TYPE_ALLOC_FD(sizeof(struct ib_uverbs_completion_event_file),
&uverbs_event_fops, uverbs_hot_unplug_completion_event_file,
"[infinibandevent]", O_RDONLY)); &uverbs_event_fops,
"[infinibandevent]",
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_QP, O_RDONLY));
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uqp_object),
uverbs_free_qp)); DECLARE_UVERBS_NAMED_OBJECT(
UVERBS_OBJECT_QP,
UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uqp_object), uverbs_free_qp));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_MW, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_MW,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_mw)); UVERBS_TYPE_ALLOC_IDR(uverbs_free_mw));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_SRQ, DECLARE_UVERBS_NAMED_OBJECT(
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_usrq_object), UVERBS_OBJECT_SRQ,
uverbs_free_srq)); UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_usrq_object),
uverbs_free_srq));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_AH, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_AH,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_ah)); UVERBS_TYPE_ALLOC_IDR(uverbs_free_ah));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_FLOW, DECLARE_UVERBS_NAMED_OBJECT(
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uflow_object), UVERBS_OBJECT_FLOW,
uverbs_free_flow)); UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uflow_object),
uverbs_free_flow));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_WQ, DECLARE_UVERBS_NAMED_OBJECT(
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uwq_object), UVERBS_OBJECT_WQ,
uverbs_free_wq)); UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uwq_object), uverbs_free_wq));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_RWQ_IND_TBL, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_RWQ_IND_TBL,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_rwq_ind_tbl)); UVERBS_TYPE_ALLOC_IDR(uverbs_free_rwq_ind_tbl));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_XRCD, DECLARE_UVERBS_NAMED_OBJECT(
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uxrcd_object), UVERBS_OBJECT_XRCD,
uverbs_free_xrcd)); UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uxrcd_object),
uverbs_free_xrcd));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_PD, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_PD,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_pd)); UVERBS_TYPE_ALLOC_IDR(uverbs_free_pd));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_DEVICE, NULL); DECLARE_UVERBS_GLOBAL_METHODS(UVERBS_OBJECT_DEVICE);
DECLARE_UVERBS_OBJECT_TREE(uverbs_default_objects, DECLARE_UVERBS_OBJECT_TREE(uverbs_default_objects,
&UVERBS_OBJECT(UVERBS_OBJECT_DEVICE), &UVERBS_OBJECT(UVERBS_OBJECT_DEVICE),
......
...@@ -124,34 +124,36 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(struct ib_device *ib_dev, ...@@ -124,34 +124,36 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(struct ib_device *ib_dev,
return ret; return ret;
} }
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_COUNTERS_CREATE, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_COUNTERS_HANDLE, UVERBS_METHOD_COUNTERS_CREATE,
UVERBS_OBJECT_COUNTERS, UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
UVERBS_ACCESS_NEW, UVERBS_OBJECT_COUNTERS,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_ACCESS_NEW,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
DECLARE_UVERBS_NAMED_METHOD_DESTROY(UVERBS_METHOD_COUNTERS_DESTROY,
&UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, DECLARE_UVERBS_NAMED_METHOD_DESTROY(
UVERBS_OBJECT_COUNTERS, UVERBS_METHOD_COUNTERS_DESTROY,
UVERBS_ACCESS_DESTROY, UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_COUNTERS_HANDLE,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_OBJECT_COUNTERS,
UVERBS_ACCESS_DESTROY,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
#define MAX_COUNTERS_BUFF_SIZE USHRT_MAX #define MAX_COUNTERS_BUFF_SIZE USHRT_MAX
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_COUNTERS_READ, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_READ_COUNTERS_HANDLE, UVERBS_METHOD_COUNTERS_READ,
UVERBS_OBJECT_COUNTERS, UVERBS_ATTR_IDR(UVERBS_ATTR_READ_COUNTERS_HANDLE,
UVERBS_ACCESS_READ, UVERBS_OBJECT_COUNTERS,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ACCESS_READ,
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_READ_COUNTERS_BUFF, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_SIZE(0, MAX_COUNTERS_BUFF_SIZE), UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_READ_COUNTERS_BUFF,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_SIZE(0, MAX_COUNTERS_BUFF_SIZE),
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_READ_COUNTERS_FLAGS, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_TYPE(__u32), UVERBS_ATTR_PTR_IN(UVERBS_ATTR_READ_COUNTERS_FLAGS,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_ATTR_TYPE(__u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_COUNTERS, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_COUNTERS,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_counters), UVERBS_TYPE_ALLOC_IDR(uverbs_free_counters),
&UVERBS_METHOD(UVERBS_METHOD_COUNTERS_CREATE), &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_CREATE),
&UVERBS_METHOD(UVERBS_METHOD_COUNTERS_DESTROY), &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_DESTROY),
&UVERBS_METHOD(UVERBS_METHOD_COUNTERS_READ)); &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_READ));
...@@ -147,24 +147,28 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(struct ib_device *ib_dev, ...@@ -147,24 +147,28 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(struct ib_device *ib_dev,
return ret; return ret;
}; };
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_CQ_CREATE, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_CQ_HANDLE, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_CREATE,
UVERBS_ACCESS_NEW, UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_CQ_HANDLE,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_OBJECT_CQ,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_CQE, UVERBS_ACCESS_NEW,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_CQE,
UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_USER_HANDLE,
UVERBS_ATTR_TYPE(u64),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_FD(UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL,
UVERBS_OBJECT_COMP_CHANNEL,
UVERBS_ACCESS_READ),
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_COMP_VECTOR,
UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_FLAGS, UVERBS_ATTR_TYPE(u32)),
UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_CREATE_CQ_RESP_CQE,
UVERBS_ATTR_TYPE(u32), UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_USER_HANDLE,
UVERBS_ATTR_TYPE(u64),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
&UVERBS_ATTR_FD(UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL,
UVERBS_OBJECT_COMP_CHANNEL,
UVERBS_ACCESS_READ),
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_COMP_VECTOR, UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_CQ_FLAGS, UVERBS_ATTR_TYPE(u32)),
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_CREATE_CQ_RESP_CQE, UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_UHW()); UVERBS_ATTR_UHW());
static int UVERBS_HANDLER(UVERBS_METHOD_CQ_DESTROY)(struct ib_device *ib_dev, static int UVERBS_HANDLER(UVERBS_METHOD_CQ_DESTROY)(struct ib_device *ib_dev,
...@@ -196,20 +200,22 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_DESTROY)(struct ib_device *ib_dev, ...@@ -196,20 +200,22 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_DESTROY)(struct ib_device *ib_dev,
sizeof(resp)); sizeof(resp));
} }
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_CQ_DESTROY, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_CQ_HANDLE, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_DESTROY,
UVERBS_ACCESS_DESTROY, UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_CQ_HANDLE,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_OBJECT_CQ,
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_DESTROY_CQ_RESP, UVERBS_ACCESS_DESTROY,
UVERBS_ATTR_TYPE(struct ib_uverbs_destroy_cq_resp), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_DESTROY_CQ_RESP,
UVERBS_ATTR_TYPE(struct ib_uverbs_destroy_cq_resp),
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_CQ, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_ucq_object),
uverbs_free_cq), DECLARE_UVERBS_NAMED_OBJECT(
UVERBS_OBJECT_CQ,
UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_ucq_object), uverbs_free_cq),
#if IS_ENABLED(CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI) #if IS_ENABLED(CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI)
&UVERBS_METHOD(UVERBS_METHOD_CQ_CREATE), &UVERBS_METHOD(UVERBS_METHOD_CQ_CREATE),
&UVERBS_METHOD(UVERBS_METHOD_CQ_DESTROY) &UVERBS_METHOD(UVERBS_METHOD_CQ_DESTROY)
#endif #endif
); );
...@@ -85,24 +85,27 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(struct ib_device *ib_dev, ...@@ -85,24 +85,27 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(struct ib_device *ib_dev,
return 0; return 0;
} }
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_DM_ALLOC, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_ALLOC_DM_HANDLE, UVERBS_OBJECT_DM, UVERBS_METHOD_DM_ALLOC,
UVERBS_ACCESS_NEW, UVERBS_ATTR_IDR(UVERBS_ATTR_ALLOC_DM_HANDLE,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_OBJECT_DM,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_ALLOC_DM_LENGTH, UVERBS_ACCESS_NEW,
UVERBS_ATTR_TYPE(u64), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_PTR_IN(UVERBS_ATTR_ALLOC_DM_LENGTH,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_ALLOC_DM_ALIGNMENT, UVERBS_ATTR_TYPE(u64),
UVERBS_ATTR_TYPE(u32), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_ATTR_PTR_IN(UVERBS_ATTR_ALLOC_DM_ALIGNMENT,
UVERBS_ATTR_TYPE(u32),
DECLARE_UVERBS_NAMED_METHOD_DESTROY(UVERBS_METHOD_DM_FREE, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
&UVERBS_ATTR_IDR(UVERBS_ATTR_FREE_DM_HANDLE,
UVERBS_OBJECT_DM, DECLARE_UVERBS_NAMED_METHOD_DESTROY(
UVERBS_ACCESS_DESTROY, UVERBS_METHOD_DM_FREE,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_ATTR_IDR(UVERBS_ATTR_FREE_DM_HANDLE,
UVERBS_OBJECT_DM,
UVERBS_ACCESS_DESTROY,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_DM, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_DM,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_dm), UVERBS_TYPE_ALLOC_IDR(uverbs_free_dm),
&UVERBS_METHOD(UVERBS_METHOD_DM_ALLOC), &UVERBS_METHOD(UVERBS_METHOD_DM_ALLOC),
&UVERBS_METHOD(UVERBS_METHOD_DM_FREE)); &UVERBS_METHOD(UVERBS_METHOD_DM_FREE));
...@@ -385,49 +385,60 @@ static const struct uverbs_attr_spec uverbs_flow_action_esp_replay[] = { ...@@ -385,49 +385,60 @@ static const struct uverbs_attr_spec uverbs_flow_action_esp_replay[] = {
}, },
}; };
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE, UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
UVERBS_OBJECT_FLOW_ACTION, UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE,
UVERBS_ACCESS_NEW, UVERBS_OBJECT_FLOW_ACTION,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ACCESS_NEW,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp, hard_limit_pkts), UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY | UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp,
UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)), hard_limit_pkts),
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ESN, UVERBS_ATTR_TYPE(__u32)), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY |
&UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT, UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)),
uverbs_flow_action_esp_keymat, UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ESN,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_TYPE(__u32)),
&UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY, UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT,
uverbs_flow_action_esp_replay), uverbs_flow_action_esp_keymat,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp_encap, type))); UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY,
uverbs_flow_action_esp_replay),
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY, UVERBS_ATTR_PTR_IN(
&UVERBS_ATTR_IDR(UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE, UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP,
UVERBS_OBJECT_FLOW_ACTION, UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp_encap,
UVERBS_ACCESS_WRITE, type)));
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS, DECLARE_UVERBS_NAMED_METHOD(
UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp, hard_limit_pkts), UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)), UVERBS_ATTR_IDR(UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ESN, UVERBS_ATTR_TYPE(__u32)), UVERBS_OBJECT_FLOW_ACTION,
&UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT, UVERBS_ACCESS_WRITE,
uverbs_flow_action_esp_keymat), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
&UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY, UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
uverbs_flow_action_esp_replay), UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP, hard_limit_pkts),
UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp_encap, type))); UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)),
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ESN,
DECLARE_UVERBS_NAMED_METHOD_DESTROY(UVERBS_METHOD_FLOW_ACTION_DESTROY, UVERBS_ATTR_TYPE(__u32)),
&UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE, UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT,
UVERBS_OBJECT_FLOW_ACTION, uverbs_flow_action_esp_keymat),
UVERBS_ACCESS_DESTROY, UVERBS_ATTR_ENUM_IN(UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); uverbs_flow_action_esp_replay),
UVERBS_ATTR_PTR_IN(
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_FLOW_ACTION, UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_flow_action), UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp_encap,
&UVERBS_METHOD(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE), type)));
&UVERBS_METHOD(UVERBS_METHOD_FLOW_ACTION_DESTROY),
&UVERBS_METHOD(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY)); DECLARE_UVERBS_NAMED_METHOD_DESTROY(
UVERBS_METHOD_FLOW_ACTION_DESTROY,
UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE,
UVERBS_OBJECT_FLOW_ACTION,
UVERBS_ACCESS_DESTROY,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
DECLARE_UVERBS_NAMED_OBJECT(
UVERBS_OBJECT_FLOW_ACTION,
UVERBS_TYPE_ALLOC_IDR(uverbs_free_flow_action),
&UVERBS_METHOD(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE),
&UVERBS_METHOD(UVERBS_METHOD_FLOW_ACTION_DESTROY),
&UVERBS_METHOD(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY));
...@@ -115,32 +115,37 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_MR_REG)(struct ib_device *ib_dev, ...@@ -115,32 +115,37 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_MR_REG)(struct ib_device *ib_dev,
return ret; return ret;
} }
DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_DM_MR_REG, DECLARE_UVERBS_NAMED_METHOD(
&UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DM_MR_HANDLE, UVERBS_OBJECT_MR, UVERBS_METHOD_DM_MR_REG,
UVERBS_ACCESS_NEW, UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DM_MR_HANDLE,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_OBJECT_MR,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DM_MR_OFFSET, UVERBS_ACCESS_NEW,
UVERBS_ATTR_TYPE(u64), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DM_MR_OFFSET,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DM_MR_LENGTH, UVERBS_ATTR_TYPE(u64),
UVERBS_ATTR_TYPE(u64), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DM_MR_LENGTH,
&UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DM_MR_PD_HANDLE, UVERBS_OBJECT_PD, UVERBS_ATTR_TYPE(u64),
UVERBS_ACCESS_READ, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DM_MR_PD_HANDLE,
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DM_MR_ACCESS_FLAGS, UVERBS_OBJECT_PD,
UVERBS_ACCESS_READ,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DM_MR_ACCESS_FLAGS,
UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DM_MR_DM_HANDLE,
UVERBS_OBJECT_DM,
UVERBS_ACCESS_READ,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_REG_DM_MR_RESP_LKEY,
UVERBS_ATTR_TYPE(u32), UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
&UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DM_MR_DM_HANDLE, UVERBS_OBJECT_DM, UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_REG_DM_MR_RESP_RKEY,
UVERBS_ACCESS_READ, UVERBS_ATTR_TYPE(u32),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_REG_DM_MR_RESP_LKEY,
UVERBS_ATTR_TYPE(u32), DECLARE_UVERBS_NAMED_OBJECT(
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_OBJECT_MR,
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_REG_DM_MR_RESP_RKEY, UVERBS_TYPE_ALLOC_IDR(uverbs_free_mr),
UVERBS_ATTR_TYPE(u32), &UVERBS_METHOD(UVERBS_METHOD_DM_MR_REG));
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_MR,
&UVERBS_TYPE_ALLOC_IDR(uverbs_free_mr),
&UVERBS_METHOD(UVERBS_METHOD_DM_MR_REG));
This diff is collapsed.
...@@ -5315,20 +5315,24 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev) ...@@ -5315,20 +5315,24 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev)
mlx5_nic_vport_disable_roce(dev->mdev); mlx5_nic_vport_disable_roce(dev->mdev);
} }
ADD_UVERBS_ATTRIBUTES_SIMPLE(mlx5_ib_dm, UVERBS_OBJECT_DM, ADD_UVERBS_ATTRIBUTES_SIMPLE(
UVERBS_METHOD_DM_ALLOC, mlx5_ib_dm,
&UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET, UVERBS_OBJECT_DM,
UVERBS_ATTR_TYPE(u64), UVERBS_METHOD_DM_ALLOC,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)), UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET,
&UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX, UVERBS_ATTR_TYPE(u64),
UVERBS_ATTR_TYPE(u16), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX,
UVERBS_ATTR_TYPE(u16),
ADD_UVERBS_ATTRIBUTES_SIMPLE(mlx5_ib_flow_action, UVERBS_OBJECT_FLOW_ACTION, UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
&UVERBS_ATTR_PTR_IN(MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS, ADD_UVERBS_ATTRIBUTES_SIMPLE(
UVERBS_ATTR_TYPE(u64), mlx5_ib_flow_action,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); UVERBS_OBJECT_FLOW_ACTION,
UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
UVERBS_ATTR_PTR_IN(MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS,
UVERBS_ATTR_TYPE(u64),
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
#define NUM_TREES 3 #define NUM_TREES 3
static int populate_specs_root(struct mlx5_ib_dev *dev) static int populate_specs_root(struct mlx5_ib_dev *dev)
......
...@@ -212,7 +212,7 @@ struct uverbs_object_tree_def { ...@@ -212,7 +212,7 @@ struct uverbs_object_tree_def {
#define UA_FLAGS(_flags) .flags = _flags #define UA_FLAGS(_flags) .flags = _flags
#define UVERBS_ATTR_IDR(_attr_id, _idr_type, _access, ...) \ #define UVERBS_ATTR_IDR(_attr_id, _idr_type, _access, ...) \
((const struct uverbs_attr_def){ \ (&(const struct uverbs_attr_def){ \
.id = _attr_id, \ .id = _attr_id, \
.attr = { .type = UVERBS_ATTR_TYPE_IDR, \ .attr = { .type = UVERBS_ATTR_TYPE_IDR, \
.u.obj.obj_type = _idr_type, \ .u.obj.obj_type = _idr_type, \
...@@ -220,7 +220,7 @@ struct uverbs_object_tree_def { ...@@ -220,7 +220,7 @@ struct uverbs_object_tree_def {
__VA_ARGS__ } }) __VA_ARGS__ } })
#define UVERBS_ATTR_FD(_attr_id, _fd_type, _access, ...) \ #define UVERBS_ATTR_FD(_attr_id, _fd_type, _access, ...) \
((const struct uverbs_attr_def){ \ (&(const struct uverbs_attr_def){ \
.id = (_attr_id) + \ .id = (_attr_id) + \
BUILD_BUG_ON_ZERO((_access) != UVERBS_ACCESS_NEW && \ BUILD_BUG_ON_ZERO((_access) != UVERBS_ACCESS_NEW && \
(_access) != UVERBS_ACCESS_READ), \ (_access) != UVERBS_ACCESS_READ), \
...@@ -230,14 +230,14 @@ struct uverbs_object_tree_def { ...@@ -230,14 +230,14 @@ struct uverbs_object_tree_def {
__VA_ARGS__ } }) __VA_ARGS__ } })
#define UVERBS_ATTR_PTR_IN(_attr_id, _type, ...) \ #define UVERBS_ATTR_PTR_IN(_attr_id, _type, ...) \
((const struct uverbs_attr_def){ \ (&(const struct uverbs_attr_def){ \
.id = _attr_id, \ .id = _attr_id, \
.attr = { .type = UVERBS_ATTR_TYPE_PTR_IN, \ .attr = { .type = UVERBS_ATTR_TYPE_PTR_IN, \
_type, \ _type, \
__VA_ARGS__ } }) __VA_ARGS__ } })
#define UVERBS_ATTR_PTR_OUT(_attr_id, _type, ...) \ #define UVERBS_ATTR_PTR_OUT(_attr_id, _type, ...) \
((const struct uverbs_attr_def){ \ (&(const struct uverbs_attr_def){ \
.id = _attr_id, \ .id = _attr_id, \
.attr = { .type = UVERBS_ATTR_TYPE_PTR_OUT, \ .attr = { .type = UVERBS_ATTR_TYPE_PTR_OUT, \
_type, \ _type, \
...@@ -245,7 +245,7 @@ struct uverbs_object_tree_def { ...@@ -245,7 +245,7 @@ struct uverbs_object_tree_def {
/* _enum_arry should be a 'static const union uverbs_attr_spec[]' */ /* _enum_arry should be a 'static const union uverbs_attr_spec[]' */
#define UVERBS_ATTR_ENUM_IN(_attr_id, _enum_arr, ...) \ #define UVERBS_ATTR_ENUM_IN(_attr_id, _enum_arr, ...) \
((const struct uverbs_attr_def){ \ (&(const struct uverbs_attr_def){ \
.id = _attr_id, \ .id = _attr_id, \
.attr = { .type = UVERBS_ATTR_TYPE_ENUM_IN, \ .attr = { .type = UVERBS_ATTR_TYPE_ENUM_IN, \
.u2.enum_def.ids = _enum_arr, \ .u2.enum_def.ids = _enum_arr, \
...@@ -259,12 +259,12 @@ struct uverbs_object_tree_def { ...@@ -259,12 +259,12 @@ struct uverbs_object_tree_def {
* spec. * spec.
*/ */
#define UVERBS_ATTR_UHW() \ #define UVERBS_ATTR_UHW() \
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_UHW_IN, \ UVERBS_ATTR_PTR_IN(UVERBS_ATTR_UHW_IN, \
UVERBS_ATTR_SIZE(0, USHRT_MAX), \
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)), \
UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_UHW_OUT, \
UVERBS_ATTR_SIZE(0, USHRT_MAX), \ UVERBS_ATTR_SIZE(0, USHRT_MAX), \
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)), \ UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO))
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_UHW_OUT, \
UVERBS_ATTR_SIZE(0, USHRT_MAX), \
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO))
/* /*
* ======================================= * =======================================
......
...@@ -78,13 +78,24 @@ ...@@ -78,13 +78,24 @@
_object_id)[] = { __VA_ARGS__ }; \ _object_id)[] = { __VA_ARGS__ }; \
const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \ const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \
.id = _object_id, \ .id = _object_id, \
.type_attrs = _type_attrs, \ .type_attrs = &_type_attrs, \
.num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \ .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
.methods = &UVERBS_OBJECT_METHODS(_object_id) \ .methods = &UVERBS_OBJECT_METHODS(_object_id) \
} }
#define DECLARE_UVERBS_GLOBAL_METHODS(_name, ...) \ /*
DECLARE_UVERBS_NAMED_OBJECT(_name, NULL, ##__VA_ARGS__) * Declare global methods. These still have a unique object_id because we
* identify all uapi methods with a (object,method) tuple. However, they have
* no type pointer.
*/
#define DECLARE_UVERBS_GLOBAL_METHODS(_object_id, ...) \
static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
_object_id)[] = { __VA_ARGS__ }; \
const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \
.id = _object_id, \
.num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
}
/* Used by drivers to declare a complete parsing tree for a single method that /* Used by drivers to declare a complete parsing tree for a single method that
* differs only in having additional driver specific attributes. * differs only in having additional driver specific attributes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment