DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/7] bnxt bug fixes
@ 2024-02-08 17:13 Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 1/7] net/bnxt: avoid seg fault in Tx queue release Ajit Khaparde
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev

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

Patchset with bug fixes for bnxt PMD.
Patch based against the
next-net-brcm for-next-net branch.

Please apply.

Ajit Khaparde (4):
  net/bnxt: modify locking for representor Tx
  net/bnxt: refactor VNIC context cleanup
  net/bnxt: update consumer index of NQ regularly
  net/bnxt: update RSS algorithm capability

Damodharam Ammepalli (1):
  net/bnxt: cleanup vnic ref count

Kishore Padmanabha (1):
  net/bnxt: avoid seg fault in Tx queue release

Shuanglin Wang (1):
  net/bnxt: adjust session name on multi host system

 drivers/net/bnxt/bnxt.h            |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c     | 14 +++-----
 drivers/net/bnxt/bnxt_hwrm.c       | 16 +++++++--
 drivers/net/bnxt/bnxt_irq.c        | 26 +++++++++++---
 drivers/net/bnxt/bnxt_reps.c       |  6 ++--
 drivers/net/bnxt/bnxt_txq.c        |  8 ++++-
 drivers/net/bnxt/bnxt_txq.h        |  1 +
 drivers/net/bnxt/bnxt_txr.c        | 13 +++++++
 drivers/net/bnxt/bnxt_txr.h        |  4 ++-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 58 ++++++++++++++++++++++++++++++
 10 files changed, 125 insertions(+), 23 deletions(-)

-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/7] net/bnxt: avoid seg fault in Tx queue release
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 2/7] net/bnxt: modify locking for representor Tx Ajit Khaparde
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev; +Cc: Kishore Padmanabha

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

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

The tx queue mutex should be freed before the tx queue structure and
similarly the completion ring stats should be reset before ring free.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_txq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index f99ad211db..7d91e88c9d 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -104,12 +104,12 @@ void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx)
 
 		/* Free TX completion ring hardware descriptors */
 		if (txq->cp_ring) {
+			bnxt_free_txq_stats(txq);
 			bnxt_free_ring(txq->cp_ring->cp_ring_struct);
 			rte_free(txq->cp_ring->cp_ring_struct);
 			rte_free(txq->cp_ring);
 		}
 
-		bnxt_free_txq_stats(txq);
 		rte_memzone_free(txq->mz);
 		txq->mz = NULL;
 
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/7] net/bnxt: modify locking for representor Tx
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 1/7] net/bnxt: avoid seg fault in Tx queue release Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 3/7] net/bnxt: refactor VNIC context cleanup Ajit Khaparde
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev; +Cc: stable, Pete Spreadborough

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

Currently the representor Tx function is synchronized using a per
device lock. But that is not sufficient when there is simultaneous
traffic on the parent Tx ring and the representor rings.
Moreover the representor Tx is not protected from incursions by the
parent transmits. This can cause parent Tx threads to crossover into
the representor Tx contexts. Prevent this by using per TxQ locking and
protect not just representor Tx, but also the parent Tx using the lock.

Fixes: 6dc83230b43b ("net/bnxt: support port representor data path")

Cc: stable@gpgk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Pete Spreadborough <peter.spreadborough@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  1 -
 drivers/net/bnxt/bnxt_ethdev.c | 11 +----------
 drivers/net/bnxt/bnxt_reps.c   |  6 +++---
 drivers/net/bnxt/bnxt_txq.c    |  6 ++++++
 drivers/net/bnxt/bnxt_txq.h    |  1 +
 drivers/net/bnxt/bnxt_txr.c    | 13 +++++++++++++
 drivers/net/bnxt/bnxt_txr.h    |  4 +++-
 7 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 42ecca35d7..3b3df6ba28 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -623,7 +623,6 @@ struct bnxt_mark_info {
 
 struct bnxt_rep_info {
 	struct rte_eth_dev	*vfr_eth_dev;
-	pthread_mutex_t		vfr_lock;
 	pthread_mutex_t		vfr_start_lock;
 	bool			conduit_valid;
 };
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index abe46e8004..fecc8666e8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1803,10 +1803,8 @@ bnxt_uninit_locks(struct bnxt *bp)
 	pthread_mutex_destroy(&bp->def_cp_lock);
 	pthread_mutex_destroy(&bp->health_check_lock);
 	pthread_mutex_destroy(&bp->err_recovery_lock);
-	if (bp->rep_info) {
-		pthread_mutex_destroy(&bp->rep_info->vfr_lock);
+	if (bp->rep_info)
 		pthread_mutex_destroy(&bp->rep_info->vfr_start_lock);
-	}
 }
 
 static void bnxt_drv_uninit(struct bnxt *bp)
