From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 006B16934 for ; Thu, 13 Feb 2014 00:30:06 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 12 Feb 2014 15:31:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,835,1384329600"; d="scan'208";a="474297284" Received: from fmsmsx105.amr.corp.intel.com ([10.19.9.36]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2014 15:31:08 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX105.amr.corp.intel.com (10.19.9.36) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 12 Feb 2014 15:31:08 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.3.43]) by fmsmsx118.amr.corp.intel.com ([10.18.116.18]) with mapi id 14.03.0123.003; Wed, 12 Feb 2014 15:31:08 -0800 From: "Shaw, Jeffrey B" To: Qing Wan , "dev@dpdk.org" Thread-Topic: condition for calling ixgbe_xmit_cleanup Thread-Index: Ac8oRMRm3EyOn0R6So+s5LK9yNntmAAA7FdQ Date: Wed, 12 Feb 2014 23:31:07 +0000 Message-ID: <4032A54B6BB5F04B8C08B6CFF08C5928553F4D6D@FMSMSX103.amr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] condition for calling ixgbe_xmit_cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2014 23:30:07 -0000 Hi Qing, The idea is that we do not want to clean the descriptor ring until we have = used "enough" descriptors. So (nb_tx_desc -nb_tx_free) tells us how many descriptors we've used. Once= we've used "enough" (i.e. tx_free_thresh) then we will try to clean the de= scriptor ring. If you look at the simpler "tx_xmit_pkts()" (simple is kind of a misnomer h= ere... it refers to simplicity of features, not simplicity of implementatio= n), we chose to implement the "nb_tx_free < tx_free_thresh" variant. The only real difference is that the semantics of "tx_free_thresh" change f= rom "free descriptors after this many are used" to "free descriptors after = this many are remaining". Thanks, Jeff -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qing Wan Sent: Wednesday, February 12, 2014 3:50 PM To: dev@dpdk.org Subject: [dpdk-dev] condition for calling ixgbe_xmit_cleanup Hi, =20 There are following code in function ixgbe_xmit_pkts, .... if ((txq->nb_tx_desc - txq->nb_tx_free) > txq->tx_free_thresh) { ixgbe_xmit_cleanup(txq); } .... My understanding is, nb_tx_desc means total number of descriptors in ring a= nd nx_tx_free represents how many descriptors are available, so txq->nb_tx_desc - txq->nb_tx_free means how many we have used. I'm not quite understand the meaning of this comparison. Why is the condition not = something like "if (txq->nb_tx_free < tx_free_thresh)".=20 =20 really appreciate if someone could help me on this. =20 Thanks Qing