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 8D32EA00C4; Mon, 25 Jul 2022 14:31:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77C8A410FA; Mon, 25 Jul 2022 14:31:19 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 007DE40684 for ; Mon, 25 Jul 2022 14:31:17 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Lrzrv3d1tz9smf; Mon, 25 Jul 2022 20:30:07 +0800 (CST) Received: from [127.0.0.1] (10.67.100.224) 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 20:31:15 +0800 Subject: Re: [PATCH] examples/dma: support DMA dequeue when no packet received To: Bruce Richardson CC: , , References: <20220725081212.4473-1-fengchengwen@huawei.com> From: fengchengwen Message-ID: <1135ec65-7a65-520e-9b17-c57b413aea9a@huawei.com> Date: Mon, 25 Jul 2022 20:31:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 On 2022/7/25 18:01, Bruce Richardson wrote: > On Mon, Jul 25, 2022 at 04:12:12PM +0800, Chengwen Feng wrote: ... >> - if (nb_rx == 0) >> + if (nb_rx == 0 && copy_mode != COPY_MODE_DMA_NUM) >> continue; >> >> port_statistics.rx[rx_config->rxtx_port] += nb_rx; > > With this change, we would work through the all the receive packet > processing code, and calling all it's functions, just witha packet count of > zero. I therefore wonder if it would be cleaner to do the dma_dequeue > immediately here on receiving zero, and then jumping to handle those > dequeued packets. Something like the diff below. > > /Bruce Hi Bruce, Thank your review, already fix in V2. > > @@ -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); > > > . >