@@ -6534,13 +6532,6 @@ static int bnxt_init_rep_info(struct bnxt *bp)
 	for (i = 0; i < BNXT_MAX_CFA_CODE; i++)
 		bp->cfa_code_map[i] = BNXT_VF_IDX_INVALID;
 
-	rc = pthread_mutex_init(&bp->rep_info->vfr_lock, NULL);
-	if (rc) {
-		PMD_DRV_LOG(ERR, "Unable to initialize vfr_lock\n");
-		bnxt_free_rep_info(bp);
-		return rc;
-	}
-
 	rc = pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL);
 	if (rc) {
 		PMD_DRV_LOG(ERR, "Unable to initialize vfr_start_lock\n");
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index d96d972904..3a4720bc3c 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -124,8 +124,8 @@ bnxt_rep_tx_burst(void *tx_queue,
 	qid = vfr_txq->txq->queue_id;
 	vf_rep_bp = vfr_txq->bp;
 	parent = vf_rep_bp->parent_dev->data->dev_private;
-	pthread_mutex_lock(&parent->rep_info->vfr_lock);
 	ptxq = parent->tx_queues[qid];
+	pthread_mutex_lock(&ptxq->txq_lock);
 
 	ptxq->vfr_tx_cfa_action = vf_rep_bp->vfr_tx_cfa_action;
 
@@ -134,9 +134,9 @@ bnxt_rep_tx_burst(void *tx_queue,
 		vf_rep_bp->tx_pkts[qid]++;
 	}
 
-	rc = bnxt_xmit_pkts(ptxq, tx_pkts, nb_pkts);
+	rc = _bnxt_xmit_pkts(ptxq, tx_pkts, nb_pkts);
 	ptxq->vfr_tx_cfa_action = 0;
-	pthread_mutex_unlock(&parent->rep_info->vfr_lock);
+	pthread_mutex_unlock(&ptxq->txq_lock);
 
 	return rc;
 }
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 7d91e88c9d..05032f7807 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -114,6 +114,7 @@ void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx)
 		txq->mz = NULL;
 
 		rte_free(txq->free);
+		pthread_mutex_destroy(&txq->txq_lock);
 		rte_free(txq);
 		dev->data->tx_queues[queue_idx] = NULL;
 	}
@@ -197,6 +198,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 		goto err;
 	}
 
+	rc = pthread_mutex_init(&txq->txq_lock, NULL);
+	if (rc != 0) {
+		PMD_DRV_LOG(ERR, "TxQ mutex init failed!");
+		goto err;
+	}
 	return 0;
 err:
 	bnxt_tx_queue_release_op(eth_dev, queue_idx);
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 3a483ad5c3..9e54985c4c 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -26,6 +26,7 @@ struct bnxt_tx_queue {
 	int			index;
 	int			tx_wake_thresh;
 	uint32_t		vfr_tx_cfa_action;
+	pthread_mutex_t		txq_lock;
 	struct bnxt_tx_ring_info	*tx_ring;
 
 	unsigned int		cp_nr_rings;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index d74d271d91..7fc44e989d 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -567,6 +567,19 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
 
 uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts)
+{
+	struct bnxt_tx_queue *txq = tx_queue;
+	uint16_t rc;
+
+	pthread_mutex_lock(&txq->txq_lock);
+	rc = _bnxt_xmit_pkts(tx_queue, tx_pkts, nb_pkts);
+	pthread_mutex_unlock(&txq->txq_lock);
+
+	return rc;
+}
+
+uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			 uint16_t nb_pkts)
 {
 	int rc;
 	uint16_t nb_tx_pkts = 0;
diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h
index e64ea2c7d1..09078d545d 100644
--- a/drivers/net/bnxt/bnxt_txr.h
+++ b/drivers/net/bnxt/bnxt_txr.h
@@ -47,7 +47,9 @@ void bnxt_free_tx_rings(struct bnxt *bp);
 int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq);
 int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);
 uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
