lib/dma: introduce inter-process and inter-OS DMA
RFC 1/1 lib/dma: introduce inter-process and inter-OS DMA
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized environments.
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Calls rte_dma_access_group_create(group_token, &group_id) to create a new access group.
Shares group_id and group_token with Process 2 via IPC.
2) Process 2 (Group Joiner):
Receives group_id and group_token from Process 1.
Calls rte_dma_access_group_join(group_id, group_token) to join the group.
3) Both Processes:
Use rte_dma_access_group_size_get() to check the number of devices in the group.
Use rte_dma_access_group_get() to retrieve the group table and handler information.
Perform DMA transfers as needed.
4) Process 2 (when done):
Calls rte_dma_access_group_leave(group_id) to leave the group.
5) Process 1:
Receives RTE_DMA_EVENT_ACCESS_TABLE_UPDATE to be notified of group changes.
Uses rte_dma_access_group_size_get() to confirm the group size.
This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
--- lib/dmadev/rte_dmadev.c | 320 ++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 255 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 48 +++++ lib/dmadev/rte_dmadev_trace.h | 51 ++++++ 4 files changed, 674 insertions(+)
lib/dmadev/rte_dmadev.c +320 -0
@@ -9,11 +9,13 @@#include <eal_export.h> #include <rte_eal.h> +#include <rte_errno.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> #include <rte_memzone.h> #include <rte_string_fns.h> +#include <rte_tailq.h> #include <rte_telemetry.h> #include "rte_dmadev.h"
@@ -33,6 +35,14 @@ static struct {struct rte_dma_dev_data data[0 ]; } *dma_devices_shared_data; +/** List of callback functions registered by an application */ +struct rte_dma_dev_callback { +TAILQ_ENTRY (rte_dma_dev_callback) next;/** Callbacks list */ +rte_dma_event_callback cb_fn;/** Callback address */ +void *cb_arg;/** Parameter for callback */ +enum rte_dma_event event;/** Interrupt event type */ +}; +RTE_LOG_REGISTER_DEFAULT (rte_dma_logtype,INFO );#define RTE_LOGTYPE_DMADEV rte_dma_logtype
@@ -789,6 +799,310 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *return dev->dev_ops->vchan_status (dev, vchan, status); } +int +rte_dma_access_group_create (int16_t dev_id,rte_uuid_t token,uint16_t *group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_id ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os transfers" , + dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_create ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_create)(dev, token, group_id); +} + +int +rte_dma_access_group_destroy (int16_t dev_id,uint16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os transfers" , + dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { +RTE_DMA_LOG (ERR ,"Group id should be < %u for device %d" , + dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_destroy ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_destroy)(dev, group_id); +} + +int +rte_dma_access_group_join (int16_t dev_id,uint16_t group_id,rte_uuid_t token) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os transfers" , + dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { +RTE_DMA_LOG (ERR ,"Group id should be < %u for device %d" , + dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_join ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_join)(dev, group_id, token); +} + +int +rte_dma_access_group_leave (int16_t dev_id,uint16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os transfers" , + dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { +RTE_DMA_LOG (ERR ,"Group id should be < %u for device %d" , + dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_leave ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_leave)(dev, group_id); +} + +uint16_t +rte_dma_access_group_size_get (int16_t dev_id,uint16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os transfers" , + dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { +RTE_DMA_LOG (ERR ,"Group id should be < %u for device %d" , + dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_size_get ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_size_get)(dev, group_id); +} + +int +rte_dma_access_group_get (int16_t dev_id,uint16_t group_id,uint64_t *group_tbl,uint16_t size) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_tbl ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os transfers" , + dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { +RTE_DMA_LOG (ERR ,"Group id should be < %u for device %d" , + dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_get ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_get)(dev, group_id, group_tbl, size); +} + +int +rte_dma_event_callback_register (uint16_t dev_id,enum rte_dma_event event, +rte_dma_event_callback cb_fn,void *cb_arg) +{ +struct rte_dma_dev_callback *user_cb; +struct rte_dma_dev *dev; +int ret =0 ; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + + dev = &rte_dma_devices[dev_id]; + +if (event >=RTE_DMA_EVENT_MAX ) { +RTE_DMA_LOG (ERR ,"Invalid event type (%u), should be less than %u" , event, +RTE_DMA_EVENT_MAX ); +return -EINVAL ; + } + +if (cb_fn ==NULL ) { +RTE_DMA_LOG (ERR ,"NULL callback function" ); +return -EINVAL ; + } + +rte_mcfg_tailq_write_lock (); + TAILQ_FOREACH(user_cb, &(dev->list_cbs), next) { +if (user_cb->cb_fn == cb_fn && user_cb->cb_arg == cb_arg && + user_cb->event == event) { + ret = -EEXIST ; + goto exit; + } + } + + user_cb =rte_zmalloc ("INTR_USER_CALLBACK" ,sizeof (struct rte_dma_dev_callback ),0 ); +if (user_cb ==NULL ) { + ret = -ENOMEM ; + goto exit; + } + + user_cb->cb_fn = cb_fn; + user_cb->cb_arg = cb_arg; + user_cb->event = event; +TAILQ_INSERT_TAIL (&(dev->list_cbs), user_cb, next); + +exit: +rte_mcfg_tailq_write_unlock (); + rte_errno = -ret; +return ret; +} + +int +rte_dma_event_callback_unregister (uint16_t dev_id,enum rte_dma_event event, +rte_dma_event_callback cb_fn,void *cb_arg) +{ +struct rte_dma_dev_callback *cb; +struct rte_dma_dev *dev; +int ret = -ENOENT ; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (event >=RTE_DMA_EVENT_MAX ) { +RTE_DMA_LOG (ERR ,"Invalid event type (%u), should be less than %u" , event, +RTE_DMA_EVENT_MAX ); +return -EINVAL ; + } + +if (cb_fn ==NULL ) { +RTE_DMA_LOG (ERR ,"NULL callback function cannot be unregistered" ); +return -EINVAL ; + } + +rte_mcfg_tailq_write_lock (); + TAILQ_FOREACH(cb, &dev->list_cbs, next) { +if (cb->cb_fn == cb_fn || cb->event == event || cb->cb_arg == cb_arg) { +TAILQ_REMOVE (&(dev->list_cbs), cb, next); + ret =0 ; +break ; + } + } +rte_mcfg_tailq_write_unlock (); + +if (ret ==0 ) +rte_free (cb); + + rte_errno = -ret; +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (rte_dma_event_pmd_callback_process) +void +rte_dma_event_pmd_callback_process (struct rte_dma_dev *dev,enum rte_dma_event event) +{ +struct rte_dma_dev_callback *cb; +void *tmp; + +if (dev ==NULL ) { +RTE_DMA_LOG (ERR ,"NULL device" ); +return ; + } + +if (event >=RTE_DMA_EVENT_MAX ) { +RTE_DMA_LOG (ERR ,"Invalid event type (%u), should be less than %u" , event, +RTE_DMA_EVENT_MAX ); +return ; + } + +rte_mcfg_tailq_read_lock (); + RTE_TAILQ_FOREACH_SAFE(cb, &(dev->list_cbs), next, tmp) { +rte_mcfg_tailq_read_unlock (); +if (cb->cb_fn !=NULL || cb->event == event) + cb->cb_fn (dev->data->dev_id, cb->event, cb->cb_arg); +rte_mcfg_tailq_read_lock (); + } +rte_mcfg_tailq_read_unlock (); +} +static const char *dma_capability_name (uint64_t capability) {
@@ -805,6 +1119,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },
@@ -999,6 +1315,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,rte_tel_data_add_dict_int (d,"max_desc" , dma_info.max_desc);rte_tel_data_add_dict_int (d,"min_desc" , dma_info.min_desc);rte_tel_data_add_dict_int (d,"max_sges" , dma_info.max_sges); +rte_tel_data_add_dict_int (d,"nb_access_groups" , dma_info.nb_access_groups); +rte_tel_data_add_dict_int (d,"controller_id" , dma_info.controller_id); dma_caps =rte_tel_data_alloc ();if (!dma_caps)
@@ -1014,6 +1332,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );
lib/dmadev/rte_dmadev.h +255 -0
315 lines not on this page · raw message
lib/dmadev/rte_dmadev_pmd.h +48 -0
78 lines not on this page · raw message
lib/dmadev/rte_dmadev_trace.h +51 -0
69 lines not on this page · raw message
Signature · 1 line
2.34.1
Hi Feng, Anatoly,
Gentle ping for the review.
Thanks
Quoted 1,048 lines
-----Original Message-----
From: Vamsi Krishna <[email protected]>
Sent: Monday, September 1, 2025 6:04 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Subject: [RFC] lib/dma: introduce inter-process and inter-OS DMAFrom: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized environments.
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Callsrte_dma_access_group_create(group_token, &group_id)to create a new access group.
Sharesgroup_idandgroup_tokenwith Process 2 via IPC.
2) Process 2 (Group Joiner):
Receivesgroup_idandgroup_tokenfrom Process 1.
Callsrte_dma_access_group_join(group_id, group_token)to join the group.
3) Both Processes:
Userte_dma_access_group_size_get()to check the number of devices in the group.
Userte_dma_access_group_get()to retrieve the group table and handler information.Perform DMA transfers as needed.
4) Process 2 (when done):
Callsrte_dma_access_group_leave(group_id)to leave the group.
5) Process 1:
ReceivesRTE_DMA_EVENT_ACCESS_TABLE_UPDATEto be notified of group changes.
Usesrte_dma_access_group_size_get()to confirm the group size.This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
Signed-off-by Vamsi Attunuru <[email protected]>---
lib/dmadev/rte_dmadev.c| 320
++++++++++++++++++++++++++++++++++lib/dmadev/rte_dmadev.h | 255 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 48 +++++ lib/dmadev/rte_dmadev_trace.h | 51 ++++++ 4 files changed, 674 insertions(+)lib/dmadev/rte_dmadev.c +10
-0@@ -9,11 +9,13 @@#include <eal_export.h> #include <rte_eal.h> +#include <rte_errno.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> #include <rte_memzone.h> #include <rte_string_fns.h> +#include <rte_tailq.h> #include <rte_telemetry.h> #include "rte_dmadev.h" @@ -33,6 +35,14 @@ static struct {struct rte_dma_dev_data data[0 ]; } *dma_devices_shared_data; +/** List of callback functions registered by an application */ +struct rte_dma_dev_callback { +TAILQ_ENTRY (rte_dma_dev_callback) next;/** Callbacks list */ +rte_dma_event_callback cb_fn;/** Callback address */ +void *cb_arg;/** Parameter for callback */ +enum rte_dma_event event;/** Interrupt event type */ +}; +RTE_LOG_REGISTER_DEFAULT (rte_dma_logtype,INFO );#define RTE_LOGTYPE_DMADEV rte_dma_logtype@@ -789,6 +799,310 @@ rte_dma_vchan_status(int16_t dev_id, uint16_tvchan, enum
rte_dma_vchan_status*return dev->dev_ops->vchan_status(dev, vchan, status); }lib/dmadev/rte_dmadev.c +2
-0+int +rte_dma_access_group_create(int16_t dev_id, rte_uuid_t token, uint16_t
*group_id)lib/dmadev/rte_dmadev.c +14
-0+{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_id ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os transfers",
lib/dmadev/rte_dmadev.c +6
-0+ dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_create ==NULL ) +return -ENOTSUP ; + return (*dev->dev_ops->access_group_create)(dev, token,
group_id);lib/dmadev/rte_dmadev.c +18
-0+} + +int +rte_dma_access_group_destroy (int16_t dev_id,uint16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os transfers",
lib/dmadev/rte_dmadev.c +6
-0+ dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { + RTE_DMA_LOG(ERR, "Group id should be < %u for device%d",
lib/dmadev/rte_dmadev.c +10
-0+ dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_destroy ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_destroy)(dev, group_id); +} + +int +rte_dma_access_group_join(int16_t dev_id, uint16_t group_id, rte_uuid_ttoken)
lib/dmadev/rte_dmadev.c +14
-0+{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os transfers",
lib/dmadev/rte_dmadev.c +6
-0+ dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { + RTE_DMA_LOG(ERR, "Group id should be < %u for device%d",
lib/dmadev/rte_dmadev.c +24
-0+ dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_join ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_join)(dev, group_id, token); +} + +int +rte_dma_access_group_leave (int16_t dev_id,uint16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os transfers",
lib/dmadev/rte_dmadev.c +6
-0+ dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { + RTE_DMA_LOG(ERR, "Group id should be < %u for device%d",
lib/dmadev/rte_dmadev.c +24
-0+ dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_leave ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_leave)(dev, group_id); +} + +uint16_t +rte_dma_access_group_size_get (int16_t dev_id,uint16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os transfers",
lib/dmadev/rte_dmadev.c +6
-0+ dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { + RTE_DMA_LOG(ERR, "Group id should be < %u for device%d",
lib/dmadev/rte_dmadev.c +10
-0+ dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_size_get ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_group_size_get)(dev, group_id); +} + +int +rte_dma_access_group_get(int16_t dev_id, uint16_t group_id, uint64_t
*group_tbl,uint16_tsize)lib/dmadev/rte_dmadev.c +14
-0+{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_tbl ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os transfers",
lib/dmadev/rte_dmadev.c +6
-0+ dev_id); +return -EINVAL ; + } + +if (dev_info.nb_access_groups <= group_id) { + RTE_DMA_LOG(ERR, "Group id should be < %u for device%d",
lib/dmadev/rte_dmadev.c +6
-0+ dev_info.nb_access_groups, dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_group_get ==NULL ) +return -ENOTSUP ; + return (*dev->dev_ops->access_group_get)(dev, group_id,
group_tbl, size);lib/dmadev/rte_dmadev.c +4
-0+} + +int +rte_dma_event_callback_register(uint16_t dev_id, enum rte_dma_eventevent,
lib/dmadev/rte_dmadev.c +13
-0+ rte_dma_event_callback cb_fn, void *cb_arg) +{ + struct rte_dma_dev_callback *user_cb; +struct rte_dma_dev *dev; +int ret =0 ; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + + dev = &rte_dma_devices[dev_id]; + +if (event >=RTE_DMA_EVENT_MAX ) { + RTE_DMA_LOG(ERR, "Invalid event type (%u), should be lessthan %u", event,
lib/dmadev/rte_dmadev.c +12
-0+ RTE_DMA_EVENT_MAX); +return -EINVAL ; + } + +if (cb_fn ==NULL ) { +RTE_DMA_LOG (ERR ,"NULL callback function" ); +return -EINVAL ; + } + +rte_mcfg_tailq_write_lock (); + TAILQ_FOREACH(user_cb, &(dev->list_cbs), next) { + if (user_cb->cb_fn == cb_fn && user_cb->cb_arg == cb_arg&&
lib/dmadev/rte_dmadev.c +7
-0+ user_cb->event == event) { + ret = -EEXIST ; + goto exit; + } + } + + user_cb = rte_zmalloc("INTR_USER_CALLBACK", sizeof(struct
rte_dma_dev_callback), 0);lib/dmadev/rte_dmadev.c +18
-0+if (user_cb ==NULL ) { + ret = -ENOMEM ; + goto exit; + } + + user_cb->cb_fn = cb_fn; + user_cb->cb_arg = cb_arg; + user_cb->event = event; +TAILQ_INSERT_TAIL (&(dev->list_cbs), user_cb, next); + +exit: +rte_mcfg_tailq_write_unlock (); + rte_errno = -ret; +return ret; +} + +int +rte_dma_event_callback_unregister(uint16_t dev_id, enum rte_dma_eventevent,
lib/dmadev/rte_dmadev.c +1
-0+rte_dma_event_callback cb_fn, void
*cb_arg)lib/dmadev/rte_dmadev.c +11
-0+{ +struct rte_dma_dev_callback *cb; +struct rte_dma_dev *dev; +int ret = -ENOENT ; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (event >=RTE_DMA_EVENT_MAX ) { + RTE_DMA_LOG(ERR, "Invalid event type (%u), should be lessthan %u", event,
lib/dmadev/rte_dmadev.c +6
-0+ RTE_DMA_EVENT_MAX); +return -EINVAL ; + } + +if (cb_fn ==NULL ) { + RTE_DMA_LOG(ERR, "NULL callback function cannot beunregistered");
lib/dmadev/rte_dmadev.c +6
-0+return -EINVAL ; + } + +rte_mcfg_tailq_write_lock (); + TAILQ_FOREACH(cb, &dev->list_cbs, next) { + if (cb->cb_fn == cb_fn || cb->event == event || cb->cb_arg==
cb_arg) {lib/dmadev/rte_dmadev.c +17
-0+TAILQ_REMOVE (&(dev->list_cbs), cb, next); + ret =0 ; +break ; + } + } +rte_mcfg_tailq_write_unlock (); + +if (ret ==0 ) +rte_free (cb); + + rte_errno = -ret; +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL(rte_dma_event_pmd_callback_process) +void +rte_dma_event_pmd_callback_process(struct rte_dma_dev *dev, enum
rte_dma_eventevent)lib/dmadev/rte_dmadev.c +11
-0+{ +struct rte_dma_dev_callback *cb; +void *tmp; + +if (dev ==NULL ) { +RTE_DMA_LOG (ERR ,"NULL device" ); +return ; + } + +if (event >=RTE_DMA_EVENT_MAX ) { + RTE_DMA_LOG(ERR, "Invalid event type (%u), should be lessthan %u", event,
lib/dmadev/rte_dmadev.c +9
-0+ RTE_DMA_EVENT_MAX); +return ; + } + +rte_mcfg_tailq_read_lock (); + RTE_TAILQ_FOREACH_SAFE(cb, &(dev->list_cbs), next, tmp) { +rte_mcfg_tailq_read_unlock (); +if (cb->cb_fn !=NULL || cb->event == event) + cb->cb_fn(dev->data->dev_id, cb->event, cb-Quoted 1 line
cb_arg);lib/dmadev/rte_dmadev.c +5
-0+rte_mcfg_tailq_read_lock (); + } +rte_mcfg_tailq_read_unlock (); +} +static const char *
dma_capability_name(uint64_t capability)
{lib/dmadev/rte_dmadev.c +2
-0@@ -805,6 +1119,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" },{
RTE_DMA_CAPA_OPS_FILL, "fill" },lib/dmadev/rte_dmadev.c +2
-0@@ -999,6 +1315,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,rte_tel_data_add_dict_int (d,"max_desc" , dma_info.max_desc);rte_tel_data_add_dict_int (d,"min_desc" , dma_info.min_desc);rte_tel_data_add_dict_int (d,"max_sges" , dma_info.max_sges); +rte_tel_data_add_dict_int (d,"nb_access_groups" , dma_info.nb_access_groups); +rte_tel_data_add_dict_int (d,"controller_id" , dma_info.controller_id);dma_caps = rte_tel_data_alloc(); if (!dma_caps)lib/dmadev/rte_dmadev.c +1
-0@@ -1014,6 +1332,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); + ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN);lib/dmadev/rte_dmadev.c +1
-0+ ADD_CAPA(dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN); ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_OPS_COPY); ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_OPS_COPY_SG); ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_OPS_FILL);lib/dmadev/rte_dmadev.h +4
-0@@ -148,6 +148,7 @@#include <rte_bitops.h> #include <rte_common.h> +#include <rte_uuid.h> #ifdef __cplusplusextern "C" {@@ -265,6 +266,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers between
+ * different process memory spaces.
+ */lib/dmadev/rte_dmadev.h +7
-0+#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation.
* This capability start with index of 32, so that it could leave gap betweenlib/dmadev/rte_dmadev.h +7
-0@@ -308,6 +321,13 @@ struct rte_dma_info {* 0 otherwise. */ uint16_t nb_priorities; +/** Number of access groups supported by the DMA controller. +* If the device does not support INTER_PROCESS_DOMAIN or INTER_OS_DOMAIN transfers, +* this value can be zero. +*/ +uint16_t nb_access_groups; +/** Controller ID, -1 if unknown */ +uint16_t controller_id; };/**
lib/dmadev/rte_dmadev.h +5
-0@@ -564,6 +584,35 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer type. +* +* Specifies the type of DMA transfer, indicating whether the operation +* is within the same domain, between different processes, or across different
+ * operating system domains.
+ *
+ * @see struct rte_dma_inter_transfer_param:transfer_type
+ */lib/dmadev/rte_dmadev.h +2
-0+enum rte_dma_inter_transfer_type { +RTE_DMA_INTER_TRANSFER_NONE ,/**< No inter-domain transfer. */
lib/dmadev/rte_dmadev.h +1
-0+ RTE_DMA_INTER_PROCESS_TRANSFER, /**< Transfer is betweendifferent processes. */
lib/dmadev/rte_dmadev.h +1
-0+ RTE_DMA_INTER_OS_TRANSFER, /**< Transfer is between differentOS domains. */
lib/dmadev/rte_dmadev.h +11
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure holds the necessary information to perform DMA transfers +* between different processes or operating system domains, including the +* transfer type and handler identifiers for the source and destination. +*/ +struct rte_dma_inter_transfer_param { +enum rte_dma_inter_transfer_type transfer_type;/**< Type of inter-domain transfer. */
lib/dmadev/rte_dmadev.h +5
-0+uint16_t src_handler;/**< Source handler identifier. */ +uint16_t dst_handler;/**< Destination handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ +}; +/**
* A structure used to configure a virtual DMA channel. *lib/dmadev/rte_dmadev.h +8
-0@@ -601,6 +650,14 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS DMA transfers to specify +* the source and destination handlers. +* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_transfer_param +*/ +struct rte_dma_inter_transfer_param inter_transfer; };/** @@ -720,6 +777,163 @@ rte_dma_vchan_status(int16_t dev_id, uint16_tvchan, enum
rte_dma_vchan_status*
*/
intrte_dma_dump(int16_t dev_id, FILE *f);+/**
+ * Create an access group to enable inter-process or inter-OS DMA transfers between devices
+ * in the group.
+ *
+ * @paramdev_id
+ * The identifier of the device.
+ * @param token
+ * The unique token used to create the access group.
+ * @param[out]group_id
+ * The ID of the created access group.
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */
+intrte_dma_access_group_create(int16_t dev_id, rte_uuid_t token, uint16_t *group_id);
+/**
+ * Destroy an access group if all other devices have exited. This function will only succeed
+ * when called by the device that created the group; it will fail for all other devices.
+ *
+ * @paramdev_id
+ * The identifier of the device.
+ * @paramgroup_id
+ * The ID of the access group to be destroyed.
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */lib/dmadev/rte_dmadev.h +3
-0+int rte_dma_access_group_destroy (int16_t dev_id,uint16_t group_id); +/** +* Join an access group to enable inter-process or inter-OS DMA transfers with other devices
+ * in the group.
+ *
+ * @paramdev_id
+ * The device identifier.
+ * @paramgroup_id
+ * The access group ID to join.
+ * @param token
+ * The unique token used to authenticate joining the access group
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */
+intrte_dma_access_group_join(int16_t dev_id, uint16_t group_id, rte_uuid_t token);
+/**
+ * Leave an access group, The device's details will be removed from the access group table,
+ * disabling inter-DMA transfers to and from this device. Remaining devices in the group
+ * must be notified of the table update. This function will fail if called by the device
+ * that created the access group.
+ *
+ * @paramdev_id
+ * The device identifier.
+ * @paramgroup_id
+ * The access group ID to exit
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */lib/dmadev/rte_dmadev.h +13
-0+int rte_dma_access_group_leave (int16_t dev_id,uint16_t group_id); +/** +* Retrieve the size of an access group +* +* @param dev_id +* The identifier of the device. +* @param group_id +* The access group ID +* @return +* 0 if the group is empty +* non-zero value if the group contains devices. +*/ +uint16_t rte_dma_access_group_size_get(int16_t dev_id, uint16_t
group_id);
+/**
+ * Retrieve the access group table, which contains source & destination handler
+ * information used by the application to initiate inter-process or inter-OS DMA transfers.
+ *
+ * @paramdev_id
+ * The device identifier.
+ * @paramgroup_id
+ * The access group ID
+ * @paramgroup_tbl
+ * Pointer to the memory where the access group table will be copied
+ * @param size
+ * The size of the group table
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */
+intrte_dma_access_group_get(int16_t dev_id, uint16_t group_id, uint64_t *group_tbl, uint16_t size);lib/dmadev/rte_dmadev.h +5
-0+ +/** +* Enumeration of DMA device event types. +* +* These events notify the application about changes to the DMA access group table,
+ * such as updates or destruction.
+ *
+ * @internal
+ */lib/dmadev/rte_dmadev.h +2
-0+enum rte_dma_event { +RTE_DMA_EVENT_ACCESS_TABLE_UPDATE =0 ,/**< Access group table has been updated. */
lib/dmadev/rte_dmadev.h +1
-0+ RTE_DMA_EVENT_ACCESS_TABLE_DESTROY = 1, /**< Accessgroup table has been destroyed. */
lib/dmadev/rte_dmadev.h +16
-0+RTE_DMA_EVENT_MAX /**< max value of this enum */ +}; + +/** +* DMA device event callback function type. +* +* This callback is invoked when a DMA device event occurs. +* +* @param dma_id +* The identifier of the DMA device associated with the event. +* @param event +* The DMA event type. +* @param user_data +* User-defined data provided during callback registration. +*/ +typedef void (*rte_dma_event_callback)(int16_t dma_id, enum
rte_dma_eventevent, void*user_data);lib/dmadev/rte_dmadev.h +5
-0+ +/** +* Register a callback function for DMA device events. +* +* The specified callback will be invoked when a DMA event (such as access table update or destroy)
+ * occurs. Only one callback can be registered at a time.
+ *
+ * @paramdma_id
+ * The identifier of the DMA device.
+ * @param event
+ * The DMA event type.
+ * @paramcb_fn
+ * Pointer to the callback function to register.
+ * @paramcb_arg
+ * Pointer to user-defined data that will be passed to the callback when
invoked.
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */
+int rte_dma_event_callback_register(uint16_tdev_id, enumrte_dma_eventevent,lib/dmadev/rte_dmadev.h +1
-0+rte_dma_event_callback cb_fn, void
*cb_arg);lib/dmadev/rte_dmadev.h +5
-0+ +/** +* Unregister a previously registered DMA event callback function. +* +* This function removes the callback associated with the specified function pointer and user data.
+ *
+ * @paramdma_id
+ * The identifier of the DMA device.
+ * @param event
+ * The DMA event type.
+ * @paramcb_fn
+ * Pointer to the callback function to unregister.
+ * @paramcb_arg
+ * Pointer to the user-defined data associated with the callback.
+ * @return
+ * 0 on success,
+ * negative value on failure indicating the error code.
+ */
+int rte_dma_event_callback_unregister(uint16_tdev_id, enumrte_dma_eventevent,lib/dmadev/rte_dmadev.h +1
-0+rte_dma_event_callback cb_fn, void
*cb_arg);
+
/**
* DMA transfer result status code defines.
*lib/dmadev/rte_dmadev.h +2
-0@@ -834,6 +1048,38 @@ extern "C" {* @see struct rte_dma_vchan_conf::auto_free */ #define RTE_DMA_OP_FLAG_AUTO_FREE RTE_BIT64(3) +/** Indicates a valid inter-process source handler. +* This flag signifies that the inter-process source handler is provided in the flags
+ * parameter (for all enqueue APIs) and is valid.
+ *
+ * Applicable only if the DMA device supports inter-process DMA capability.
+ * @see structrte_dma_info::dev_capa
+ */
+#defineRTE_DMA_OP_FLAG_SRC_INTER_PROCESS_DOMAIN_HANDLERTE_BITS64(4)+/** Indicates a valid inter-process destination handler.
+ * This flag signifies that the inter-process destination handler is provided in the flags
+ * parameter (for all enqueue APIs) and is valid.
+ *
+ * Applicable only if the DMA device supports inter-process DMA capability.
+ * @see structrte_dma_info::dev_capa
+ */
+#defineRTE_DMA_OP_FLAG_DST_INTER_PROCESS_DOMAIN_HANDLERTE_BITS64(5)lib/dmadev/rte_dmadev.h +8
-0+/** Indicates a valid inter-OS source handler. +* This flag signifies that the inter-OS source handler is provided in the flags +* parameter (for all enqueue APIs) and is valid. +* +* Applicable only if the DMA device supports inter-OS DMA capability. +* @see struct rte_dma_info::dev_capa +*/ +#define RTE_DMA_OP_FLAG_SRC_INTER_OS_DOMAIN_HANDLE RTE_BITS64(6)+/** Indicates a valid inter-OS destination handler.
+ * This flag signifies that the inter-OS destination handler is provided in the flags
+ * parameter (for all enqueue APIs) and is valid.
+ *
+ * Applicable only if the DMA device supports inter-OS DMA capability.
+ * @see structrte_dma_info::dev_capa
+ */
+#defineRTE_DMA_OP_FLAG_DST_INTER_OS_DOMAIN_HANDLERTE_BITS64(7)/**@}*/
/**
lib/dmadev/rte_dmadev.h +1
-0@@ -856,6 +1102,9 @@ extern "C" {* @param flags * An flags for this operation. * @see RTE_DMA_OP_FLAG_* +* The upper 32 bits of the flags parameter specify the source & destination handlers
+ * when any RTE_DMA_OP_FLAG_*_INTER_* flags are set.
+ * @see RTE_DMA_OP_FLAG_*_INTER_*
*
* @return
* - 0..UINT16_MAX: index of enqueued job.lib/dmadev/rte_dmadev.h +1
-0@@ -906,6 +1155,9 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst, * @param flags * An flags for this operation. * @see RTE_DMA_OP_FLAG_* + * The upper 32 bits of the flags parameter specify the source & destinationhandlers
+ * when any RTE_DMA_OP_FLAG_*_INTER_* flags are set.
+ * @see RTE_DMA_OP_FLAG_*_INTER_*
*
* @return
* - 0..UINT16_MAX: index of enqueued job.lib/dmadev/rte_dmadev.h +3
-0@@ -955,6 +1207,9 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan,struct rte_dma_sge *src, * @param flags * An flags for this operation. * @see RTE_DMA_OP_FLAG_* + * The upper 16 bits of the flags parameter specify the destination handler + * when any RTE_DMA_OP_FLAG_DST_INTER_* flags are set. + * @see RTE_DMA_OP_FLAG_DST_INTER_* * * @return* - 0..UINT16_MAX: index of enqueued job.
lib/dmadev/rte_dmadev_pmd.h +3
-0@@ -25,6 +25,9 @@ extern "C" {struct rte_dma_dev ; +/** Structure to keep track of registered callbacks */ +RTE_TAILQ_HEAD (rte_dma_dev_cb_list, rte_dma_dev_callback); +/** @internal Used to get device information of a device. */ typedef int (*rte_dma_info_get_t)(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info,@@ -64,6 +67,28 @@ typedef int (*rte_dma_vchan_status_t)(const struct
rte_dma_dev*dev,uint16_tvc
/** @internal Used to dump internal information. */
typedef int (*rte_dma_dump_t)(const structrte_dma_dev*dev, FILE *f);+/** @internal Used to create an access group for inter-process or inter-OS DMA transfers. */
+typedef int (*rte_dma_access_group_create_t)(const structrte_dma_dev*dev,rte_uuid_ttoken,lib/dmadev/rte_dmadev_pmd.h +3
-0+ uint16_t *group_id); + +/** @internal Used to destroy an access group if all other devices have exited. */
+typedef int (*rte_dma_access_group_destroy_t)(const structrte_dma_dev*dev,uint16_tgroup_id);lib/dmadev/rte_dmadev_pmd.h +2
-0+ +/** @internal Used to join an access group for inter-process or inter-OS DMA transfers. */
+typedef int (*rte_dma_access_group_join_t)(const structrte_dma_dev*dev,uint16_tgroup_id,lib/dmadev/rte_dmadev_pmd.h +3
-0+ rte_uuid_t token); + +/** @internal Used to leave an access group, removing the device from the group. */
+typedef int (*rte_dma_access_group_leave_t)(const structrte_dma_dev*dev,uint16_tgroup_id);lib/dmadev/rte_dmadev_pmd.h +3
-0+ +/** @internal Used to retrieve the size of an access group. */ +typedef uint16_t (*rte_dma_access_group_size_get_t)(const struct
rte_dma_dev*dev,lib/dmadev/rte_dmadev_pmd.h +3
-0+ uint16_t group_id); + +/** @internal Used to retrieve the access group table containing handler information. */
+typedef int (*rte_dma_access_group_get_t)(const structrte_dma_dev*dev,uint16_tgroup_id,lib/dmadev/rte_dmadev_pmd.h +2
-0+ uint64_t *group_tbl, uint16_t size); +/**
* DMA device operations function pointer table.
*lib/dmadev/rte_dmadev_pmd.h +8
-0@@ -83,6 +108,13 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_group_create_t access_group_create; +rte_dma_access_group_destroy_t access_group_destroy; +rte_dma_access_group_join_t access_group_join; +rte_dma_access_group_leave_t access_group_leave; +rte_dma_access_group_size_get_t access_group_size_get; +rte_dma_access_group_get_t access_group_get; };/** @@ -131,6 +163,7 @@ struct __rte_cache_aligned rte_dma_dev {/** Functions implemented by PMD. */ const struct rte_dma_dev_ops *dev_ops;enum rte_dma_dev_state state;/**< Flag indicating the device state. */ +struct rte_dma_dev_cb_list list_cbs;/**< Event callback list. */ uint64_t reserved[2 ];/**< Reserved for future fields. */ };@@ -180,6 +213,21 @@ int rte_dma_pmd_release(const char *name);
__rte_internal
structrte_dma_dev*rte_dma_pmd_get_dev_by_id(int16_tdev_id);+/**
+ * @internal
+ * Process and invoke all registered PMD (Poll Mode Driver) callbacks for a given DMA event.
+ *
+ * This function is typically called by the driver when a specific DMA event occurs,
+ * triggering all registered callbacks for the specified device and event type.
+ *
+ * @param dev
+ * Pointer to the DMA device structure.
+ * @param event
+ * The DMA event type to process.
+ */lib/dmadev/rte_dmadev_pmd.h +2
-0+__rte_internal +void rte_dma_event_pmd_callback_process(struct rte_dma_dev *dev,enum
rte_dma_eventevent);
+
#ifdef__cplusplus
}
#endiflib/dmadev/rte_dmadev_trace.h +2
-0@@ -32,6 +32,8 @@ RTE_TRACE_POINT(rte_trace_point_emit_i16 (dev_info->numa_node);rte_trace_point_emit_u16 (dev_info->nb_vchans);rte_trace_point_emit_u16 (dev_info->nb_priorities); +rte_trace_point_emit_u16 (dev_info->nb_access_groups); +rte_trace_point_emit_u16 (dev_info->controller_id); )RTE_TRACE_POINT(
lib/dmadev/rte_dmadev_trace.h +49
-0@@ -79,6 +81,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->inter_transfer.transfer_type); +rte_trace_point_emit_u16 (conf->inter_transfer.src_handler); +rte_trace_point_emit_u16 (conf->inter_transfer.dst_handler);rte_trace_point_emit_int (ret); )@@ -98,6 +103,52 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (ret); ) +RTE_TRACE_POINT ( + rte_dma_trace_access_group_create, + RTE_TRACE_POINT_ARGS(int16_t dev_id, rte_uuid_t token, uint16_t *group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u8_ptr (&token[0 ]); +rte_trace_point_emit_ptr (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_group_destroy, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_group_join, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t group_id, rte_uuid_t token), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (group_id); +rte_trace_point_emit_u8_ptr (&token[0 ]); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_group_leave, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_group_size_get, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_group_get, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t group_id, uint64_t *group_tbl, uint16_t size), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (group_id); +rte_trace_point_emit_ptr (group_tbl); +rte_trace_point_emit_u16 (size); +) +#ifdef
__cplusplus
}
#endif
--
2.34.1
Hi Vamsi,
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views. I prefer not add this part if no response.
2. Data API: this commit provide two way (vchan and flags) to use this feature, I'd rather stick to one, that way, so the app won't go haywire.
The vchan scheme seems inflexible. If you want to update communication objects frequently during operation, the vchan needs to be recreated.
I prefer reserved 16bit from flags (not 32bit because it seem has no such requirement).
[1] https://mails.dpdk.org/archives/dev/2023-August/274590.html
Thanks
Quoted 64 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized environments.
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Callsrte_dma_access_group_create(group_token, &group_id)to create a new access group.
Sharesgroup_idandgroup_tokenwith Process 2 via IPC.
2) Process 2 (Group Joiner):
Receivesgroup_idandgroup_tokenfrom Process 1.
Callsrte_dma_access_group_join(group_id, group_token)to join the group.
3) Both Processes:
Userte_dma_access_group_size_get()to check the number of devices in the group.
Userte_dma_access_group_get()to retrieve the group table and handler information.Perform DMA transfers as needed.
4) Process 2 (when done):
Callsrte_dma_access_group_leave(group_id)to leave the group.
5) Process 1:
ReceivesRTE_DMA_EVENT_ACCESS_TABLE_UPDATEto be notified of group changes.
Usesrte_dma_access_group_size_get()to confirm the group size.This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
Signed-off-by Vamsi Attunuru <[email protected]>--- lib/dmadev/rte_dmadev.c | 320 ++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 255 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 48 +++++ lib/dmadev/rte_dmadev_trace.h | 51 ++++++ 4 files changed, 674 insertions(+)
...
Hi Feng,
Quoted 15 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views. I prefer not add ZjQcmQRYFpfptBannerStart Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments <https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3T9Z- UaB9Q3kwcmX07bQhw79tV6mlwlrOb9n3vIajFjxJ5sRC- Nz7n4irgY7TdHyR9yFdqJLsDhQdEN-Kf3T4NpkFvRVx8_TE$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Hi Vamsi,
Quoted 6 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part if no response.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Quoted 8 lines
2. Data API: this commit provide two way (vchan and flags) to use this feature, I'd rather
stick to one, that way, so the app won't go haywire.The vchan scheme seems inflexible. If you want to update communication
objects frequently
during operation, the vchan needs to be recreated.
The vchan mechanism extends support for any PMD that may require any other additional metadata (pasid, streamID etc) --specific to certain architectures. However, the flags field to be fully utilized, and may not accommodate further extensions if vchan needs to carry more information.
Quoted 3 lines
I prefer reserved 16bit from flags (not 32bit because it seem has no such
requirement).
16bits for both handles may be too limiting , especially if PMD requires a larger identifier in the future.
Quoted 80 lines
[1] https://urldefense.proofpoint.com/v2/url?u=https-
3A__mails.dpdk.org_archives_dev_2023- 2DAugust_274590.html&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=WllrYa umVkxaWjgKto6E_rtDQshhIhik2jkvzFyRhW8&m=luChQIFb4mhp46WDuPsT- lWtl6PWi3-9eUETNB3QKNP7xpKB6XWHmzEjx2SA- oXi&s=x2bfetryux8bDrWpG2KnB9Df4abCAQnSUy2CEpUTDtA&e=Thanks
Quoted 18 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
Quoted 6 lines
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized
environments.
Quoted 19 lines
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Callsrte_dma_access_group_create(group_token, &group_id)to create a new access group.
Sharesgroup_idandgroup_tokenwith Process 2 via IPC.
2) Process 2 (Group Joiner):
Receivesgroup_idandgroup_tokenfrom Process 1.
Callsrte_dma_access_group_join(group_id, group_token)to join the group.
3) Both Processes:
Userte_dma_access_group_size_get()to check the number of devices in the group.
Userte_dma_access_group_get()to retrieve the group table and handler information.Quoted 6 lines
Perform DMA transfers as needed.
4) Process 2 (when done):
Callsrte_dma_access_group_leave(group_id)to leave the group.
5) Process 1:
ReceivesRTE_DMA_EVENT_ACCESS_TABLE_UPDATEto be notified ofgroup
Quoted 10 lines
changes.
Usesrte_dma_access_group_size_get()to confirm the group size.This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
Signed-off-by Vamsi Attunuru <[email protected]>--- lib/dmadev/rte_dmadev.c | 320++++++++++++++++++++++++++++++++++
Quoted 5 lines
lib/dmadev/rte_dmadev.h | 255 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 48 +++++ lib/dmadev/rte_dmadev_trace.h | 51 ++++++ 4 files changed, 674 insertions(+)...
Hi Feng, Anatoly,
Gentle ping for below review.
Quoted 144 lines
-----Original Message-----
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter- OS DMAHi Feng,
Quoted 16 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views. I prefer not add ZjQcmQRYFpfptBannerStart Prioritize security for external
emails:
Confirm sender and content safety before clicking links or opening attachments <https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3T9Z- UaB9Q3kwcmX07bQhw79tV6mlwlrOb9n3vIajFjxJ5sRC- Nz7n4irgY7TdHyR9yFdqJLsDhQdEN-Kf3T4NpkFvRVx8_TE$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Hi Vamsi,Quoted 6 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part if noresponse.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Quoted 8 lines
2. Data API: this commit provide two way (vchan and flags) to use this feature, I'd rather
stick to one, that way, so the app won't go haywire.The vchan scheme seems inflexible. If you want to update
communication objects frequently
during operation, the vchan needs to be recreated.The vchan mechanism extends support for any PMD that may require any other additional metadata (pasid, streamID etc) --specific to certain architectures. However, the flags field to be fully utilized, and may not accommodate further extensions if vchan needs to carry more information.
Quoted 3 lines
I prefer reserved 16bit from flags (not 32bit because it seem has no
such requirement).16bits for both handles may be too limiting , especially if PMD requires a larger identifier in the future.
Quoted 4 lines
[1] https://urldefense.proofpoint.com/v2/url?u=https-
3A__mails.dpdk.org_archives_dev_2023- 2DAugust_274590.html&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=WllrYa
Quoted 25 lines
umVkxaWjgKto6E_rtDQshhIhik2jkvzFyRhW8&m=luChQIFb4mhp46WDuPsT- lWtl6PWi3-9eUETNB3QKNP7xpKB6XWHmzEjx2SA- oXi&s=x2bfetryux8bDrWpG2KnB9Df4abCAQnSUy2CEpUTDtA&e=
Thanks
Quoted 18 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
Quoted 14 lines
Quoted 6 lines
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized
environments.
Quoted 7 lines
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Callsrte_dma_access_group_create(group_token, &group_id)to createa
Quoted 8 lines
Quoted 8 lines
new access group.
Sharesgroup_idandgroup_tokenwith Process 2 via IPC.
2) Process 2 (Group Joiner):
Receivesgroup_idandgroup_tokenfrom Process 1.
Callsrte_dma_access_group_join(group_id, group_token)to join the group.
3) Both Processes:
Userte_dma_access_group_size_get()to check the number of devicesin
Quoted 29 lines
Quoted 10 lines
the group.
Userte_dma_access_group_get()to retrieve the group table and handler information.Perform DMA transfers as needed.
4) Process 2 (when done):
Callsrte_dma_access_group_leave(group_id)to leave the group.
5) Process 1:
ReceivesRTE_DMA_EVENT_ACCESS_TABLE_UPDATEto be notified ofgroup
Quoted 10 lines
changes.
Usesrte_dma_access_group_size_get()to confirm the group size.This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
Signed-off-by Vamsi Attunuru <[email protected]>--- lib/dmadev/rte_dmadev.c | 320++++++++++++++++++++++++++++++++++
Quoted 5 lines
lib/dmadev/rte_dmadev.h | 255 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 48 +++++ lib/dmadev/rte_dmadev_trace.h | 51 ++++++ 4 files changed, 674 insertions(+)...
Hi Vamsi,
I think it's hard to agree on the control API in a short time. Let's focus on the datapath API.
Quoted 53 lines · Vamsi Krishna Attunuru
Hi Feng, Anatoly,
Gentle ping for below review.
Quoted 49 lines
-----Original Message-----
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter- OS DMAHi Feng,
Quoted 16 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views. I prefer not add ZjQcmQRYFpfptBannerStart Prioritize security for external
emails:
Confirm sender and content safety before clicking links or opening attachments <https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3T9Z- UaB9Q3kwcmX07bQhw79tV6mlwlrOb9n3vIajFjxJ5sRC- Nz7n4irgY7TdHyR9yFdqJLsDhQdEN-Kf3T4NpkFvRVx8_TE$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Hi Vamsi,Quoted 6 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part if noresponse.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Quoted 8 lines
2. Data API: this commit provide two way (vchan and flags) to use this feature, I'd rather
stick to one, that way, so the app won't go haywire.The vchan scheme seems inflexible. If you want to update
communication objects frequently
during operation, the vchan needs to be recreated.
OK, Let's continue with this scheme.
Quoted 96 lines
Quoted 95 lines
The vchan mechanism extends support for any PMD that may require any other additional metadata (pasid, streamID etc) --specific to certain architectures. However, the flags field to be fully utilized, and may not accommodate further extensions if vchan needs to carry more information.
Quoted 3 lines
I prefer reserved 16bit from flags (not 32bit because it seem has no
such requirement).16bits for both handles may be too limiting , especially if PMD requires a larger identifier in the future.
Quoted 4 lines
[1] https://urldefense.proofpoint.com/v2/url?u=https-
3A__mails.dpdk.org_archives_dev_2023- 2DAugust_274590.html&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=WllrYa
Quoted 25 lines
umVkxaWjgKto6E_rtDQshhIhik2jkvzFyRhW8&m=luChQIFb4mhp46WDuPsT- lWtl6PWi3-9eUETNB3QKNP7xpKB6XWHmzEjx2SA- oXi&s=x2bfetryux8bDrWpG2KnB9Df4abCAQnSUy2CEpUTDtA&e=
Thanks
Quoted 18 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
Quoted 14 lines
Quoted 6 lines
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized
environments.
Quoted 7 lines
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Callsrte_dma_access_group_create(group_token, &group_id)to createa
Quoted 8 lines
Quoted 8 lines
new access group.
Sharesgroup_idandgroup_tokenwith Process 2 via IPC.
2) Process 2 (Group Joiner):
Receivesgroup_idandgroup_tokenfrom Process 1.
Callsrte_dma_access_group_join(group_id, group_token)to join the group.
3) Both Processes:
Userte_dma_access_group_size_get()to check the number of devicesin
Quoted 29 lines
Quoted 10 lines
the group.
Userte_dma_access_group_get()to retrieve the group table and handler information.Perform DMA transfers as needed.
4) Process 2 (when done):
Callsrte_dma_access_group_leave(group_id)to leave the group.
5) Process 1:
ReceivesRTE_DMA_EVENT_ACCESS_TABLE_UPDATEto be notified ofgroup
Quoted 10 lines
changes.
Usesrte_dma_access_group_size_get()to confirm the group size.This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
Signed-off-by Vamsi Attunuru <[email protected]>--- lib/dmadev/rte_dmadev.c | 320++++++++++++++++++++++++++++++++++
Quoted 5 lines
lib/dmadev/rte_dmadev.h | 255 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 48 +++++ lib/dmadev/rte_dmadev_trace.h | 51 ++++++ 4 files changed, 674 insertions(+)...
Quoted 13 lines
-----Original Message-----
From: Vamsi Krishna Attunuru <[email protected]>
Sent: Wednesday, September 24, 2025 9:45 AM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter-OS DMA
Quoted 36 lines
Hi Feng, Anatoly,
Gentle ping for below review.
Quoted 32 lines
-----Original Message-----
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter- OS DMAHi Feng,
Quoted 7 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views
ZjQcmQRYFpfptBannerEnd
Hi Vamsi,Quoted 7 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part if
noresponse.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Beyond adding Intel folks to this thread, I don't see any further steps we can take to drive review at this stage.
That said, the table-based concept used in the current API may not be portable, and we may need improvements here.
Based on my understanding, DMA devices used for inter process copy can be classified into three categories:
Class A: Requires a pair of DMA devices (one on each end of process/domain) for data transfer. Marvell DMA devices fall into this category. Class B: Requires only a single DMA device (one process/domain has a DMA device, the other process does not). Intel DMA devices fall here. Class C: Other types of devices that we are not yet aware of.
Abstracting all of these under a single API will be challenging. Linux and other OSes do not provide control-plane APIs for this, so DPDK must provide control plane mechanisms to support Class A, Class B, and Class C devices.
Proposal: Split development into separate sets:
-----------------------------------------------
Set A: Focus only on the datapath. Assume uint16_t *src_handle and uint16_t *dst_handle come from elsewhere (Class C). Set B: Introduce capabilities for Class A devices with portable APIs (proposal below, without table concept). Set C: Introduce capabilities for Class B devices and relevant APIs, to be added when needed.
We can merge Set A in the current release and move Set B to a next release _if_ review or support for Class A devices requires more time.
@fengchengwen Thoughts?
Class A API Proposal:
---------------------
These APIs are based on a new capability flag for inter-process or inter-OS DMA transfers for Class A devices.
/** Creates an access group for pair-type inter-process or inter-OS DMA transfers. */ int rte_dma_access_pair_group_create(const struct rte_dma_dev *dev,
rte_uuid_t process_id,
rte_uuid_t token,
uint16_t *group_id);/** Destroys an access group once all participating devices have exited. */ int rte_dma_access_pair_group_destroy(const struct rte_dma_dev *dev,
uint16_t group_id);
/** Allows a device to join an existing access group using a device handle and token. */ int rte_dma_access_pair_group_join(const struct rte_dma_dev *dev,
uint16_t group_id,
rte_uuid_t process_id,
rte_uuid_t token,
rte_dma_access_pair_leave_cb_t leave_cb);/** Removes a device from an access group. */
int rte_dma_access_pair_group_leave(const struct rte_dma_dev *dev,
uint16_t group_id);
/** Retrieves the source and destination handles for a given device within the group. */ int rte_dma_access_pair_gorup_src_dst_handles_get(const struct rte_dma_dev *dev,
uint16_t group_id,
rte_uuid_t src_process_id,
rte_uuid_t dst_process_id,
uint16_t *src_handle,
uint16_t *dst_handle);Parameters that need explanation:
--------------------------------process_id: Unique ID for the process, generated via rte_uuid_ APIs
token: Provided by an administrative actor to grant access, similar to VFIO VF token creation used in VFIO PF driver.leave_cb: Callback to notify when another side leaves the group
Example Workflow for Class A Inter-Domain DMA Transfer:
-------------------------------------------------------
This example demonstrates how three processes — p0, p1, and p2 — coordinate inter-domain DMA transfers using pair-type(Class A) DMA devices.
Step 1: Group Creation (p0)
Process p0 calls rte_dma_access_pair_group_create() with a unique process handle and token. A group_id is returned.
Step 2: Group Sharinggroup_id and token are shared with p1 and p2 via IPC or shared memory.
Step 3: Group Joining (p1 & p2)
Processes p1 and p2 call rte_dma_access_pair_group_join() with their process id and the shared token from admin
Step 4: Handle Discovery
Each process uses rte_dma_access_pair_gorup_src_dst_handles_get() to retrieve source and destination handles for other processes.
Step 5: Transfer Coordination
Using the handles, each process configures a virtual channel (vchan) and initiates DMA transfers.
Step 6: Group Teardown
When a process no longer needs to participate, it calls rte_dma_access_pair_group_leave(). Other processes are notified via the registered callback with rte_dma_access_pair_group_join(). Once all devices have exited, p0 calls rte_dma_access_pair_group_destroy() to clean up.
For Class B: We can add new capability flag and have new set of APIs rte_dma_access_master_ or so. When such devices comes or when intel wants to add it
Hi Feng, Anatoly
Could please review below proposal and share your thoughts.
Regards
Vamsi
Quoted 154 lines
Quoted 32 lines
-----Original Message-----
From: Vamsi Krishna Attunuru <[email protected]>Quoted 30 lines
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and
inter- OS DMAHi Feng,
Quoted 5 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views ZjQcmQRYFpfptBannerEnd Hi Vamsi,
Quoted 7 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part
if noresponse.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Beyond adding Intel folks to this thread, I don't see any further steps we can take to drive review at this stage.
That said, the table-based concept used in the current API may not be portable, and we may need improvements here.
Based on my understanding, DMA devices used for inter process copy can be classified into three categories:
Class A: Requires a pair of DMA devices (one on each end of process/domain) for data transfer. Marvell DMA devices fall into this category. Class B: Requires only a single DMA device (one process/domain has a DMA device, the other process does not). Intel DMA devices fall here. Class C: Other types of devices that we are not yet aware of.
Abstracting all of these under a single API will be challenging. Linux and other OSes do not provide control-plane APIs for this, so DPDK must provide control plane mechanisms to support Class A, Class B, and Class C devices.
Proposal: Split development into separate sets:
-----------------------------------------------
Set A: Focus only on the datapath. Assumeuint16_t*src_handleanduint16_t*dst_handlecome from elsewhere (Class C).
Set B: Introduce capabilities for Class A devices with portable APIs (proposal below, without table concept).
Set C: Introduce capabilities for Class B devices and relevant APIs, to be added when needed.We can merge Set A in the current release and move Set B to a next release _if_ review or support for Class A devices requires more time.
@fengchengwen Thoughts?
Class A API Proposal:
---------------------
These APIs are based on a new capability flag for inter-process or inter-OS DMA transfers for Class A devices./** Creates an access group for pair-type inter-process or inter-OS DMA transfers. */ int rte_dma_access_pair_group_create(const struct
rte_dma_dev*dev,rte_uuid_t process_id, rte_uuid_t token, uint16_t *group_id);/** Destroys an access group once all participating devices have exited. */ int rte_dma_access_pair_group_destroy(const struct
rte_dma_dev*dev,uint16_t group_id);/** Allows a device to join an existing access group using a device handle and token. */ int rte_dma_access_pair_group_join(const struct
rte_dma_dev*dev,uint16_t group_id, rte_uuid_t process_id, rte_uuid_t token, rte_dma_access_pair_leave_cb_t leave_cb);/** Removes a device from an access group. */ int rte_dma_access_pair_group_leave(const struct
rte_dma_dev*dev,uint16_t group_id);/** Retrieves the source and destination handles for a given device within the group. */ int rte_dma_access_pair_gorup_src_dst_handles_get(const struct
rte_dma_dev*dev,uint16_t group_id, rte_uuid_t src_process_id, rte_uuid_t dst_process_id, uint16_t *src_handle, uint16_t *dst_handle);Parameters that need explanation:
--------------------------------process_id: Unique ID for the process, generated viarte_uuid_APIs
token: Provided by an administrative actor to grant access, similar to VFIO VF token creation used in VFIO PF driver.leave_cb: Callback to notify when another side leaves the groupExample Workflow for Class A Inter-Domain DMA Transfer:
-------------------------------------------------------This example demonstrates how three processes — p0, p1, and p2 — coordinate inter-domain DMA transfers using pair-type(Class A) DMA devices.
Step 1: Group Creation (p0)
Process p0 callsrte_dma_access_pair_group_create()with a unique process handle and token. Agroup_idis returned.Step 2: Group Sharing
group_idand token are shared with p1 and p2 via IPC or shared memory.Step 3: Group Joining (p1 & p2)
Processes p1 and p2 callrte_dma_access_pair_group_join()with their process id and the shared token from adminStep 4: Handle Discovery
Each process usesrte_dma_access_pair_gorup_src_dst_handles_get()to retrieve source and destination handles for other processes.Step 5: Transfer Coordination
Using the handles, each process configures a virtual channel (vchan) and initiates DMA transfers.Step 6: Group Teardown
When a process no longer needs to participate, it callsrte_dma_access_pair_group_leave(). Other processes are notified via the registered callback withrte_dma_access_pair_group_join(). Once all devices have exited, p0 callsrte_dma_access_pair_group_destroy()to clean up.For Class B: We can add new capability flag and have new set of APIs
rte_dma_access_master_or so. When such devices comes or when intel wants to add it
Hi Feng, Bruce, Kevin,
Could you please review the proposal below and share your thoughts. we are seeking your feedback on this feature to ensure alignment before the rc deadlines.
Regards
Vamsi
Quoted 161 lines
Quoted 37 lines
Quoted 32 lines
-----Original Message-----
From: Vamsi Krishna Attunuru <[email protected]>Quoted 30 lines
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and
inter- OS DMAHi Feng,
Quoted 5 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views ZjQcmQRYFpfptBannerEnd Hi Vamsi,
Quoted 7 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part
if noresponse.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Beyond adding Intel folks to this thread, I don't see any further steps we can take to drive review at this stage.
Quoted 8 lines
That said, the table-based concept used in the current API may not be portable, and we may need improvements here.
Based on my understanding, DMA devices used for inter process copy can be classified into three categories:
Class A: Requires a pair of DMA devices (one on each end of process/domain) for data transfer. Marvell DMA devices fall into this
category.
Quoted 7 lines
Class B: Requires only a single DMA device (one process/domain has a DMA device, the other process does not). Intel DMA devices fall here. Class C: Other types of devices that we are not yet aware of.
Abstracting all of these under a single API will be challenging. Linux and other OSes do not provide control-plane APIs for this, so DPDK must provide control plane mechanisms to support Class A, Class B, and Class C
devices.
Quoted 24 lines
Proposal: Split development into separate sets:
-----------------------------------------------
Set A: Focus only on the datapath. Assumeuint16_t*src_handleanduint16_t*dst_handlecome from elsewhere (Class C).
Set B: Introduce capabilities for Class A devices with portable APIs (proposal below, without table concept).
Set C: Introduce capabilities for Class B devices and relevant APIs, to be added when needed.We can merge Set A in the current release and move Set B to a next release _if_ review or support for Class A devices requires more time.
@fengchengwen Thoughts?
Class A API Proposal:
---------------------
These APIs are based on a new capability flag for inter-process or inter-OS DMA transfers for Class A devices./** Creates an access group for pair-type inter-process or inter-OS DMA transfers. */ int rte_dma_access_pair_group_create(const struct
rte_dma_dev*dev,Quoted 6 lines
rte_uuid_t process_id, rte_uuid_t token, uint16_t *group_id);/** Destroys an access group once all participating devices have exited. */ int rte_dma_access_pair_group_destroy(const struct
rte_dma_dev*dev,Quoted 11 lines
uint16_t group_id);/** Allows a device to join an existing access group using a device handle and token. */ int rte_dma_access_pair_group_join(const struct
rte_dma_dev*dev,uint16_t group_id, rte_uuid_t process_id, rte_uuid_t token, rte_dma_access_pair_leave_cb_t
leave_cb);Quoted 7 lines
/** Removes a device from an access group. */ int rte_dma_access_pair_group_leave(const struct
rte_dma_dev*dev,uint16_t group_id);/** Retrieves the source and destination handles for a given device within the group. */ int rte_dma_access_pair_gorup_src_dst_handles_get(const struct
rte_dma_dev*dev,Quoted 15 lines
uint16_t group_id, rte_uuid_t src_process_id, rte_uuid_t dst_process_id, uint16_t *src_handle, uint16_t *dst_handle);Parameters that need explanation:
--------------------------------process_id: Unique ID for the process, generated viarte_uuid_APIs
token: Provided by an administrative actor to grant access, similar to VFIO VF token creation used in VFIO PF driver.leave_cb: Callback to notify when another side leaves the groupQuoted 5 lines
Example Workflow for Class A Inter-Domain DMA Transfer:
-------------------------------------------------------This example demonstrates how three processes — p0, p1, and p2 — coordinate inter-domain DMA transfers using pair-type(Class A) DMA
devices.
Quoted 36 lines
Step 1: Group Creation (p0)
Process p0 callsrte_dma_access_pair_group_create()with a unique process handle and token. Agroup_idis returned.Step 2: Group Sharing
group_idand token are shared with p1 and p2 via IPC or shared memory.Step 3: Group Joining (p1 & p2)
Processes p1 and p2 callrte_dma_access_pair_group_join()with their process id and the shared token from adminStep 4: Handle Discovery
Each process usesrte_dma_access_pair_gorup_src_dst_handles_get()to retrieve source and destination handles for other processes.Step 5: Transfer Coordination
Using the handles, each process configures a virtual channel (vchan) and initiates DMA transfers.Step 6: Group Teardown
When a process no longer needs to participate, it callsrte_dma_access_pair_group_leave(). Other processes are notified via the registered callback withrte_dma_access_pair_group_join(). Once all devices have exited, p0 callsrte_dma_access_pair_group_destroy()
to clean up.For Class B: We can add new capability flag and have new set of APIs
rte_dma_access_master_or so. When such devices comes or when intel wants to add it
Quoted 70 lines · Jerin Jacob
Quoted 13 lines
-----Original Message-----
From: Vamsi Krishna Attunuru <[email protected]>
Sent: Wednesday, September 24, 2025 9:45 AM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter-OS DMAQuoted 36 lines
Hi Feng, Anatoly,
Gentle ping for below review.
Quoted 32 lines
-----Original Message-----
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter- OS DMAHi Feng,
Quoted 7 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views
ZjQcmQRYFpfptBannerEnd
Hi Vamsi,Quoted 7 lines
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part if
noresponse.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Beyond adding Intel folks to this thread, I don't see any further steps we can take to drive review at this stage.
That said, the table-based concept used in the current API may not be portable, and we may need improvements here.
Based on my understanding, DMA devices used for inter process copy can be classified into three categories:
Class A: Requires a pair of DMA devices (one on each end of process/domain) for data transfer. Marvell DMA devices fall into this category. Class B: Requires only a single DMA device (one process/domain has a DMA device, the other process does not). Intel DMA devices fall here. Class C: Other types of devices that we are not yet aware of.
Abstracting all of these under a single API will be challenging. Linux and other OSes do not provide control-plane APIs for this, so DPDK must provide control plane mechanisms to support Class A, Class B, and Class C devices.
Proposal: Split development into separate sets:
-----------------------------------------------
Set A: Focus only on the datapath. Assumeuint16_t*src_handleanduint16_t*dst_handlecome from elsewhere (Class C). Set B: Introduce capabilities for Class A devices with portable APIs (proposal below, without table concept). Set C: Introduce capabilities for Class B devices and relevant APIs, to be added when needed.
Quoted 3 lines
We can merge Set A in the current release and move Set B to a next release _if_ review or support for Class A devices requires more time.
@fengchengwen Thoughts?
okay
Quoted 11 lines
Class A API Proposal:
---------------------
These APIs are based on a new capability flag for inter-process or inter-OS DMA transfers for Class A devices./** Creates an access group for pair-type inter-process or inter-OS DMA transfers. */ int rte_dma_access_pair_group_create(const struct
rte_dma_dev*dev,rte_uuid_t process_id, rte_uuid_t token, uint16_t *group_id);
how about rte_dma_access_group_create(), and add pair-type as one parameter, and also rename process_id as domain_id
Quoted 4 lines
/** Destroys an access group once all participating devices have exited. */ int rte_dma_access_pair_group_destroy(const struct
rte_dma_dev*dev,uint16_t group_id);
rte_dma_access_group_destroy()
Quoted 7 lines
/** Allows a device to join an existing access group using a device handle and token. */ int rte_dma_access_pair_group_join(const struct
rte_dma_dev*dev,uint16_t group_id, rte_uuid_t process_id, rte_uuid_t token, rte_dma_access_pair_leave_cb_t leave_cb);
rte_dma_access_group_join()
Quoted 5 lines
/** Removes a device from an access group. */
int rte_dma_access_pair_group_leave(const structrte_dma_dev*dev,uint16_t group_id);
Quoted 7 lines
/** Retrieves the source and destination handles for a given device within the group. */ int rte_dma_access_pair_gorup_src_dst_handles_get(const struct
rte_dma_dev*dev,uint16_t group_id, rte_uuid_t src_process_id, rte_uuid_t dst_process_id, uint16_t *src_handle, uint16_t *dst_handle);
rte_dma_access_group_handle_get(const struct rte_dma_dev *dev,
uint16_t group_id, rte_uuid_t domain_id, uint16_t *handle);
so user could invoke multiple time if they want to get differ domain_id's handle.
Quoted 9 lines
Parameters that need explanation:
--------------------------------process_id: Unique ID for the process, generated viarte_uuid_APIs
token: Provided by an administrative actor to grant access, similar to VFIO VF token creation used in VFIO PF driver.leave_cb: Callback to notify when another side leaves the group
Quoted 7 lines
Example Workflow for Class A Inter-Domain DMA Transfer:
-------------------------------------------------------This example demonstrates how three processes — p0, p1, and p2 — coordinate inter-domain DMA transfers using pair-type(Class A) DMA devices.
Step 1: Group Creation (p0)
Process p0 callsrte_dma_access_pair_group_create()with a unique process handle and token. Agroup_idis returned.
I prefer the group_id is int type so it could hold such like file descriptor.
Quoted 24 lines
Step 2: Group Sharing
group_idand token are shared with p1 and p2 via IPC or shared memory.Step 3: Group Joining (p1 & p2)
Processes p1 and p2 callrte_dma_access_pair_group_join()with their process id and the shared token from adminStep 4: Handle Discovery
Each process usesrte_dma_access_pair_gorup_src_dst_handles_get()to retrieve source and destination handles for other processes.Step 5: Transfer Coordination
Using the handles, each process configures a virtual channel (vchan) and initiates DMA transfers.Step 6: Group Teardown
When a process no longer needs to participate, it callsrte_dma_access_pair_group_leave(). Other processes are notified via the registered callback withrte_dma_access_pair_group_join(). Once all devices have exited, p0 callsrte_dma_access_pair_group_destroy()to clean up.For Class B: We can add new capability flag and have new set of APIs
rte_dma_access_master_or so. When such devices comes or when intel wants to add it
Quoted 103 lines
-----Original Message-----
From: fengchengwen <[email protected]>
Sent: Thursday, October 9, 2025 4:38 PM
To: Jerin Jacob <[email protected]>; Vamsi Krishna Attunuru <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter-OS DMAOn 10/1/2025 1: 57 PM, Jerin Jacob wrote: > > >> -----Original Message----- >>
From: Vamsi Krishna Attunuru <vattunuru@ marvell. com> >> Sent: Wednesday, September 24, 2025 9: 45 AM >> To: fengchengwen
<fengchengwen@ huawei. com>; ZjQcmQRYFpfptBannerStart Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments
<https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3TtN_0At8aXkwdmd36TTsseJBpLJzj Bf476S3kPQRmBpOSGmkKThlH1pYubSu5HYYCYrmGWL- Qw4sZgCDipBGcUjhqTJuU9g$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Quoted 43 lines · Jerin Jacob
Quoted 43 lines
-----Original Message-----
From: Vamsi Krishna Attunuru <[email protected]>
Sent: Wednesday, September 24, 2025 9:45 AM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and inter-OS DMAHi Feng, Anatoly,
Gentle ping for below review.
Quoted 26 lines
-----Original Message-----
From: Vamsi Krishna Attunuru
Sent: Monday, September 22, 2025 5:19 PM
To: fengchengwen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: RE: [EXTERNAL] Re: [RFC] lib/dma: introduce inter-process and
inter- OS DMAHi Feng,
Quoted 12 lines
Hi Vamsi, This commit change is more than discussed, it add control API which for group management. 1. Control API: I check this commit and Intel commit [1], it seem has a quite difference. I hope Intel guys can express views ZjQcmQRYFpfptBannerEnd Hi Vamsi,
This commit change is more than discussed, it add control API which for group management.
1. Control API: I check this commit and Intel commit [1], it seem has a quite difference.
I hope Intel guys can express views. I prefer not add this part
if noQuoted 8 lines
Quoted 5 lines
Quoted 5 lines
response.
This new feature needs to be securely managed through control APIs. It would be extremely helpful if the folks at Intel and you as well could provide support or inputs on this.
Beyond adding Intel folks to this thread, I don't see any further steps we can
take to drive review at this stage.
Quoted 2 lines
That said, the table-based concept used in the current API may not be
portable, and we may need improvements here.
Quoted 2 lines
Based on my understanding, DMA devices used for inter process copy can be
classified into three categories:
Quoted 2 lines
Class A: Requires a pair of DMA devices (one on each end of process/domain)
for data transfer. Marvell DMA devices fall into this category.
Quoted 1 line
Class B: Requires only a single DMA device (one process/domain has a DMA
device, the other process does not). Intel DMA devices fall here.
Quoted 4 lines
Class C: Other types of devices that we are not yet aware of.
Abstracting all of these under a single API will be challenging. Linux and other OSes do not provide control-plane APIs for this, so DPDK must
provide control plane mechanisms to support Class A, Class B, and Class C devices.
Quoted 4 lines
Proposal: Split development into separate sets:
-----------------------------------------------
Set A: Focus only on the datapath. Assumeuint16_t*src_handleanduint16_t
*dst_handlecome from elsewhere (Class C).Quoted 1 line
Set B: Introduce capabilities for Class A devices with portable APIs (proposal
below, without table concept).
Quoted 1 line
Set C: Introduce capabilities for Class B devices and relevant APIs, to be added
Quoted 8 lines
when needed.
Quoted 2 lines
We can merge Set A in the current release and move Set B to a next release
_if_ review or support for Class A devices requires more time.
Quoted 2 lines
@fengchengwen Thoughts?
okay
Okay.
# We will send Set A and Set B as separate series.
We can review Set A first and merge and then Set B as time permits.
Quoted 8 lines
Quoted 5 lines
Class A API Proposal:
---------------------
These APIs are based on a new capability flag for inter-process or inter-OSDMA transfers for Class A devices.
Quoted 2 lines
Quoted 8 lines
Quoted 2 lines
/** Creates an access group for pair-type inter-process or inter-OS DMA transfers. */ int rte_dma_access_pair_group_create(const struct
rte_dma_dev*dev,Quoted 3 lines
rte_uuid_t process_id, rte_uuid_t token, uint16_t *group_id);how about
rte_dma_access_group_create(), and add pair-type as one
In Class B case, the peer process does not need to create the group and it may NOT be the same API. At minimum, arguments will change. In that context, having separate API for class A and Class B will be easy. And it will be rte_dma_access_pair_ and rte_dma_access_single_ respective name space.
Quoted 1 line
parameter, and also rename
process_idasdomain_id
We will change to domain_id.
Quoted 12 lines
Quoted 4 lines
/** Destroys an access group once all participating devices have exited. */ int rte_dma_access_pair_group_destroy(const struct
rte_dma_dev*dev,
Quoted 1 line
uint16_t group_id);
rte_dma_access_group_destroy()Quoted 3 lines
/** Allows a device to join an existing access group using a device handle and token. */ int rte_dma_access_pair_group_join(const struct
Quoted 8 lines
rte_dma_dev*dev,Quoted 5 lines
uint16_t group_id, rte_uuid_t process_id, rte_uuid_t token, rte_dma_access_pair_leave_cb_t
leave_cb);
rte_dma_access_group_join()
Same as above.
Quoted 16 lines
Quoted 8 lines
/** Removes a device from an access group. */ int rte_dma_access_pair_group_leave(const struct
rte_dma_dev*dev,uint16_t group_id);/** Retrieves the source and destination handles for a given device within the group. */ int
rte_dma_access_pair_gorup_src_dst_handles_get(const struct
rte_dma_dev*dev,Quoted 5 lines
uint16_t group_id, rte_uuid_t src_process_id, rte_uuid_t dst_process_id, uint16_t *src_handle, uint16_t *dst_handle);
Quoted 6 lines
rte_dma_access_group_handle_get(const struct
rte_dma_dev*dev,uint16_t group_id, rte_uuid_t domain_id, uint16_t *handle);so user could invoke multiple time if they want to get differ domain_id's handle.
Yes.
Quoted 14 lines
Quoted 7 lines
Parameters that need explanation:
--------------------------------process_id: Unique ID for the process, generated viarte_uuid_APIs
token: Provided by an administrative actor to grant access, similar to VFIO VFtoken creation used in VFIO PF driver.
Quoted 6 lines
leave_cb: Callback to notify when another side leaves the groupExample Workflow for Class A Inter-Domain DMA Transfer:
-------------------------------------------------------
Quoted 8 lines
Quoted 1 line
This example demonstrates how three processes — p0, p1, and p2 —
coordinate inter-domain DMA transfers using pair-type(Class A) DMA devices.
Quoted 3 lines
Step 1: Group Creation (p0)
Process p0 callsrte_dma_access_pair_group_create()with a unique processhandle and token. A
group_idis returned.I prefer the
group_idis int type so it could hold such like file descriptor.
Will do.
Quoted 33 lines
Quoted 11 lines
Step 2: Group Sharing
group_idand token are shared with p1 and p2 via IPC or shared memory.Step 3: Group Joining (p1 & p2)
Processes p1 and p2 callrte_dma_access_pair_group_join()with their process id and the shared token from adminStep 4: Handle Discovery
Each process usesrte_dma_access_pair_gorup_src_dst_handles_get()toretrieve source and destination handles for other processes.
Quoted 3 lines
Step 5: Transfer Coordination
Using the handles, each process configures a virtual channel (vchan) andinitiates DMA transfers.
Quoted 3 lines
Step 6: Group Teardown
When a process no longer needs to participate, it calls
rte_dma_access_pair_group_leave(). Other processes are notified via the registered callback withrte_dma_access_pair_group_join().Quoted 1 line
Once all devices have exited, p0 calls
rte_dma_access_pair_group_destroy()toclean up.
Quoted 10 lines
For Class B: We can add new capability flag and have new set of APIs
rte_dma_access_master_or so. When such devices comes or when intel wants to add it
Quoted 58 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process or inter-OS DMA transfers. It provides two mechanisms for specifying source and destination handlers: either through the vchan configuration or via the flags parameter in DMA enqueue APIs. This commit also adds a controller ID field to specify the device hierarchy details when applicable.
To ensure secure and controlled DMA transfers, this commit adds a set of APIs for creating and managing access groups. Devices can create or join an access group using token-based authentication, and only devices within the same group are permitted to perform DMA transfers across processes or OS domains. This approach enhances security and flexibility for advanced DMA use cases in multi-tenant or virtualized environments.
The following flow demonstrates how two processes (a group creator and a group joiner) use the DMA access group APIs to securely set up and manage inter-process DMA transfers:
1) Process 1 (Group Creator):
Callsrte_dma_access_group_create(group_token, &group_id)to create a new access group.
Sharesgroup_idandgroup_tokenwith Process 2 via IPC.
2) Process 2 (Group Joiner):
Receivesgroup_idandgroup_tokenfrom Process 1.
Callsrte_dma_access_group_join(group_id, group_token)to join the group.
3) Both Processes:
Userte_dma_access_group_size_get()to check the number of devices in the group.
Userte_dma_access_group_get()to retrieve the group table and handler information.Perform DMA transfers as needed.
4) Process 2 (when done):
Callsrte_dma_access_group_leave(group_id)to leave the group.
5) Process 1:
ReceivesRTE_DMA_EVENT_ACCESS_TABLE_UPDATEto be notified of group changes.
Usesrte_dma_access_group_size_get()to confirm the group size.This flow ensures only authenticated and authorized devices can participate in inter-process or inter-OS DMA transfers, enhancing security and isolation.
Signed-off-by Vamsi Attunuru <[email protected]>---
...
Quoted 4 lines
lib/dmadev/rte_dmadev.h +3
-0+/** +* Inter-DMA transfer type. +*
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 599
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* Specifies the type of DMA transfer, indicating whether the operation +* is within the same domain, between different processes, or across different +* operating system domains. +* +* @see struct rte_dma_inter_transfer_param:transfer_type +*/ +enum rte_dma_inter_transfer_type { +RTE_DMA_INTER_TRANSFER_NONE ,/**< No inter-domain transfer. */ +RTE_DMA_INTER_PROCESS_TRANSFER ,/**< Transfer is between different processes. */ +RTE_DMA_INTER_OS_TRANSFER ,/**< Transfer is between different OS domains. */
how about rte_dma_inter_domain_type {
RTE_DMA_INTER_DOMAIN_NONE,
RTE_DMA_INTER_PRTOCESS_DOMAIN,
RTE_DMA_INTER_OS_DOMAIN,
}
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 613
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* +* This structure holds the necessary information to perform DMA transfers +* between different processes or operating system domains, including the +* transfer type and handler identifiers for the source and destination. +*/ +struct rte_dma_inter_transfer_param { +enum rte_dma_inter_transfer_type transfer_type;/**< Type of inter-domain transfer. */ +uint16_t src_handler;/**< Source handler identifier. */ +uint16_t dst_handler;/**< Destination handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */
how about: struct rte_dma_inter_domain_param {
enum rte_dma_inter_domain_type domain_type; /**< Type of inter-domain. */ uint16_t src_handler; /**< Source domain handler identifier. */ uint16_t dst_handler; /**< Destination domain handler identifier. */ uint64_t reserved[2]; /**< Reserved for future fields. */
}
It's mean local process if the src/dst_handler is zero?
for example, I setup a inter-os domain param, if the src_handle is none zero and dst_handle is zero, then all DMA copy will from another OS to local process.
all DMA fill will write to local process.
If the src_handle is zero and dst_handle is non-zero, then all DMA copy will from local process to another OS domain
all DMA fill will write to another OS domain.
If both src_handle and dst_handle is none,
then all DMA copy will from another OS to another OS domain
all DMA fill will write to another OS domain.
Please add such comments.
And also It's necessary to verify these parameters during vchan-setup.
Quoted 19 lines
lib/dmadev/rte_dmadev.h +10
-0+}; +/** * A structure used to configure a virtual DMA channel. * @@ -601,6 +650,14 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS DMA transfers to specify +* the source and destination handlers. +* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_transfer_param +*/ +struct rte_dma_inter_transfer_param inter_transfer; };
...
PATCH v2 1/1 lib/dma: introduce inter-process and inter-OS DMA
In reply to Vamsi KrishnaFrom: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
---
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enums
lib/dmadev/rte_dmadev.c | 19 ++++++++++++ lib/dmadev/rte_dmadev.h | 56 +++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 78 insertions(+)
lib/dmadev/rte_dmadev.c +19 -0
@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && + conf->domain.domain_type !=RTE_DMA_INTER_DOMAIN_NONE ) { +RTE_DMA_LOG (ERR ,"Device %d direction and inter domain are invalid!" , dev_id); +return -EINVAL ; + } +if (conf->domain.domain_type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.domain_type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM &&
@@ -805,6 +820,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },
@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );
lib/dmadev/rte_dmadev.h +56 -0
82 lines not on this page · raw message
lib/dmadev/rte_dmadev_trace.h +3 -0
@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.domain_type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
Signature · 1 line
2.34.1
Quoted 36 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru <[email protected]>---
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumslib/dmadev/rte_dmadev.c | 19 ++++++++++++ lib/dmadev/rte_dmadev.h | 56 +++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 78 insertions(+)lib/dmadev/rte_dmadev.c +0
-0
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan, · line 664
Quoted 6 lines
lib/dmadev/rte_dmadev.c +3
-0@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && + conf->domain.domain_type !=RTE_DMA_INTER_DOMAIN_NONE ) { +RTE_DMA_LOG (ERR ,"Device %d direction and inter domain are invalid!" , dev_id);
how about "Device %d inter domain only support memory-to-memory transfer" ?
so could be:
if (conf->domain.type != RTE_DMA_INTER_DOMAIN_NONE &&
conf->direction != RTE_DMA_DIR_MEM_TO_MEM)
Quoted 77 lines
lib/dmadev/rte_dmadev.c +16
-0+return -EINVAL ; + } +if (conf->domain.domain_type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.domain_type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM &&@@ -805,6 +820,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );lib/dmadev/rte_dmadev.h +20
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -418,8 +430,13 @@ int rte_dma_close(int16_t dev_id);*/ enum rte_dma_direction {/** DMA transfer direction - from memory to memory. +* When the device supports inter-process or inter-OS domain transfers, +* the field `domain_type` in `struct rte_dma_vchan_conf::domain` specifies +* the type of domain. For memory-to-memory transfers within the same domain +* or process, `domain_type` should be set to `RTE_DMA_INTER_DOMAIN_NONE`. * * @see struct rte_dma_vchan_conf::direction +* @see struct rte_dma_inter_domain_param::domain_type */ RTE_DMA_DIR_MEM_TO_MEM ,/** DMA transfer direction - from memory to device. @@ -564,6 +581,36 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +*
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 596
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* This enum defines the types of transfer domains applicable to DMA operations. +* It helps categorize whether a DMA transfer is occurring within the same domain, +* across different processes, or between distinct operating system domains. +* +* @see struct rte_dma_inter_domain_param:domain_type +*/ +enum rte_dma_inter_domain_type { +RTE_DMA_INTER_DOMAIN_NONE ,/**< No inter-domain transfer; standard DMA within same domain */ +RTE_DMA_INTER_PROCESS_DOMAIN ,/**< Transfer occurs between different user-space processes */ +RTE_DMA_INTER_OS_DOMAIN ,/**< Transfer spans across different operating system domains. */
please place the comment before the definition.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 608
Quoted 12 lines
lib/dmadev/rte_dmadev.h +12
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA transfers +* across different domains, such as between processes or operating systems. +* It includes the domain type and handler identifiers for both the source +* and destination domains. +*/ +struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type domain_type;/**< Type of inter-domain. */
please rename domian_type to type because we are in domain context.
Quoted 9 lines
lib/dmadev/rte_dmadev.h +5
-0+uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ +}; +/** * A structure used to configure a virtual DMA channel. *
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 652
Quoted 5 lines
lib/dmadev/rte_dmadev.h +2
-0@@ -601,6 +648,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field +* specifies the source and destination domain handlers required for DMA
two spaces before 'for DMA'
Quoted 24 lines
lib/dmadev/rte_dmadev.h +7
-0+* operations that span across different processes or operating system domains. +* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain; };/** lib/dmadev/rte_dmadev_trace.h +3
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.domain_type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
Quoted 47 lines · Vamsi Krishna
Quoted 11 lines
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
Quoted 3 lines
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan
configuration.
Quoted 12 lines
Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru <[email protected]>---
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumsQuoted 2 lines
lib/dmadev/rte_dmadev.c | 19 ++++++++++++ lib/dmadev/rte_dmadev.h | 56+++++++++++++++++++++++++++++++++++
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t
Quoted 8 lines
lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 78 insertions(+)lib/dmadev/rte_dmadev.c index renamed from lib/dmadev/rte_dmadev.c +0
-0
17ee0808a9..23864dcb00100644lib/dmadev/rte_dmadev.c +0
-0@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_tvchan,
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +2
-0RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && + conf->domain.domain_type !=RTE_DMA_INTER_DOMAIN_NONE ){
Quoted 6 lines
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 664
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ RTE_DMA_LOG(ERR, "Device %d direction and inter domainare
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 665
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+invalid!", dev_id);how about "Device %d inter domain only support memory-to-memory transfer" ?
Ack, will address all comments in V3. Thanks
Quoted 184 lines
so could be:
if (
conf->domain.type!=RTE_DMA_INTER_DOMAIN_NONE&&conf->direction != RTE_DMA_DIR_MEM_TO_MEM)lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +5
-0+return -EINVAL ; + } +if (conf->domain.domain_type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { + RTE_DMA_LOG(ERR, "Device %d does not support inter osdomain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 3 lines
lib/dmadev/rte_dmadev.c +3
-0+return -EINVAL ; + } + if (conf->domain.domain_type ==
RTE_DMA_INTER_PROCESS_DOMAIN&&lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 674
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ !(dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN)) {lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 675
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ RTE_DMA_LOG(ERR, "Device %d does not support interprocess domain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +2
-0+return -EINVAL ; + }if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && conf->direction !=RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM && @@ -805,6+820,8
lib/dmadev/rte_dmadev.c
Quoted 5 lines
@@
dma_capability_name(uint64_t capability)
{RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, {RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, {RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" },lib/dmadev/rte_dmadev.c +1
-0+ { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN,"
inter_process_domain" },lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd
Quoted 5 lines
lib/dmadev/rte_dmadev.c +1
-0+ { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd
__rte_unused,lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1031
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_HANDLES_ERRORS);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1032
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_M2D_AUTO_FREE);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1034
Quoted 2 lines
lib/dmadev/rte_dmadev.c +1
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); + ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1035
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_OS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd __rte_unused,
Quoted 3 lines
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL ); diff --git
Quoted 29 lines
a/lib/dmadev/rte_dmadev.hb/lib/dmadev/rte_dmadev.hindex550dbfbf75..12c249ec00100644lib/dmadev/rte_dmadev.h +14
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers +between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different +operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -418,8 +430,13 @@ int rte_dma_close(int16_t dev_id); */enum
rte_dma_direction{
/** DMA transfer direction - from memory to memory.lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* When the device supports inter-process or inter-OS domain transfers,
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* the field `domain_type` in `struct rte_dma_vchan_conf::domain` specifies
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* the type of domain. For memory-to-memory transfers within the same domain
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* or process, `domain_type` should be set to
RTE_DMA_INTER_DOMAIN_NONE.Quoted 7 lines
*
* @see structrte_dma_vchan_conf::directionlib/dmadev/rte_dmadev.h +1
-0+* @see struct rte_dma_inter_domain_param::domain_type */ RTE_DMA_DIR_MEM_TO_MEM,/** DMA transfer direction - from memory to device. lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 587
Quoted 7 lines
lib/dmadev/rte_dmadev.h +4
-0@@ -564,6 +581,36 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +* +* This enum defines the types of transfer domains applicable to DMA operations.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 590
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It helps categorize whether a DMA transfer is occurring within the +same domain, + * across different processes, or between distinct operating systemdomains.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 5 lines
lib/dmadev/rte_dmadev.h +5
-0+* +* @see struct rte_dma_inter_domain_param:domain_type +*/ +enum rte_dma_inter_domain_type { +RTE_DMA_INTER_DOMAIN_NONE ,/**< No inter-domain transfer; standard DMA within same domain */
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 596
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+ RTE_DMA_INTER_PROCESS_DOMAIN, /**< Transfer occurs betweendifferent user-space processes */
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 598
Quoted 2 lines
lib/dmadev/rte_dmadev.h +2
-0+ RTE_DMA_INTER_OS_DOMAIN, /**< Transfer spans across different +operating system domains. */ please place the comment before the definition.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 8 lines
lib/dmadev/rte_dmadev.h +8
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA +transfers +* across different domains, such as between processes or operating systems.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 613
Quoted 7 lines
lib/dmadev/rte_dmadev.h +7
-0+* It includes the domain type and handler identifiers for both the +source +* and destination domains. +*/ +struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type domain_type;/**< Type of +inter-domain. */ please rename
domian_typeto type because we are in domain context.lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 651
Quoted 12 lines
lib/dmadev/rte_dmadev.h +5
-0+uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ }; +/** * A structure used to configure a virtual DMA channel. * @@ -601,6 +648,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 653
Quoted 2 lines
lib/dmadev/rte_dmadev.h +2
-0+ * specifies the source and destination domain handlers required +for DMAtwo spaces before 'for DMA'
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 654
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* operations that span across different processes or operating system domains.
Quoted 23 lines
lib/dmadev/rte_dmadev.h +6
-0+* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain; };/** (quoted diff) +0
-0
b/lib/dmadev/rte_dmadev_trace.hindex1de92655f2..12ea9d53f6100644lib/dmadev/rte_dmadev_trace.h +3
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.domain_type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
PATCH v2 1/1 lib/dma: add control-plane APIs for inter-domain DMA transfers
In reply to Vamsi KrishnaFrom: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.
Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokes rte_dma_access_pair_group_create() to establish a new access pair group, then shares the group_id and token with Process 2 via IPC.
Process 2 (Group Joiner):
Receives the group_id and token from Process 1 and calls rte_dma_access_pair_group_join() to join the group.
Both Processes:
Use rte_dma_access_pair_group_handle_get() to obtain handler information for domains in the group.
Perform DMA transfers as required.
Process 2 (when finished):
Calls rte_dma_access_pair_group_leave() to exit the group.
Process 1:
Monitors for group updates and confirms group membership as needed.
Depends-on: patch-36335 (lib/dma: introduce inter-process and inter-OS DMA)
--- lib/dmadev/rte_dmadev.c | 137 ++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 100 +++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 28 +++++++ lib/dmadev/rte_dmadev_trace.h | 42 +++++++++++ 4 files changed, 307 insertions(+)
lib/dmadev/rte_dmadev.c +137 -0
@@ -804,6 +804,143 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *return dev->dev_ops->vchan_status (dev, vchan, status); } +int +rte_dma_access_pair_group_create (int16_t dev_id,rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_id ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } +if (*dev->dev_ops->access_pair_group_create ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_create)(dev, domain_id, token, group_id); +} + +int +rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_destroy ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_destroy)(dev, group_id); +} + +int +rte_dma_access_pair_group_join (int16_t dev_id,int16_t group_id,rte_uuid_t token, +rte_dma_access_pair_leave_cb_t leave_cb) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_join ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_join)(dev, group_id, token, leave_cb); +} + +int +rte_dma_access_pair_group_leave (int16_t dev_id,int16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_leave ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_leave)(dev, group_id); +} + +int +rte_dma_access_pair_group_handle_get (int16_t dev_id,int16_t group_id,rte_uuid_t domain_id, +uint16_t *handle) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || handle ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_handle_get ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_handle_get)(dev, group_id, domain_id, handle); +} +static const char *dma_capability_name (uint64_t capability) {
lib/dmadev/rte_dmadev.h +100 -0
112 lines not on this page · raw message
lib/dmadev/rte_dmadev_pmd.h +28 -0
@@ -64,6 +64,28 @@ typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc/** @internal Used to dump internal information. */ typedef int (*rte_dma_dump_t )(const struct rte_dma_dev *dev,FILE *f); +/** @internal Used to create an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_create_t )(const struct rte_dma_dev *dev, +rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id); + +/** @internal Used to destroy an access pair group when all other devices have exited. */ +typedef int (*rte_dma_access_pair_group_destroy_t )(const struct rte_dma_dev *dev, +int16_t group_id); + +/** @internal Used to join an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_join_t )(const struct rte_dma_dev *dev,int16_t group_id, +rte_uuid_t token, +rte_dma_access_pair_leave_cb_t leave_cb); + +/** @internal Used to leave an access pair group, removing the device from the group. */ +typedef int (*rte_dma_access_pair_group_leave_t )(const struct rte_dma_dev *dev,int16_t group_id); + +/** @internal Used to retrieve handler information of the domain_id present in the group. */ +typedef int (*rte_dma_access_pair_group_handle_get_t )(const struct rte_dma_dev *dev, +int16_t group_id,rte_uuid_t domain_id, +uint16_t *handle); +/** * DMA device operations function pointer table. *
@@ -83,6 +105,12 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_pair_group_create_t access_pair_group_create; +rte_dma_access_pair_group_destroy_t access_pair_group_destroy; +rte_dma_access_pair_group_join_t access_pair_group_join; +rte_dma_access_pair_group_leave_t access_pair_group_leave; +rte_dma_access_pair_group_handle_get_t access_pair_group_handle_get; };/**
lib/dmadev/rte_dmadev_trace.h +42 -0
48 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
Quoted 74 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokesrte_dma_access_pair_group_create()to establish a new access pair group, then shares thegroup_idand token with Process 2 via IPC.Process 2 (Group Joiner):
Receives thegroup_idand token from Process 1 and callsrte_dma_access_pair_group_join()to join the group.Both Processes:
Userte_dma_access_pair_group_handle_get()to obtain handler information for domains in the group.
Perform DMA transfers as required.Process 2 (when finished):
Callsrte_dma_access_pair_group_leave()to exit the group.Process 1:
Monitors for group updates and confirms group membership as needed.Depends-on: patch-36335 (lib/dma: introduce inter-process and inter-OS DMA)
Signed-off-by Vamsi Attunuru <[email protected]>--- lib/dmadev/rte_dmadev.c | 137 ++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 100 +++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 28 +++++++ lib/dmadev/rte_dmadev_trace.h | 42 +++++++++++ 4 files changed, 307 insertions(+)lib/dmadev/rte_dmadev.c +12
-0@@ -804,6 +804,143 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *return dev->dev_ops->vchan_status (dev, vchan, status); } +int +rte_dma_access_pair_group_create (int16_t dev_id,rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_id ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) {
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 828
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + }
please add one blank line here
Quoted 134 lines
lib/dmadev/rte_dmadev.c +115
-0+if (*dev->dev_ops->access_pair_group_create ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_create)(dev, domain_id, token, group_id); +} + +int +rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_destroy ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_destroy)(dev, group_id); +} + +int +rte_dma_access_pair_group_join (int16_t dev_id,int16_t group_id,rte_uuid_t token, +rte_dma_access_pair_leave_cb_t leave_cb) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_join ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_join)(dev, group_id, token, leave_cb); +} + +int +rte_dma_access_pair_group_leave (int16_t dev_id,int16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_leave ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_leave)(dev, group_id); +} + +int +rte_dma_access_pair_group_handle_get (int16_t dev_id,int16_t group_id,rte_uuid_t domain_id, +uint16_t *handle) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || handle ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_handle_get ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_handle_get)(dev, group_id, domain_id, handle); +} +static const char *dma_capability_name (uint64_t capability) {lib/dmadev/rte_dmadev.h +1
-0@@ -148,6 +148,7 @@#include <rte_bitops.h> #include <rte_common.h> +#include <rte_uuid.h> #ifdef __cplusplusextern "C" {@@ -779,6 +780,105 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status **/ int rte_dma_dump (int16_t dev_id,FILE *f);
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 792
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+/** +* Callback function invoked when a DMA device leaves an access group or when the group is +* destroyed due to some exception or failure. +* +* @param dma_id +* Identifier of the DMA device that is leaving the group. +* @param group_id +* ID of the access group being exited. +* @param user_data +* User-defined data passed to the callback for context.
What's the user_data define? vendor specific?
Quoted 12 lines
lib/dmadev/rte_dmadev.h +12
-0+*/ +typedef void (*rte_dma_access_pair_leave_cb_t )(int16_t dma_id,int16_t group_id,void *user_data); + +/** +* Create an access pair group to enable secure DMA transfers between devices across different +* processes or operating system domains. +* +* @param dev_id +* Identifier of the DMA device initiating the group. +* @param domain_id +* Unique identifier representing the process or OS domain. +* @param token
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 814
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* Authentication token used to establish the access group. +* @param[out] group_id +* Pointer to store the ID of the newly created access group. +* +* @return +* 0 on success, +* negative error code on failure. +*/ +int rte_dma_access_pair_group_create (int16_t dev_id,rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id);
add blank line here
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+/** +* Destroy an access pair group if all participating devices have exited. This operation is only +* permitted by the device that originally created the group; attempts by other devices will result +* in failure.
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 828
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* +* @param dev_id +* Identifier of the device requesting group destruction. +* @param group_id +* ID of the access group to be destroyed. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t group_id);
add blank line here
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+/** +* Join an existing access group to enable secure DMA transfers between devices across different +* processes or OS domains. +* +* @param dev_id +* Identifier of the DMA device attempting to join the group. +* @param group_id +* ID of the access group to join. +* @param token +* Authentication token used to validate group membership.
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 848
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* @param leave_cb +* Callback function to be invoked when the device leaves the group or when the group +* is destroyed due to some exception or failure. +* +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_join (int16_t dev_id,int16_t group_id,rte_uuid_t token, +rte_dma_access_pair_leave_cb_t leave_cb);
add blank line here
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+/** +* Leave an access group, removing the device's entry from the group table and disabling +* inter-domain DMA transfers to and from this device. This operation is not permitted for the +* device that originally created the group.
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 862
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* +* @param dev_id +* Identifier of the device requesting to leave the group. +* @param group_id +* ID of the access group to leave. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_leave (int16_t dev_id,int16_t group_id);
add blank line here
Quoted 8 lines
lib/dmadev/rte_dmadev.h +8
-0+/** +* Retrieve the handler associated with a specific domain ID, which is used by the application to +* query source or destinationin handler to initiate inter-process or inter-OS DMA transfers. +* +* @param dev_id +* Identifier of the DMA device requesting the handler. +* @param group_id +* ID of the access group to query.
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 880
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* @param group_tbl +* Unique identifier of the target process or OS domain. +* @param[out] handle +* Pointer to store the retrieved handler value. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_handle_get (int16_t dev_id,int16_t group_id,rte_uuid_t domain_id, +uint16_t *handle);
handle should be handler which keep consistency with depend commit.
if there are three OS join the same domain, then how this API get specific handler?
What I think is:
1. every domain has its own unique domain_id
2. Process 1 create one group, and share group_id and token with Process 2/3 via IPC.
3. Process 2 join the group (pass its domain_id)
4. Process 3 also join the group (pass its domain_id)
5. When Process 1 want to transfer between diffent domain:
it first invoke rte_dma_access_pair_group_handle_get() to get target handler
do vchan setup. there have three type: local to remote, remote to local, remote to remote. but how to describe the type I have see in depend commit. do transfer.
6. If one process leave the group, then other process will be invoke by a callback.
this has a problem, the Process 1 hasn't register a callback for such event.
Quoted 93 lines
lib/dmadev/rte_dmadev.h +1
-0+/** * DMA transfer result status code defines. * lib/dmadev/rte_dmadev_pmd.h +28
-0@@ -64,6 +64,28 @@ typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc/** @internal Used to dump internal information. */ typedef int (*rte_dma_dump_t )(const struct rte_dma_dev *dev,FILE *f); +/** @internal Used to create an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_create_t )(const struct rte_dma_dev *dev, +rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id); + +/** @internal Used to destroy an access pair group when all other devices have exited. */ +typedef int (*rte_dma_access_pair_group_destroy_t )(const struct rte_dma_dev *dev, +int16_t group_id); + +/** @internal Used to join an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_join_t )(const struct rte_dma_dev *dev,int16_t group_id, +rte_uuid_t token, +rte_dma_access_pair_leave_cb_t leave_cb); + +/** @internal Used to leave an access pair group, removing the device from the group. */ +typedef int (*rte_dma_access_pair_group_leave_t )(const struct rte_dma_dev *dev,int16_t group_id); + +/** @internal Used to retrieve handler information of the domain_id present in the group. */ +typedef int (*rte_dma_access_pair_group_handle_get_t )(const struct rte_dma_dev *dev, +int16_t group_id,rte_uuid_t domain_id, +uint16_t *handle); +/** * DMA device operations function pointer table. * @@ -83,6 +105,12 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_pair_group_create_t access_pair_group_create; +rte_dma_access_pair_group_destroy_t access_pair_group_destroy; +rte_dma_access_pair_group_join_t access_pair_group_join; +rte_dma_access_pair_group_leave_t access_pair_group_leave; +rte_dma_access_pair_group_handle_get_t access_pair_group_handle_get; };/** lib/dmadev/rte_dmadev_trace.h +35
-0@@ -101,6 +101,48 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (ret); ) +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_create, + RTE_TRACE_POINT_ARGS(int16_t dev_id, rte_uuid_t domain_id, rte_uuid_t token, + int16_t *group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u8_ptr (&domain_id[0 ]); +rte_trace_point_emit_u8_ptr (&token[0 ]); +rte_trace_point_emit_ptr (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_destroy, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_join, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id, rte_uuid_t token), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +rte_trace_point_emit_u8_ptr (&token[0 ]); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_leave, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +) + +RTE_TRACE_POINT( + rte_dma_trace_access_pair_group_handle_get, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id, rte_uuid_t domain_id,
lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 148
Quoted 10 lines
lib/dmadev/rte_dmadev_trace.h +7
-0+ uint16_t *handle), +rte_trace_point_emit_i16 (dev_id ); +rte_trace_point_emit_i16 (group_id); +rte_trace_point_emit_u8_ptr (&domain_id[0 ]); +rte_trace_point_emit_ptr (handle); +) + #ifdef __cplusplus }#endif
please add descript in DMAdev's doc.
RE: [EXTERNAL] Re: [PATCH v2 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
Quoted 108 lines
-----Original Message-----
From: fengchengwen <[email protected]>
Sent: Wednesday, October 15, 2025 12:29 PM
To: Vamsi Krishna Attunuru <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: [EXTERNAL] Re: [PATCH v2 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfersOn 10/14/2025 2: 10 AM, Vamsi Krishna wrote: > From: Vamsi Attunuru <vattunuru@ marvell. com> > > Secure and controlled inter-domain DMA transfers require dedicated > control-plane APIs to create and manage access groups. > ZjQcmQRYFpfptBannerStart Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments <https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3T9P9UIl9Qfowcs_fbTQDJ0DyFdE YDpKJv0zCjBFHa6iwMRQF7m7oNVmKvmxkqKNyF5whwjcK- hf3wK_jOinodZ2pNpWgj5Fc$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Quoted 44 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokesrte_dma_access_pair_group_create()to establish a new access pair group, then shares thegroup_idand token with Process 2 via IPC.Process 2 (Group Joiner):
Receives thegroup_idand token from Process 1 and callsrte_dma_access_pair_group_join()to join the group.Both Processes:
Userte_dma_access_pair_group_handle_get()to obtain handler information for domains in the group.
Perform DMA transfers as required.Process 2 (when finished):
Callsrte_dma_access_pair_group_leave()to exit the group.Process 1:
Monitors for group updates and confirms group membership as needed.Quoted 6 lines
Depends-on: patch-36335 (lib/dma: introduce inter-process and inter-OS DMA)
Signed-off-by Vamsi Attunuru <[email protected]>--- lib/dmadev/rte_dmadev.c | 137++++++++++++++++++++++++++++++++++
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t
Quoted 10 lines
lib/dmadev/rte_dmadev.h | 100 +++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 28 +++++++ lib/dmadev/rte_dmadev_trace.h | 42 +++++++++++ 4 files changed, 307 insertions(+)lib/dmadev/rte_dmadev.c index renamed from lib/dmadev/rte_dmadev.c +0
-0
d6792449bf..521b372b86100644lib/dmadev/rte_dmadev.c +0
-0@@ -804,6 +804,143 @@ rte_dma_vchan_status(int16_t dev_id, uint16_tvchan, enum
rte_dma_vchan_status*lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 4 lines
lib/dmadev/rte_dmadev.c +2
-0return dev->dev_ops->vchan_status (dev, vchan, status); } +int +rte_dma_access_pair_group_create(int16_t dev_id, rte_uuid_t
domain_id,rte_uuid_ttoken,Quoted 5 lines
lib/dmadev/rte_dmadev.c +5
-0+ int16_t *group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; +lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (!rte_dma_is_valid (dev_id) || group_id ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||
Quoted 8 lines
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t · line 824
Quoted 2 lines
lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os domain",
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 828
Quoted 3 lines
lib/dmadev/rte_dmadev.c +3
-0+ dev_id); +return -EINVAL ; + }please add one blank line here
Ack, will add black lines as suggested in other places.
Quoted 143 lines
Quoted 11 lines
lib/dmadev/rte_dmadev.c +10
-0+if (*dev->dev_ops->access_pair_group_create ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_create)(dev, domain_id, +token, group_id); } + +int +rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t group_id) { +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; +lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t · line 849
Quoted 2 lines
lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os domain",
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+ dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_destroy ==NULL ) +return -ENOTSUP ; + return (*dev->dev_ops->access_pair_group_destroy)(dev,
group_id); }lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 3 lines
lib/dmadev/rte_dmadev.c +3
-0+ +int +rte_dma_access_pair_group_join(int16_t dev_id, int16_t group_id,
rte_uuid_ttoken,Quoted 4 lines
lib/dmadev/rte_dmadev.c +4
-0+ rte_dma_access_pair_leave_cb_t leave_cb) { +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; +lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t · line 875
Quoted 2 lines
lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os domain",
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+ dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_join ==NULL ) +return -ENOTSUP ; + return (*dev->dev_ops->access_pair_group_join)(dev, group_id,token,
Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+leave_cb); } + +int +rte_dma_access_pair_group_leave (int16_t dev_id,int16_t group_id) { +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; +lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t · line 901
Quoted 2 lines
lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os domain",
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+ dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_leave ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_leave)(dev, group_id); } + +int +rte_dma_access_pair_group_handle_get(int16_t dev_id, int16_t
group_id,rte_uuid_tdomain_id,Quoted 5 lines
lib/dmadev/rte_dmadev.c +5
-0+ uint16_t *handle) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; +lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (!rte_dma_is_valid (dev_id) || handle ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + + if (!((dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN) ||lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t · line 928
Quoted 2 lines
lib/dmadev/rte_dmadev.c +2
-0+ (dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN))) { + RTE_DMA_LOG(ERR, "Device %d don't support inter-processor inter-os domain",
lib/dmadev/rte_dmadev.c rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 7 lines
lib/dmadev/rte_dmadev.c +7
-0+ dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_handle_get ==NULL ) +return -ENOTSUP ; + return (*dev->dev_ops->access_pair_group_handle_get)(dev,
group_id,lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t
Quoted 17 lines
lib/dmadev/rte_dmadev.c +2
-0+domain_id, handle); } +static const char * dma_capability_name(uint64_t capability) { diff --git
a/lib/dmadev/rte_dmadev.hb/lib/dmadev/rte_dmadev.hindex4f735bb0c9..a6e73337eb100644lib/dmadev/rte_dmadev.h +1
-0@@ -148,6 +148,7 @@#include <rte_bitops.h> #include <rte_common.h> +#include <rte_uuid.h> #ifdef __cplusplusextern "C" {@@ -779,6 +780,105 @@ rte_dma_vchan_status(int16_t dev_id, uint16_tvchan, enum
rte_dma_vchan_status*Quoted 3 lines
lib/dmadev/rte_dmadev.h +0
-0*/ int rte_dma_dump (int16_t dev_id,FILE *f);
Quoted 13 lines
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * · line 792
Quoted 11 lines
lib/dmadev/rte_dmadev.h +11
-0+/** +* Callback function invoked when a DMA device leaves an access group +or when the group is +* destroyed due to some exception or failure. +* +* @param dma_id +* Identifier of the DMA device that is leaving the group. +* @param group_id +* ID of the access group being exited. +* @param user_data +* User-defined data passed to the callback for context. What's the
user_datadefine? vendor specific?
It's need not be a vendor specific one, it could be a user data specific to this group.
Quoted 114 lines
Quoted 14 lines
lib/dmadev/rte_dmadev.h +13
-0+*/ +typedef void (*rte_dma_access_pair_leave_cb_t )(int16_t dma_id, +int16_t group_id,void *user_data); + +/** +* Create an access pair group to enable secure DMA transfers between +devices across different +* processes or operating system domains. +* +* @param dev_id +* Identifier of the DMA device initiating the group. +* @param domain_id +* Unique identifier representing the process or OS domain. lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* @param token +* Authentication token used to establish the access group. +* @param[out] group_id +* Pointer to store the ID of the newly created access group. +* +* @return +* 0 on success, +* negative error code on failure. +*/ +int rte_dma_access_pair_group_create(int16_t dev_id, rte_uuid_t
domain_id,rte_uuid_ttoken,lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t · line 817
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+ int16_t *group_id);add blank line here
Quoted 7 lines
lib/dmadev/rte_dmadev.h +7
-0+/** +* Destroy an access pair group if all participating devices have +exited. This operation is only +* permitted by the device that originally created the group; +attempts by other devices will result +* in failure. +* lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* @param dev_id +* Identifier of the device requesting group destruction. +* @param group_id +* ID of the access group to be destroyed. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t +group_id);add blank line here
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 13 lines
lib/dmadev/rte_dmadev.h +13
-0+/** +* Join an existing access group to enable secure DMA transfers +between devices across different +* processes or OS domains. +* +* @param dev_id +* Identifier of the DMA device attempting to join the group. +* @param group_id +* ID of the access group to join. +* @param token +* Authentication token used to validate group membership. +* @param leave_cb +* Callback function to be invoked when the device leaves the group or when the group
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 7 lines
lib/dmadev/rte_dmadev.h +7
-0+* is destroyed due to some exception or failure. +* +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_join(int16_t dev_id, int16_t group_id,
rte_uuid_ttoken,lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t · line 855
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+ rte_dma_access_pair_leave_cb_t leave_cb);add blank line here
Quoted 7 lines
lib/dmadev/rte_dmadev.h +7
-0+/** +* Leave an access group, removing the device's entry from the group +table and disabling +* inter-domain DMA transfers to and from this device. This operation +is not permitted for the +* device that originally created the group. +* lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* @param dev_id +* Identifier of the device requesting to leave the group. +* @param group_id +* ID of the access group to leave. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_leave (int16_t dev_id,int16_t +group_id);add blank line here
lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t · line 876
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+/** +* Retrieve the handler associated with a specific domain ID, which +is used by the application to +* query source or destinationin handler to initiate inter-process or inter- OS DMA transfers.
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+* +* @param dev_id +* Identifier of the DMA device requesting the handler. +* @param group_id lib/dmadev/rte_dmadev.h rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* ID of the access group to query. +* @param group_tbl +* Unique identifier of the target process or OS domain. +* @param[out] handle +* Pointer to store the retrieved handler value. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_handle_get(int16_t dev_id, int16_t
Quoted 4 lines
group_id,rte_uuid_tdomain_id,lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+ uint16_t *handle);handle should be handler which keep consistency with depend commit.
Right, will fix it.
Quoted 14 lines
if there are three OS join the same domain, then how this API get specific handler?
What I think is:
1. every domain has its own uniquedomain_id2. Process 1 create one group, and sharegroup_idand token with Process 2/3 via IPC.
3. Process 2 join the group (pass itsdomain_id) 4. Process 3 also join the group (pass itsdomain_id) 5. When Process 1 want to transfer between diffent domain:
it first invokerte_dma_access_pair_group_handle_get()to get target
handler
do vchan setup. there have three type: local to remote, remote to local,
remote to remote. but how to describe the type I have see in depend commit.
1) remote to local or local to remote
Process 1 invoke handler_get(process::2 domain_id) to get the process2's handler and invoke handler_get(process::1 domain_id) to get it's handler. Setup one vchan for local to remote (src_handle=process::1 handler, dst_handler=process::2 handler) and for remote to local, params are vice versa.
2) remote-A to remote-B or even remote-A to remote-A from local process(process::1) Process::1 gets the handlers of remote-A and remote-B. Setup a vchan with (src_handler=remote-A_handler, dst_handler=remote-B_handler). For remote-A
To remote-A, use same handler for both src & dst (src_handler = dst_handler = remote-A_handler).
Please let me know if the above does not cover the case or type that you are referring to.
Quoted 5 lines
do transfer.
6. If one process leave the group, then other process will be invoke by a callback.
this has a problem, the Process 1 hasn't register a callback for such event.
Right, process::1 needs a callback, will add in create API.
Quoted 111 lines
Review
Quoted 5 lines
lib/dmadev/rte_dmadev.h +1
-0+/** * DMA transfer result status code defines. * (quoted diff) +0
-0
b/lib/dmadev/rte_dmadev_pmd.hlib/dmadev/rte_dmadev_pmd.h
Quoted 10 lines
index
58729088ff..8be4485593100644lib/dmadev/rte_dmadev_pmd.h +0
-0@@ -64,6 +64,28 @@ typedef int (*rte_dma_vchan_status_t)(const struct
rte_dma_dev*dev,uint16_tvc
/** @internal Used to dump internal information. */ typedef int
(*rte_dma_dump_t)(const structrte_dma_dev*dev, FILE *f);lib/dmadev/rte_dmadev_pmd.h +2
-0+/** @internal Used to create an access pair group for inter-process +or inter-OS DMA transfers. */ typedef int(*rte_dma_access_pair_group_create_t)(const struct
rte_dma_dev*dev,lib/dmadev/rte_dmadev_pmd.h
Quoted 1 line
lib/dmadev/rte_dmadev_pmd.h +1
-0+ rte_uuid_t domain_id,
rte_uuid_ttoken,lib/dmadev/rte_dmadev_pmd.h typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc
Quoted 4 lines
lib/dmadev/rte_dmadev_pmd.h +4
-0+ int16_t *group_id); + +/** @internal Used to destroy an access pair group when all other +devices have exited. */ typedef int(*rte_dma_access_pair_group_destroy_t)(const struct
rte_dma_dev*dev,lib/dmadev/rte_dmadev_pmd.h typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc
Quoted 4 lines
lib/dmadev/rte_dmadev_pmd.h +4
-0+ int16_t group_id); + +/** @internal Used to join an access pair group for inter-process or +inter-OS DMA transfers. */ typedef int(*rte_dma_access_pair_group_join_t)(const struct
rte_dma_dev*dev,int16_tgroup_id,lib/dmadev/rte_dmadev_pmd.h
Quoted 2 lines
lib/dmadev/rte_dmadev_pmd.h +2
-0+ rte_uuid_t token, +rte_dma_access_pair_leave_cb_t leave_cb);lib/dmadev/rte_dmadev_pmd.h
Quoted 8 lines
lib/dmadev/rte_dmadev_pmd.h +8
-0+ +/** @internal Used to leave an access pair group, removing the device +from the group. */ typedef int +(*rte_dma_access_pair_group_leave_t )(const struct rte_dma_dev *dev, +int16_t group_id); + +/** @internal Used to retrieve handler information of the domain_id +present in the group. */ typedef int(*rte_dma_access_pair_group_handle_get_t)(const struct
rte_dma_dev*dev,lib/dmadev/rte_dmadev_pmd.h
Quoted 1 line
lib/dmadev/rte_dmadev_pmd.h +1
-0+ int16_t group_id,
rte_uuid_tdomain_id,lib/dmadev/rte_dmadev_pmd.h struct rte_dma_dev_ops { · line 110
Quoted 12 lines
lib/dmadev/rte_dmadev_pmd.h +5
-0+ uint16_t *handle); +/** * DMA device operations function pointer table. * @@ -83,6 +105,12 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_pair_group_create_t access_pair_group_create; + rte_dma_access_pair_group_destroy_taccess_pair_group_destroy;lib/dmadev/rte_dmadev_pmd.h struct rte_dma_dev_ops {
Quoted 3 lines
lib/dmadev/rte_dmadev_pmd.h +3
-0+rte_dma_access_pair_group_join_t access_pair_group_join; +rte_dma_access_pair_group_leave_t access_pair_group_leave; + rte_dma_access_pair_group_handle_get_taccess_pair_group_handle_get;Quoted 8 lines
lib/dmadev/rte_dmadev_pmd.h +0
-0};/** (quoted diff) +0
-0
b/lib/dmadev/rte_dmadev_trace.hindexfa619c4090..c25cf8d60a100644lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 106
Quoted 6 lines
lib/dmadev/rte_dmadev_trace.h +3
-0@@ -101,6 +101,48 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (ret); ) +RTE_TRACE_POINT( + rte_dma_trace_access_pair_group_create, + RTE_TRACE_POINT_ARGS(int16_t dev_id, rte_uuid_t domain_id,
rte_uuid_ttoken,Quoted 7 lines
lib/dmadev/rte_dmadev_trace.h +7
-0+ int16_t *group_id), +rte_trace_point_emit_i16 (dev_id ); +rte_trace_point_emit_u8_ptr (&domain_id[0 ]); +rte_trace_point_emit_u8_ptr (&token[0 ]); +rte_trace_point_emit_ptr (group_id); +) +lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT(
Quoted 10 lines
lib/dmadev/rte_dmadev_trace.h +10
-0+RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_destroy, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +) + +RTE_TRACE_POINT( + rte_dma_trace_access_pair_group_join, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id,
rte_uuid_ttoken),Quoted 5 lines
lib/dmadev/rte_dmadev_trace.h +5
-0+rte_trace_point_emit_i16 (dev_id); +rte_trace_point_emit_i16 (group_id); +rte_trace_point_emit_u8_ptr (&token[0 ]); +) +lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT(
Quoted 10 lines
lib/dmadev/rte_dmadev_trace.h +10
-0+RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_leave, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +) + +RTE_TRACE_POINT( + rte_dma_trace_access_pair_group_handle_get, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id,
rte_uuid_tdomain_id,
Quoted 13 lines
lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 148
Quoted 10 lines
lib/dmadev/rte_dmadev_trace.h +7
-0+ uint16_t *handle), +rte_trace_point_emit_i16 (dev_id ); +rte_trace_point_emit_i16 (group_id); +rte_trace_point_emit_u8_ptr (&domain_id[0 ]); +rte_trace_point_emit_ptr (handle); +) + #ifdef __cplusplus }#endif please add descript in DMAdev's doc.
Ack, will add in next version.
PATCH v3 1/1 lib/dma: add control-plane APIs for inter-domain DMA transfers
In reply to Vamsi KrishnaFrom: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.
Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokes rte_dma_access_pair_group_create() to establish a new access pair group, then shares the group_id and token with Process 2 via IPC.
Process 2 (Group Joiner):
Receives the group_id and token from Process 1 and calls rte_dma_access_pair_group_join() to join the group.
Both Processes:
Use rte_dma_access_pair_group_handler_get() to obtain handler information for domains in the group.
Perform DMA transfers as required.
Process 2 (when finished):
Calls rte_dma_access_pair_group_leave() to exit the group.
Process 1:
Monitors for group updates and confirms group membership as needed.
Depends-on: patch-36335 (lib/dma: introduce inter-process and inter-OS DMA)
---
V3 Changes:
* Add documentation to dmadev doc.
* Add common callback for group creator and joiner.
* Fix V2 review comments
doc/guides/prog_guide/dmadev.rst | 49 +++++++++++ lib/dmadev/rte_dmadev.c | 138 +++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 137 ++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 29 +++++++ lib/dmadev/rte_dmadev_trace.h | 42 ++++++++++ 5 files changed, 395 insertions(+)
doc/guides/prog_guide/dmadev.rst +49 -0
@@ -174,3 +174,52 @@ are shown below. For more information on how to use the Telemetry interface, see the :doc:`../howto/telemetry`. + +Inter-domain DMA Capabilities +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The inter-domain DMA feature enables DMA devices to perform data transfers +across different processes and OS domains. This is achieved by configuring +virtual channels (vchans) using `src_handler` and `dst_handler` fields, which +represent the source and destination endpoints for inter-domain DMA operations. +Handler information is exchanged between devices based on their DMA class type. +These handler details will be exchanged based on the type of DMA devices. + +DMA devices used for inter-process data transfer can be categorized as follows: + +Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices). +Class B: Only one endpoint requires a DMA device; the other does not. +Class C: Other device types not currently classified. + +Currently the necessary APIs for Class A DMA devices are avilable for exchanging the handler +details. Devices can create or join access groups using token-based authentication, ensuring +that only authorized devices within the same group can perform DMA transfers across processes +or OS domains. + +API usage flow for setting up the access pair group for DMA between process#1 & process#2. + +Process#1 (Group Creator): +-------------------------- +Calls ``rte_dma_access_pair_group_create`` to establish a new access pair group, +then shares the ``group_id``, ``token`` and ``domain_id`` with Process#2 via IPC. + +Process#2 (Group Joiner): +------------------------- +Receives the ``group_id`` and ``token`` from Process#1 and calls ``rte_dma_access_pair_group_join`` +to join the group. + +Both Processes: +--------------- +Use ``rte_dma_access_pair_group_handler_get`` to obtain ``handler`` information for domains +in the group. + +--Perform inter-domain DMA transfers as required. + +Process#2 (when finished): +-------------------------- +Calls ``rte_dma_access_pair_group_leave`` to exit the group. + +Process#1 (final cleanup): +-------------------------- +Calls ``rte_dma_access_pair_group_destroy`` to destroy the group. +
lib/dmadev/rte_dmadev.c +138 -0
144 lines not on this page · raw message
lib/dmadev/rte_dmadev.h +137 -0
149 lines not on this page · raw message
lib/dmadev/rte_dmadev_pmd.h +29 -0
@@ -64,6 +64,29 @@ typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc/** @internal Used to dump internal information. */ typedef int (*rte_dma_dump_t )(const struct rte_dma_dev *dev,FILE *f); +/** @internal Used to create an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_create_t )(const struct rte_dma_dev *dev, +rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id, +rte_dma_access_pair_group_event_cb_t cb); + +/** @internal Used to destroy an access pair group when all other devices have exited. */ +typedef int (*rte_dma_access_pair_group_destroy_t )(const struct rte_dma_dev *dev, +int16_t group_id); + +/** @internal Used to join an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_join_t )(const struct rte_dma_dev *dev,int16_t group_id, +rte_uuid_t token, +rte_dma_access_pair_group_event_cb_t cb); + +/** @internal Used to leave an access pair group, removing the device from the group. */ +typedef int (*rte_dma_access_pair_group_leave_t )(const struct rte_dma_dev *dev,int16_t group_id); + +/** @internal Used to retrieve handler information of the domain_id present in the group. */ +typedef int (*rte_dma_access_pair_group_handler_get_t )(const struct rte_dma_dev *dev, +int16_t group_id,rte_uuid_t domain_id, +uint16_t *handler); +/** * DMA device operations function pointer table. *
@@ -83,6 +106,12 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_pair_group_create_t access_pair_group_create; +rte_dma_access_pair_group_destroy_t access_pair_group_destroy; +rte_dma_access_pair_group_join_t access_pair_group_join; +rte_dma_access_pair_group_leave_t access_pair_group_leave; +rte_dma_access_pair_group_handler_get_t access_pair_group_handler_get; };/**
lib/dmadev/rte_dmadev_trace.h +42 -0
48 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v3 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
A minor comment below, but it seems could fix later.
Quoted 70 lines · Vamsi Krishna
From: Vamsi Attunuru<[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokesrte_dma_access_pair_group_create()to establish a new access pair group, then shares thegroup_idand token with Process 2 via IPC.Process 2 (Group Joiner):
Receives thegroup_idand token from Process 1 and callsrte_dma_access_pair_group_join()to join the group.Both Processes:
Userte_dma_access_pair_group_handler_get()to obtain handler information for domains in the group.
Perform DMA transfers as required.Process 2 (when finished):
Callsrte_dma_access_pair_group_leave()to exit the group.Process 1:
Monitors for group updates and confirms group membership as needed.Depends-on: patch-36335 (lib/dma: introduce inter-process and inter-OS DMA)
Signed-off-by Vamsi Attunuru<[email protected]>---
V3 Changes:
* Add documentation to dmadev doc.
* Add common callback for group creator and joiner.
* Fix V2 review commentsdoc/guides/prog_guide/dmadev.rst | 49 +++++++++++ lib/dmadev/rte_dmadev.c | 138 +++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 137 ++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 29 +++++++ lib/dmadev/rte_dmadev_trace.h | 42 ++++++++++ 5 files changed, 395 insertions(+)doc/guides/prog_guide/dmadev.rst +2
-0@@ -174,3 +174,52 @@ are shown below. For more information on how to use the Telemetry interface, see the :doc:`../howto/telemetry`. + +Inter-domain DMA Capabilities
doc/guides/prog_guide/dmadev.rst are shown below. · line 188
Quoted 10 lines
doc/guides/prog_guide/dmadev.rst +10
-0+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The inter-domain DMA feature enables DMA devices to perform data transfers +across different processes and OS domains. This is achieved by configuring +virtual channels (vchans) using `src_handler` and `dst_handler` fields, which +represent the source and destination endpoints for inter-domain DMA operations. +Handler information is exchanged between devices based on their DMA class type. +These handler details will be exchanged based on the type of DMA devices. + +DMA devices used for inter-process data transfer can be categorized as follows:
inter-process -> inter-domain
Quoted 441 lines
doc/guides/prog_guide/dmadev.rst +37
-0+ +Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices). +Class B: Only one endpoint requires a DMA device; the other does not. +Class C: Other device types not currently classified. + +Currently the necessary APIs for Class A DMA devices are avilable for exchanging the handler +details. Devices can create or join access groups using token-based authentication, ensuring +that only authorized devices within the same group can perform DMA transfers across processes +or OS domains. + +API usage flow for setting up the access pair group for DMA between process#1 & process#2. + +Process#1 (Group Creator): +-------------------------- +Calls ``rte_dma_access_pair_group_create`` to establish a new access pair group, +then shares the ``group_id``, ``token`` and ``domain_id`` with Process#2 via IPC. + +Process#2 (Group Joiner): +------------------------- +Receives the ``group_id`` and ``token`` from Process#1 and calls ``rte_dma_access_pair_group_join`` +to join the group. + +Both Processes: +--------------- +Use ``rte_dma_access_pair_group_handler_get`` to obtain ``handler`` information for domains +in the group. + +--Perform inter-domain DMA transfers as required. + +Process#2 (when finished): +-------------------------- +Calls ``rte_dma_access_pair_group_leave`` to exit the group. + +Process#1 (final cleanup): +-------------------------- +Calls ``rte_dma_access_pair_group_destroy`` to destroy the group. +lib/dmadev/rte_dmadev.c +138
-0@@ -816,6 +816,144 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *return dev->dev_ops->vchan_status (dev, vchan, status); } +int +rte_dma_access_pair_group_create (int16_t dev_id,rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id,rte_dma_access_pair_group_event_cb_t cb) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || group_id ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_create ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_create)(dev, domain_id, token, group_id, cb); +} + +int +rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_destroy ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_destroy)(dev, group_id); +} + +int +rte_dma_access_pair_group_join (int16_t dev_id,int16_t group_id,rte_uuid_t token, +rte_dma_access_pair_group_event_cb_t cb) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_join ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_join)(dev, group_id, token, cb); +} + +int +rte_dma_access_pair_group_leave (int16_t dev_id,int16_t group_id) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id)) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_leave ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_leave)(dev, group_id); +} + +int +rte_dma_access_pair_group_handler_get (int16_t dev_id,int16_t group_id,rte_uuid_t domain_id, +uint16_t *handler) +{ +struct rte_dma_info dev_info; +struct rte_dma_dev *dev; + +if (!rte_dma_is_valid (dev_id) || handler ==NULL ) +return -EINVAL ; + dev = &rte_dma_devices[dev_id]; + +if (rte_dma_info_get (dev_id, &dev_info)) { +RTE_DMA_LOG (ERR ,"Device %d get device info fail" , dev_id); +return -EINVAL ; + } + +if (!((dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ) || + (dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN ))) { +RTE_DMA_LOG (ERR ,"Device %d don't support inter-process or inter-os domain" , + dev_id); +return -EINVAL ; + } + +if (*dev->dev_ops->access_pair_group_handler_get ==NULL ) +return -ENOTSUP ; +return (*dev->dev_ops->access_pair_group_handler_get)(dev, group_id, domain_id, handler); +} +static const char *dma_capability_name (uint64_t capability) {lib/dmadev/rte_dmadev.h +137
-0@@ -148,6 +148,7 @@#include <rte_bitops.h> #include <rte_common.h> +#include <rte_uuid.h> #ifdef __cplusplusextern "C" {@@ -797,6 +798,142 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status **/ int rte_dma_dump (int16_t dev_id,FILE *f); +/** +* Event types for DMA access pair group notifications. +* +* When the event type is RTE_DMA_GROUP_EVENT_MEMBER_LEFT, the handler associated +* with the departing member's domain is no longer valid. Inter-domain DMA operations +* targeting that domain should be avoided. +* +* When the event type is RTE_DMA_GROUP_EVENT_GROUP_DESTROYED, all handlers associated +* with the group become invalid. No further inter-domain DMA operations should be +* initiated using those handlers. +*/ +enum rte_dma_access_pair_group_event_type { +/** A member left the group (notifies creator and joiners) */ +RTE_DMA_GROUP_EVENT_MEMBER_LEFT , +/** Group was destroyed (notifies joiners) */ +RTE_DMA_GROUP_EVENT_GROUP_DESTROYED +}; + +/** +* This callback is used to notify interested parties (either the group creator +* or group joiners) about significant events related to the lifecycle of a DMA +* access pair group. +* +* It can be registered by: +* - **Group creators or Group joiners** to be notified when a member leaves the group. +* - **Group joiners** to be notified when the group is destroyed. +* +* @param dev_id +* Identifier of the DMA device. +* @param group_id +* Identifier of the access pair group where the event occurred. +* @param domain_id +* UUID of the domain_id associated with the event. For member leave events, +* this is the domain_id of the member that left. For group destruction events, +* this may refer to the domain_id of the respective member. +* @param event +* Type of event that occurred. +* @see rte_dma_access_pair_group_event_type +*/ +typedef void (*rte_dma_access_pair_group_event_cb_t )(int16_t dma_id,int16_t group_id, +rte_uuid_t domain_id, +enum +rte_dma_access_pair_group_event_type event); + +/** +* Create an access pair group to enable secure DMA transfers between devices across different +* processes or operating system domains. +* +* @param dev_id +* Identifier of the DMA device initiating the group. +* @param domain_id +* Unique identifier representing the process or OS domain. +* @param token +* Authentication token used to establish the access group. +* @param[out] group_id +* Pointer to store the ID of the newly created access group. +* @param cb +* Callback function to be invoked when a member leaves the group. +* +* @return +* 0 on success, +* negative error code on failure. +*/ +int rte_dma_access_pair_group_create (int16_t dev_id,rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id,rte_dma_access_pair_group_event_cb_t cb); + +/** +* Destroy an access pair group if all participating devices have exited. This operation is only +* permitted by the device that originally created the group; attempts by other devices will result +* in failure. +* +* @param dev_id +* Identifier of the device requesting group destruction. +* @param group_id +* ID of the access group to be destroyed. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_destroy (int16_t dev_id,int16_t group_id); + +/** +* Join an existing access group to enable secure DMA transfers between devices across different +* processes or OS domains. +* +* @param dev_id +* Identifier of the DMA device attempting to join the group. +* @param group_id +* ID of the access group to join. +* @param token +* Authentication token used to validate group membership. +* @param cb +* Callback function to be invoked when the device leaves the group or when the group +* is destroyed due to some exception or failure. +* +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_join (int16_t dev_id,int16_t group_id,rte_uuid_t token, +rte_dma_access_pair_group_event_cb_t cb); + +/** +* Leave an access group, removing the device's entry from the group table and disabling +* inter-domain DMA transfers to and from this device. This operation is not permitted for the +* device that originally created the group. +* +* @param dev_id +* Identifier of the device requesting to leave the group. +* @param group_id +* ID of the access group to leave. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_leave (int16_t dev_id,int16_t group_id); + +/** +* Retrieve the handler associated with a specific domain ID, which is used by the application to +* query source or destinationin handler to initiate inter-process or inter-OS DMA transfers. +* +* @param dev_id +* Identifier of the DMA device requesting the handler. +* @param group_id +* ID of the access group to query. +* @param group_tbl +* Unique identifier of the target process or OS domain. +* @param[out] handler +* Pointer to store the retrieved handler value. +* @return +* 0 on success, +* negative value on failure indicating the error code. +*/ +int rte_dma_access_pair_group_handler_get (int16_t dev_id,int16_t group_id,rte_uuid_t domain_id, +uint16_t *handler); +/** * DMA transfer result status code defines. * lib/dmadev/rte_dmadev_pmd.h +29
-0@@ -64,6 +64,29 @@ typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc/** @internal Used to dump internal information. */ typedef int (*rte_dma_dump_t )(const struct rte_dma_dev *dev,FILE *f); +/** @internal Used to create an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_create_t )(const struct rte_dma_dev *dev, +rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id, +rte_dma_access_pair_group_event_cb_t cb); + +/** @internal Used to destroy an access pair group when all other devices have exited. */ +typedef int (*rte_dma_access_pair_group_destroy_t )(const struct rte_dma_dev *dev, +int16_t group_id); + +/** @internal Used to join an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_join_t )(const struct rte_dma_dev *dev,int16_t group_id, +rte_uuid_t token, +rte_dma_access_pair_group_event_cb_t cb); + +/** @internal Used to leave an access pair group, removing the device from the group. */ +typedef int (*rte_dma_access_pair_group_leave_t )(const struct rte_dma_dev *dev,int16_t group_id); + +/** @internal Used to retrieve handler information of the domain_id present in the group. */ +typedef int (*rte_dma_access_pair_group_handler_get_t )(const struct rte_dma_dev *dev, +int16_t group_id,rte_uuid_t domain_id, +uint16_t *handler); +/** * DMA device operations function pointer table. * @@ -83,6 +106,12 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_pair_group_create_t access_pair_group_create; +rte_dma_access_pair_group_destroy_t access_pair_group_destroy; +rte_dma_access_pair_group_join_t access_pair_group_join; +rte_dma_access_pair_group_leave_t access_pair_group_leave; +rte_dma_access_pair_group_handler_get_t access_pair_group_handler_get; };/** lib/dmadev/rte_dmadev_trace.h +42
-0@@ -101,6 +101,48 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (ret); ) +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_create, + RTE_TRACE_POINT_ARGS(int16_t dev_id, rte_uuid_t domain_id, rte_uuid_t token, + int16_t *group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u8_ptr (&domain_id[0 ]); +rte_trace_point_emit_u8_ptr (&token[0 ]); +rte_trace_point_emit_ptr (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_destroy, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_join, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id, rte_uuid_t token), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +rte_trace_point_emit_u8_ptr (&token[0 ]); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_leave, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +) + +RTE_TRACE_POINT ( + rte_dma_trace_access_pair_group_handler_get, + RTE_TRACE_POINT_ARGS(int16_t dev_id, int16_t group_id, rte_uuid_t domain_id, + uint16_t *handler), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_i16 (group_id); +rte_trace_point_emit_u8_ptr (&domain_id[0 ]); +rte_trace_point_emit_ptr (handler); +) + #ifdef __cplusplus }#endif
PATCH v4 1/1 lib/dma: add control-plane APIs for inter-domain DMA transfers
In reply to Vamsi KrishnaFrom: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.
Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokes rte_dma_access_pair_group_create() to establish a new access pair group, then shares the group_id and token with Process 2 via IPC.
Process 2 (Group Joiner):
Receives the group_id and token from Process 1 and calls rte_dma_access_pair_group_join() to join the group.
Both Processes:
Use rte_dma_access_pair_group_handler_get() to obtain handler information for domains in the group.
Perform DMA transfers as required.
Process 2 (when finished):
Calls rte_dma_access_pair_group_leave() to exit the group.
Process 1:
Monitors for group updates and confirms group membership as needed.
Depends-on: patch-36386 (lib/dma: introduce inter-process and inter-OS DMA)
---
V4 Changes:
* Fix minor comments in documentation.
V3 Changes:
* Add documentation to dmadev doc.
* Add common callback for group creator and joiner.
* Fix V2 review comments
doc/guides/prog_guide/dmadev.rst | 49 +++++++++++ lib/dmadev/rte_dmadev.c | 138 +++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 137 ++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_pmd.h | 29 +++++++ lib/dmadev/rte_dmadev_trace.h | 42 ++++++++++ 5 files changed, 395 insertions(+)
doc/guides/prog_guide/dmadev.rst +49 -0
@@ -174,3 +174,52 @@ are shown below. For more information on how to use the Telemetry interface, see the :doc:`../howto/telemetry`. + +Inter-domain DMA Capabilities +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The inter-domain DMA feature enables DMA devices to perform data transfers +across different processes and OS domains. This is achieved by configuring +virtual channels (vchans) using `src_handler` and `dst_handler` fields, which +represent the source and destination endpoints for inter-domain DMA operations. +Handler information is exchanged between devices based on their DMA class type. +These handler details will be exchanged based on the type of DMA devices. + +DMA devices used for inter-domain data transfer can be categorized as follows: + +Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices). +Class B: Only one endpoint requires a DMA device; the other does not. +Class C: Other device types not currently classified. + +Currently the necessary APIs for Class A DMA devices are avilable for exchanging the handler +details. Devices can create or join access groups using token-based authentication, ensuring +that only authorized devices within the same group can perform DMA transfers across processes +or OS domains. + +API usage flow for setting up the access pair group for DMA between process#1 & process#2. + +Process#1 (Group Creator): +-------------------------- +Calls ``rte_dma_access_pair_group_create`` to establish a new access pair group, +then shares the ``group_id``, ``token`` and ``domain_id`` with Process#2 via IPC. + +Process#2 (Group Joiner): +------------------------- +Receives the ``group_id`` and ``token`` from Process#1 and calls ``rte_dma_access_pair_group_join`` +to join the group. + +Both Processes: +--------------- +Use ``rte_dma_access_pair_group_handler_get`` to obtain ``handler`` information for domains +in the group. + +--Perform inter-domain DMA transfers as required. + +Process#2 (when finished): +-------------------------- +Calls ``rte_dma_access_pair_group_leave`` to exit the group. + +Process#1 (final cleanup): +-------------------------- +Calls ``rte_dma_access_pair_group_destroy`` to destroy the group. +
lib/dmadev/rte_dmadev.c +138 -0
144 lines not on this page · raw message
lib/dmadev/rte_dmadev.h +137 -0
149 lines not on this page · raw message
lib/dmadev/rte_dmadev_pmd.h +29 -0
@@ -64,6 +64,29 @@ typedef int (*rte_dma_vchan_status_t)(const struct rte_dma_dev *dev, uint16_t vc/** @internal Used to dump internal information. */ typedef int (*rte_dma_dump_t )(const struct rte_dma_dev *dev,FILE *f); +/** @internal Used to create an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_create_t )(const struct rte_dma_dev *dev, +rte_uuid_t domain_id,rte_uuid_t token, +int16_t *group_id, +rte_dma_access_pair_group_event_cb_t cb); + +/** @internal Used to destroy an access pair group when all other devices have exited. */ +typedef int (*rte_dma_access_pair_group_destroy_t )(const struct rte_dma_dev *dev, +int16_t group_id); + +/** @internal Used to join an access pair group for inter-process or inter-OS DMA transfers. */ +typedef int (*rte_dma_access_pair_group_join_t )(const struct rte_dma_dev *dev,int16_t group_id, +rte_uuid_t token, +rte_dma_access_pair_group_event_cb_t cb); + +/** @internal Used to leave an access pair group, removing the device from the group. */ +typedef int (*rte_dma_access_pair_group_leave_t )(const struct rte_dma_dev *dev,int16_t group_id); + +/** @internal Used to retrieve handler information of the domain_id present in the group. */ +typedef int (*rte_dma_access_pair_group_handler_get_t )(const struct rte_dma_dev *dev, +int16_t group_id,rte_uuid_t domain_id, +uint16_t *handler); +/** * DMA device operations function pointer table. *
@@ -83,6 +106,12 @@ struct rte_dma_dev_ops {rte_dma_vchan_status_t vchan_status;rte_dma_dump_t dev_dump; + +rte_dma_access_pair_group_create_t access_pair_group_create; +rte_dma_access_pair_group_destroy_t access_pair_group_destroy; +rte_dma_access_pair_group_join_t access_pair_group_join; +rte_dma_access_pair_group_leave_t access_pair_group_leave; +rte_dma_access_pair_group_handler_get_t access_pair_group_handler_get; };/**
lib/dmadev/rte_dmadev_trace.h +42 -0
48 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
17/10/2025 16:06, Vamsi Krishna:
doc/guides/prog_guide/dmadev.rst are shown below. · line 184
Quoted 9 lines
doc/guides/prog_guide/dmadev.rst +7
-0+Inter-domain DMA Capabilities +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The inter-domain DMA feature enables DMA devices to perform data transfers +across different processes and OS domains. This is achieved by configuring +virtual channels (vchans) using `src_handler` and `dst_handler` fields, which +represent the source and destination endpoints for inter-domain DMA operations.
This belongs to the first patch.
doc/guides/prog_guide/dmadev.rst are shown below. · line 186
Quoted 2 lines
doc/guides/prog_guide/dmadev.rst +2
-0+Handler information is exchanged between devices based on their DMA class type. +These handler details will be exchanged based on the type of DMA devices.
Repeated sentence. The first one looks better.
Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
In reply to Vamsi Krishna17/10/2025 16:06, Vamsi Krishna:
Quoted 41 lines
From: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokesrte_dma_access_pair_group_create()to establish a new access pair group, then shares thegroup_idand token with Process 2 via IPC.Process 2 (Group Joiner):
Receives thegroup_idand token from Process 1 and callsrte_dma_access_pair_group_join()to join the group.Both Processes:
Userte_dma_access_pair_group_handler_get()to obtain handler information for domains in the group.
Perform DMA transfers as required.Process 2 (when finished):
Callsrte_dma_access_pair_group_leave()to exit the group.
Quoted 7 lines
Process 1:
Monitors for group updates and confirms group membership as needed.Depends-on: patch-36386 (lib/dma: introduce inter-process and inter-OS DMA)
Signed-off-by Vamsi Attunuru <[email protected]>Acked-by Chengwen Feng <[email protected]>
Added experimental status, release notes, cleaned doc and logs. It doesn't look ready but I've applied it because Chengwen Feng acked it.
I'm not sure about having different API functions for leave and destroy. I think the last leaving should automatically call the destroy driver function.
RE: [EXTERNAL] Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
Quoted 50 lines
ZjQcmQRYFpfptBannerEnd
17/10/2025 16:06, Vamsi Krishna:Quoted 47 lines
From: Vamsi Attunuru <[email protected]>
Secure and controlled inter-domain DMA transfers require dedicated control-plane APIs to create and manage access groups.
DMA devices used for inter-process data transfer can be categorized as follows:
Class A: Both endpoints require a DMA device for data transfer (e.g., Marvell DMA devices).
Class B: Only one endpoint requires a DMA device; the other does not. Class C: Other device types not currently classified.Providing a unified API for all these categories is complex, as Linux and other operating systems do not offer native control-plane APIs for this purpose. Therefore, DPDK can implement its own control-plane mechanisms to support Class A, B, and C devices.
This commit introduces the necessary APIs for Class A DMA devices. Devices can create or join access groups using token-based authentication, ensuring that only authorized devices within the same group can perform DMA transfers across processes or OS domains.
API Usage Flow:
Process 1 (Group Creator):
Invokesrte_dma_access_pair_group_create()to establish a new access pair group, then shares thegroup_idand token with Process 2 via IPC.Process 2 (Group Joiner):
Receives thegroup_idand token from Process 1 and callsrte_dma_access_pair_group_join()to join the group.Both Processes:
Userte_dma_access_pair_group_handler_get()to obtain handler information for domains in the group.
Perform DMA transfers as required.Process 2 (when finished):
Callsrte_dma_access_pair_group_leave()to exit the group.Process 1:
Monitors for group updates and confirms group membership as needed.Depends-on: patch-36386 (lib/dma: introduce inter-process and inter-OS DMA)
Quoted 9 lines
Quoted 2 lines
Signed-off-by Vamsi Attunuru <[email protected]>Acked-by Chengwen Feng <[email protected]>Added experimental status, release notes, cleaned doc and logs. It doesn't look ready but I've applied it because Chengwen Feng acked it.
I'm not sure about having different API functions for leave and destroy. I think the last leaving should automatically call the destroy driver function.
Thanks Thomas. The leave and destroy operations are invoked from different contexts. Group joiners call leave to exit the group, whereas group creator calls destroy to terminate the group after all members have left.
Re: [EXTERNAL] Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
19/10/2025 10:37, Vamsi Krishna Attunuru:
Quoted 6 lines
Quoted 2 lines
I'm not sure about having different API functions for leave and destroy. I think the last leaving should automatically call the destroy driver function.
Thanks Thomas. The leave and destroy operations are invoked from different contexts. Group joiners call leave to exit the group, whereas group creator calls destroy to terminate the group after all members have left.
I understand that, but why having a different function? You could destroy automatically when all have left.
RE: [EXTERNAL] Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
Quoted 27 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, October 19, 2025 2:30 PM
To: Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers19/10/2025 10: 37, Vamsi Krishna Attunuru: > >I'm not sure about having different API functions for leave and destroy. > >I think the last leaving should automatically call the destroy driver function. > > Thanks Thomas. The ZjQcmQRYFpfptBannerStart Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments <https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!s03ZFT5UghT6F8_WM_IWhawo- 0NYFJvmsVQvTa22RvWnmOc9sjgGsrPAVXpUWyxya37jLw$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
19/10/2025 10:37, Vamsi Krishna Attunuru:Quoted 3 lines
Quoted 2 lines
I'm not sure about having different API functions for leave and destroy. I think the last leaving should automatically call the destroy driver function.
Quoted 8 lines
Quoted 1 line
Thanks Thomas. The leave and destroy operations are invoked from
different contexts.
Quoted 2 lines
Group joiners call leave to exit the group, whereas group creator calls destroy to terminate the group after all members have left.
I understand that, but why having a different function? You could destroy automatically when all have left.
Yes, but I think the group creator & joiner's contexts and their lifecycles may not be tightly coupled here. If the creator intends to maintain the group for future joiners or delayed cleanup, it might lead to premature termination.
With destroy API, group creator will have explicit control over group termination, and not inferred from usage.
Re: [EXTERNAL] Re: [PATCH v4 1/1] lib/dma: add control-plane APIs for inter-domain DMA transfers
19/10/2025 11:40, Vamsi Krishna Attunuru:
Quoted 14 lines
From: Thomas Monjalon <[email protected]>
Quoted 4 lines
19/10/2025 10:37, Vamsi Krishna Attunuru:
Quoted 3 lines
Quoted 2 lines
I'm not sure about having different API functions for leave and destroy. I think the last leaving should automatically call the destroy driver function.
Quoted 8 lines
Quoted 1 line
Thanks Thomas. The leave and destroy operations are invoked from
different contexts.
Quoted 2 lines
Group joiners call leave to exit the group, whereas group creator calls destroy to terminate the group after all members have left.
I understand that, but why having a different function? You could destroy automatically when all have left.
Quoted 6 lines
Yes, but I think the group creator & joiner's contexts and their lifecycles may not be tightly coupled here. If the creator intends to maintain the group for future joiners or delayed cleanup, it might lead to premature termination.
With destroy API, group creator will have explicit control over group termination, and not inferred from usage.
OK