dmadev: add enqueue dequeue operations
RFC PATCH 1/4 dmadev: add enqueue dequeue operations
From: Pavan Nikhilesh <[email protected]>
Add enqueue/dequeue operations that use struct rte_dma_op to communicate with the dma device.
These operations need to be enabled at dma device configuration time by setting the flag rte_dma_conf::enable_enq_deq if the device supports RTE_DMA_CAPA_OPS_ENQ_DEQ capability. The enqueue dequeue operations are not compatible with rte_dma_copy, rte_dma_copy_sg, rte_dma_fill, rte_dma_submit, rte_dma_completed, rte_dma_completed_status range of APIs.
--- lib/dmadev/rte_dmadev.c | 18 ++++ lib/dmadev/rte_dmadev.h | 145 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_core.h | 10 ++ lib/dmadev/rte_dmadev_trace_fp.h | 20 ++++ lib/dmadev/rte_dmadev_trace_points.c | 6 ++ 5 files changed, 199 insertions(+)
lib/dmadev/rte_dmadev.c +18 -0
@@ -921,6 +921,22 @@ dummy_burst_capacity(__rte_unused const void *dev_private,return 0 ; } +static uint16_t +dummy_enqueue(__rte_unused void *dev_private, __rte_unused uint16_t vchan, + __rte_unused struct rte_dma_op **ops, __rte_unused uint16_t nb_ops) +{ +RTE_DMA_LOG (ERR ,"Enqueue not configured or not supported." ); +return 0 ; +} + +static uint16_t +dummy_dequeue(__rte_unused void *dev_private, __rte_unused uint16_t vchan, + __rte_unused struct rte_dma_op **ops, __rte_unused uint16_t nb_ops) +{ +RTE_DMA_LOG (ERR ,"Enqueue not configured or not supported." ); +return 0 ; +} +static void dma_fp_object_dummy (struct rte_dma_fp_object *obj) {
@@ -932,6 +948,8 @@ dma_fp_object_dummy(struct rte_dma_fp_object *obj) obj->completed = dummy_completed; obj->completed_status = dummy_completed_status; obj->burst_capacity = dummy_burst_capacity; + obj->enqueue = dummy_enqueue; + obj->dequeue = dummy_dequeue; } static int
lib/dmadev/rte_dmadev.h +145 -0
169 lines not on this page · raw message
lib/dmadev/rte_dmadev_core.h +10 -0
@@ -50,6 +50,14 @@ typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private,/** @internal Used to check the remaining space in descriptor ring. */ typedef uint16_t (*rte_dma_burst_capacity_t )(const void *dev_private,uint16_t vchan); +/** @internal Used to enqueue a rte_dma_op to the dma engine. */ +typedef uint16_t (*rte_dma_enqueue_ops_t )(void *dev_private,uint16_t vchan, +struct rte_dma_op **ops,uint16_t nb_ops); + +/** @internal Used to dequeue rte_dma_op from the dma engine. */ +typedef uint16_t (*rte_dma_dequeue_ops_t )(void *dev_private,uint16_t vchan, +struct rte_dma_op **ops,uint16_t nb_ops); +/** * @internal * Fast-path dmadev functions and related data are hold in a flat array.
@@ -73,6 +81,8 @@ struct __rte_cache_aligned rte_dma_fp_object {rte_dma_completed_t completed;rte_dma_completed_status_t completed_status;rte_dma_burst_capacity_t burst_capacity; +rte_dma_enqueue_ops_t enqueue; +rte_dma_dequeue_ops_t dequeue; };extern struct rte_dma_fp_object *rte_dma_fp_objs;
lib/dmadev/rte_dmadev_trace_fp.h +20 -0
@@ -143,6 +143,26 @@ RTE_TRACE_POINT_FP(rte_trace_point_emit_u16 (ret); ) +RTE_TRACE_POINT_FP ( + rte_dma_trace_enqueue_ops, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, void **ops, + uint16_t nb_ops), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (vchan); +rte_trace_point_emit_ptr (ops); +rte_trace_point_emit_u16 (nb_ops); +) + +RTE_TRACE_POINT_FP ( + rte_dma_trace_dequeue_ops, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, void **ops, + uint16_t nb_ops), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (vchan); +rte_trace_point_emit_ptr (ops); +rte_trace_point_emit_u16 (nb_ops); +) + #ifdef __cplusplus }#endif
lib/dmadev/rte_dmadev_trace_points.c +6 -0
@@ -56,3 +56,9 @@ RTE_TRACE_POINT_REGISTER(rte_dma_trace_completed_status,RTE_TRACE_POINT_REGISTER (rte_dma_trace_burst_capacity, lib.dmadev.burst_capacity) + +RTE_TRACE_POINT_REGISTER (rte_dma_trace_enqueue_ops, + lib.dmadev.enqueue_ops) + +RTE_TRACE_POINT_REGISTER (rte_dma_trace_dequeue_ops, + lib.dmadev.dequeue_ops)
Signature · 1 line
2.43.0
RFC PATCH 2/4 eventdev: refactor rte_event_dma_adapater_op calls
From: Pavan Nikhilesh <[email protected]>
Migrate all invocations of rte_event_dma_adapter_op API to rte_dma_op.
--- app/test-eventdev/test_perf_common.c | 6 +-- app/test-eventdev/test_perf_common.h | 4 +- app/test/test_event_dma_adapter.c | 6 +-- drivers/dma/cnxk/cnxk_dmadev.c | 2 +- drivers/dma/cnxk/cnxk_dmadev_fp.c | 12 +++--- lib/eventdev/rte_event_dma_adapter.c | 18 ++++----- lib/eventdev/rte_event_dma_adapter.h | 57 ---------------------------- 7 files changed, 24 insertions(+), 81 deletions(-)
app/test-eventdev/test_perf_common.c +3 -3
@@ -562,11 +562,11 @@ crypto_adapter_enq_op_fwd(struct prod_data *p)static inline void dma_adapter_enq_op_fwd (struct prod_data *p) { -struct rte_event_dma_adapter_op *ops[BURST_SIZE ] = {NULL }; +struct rte_dma_op *ops[BURST_SIZE ] = {NULL };struct test_perf *t = p->t;const uint32_t nb_flows = t->nb_flows;const uint64_t nb_pkts = t->nb_pkts; -struct rte_event_dma_adapter_op op; +struct rte_dma_op op;struct rte_event evts[BURST_SIZE ];const uint8_t dev_id = p->dev_id;struct evt_options *opt = t->opt;
@@ -2114,7 +2114,7 @@ perf_mempool_setup(struct evt_test *test, struct evt_options *opt) }else if (opt->prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { t->pool = rte_mempool_create(test->name, /* mempool name */ opt->pool_sz, /* number of elements*/ - sizeof(struct rte_event_dma_adapter_op) + + sizeof(struct rte_dma_op) + (sizeof(struct rte_dma_sge) * 2), cache_sz, /* cache size*/ 0, NULL, NULL, NULL, /* obj constructor */
app/test-eventdev/test_perf_common.h +2 -2
@@ -139,7 +139,7 @@ perf_mark_fwd_latency(enum evt_prod_type prod_type, struct rte_event *const ev) } pe->timestamp =rte_get_timer_cycles (); }else if (prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { -struct rte_event_dma_adapter_op *op = ev->event_ptr; +struct rte_dma_op *op = ev->event_ptr; op->user_meta =rte_get_timer_cycles (); }else {
@@ -297,7 +297,7 @@ perf_process_last_stage_latency(struct rte_mempool *const pool, enum evt_prod_ty tstamp = pe->timestamp;rte_crypto_op_free (op); }else if (prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { -struct rte_event_dma_adapter_op *op = ev->event_ptr; +struct rte_dma_op *op = ev->event_ptr; to_free_in_bulk = op; tstamp = op->user_meta;
app/test/test_event_dma_adapter.c +3 -3
@@ -234,7 +234,7 @@ test_op_forward_mode(void) {struct rte_mbuf *src_mbuf[TEST_MAX_OP ];struct rte_mbuf *dst_mbuf[TEST_MAX_OP ]; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct rte_event ev[TEST_MAX_OP ];int ret, i;
@@ -266,7 +266,7 @@ test_op_forward_mode(void) op->vchan =TEST_DMA_VCHAN_ID ; op->event_meta = dma_response_info.event; -/* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ +/* Fill in event info and update event_ptr with rte_dma_op */ memset (&ev[i],0 ,sizeof (struct rte_event )); ev[i].event =0 ; ev[i].op =RTE_EVENT_OP_NEW ;
@@ -396,7 +396,7 @@ configure_dmadev(void) rte_socket_id());RTE_TEST_ASSERT_NOT_NULL (params.dst_mbuf_pool,"Can't create DMA_DST_MBUFPOOL\n" ); - elt_size =sizeof (struct rte_event_dma_adapter_op ) + (sizeof (struct rte_dma_sge ) *2 ); + elt_size =sizeof (struct rte_dma_op ) + (sizeof (struct rte_dma_sge ) *2 ); params.op_mpool =rte_mempool_create ("EVENT_DMA_OP_POOL" ,DMA_OP_POOL_SIZE , elt_size,0 ,0 ,NULL ,NULL ,NULL ,NULL ,rte_socket_id (),0 );RTE_TEST_ASSERT_NOT_NULL (params.op_mpool,"Can't create DMA_OP_POOL\n" );
drivers/dma/cnxk/cnxk_dmadev.c +1 -1
@@ -591,7 +591,7 @@ cnxk_dmadev_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_de rdpi = &dpivf->rdpi; rdpi->pci_dev = pci_dev; - rc =roc_dpi_dev_init (rdpi, offsetof(struct rte_event_dma_adapter_op , impl_opaque)); + rc =roc_dpi_dev_init (rdpi, offsetof(struct rte_dma_op , impl_opaque));if (rc <0 ) goto err_out_free;
drivers/dma/cnxk/cnxk_dmadev_fp.c +6 -6
@@ -453,7 +453,7 @@ uint16_t cn10k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *src, *dst; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;struct cn10k_sso_hws *work;
@@ -514,7 +514,7 @@ uint16_t cn9k_dma_adapter_dual_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *fptr, *lptr; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cn9k_sso_hws_dual *work;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;
@@ -530,7 +530,7 @@ cn9k_dma_adapter_dual_enqueue(void *ws, struct rte_event ev[], uint16_t nb_eventfor (count =0 ; count < nb_events; count++) { op = ev[count].event_ptr; rsp_info = (struct rte_event *)((uint8_t *)op + -sizeof (struct rte_event_dma_adapter_op )); +sizeof (struct rte_dma_op )); dpivf = rte_dma_fp_objs[op->dma_dev_id].dev_private; dpi_conf = &dpivf->conf[op->vchan];
@@ -586,7 +586,7 @@ uint16_t cn9k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *fptr, *lptr; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;struct cn9k_sso_hws *work;
@@ -654,11 +654,11 @@ cn9k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events)uintptr_t cnxk_dma_adapter_dequeue (uintptr_t get_work1) { -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf; - op = (struct rte_event_dma_adapter_op *)get_work1; + op = (struct rte_dma_op *)get_work1; dpivf = rte_dma_fp_objs[op->dma_dev_id].dev_private; dpi_conf = &dpivf->conf[op->vchan];
lib/eventdev/rte_event_dma_adapter.c +9 -9
@@ -39,8 +39,8 @@ struct __rte_cache_aligned dma_ops_circular_buffer {/* Size of circular buffer */ uint16_t size; -/* Pointer to hold rte_event_dma_adapter_op for processing */ -struct rte_event_dma_adapter_op **op_buffer; +/* Pointer to hold rte_dma_op for processing */ +struct rte_dma_op **op_buffer; };/* Vchan information */
@@ -201,7 +201,7 @@ edma_circular_buffer_space_for_batch(struct dma_ops_circular_buffer *bufp)static inline int edma_circular_buffer_init (const char *name,struct dma_ops_circular_buffer *buf,uint16_t sz) { - buf->op_buffer =rte_zmalloc (name,sizeof (struct rte_event_dma_adapter_op *) * sz,0 ); + buf->op_buffer =rte_zmalloc (name,sizeof (struct rte_dma_op *) * sz,0 );if (buf->op_buffer ==NULL )return -ENOMEM ;
@@ -217,7 +217,7 @@ edma_circular_buffer_free(struct dma_ops_circular_buffer *buf) }static inline int -edma_circular_buffer_add (struct dma_ops_circular_buffer *bufp,struct rte_event_dma_adapter_op *op) +edma_circular_buffer_add (struct dma_ops_circular_buffer *bufp,struct rte_dma_op *op) {uint16_t *tail = &bufp->tail;
@@ -235,7 +235,7 @@ edma_circular_buffer_flush_to_dma_dev(struct event_dma_adapter *adapter, struct dma_ops_circular_buffer *bufp, uint8_t dma_dev_id, uint16_t vchan, uint16_t *nb_ops_flushed) { - struct rte_event_dma_adapter_op *op; + struct rte_dma_op *op;uint16_t *head = &bufp->head;uint16_t *tail = &bufp->tail;struct dma_vchan_info *tq;
@@ -498,7 +498,7 @@ edma_enq_to_dma_dev(struct event_dma_adapter *adapter, struct rte_event *ev, uns {struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;struct dma_vchan_info *vchan_qinfo =NULL ; -struct rte_event_dma_adapter_op *dma_op; +struct rte_dma_op *dma_op;uint16_t vchan, nb_enqueued =0 ;int16_t dma_dev_id;unsigned int i, n;
@@ -641,7 +641,7 @@ edma_adapter_enq_run(struct event_dma_adapter *adapter, unsigned int max_enq)#define DMA_ADAPTER_MAX_EV_ENQ_RETRIES 100static inline uint16_t -edma_ops_enqueue_burst (struct event_dma_adapter *adapter,struct rte_event_dma_adapter_op **ops, +edma_ops_enqueue_burst (struct event_dma_adapter *adapter,struct rte_dma_op **ops,uint16_t num) {struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;
@@ -687,7 +687,7 @@ edma_circular_buffer_flush_to_evdev(struct event_dma_adapter *adapter,struct dma_ops_circular_buffer *bufp, uint16_t *enqueue_count) { - struct rte_event_dma_adapter_op **ops = bufp->op_buffer; + struct rte_dma_op **ops = bufp->op_buffer;uint16_t n =0 , nb_ops_flushed;uint16_t *head = &bufp->head;uint16_t *tail = &bufp->tail;
@@ -736,7 +736,7 @@ edma_adapter_deq_run(struct event_dma_adapter *adapter, unsigned int max_deq)struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;struct dma_vchan_info *vchan_info;struct dma_ops_circular_buffer *tq_buf; -struct rte_event_dma_adapter_op *ops; +struct rte_dma_op *ops;uint16_t n, nb_deq, nb_enqueued, i;struct dma_device_info *dev_info;uint16_t vchan, num_vchan;
lib/eventdev/rte_event_dma_adapter.h +0 -57
63 lines not on this page · raw message
Signature · 1 line
2.43.0
RE: [PATCH RFC 2/4] eventdev: refactor rte_event_dma_adapater_op calls
Quoted 22 lines
-----Original Message-----
From: Kommula Shiva Shankar <[email protected]>
Sent: Wednesday, January 29, 2025 8:07 PM
To: Jerin Jacob <[email protected]>; Amit Prakash Shukla <[email protected]>; Vamsi Krishna Attunuru <[email protected]>; [email protected]; [email protected]
Cc: Nithin Kumar Dabilpuram <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>
Subject: [PATCH RFC 2/4] eventdev: refactorrte_event_dma_adapater_opcallsFrom: Pavan Nikhilesh <[email protected]>
Migrate all invocations of
rte_event_dma_adapter_opAPI torte_dma_op.Signed-off-by Pavan Nikhilesh <[email protected]>Change-Id I56b6e61af72d119287b0d2ba6a9bbacc3ae808d6---
app/test-eventdev/test_perf_common.c| 6 +-- app/test-eventdev/test_perf_common.h| 4 +-
Quoted 7 lines
app/test/test_event_dma_adapter.c | 6 +-- drivers/dma/cnxk/cnxk_dmadev.c | 2 +- drivers/dma/cnxk/cnxk_dmadev_fp.c | 12 +++--- lib/eventdev/rte_event_dma_adapter.c | 18 ++++----- lib/eventdev/rte_event_dma_adapter.h | 57 ---------------------------- 7 files changed, 24 insertions(+), 81 deletions(-)
Thanks,
Amit Shukla
Quoted 338 lines
app/test- renamed from app/test-eventdev/test_perf_common.c +0
-0
eventdev/test_perf_common.c
index627f07caa1..4e0109db52100644app/test-eventdev/test_perf_common.c +2
-2@@ -562,11 +562,11 @@ crypto_adapter_enq_op_fwd(struct prod_data *p)static inline void dma_adapter_enq_op_fwd (struct prod_data *p) { -struct rte_event_dma_adapter_op *ops[BURST_SIZE ] = {NULL }; +struct rte_dma_op *ops[BURST_SIZE ] = {NULL };struct test_perf *t = p->t;const uint32_t nb_flows = t->nb_flows;const uint64_t nb_pkts = t->nb_pkts; -struct rte_event_dma_adapter_op op; +struct rte_dma_op op;struct rte_event evts[BURST_SIZE ];const uint8_t dev_id = p->dev_id;struct evt_options *opt = t->opt;@@ -2114,7 +2114,7 @@ perf_mempool_setup(struct evt_test *test, struct evt_options *opt) }else if (opt->prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { t->pool = rte_mempool_create(test->name, /* mempoolname */
opt->pool_sz, /* number of
elements*/app/test-eventdev/test_perf_common.c +0
-1- sizeof(struct
rte_event_dma_adapter_op) +app/test-eventdev/test_perf_common.c +1
-0+sizeof (struct rte_dma_op ) + (sizeof(struct rte_dma_sge)* 2),
cache_sz, /* cache
size*/
0, NULL, NULL, NULL, /* obj
constructor */app/test- renamed from app/test-eventdev/test_perf_common.h +0
-0
eventdev/test_perf_common.h
indexd7333ad390..63078b0ee2100644app/test-eventdev/test_perf_common.h +1
-1@@ -139,7 +139,7 @@ perf_mark_fwd_latency(enum evt_prod_type prod_type, struct rte_event *const ev) } pe->timestamp =rte_get_timer_cycles (); }else if (prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { -struct rte_event_dma_adapter_op *op = ev->event_ptr; +struct rte_dma_op *op = ev->event_ptr; op->user_meta =rte_get_timer_cycles ();app/test-eventdev/test_perf_common.h +1
-1}else {@@ -297,7 +297,7 @@ perf_process_last_stage_latency(struct rte_mempool *const pool, enum evt_prod_ty tstamp = pe->timestamp;rte_crypto_op_free (op); }else if (prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { -struct rte_event_dma_adapter_op *op = ev->event_ptr; +struct rte_dma_op *op = ev->event_ptr; to_free_in_bulk = op;app/test-eventdev/test_perf_common.h +0
-0tstamp = op->user_meta;app/test/test_event_dma_adapter.c +1
-2@@ -234,7 +234,7 @@ test_op_forward_mode(void) {struct rte_mbuf *src_mbuf[TEST_MAX_OP ];struct rte_mbuf *dst_mbuf[TEST_MAX_OP ]; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct rte_event ev[TEST_MAX_OP ];int ret, i;@@ -266,7 +266,7 @@ test_op_forward_mode(void) op->vchan =TEST_DMA_VCHAN_ID ; op->event_meta = dma_response_info.event; -/* Fill in event info and update event_ptr with
rte_event_dma_adapter_op*/app/test/test_event_dma_adapter.c +3
-1+/* Fill in event info and update event_ptr with rte_dma_op */ memset (&ev[i],0 ,sizeof (struct rte_event )); ev[i].event =0 ; ev[i].op =RTE_EVENT_OP_NEW ;@@ -396,7 +396,7 @@ configure_dmadev(void) rte_socket_id());RTE_TEST_ASSERT_NOT_NULL (params.dst_mbuf_pool,"Can't create DMA_DST_MBUFPOOL\n"); - elt_size =sizeof (struct rte_event_dma_adapter_op ) + (sizeof (struct rte_dma_sge) * 2); + elt_size =sizeof (struct rte_dma_op ) + (sizeof (struct rte_dma_sge ) * +2 ); params.op_mpool = rte_mempool_create("EVENT_DMA_OP_POOL",
DMA_OP_POOL_SIZE,elt_size, 0,
0, NULL, NULL, NULL, NULL,rte_socket_id(), 0);
RTE_TEST_ASSERT_NOT_NULL(params.op_mpool, "Can't create
DMA_OP_POOL\n"); diff --gita/drivers/dma/cnxk/cnxk_dmadev.cb/drivers/dma/cnxk/cnxk_dmadev.cindexe7be3767b2..60b3d28d65100644drivers/dma/cnxk/cnxk_dmadev.c +0
-0@@ -591,7 +591,7 @@ cnxk_dmadev_probe(struct rte_pci_driver *pci_drv
__rte_unused, structrte_pci_dedrivers/dma/cnxk/cnxk_dmadev.c +0
-1rdpi = &dpivf->rdpi; rdpi->pci_dev = pci_dev; - rc = roc_dpi_dev_init(rdpi, offsetof(struct
rte_event_dma_adapter_op,impl_opaque));drivers/dma/cnxk/cnxk_dmadev.c +1
-0+ rc = roc_dpi_dev_init(rdpi, offsetof(struct rte_dma_op,
impl_opaque));drivers/dma/cnxk/cnxk_dmadev.c +0
-0if (rc <0 ) goto err_out_free;drivers/dma/cnxk/cnxk_dmadev_fp.c +2
-2@@ -453,7 +453,7 @@ uint16_t cn10k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *src, *dst; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;struct cn10k_sso_hws *work;@@ -514,7 +514,7 @@ uint16_t cn9k_dma_adapter_dual_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *fptr, *lptr; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cn9k_sso_hws_dual *work;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;@@ -530,7 +530,7 @@ cn9k_dma_adapter_dual_enqueue(void *ws, struct
rte_eventev[],uint16_tnb_eventdrivers/dma/cnxk/cnxk_dmadev_fp.c +0
-1for (count =0 ; count < nb_events; count++) { op = ev[count].event_ptr; rsp_info = (struct rte_event *)((uint8_t *)op + - sizeof(struct
rte_event_dma_adapter_op));drivers/dma/cnxk/cnxk_dmadev_fp.c +2
-1+ sizeof(struct rte_dma_op)); dpivf = rte_dma_fp_objs[op->dma_dev_id].dev_private; dpi_conf = &dpivf->conf[op->vchan];@@ -586,7 +586,7 @@ uint16_t cn9k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *fptr, *lptr; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;struct cn9k_sso_hws *work;@@ -654,11 +654,11 @@ cn9k_dma_adapter_enqueue(void *ws, struct
rte_eventev[],uint16_tnb_events)uintptr_tcnxk_dma_adapter_dequeue(uintptr_t get_work1){drivers/dma/cnxk/cnxk_dmadev_fp.c +2
-2-struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf; - op = (struct rte_event_dma_adapter_op *)get_work1; + op = (struct rte_dma_op *)get_work1; dpivf = rte_dma_fp_objs[op->dma_dev_id].dev_private; dpi_conf = &dpivf->conf[op->vchan];lib/eventdev/rte_event_dma_adapter.c +2
-2@@ -39,8 +39,8 @@ struct __rte_cache_aligned dma_ops_circular_buffer {/* Size of circular buffer */ uint16_t size; -/* Pointer to hold rte_event_dma_adapter_op for processing */ -struct rte_event_dma_adapter_op **op_buffer; +/* Pointer to hold rte_dma_op for processing */ +struct rte_dma_op **op_buffer; };/* Vchan information */ @@ -201,7 +201,7 @@ edma_circular_buffer_space_for_batch(struct
dma_ops_circular_buffer*bufp) static inline intedma_circular_buffer_init(const char *name, struct dma_ops_circular_buffer *buf, uint16_t sz){lib/eventdev/rte_event_dma_adapter.c +0
-1- buf->op_buffer = rte_zmalloc(name, sizeof(struct
rte_event_dma_adapter_op*) * sz, 0);lib/eventdev/rte_event_dma_adapter.c +5
-2+ buf->op_buffer =rte_zmalloc (name,sizeof (struct rte_dma_op *) * sz, +0 );if (buf->op_buffer ==NULL )return -ENOMEM ;@@ -217,7 +217,7 @@ edma_circular_buffer_free(struct dma_ops_circular_buffer *buf) }static inline int -edma_circular_buffer_add (struct dma_ops_circular_buffer *bufp,struct rte_event_dma_adapter_op *op) +edma_circular_buffer_add(struct dma_ops_circular_buffer *bufp, struct +rte_dma_op *op) {uint16_t *tail = &bufp->tail;@@ -235,7 +235,7 @@ edma_circular_buffer_flush_to_dma_dev(structevent_dma_adapter *adapter, struct dma_ops_circular_buffer *bufp, uint8_t dma_dev_id, uint16_t vchan, uint16_t *nb_ops_flushed) { - struct rte_event_dma_adapter_op *op; + struct rte_dma_op *op;uint16_t *head = &bufp->head;lib/eventdev/rte_event_dma_adapter.c +1
-1uint16_t *tail = &bufp->tail;struct dma_vchan_info *tq;@@ -498,7 +498,7 @@ edma_enq_to_dma_dev(struct event_dma_adapter *adapter, struct rte_event *ev, uns {struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;struct dma_vchan_info *vchan_qinfo =NULL ; -struct rte_event_dma_adapter_op *dma_op; +struct rte_dma_op *dma_op;uint16_t vchan, nb_enqueued =0 ;int16_t dma_dev_id;unsigned int i, n;@@ -641,7 +641,7 @@ edma_adapter_enq_run(struct event_dma_adapter *adapter, unsigned int max_enq) #define
DMA_ADAPTER_MAX_EV_ENQ_RETRIES100static inline
uint16_t
-edma_ops_enqueue_burst(structevent_dma_adapter*adapter, structrte_event_dma_adapter_op**ops,lib/eventdev/rte_event_dma_adapter.c +3
-1+edma_ops_enqueue_burst(struct event_dma_adapter *adapter, struct +rte_dma_op **ops, uint16_t num) { struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;@@ -687,7 +687,7 @@ edma_circular_buffer_flush_to_evdev(structevent_dma_adapter *adapter, struct dma_ops_circular_buffer *bufp, uint16_t *enqueue_count) { - struct rte_event_dma_adapter_op **ops = bufp->op_buffer; + struct rte_dma_op **ops = bufp->op_buffer;uint16_t n =0 , nb_ops_flushed;uint16_t *head = &bufp->head;lib/eventdev/rte_event_dma_adapter.c +1
-1uint16_t *tail = &bufp->tail;@@ -736,7 +736,7 @@ edma_adapter_deq_run(struct event_dma_adapter *adapter, unsigned int max_deq)struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;struct dma_vchan_info *vchan_info;struct dma_ops_circular_buffer *tq_buf; -struct rte_event_dma_adapter_op *ops; +struct rte_dma_op *ops;uint16_t n, nb_deq, nb_enqueued, i;struct dma_device_info *dev_info;lib/eventdev/rte_event_dma_adapter.c +0
-0uint16_t vchan, num_vchan;lib/eventdev/rte_event_dma_adapter.h +0
-2@@ -151,63 +151,6 @@extern "C" {#endif -/** -* A structure used to hold event based DMA operation entry. All the information
- * required for a DMA transfer shall be populated in "structrte_event_dma_adapter_op"
- * instance.
- */lib/eventdev/rte_event_dma_adapter.h +0
-15-struct rte_event_dma_adapter_op { -uint64_t flags; -/**< Flags related to the operation. -* @see RTE_DMA_OP_FLAG_* -*/ -struct rte_mempool *op_mp; -/**< Mempool from which op is allocated. */ -enum rte_dma_status_code status; -/**< Status code for this operation. */ -uint32_t rsvd; -/**< Reserved for future use. */ -uint64_t impl_opaque[2 ]; -/**< Implementation-specific opaque data. -* An dma device implementation use this field to hold -* implementation specific values to share between dequeue and enqueue
lib/eventdev/rte_event_dma_adapter.h +0
-10-* operations. -* The application should not modify this field. -*/ -uint64_t user_meta; -/**< Memory to store user specific metadata. -* The dma device implementation should not modify this area. -*/ -uint64_t event_meta; -/**< Event metadata of DMA completion event. -* Used when
RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BINDis notlib/eventdev/rte_event_dma_adapter.h +0
-2-* supported in OP_NEW mode. -* @see
rte_event_dma_adapter_mode::RTE_EVENT_DMA_ADAPTER_OP_NEWlib/eventdev/rte_event_dma_adapter.h +0
-1-* @see
RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BINDlib/eventdev/rte_event_dma_adapter.h +0
-2-* -* Used when
RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWDis notlib/eventdev/rte_event_dma_adapter.h +0
-2-* supported in OP_FWD mode. -* @see
rte_event_dma_adapter_mode::RTE_EVENT_DMA_ADAPTER_OP_FORWARDlib/eventdev/rte_event_dma_adapter.h +0
-7-* @see RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD -* -* @see struct rte_event::event -*/ -int16_t dma_dev_id; -/**< DMA device ID to be used with OP_FORWARD mode. -* @see
rte_event_dma_adapter_mode::RTE_EVENT_DMA_ADAPTER_OP_FORWARDlib/eventdev/rte_event_dma_adapter.h +0
-4-*/ -uint16_t vchan; -/**< DMA vchan ID to be used with OP_FORWARD mode -* @see
rte_event_dma_adapter_mode::RTE_EVENT_DMA_ADAPTER_OP_FORWARDlib/eventdev/rte_event_dma_adapter.h +0
-10-*/ -uint16_t nb_src; -/**< Number of source segments. */ -uint16_t nb_dst; -/**< Number of destination segments. */ -struct rte_dma_sge src_dst_seg[]; -/**< Source and destination segments. */ -}; -/** * DMA event adapter mode */ --2.43.0
RFC PATCH 3/4 doc: update prog guide to use rte_dma_op
In reply to Kommula Shiva ShankarFrom: Pavan Nikhilesh <[email protected]>
Update the documentation to replace all instances of rte_event_dma_adapter_op with rte_dma_op
--- doc/guides/prog_guide/eventdev/event_dma_adapter.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
doc/guides/prog_guide/eventdev/event_dma_adapter.rst +3 -3
@@ -144,7 +144,7 @@ on which it enqueues events towards the DMA adapter using ``rte_event_enqueue_bu uint32_t cap; int ret; - /* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ + /* Fill in event info and update event_ptr with rte_dma_op */ memset(&ev, 0, sizeof(ev)); . .
@@ -244,11 +244,11 @@ Set event response information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the ``RTE_EVENT_DMA_ADAPTER_OP_FORWARD`` / ``RTE_EVENT_DMA_ADAPTER_OP_NEW`` mode, -the application specifies the dmadev ID and vchan ID in ``struct rte_event_dma_adapter_op`` +the application specifies the dmadev ID and vchan ID in ``struct rte_dma_op`` and the event information (response information) needed to enqueue an event after the DMA operation has completed. The response information is specified in ``struct rte_event`` -and appended to the ``struct rte_event_dma_adapter_op``. +and appended to the ``struct rte_dma_op``. Start the adapter instance
Signature · 1 line
2.43.0
RE: [PATCH RFC 3/4] doc: update prog guide to use rte_dma_op
Quoted 14 lines
-----Original Message-----
From: Kommula Shiva Shankar <[email protected]>
Sent: Wednesday, January 29, 2025 8:07 PM
To: Jerin Jacob <[email protected]>; Amit Prakash Shukla <[email protected]>; Vamsi Krishna Attunuru <[email protected]>; [email protected]; [email protected]
Cc: Nithin Kumar Dabilpuram <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>
Subject: [PATCH RFC 3/4] doc: update prog guide to userte_dma_opFrom: Pavan Nikhilesh <[email protected]>
Quoted 9 lines
Update the documentation to replace all instances of
rte_event_dma_adapter_opwithrte_dma_opSigned-off-by Pavan Nikhilesh <[email protected]>Change-Id I0fe65d18f4601709826c11c6738cacec8991515d--- doc/guides/prog_guide/eventdev/event_dma_adapter.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 34 lines
doc/guides/prog_guide/eventdev/event_dma_adapter.rst +0
-0@@ -144,7 +144,7 @@ on which it enqueues events towards the DMAadapter using ``rte_event_enqueue_bu
uint32_t cap; int ret;- /* Fill in event info and update
event_ptrwithrte_event_dma_adapter_op
*/doc/guides/prog_guide/eventdev/event_dma_adapter.rst +1
-0+ /* Fill in event info and update event_ptr with rte_dma_op */ memset(&ev, 0, sizeof(ev)); . .@@ -244,11 +244,11 @@ Set event response information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the ``RTE_EVENT_DMA_ADAPTER_OP_FORWARD`` /
``RTE_EVENT_DMA_ADAPTER_OP_NEW`` mode, -the application specifies the dmadev ID and vchan ID in ``struct rte_event_dma_adapter_op``doc/guides/prog_guide/eventdev/event_dma_adapter.rst +2
-0+the application specifies the dmadev ID and vchan ID in ``struct +rte_dma_op`` and the event information (response information) needed to enqueue anevent after the DMA operation has completed.
The response information is specified in ``struct rte_event`` -and appended
to the ``struct rte_event_dma_adapter_op``.
+and appended to the ``struct rte_dma_op``.Start the adapter instance
--
2.43.0
RFC PATCH 4/4 dma/cnxk: implement enqueue dequeue ops
In reply to Kommula Shiva ShankarFrom: Pavan Nikhilesh <[email protected]>
Implement DMA enqueue/dequeue operations when
application enables it via configuration.
--- drivers/dma/cnxk/cnxk_dmadev.c | 25 +++++- drivers/dma/cnxk/cnxk_dmadev.h | 7 ++ drivers/dma/cnxk/cnxk_dmadev_fp.c | 140 ++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 1 deletion(-)
drivers/dma/cnxk/cnxk_dmadev.c +24 -1
@@ -19,7 +19,7 @@ cnxk_dmadev_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_inf dev_info->dev_capa =RTE_DMA_CAPA_MEM_TO_MEM |RTE_DMA_CAPA_MEM_TO_DEV |RTE_DMA_CAPA_DEV_TO_MEM |RTE_DMA_CAPA_DEV_TO_DEV |RTE_DMA_CAPA_OPS_COPY |RTE_DMA_CAPA_OPS_COPY_SG | -RTE_DMA_CAPA_M2D_AUTO_FREE ; +RTE_DMA_CAPA_M2D_AUTO_FREE |RTE_DMA_CAPA_OPS_ENQ_DEQ ;if (roc_feature_dpi_has_priority ()) { dev_info->dev_capa |=RTE_DMA_CAPA_PRI_POLICY_SP ; dev_info->nb_priorities =CN10K_DPI_MAX_PRI ;
@@ -114,6 +114,21 @@ cnxk_dmadev_configure(struct rte_dma_dev *dev, const struct rte_dma_conf *conf,if (roc_feature_dpi_has_priority ()) dpivf->rdpi.priority = conf->priority; +if (conf->enable_enq_deq) { + dev->fp_obj->copy =NULL ; + dev->fp_obj->fill =NULL ; + dev->fp_obj->submit =NULL ; + dev->fp_obj->copy_sg =NULL ; + dev->fp_obj->completed =NULL ; + dev->fp_obj->completed_status =NULL ; + + dev->fp_obj->enqueue = cnxk_dma_ops_enqueue; + dev->fp_obj->dequeue = cnxk_dma_ops_dequeue; + +if (roc_model_is_cn10k ()) + dev->fp_obj->enqueue = cn10k_dma_ops_enqueue; + } +return 0 ; }
@@ -270,6 +285,14 @@ cnxk_dmadev_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan,return -ENOMEM ; } + size = (max_desc *sizeof (struct rte_dma_op *)); + dpi_conf->c_desc.ops =rte_zmalloc (NULL , size,RTE_CACHE_LINE_SIZE ); +if (dpi_conf->c_desc.ops ==NULL ) { +plt_err ("Failed to allocate for ops array" ); +rte_free (dpi_conf->c_desc.compl_ptr); +return -ENOMEM ; + } +for (i =0 ; i < max_desc; i++) dpi_conf->c_desc.compl_ptr[i *CNXK_DPI_COMPL_OFFSET ] =CNXK_DPI_REQ_CDATA ;
drivers/dma/cnxk/cnxk_dmadev.h +7 -0
@@ -93,6 +93,7 @@ struct cnxk_dpi_cdesc_data_s {uint16_t head;uint16_t tail;uint8_t *compl_ptr; +struct rte_dma_op **ops; };struct cnxk_dpi_conf {
@@ -132,5 +133,11 @@ int cn10k_dmadev_copy(void *dev_private, uint16_t vchan, rte_iova_t src, rte_iovint cn10k_dmadev_copy_sg (void *dev_private,uint16_t vchan,const struct rte_dma_sge *src,const struct rte_dma_sge *dst,uint16_t nb_src,uint16_t nb_dst,uint64_t flags); +uint16_t cnxk_dma_ops_enqueue (void *dev_private,uint16_t vchan,struct rte_dma_op **ops, +uint16_t nb_ops); +uint16_t cn10k_dma_ops_enqueue (void *dev_private,uint16_t vchan,struct rte_dma_op **ops, +uint16_t nb_ops); +uint16_t cnxk_dma_ops_dequeue (void *dev_private,uint16_t vchan,struct rte_dma_op **ops, +uint16_t nb_ops);#endif
drivers/dma/cnxk/cnxk_dmadev_fp.c +140 -0
143 lines not on this page · raw message
Signature · 1 line
2.43.0
v2 cover Introduce DMA enqueue/dequeue operations
In reply to Kommula Shiva ShankarFrom: Pavan Nikhilesh <[email protected]>
Introduce DMA enqueue/dequeue operations to the DMA device library.
The enqueue/dequeue operations allow applications to communicate with the DMA device using the rte_dma_op structure, providing a more flexible and efficient way to manage DMA operations.
The programming model for the enqueue/dequeue operations is as follows:
* Query DMA devices capability for RTE_DMA_CAPA_OPS_ENQ_DEQ through rte_dma_info::dev_capa.
* Enable enqueue/dequeue operations on DMA device by enabling rte_dma_conf::enable_enq_deq during device configuration.
* Allocate a mempool for rte_dma_ops with object size of rte_dma_op + (sizeof(struct rte_dma_sge) * rte_dma_info::max_sges * 2).
* Configure vchans and start the dma device.
* Get an rte_dma_op from the mempool, fill it with the necessary information and use rte_dma_enqueue() to enqueue the operation.
* Call rte_dma_dequeue() operation to get the array of finished operations.
* Free the rte_dma_op back to the mempool.
The enqueue dequeue operations are not compatible with rte_dma_copy, rte_dma_copy_sg, rte_dma_fill, rte_dma_submit, rte_dma_completed and rte_dma_completed_status range of APIs.
Pavan Nikhilesh (3):
dmadev: add enqueue dequeue operations
dma/cnxk: implement enqueue dequeue ops
eventdev: refactor DMA adapter ops
app/test-eventdev/test_perf_common.c | 6 +- app/test-eventdev/test_perf_common.h | 4 +- app/test/test_event_dma_adapter.c | 6 +- .../prog_guide/eventdev/event_dma_adapter.rst | 6 +- drivers/dma/cnxk/cnxk_dmadev.c | 27 +++- drivers/dma/cnxk/cnxk_dmadev.h | 7 + drivers/dma/cnxk/cnxk_dmadev_fp.c | 152 +++++++++++++++++- lib/dmadev/rte_dmadev.c | 18 +++ lib/dmadev/rte_dmadev.h | 145 +++++++++++++++++ lib/dmadev/rte_dmadev_core.h | 10 ++ lib/dmadev/rte_dmadev_trace_fp.h | 20 +++ lib/dmadev/rte_dmadev_trace_points.c | 6 + lib/eventdev/rte_event_dma_adapter.c | 18 +-- lib/eventdev/rte_event_dma_adapter.h | 57 ------- 14 files changed, 397 insertions(+), 85 deletions(-)
--
2.43.0
RFC v2 1/3 dmadev: add enqueue dequeue operations
From: Pavan Nikhilesh <[email protected]>
Add enqueue/dequeue operations that use struct rte_dma_op to communicate with the dma device.
These operations need to be enabled at dma device configuration time by setting the flag rte_dma_conf::enable_enq_deq if the device supports RTE_DMA_CAPA_OPS_ENQ_DEQ capability. The enqueue dequeue operations are not compatible with rte_dma_copy, rte_dma_copy_sg, rte_dma_fill, rte_dma_submit, rte_dma_completed, rte_dma_completed_status range of APIs.
--- lib/dmadev/rte_dmadev.c | 18 ++++ lib/dmadev/rte_dmadev.h | 145 +++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_core.h | 10 ++ lib/dmadev/rte_dmadev_trace_fp.h | 20 ++++ lib/dmadev/rte_dmadev_trace_points.c | 6 ++ 5 files changed, 199 insertions(+)
lib/dmadev/rte_dmadev.c +18 -0
@@ -917,6 +917,22 @@ dummy_burst_capacity(__rte_unused const void *dev_private,return 0 ; } +static uint16_t +dummy_enqueue(__rte_unused void *dev_private, __rte_unused uint16_t vchan, + __rte_unused struct rte_dma_op **ops, __rte_unused uint16_t nb_ops) +{ +RTE_DMA_LOG (ERR ,"Enqueue not configured or not supported." ); +return 0 ; +} + +static uint16_t +dummy_dequeue(__rte_unused void *dev_private, __rte_unused uint16_t vchan, + __rte_unused struct rte_dma_op **ops, __rte_unused uint16_t nb_ops) +{ +RTE_DMA_LOG (ERR ,"Enqueue not configured or not supported." ); +return 0 ; +} +static void dma_fp_object_dummy (struct rte_dma_fp_object *obj) {
@@ -928,6 +944,8 @@ dma_fp_object_dummy(struct rte_dma_fp_object *obj) obj->completed = dummy_completed; obj->completed_status = dummy_completed_status; obj->burst_capacity = dummy_burst_capacity; + obj->enqueue = dummy_enqueue; + obj->dequeue = dummy_dequeue; } static int
lib/dmadev/rte_dmadev.h +145 -0
169 lines not on this page · raw message
lib/dmadev/rte_dmadev_core.h +10 -0
@@ -50,6 +50,14 @@ typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private,/** @internal Used to check the remaining space in descriptor ring. */ typedef uint16_t (*rte_dma_burst_capacity_t )(const void *dev_private,uint16_t vchan); +/** @internal Used to enqueue a rte_dma_op to the dma engine. */ +typedef uint16_t (*rte_dma_enqueue_ops_t )(void *dev_private,uint16_t vchan, +struct rte_dma_op **ops,uint16_t nb_ops); + +/** @internal Used to dequeue rte_dma_op from the dma engine. */ +typedef uint16_t (*rte_dma_dequeue_ops_t )(void *dev_private,uint16_t vchan, +struct rte_dma_op **ops,uint16_t nb_ops); +/** * @internal * Fast-path dmadev functions and related data are hold in a flat array.
@@ -73,6 +81,8 @@ struct __rte_cache_aligned rte_dma_fp_object {rte_dma_completed_t completed;rte_dma_completed_status_t completed_status;rte_dma_burst_capacity_t burst_capacity; +rte_dma_enqueue_ops_t enqueue; +rte_dma_dequeue_ops_t dequeue; };extern struct rte_dma_fp_object *rte_dma_fp_objs;
lib/dmadev/rte_dmadev_trace_fp.h +20 -0
@@ -125,6 +125,26 @@ RTE_TRACE_POINT_FP(rte_trace_point_emit_u16 (ret); ) +RTE_TRACE_POINT_FP ( + rte_dma_trace_enqueue_ops, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, void **ops, + uint16_t nb_ops), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (vchan); +rte_trace_point_emit_ptr (ops); +rte_trace_point_emit_u16 (nb_ops); +) + +RTE_TRACE_POINT_FP ( + rte_dma_trace_dequeue_ops, + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, void **ops, + uint16_t nb_ops), + rte_trace_point_emit_i16(dev_id); +rte_trace_point_emit_u16 (vchan); +rte_trace_point_emit_ptr (ops); +rte_trace_point_emit_u16 (nb_ops); +) + #ifdef __cplusplus }#endif
lib/dmadev/rte_dmadev_trace_points.c +6 -0
@@ -56,3 +56,9 @@ RTE_TRACE_POINT_REGISTER(rte_dma_trace_completed_status,RTE_TRACE_POINT_REGISTER (rte_dma_trace_burst_capacity, lib.dmadev.burst_capacity) + +RTE_TRACE_POINT_REGISTER (rte_dma_trace_enqueue_ops, + lib.dmadev.enqueue_ops) + +RTE_TRACE_POINT_REGISTER (rte_dma_trace_dequeue_ops, + lib.dmadev.dequeue_ops)
Signature · 1 line
2.43.0
RFC v2 2/3 dma/cnxk: implement enqueue dequeue ops
In reply to [email protected]From: Pavan Nikhilesh <[email protected]>
Implement DMA enqueue/dequeue operations when
application enables it via configuration.
--- drivers/dma/cnxk/cnxk_dmadev.c | 25 +++++- drivers/dma/cnxk/cnxk_dmadev.h | 7 ++ drivers/dma/cnxk/cnxk_dmadev_fp.c | 140 ++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 1 deletion(-)
drivers/dma/cnxk/cnxk_dmadev.c +24 -1
@@ -19,7 +19,7 @@ cnxk_dmadev_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_inf dev_info->dev_capa =RTE_DMA_CAPA_MEM_TO_MEM |RTE_DMA_CAPA_MEM_TO_DEV |RTE_DMA_CAPA_DEV_TO_MEM |RTE_DMA_CAPA_DEV_TO_DEV |RTE_DMA_CAPA_OPS_COPY |RTE_DMA_CAPA_OPS_COPY_SG | -RTE_DMA_CAPA_M2D_AUTO_FREE ; +RTE_DMA_CAPA_M2D_AUTO_FREE |RTE_DMA_CAPA_OPS_ENQ_DEQ ;if (roc_feature_dpi_has_priority ()) { dev_info->dev_capa |=RTE_DMA_CAPA_PRI_POLICY_SP ; dev_info->nb_priorities =CN10K_DPI_MAX_PRI ;
@@ -114,6 +114,21 @@ cnxk_dmadev_configure(struct rte_dma_dev *dev, const struct rte_dma_conf *conf,if (roc_feature_dpi_has_priority ()) dpivf->rdpi.priority = conf->priority; +if (conf->enable_enq_deq) { + dev->fp_obj->copy =NULL ; + dev->fp_obj->fill =NULL ; + dev->fp_obj->submit =NULL ; + dev->fp_obj->copy_sg =NULL ; + dev->fp_obj->completed =NULL ; + dev->fp_obj->completed_status =NULL ; + + dev->fp_obj->enqueue = cnxk_dma_ops_enqueue; + dev->fp_obj->dequeue = cnxk_dma_ops_dequeue; + +if (roc_model_is_cn10k ()) + dev->fp_obj->enqueue = cn10k_dma_ops_enqueue; + } +return 0 ; }
@@ -270,6 +285,14 @@ cnxk_dmadev_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan,return -ENOMEM ; } + size = (max_desc *sizeof (struct rte_dma_op *)); + dpi_conf->c_desc.ops =rte_zmalloc (NULL , size,RTE_CACHE_LINE_SIZE ); +if (dpi_conf->c_desc.ops ==NULL ) { +plt_err ("Failed to allocate for ops array" ); +rte_free (dpi_conf->c_desc.compl_ptr); +return -ENOMEM ; + } +for (i =0 ; i < max_desc; i++) dpi_conf->c_desc.compl_ptr[i *CNXK_DPI_COMPL_OFFSET ] =CNXK_DPI_REQ_CDATA ;
drivers/dma/cnxk/cnxk_dmadev.h +7 -0
@@ -93,6 +93,7 @@ struct cnxk_dpi_cdesc_data_s {uint16_t head;uint16_t tail;uint8_t *compl_ptr; +struct rte_dma_op **ops; };struct cnxk_dpi_conf {
@@ -131,5 +132,11 @@ int cn10k_dmadev_copy(void *dev_private, uint16_t vchan, rte_iova_t src, rte_iovint cn10k_dmadev_copy_sg (void *dev_private,uint16_t vchan,const struct rte_dma_sge *src,const struct rte_dma_sge *dst,uint16_t nb_src,uint16_t nb_dst,uint64_t flags); +uint16_t cnxk_dma_ops_enqueue (void *dev_private,uint16_t vchan,struct rte_dma_op **ops, +uint16_t nb_ops); +uint16_t cn10k_dma_ops_enqueue (void *dev_private,uint16_t vchan,struct rte_dma_op **ops, +uint16_t nb_ops); +uint16_t cnxk_dma_ops_dequeue (void *dev_private,uint16_t vchan,struct rte_dma_op **ops, +uint16_t nb_ops);#endif
drivers/dma/cnxk/cnxk_dmadev_fp.c +140 -0
143 lines not on this page · raw message
Signature · 1 line
2.43.0
RFC v2 3/3 eventdev: refactor DMA adapter ops
In reply to [email protected]From: Pavan Nikhilesh <[email protected]>
Migrate all invocations of rte_event_dma_adapter_op API to rte_dma_op.
--- app/test-eventdev/test_perf_common.c | 6 +- app/test-eventdev/test_perf_common.h | 4 +- app/test/test_event_dma_adapter.c | 6 +- .../prog_guide/eventdev/event_dma_adapter.rst | 6 +- drivers/dma/cnxk/cnxk_dmadev.c | 2 +- drivers/dma/cnxk/cnxk_dmadev_fp.c | 12 ++-- lib/eventdev/rte_event_dma_adapter.c | 18 +++--- lib/eventdev/rte_event_dma_adapter.h | 57 ------------------- 8 files changed, 27 insertions(+), 84 deletions(-)
app/test-eventdev/test_perf_common.c +3 -3
@@ -562,11 +562,11 @@ crypto_adapter_enq_op_fwd(struct prod_data *p)static inline void dma_adapter_enq_op_fwd (struct prod_data *p) { -struct rte_event_dma_adapter_op *ops[BURST_SIZE ] = {NULL }; +struct rte_dma_op *ops[BURST_SIZE ] = {NULL };struct test_perf *t = p->t;const uint32_t nb_flows = t->nb_flows;const uint64_t nb_pkts = t->nb_pkts; -struct rte_event_dma_adapter_op op; +struct rte_dma_op op;struct rte_event evts[BURST_SIZE ];const uint8_t dev_id = p->dev_id;struct evt_options *opt = t->opt;
@@ -2114,7 +2114,7 @@ perf_mempool_setup(struct evt_test *test, struct evt_options *opt) }else if (opt->prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { t->pool = rte_mempool_create(test->name, /* mempool name */ opt->pool_sz, /* number of elements*/ - sizeof(struct rte_event_dma_adapter_op) + + sizeof(struct rte_dma_op) + (sizeof(struct rte_dma_sge) * 2), cache_sz, /* cache size*/ 0, NULL, NULL, NULL, /* obj constructor */
app/test-eventdev/test_perf_common.h +2 -2
@@ -139,7 +139,7 @@ perf_mark_fwd_latency(enum evt_prod_type prod_type, struct rte_event *const ev) } pe->timestamp =rte_get_timer_cycles (); }else if (prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { -struct rte_event_dma_adapter_op *op = ev->event_ptr; +struct rte_dma_op *op = ev->event_ptr; op->user_meta =rte_get_timer_cycles (); }else {
@@ -297,7 +297,7 @@ perf_process_last_stage_latency(struct rte_mempool *const pool, enum evt_prod_ty tstamp = pe->timestamp;rte_crypto_op_free (op); }else if (prod_type ==EVT_PROD_TYPE_EVENT_DMA_ADPTR ) { -struct rte_event_dma_adapter_op *op = ev->event_ptr; +struct rte_dma_op *op = ev->event_ptr; to_free_in_bulk = op; tstamp = op->user_meta;
app/test/test_event_dma_adapter.c +3 -3
@@ -234,7 +234,7 @@ test_op_forward_mode(void) {struct rte_mbuf *src_mbuf[TEST_MAX_OP ];struct rte_mbuf *dst_mbuf[TEST_MAX_OP ]; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct rte_event ev[TEST_MAX_OP ];int ret, i;
@@ -266,7 +266,7 @@ test_op_forward_mode(void) op->vchan =TEST_DMA_VCHAN_ID ; op->event_meta = dma_response_info.event; -/* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ +/* Fill in event info and update event_ptr with rte_dma_op */ memset (&ev[i],0 ,sizeof (struct rte_event )); ev[i].event =0 ; ev[i].op =RTE_EVENT_OP_NEW ;
@@ -396,7 +396,7 @@ configure_dmadev(void) rte_socket_id());RTE_TEST_ASSERT_NOT_NULL (params.dst_mbuf_pool,"Can't create DMA_DST_MBUFPOOL\n" ); - elt_size =sizeof (struct rte_event_dma_adapter_op ) + (sizeof (struct rte_dma_sge ) *2 ); + elt_size =sizeof (struct rte_dma_op ) + (sizeof (struct rte_dma_sge ) *2 ); params.op_mpool =rte_mempool_create ("EVENT_DMA_OP_POOL" ,DMA_OP_POOL_SIZE , elt_size,0 ,0 ,NULL ,NULL ,NULL ,NULL ,rte_socket_id (),0 );RTE_TEST_ASSERT_NOT_NULL (params.op_mpool,"Can't create DMA_OP_POOL\n" );
doc/guides/prog_guide/eventdev/event_dma_adapter.rst +3 -3
@@ -144,7 +144,7 @@ on which it enqueues events towards the DMA adapter using ``rte_event_enqueue_bu uint32_t cap; int ret; - /* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ + /* Fill in event info and update event_ptr with rte_dma_op */ memset(&ev, 0, sizeof(ev)); . .
@@ -244,11 +244,11 @@ Set event response information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the ``RTE_EVENT_DMA_ADAPTER_OP_FORWARD`` / ``RTE_EVENT_DMA_ADAPTER_OP_NEW`` mode, -the application specifies the dmadev ID and vchan ID in ``struct rte_event_dma_adapter_op`` +the application specifies the dmadev ID and vchan ID in ``struct rte_dma_op`` and the event information (response information) needed to enqueue an event after the DMA operation has completed. The response information is specified in ``struct rte_event`` -and appended to the ``struct rte_event_dma_adapter_op``. +and appended to the ``struct rte_dma_op``. Start the adapter instance
drivers/dma/cnxk/cnxk_dmadev.c +1 -1
@@ -611,7 +611,7 @@ cnxk_dmadev_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_de rdpi = &dpivf->rdpi; rdpi->pci_dev = pci_dev; - rc =roc_dpi_dev_init (rdpi, offsetof(struct rte_event_dma_adapter_op , impl_opaque)); + rc =roc_dpi_dev_init (rdpi, offsetof(struct rte_dma_op , impl_opaque));if (rc <0 ) goto err_out_free;
drivers/dma/cnxk/cnxk_dmadev_fp.c +6 -6
@@ -449,7 +449,7 @@ uint16_t cn10k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *src, *dst; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;struct cn10k_sso_hws *work;
@@ -508,7 +508,7 @@ uint16_t cn9k_dma_adapter_dual_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *fptr, *lptr; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cn9k_sso_hws_dual *work;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;
@@ -524,7 +524,7 @@ cn9k_dma_adapter_dual_enqueue(void *ws, struct rte_event ev[], uint16_t nb_eventfor (count =0 ; count < nb_events; count++) { op = ev[count].event_ptr; rsp_info = (struct rte_event *)((uint8_t *)op + -sizeof (struct rte_event_dma_adapter_op )); +sizeof (struct rte_dma_op )); dpivf = rte_dma_fp_objs[op->dma_dev_id].dev_private; dpi_conf = &dpivf->conf[op->vchan];
@@ -578,7 +578,7 @@ uint16_t cn9k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events) {const struct rte_dma_sge *fptr, *lptr; -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf;struct cn9k_sso_hws *work;
@@ -644,11 +644,11 @@ cn9k_dma_adapter_enqueue(void *ws, struct rte_event ev[], uint16_t nb_events)uintptr_t cnxk_dma_adapter_dequeue (uintptr_t get_work1) { -struct rte_event_dma_adapter_op *op; +struct rte_dma_op *op;struct cnxk_dpi_conf *dpi_conf;struct cnxk_dpi_vf_s *dpivf; - op = (struct rte_event_dma_adapter_op *)get_work1; + op = (struct rte_dma_op *)get_work1; dpivf = rte_dma_fp_objs[op->dma_dev_id].dev_private; dpi_conf = &dpivf->conf[op->vchan];
lib/eventdev/rte_event_dma_adapter.c +9 -9
@@ -39,8 +39,8 @@ struct __rte_cache_aligned dma_ops_circular_buffer {/* Size of circular buffer */ uint16_t size; -/* Pointer to hold rte_event_dma_adapter_op for processing */ -struct rte_event_dma_adapter_op **op_buffer; +/* Pointer to hold rte_dma_op for processing */ +struct rte_dma_op **op_buffer; };/* Vchan information */
@@ -201,7 +201,7 @@ edma_circular_buffer_space_for_batch(struct dma_ops_circular_buffer *bufp)static inline int edma_circular_buffer_init (const char *name,struct dma_ops_circular_buffer *buf,uint16_t sz) { - buf->op_buffer =rte_zmalloc (name,sizeof (struct rte_event_dma_adapter_op *) * sz,0 ); + buf->op_buffer =rte_zmalloc (name,sizeof (struct rte_dma_op *) * sz,0 );if (buf->op_buffer ==NULL )return -ENOMEM ;
@@ -217,7 +217,7 @@ edma_circular_buffer_free(struct dma_ops_circular_buffer *buf) }static inline int -edma_circular_buffer_add (struct dma_ops_circular_buffer *bufp,struct rte_event_dma_adapter_op *op) +edma_circular_buffer_add (struct dma_ops_circular_buffer *bufp,struct rte_dma_op *op) {uint16_t *tail = &bufp->tail;
@@ -235,7 +235,7 @@ edma_circular_buffer_flush_to_dma_dev(struct event_dma_adapter *adapter, struct dma_ops_circular_buffer *bufp, uint8_t dma_dev_id, uint16_t vchan, uint16_t *nb_ops_flushed) { - struct rte_event_dma_adapter_op *op; + struct rte_dma_op *op;uint16_t *head = &bufp->head;uint16_t *tail = &bufp->tail;struct dma_vchan_info *tq;
@@ -498,7 +498,7 @@ edma_enq_to_dma_dev(struct event_dma_adapter *adapter, struct rte_event *ev, uns {struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;struct dma_vchan_info *vchan_qinfo =NULL ; -struct rte_event_dma_adapter_op *dma_op; +struct rte_dma_op *dma_op;uint16_t vchan, nb_enqueued =0 ;int16_t dma_dev_id;unsigned int i, n;
@@ -641,7 +641,7 @@ edma_adapter_enq_run(struct event_dma_adapter *adapter, unsigned int max_enq)#define DMA_ADAPTER_MAX_EV_ENQ_RETRIES 100static inline uint16_t -edma_ops_enqueue_burst (struct event_dma_adapter *adapter,struct rte_event_dma_adapter_op **ops, +edma_ops_enqueue_burst (struct event_dma_adapter *adapter,struct rte_dma_op **ops,uint16_t num) {struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;
@@ -687,7 +687,7 @@ edma_circular_buffer_flush_to_evdev(struct event_dma_adapter *adapter,struct dma_ops_circular_buffer *bufp, uint16_t *enqueue_count) { - struct rte_event_dma_adapter_op **ops = bufp->op_buffer; + struct rte_dma_op **ops = bufp->op_buffer;uint16_t n =0 , nb_ops_flushed;uint16_t *head = &bufp->head;uint16_t *tail = &bufp->tail;
@@ -736,7 +736,7 @@ edma_adapter_deq_run(struct event_dma_adapter *adapter, unsigned int max_deq)struct rte_event_dma_adapter_stats *stats = &adapter->dma_stats;struct dma_vchan_info *vchan_info;struct dma_ops_circular_buffer *tq_buf; -struct rte_event_dma_adapter_op *ops; +struct rte_dma_op *ops;uint16_t n, nb_deq, nb_enqueued, i;struct dma_device_info *dev_info;uint16_t vchan, num_vchan;
lib/eventdev/rte_event_dma_adapter.h +0 -57
63 lines not on this page · raw message
Signature · 1 line
2.43.0
RE: [RFC v2 0/3] Introduce DMA enqueue/dequeue operations
In reply to [email protected]++
Quoted 57 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, March 27, 2025 1:07 AM
To: Jerin Jacob <[email protected]>
Cc: [email protected]; Pavan Nikhilesh Bhagavatula <[email protected]>
Subject: [RFC v2 0/3] Introduce DMA enqueue/dequeue operationsFrom: Pavan Nikhilesh <[email protected]>
Introduce DMA enqueue/dequeue operations to the DMA device library.
The enqueue/dequeue operations allow applications to communicate with the DMA device using the
rte_dma_opstructure, providing a more flexible and efficient way to manage DMA operations.The programming model for the enqueue/dequeue operations is as follows:
* Query DMA devices capability for
RTE_DMA_CAPA_OPS_ENQ_DEQthroughrte_dma_info::dev_capa.
* Enable enqueue/dequeue operations on DMA device by enablingrte_dma_conf::enable_enq_deqduring device configuration.
* Allocate a mempool forrte_dma_opswith object size ofrte_dma_op+ (sizeof(struct rte_dma_sge)*rte_dma_info::max_sges* 2).
* Configure vchans and start the dma device.
* Get anrte_dma_opfrom the mempool, fill it with the necessary information and userte_dma_enqueue()to enqueue the operation.
* Callrte_dma_dequeue()operation to get the array of finished operations.
* Free therte_dma_opback to the mempool.The enqueue dequeue operations are not compatible with
rte_dma_copy,rte_dma_copy_sg,rte_dma_fill,rte_dma_submit,rte_dma_completedandrte_dma_completed_statusrange of APIs.Pavan Nikhilesh (3):
dmadev: add enqueue dequeue operations
dma/cnxk: implement enqueue dequeue ops
eventdev: refactor DMA adapter opsapp/test-eventdev/test_perf_common.c | 6 +- app/test-eventdev/test_perf_common.h | 4 +- app/test/test_event_dma_adapter.c | 6 +- .../prog_guide/eventdev/event_dma_adapter.rst | 6 +- drivers/dma/cnxk/cnxk_dmadev.c | 27 +++- drivers/dma/cnxk/cnxk_dmadev.h | 7 + drivers/dma/cnxk/cnxk_dmadev_fp.c | 152 +++++++++++++++++- lib/dmadev/rte_dmadev.c | 18 +++ lib/dmadev/rte_dmadev.h | 145 +++++++++++++++++ lib/dmadev/rte_dmadev_core.h | 10 ++ lib/dmadev/rte_dmadev_trace_fp.h | 20 +++ lib/dmadev/rte_dmadev_trace_points.c | 6 + lib/eventdev/rte_event_dma_adapter.c | 18 +-- lib/eventdev/rte_event_dma_adapter.h | 57 ------- 14 files changed, 397 insertions(+), 85 deletions(-)--
2.43.0