-			       uint16_t nb_pkts);
+			uint16_t nb_pkts);
+uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			 uint16_t nb_pkts);
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 			    uint16_t nb_pkts);
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/7] net/bnxt: refactor VNIC context cleanup
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 1/7] net/bnxt: avoid seg fault in Tx queue release Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 2/7] net/bnxt: modify locking for representor Tx Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 4/7] net/bnxt: cleanup vnic ref count Ajit Khaparde
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, Kishore Padmanabha

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

Currently the VNIC context cleanup is being called a little early
leading to the VNIC RSS context being freed prior to the filter
cleanup corresponding to the VNIC. But since these filters could
still be referenced by the default VNIC the hardware fails to find
the corresponding VNIC context in some rare cases.

Modify the cleanup sequence for the VNICs to free the VNIC contexts
after the filters and the actual VNIC is freed up in the firmware.

Also make sure to clear the rx_mask with mask of 0 for default VNIC.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 17527a3c4d..397b4a0e05 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3570,16 +3570,18 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 		if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
 			continue;
 
+		if (vnic->func_default && (bp->flags & BNXT_FLAG_DFLT_VNIC_SET))
+			bnxt_hwrm_cfa_l2_clear_rx_mask(bp, vnic);
 		bnxt_clear_hwrm_vnic_flows(bp, vnic);
 
 		bnxt_clear_hwrm_vnic_filters(bp, vnic);
 
-		bnxt_hwrm_vnic_ctx_free(bp, vnic);
-
 		bnxt_hwrm_vnic_tpa_cfg(bp, vnic, false);
 
 		bnxt_hwrm_vnic_free(bp, vnic);
 
+		bnxt_hwrm_vnic_ctx_free(bp, vnic);
+
 		rte_free(vnic->fw_grp_ids);
 		vnic->fw_grp_ids = NULL;
 	}
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/7] net/bnxt: cleanup vnic ref count
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
                   ` (2 preceding siblings ...)
  2024-02-08 17:13 ` [PATCH 3/7] net/bnxt: refactor VNIC context cleanup Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 5/7] net/bnxt: adjust session name on multi host system Ajit Khaparde
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev; +Cc: Damodharam Ammepalli

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

From: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>

Cleanup vnic ref count when port is stopped.
When vlan strip is set/unset the current active
vnics are destroyed and recreated with VNIC id
provided by firmware. The default vnic at index 0
still has ref_cnt=1 while rx_queues are reset to 0,
which fails the check under bnxt_vnic_rss_action_free()

Resetting the vnic->ref_cnt in bnxt_free_all_hwrm_resources()
post FW handshake in clean-up path.

Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 397b4a0e05..1d523d6dec 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3584,6 +3584,8 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 
 		rte_free(vnic->fw_grp_ids);
 		vnic->fw_grp_ids = NULL;
+		if (vnic->ref_cnt && !vnic->rx_queue_cnt)
+			vnic->ref_cnt--;
 	}
 	/* Ring resources */
 	bnxt_free_all_hwrm_rings(bp);
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/7] net/bnxt: adjust session name on multi host system
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
                   ` (3 preceding siblings ...)
  2024-02-08 17:13 ` [PATCH 4/7] net/bnxt: cleanup vnic ref count Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 6/7] net/bnxt: update consumer index of NQ regularly Ajit Khaparde
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev; +Cc: Shuanglin Wang, Shahaji Bhosle

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

From: Shuanglin Wang <shuanglin.wang@broadcom.com>

On multi-host system, pci-id on PFs are same on each host.
The currect code is using the pci-id as the session name to
create a session. This would cause a name confliction on firmware
then fw rejects the session creation.

