From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 68189C31A for ; Tue, 2 Jun 2015 15:31:58 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 02 Jun 2015 06:31:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,539,1427785200"; d="scan'208";a="703932598" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga001.jf.intel.com with ESMTP; 02 Jun 2015 06:31:56 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.73]) by IRSMSX102.ger.corp.intel.com ([169.254.2.36]) with mapi id 14.03.0224.002; Tue, 2 Jun 2015 14:31:56 +0100 From: "Ananyev, Konstantin" To: Zoltan Kiss , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ixgbe: fix checking for tx_free_thresh Thread-Index: AQHQmLmPEOJX52mtSEe6r+HqaQm4f52XykYAgAFWiJA= Date: Tue, 2 Jun 2015 13:31:55 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258214346AE@irsmsx105.ger.corp.intel.com> References: <1432757539-8544-1-git-send-email-zoltan.kiss@linaro.org> <556C853E.8090902@linaro.org> In-Reply-To: <556C853E.8090902@linaro.org> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ixgbe: fix checking for tx_free_thresh 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: Tue, 02 Jun 2015 13:31:59 -0000 Hi Zoltan, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zoltan Kiss > Sent: Monday, June 01, 2015 5:16 PM > To: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] ixgbe: fix checking for tx_free_thresh >=20 > Hi, >=20 > Anyone would like to review this patch? Venky sent a NAK, but I've > explained to him why it is a bug. Well, I think Venky is right here. Indeed that fix, will cause more often unsuccessful checks for DD bits and = might cause a slowdown for TX fast-path. =20 Anyway, with current PMD implementation, you can't guarantee that at any mo= ment TX queue wouldn't use more than tx_free_thresh mbufs. There could be situations (low speed, or link is down for some short period= , etc), when much more than tx_free_thresh TXDs are in use and none of them could be fre= ed by HW right now. So your app better be prepared, that up to (nb_tx_desc * num_of_TX_queues) = could be in use by TX path at any given moment. Though yes, there is an inconsistency how different ixgbe TX functions tre= at tx_conf->tx_free_thresh parameter.=20 That probably creates wrong expectations and confusion. We might try to unify it's usage one way or another, but I personally don't= see much point in it. After all, tx_free_tresh seems like a driver internal choice (based on the = nb_tx_desc and other parameters). So I think a better way would be: 1. Deprecate tx_conf->tx_free_thresh (and remove it in later releases) and = make each driver to use what it thinks would be the best value. 2. As you suggested in another mail, introduce an new function: uint16_t rte_eth_tx_free_pkts(port_id, queue_id, nb_to_free). That would give upper layer a better control of memory usage, and might be = called by the upper layer at idle time, so further tx_burst, don't need to spend time on freeing TXDs/packets. Konstantin >=20 > Regards, >=20 > Zoltan >=20 > On 27/05/15 21:12, Zoltan Kiss wrote: > > This check doesn't do what's required by rte_eth_tx_burst: > > "When the number of previously sent packets reached the "minimum transm= it > > packets to free" threshold" > > > > This can cause problems when txq->tx_free_thresh + [number of elements = in the > > pool] < txq->nb_tx_desc. > > > > Signed-off-by: Zoltan Kiss > > --- > > drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++-- > > drivers/net/ixgbe/ixgbe_rxtx_vec.c | 2 +- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_r= xtx.c > > index 4f9ab22..b70ed8c 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > @@ -250,10 +250,10 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx= _pkts, > > > > /* > > * Begin scanning the H/W ring for done descriptors when the > > - * number of available descriptors drops below tx_free_thresh. For > > + * number of in flight descriptors reaches tx_free_thresh. For > > * each done descriptor, free the associated buffer. > > */ > > - if (txq->nb_tx_free < txq->tx_free_thresh) > > + if ((txq->nb_tx_desc - txq->nb_tx_free) > txq->tx_free_thresh) > > ixgbe_tx_free_bufs(txq); > > > > /* Only use descriptors that are available */ > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec.c b/drivers/net/ixgbe/ixg= be_rxtx_vec.c > > index abd10f6..f91c698 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx_vec.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec.c > > @@ -598,7 +598,7 @@ ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf= **tx_pkts, > > if (unlikely(nb_pkts > RTE_IXGBE_VPMD_TX_BURST)) > > nb_pkts =3D RTE_IXGBE_VPMD_TX_BURST; > > > > - if (txq->nb_tx_free < txq->tx_free_thresh) > > + if ((txq->nb_tx_desc - txq->nb_tx_free) > txq->tx_free_thresh) > > ixgbe_tx_free_bufs(txq); > > > > nb_commit =3D nb_pkts =3D (uint16_t)RTE_MIN(txq->nb_tx_free, nb_pkts= ); > >