From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by dpdk.org (Postfix) with ESMTP id 40D6A3237 for ; Thu, 28 May 2015 13:12:47 +0200 (CEST) Received: by wizo1 with SMTP id o1so57492278wiz.1 for ; Thu, 28 May 2015 04:12:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=lkvUw2DEuV+WwafW2VaT004XMw9XSxsegDI1oK3lTs0=; b=U5GFNW/ujt+ji/KCZgn4sUVnCbEt/bXxFnCnCS/A+7AdbqIfRmeqMz7JzJMlzNGHgS Kjx/EHqeiG4DoqHjD5xRjTH/wg81kkvBqEL7n50aom8GClWVi0jkgvlaN2lOy6VRG/me CsLhPI7mQs5sEFkJyJz+OM/F24OKDZV3BRdA5zX5m9fSIjpygNVZIEJTgvpi0UFwxWPr 3srgb0vBLmmtwrzFx5Yi73OJtixc/NE/gpWR38/VsMtJlTsLL5Z/FmtXNyAu+w8K3tWL OPucmHNzxW/N51m9qDtopgD6GJ3qnSrh6z/LdG6VB0uQRJWcFNCZXuUomKDJak0OvD+A a3zQ== X-Gm-Message-State: ALoCoQlIAzqI97eKh+Mo2opp3hUvEacrxNzKmCSEz6Tzt6+nz1zpGbQ0VD8f30a49BpeYjRH2obt X-Received: by 10.194.188.107 with SMTP id fz11mr4219178wjc.98.1432811566109; Thu, 28 May 2015 04:12:46 -0700 (PDT) Received: from [192.168.0.101] ([90.152.119.35]) by mx.google.com with ESMTPSA id mc20sm3479690wic.15.2015.05.28.04.12.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 04:12:45 -0700 (PDT) Message-ID: <5566F82D.3070608@linaro.org> Date: Thu, 28 May 2015 12:12:45 +0100 From: Zoltan Kiss User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Venkatesan, Venky" References: <1432757539-8544-1-git-send-email-zoltan.kiss@linaro.org> <65CC0274-0B2A-460C-B381-59EB8CE9F970@intel.com> In-Reply-To: <65CC0274-0B2A-460C-B381-59EB8CE9F970@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" 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: Thu, 28 May 2015 11:12:47 -0000 The requirements for rte_eth_tx_burst(), which calls a driver specific function, in case of ixgbe, these two: "It is the responsibility of the rte_eth_tx_burst() function to transparently free the memory buffers of packets previously sent. This feature is driven by the *tx_free_thresh* value supplied to the rte_eth_dev_configure() function at device configuration time. When the number of previously sent packets reached the "minimum transmit packets to free" threshold, the rte_eth_tx_burst() function must [attempt to] free the *rte_mbuf* buffers of those packets whose transmission was effectively completed." Also rte_eth_tx_queue_setup() uses the same description for tx_free_thresh: "The *tx_free_thresh* value indicates the [minimum] number of network buffers that must be pending in the transmit ring to trigger their [implicit] freeing by the driver transmit function." And all the other poll mode drivers are using this formula. Plus I've described a possible hang situation in the commit message. On 28/05/15 11:50, Venkatesan, Venky wrote: > NAK. This causes more (unsuccessful) cleanup attempts on the descriptor ring. What is motivating this change? > > Regards, > Venky > > >> On May 28, 2015, at 1:42 AM, 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 transmit >> 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_rxtx.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/ixgbe_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 = 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 = nb_pkts = (uint16_t)RTE_MIN(txq->nb_tx_free, nb_pkts); >> -- >> 1.9.1 >>