The patch will change the session name with parent pci_id for
multi-host system. This solution works for single PF per EP only.

Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
---
 drivers/net/bnxt/bnxt.h            |  1 +
 drivers/net/bnxt/bnxt_hwrm.c       |  8 +++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 58 ++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 3b3df6ba28..4203e6a055 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -825,6 +825,7 @@ struct bnxt {
 #define BNXT_TESTPMD_EN(bp)			\
 	((bp)->flags2 & BNXT_FLAGS2_TESTPMD_EN)
 
+	uint16_t		multi_host_pf_pci_id;
 	uint16_t		chip_num;
 #define CHIP_NUM_58818		0xd818
 #define BNXT_CHIP_SR2(bp)	((bp)->chip_num == CHIP_NUM_58818)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1d523d6dec..2ceab555a5 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4207,6 +4207,14 @@ int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp)
 	bp->parent->port_id = rte_le_to_cpu_16(resp->port_id);
 
 	flags = rte_le_to_cpu_16(resp->flags);
+
+	/* check for the mulit-host support */
+	if (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST) {
+		bp->flags |= BNXT_FLAG_MULTI_HOST;
+		bp->multi_host_pf_pci_id = resp->pci_id;
+		PMD_DRV_LOG(INFO, "Mult-Host system Parent PCI-ID: 0x%x\n", resp->pci_id);
+	}
+
 	/* check for the multi-root support */
 	if (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_ROOT) {
 		bp->flags2 |= BNXT_FLAGS2_MULTIROOT_EN;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index b696b6dc3e..274e935a1f 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -641,6 +641,49 @@ ulp_ctx_shared_session_close(struct bnxt *bp,
 	bnxt_ulp_session_tfp_reset(session, session_type);
 }
 
+static int32_t
+ulp_ctx_mh_get_session_name(struct bnxt *bp,
+			    struct tf_open_session_parms *parms)
+{
+	int32_t	rc = 0;
+	unsigned int domain = 0, bus = 0, slot = 0, device = 0;
+	rc = sscanf(parms->ctrl_chan_name,
+		    "%x:%x:%x.%u",
+		    &domain,
+		    &bus,
+		    &slot,
+		    &device);
+	if (rc != 4) {
+		/* PCI Domain not provided (optional in DPDK), thus we
+		 * force domain to 0 and recheck.
+		 */
+		domain = 0;
+		/* Check parsing of bus/slot/device */
+		rc = sscanf(parms->ctrl_chan_name,
+			    "%x:%x.%u",
+			    &bus,
+			    &slot,
+			    &device);
+		if (rc != 3) {
+			BNXT_TF_DBG(DEBUG,
+				    "Failed to scan device ctrl_chan_name\n");
+			return -EINVAL;
+		}
+	}
+
+	/* change domain name for multi-host system */
+	domain = domain + (0xf & bp->multi_host_pf_pci_id);
+	sprintf(parms->ctrl_chan_name,
+		"%x:%x:%x.%u",
+		domain,
+		bus,
+		slot,
+		device);
+	BNXT_TF_DBG(DEBUG,
+		    "Session name for Multi-Host: ctrl_chan_name:%s\n", parms->ctrl_chan_name);
+	return 0;
+}
+
 static int32_t
 ulp_ctx_shared_session_open(struct bnxt *bp,
 			    enum bnxt_ulp_session_type session_type,
@@ -664,6 +707,14 @@ ulp_ctx_shared_session_open(struct bnxt *bp,
 			    ethdev->data->port_id, rc);
 		return rc;
 	}
+
+	/* On multi-host system, adjust ctrl_chan_name to avoid confliction */
+	if (BNXT_MH(bp)) {
+		rc = ulp_ctx_mh_get_session_name(bp, &parms);
+		if (rc)
+			return rc;
+	}
+
 	resources = &parms.resources;
 
 	/*
@@ -835,6 +886,13 @@ ulp_ctx_session_open(struct bnxt *bp,
 		return rc;
 	}
 
+	/* On multi-host system, adjust ctrl_chan_name to avoid confliction */
+	if (BNXT_MH(bp)) {
+		rc = ulp_ctx_mh_get_session_name(bp, &params);
+		if (rc)
+			return rc;
+	}
+
 	rc = bnxt_ulp_cntxt_app_id_get(bp->ulp_ctx, &app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to get the app id from ulp.\n");
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/7] net/bnxt: update consumer index of NQ regularly
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
                   ` (4 preceding siblings ...)
  2024-02-08 17:13 ` [PATCH 5/7] net/bnxt: adjust session name on multi host system Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 17:13 ` [PATCH 7/7] net/bnxt: update RSS algorithm capability Ajit Khaparde
  2024-02-08 21:50 ` [PATCH 0/7] bnxt bug fixes Ajit Khaparde
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev; +Cc: Damodharam Ammepalli, Somnath Kotur, Kalesh AP

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

Update the consumer index of the default CQ/NQ at regular intervals.
Since the size of the queue can vary, ring the queue at 1/8th the queue
depth.

Also skip NQ doorbell update if done already.

If the NQ is rearmed already or if there was no valid entry,
which is indicated by cnt being 0, skip ringing the doorbell for the NQ.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
 drivers/net/bnxt/bnxt_irq.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 71d1565e08..edf16bd33e 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -17,6 +17,19 @@
  * Interrupts
  */
 
+static inline void bnxt_int_handler_rearm(struct bnxt *bp,
+					  struct bnxt_cp_ring_info *cpr,
+					  uint32_t raw_cons)
+{
+	cpr->cp_raw_cons = raw_cons;
+	if (BNXT_HAS_NQ(bp))
+		bnxt_db_nq_arm(cpr);
+	else
+		B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
+}
+
+/* ARM the default CQ/NQ at intervals of 1/8th of ring size */
+#define BNXT_DB_REARM_FACTOR		8
 void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
@@ -24,6 +37,7 @@ void bnxt_int_handler(void *param)
 	uint32_t cons, raw_cons, cp_ring_size;
 	struct bnxt_cp_ring_info *cpr;
 	struct cmpl_base *cmp;
+	uint16_t cnt = 0;
 
 
 	if (bp == NULL)
@@ -54,13 +68,15 @@ void bnxt_int_handler(void *param)
 
 		bnxt_event_hwrm_resp_handler(bp, cmp);
 		raw_cons = NEXT_RAW_CMP(raw_cons);
+		if (++cnt >= cp_ring_size / BNXT_DB_REARM_FACTOR) {
+			bnxt_int_handler_rearm(bp, cpr, raw_cons);
+			cnt = 0;
+		}
 	}
 
-	cpr->cp_raw_cons = raw_cons;
-	if (BNXT_HAS_NQ(bp))
-		bnxt_db_nq_arm(cpr);
-	else
-		B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
+	/* cnt = 0 means no work or we rearmed already */
+	if (cnt > 0)
+		bnxt_int_handler_rearm(bp, cpr, raw_cons);
 
 	pthread_mutex_unlock(&bp->def_cp_lock);
 }
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 7/7] net/bnxt: update RSS algorithm capability
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
                   ` (5 preceding siblings ...)
  2024-02-08 17:13 ` [PATCH 6/7] net/bnxt: update consumer index of NQ regularly Ajit Khaparde
