From: fengchengwen <fengchengwen@huawei.com>
To: Conor Walsh <conor.walsh@intel.com>, <bruce.richardson@intel.com>,
<jerinj@marvell.com>, <kevin.laatz@intel.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v4 04/11] dma/ioat: add configuration functions
Date: Wed, 22 Sep 2021 16:08:33 +0800 [thread overview]
Message-ID: <6d4f6b80-a546-0e6e-418f-1c26f4b3bd92@huawei.com> (raw)
In-Reply-To: <20210917154227.737554-5-conor.walsh@intel.com>
On 2021/9/17 23:42, Conor Walsh wrote:
> Add functions for device configuration. The info_get and close functions
> are included here also. info_get can be useful for checking successful
> configuration and close is used by the dmadev api when releasing a
> configured device.
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
> doc/guides/dmadevs/ioat.rst | 24 +++++++++
> drivers/dma/ioat/ioat_dmadev.c | 93 ++++++++++++++++++++++++++++++++++
> 2 files changed, 117 insertions(+)
>
> diff --git a/doc/guides/dmadevs/ioat.rst b/doc/guides/dmadevs/ioat.rst
> index 45a2e65d70..6092599fe4 100644
> --- a/doc/guides/dmadevs/ioat.rst
> +++ b/doc/guides/dmadevs/ioat.rst
> @@ -62,3 +62,27 @@ For example::
> Once probed successfully, the device will appear as a ``dmadev``, that is a
> "DMA device type" inside DPDK, and can be accessed using APIs from the
> ``rte_dmadev`` library.
> +
> +Device Configuration
> +~~~~~~~~~~~~~~~~~~~~~
> +
> +Configuring an IOAT dmadev device is done using the ``rte_dma_configure()``
> +and ``rte_dma_vchan_setup()`` APIs. ``rte_dma_configure()`` uses the structure
> +``rte_dma_conf`` to configure an IOAT device, within this struct the number
> +of virtual DMA channels for the device is set and silent mode can be enabled.
> +Each IOAT device can only use 1 virtual DMA channel and silent mode is not
> +supported so these will always be set to ``1`` and ``false``.
> +``rte_dma_vchan_setup()`` uses the structure ``rte_dma_vchan_conf`` to setup
> +a virtual DMA channel within this struct the transfer direction and ring size
> +are set. Generally for an onboard Intel\ |reg| IOAT device the transfer direction
> +will be set to ``RTE_DMA_DIR_MEM_TO_MEM`` to copy from memory to memory (more info
> +available in the dmadev API guide). The ring size must be a power of two, between
> +64 and 4096.
> +
> +The following code shows how the device is configured in ``test_dmadev.c``:
> +
> +.. literalinclude:: ../../../app/test/test_dmadev.c
> + :language: c
> + :start-after: Setup of the dmadev device. 8<
> + :end-before: >8 End of setup of the dmadev device.
> + :dedent: 1
> diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
> index 370be3ec72..d58022e258 100644
> --- a/drivers/dma/ioat/ioat_dmadev.c
> +++ b/drivers/dma/ioat/ioat_dmadev.c
> @@ -12,9 +12,98 @@ static struct rte_pci_driver ioat_pmd_drv;
>
> RTE_LOG_REGISTER_DEFAULT(ioat_pmd_logtype, INFO);
>
> +#define DESC_SZ sizeof(struct ioat_dma_hw_desc)
> +
> #define IOAT_PMD_NAME dmadev_ioat
> #define IOAT_PMD_NAME_STR RTE_STR(IOAT_PMD_NAME)
>
> +/* Configure a device. */
> +static int
> +ioat_dev_configure(struct rte_dma_dev *dev __rte_unused, const struct rte_dma_conf *dev_conf,
> + uint32_t conf_sz)
> +{
> + if (sizeof(struct rte_dma_conf) != conf_sz)
> + return -EINVAL;
> +
> + if (dev_conf->nb_vchans != 1)
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> +/* Setup a virtual channel for IOAT, only 1 vchan is supported. */
> +static int
> +ioat_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan __rte_unused,
> + const struct rte_dma_vchan_conf *qconf, uint32_t qconf_sz)
> +{
> + struct ioat_dmadev *ioat = dev->dev_private;
> + uint16_t max_desc = qconf->nb_desc;
> + int i;
> +
> + if (sizeof(struct rte_dma_vchan_conf) != qconf_sz)
> + return -EINVAL;
> +
> + ioat->qcfg = *qconf;
> +
> + if (!rte_is_power_of_2(max_desc)) {
> + max_desc = rte_align32pow2(max_desc);
> + IOAT_PMD_DEBUG("DMA dev %u using %u descriptors", dev->data->dev_id, max_desc);
> + ioat->qcfg.nb_desc = max_desc;
> + }
> +
> + /* In case we are reconfiguring a device, free any existing memory. */
> + rte_free(ioat->desc_ring);
> +
> + ioat->desc_ring = rte_zmalloc(NULL, sizeof(*ioat->desc_ring) * max_desc, 0);
> + if (ioat->desc_ring == NULL)
> + return -ENOMEM;
> +
> + ioat->ring_addr = rte_mem_virt2iova(ioat->desc_ring);
> +
> + ioat->status_addr = rte_mem_virt2iova(ioat) + offsetof(struct ioat_dmadev, status);
> +
> + /* Ensure all counters are reset, if reconfiguring/restarting device. */
> + ioat->next_read = 0;
> + ioat->next_write = 0;
> + ioat->last_write = 0;
> + ioat->offset = 0;
> + ioat->failure = 0;
> +
> + /* Configure descriptor ring - each one points to next. */
> + for (i = 0; i < ioat->qcfg.nb_desc; i++) {
> + ioat->desc_ring[i].next = ioat->ring_addr +
> + (((i + 1) % ioat->qcfg.nb_desc) * DESC_SZ);
> + }
> +
> + return 0;
> +}
> +
> +/* Get device information of a device. */
> +static int
> +ioat_dev_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *info, uint32_t size)
> +{
> + struct ioat_dmadev *ioat = dev->dev_private;
> +
> + if (size < sizeof(*info))
> + return -EINVAL;
> + info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM |
> + RTE_DMA_CAPA_OPS_COPY |
> + RTE_DMA_CAPA_OPS_FILL;
> + info->max_vchans = 1;
> + info->min_desc = 32;
> + info->max_desc = 4096;
> + info->nb_vchans = (ioat->desc_ring == NULL);
The nb_vchans will overwrite by library.
> + return 0;
> +}
> +
> +/* Close a configured device. */
> +static int
> +ioat_dev_close(struct rte_dma_dev *dev)
> +{
> + RTE_SET_USED(dev);
> + return 0;
> +}
> +
> /* Dump DMA device info. */
> static int
> ioat_dev_dump(const struct rte_dma_dev *dev, FILE *f)
> @@ -77,7 +166,11 @@ static int
> ioat_dmadev_create(const char *name, struct rte_pci_device *dev)
> {
> static const struct rte_dma_dev_ops ioat_dmadev_ops = {
> + .dev_close = ioat_dev_close,
> + .dev_configure = ioat_dev_configure,
> .dev_dump = ioat_dev_dump,
> + .dev_info_get = ioat_dev_info_get,
> + .vchan_setup = ioat_vchan_setup,
> };
>
> struct rte_dma_dev *dmadev = NULL;
>
next prev parent reply other threads:[~2021-09-22 8:08 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 17:25 [dpdk-dev] [PATCH 0/8] dma: add dmadev driver for ioat devices Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 1/8] dma/ioat: add device probe and removal functions Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 2/8] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 3/8] dma/ioat: add datapath structures Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 4/8] dma/ioat: add configuration functions Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 5/8] dma/ioat: add start and stop functions Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 6/8] dma/ioat: add data path job submission functions Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 7/8] dma/ioat: add data path completion functions Conor Walsh
2021-08-27 17:25 ` [dpdk-dev] [PATCH 8/8] dma/ioat: add statistics Conor Walsh
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 00/10] dma: add dmadev driver for ioat devices Conor Walsh
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 01/10] dma/ioat: add device probe and removal functions Conor Walsh
2021-09-07 10:10 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 02/10] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-09-07 10:11 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 03/10] dma/ioat: add datapath structures Conor Walsh
2021-09-07 10:11 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 04/10] dma/ioat: add configuration functions Conor Walsh
2021-09-07 10:11 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 05/10] dma/ioat: add start and stop functions Conor Walsh
2021-09-07 10:11 ` Kevin Laatz
2021-09-07 10:35 ` Walsh, Conor
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 06/10] dma/ioat: add data path job submission functions Conor Walsh
2021-09-07 10:12 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 07/10] dma/ioat: add data path completion functions Conor Walsh
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 08/10] dma/ioat: add statistics Conor Walsh
2021-09-07 10:12 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 09/10] dma/ioat: add support for vchan idle function Conor Walsh
2021-09-07 10:12 ` Kevin Laatz
2021-09-03 11:17 ` [dpdk-dev] [PATCH v2 10/10] devbind: move ioat device ID for ICX to dmadev category Conor Walsh
2021-09-07 10:10 ` Kevin Laatz
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 00/11] dma: add dmadev driver for ioat devices Conor Walsh
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 01/11] dma/ioat: add device probe and removal functions Conor Walsh
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 02/11] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 03/11] dma/ioat: add datapath structures Conor Walsh
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 04/11] dma/ioat: add configuration functions Conor Walsh
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 05/11] dma/ioat: add start and stop functions Conor Walsh
2021-09-08 10:39 ` [dpdk-dev] [PATCH v3 06/11] dma/ioat: add data path job submission functions Conor Walsh
2021-09-08 10:40 ` [dpdk-dev] [PATCH v3 07/11] dma/ioat: add data path completion functions Conor Walsh
2021-09-08 10:40 ` [dpdk-dev] [PATCH v3 08/11] dma/ioat: add statistics Conor Walsh
2021-09-08 10:40 ` [dpdk-dev] [PATCH v3 09/11] dma/ioat: add support for vchan status function Conor Walsh
2021-09-08 10:40 ` [dpdk-dev] [PATCH v3 10/11] dma/ioat: add burst capacity function Conor Walsh
2021-09-08 10:40 ` [dpdk-dev] [PATCH v3 11/11] devbind: move ioat device ID for ICX to dmadev category Conor Walsh
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 00/11] dma: add dmadev driver for ioat devices Conor Walsh
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 01/11] dma/ioat: add device probe and removal functions Conor Walsh
2021-09-20 11:15 ` Bruce Richardson
2021-09-21 16:24 ` Conor Walsh
2021-09-22 3:59 ` fengchengwen
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 02/11] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-09-20 13:31 ` Bruce Richardson
2021-09-21 16:25 ` Conor Walsh
2021-09-22 8:04 ` fengchengwen
2021-09-22 16:40 ` Conor Walsh
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 03/11] dma/ioat: add datapath structures Conor Walsh
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 04/11] dma/ioat: add configuration functions Conor Walsh
2021-09-22 8:08 ` fengchengwen [this message]
2021-09-22 16:41 ` Conor Walsh
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 05/11] dma/ioat: add start and stop functions Conor Walsh
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 06/11] dma/ioat: add data path job submission functions Conor Walsh
2021-09-20 13:36 ` Bruce Richardson
2021-09-21 16:25 ` Conor Walsh
2021-09-22 8:18 ` fengchengwen
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 07/11] dma/ioat: add data path completion functions Conor Walsh
2021-09-20 13:39 ` Bruce Richardson
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 08/11] dma/ioat: add statistics Conor Walsh
2021-09-20 13:48 ` Bruce Richardson
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 09/11] dma/ioat: add support for vchan status function Conor Walsh
2021-09-20 13:49 ` Bruce Richardson
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 10/11] dma/ioat: add burst capacity function Conor Walsh
2021-09-20 13:49 ` Bruce Richardson
2021-09-17 15:42 ` [dpdk-dev] [PATCH v4 11/11] devbind: move ioat device ID for ICX to dmadev category Conor Walsh
2021-09-20 13:53 ` Bruce Richardson
2021-09-21 16:26 ` Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 00/12] dma: add dmadev driver for ioat devices Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 01/12] dma/ioat: add device probe and removal functions Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 02/12] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 03/12] dma/ioat: add datapath structures Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 04/12] dma/ioat: add configuration functions Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 05/12] dma/ioat: add start and stop functions Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 06/12] dma/ioat: add data path job submission functions Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 07/12] dma/ioat: add data path completion functions Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 08/12] dma/ioat: add statistics Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 09/12] dma/ioat: add support for vchan status function Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 10/12] dma/ioat: add burst capacity function Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 11/12] devbind: move ioat device IDs to dmadev category Conor Walsh
2021-09-24 14:33 ` [dpdk-dev] [PATCH v5 12/12] raw/ioat: deprecate ioat rawdev driver Conor Walsh
2021-09-24 16:21 ` Kevin Laatz
2021-09-24 16:56 ` Bruce Richardson
2021-09-27 9:36 ` Walsh, Conor
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 00/12] dma: add dmadev driver for ioat devices Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 01/12] dma/ioat: add device probe and removal functions Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 02/12] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 03/12] dma/ioat: add datapath structures Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 04/12] dma/ioat: add configuration functions Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 05/12] dma/ioat: add start and stop functions Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 06/12] dma/ioat: add data path job submission functions Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 07/12] dma/ioat: add data path completion functions Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 08/12] dma/ioat: add statistics Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 09/12] dma/ioat: add support for vchan status function Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 10/12] dma/ioat: add burst capacity function Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 11/12] devbind: move ioat device IDs to dmadev category Conor Walsh
2021-09-27 10:21 ` [dpdk-dev] [PATCH v6 12/12] raw/ioat: deprecate ioat rawdev driver Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 00/12] dma: add dmadev driver for ioat devices Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 01/12] dma/ioat: add device probe and removal functions Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 02/12] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 03/12] dma/ioat: add datapath structures Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 04/12] dma/ioat: add configuration functions Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 05/12] dma/ioat: add start and stop functions Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 06/12] dma/ioat: add data path job submission functions Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 07/12] dma/ioat: add data path completion functions Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 08/12] dma/ioat: add statistics Conor Walsh
2021-10-14 9:48 ` [dpdk-dev] [PATCH v7 09/12] dma/ioat: add support for vchan status function Conor Walsh
2021-10-14 9:49 ` [dpdk-dev] [PATCH v7 10/12] dma/ioat: add burst capacity function Conor Walsh
2021-10-14 9:49 ` [dpdk-dev] [PATCH v7 11/12] devbind: move ioat device IDs to dmadev category Conor Walsh
2021-10-14 9:49 ` [dpdk-dev] [PATCH v7 12/12] raw/ioat: deprecate ioat rawdev driver Conor Walsh
2021-10-18 7:54 ` Thomas Monjalon
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 00/12] dma: add dmadev driver for ioat devices Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 01/12] dma/ioat: add device probe and removal functions Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 02/12] dma/ioat: create dmadev instances on PCI probe Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 03/12] dma/ioat: add datapath structures Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 04/12] dma/ioat: add configuration functions Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 05/12] dma/ioat: add start and stop functions Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 06/12] dma/ioat: add data path job submission functions Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 07/12] dma/ioat: add data path completion functions Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 08/12] dma/ioat: add statistics Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 09/12] dma/ioat: add support for vchan status function Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 10/12] dma/ioat: add burst capacity function Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 11/12] devbind: move ioat device IDs to dmadev category Conor Walsh
2021-10-18 12:38 ` [dpdk-dev] [PATCH v8 12/12] raw/ioat: deprecate ioat rawdev driver Conor Walsh
2021-10-19 11:28 ` [dpdk-dev] [PATCH v8 00/12] dma: add dmadev driver for ioat devices Walsh, Conor
2021-10-19 14:23 ` Walsh, Conor
2021-10-20 16:35 ` Walsh, Conor
2021-10-22 19:25 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d4f6b80-a546-0e6e-418f-1c26f4b3bd92@huawei.com \
--to=fengchengwen@huawei.com \
--cc=bruce.richardson@intel.com \
--cc=conor.walsh@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kevin.laatz@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).