DPDK patches and discussions
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: Kevin Laatz <kevin.laatz@intel.com>, <dev@dpdk.org>
Cc: <bruce.richardson@intel.com>, <conor.walsh@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 4/6] examples/ioat: port application to dmadev APIs
Date: Fri, 24 Sep 2021 12:00:02 +0800	[thread overview]
Message-ID: <a6d06e4c-d73a-2476-a2db-c442c943213b@huawei.com> (raw)
In-Reply-To: <20210917164136.3499904-5-kevin.laatz@intel.com>

On 2021/9/18 0:41, Kevin Laatz wrote:
> The dmadev library abstraction allows applications to use the same APIs for
> all DMA device drivers in DPDK. This patch updates the ioatfwd application
> to make use of the new dmadev APIs, in turn making it a generic application
> which can be used with any of the DMA device drivers.
> 
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> 
> ---
> v2:
>   - dmadev api name updates following rebase
>   - use rte_config macro for max devs
>   - use PRIu64 for printing stats
> ---
>  examples/ioat/ioatfwd.c   | 239 ++++++++++++++++----------------------
>  examples/ioat/meson.build |   8 +-
>  2 files changed, 105 insertions(+), 142 deletions(-)
> 

[snip]

>  
>  typedef enum copy_mode_t {
> @@ -95,6 +94,16 @@ static copy_mode_t copy_mode = COPY_MODE_IOAT_NUM;
>   */
>  static unsigned short ring_size = 2048;
>  
> +/* global mbuf arrays for tracking DMA bufs */
> +#define MBUF_RING_SIZE	1024
> +#define MBUF_RING_MASK	(MBUF_RING_SIZE - 1)
> +struct dma_bufs {
> +	struct rte_mbuf *bufs[MBUF_RING_SIZE];
> +	struct rte_mbuf *copies[MBUF_RING_SIZE];
> +	uint16_t sent;
> +};

The dma_bufs size only hold 1024 address info, and the dmadev virtual channel ring size is 2048 default,
If the DMA cannot be moved in time, may exist overlay in dma_bufs in dma_dequeue() API.

> +static struct dma_bufs dma_bufs[RTE_DMADEV_DEFAULT_MAX_DEVS];
> +
>  /* global transmission config */
>  struct rxtx_transmission_config cfg;

[snip]

>  }
>  /* >8 End of configuration of device. */
>  
> @@ -820,18 +789,16 @@ assign_rawdevs(void)
>  
>  	for (i = 0; i < cfg.nb_ports; i++) {
>  		for (j = 0; j < cfg.ports[i].nb_queues; j++) {
> -			struct rte_rawdev_info rdev_info = { 0 };
> +			struct rte_dma_info dmadev_info = { 0 };
>  
>  			do {
> -				if (rdev_id == rte_rawdev_count())
> +				if (rdev_id == rte_dma_count_avail())
>  					goto end;
> -				rte_rawdev_info_get(rdev_id++, &rdev_info, 0);
> -			} while (rdev_info.driver_name == NULL ||
> -					strcmp(rdev_info.driver_name,
> -						IOAT_PMD_RAWDEV_NAME_STR) != 0);
> +				rte_dma_info_get(rdev_id++, &dmadev_info);
> +			} while (!rte_dma_is_valid(rdev_id));
>  
> -			cfg.ports[i].ioat_ids[j] = rdev_id - 1;
> -			configure_rawdev_queue(cfg.ports[i].ioat_ids[j]);
> +			cfg.ports[i].dmadev_ids[j] = rdev_id - 1;
> +			configure_rawdev_queue(cfg.ports[i].dmadev_ids[j]);

Tests show that if there are four dmadevs, only three dmadevs can be allocated here.

1st malloc: rdev_id=0, assign successful, and the dmadev_id=0, rdev_id=1
2st malloc: rdev_id=1, assign successful, and the dmadev_id=1, rdev_id=2
3st malloc: rdev_id=2, assign successful, and the dmadev_id=2, rdev_id=3
4st malloc: rdev_id=3, assign failed, because rte_dma_info_get(rdev_id++,...), the rdev_id is 4 and it's not a valid id.

Recommended use rte_dma_next_dev() which Bruce introduced.

>  			++nb_rawdev;
>  		}
>  	}
> @@ -840,7 +807,7 @@ assign_rawdevs(void)
>  		rte_exit(EXIT_FAILURE,
>  			"Not enough IOAT rawdevs (%u) for all queues (%u).\n",
>  			nb_rawdev, cfg.nb_ports * cfg.ports[0].nb_queues);
> -	RTE_LOG(INFO, IOAT, "Number of used rawdevs: %u.\n", nb_rawdev);
> +	RTE_LOG(INFO, DMA, "Number of used rawdevs: %u.\n", nb_rawdev);
>  }
>  /* >8 End of using IOAT rawdev API functions. */
>  

[snip]


  parent reply	other threads:[~2021-09-24  4:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 17:27 [dpdk-dev] [PATCH 0/6] port ioatfwd app to dmadev Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 1/6] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 2/6] examples/ioat: add cmd-line option to control DMA batch size Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 3/6] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 4/6] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 5/6] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 6/6] examples/ioat: rename application to dmafwd Kevin Laatz
2021-09-17 16:41 ` [dpdk-dev] [PATCH v2 0/6] port ioatfwd app to dmadev Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 1/6] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-23 15:33       ` Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 2/6] examples/ioat: add cmd-line option to control DMA batch size Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 3/6] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 4/6] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-24  4:00     ` fengchengwen [this message]
2021-09-24  8:40       ` Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 5/6] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 6/6] examples/ioat: rename application to dmafwd Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-23 13:53   ` [dpdk-dev] [PATCH v2 0/6] port ioatfwd app to dmadev fengchengwen
2021-09-23 14:00     ` Kevin Laatz
2021-09-28 16:29 ` [dpdk-dev] [PATCH v3 0/8] " Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-09-29 10:32     ` Conor Walsh
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-09-29 10:33     ` Conor Walsh
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-14  9:53 ` [dpdk-dev] [PATCH v4 0/8] port ioatfwd app to dmadev Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-22 19:48   ` [dpdk-dev] [PATCH v4 0/8] port ioatfwd app to dmadev Thomas Monjalon
2021-10-25 19:59     ` Kevin Laatz
2021-10-26  0:56   ` fengchengwen
2021-10-26 11:46     ` Kevin Laatz
2021-10-26 13:14 ` [dpdk-dev] [PATCH v5 " Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-27 13:23   ` [dpdk-dev] [PATCH v5 0/8] port ioatfwd app to dmadev Thomas Monjalon
2021-10-27 13:35     ` Kevin Laatz
2021-10-27 14:07       ` Thomas Monjalon
2021-10-27 14:14         ` Kevin Laatz
2021-10-27 14:54   ` 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=a6d06e4c-d73a-2476-a2db-c442c943213b@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=bruce.richardson@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --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).