@ 2024-02-08 17:13 ` Ajit Khaparde
  2024-02-08 21:50 ` [PATCH 0/7] bnxt bug fixes Ajit Khaparde
  7 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 17:13 UTC (permalink / raw)
  To: dev

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

Update rss_algo_capa in ethdev.
This information was not being set.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index fecc8666e8..09a70b7529 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1138,6 +1138,9 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->tx_offload_capa = bnxt_get_tx_port_offloads(bp) |
 				    dev_info->tx_queue_offload_capa;
 	dev_info->flow_type_rss_offloads = bnxt_eth_rss_support(bp);
+	dev_info->rss_algo_capa = RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT) |
+				  RTE_ETH_HASH_ALGO_CAPA_MASK(TOEPLITZ) |
+				  RTE_ETH_HASH_ALGO_CAPA_MASK(SIMPLE_XOR);
 
 	dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
 	dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
-- 
2.39.2 (Apple Git-143)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/7] bnxt bug fixes
  2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
                   ` (6 preceding siblings ...)
  2024-02-08 17:13 ` [PATCH 7/7] net/bnxt: update RSS algorithm capability Ajit Khaparde
@ 2024-02-08 21:50 ` Ajit Khaparde
  2024-02-22  2:50   ` Patrick Robb
  7 siblings, 1 reply; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-08 21:50 UTC (permalink / raw)
  To: dev

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

On Thu, Feb 8, 2024 at 9:13 AM Ajit Khaparde <ajit.khaparde@broadcom.com> wrote:
>
> Patchset with bug fixes for bnxt PMD.
> Patch based against the
> next-net-brcm for-next-net branch.
>
> Please apply.
Patchset merged to the dpdk-next-brcm for-next-net branch.
Thanks

