RDMA/efa: Add Completion Actions support
Subsystems (2)
cover RDMA/efa: Add Completion Actions support
EFA Completion actions let an application observe work request completions without polling a completion queue: when a work request completes, locally or at the remote side, the device performs an action that the work request names, such as writing a value to a user buffer.
This series adds the control path for memory completion actions:
Patch 1 updates the device interface definitions: the create and destroy action admin commands, the supported action events mask in the queue attributes, and the action descriptor and status codes in the I/O definitions.
Patch 2 maps the admin RESOURCE_BUSY status to EBUSY, which the device returns when a PD is deallocated while an action still references it.
Patch 3 adds the completion action uverbs object, the QP creation attributes for the action descriptor block, and the capability, limit and supported operation reporting through query device.
The user space counterpart (rdma-core efa provider) follows separately.
Ilia Kolominsky (3):
RDMA/efa: Update device interface
RDMA/efa: Report the admin RESOURCE_BUSY status as EBUSY RDMA/efa: Add Completion Actions support
drivers/infiniband/hw/efa/efa.h | 7 + .../infiniband/hw/efa/efa_admin_cmds_defs.h | 111 ++++++++- drivers/infiniband/hw/efa/efa_com.c | 10 + drivers/infiniband/hw/efa/efa_com_cmd.c | 73 ++++++ drivers/infiniband/hw/efa/efa_com_cmd.h | 31 +++ drivers/infiniband/hw/efa/efa_io_defs.h | 26 +- drivers/infiniband/hw/efa/efa_verbs.c | 235 +++++++++++++++++- include/uapi/rdma/efa-abi.h | 56 ++++- 8 files changed, 542 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/3 RDMA/efa: Update device interface
Align device interface definitions.
--- .../infiniband/hw/efa/efa_admin_cmds_defs.h | 111 +++++++++++++++++- drivers/infiniband/hw/efa/efa_io_defs.h | 26 +++- 2 files changed, 132 insertions(+), 5 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +107 -4
@@ -29,6 +29,8 @@ enum efa_admin_aq_opcode {EFA_ADMIN_DESTROY_EQ =19 ,EFA_ADMIN_ALLOC_MR =20 ,EFA_ADMIN_SERVICE =21 , +EFA_ADMIN_CREATE_ACTION =22 , +EFA_ADMIN_DESTROY_ACTION =23 ,EFA_ADMIN_CREATE_EVENT_COUNTER =25 ,EFA_ADMIN_DESTROY_EVENT_COUNTER =26 , EFA_ADMIN_ATTACH_EVENT_COUNTER = 27,
@@ -162,8 +164,20 @@ struct efa_admin_create_qp_cmd {/* MBZ */ u8 reserved; +/* +* Enablement bitmap for WQE configurable feature blocks +* 0 : action_with_data - If set, action with data +* block is used - offset in the WQE is provided by +* action_with_data_wqe_offset +* 15:1 : reserved - MBZ +*/ +u16 wqe_blocks_enablement; + +/* Offset in SQ WQE to action w/ data descriptor */ +u8 action_with_data_wqe_offset; +/* MBZ */ -u32 reserved2; +u8 reserved2; } __packed;struct efa_admin_create_qp_resp {
@@ -701,7 +715,8 @@ struct efa_admin_feature_device_attr_desc {* 9:6 : reserved1 - MBZ * 10 : sq_64_bit_req_id - If set, SQ can use 64-bit * work request ids -* 31:11 : reserved2 - MBZ +* 11 : actions - If set, actions are supported +* 31:12 : reserved2 - MBZ */ u32 device_caps;
@@ -792,7 +807,10 @@ struct efa_admin_feature_queue_attr_desc_2 {u16 inline_buf_size_ex;/* MBZ */ -u8 reserved[6 ]; +u8 reserved[2 ]; + +/* Maximum number of actions supported per device */ +u32 max_actions;/* * Supported counter QP events
@@ -818,6 +836,27 @@ struct efa_admin_feature_queue_attr_desc_2 {* this value */ u64 event_counter_max_val; + +/* +* Bitmask indicating which completion events can trigger actions +* 0 : action_send_comp - Send completion +* 1 : action_recv_comp - Receive completion +* 2 : action_read_comp - RDMA read initiator +* completion +* 3 : action_remote_read_comp - RDMA read target +* (responder) completion +* 4 : action_write_comp - RDMA write initiator +* completion (w/ or w/o immediate) +* 5 : action_remote_write_comp - RDMA write target +* completion +* 6 : action_remote_write_imm_comp - RDMA write with +* immediate target completion +* 31:7 : reserved - MBZ +*/ +u32 supported_action_events; + +/* MBZ */ +u32 reserved2; };struct efa_admin_event_queue_attr_desc {
@@ -1086,6 +1125,62 @@ struct efa_admin_service_resp {u8 buffer[56 ]; }; +enum efa_admin_action_type { +/* Memset action - write a value to a target memory location */ +EFA_ADMIN_ACTION_TYPE_MEMSET =0 , +}; + +/* Memset action attributes */ +struct efa_admin_action_memset_attr { +/* Target physical address. */ +u64 paddr; + +/* Size of the memory range in bytes. */ +u32 length; + +/* Size of memset in bytes. Only 1, 2 or 4 are accepted */ +u8 write_size; + +/* MBZ */ +u8 flags; + +/* MBZ */ +u16 reserved; +}; + +/* Create Action command parameters. */ +struct efa_admin_create_action_cmd { +/* Action type, defined in enum efa_admin_action_type */ +u16 type; + +/* Protection Domain associated with this action */ +u16 pd; + +union { +struct efa_admin_action_memset_attr memset; + } action_data; +} __packed; + +struct efa_admin_create_action_resp { +/* Common Admin Queue completion descriptor */ +struct efa_admin_acq_common_desc acq_common_desc; + +/* Opaque handle to be used for consequent admin operation */ +u32 action_handle; + +/* Action id to be used in work requests */ +u32 action_id; +}; + +struct efa_admin_destroy_action_cmd { +u32 action_handle; +} __packed; + +struct efa_admin_destroy_action_resp { +/* Common Admin Queue completion descriptor */ +struct efa_admin_acq_common_desc acq_common_desc; +}; +/* Create Counter command */ struct efa_admin_create_event_counter_cmd {/* UAR number */
@@ -1191,8 +1286,8 @@ struct efa_admin_modify_event_counter_resp {#define EFA_ADMIN_CREATE_QP_CMD_SQ_VIRT_MASK BIT(0)#define EFA_ADMIN_CREATE_QP_CMD_RQ_VIRT_MASK BIT(1)#define EFA_ADMIN_CREATE_QP_CMD_UNSOLICITED_WRITE_RECV_MASK BIT(2) -#define EFA_ADMIN_CREATE_QP_CMD_SQ_64_BIT_REQ_ID_SHIFT 3#define EFA_ADMIN_CREATE_QP_CMD_SQ_64_BIT_REQ_ID_MASK BIT(3) +#define EFA_ADMIN_CREATE_QP_CMD_ACTION_WITH_DATA_MASK BIT(0)/* modify_qp_cmd */ #define EFA_ADMIN_MODIFY_QP_CMD_QP_STATE_MASK BIT(0)
@@ -1234,6 +1329,7 @@ struct efa_admin_modify_event_counter_resp {#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_UNSOLICITED_WRITE_RECV_MASK BIT(4)#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_EVENT_COUNTERS_MASK BIT(5)#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_SQ_64_BIT_REQ_ID_MASK BIT(10) +#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_ACTIONS_MASK BIT(11)/* feature_queue_attr_desc_2 */ #define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_SEND_COMP_MASK BIT(0)
@@ -1246,6 +1342,13 @@ struct efa_admin_modify_event_counter_resp {#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_WRITE_COMP_ERR_MASK BIT(7)#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_REMOTE_READ_COMP_MASK BIT(8)#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_REMOTE_WRITE_COMP_MASK BIT(9) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_SEND_COMP_MASK BIT(0) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_RECV_COMP_MASK BIT(1) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_READ_COMP_MASK BIT(2) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_REMOTE_READ_COMP_MASK BIT(3) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_WRITE_COMP_MASK BIT(4) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_REMOTE_WRITE_COMP_MASK BIT(5) +#define EFA_ADMIN_FEATURE_QUEUE_ATTR_DESC_2_ACTION_REMOTE_WRITE_IMM_COMP_MASK BIT(6)/* create_eq_cmd */ #define EFA_ADMIN_CREATE_EQ_CMD_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
drivers/infiniband/hw/efa/efa_io_defs.h +25 -1
@@ -65,6 +65,10 @@ enum efa_io_comp_status {EFA_IO_COMP_STATUS_REMOTE_ERROR_UNKNOWN_PEER =14 ,/* Unreachable remote - never received a response */ EFA_IO_COMP_STATUS_LOCAL_ERROR_UNREACH_REMOTE =15 , +/* Local action not valid */ +EFA_IO_COMP_STATUS_LOCAL_ERROR_INVALID_ACTION =16 , +/* No valid action at remote side */ +EFA_IO_COMP_STATUS_REMOTE_ERROR_INVALID_ACTION =17 ,/* Remote feature mismatch */ EFA_IO_COMP_STATUS_REMOTE_ERROR_FEATURE_MISMATCH = 18, };
@@ -83,6 +87,20 @@ struct efa_io_req_id_ex {u16 w[3 ]; }; +/* +* Action descriptor, placed in WQE inline space. Holds local and remote +* action handles and data. One entry per local and remote action. +*/ +struct efa_io_action_with_data_block { +u32 local_action_handle; + +u32 remote_action_handle; + +u64 local_action_data; + +u64 remote_action_data; +}; +struct efa_io_tx_meta_desc {/* Verbs-generated Request ID */ u16 req_id;
@@ -112,7 +130,11 @@ struct efa_io_tx_meta_desc {* 4 : comp_req - Indicates whether completion should * be posted, after packet is transmitted. Valid only * for the first descriptor -* 7:5 : reserved29 - MBZ +* 5 : reserved29 - MBZ +* 6 : local_action_req - Indicates local action +* should be triggered post local WR completion. +* 7 : remote_action_req - Indicates remote action +* should be triggered post remote completion. */ u8 ctrl2;
@@ -388,6 +410,8 @@ struct efa_io_rx_cdesc_ex {#define EFA_IO_TX_META_DESC_FIRST_MASK BIT(2)#define EFA_IO_TX_META_DESC_LAST_MASK BIT(3)#define EFA_IO_TX_META_DESC_COMP_REQ_MASK BIT(4) +#define EFA_IO_TX_META_DESC_LOCAL_ACTION_REQ_MASK BIT(6) +#define EFA_IO_TX_META_DESC_REMOTE_ACTION_REQ_MASK BIT(7)#define EFA_IO_TX_META_DESC_PROCESSING_HINTS_MASK GENMASK(1, 0)/* tx_buf_desc */
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH for-next 1/3] RDMA/efa: Update device interface
Sashiko has reviewed this patch and found no issues.
Quoted 5 lines
Align device interface definitions.
Reviewed-by Michael Margolin <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Ilia Kolominsky <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/3 RDMA/efa: Report the admin RESOURCE_BUSY status as EBUSY
In reply to Ilia KolominskyThe device completes a command with RESOURCE_BUSY when the object it targets is still in use, for example a destroy of an object that other objects still reference. Map that status to EBUSY instead of the generic EINVAL so that callers can tell the two apart.
--- drivers/infiniband/hw/efa/efa_com.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/efa/efa_com.c +2 -0
@@ -584,6 +584,8 @@ static int efa_com_comp_status_to_errno(u8 comp_status)case EFA_ADMIN_ILLEGAL_PARAMETER :case EFA_ADMIN_UNKNOWN_ERROR :return -EINVAL ; +case EFA_ADMIN_RESOURCE_BUSY : +return -EBUSY ;default :return -EINVAL ; }
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH for-next 2/3] RDMA/efa: Report the admin RESOURCE_BUSY status as EBUSY
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
The device completes a command with
RESOURCE_BUSYwhen the object it targets is still in use, for example a destroy of an object that other objects still reference. Map that status to EBUSY instead of the generic EINVAL so that callers can tell the two apart.Reviewed-by Michael Margolin <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Ilia Kolominsky <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH 3/3 RDMA/efa: Add Completion Actions support
In reply to Ilia KolominskyCompletion actions are device-side effects triggered by work requests:
when a work request completes, locally or at the remote side, the device performs the action, so completions can be observed without polling a completion queue.
Implement the control path. A memory completion action object pins a user buffer (VA or dmabuf) on a protection domain and yields the action id that work requests carry; on each completion the device modifies mem_modify_size bytes (1, 2 or 4) of that buffer with the operand the work request supplies. The buffer must be physically contiguous. The device also returns an action handle, which the driver keeps for the destroy command.
The object is an EFA ioctl object, exposed only when the device reports the actions capability. It holds a reference on its protection domain, so deallocating the PD while the action exists fails with EBUSY. QP creation accepts a WQE feature block configuration - an enablement bitmap and the offset of the action descriptor within the WQE - determined by the user space provider, which owns the WQE layout, and passed through to the device. The device capability, the maximum number of memory completion actions and the supported work request types are reported through query device.
--- drivers/infiniband/hw/efa/efa.h | 7 + drivers/infiniband/hw/efa/efa_com.c | 8 + drivers/infiniband/hw/efa/efa_com_cmd.c | 73 ++++++++ drivers/infiniband/hw/efa/efa_com_cmd.h | 31 ++++ drivers/infiniband/hw/efa/efa_verbs.c | 235 +++++++++++++++++++++++- include/uapi/rdma/efa-abi.h | 56 +++++- 6 files changed, 408 insertions(+), 2 deletions(-)
drivers/infiniband/hw/efa/efa.h +7 -0
@@ -118,6 +118,13 @@ struct efa_comp_cntr {u32 err_handle; }; +struct efa_comp_action { +struct efa_dev *dev; +struct ib_pd *pd; +struct ib_umem *umem; +u32 action_handle; +}; +struct efa_qp {struct ib_qp ibqp;dma_addr_t rq_dma_addr;
drivers/infiniband/hw/efa/efa_com.c +8 -0
@@ -77,6 +77,14 @@ static const char *efa_com_cmd_str(u8 cmd)EFA_CMD_STR_CASE (DEALLOC_UAR );EFA_CMD_STR_CASE (CREATE_EQ );EFA_CMD_STR_CASE (DESTROY_EQ ); +EFA_CMD_STR_CASE (SERVICE ); +EFA_CMD_STR_CASE (CREATE_ACTION ); +EFA_CMD_STR_CASE (DESTROY_ACTION ); +EFA_CMD_STR_CASE (CREATE_EVENT_COUNTER ); +EFA_CMD_STR_CASE (DESTROY_EVENT_COUNTER ); +EFA_CMD_STR_CASE (ATTACH_EVENT_COUNTER ); +EFA_CMD_STR_CASE (MODIFY_EVENT_COUNTER ); +EFA_CMD_STR_CASE (DETACH_EVENT_COUNTER );default :return "unknown command opcode" ; }#undef EFA_CMD_STR_CASE
drivers/infiniband/hw/efa/efa_com_cmd.c +73 -0
88 lines not on this page · raw message
drivers/infiniband/hw/efa/efa_com_cmd.h +31 -0
@@ -30,6 +30,14 @@ struct efa_com_create_qp_params {u8 sl; u8 unsolicited_write_recv : 1; u8 sq_64_bit_req_id : 1; +/* Enablement of WQE feature blocks */ +struct { +u8 action_with_data:1 ; + } wqe_blocks_en; +/* Offsets in SQ WQE of the enabled WQE feature blocks */ +struct { +u8 action_with_data; + } wqe_blocks_offsets; };struct efa_com_create_qp_result {
@@ -151,6 +159,8 @@ struct efa_com_get_device_attr_result {u32 max_event_counters;u64 event_counter_max_val;u32 supported_event_counter_qp_events; +u32 max_actions; +u32 supported_action_events; };struct efa_com_get_hw_hints_result {
@@ -341,6 +351,22 @@ struct efa_com_modify_event_counter_params {u64 value; }; +struct efa_com_create_action_params { +dma_addr_t dma_addr; +u64 length; +u32 write_size; +u16 pdn; +}; + +struct efa_com_create_action_result { +u32 action_handle; +u32 action_id; +}; + +struct efa_com_destroy_action_params { +u32 action_handle; +}; +int efa_com_create_qp (struct efa_com_dev *edev,struct efa_com_create_qp_params *params,struct efa_com_create_qp_result *res);
@@ -402,5 +428,10 @@ int efa_com_detach_event_counter(struct efa_com_dev *edev, struct efa_com_detach_event_counter_params *params);int efa_com_modify_event_counter (struct efa_com_dev *edev,struct efa_com_modify_event_counter_params *params); +int efa_com_create_action (struct efa_com_dev *edev, +struct efa_com_create_action_params *params, +struct efa_com_create_action_result *result); +int efa_com_destroy_action (struct efa_com_dev *edev, +struct efa_com_destroy_action_params *params);#endif /* _EFA_COM_CMD_H_ */
drivers/infiniband/hw/efa/efa_verbs.c +234 -1
287 lines not on this page · raw message
include/uapi/rdma/efa-abi.h +55 -1
84 lines not on this page · raw message
Signature · 1 line
2.47.3
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 23 lines
Completion actions are device-side effects triggered by work requests:
when a work request completes, locally or at the remote side, the device performs the action, so completions can be observed without polling a completion queue.Implement the control path. A memory completion action object pins a user buffer (VA or dmabuf) on a protection domain and yields the action id that work requests carry; on each completion the device modifies
mem_modify_sizebytes (1, 2 or 4) of that buffer with the operand the work request supplies. The buffer must be physically contiguous. The device also returns an action handle, which the driver keeps for the destroy command.The object is an EFA ioctl object, exposed only when the device reports the actions capability. It holds a reference on its protection domain, so deallocating the PD while the action exists fails with EBUSY. QP creation accepts a WQE feature block configuration - an enablement bitmap and the offset of the action descriptor within the WQE - determined by the user space provider, which owns the WQE layout, and passed through to the device. The device capability, the maximum number of memory completion actions and the supported work request types are reported through query device.
Quoted 3 lines
Reviewed-by Michael Margolin <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Ilia Kolominsky <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
The rdma-core counterpart is up for review:
https://github.com/linux-rdma/rdma-core/pull/1854
Thanks,
Ilia
Quoted 4 lines · Ilia Kolominsky
EFA Completion actions let an application observe work request completions without polling a completion queue: when a work request completes, locally or at the remote side, the device performs an action that the work request names, such as writing a value to a user buffer.
Why are these verbs EFA-specific? This looks like extension of already generic UVERBS_METHOD_COMP_CNTR_* code and probably should be general too.
Thanks
Michael Margolin
maintainerQuoted 8 lines · Leon Romanovsky
Quoted 4 lines · Ilia Kolominsky
EFA Completion actions let an application observe work request completions without polling a completion queue: when a work request completes, locally or at the remote side, the device performs an action that the work request names, such as writing a value to a user buffer.
Why are these verbs EFA-specific? This looks like extension of already generic UVERBS_METHOD_COMP_CNTR_* code and probably should be general too.
It is indeed an extension of Completion Counters, and later we plan to connect the two by allowing a Completion Counter to be used as a Completion Action, but unlike counters, actions mostly matter for unordered transports where a completion count alone doesn't tell the application which requests have completed, so it needs an efficient way to track completion of specific requests.
Do you think these semantics can be useful for other providers at this stage, or can we start with an EFA-specific interface and add a common ABI later if required?
Michael
Quoted 17 lines · Michael Margolin
Quoted 8 lines · Leon Romanovsky
Quoted 4 lines · Ilia Kolominsky
EFA Completion actions let an application observe work request completions without polling a completion queue: when a work request completes, locally or at the remote side, the device performs an action that the work request names, such as writing a value to a user buffer.
Why are these verbs EFA-specific? This looks like extension of already generic UVERBS_METHOD_COMP_CNTR_* code and probably should be general too.
It is indeed an extension of Completion Counters, and later we plan to connect the two by allowing a Completion Counter to be used as a Completion Action, but unlike counters, actions mostly matter for unordered transports where a completion count alone doesn't tell the application which requests have completed, so it needs an efficient way to track completion of specific requests.
Quoted 3 lines
Do you think these semantics can be useful for other providers at this stage, or can we start with an EFA-specific interface and add a common ABI later if required?
I think the idea and implementation is general enough to be picked by anyone who will decide to implement it later. Let's do it in common ABI, please.
Thanks
Quoted 3 lines
Michael
Michael Margolin
maintainerOn Tue, Nov 17, 2026 at 02:53:25PM +0200, Leon Romanovsky wrote:w3esq23
Quoted 22 lines · Michael Margolin
Quoted 17 lines · Leon Romanovsky
Quoted 8 lines · Ilia Kolominsky
Quoted 4 lines
EFA Completion actions let an application observe work request completions without polling a completion queue: when a work request completes, locally or at the remote side, the device performs an action that the work request names, such as writing a value to a user buffer.
Why are these verbs EFA-specific? This looks like extension of already generic UVERBS_METHOD_COMP_CNTR_* code and probably should be general too.
It is indeed an extension of Completion Counters, and later we plan to connect the two by allowing a Completion Counter to be used as a Completion Action, but unlike counters, actions mostly matter for unordered transports where a completion count alone doesn't tell the application which requests have completed, so it needs an efficient way to track completion of specific requests.
Quoted 3 lines
Do you think these semantics can be useful for other providers at this stage, or can we start with an EFA-specific interface and add a common ABI later if required?
Quoted 6 lines
I think the idea and implementation is general enough to be picked by anyone who will decide to implement it later. Let's do it in common ABI, please.
Thanks
Ok, makes sense.
Please see libibverbs API suggestion:
https://github.com/linux-rdma/rdma-core/pull/1865
Michael