From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7B687A00E6 for ; Wed, 7 Aug 2019 17:09:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 608842C58; Wed, 7 Aug 2019 17:09:52 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id C8A2F2BCE for ; Wed, 7 Aug 2019 17:09:40 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id f72so388582wmf.5 for ; Wed, 07 Aug 2019 08:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=gTFJzslpHYR9f3LHN3S3BY6ntDu6T1luGQ2TnkCujSw=; b=gwekg01+K2ROk8rgN1MvmV23A7YN1+EmgHfiPl59XX7hcNbXvfGPMdDjNfv+eDue5h lhR0J79YQXRU+UAeOHyoD13KVXcBU3LGGzGJYMICCcBM8qXGIuSVJ22QyE3SEQ2lHUoT zjGm9YKOBvtjJyX/1q1B4THOeH7RdLDm24z/MTIajP3q4Izy3RQoe/+lV/0X6fDGbQQz 5rx9fe/T253O9WM/e8YTrGl2y/LRkOYQHtrYc3BPQjo2ZSAM272Z2SIjSk3IYM1CAa15 Pw2TbcpQRIImiorYPcZBVPRD9RssxVaG7AUky3f7jjOsBOTWcnGWCm2pX2GpvkYjIqjZ PQLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=gTFJzslpHYR9f3LHN3S3BY6ntDu6T1luGQ2TnkCujSw=; b=f3FsMCSkDw5q3ZxqsdBwDhWhnCp3bU93Hg+lJSdVNHa26ZWhkaDHoFjXIzfbkiTRW9 2Am6lZsVJFNbOj+eZWT+TW60Q0GvOSlejJk+H5Lm0V5jkW6tD1aPBh5UL8sTY4VUbn8I 1jT6lpClD7UJgmzIcXBDRbe7cqngeRSuDAfeS2U/faieXffz6aD3XrWroQzpoFaUe3j0 yEbP39/Ap+tjodbI4vJVTVflc/mOGWFLWUzxmhVzMrkQHplrwGI887Nj+b9VxAjv8qrI mBCimVejOOwJ6BGBJ9b5DU0Zar90MCpaKTuVRmQ0MIksVCgl4K4g/9/MlembbM4rokLs YtWA== X-Gm-Message-State: APjAAAWHKXoJsxx2ByJN63qdjPuw34nu0hGUtjhB2l9WJfCMhf59tDgG b1ThOS4Oo8coBjSGAXvOyzJF X-Google-Smtp-Source: APXvYqwEJrDsRtlXic/pihT1LvQOuNSvUBdwLAQ7eaEumpGjsT3NSnEtESpH6aP9lts7opaP0X02og== X-Received: by 2002:a1c:9889:: with SMTP id a131mr437926wme.22.1565190580625; Wed, 07 Aug 2019 08:09:40 -0700 (PDT) Received: from ascain.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id r5sm382862wmh.35.2019.08.07.08.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 08:09:40 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Olivier Matz , stable@dpdk.org, Thomas Monjalon Date: Wed, 7 Aug 2019 17:09:12 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-stable] [PATCH 19.11 V2 03/12] net/e1000: fix Tx descriptor status api (igb) X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Olivier Matz The Tx descriptor status api was not behaving as expected. This API is used to inspect the content of the descriptors in the Tx ring to determine the length of the Tx queue. Since the software advances the tail pointer and the hardware advances the head pointer, the Tx queue is located before txq->tx_tail in the ring. Therefore, a call to rte_eth_tx_descriptor_status(..., offset=20) should inspect the 20th descriptor before the tail, not after. Fixes: 978f8eea1719 ("net/e1000: implement descriptor status API (igb)") Cc: stable@dpdk.org Signed-off-by: Olivier Matz --- drivers/net/e1000/igb_rxtx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index c5606de5d7a0..c22118e59a21 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1835,14 +1835,15 @@ eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset) { struct igb_tx_queue *txq = tx_queue; volatile uint32_t *status; - uint32_t desc; + int32_t desc; if (unlikely(offset >= txq->nb_tx_desc)) return -EINVAL; - desc = txq->tx_tail + offset; - if (desc >= txq->nb_tx_desc) - desc -= txq->nb_tx_desc; + desc = txq->tx_tail - offset - 1; + if (desc < 0) + desc += txq->nb_tx_desc; + desc = txq->sw_ring[desc].last_id; status = &txq->tx_ring[desc].wb.status; if (*status & rte_cpu_to_le_32(E1000_TXD_STAT_DD)) -- 2.11.0