Skip to contentSkip to conversation

bnxt PMD fixes

PATCH In review Ajit Khaparde 1 participant 6 messages Apr 30, 2021 – May 2, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt PMD fixes

This patchset contains fixes to the bnxt PMD.

Ajit Khaparde (4):
net/bnxt: fix mismatched type comparison
net/bnxt: fix unchecked return value
net/bnxt: fix mismatched comparison
net/bnxt: fix ring count calculation

 drivers/net/bnxt/bnxt.h        | 18 ++++++------------
 drivers/net/bnxt/bnxt_ethdev.c |  8 ++++++--
 drivers/net/bnxt/bnxt_rxr.c    |  2 +-
 3 files changed, 13 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/4 net/bnxt: fix mismatched type comparison

dev_info.max_mac_addrs is of type uint32_t. But the counter i is of type uint16_t. This mismatch may cause the loop condition may always be true. Change the loop counter variable to uint32_t.

Fixes b02f1573cd07 ("net/bnxt: restore MAC filters during reset recovery")
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index dba5b9f..6dfb33c 100644
@@ -3959,7 +3959,7 @@ static int bnxt_restore_mac_filters(struct bnxt *bp)
 	struct rte_ether_addr *addr;
 	uint64_t pool_mask;
 	uint32_t pool = 0;
-	uint16_t i;
+	uint32_t i;
 	int rc;
 
 	if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp))
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/4 net/bnxt: fix unchecked return value

In reply to Ajit Khaparde

Return value where return value of rte_pci_read_config was not checked. Fix it.

Coverity issue: 349919

Fixes 9d0cbaecc91a ("net/bnxt: support periodic FW health monitoring")
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -1
index 6dfb33c..4068271 100644
@@ -4129,13 +4129,17 @@ uint32_t bnxt_read_fw_status_reg(struct bnxt *bp, uint32_t index)
 	struct bnxt_error_recovery_info *info = bp->recovery_info;
 	uint32_t reg = info->status_regs[index];
 	uint32_t type, offset, val = 0;
+	int ret = 0;
 
 	type = BNXT_FW_STATUS_REG_TYPE(reg);
 	offset = BNXT_FW_STATUS_REG_OFF(reg);
 
 	switch (type) {
 	case BNXT_FW_STATUS_REG_TYPE_CFG:
-		rte_pci_read_config(bp->pdev, &val, sizeof(val), offset);
+		ret = rte_pci_read_config(bp->pdev, &val, sizeof(val), offset);
+		if (ret < 0)
+			PMD_DRV_LOG(ERR, "Failed to read PCI offset %#x",
+				    offset);
 		break;
 	case BNXT_FW_STATUS_REG_TYPE_GRC:
 		offset = info->mapped_status_regs[index];
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/4 net/bnxt: fix mismatched comparison

In reply to Ajit Khaparde

Fix comparison between uint16_t and uint32_t types.

Fixes 6dc83230b43b ("net/bnxt: support port representor data path")
---
 drivers/net/bnxt/bnxt_rxr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_rxr.c +1 -1
index 7179c6c..2ef4115 100644
@@ -1042,7 +1042,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (alloc_failed) {
-		uint16_t cnt;
+		int cnt;
 
 		rx_raw_prod = RING_NEXT(rx_raw_prod);
 		for (cnt = 0; cnt < nb_rx_pkts + nb_rep_rx_pkts; cnt++) {
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/4 net/bnxt: fix ring count calculation

In reply to Ajit Khaparde

Fix ring count calculation for Thor. VNIC count does not have a direct bearing on the number of rings that can be used.

Fixes fe8dd26f86c78 ("net/bnxt: cap max Rx rings for Thor")
---
 drivers/net/bnxt/bnxt.h | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/bnxt/bnxt.h +6 -12
index bd2dec4..013e291 100644
@@ -836,7 +836,6 @@ struct bnxt {
 static
 inline uint16_t bnxt_max_rings(struct bnxt *bp)
 {
-	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	uint16_t max_tx_rings = bp->max_tx_rings;
 	uint16_t max_rx_rings = bp->max_rx_rings;
 	uint16_t max_cp_rings = bp->max_cp_rings;
@@ -854,17 +853,12 @@ inline uint16_t bnxt_max_rings(struct bnxt *bp)
 				       bp->max_stat_ctx / 2U);
 	}
 
-	if (BNXT_CHIP_P5(bp)) {
-		/* RSS table size in Thor is 512.
-		 * Cap max Rx rings to the same value for RSS.
-		 * For non-RSS case cap it to the max VNIC count.
-		 */
-		if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
-			max_rx_rings = RTE_MIN(max_rx_rings,
-					       BNXT_RSS_TBL_SIZE_P5);
-		else
-			max_rx_rings = RTE_MIN(max_rx_rings, bp->max_vnics);
-	}
+	/*
+	 * RSS table size in Thor is 512.
+	 * Cap max Rx rings to the same value for RSS.
+	 */
+	if (BNXT_CHIP_P5(bp))
+		max_rx_rings = RTE_MIN(max_rx_rings, BNXT_RSS_TBL_SIZE_P5);
 
 	max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
 	if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
Signature · 1 line
1.8.3.1
#5 lore raw
In reply to Ajit Khaparde
Quoted 8 lines · Ajit Khaparde

This patchset contains fixes to the bnxt PMD.

Ajit Khaparde (4):
net/bnxt: fix mismatched type comparison
net/bnxt: fix unchecked return value
net/bnxt: fix mismatched comparison
net/bnxt: fix ring count calculation

Quoted 5 lines
 drivers/net/bnxt/bnxt.h        | 18 ++++++------------
 drivers/net/bnxt/bnxt_ethdev.c |  8 ++++++--
 drivers/net/bnxt/bnxt_rxr.c    |  2 +-
 3 files changed, 13 insertions(+), 15 deletions(-)

Patchset applied to dpdk-next-net-brcm. Thanks

Quoted 5 lines

--
1.8.3.1