From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 545FCA00C4; Mon, 25 Jul 2022 10:19:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3403F410FA; Mon, 25 Jul 2022 10:19:20 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 2188A41148 for ; Mon, 25 Jul 2022 10:19:18 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LrtG51528zGpB9; Mon, 25 Jul 2022 16:18:05 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 25 Jul 2022 16:19:13 +0800 From: Chengwen Feng To: CC: , , Subject: [PATCH] examples/dma: support DMA dequeue when no packet received Date: Mon, 25 Jul 2022 16:12:12 +0800 Message-ID: <20220725081212.4473-1-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- examples/dma/dmafwd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c index 67b5a9b22b..e3fe226dff 100644 --- a/examples/dma/dmafwd.c +++ b/examples/dma/dmafwd.c @@ -408,7 +408,7 @@ 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 && copy_mode != COPY_MODE_DMA_NUM) continue; port_statistics.rx[rx_config->rxtx_port] += nb_rx; -- 2.33.0