DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: Conor Walsh <conor.walsh@intel.com>, <bruce.richardson@intel.com>,
	<fengchengwen@huawei.com>, <jerinj@marvell.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2 05/10] dma/ioat: add start and stop functions
Date: Tue, 7 Sep 2021 11:11:51 +0100	[thread overview]
Message-ID: <e5fed519-672a-c5d4-b44b-d9a2688532df@intel.com> (raw)
In-Reply-To: <20210903111734.2734545-6-conor.walsh@intel.com>

On 03/09/2021 12:17, Conor Walsh wrote:
> Add start, stop and recover functions for IOAT devices.
>
> Signed-off-by: Conor Walsh<conor.walsh@intel.com>
> Signed-off-by: Bruce Richardson<bruce.richardson@intel.com>
> ---
>   doc/guides/dmadevs/ioat.rst    |  3 ++
>   drivers/dma/ioat/ioat_dmadev.c | 87 ++++++++++++++++++++++++++++++++++
>   2 files changed, 90 insertions(+)
>
> diff --git a/doc/guides/dmadevs/ioat.rst b/doc/guides/dmadevs/ioat.rst
> index b6d88fe966..f7742642b5 100644
> --- a/doc/guides/dmadevs/ioat.rst
> +++ b/doc/guides/dmadevs/ioat.rst
> @@ -86,3 +86,6 @@ The following code shows how the device is configured in ``test_dmadev.c``:
>      :start-after: Setup of the dmadev device. 8<
>      :end-before: >8 End of setup of the dmadev device.
>      :dedent: 1
> +
> +Once configured, the device can then be made ready for use by calling the
> +``rte_dmadev_start()`` API.
> diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
> index 94f9139e0d..9f9feecd49 100644
> --- a/drivers/dma/ioat/ioat_dmadev.c
> +++ b/drivers/dma/ioat/ioat_dmadev.c
> @@ -73,6 +73,91 @@ ioat_vchan_setup(struct rte_dmadev *dev, uint16_t vchan __rte_unused,
>   	return 0;
>   }
>   
> +/* Recover IOAT device. */
> +static inline int
> +__ioat_recover(struct ioat_dmadev *ioat)
> +{
> +	uint32_t chanerr, retry = 0;
> +	uint16_t mask = ioat->qcfg.nb_desc - 1;
> +
> +	/* Clear any channel errors. Reading and writing to chanerr does this. */
> +	chanerr = ioat->regs->chanerr;
> +	ioat->regs->chanerr = chanerr;
> +
> +	/* Reset Channel. */
> +	ioat->regs->chancmd = IOAT_CHANCMD_RESET;
> +
> +	/* Write new chain address to trigger state change. */
> +	ioat->regs->chainaddr = ioat->desc_ring[(ioat->next_read - 1) & mask].next;
> +	/* Ensure channel control and status addr are correct. */
> +	ioat->regs->chanctrl = IOAT_CHANCTRL_ANY_ERR_ABORT_EN |
> +			IOAT_CHANCTRL_ERR_COMPLETION_EN;
> +	ioat->regs->chancmp = ioat->status_addr;
> +
> +	/* Allow HW time to move to the ARMED state. */
> +	do {
> +		rte_pause();
> +		retry++;
> +	} while (ioat->regs->chansts != IOAT_CHANSTS_ARMED && retry < 200);
> +
> +	/* Exit as failure if device is still HALTED. */
> +	if (ioat->regs->chansts != IOAT_CHANSTS_ARMED)
> +		return -1;
> +
> +	/* Store next write as offset as recover will move HW and SW ring out of sync. */
> +	ioat->offset = ioat->next_read;
> +
> +	/* Prime status register with previous address. */
> +	ioat->status = ioat->desc_ring[(ioat->next_read - 2) & mask].next;
> +
> +	return 0;
> +}
> +
> +/* Start a configured device. */
> +static int
> +ioat_dev_start(struct rte_dmadev *dev)
> +{
> +	struct ioat_dmadev *ioat = dev->dev_private;
> +
> +	if (ioat->qcfg.nb_desc == 0 || ioat->desc_ring == NULL)
> +		return -EBUSY;
> +
> +	/* Inform hardware of where the descriptor ring is. */
> +	ioat->regs->chainaddr = ioat->ring_addr;
> +	/* Inform hardware of where to write the status/completions. */
> +	ioat->regs->chancmp = ioat->status_addr;
> +
> +	/* Prime the status register to be set to the last element. */
> +	ioat->status = ioat->ring_addr + ((ioat->qcfg.nb_desc - 1) * DESC_SZ);
> +
> +	printf("IOAT.status: %s [%#lx]\n",
> +			chansts_readable[ioat->status & IOAT_CHANSTS_STATUS],
> +			ioat->status);
> +
> +	if ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_HALTED) {
> +		IOAT_PMD_WARN("Device HALTED on start, attempting to recover\n");
> +		if (__ioat_recover(ioat) != 0) {
> +			IOAT_PMD_ERR("Device couldn't be recovered");
> +			return -1;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +/* Stop a configured device. */
> +static int
> +ioat_dev_stop(struct rte_dmadev *dev)
> +{
> +	struct ioat_dmadev *ioat = dev->dev_private;
> +
> +	ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND;
> +	/* Allow the device time to suspend itself. */
> +	rte_delay_ms(1);
> +
> +	return 0;

It be more beneficial to check if the device has actually suspended 
before returning. Similar to recover, a timeout could be set by which 
the device is expected to be suspended. If the device is still not 
suspended by then, return error.

IMO this would be more useful to an application that always returning 0, 
since the device may still be active.


With the above addressed,

Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>


  reply	other threads:[~2021-09-07 10:12 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 [this message]
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
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=e5fed519-672a-c5d4-b44b-d9a2688532df@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=jerinj@marvell.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).