From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 87EC3A0C43
	for <public@inbox.dpdk.org>; Wed, 16 Jun 2021 20:09:54 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7A063410E3;
	Wed, 16 Jun 2021 20:09:54 +0200 (CEST)
Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com
 [209.85.215.180])
 by mails.dpdk.org (Postfix) with ESMTP id D446C410E3
 for <stable@dpdk.org>; Wed, 16 Jun 2021 20:09:53 +0200 (CEST)
Received: by mail-pg1-f180.google.com with SMTP id e22so2631517pgv.10
 for <stable@dpdk.org>; Wed, 16 Jun 2021 11:09:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version; bh=+y2gW10UZ0BjfuaPHFFKjyYL31KzDANREZdG3Qiso0U=;
 b=cyFIlDJoxhwgwEVc8pMfldWKvwMp6qPp2A4YDmZWSG7RS3M66OaTPkpglo84ntKzKA
 5Ylt6lAzfDxT2GullE2ru2z3yiChdoUVhnBioKbyf5ZSyu3hsw1dX185yuiacmbud7hV
 WwK0RXj7xCP9xp48fxW4+RfII7f+kaVI/GlV0=
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:mime-version;
 bh=+y2gW10UZ0BjfuaPHFFKjyYL31KzDANREZdG3Qiso0U=;
 b=nKTgSjqgvR6zTKQK0VL8S6KK98k+dyWU0nrcV4SKaUXoUorwith7DyQGcuOzmiLIPF
 Vhb+POfZTh72Hk5V+oBM6MbKkowpM4qYnCvzceCinRQxj29MHvcE55AtwyE6D/2yQlZ/
 Sp7XeEggtzef6UoVGeHBpDB3dyHMn3DS/OADrwzOeaJMlDTWsgFOKWhUxtS8K3IPsq87
 /S0RC4j9n3HfZ+UP5eFHssJSouJclInNv9MTvHBafk1RE135EetPLk1r75l+bj24dthW
 Mbe5c1rYYtmLFcKT+BNybnXTx+nj5YywjDuzdH28owoiKcHL2oZpdO27BldtapA35VZ6
 /ObQ==
X-Gm-Message-State: AOAM532nzyPx6q6zJr6b0aQ7Je3HH9BWYS5qO5niV2ZPDBUtRMwfv3xw
 wYuYjXXZ64GncwAwmNkyOE9EsQ==
X-Google-Smtp-Source: ABdhPJyR++/eWZvEhzXByq3BgAwX/wvWL3W8UEM22K9aOUBLwFAIpxx4zyEV7BpLwohfUCAR/KFldw==
X-Received: by 2002:a63:e958:: with SMTP id q24mr864866pgj.438.1623866992923; 
 Wed, 16 Jun 2021 11:09:52 -0700 (PDT)
Received: from lrichardson-VirtualBox.dhcp.broadcom.net ([192.19.231.250])
 by smtp.gmail.com with ESMTPSA id q4sm2951401pfh.18.2021.06.16.11.09.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 16 Jun 2021 11:09:52 -0700 (PDT)
From: Lance Richardson <lance.richardson@broadcom.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>,
 Somnath Kotur <somnath.kotur@broadcom.com>
Cc: dev@dpdk.org,
	stable@dpdk.org
Date: Wed, 16 Jun 2021 13:55:22 -0400
Message-Id: <20210616175523.930678-4-lance.richardson@broadcom.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210616175523.930678-1-lance.richardson@broadcom.com>
References: <20210616175523.930678-1-lance.richardson@broadcom.com>
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pkcs7-signature";
 micalg=sha-256; boundary="0000000000004d69d605c4e5ffee"
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
Subject: [dpdk-stable] [PATCH 3/4] net/bnxt: fix scalar Tx completion
 handling
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

--0000000000004d69d605c4e5ffee
Content-Transfer-Encoding: 8bit

Preserve the raw (unmasked) transmit completion ring
consumer index.

Remove cache prefetches that have no measurable performance
benefit.

Fixes: c7de4195cc4c ("net/bnxt: modify ring index logic")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_txr.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 27459960d..54eaab34a 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -444,30 +444,26 @@ static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
 
 static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
 {
+	uint32_t nb_tx_pkts = 0, cons, ring_mask, opaque;
 	struct bnxt_cp_ring_info *cpr = txq->cp_ring;
 	uint32_t raw_cons = cpr->cp_raw_cons;
-	uint32_t cons;
-	uint32_t nb_tx_pkts = 0;
+	struct bnxt_ring *cp_ring_struct;
 	struct tx_cmpl *txcmp;
-	struct cmpl_base *cp_desc_ring = cpr->cp_desc_ring;
-	struct bnxt_ring *cp_ring_struct = cpr->cp_ring_struct;
-	uint32_t ring_mask = cp_ring_struct->ring_mask;
-	uint32_t opaque = 0;
 
 	if (bnxt_tx_bds_in_hw(txq) < txq->tx_free_thresh)
 		return 0;
 
+	cp_ring_struct = cpr->cp_ring_struct;
+	ring_mask = cp_ring_struct->ring_mask;
+
 	do {
 		cons = RING_CMPL(ring_mask, raw_cons);
 		txcmp = (struct tx_cmpl *)&cpr->cp_desc_ring[cons];
-		rte_prefetch_non_temporal(&cp_desc_ring[(cons + 2) &
-							ring_mask]);
 
-		if (!CMPL_VALID(txcmp, cpr->valid))
+		if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
 			break;
-		opaque = rte_cpu_to_le_32(txcmp->opaque);
-		NEXT_CMPL(cpr, cons, cpr->valid, 1);
-		rte_prefetch0(&cp_desc_ring[cons]);
+
+		opaque = rte_le_to_cpu_32(txcmp->opaque);
 
 		if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
 			nb_tx_pkts += opaque;
@@ -475,9 +471,11 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
 			RTE_LOG_DP(ERR, PMD,
 					"Unhandled CMP type %02x\n",
 					CMP_TYPE(txcmp));
-		raw_cons = cons;
+		raw_cons = NEXT_RAW_CMP(raw_cons);
 	} while (nb_tx_pkts < ring_mask);
 
+	cpr->valid = !!(raw_cons & cp_ring_struct->ring_size);
+
 	if (nb_tx_pkts) {
 		if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
 			bnxt_tx_cmp_fast(txq, nb_tx_pkts);
-- 
2.25.1


--0000000000004d69d605c4e5ffee--