DPDK patches and discussions
 help / color / mirror / Atom feed
From: Randy Schacher <stuart.schacher@broadcom.com>
To: dev@dpdk.org
Cc: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Shahaji Bhosle <shahaji.bhosle@broadcom.com>
Subject: [PATCH 09/11] net/bnxt: fix multi-root card support
Date: Wed, 19 Apr 2023 20:11:20 +0000	[thread overview]
Message-ID: <20230419201122.338133-10-stuart.schacher@broadcom.com> (raw)
In-Reply-To: <20230419201122.338133-1-stuart.schacher@broadcom.com>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Changed the logic to use device serial number to identify that
different ports belong to same physical card instead of the PCI
domain address.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Shahaji Bhosle <shahaji.bhosle@broadcom.com>
---
 drivers/net/bnxt/bnxt.h            |  3 +++
 drivers/net/bnxt/bnxt_hwrm.c       |  1 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 11 ++++++++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h |  2 ++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9dd663e0c2..ea678d40d2 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -138,6 +138,7 @@
 #define BNXT_NUM_CMPL_DMA_AGGR			36
 #define BNXT_CMPL_AGGR_DMA_TMR_DURING_INT	50
 #define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT	12
+#define BNXT_DEVICE_SERIAL_NUM_SIZE		8
 
 #define	BNXT_DEFAULT_VNIC_STATE_MASK			\
 	HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_MASK
@@ -874,6 +875,8 @@ struct bnxt {
 	uint16_t		num_reps;
 	struct bnxt_rep_info	*rep_info;
 	uint16_t                *cfa_code_map;
+	/* Device Serial Number */
+	uint8_t			dsn[BNXT_DEVICE_SERIAL_NUM_SIZE];
 	/* Struct to hold adapter error recovery related info */
 	struct bnxt_error_recovery_info *recovery_info;
 #define BNXT_MARK_TABLE_SZ	(sizeof(struct bnxt_mark_info)  * 64 * 1024)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0c4b2aaaa9..7c0d2faa8b 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -863,6 +863,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		    bp->max_l2_ctx, bp->max_vnics);
 	bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
 	bp->max_mcast_addr = rte_le_to_cpu_32(resp->max_mcast_filters);
+	memcpy(bp->dsn, resp->device_serial_number, sizeof(bp->dsn));
 
 	if (BNXT_PF(bp))
 		bp->pf->total_vnics = rte_le_to_cpu_16(resp->max_vnics);
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 1d0b11e73c..f80e76e69c 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -1318,9 +1318,13 @@ ulp_get_session(struct bnxt *bp, struct rte_pci_addr *pci_addr)
 
 	/* if multi root capability is enabled, then ignore the pci bus id */
 	STAILQ_FOREACH(session, &bnxt_ulp_session_list, next) {
-		if (session->pci_info.domain == pci_addr->domain &&
-		    (BNXT_MULTIROOT_EN(bp) ||
-		    session->pci_info.bus == pci_addr->bus)) {
+		if (BNXT_MULTIROOT_EN(bp)) {
+			if (!memcmp(bp->dsn, session->dsn,
+				    sizeof(session->dsn))) {
+				return session;
+			}
+		} else if (session->pci_info.domain == pci_addr->domain &&
+			   session->pci_info.bus == pci_addr->bus) {
 			return session;
 		}
 	}
@@ -1364,6 +1368,7 @@ ulp_session_init(struct bnxt *bp,
 			/* Add it to the queue */
 			session->pci_info.domain = pci_addr->domain;
 			session->pci_info.bus = pci_addr->bus;
+			memcpy(session->dsn, bp->dsn, sizeof(session->dsn));
 			rc = pthread_mutex_init(&session->bnxt_ulp_mutex, NULL);
 			if (rc) {
 				BNXT_TF_DBG(ERR, "mutex create failed\n");
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index a6ad5c1eaa..92db7751fe 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -131,11 +131,13 @@ struct bnxt_ulp_pci_info {
 	uint8_t		bus;
 };
 
+#define BNXT_ULP_DEVICE_SERIAL_NUM_SIZE 8
 struct bnxt_ulp_session_state {
 	STAILQ_ENTRY(bnxt_ulp_session_state)	next;
 	bool				bnxt_ulp_init;
 	pthread_mutex_t			bnxt_ulp_mutex;
 	struct bnxt_ulp_pci_info	pci_info;
+	uint8_t				dsn[BNXT_ULP_DEVICE_SERIAL_NUM_SIZE];
 	struct bnxt_ulp_data		*cfg_data;
 	struct tf			*g_tfp[BNXT_ULP_SESSION_MAX];
 	uint32_t			session_opened[BNXT_ULP_SESSION_MAX];
-- 
2.25.1


  parent reply	other threads:[~2023-04-19 20:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 20:11 [PATCH 00/11] sync Truflow support with latest release Randy Schacher
2023-04-19 20:11 ` [PATCH 01/11] net/bnxt: remove deprecated features Randy Schacher
2023-04-19 20:11 ` [PATCH 02/11] net/bnxt: update bnxt hsi structure Randy Schacher
2023-04-19 20:11 ` [PATCH 03/11] net/bnxt: update copyright date and cleanup whitespace Randy Schacher
2023-04-19 20:11 ` [PATCH 04/11] net/bnxt: update Truflow core Randy Schacher
2023-04-19 20:11 ` [PATCH 05/11] net/bnxt: update ULP shared session support Randy Schacher
2023-04-19 20:11 ` [PATCH 06/11] net/bnxt: add support for RSS action and Queue action Randy Schacher
2023-04-19 20:11 ` [PATCH 07/11] net/bnxt: add ulp support for rte meter Randy Schacher
2023-04-19 20:11 ` [PATCH 08/11] net/bnxt: update PTP support on Thor Randy Schacher
2023-04-19 20:11 ` Randy Schacher [this message]
2023-04-19 20:11 ` [PATCH 10/11] net/bnxt: add ulp support for ecpri Randy Schacher
2023-04-19 20:11 ` [PATCH 11/11] net/bnxt: Avoid submitting hwrm rss request when rss mode disabled Randy Schacher

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=20230419201122.338133-10-stuart.schacher@broadcom.com \
    --to=stuart.schacher@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=shahaji.bhosle@broadcom.com \
    /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).