DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2] examples/dma: support DMA dequeue when no packet received
@ 2022-07-25 12:22 Chengwen Feng
  2022-07-25 12:48 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chengwen Feng @ 2022-07-25 12:22 UTC (permalink / raw)
  To: thomas; +Cc: dev, kevin.laatz, bruce.richardson

Currently the example using DMA in asynchronous mode, which are:
	nb_rx = rte_eth_rx_burst();
	if (nb_rx == 0)
		continue;
	...
	dma_enqueue(); // enqueue the received packets copy request
	nb_cpl = dma_dequeue(); // get copy completed packets
	...

There are no waiting inside dma_dequeue(), and this is why it's called
asynchronus. If there are no packet received, it won't call
dma_dequeue(), but some packets may still in the DMA queue which
enqueued in last cycle. As a result, when the traffic is stopped, the
sent packets and received packets are unbalanced from the perspective
of the traffic generator.

The patch supports DMA dequeue when no packet received, it helps to
judge the test result by comparing the sent packets with the received
packets on traffic generator sides.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 examples/dma/dmafwd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c
index 67b5a9b22b..9fc46f5255 100644
--- a/examples/dma/dmafwd.c
+++ b/examples/dma/dmafwd.c
@@ -408,8 +408,13 @@ dma_rx_port(struct rxtx_port_config *rx_config)
 		nb_rx = rte_eth_rx_burst(rx_config->rxtx_port, i,
 			pkts_burst, MAX_PKT_BURST);
 
-		if (nb_rx == 0)
+		if (nb_rx == 0) {
+			if (copy_mode == COPY_MODE_DMA_NUM &&
+				(nb_rx = dma_dequeue(pkts_burst, pkts_burst_copy,
+					MAX_PKT_BURST, rx_config->dmadev_ids[i])) > 0)
+				goto handle_tx;
 			continue;
+		}
 
 		port_statistics.rx[rx_config->rxtx_port] += nb_rx;
 
@@ -450,6 +455,7 @@ dma_rx_port(struct rxtx_port_config *rx_config)
 					pkts_burst_copy[j]);
 		}
 
+handle_tx:
 		rte_mempool_put_bulk(dma_pktmbuf_pool,
 			(void *)pkts_burst, nb_rx);
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] examples/dma: support DMA dequeue when no packet received
  2022-07-25 12:22 [PATCH v2] examples/dma: support DMA dequeue when no packet received Chengwen Feng
@ 2022-07-25 12:48 ` Bruce Richardson
  2022-10-03 16:21   ` Thomas Monjalon
  2022-07-26  8:49 ` Kevin Laatz
  2022-09-13  1:44 ` fengchengwen
  2 siblings, 1 reply; 5+ messages in thread
From: Bruce Richardson @ 2022-07-25 12:48 UTC (permalink / raw)
  To: Chengwen Feng; +Cc: thomas, dev, kevin.laatz