>
> Ajit Khaparde (4):
>   net/bnxt: modify locking for representor Tx
>   net/bnxt: refactor VNIC context cleanup
>   net/bnxt: update consumer index of NQ regularly
>   net/bnxt: update RSS algorithm capability
>
> Damodharam Ammepalli (1):
>   net/bnxt: cleanup vnic ref count
>
> Kishore Padmanabha (1):
>   net/bnxt: avoid seg fault in Tx queue release
>
> Shuanglin Wang (1):
>   net/bnxt: adjust session name on multi host system
>
>  drivers/net/bnxt/bnxt.h            |  2 +-
>  drivers/net/bnxt/bnxt_ethdev.c     | 14 +++-----
>  drivers/net/bnxt/bnxt_hwrm.c       | 16 +++++++--
>  drivers/net/bnxt/bnxt_irq.c        | 26 +++++++++++---
>  drivers/net/bnxt/bnxt_reps.c       |  6 ++--
>  drivers/net/bnxt/bnxt_txq.c        |  8 ++++-
>  drivers/net/bnxt/bnxt_txq.h        |  1 +
>  drivers/net/bnxt/bnxt_txr.c        | 13 +++++++
>  drivers/net/bnxt/bnxt_txr.h        |  4 ++-
>  drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 58 ++++++++++++++++++++++++++++++
>  10 files changed, 125 insertions(+), 23 deletions(-)
>
> --
> 2.39.2 (Apple Git-143)
>

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/7] bnxt bug fixes
  2024-02-08 21:50 ` [PATCH 0/7] bnxt bug fixes Ajit Khaparde
@ 2024-02-22  2:50   ` Patrick Robb
  2024-02-22  3:20     ` Ajit Khaparde
  0 siblings, 1 reply; 11+ messages in thread
From: Patrick Robb @ 2024-02-22  2:50 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

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

https://patchwork.dpdk.org/project/dpdk/patch/20240208171330.31139-8-ajit.khaparde@broadcom.com/

Hi Ajit,

So you know, this series did fail in CI testing, and now that it is merged
to main, all patchseries are failing DTS at EAL. Performance testing is
also offline for the same reason.

I will run the niccli utility to upgrade broadcom NIC firmware on the
system and give it a rerun. Otherwise, let me know what you think.

This occurs on our ARM Ampere server, with the BCM57414 NetXtreme-E
10Gb/25Gb

21:02:08   [00;36m                   TestScatter: Test Case
test_scatter_mbuf_2048 Begin [0m
21:02:08  dut.arm-ampere-dut.dpdklab.iol.unh.edu:
x86_64-native-linux-gcc/app/dpdk-testpmd -l 1,2 -n 4 -a 0007:01:00.0 -a
0007:01:00.1 --file-prefix=dpdk_2978774_20240222015854   -- -i
--mbcache=200 --mbuf-size=1024 --portmask=0x1 --max-pkt-len=9000
--port-topology=loop --tx-offloads=0x00008000 [0m
21:04:14   [01;31m                   TestScatter: Test Case
test_scatter_mbuf_2048 Result FAILED: TIMEOUT on
x86_64-native-linux-gcc/app/dpdk-testpmd -l 1,2 -n 4 -a 0007:01:00.0 -a
0007:01:00.1 --file-prefix=dpdk_2978774_20240222015854   -- -i
--mbcache=200 --mbuf-size=1024 --portmask=0x1 --max-pkt-len=9000
--port-topology=loop --tx-offloads=0x00008000 [0m
21:04:14   [01;31m                   TestScatter: EAL: Detected CPU lcores:
160
21:04:14  EAL: Detected NUMA nodes: 2
21:04:14  EAL: Detected static linkage of DPDK
21:04:14  EAL: Multi-process socket
/var/run/dpdk/dpdk_2978774_20240222015854/mp_socket
21:04:14  EAL: Selected IOVA mode 'VA'
21:04:14  EAL: VFIO support initialized
21:04:14  EAL: Using IOMMU type 1 (Type 1)
21:04:14  EAL: Probe PCI driver: net_bnxt (14e4:16d7) device: 0007:01:00.0
(socket 1)
21:04:14  Segmentation fault (core dumped)

I'll let you know how reruns go.

On Thu, Feb 8, 2024 at 4:51 PM Ajit Khaparde <ajit.khaparde@broadcom.com>
wrote:

> On Thu, Feb 8, 2024 at 9:13 AM Ajit Khaparde <ajit.khaparde@broadcom.com>
> wrote:
> >
> > Patchset with bug fixes for bnxt PMD.
> > Patch based against the
> > next-net-brcm for-next-net branch.
> >
> > Please apply.
> Patchset merged to the dpdk-next-brcm for-next-net branch.
> Thanks
>
> >
> > Ajit Khaparde (4):
> >   net/bnxt: modify locking for representor Tx
> >   net/bnxt: refactor VNIC context cleanup
> >   net/bnxt: update consumer index of NQ regularly
> >   net/bnxt: update RSS algorithm capability
> >
> > Damodharam Ammepalli (1):
> >   net/bnxt: cleanup vnic ref count
> >
> > Kishore Padmanabha (1):
> >   net/bnxt: avoid seg fault in Tx queue release
> >
> > Shuanglin Wang (1):
> >   net/bnxt: adjust session name on multi host system
> >
> >  drivers/net/bnxt/bnxt.h            |  2 +-
> >  drivers/net/bnxt/bnxt_ethdev.c     | 14 +++-----
> >  drivers/net/bnxt/bnxt_hwrm.c       | 16 +++++++--
> >  drivers/net/bnxt/bnxt_irq.c        | 26 +++++++++++---
> >  drivers/net/bnxt/bnxt_reps.c       |  6 ++--
> >  drivers/net/bnxt/bnxt_txq.c        |  8 ++++-
> >  drivers/net/bnxt/bnxt_txq.h        |  1 +
> >  drivers/net/bnxt/bnxt_txr.c        | 13 +++++++
> >  drivers/net/bnxt/bnxt_txr.h        |  4 ++-
> >  drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 58 ++++++++++++++++++++++++++++++
> >  10 files changed, 125 insertions(+), 23 deletions(-)
> >
> > --
> > 2.39.2 (Apple Git-143)
> >
>

[-- Attachment #2: Type: text/html, Size: 4396 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/7] bnxt bug fixes
  2024-02-22  2:50   ` Patrick Robb
