[dpdk-dev] [PATCH v10 09/16] dma/idxd: add data-path job submission functions

fengchengwen fengchengwen at huawei.com
Wed Oct 20 10:27:37 CEST 2021



On 2021/10/19 22:10, Kevin Laatz wrote:
> Add data path functions for enqueuing and submitting operations to DSA
> devices.
> 
> Documentation updates are included for dmadev library and IDXD driver docs
> as appropriate.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> Signed-off-by: Kevin Laatz <kevin.laatz at intel.com>
> Reviewed-by: Conor Walsh <conor.walsh at intel.com>
> ---
>  doc/guides/dmadevs/idxd.rst      |   9 +++
>  doc/guides/prog_guide/dmadev.rst |  19 +++++
>  drivers/dma/idxd/idxd_common.c   | 135 +++++++++++++++++++++++++++++++
>  drivers/dma/idxd/idxd_internal.h |   5 ++
>  drivers/dma/idxd/meson.build     |   1 +
>  5 files changed, 169 insertions(+)
> 
> diff --git a/doc/guides/dmadevs/idxd.rst b/doc/guides/dmadevs/idxd.rst
> index 711890bd9e..d548c4751a 100644
> --- a/doc/guides/dmadevs/idxd.rst
> +++ b/doc/guides/dmadevs/idxd.rst
> @@ -138,3 +138,12 @@ IDXD configuration requirements:
>  
>  Once configured, the device can then be made ready for use by calling the
>  ``rte_dma_start()`` API.
> +
> +Performing Data Copies
> +~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Refer to the :ref:`Enqueue / Dequeue APIs <dmadev_enqueue_dequeue>` section of the dmadev library
> +documentation for details on operation enqueue and submission API usage.
> +
> +It is expected that, for efficiency reasons, a burst of operations will be enqueued to the
> +device via multiple enqueue calls between calls to the ``rte_dma_submit()`` function.
> diff --git a/doc/guides/prog_guide/dmadev.rst b/doc/guides/prog_guide/dmadev.rst
> index 32f7147862..e853ffda3a 100644
> --- a/doc/guides/prog_guide/dmadev.rst
> +++ b/doc/guides/prog_guide/dmadev.rst
> @@ -67,6 +67,8 @@ can be used to get the device info and supported features.
>  Silent mode is a special device capability which does not require the
>  application to invoke dequeue APIs.
>  
> +.. _dmadev_enqueue_dequeue:
> +
>  
>  Enqueue / Dequeue APIs
>  ~~~~~~~~~~~~~~~~~~~~~~
> @@ -80,6 +82,23 @@ The ``rte_dma_submit`` API is used to issue doorbell to hardware.
>  Alternatively the ``RTE_DMA_OP_FLAG_SUBMIT`` flag can be passed to the enqueue
>  APIs to also issue the doorbell to hardware.
>  
> +The following code demonstrates how to enqueue a burst of copies to the
> +device and start the hardware processing of them:
> +
> +.. code-block:: C
> +
> +   struct rte_mbuf *srcs[DMA_BURST_SZ], *dsts[DMA_BURST_SZ];
> +   unsigned int i;
> +
> +   for (i = 0; i < RTE_DIM(srcs); i++) {
> +      if (rte_dma_copy(dev_id, vchan, rte_pktmbuf_iova(srcs),
> +            rte_pktmbuf_iova(dsts), COPY_LEN, 0) < 0) {

srcs->srcs[i]
dsts->dsts[i]

could add my reviewed-by after fix it, thanks.

> +         PRINT_ERR("Error with rte_dma_copy for buffer %u\n", i);
> +         return -1;
> +      }
> +   }
> +   rte_dma_submit(dev_id, vchan);
> +
>  There are two dequeue APIs ``rte_dma_completed`` and
>  ``rte_dma_completed_status``, these are used to obtain the results of the
>  enqueue requests. ``rte_dma_completed`` will return the number of successfully
> diff --git a/drivers/dma/idxd/idxd_common.c b/drivers/dma/idxd/idxd_common.c
> index b0c79a2e42..a686ad421c 100644
> --- a/drivers/dma/idxd/idxd_common.c
> +++ b/drivers/dma/idxd/idxd_common.c
> @@ -2,14 +2,145 @@
>   * Copyright 2021 Intel Corporation
>   */
>  

[snip]



More information about the dev mailing list