DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Subject: [PATCH v3 01/14] net/bnxt: refactor epoch setting
Date: Mon, 11 Dec 2023 09:10:56 -0800	[thread overview]
Message-ID: <20231211171109.89716-2-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20231211171109.89716-1-ajit.khaparde@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]

Fix epoch bit setting when we ring the doorbell.
Epoch bit needs to toggle alternatively from 0 to 1 every time the
ring indices wrap.
Currently its value is everything but an alternating 0 and 1.

Remove unnecessary field db_epoch_shift from
bnxt_db_info structure.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.h  | 5 ++---
 drivers/net/bnxt/bnxt_ring.c | 9 ++-------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index 2de154322d..26e81a6a7e 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -53,11 +53,10 @@ struct bnxt_db_info {
 	bool                    db_64;
 	uint32_t		db_ring_mask;
 	uint32_t		db_epoch_mask;
-	uint32_t		db_epoch_shift;
 };
 
-#define DB_EPOCH(db, idx)	(((idx) & (db)->db_epoch_mask) <<	\
-				 ((db)->db_epoch_shift))
+#define DB_EPOCH(db, idx)	(!!((idx) & (db)->db_epoch_mask) <<	\
+				 DBR_EPOCH_SFT)
 #define DB_RING_IDX(db, idx)	(((idx) & (db)->db_ring_mask) |		\
 				 DB_EPOCH(db, idx))
 
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 34b2510d54..6dacb1b37f 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -371,9 +371,10 @@ static void bnxt_set_db(struct bnxt *bp,
 			db->db_key64 = DBR_PATH_L2;
 			break;
 		}
-		if (BNXT_CHIP_SR2(bp)) {
+		if (BNXT_CHIP_P7(bp)) {
 			db->db_key64 |= DBR_VALID;
 			db_offset = bp->legacy_db_size;
+			db->db_epoch_mask = ring_mask + 1;
 		} else if (BNXT_VF(bp)) {
 			db_offset = DB_VF_OFFSET;
 		}
@@ -397,12 +398,6 @@ static void bnxt_set_db(struct bnxt *bp,
 		db->db_64 = false;
 	}
 	db->db_ring_mask = ring_mask;
-
-	if (BNXT_CHIP_SR2(bp)) {
-		db->db_epoch_mask = db->db_ring_mask + 1;
-		db->db_epoch_shift = DBR_EPOCH_SFT -
-					rte_log2_u32(db->db_epoch_mask);
-	}
 }
 
 static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,
-- 
2.39.2 (Apple Git-143)


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

  reply	other threads:[~2023-12-11 17:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 17:10 [PATCH v3 00/14] support new 5760X P7 devices Ajit Khaparde
2023-12-11 17:10 ` Ajit Khaparde [this message]
2023-12-11 17:10 ` [PATCH v3 02/14] net/bnxt: update HWRM API Ajit Khaparde
2023-12-11 17:10 ` [PATCH v3 03/14] net/bnxt: log a message when multicast promisc mode changes Ajit Khaparde
2023-12-11 17:10 ` [PATCH v3 04/14] net/bnxt: use the correct COS queue for Tx Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 05/14] net/bnxt: refactor mem zone allocation Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 06/14] net/bnxt: add support for p7 device family Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 07/14] net/bnxt: refactor code to support P7 devices Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 08/14] net/bnxt: fix array overflow Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 09/14] net/bnxt: add support for backing store v2 Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 10/14] net/bnxt: refactor the ulp initialization Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 11/14] net/bnxt: modify sending new HWRM commands to firmware Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 12/14] net/bnxt: retry HWRM ver get if the command fails Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 13/14] net/bnxt: cap ring resources for P7 devices Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 14/14] net/bnxt: add support for v3 Rx completion Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231211171109.89716-2-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=damodharam.ammepalli@broadcom.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).