On Mon, Jul 25, 2022 at 08:22:00PM +0800, Chengwen Feng wrote:
> Currently the example using DMA in asynchronous mode, which are:
> 	nb_rx = rte_eth_rx_burst();
> 	if (nb_rx == 0)
> 		continue;
> 	...
> 	dma_enqueue(); // enqueue the received packets copy request
> 	nb_cpl = dma_dequeue(); // get copy completed packets
> 	...
> 
> There are no waiting inside dma_dequeue(), and this is why it's called
> asynchronus. If there are no packet received, it won't call
> dma_dequeue(), but some packets may still in the DMA queue which
> enqueued in last cycle. As a result, when the traffic is stopped, the
> sent packets and received packets are unbalanced from the perspective
> of the traffic generator.
> 
> The patch supports DMA dequeue when no packet received, it helps to
> judge the test result by comparing the sent packets with the received
> packets on traffic generator sides.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] examples/dma: support DMA dequeue when no packet received
  2022-07-25 12:22 [PATCH v2] examples/dma: support DMA dequeue when no packet received Chengwen Feng
  2022-07-25 12:48 ` Bruce Richardson
@ 2022-07-26  8:49 ` Kevin Laatz
  2022-09-13  1:44 ` fengchengwen
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Laatz @ 2022-07-26  8:49 UTC (permalink / raw)
  To: Chengwen Feng, thomas; +Cc: dev, bruce.richardson

On 25/07/2022 13:22, Chengwen Feng wrote:
> Currently the example using DMA in asynchronous mode, which are:
> 	nb_rx = rte_eth_rx_burst();
> 	if (nb_rx == 0)
> 		continue;
> 	...
> 	dma_enqueue(); // enqueue the received packets copy request
> 	nb_cpl = dma_dequeue(); // get copy completed packets
> 	...
>
> There are no waiting inside dma_dequeue(), and this is why it's called
> asynchronus. If there are no packet received, it won't call
> dma_dequeue(), but some packets may still in the DMA queue which
> enqueued in last cycle. As a result, when the traffic is stopped, the
> sent packets and received packets are unbalanced from the perspective
> of the traffic generator.
>
> The patch supports DMA dequeue when no packet received, it helps to
> judge the test result by comparing the sent packets with the received
> packets on traffic generator sides.
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
>   examples/dma/dmafwd.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] examples/dma: support DMA dequeue when no packet received
  2022-07-25 12:22 [PATCH v2] examples/dma: support DMA dequeue when no packet received Chengwen Feng
  2022-07-25 12:48 ` Bruce Richardson
  2022-07-26  8:49 ` Kevin Laatz
@ 2022-09-13  1:44 ` fengchengwen
  2 siblings, 0 replies; 5+ messages in thread
From: fengchengwen @ 2022-09-13  1:44 UTC (permalink / raw)
  To: thomas; +Cc: dev, kevin.laatz, bruce.richardson

Kindly ping.

On 2022/7/25 20:22, Chengwen Feng wrote:
> Currently the example using DMA in asynchronous mode, which are:
> 	nb_rx = rte_eth_rx_burst();
> 	if (nb_rx == 0)
> 		continue;
> 	...
> 	dma_enqueue(); // enqueue the received packets copy request
> 	nb_cpl = dma_dequeue(); // get copy completed packets
> 	...
> 
> There are no waiting inside dma_dequeue(), and this is why it's called
> asynchronus. If there are no packet received, it won't call
> dma_dequeue(), but some packets may still in the DMA queue which
> enqueued in last cycle. As a result, when the traffic is stopped, the
> sent packets and received packets are unbalanced from the perspective
> of the traffic generator.
> 
> The patch supports DMA dequeue when no packet received, it helps to
> judge the test result by comparing the sent packets with the received
> packets on traffic generator sides.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---

...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] examples/dma: support DMA dequeue when no packet received
  2022-07-25 12:48 ` Bruce Richardson
@ 2022-10-03 16:21   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2022-10-03 16:21 UTC (permalink / raw)
  To: Chengwen Feng; +Cc: dev, kevin.laatz, Bruce Richardson

25/07/2022 14:48, Bruce Richardson:
> On Mon, Jul 25, 2022 at 08:22:00PM +0800, Chengwen Feng wrote:
> > Currently the example using DMA in asynchronous mode, which are:
> > 	nb_rx = rte_eth_rx_burst();
> > 	if (nb_rx == 0)
> > 		continue;
> > 	...
> > 	dma_enqueue(); // enqueue the received packets copy request
> > 	nb_cpl = dma_dequeue(); // get copy completed packets
> > 	...
> > 
> > There are no waiting inside dma_dequeue(), and this is why it's called
> > asynchronus. If there are no packet received, it won't call
> > dma_dequeue(), but some packets may still in the DMA queue which
> > enqueued in last cycle. As a result, when the traffic is stopped, the
> > sent packets and received packets are unbalanced from the perspective
> > of the traffic generator.
> > 
> > The patch supports DMA dequeue when no packet received, it helps to
> > judge the test result by comparing the sent packets with the received
> > packets on traffic generator sides.
> > 
> > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>

Applied, thanks.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-03 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 12:22 [PATCH v2] examples/dma: support DMA dequeue when no packet received Chengwen Feng
2022-07-25 12:48 ` Bruce Richardson
2022-10-03 16:21   ` Thomas Monjalon
2022-07-26  8:49 ` Kevin Laatz
2022-09-13  1:44 ` fengchengwen

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).