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 55D9A42BE1; Tue, 30 May 2023 11:48:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3099140A82; Tue, 30 May 2023 11:48:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 67E41406BC for ; Tue, 30 May 2023 11:48:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685440116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9yhqA53MlQXHqTsBV+LzZqPHyD7sfb4Y2WYVGf3FB6s=; b=ff53K9Wsnx/qdGyRBLyYBFQafU+xTwZbKiF3hhyDKP8B/pGOlHivRrxG/8UL6yOgTeAYRJ UUHe2f6TIFOZK2+/2CfBPQWl6GOpCfq4UVHvjhg/44NZkccBjEXmnp/3Q9O+y+B/ivm+3w +aTIOPejZNUFMAtvNt40gXsqNN99nrA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-502lc2X5M02G8JTqQS7yyQ-1; Tue, 30 May 2023 05:48:31 -0400 X-MC-Unique: 502lc2X5M02G8JTqQS7yyQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9ABD02A59566; Tue, 30 May 2023 09:48:30 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65673202696C; Tue, 30 May 2023 09:48:28 +0000 (UTC) Message-ID: <1d846873-9bc5-814f-b0a7-2375f0a332a6@redhat.com> Date: Tue, 30 May 2023 11:48:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: dpdk: Inquiry about vring cleanup during packets transmission To: wangzengyuan , "dev@dpdk.org" Cc: "chenbo.xia@intel.com" , "zhangxu (BA)" , luyicai , wangyunjian References: From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 Hello, On 5/27/23 09:08, wangzengyuan wrote: > Hi, > >          I am writing to inquire about the vring cleanup process during > packets transmission. > > In the virtio_xmit_pkts function, there is the following code: > >          nb_used = virtqueue_nused(vq); > >          if (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh)) > >                    virtio_xmit_cleanup(vq, nb_used); > > In other words, cleaning is performed when the number of items used in > the vring exceeds (vq->vq_nentries - vq->vq_free_thresh). In the case of > an vring size of 4096, at least (4096-32) items need to be cleaned at > once, which will take a considerable amount of time. > > I'm curious why not clean up fewer items each time to avoid taking up > too much CPU time in one transmission. Because during the debugging > process, I found that cleaning up thousands of items at once takes up a > considerable amount of time. > > As I am not familiar with this process, I would appreciate it if you > could provide me with some information on what its purpose is. Both the Tx and Rx queues free threshold are configurable via ethdev APIs: int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool); As you are using large rings, your application may use above APIs to set more appropriate values. Regards, Maxime > Best regards, > > Zengyuan Wang >