@ 2024-02-22  3:20     ` Ajit Khaparde
  0 siblings, 0 replies; 11+ messages in thread
From: Ajit Khaparde @ 2024-02-22  3:20 UTC (permalink / raw)
  To: Patrick Robb; +Cc: dev

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

On Wed, Feb 21, 2024 at 6:50 PM Patrick Robb <probb@iol.unh.edu> wrote:
>
> https://patchwork.dpdk.org/project/dpdk/patch/20240208171330.31139-8-ajit.khaparde@broadcom.com/
>
> Hi Ajit,
>
> So you know, this series did fail in CI testing, and now that it is merged to main, all patchseries are failing DTS at EAL. Performance testing is also offline for the same reason.
>
> I will run the niccli utility to upgrade broadcom NIC firmware on the system and give it a rerun. Otherwise, let me know what you think.
>
> This occurs on our ARM Ampere server, with the BCM57414 NetXtreme-E 10Gb/25Gb
>
> 21:02:08   [00;36m                   TestScatter: Test Case test_scatter_mbuf_2048 Begin [0m
> 21:02:08  dut.arm-ampere-dut.dpdklab.iol.unh.edu: x86_64-native-linux-gcc/app/dpdk-testpmd -l 1,2 -n 4 -a 0007:01:00.0 -a 0007:01:00.1 --file-prefix=dpdk_2978774_20240222015854   -- -i --mbcache=200 --mbuf-size=1024 --portmask=0x1 --max-pkt-len=9000 --port-topology=loop --tx-offloads=0x00008000 [0m
> 21:04:14   [01;31m                   TestScatter: Test Case test_scatter_mbuf_2048 Result FAILED: TIMEOUT on x86_64-native-linux-gcc/app/dpdk-testpmd -l 1,2 -n 4 -a 0007:01:00.0 -a 0007:01:00.1 --file-prefix=dpdk_2978774_20240222015854   -- -i --mbcache=200 --mbuf-size=1024 --portmask=0x1 --max-pkt-len=9000 --port-topology=loop --tx-offloads=0x00008000 [0m
> 21:04:14   [01;31m                   TestScatter: EAL: Detected CPU lcores: 160
> 21:04:14  EAL: Detected NUMA nodes: 2
> 21:04:14  EAL: Detected static linkage of DPDK
> 21:04:14  EAL: Multi-process socket /var/run/dpdk/dpdk_2978774_20240222015854/mp_socket
> 21:04:14  EAL: Selected IOVA mode 'VA'
> 21:04:14  EAL: VFIO support initialized
> 21:04:14  EAL: Using IOMMU type 1 (Type 1)
> 21:04:14  EAL: Probe PCI driver: net_bnxt (14e4:16d7) device: 0007:01:00.0 (socket 1)
> 21:04:14  Segmentation fault (core dumped)
>
> I'll let you know how reruns go.

Ok Thanks for bringing it to my attention. Let me know how the rerun goes.
I had run the tests on my ARM setup and did not see the problem.
Let me try again.

Thanks
Ajit



>
> On Thu, Feb 8, 2024 at 4:51 PM Ajit Khaparde <ajit.khaparde@broadcom.com> wrote:
>>
>> On Thu, Feb 8, 2024 at 9:13 AM Ajit Khaparde <ajit.khaparde@broadcom.com> wrote:
>> >
>> > Patchset with bug fixes for bnxt PMD.
>> > Patch based against the
>> > next-net-brcm for-next-net branch.
>> >
>> > Please apply.
>> Patchset merged to the dpdk-next-brcm for-next-net branch.
>> Thanks
>>
>> >
>> > Ajit Khaparde (4):
>> >   net/bnxt: modify locking for representor Tx
>> >   net/bnxt: refactor VNIC context cleanup
>> >   net/bnxt: update consumer index of NQ regularly
>> >   net/bnxt: update RSS algorithm capability
>> >
>> > Damodharam Ammepalli (1):
>> >   net/bnxt: cleanup vnic ref count
>> >
>> > Kishore Padmanabha (1):
>> >   net/bnxt: avoid seg fault in Tx queue release
>> >
>> > Shuanglin Wang (1):
>> >   net/bnxt: adjust session name on multi host system
>> >
>> >  drivers/net/bnxt/bnxt.h            |  2 +-
>> >  drivers/net/bnxt/bnxt_ethdev.c     | 14 +++-----
>> >  drivers/net/bnxt/bnxt_hwrm.c       | 16 +++++++--
>> >  drivers/net/bnxt/bnxt_irq.c        | 26 +++++++++++---
>> >  drivers/net/bnxt/bnxt_reps.c       |  6 ++--
>> >  drivers/net/bnxt/bnxt_txq.c        |  8 ++++-
>> >  drivers/net/bnxt/bnxt_txq.h        |  1 +
>> >  drivers/net/bnxt/bnxt_txr.c        | 13 +++++++
>> >  drivers/net/bnxt/bnxt_txr.h        |  4 ++-
>> >  drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 58 ++++++++++++++++++++++++++++++
>> >  10 files changed, 125 insertions(+), 23 deletions(-)
>> >
>> > --
>> > 2.39.2 (Apple Git-143)
>> >
>
>

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-22  3:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
2024-02-08 17:13 ` [PATCH 1/7] net/bnxt: avoid seg fault in Tx queue release Ajit Khaparde
2024-02-08 17:13 ` [PATCH 2/7] net/bnxt: modify locking for representor Tx Ajit Khaparde
2024-02-08 17:13 ` [PATCH 3/7] net/bnxt: refactor VNIC context cleanup Ajit Khaparde
2024-02-08 17:13 ` [PATCH 4/7] net/bnxt: cleanup vnic ref count Ajit Khaparde
2024-02-08 17:13 ` [PATCH 5/7] net/bnxt: adjust session name on multi host system Ajit Khaparde
2024-02-08 17:13 ` [PATCH 6/7] net/bnxt: update consumer index of NQ regularly Ajit Khaparde
2024-02-08 17:13 ` [PATCH 7/7] net/bnxt: update RSS algorithm capability Ajit Khaparde
2024-02-08 21:50 ` [PATCH 0/7] bnxt bug fixes Ajit Khaparde
2024-02-22  2:50   ` Patrick Robb
2024-02-22  3:20     ` Ajit Khaparde

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).