Skip to contentSkip to conversation

bnxt patch set

PATCH In review Ajit Khaparde 1 participant 13 messages Feb 5, 2025 – Feb 6, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt patch set

Patchset with bug fixes for bnxt PMD.
Also addresses various Coverity issues reported in the recent Coverity scan.

Please apply.

Ajit Khaparde (4):
net/bnxt: disable TruFlow if compressed CQE is set net/bnxt: simplify check for CQE mode net/bnxt: fix Rx handler
net/bnxt: fix burst handler initialization

Peter Spreadborough (6):
net/bnxt: address coverity deadcode issue net/bnxt: address coverity checked return issues net/bnxt: address coverity overflow issues net/bnxt: address coverity integer overflow issues net/bnxt: address coverity uninitialized variables issues net/bnxt: address coverity control flow issues

Sangtani Parag Satishbhai (1):
net/bnxt/truFlow: Fix seg fault when rep are re-attached

 drivers/net/bnxt/bnxt.h                       |   4 -
 drivers/net/bnxt/bnxt_ethdev.c                |  31 ++--
 drivers/net/bnxt/bnxt_hwrm.c                  |   2 +-
 drivers/net/bnxt/bnxt_rxr.c                   |  16 +-
 .../hcapi/cfa_v3/bld/p70/cfa_bld_p70_mpc.c    |  90 +++++------
 .../p70/host/cfa_bld_p70_host_mpc_wrapper.c   | 150 +++++++++---------
 drivers/net/bnxt/hcapi/cfa_v3/mm/cfa_mm.c     |   6 +-
 drivers/net/bnxt/tf_core/v3/tfc_em.c          |   1 +
 drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c   |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_utils.h      |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  10 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   8 +-
 drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c          |   1 +
 13 files changed, 174 insertions(+), 149 deletions(-)
Signature · 1 line
2.39.5 (Apple Git-154)
#1 lore raw

PATCH 1/11 net/bnxt: disable TruFlow if compressed CQE is set

If a user selects compressed CQE mode using the cqe-mode devarg, it is clear that the user does not intend to use TruFlow mode. Since host backed TruFlow setting is enable by default now, disable TruFlow during initialization to prevent unexpected behavior when the two get enabled.

---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 drivers/net/bnxt/bnxt_hwrm.c   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
index 21e9aa902c..81a7723c7e 100644
@@ -5785,6 +5785,11 @@ static int bnxt_get_config(struct bnxt *bp)
 	if (rc)
 		return rc;
 
+	if (bnxt_compressed_rx_cqe_mode_enabled(bp)) {
+		PMD_DRV_LOG_LINE(INFO, "Compressed CQE is set. Truflow is disabled.");
+		bp->fw_cap &= ~BNXT_FW_CAP_TRUFLOW_EN;
+	}
+
 	rc = bnxt_hwrm_queue_qportcfg(bp);
 	if (rc)
 		return rc;
drivers/net/bnxt/bnxt_hwrm.c +1 -1
index d015ba2b9c..305c419051 100644
@@ -1731,7 +1731,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 
 	if (dev_caps_cfg &
 	    HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_CFA_TRUFLOW_SUPPORTED) {
-		PMD_DRV_LOG_LINE(DEBUG, "Host-based truflow feature enabled.");
+		PMD_DRV_LOG_LINE(DEBUG, "Host-based truflow feature supported.");
 		bp->fw_cap |= BNXT_FW_CAP_TRUFLOW_EN;
 	}
 
Signature · 1 line
2.39.5 (Apple Git-154)
#2 lore raw

PATCH 2/11 net/bnxt: simplify check for CQE mode

In reply to Ajit Khaparde

Simplify the check for the CQE mode.
We don't have to check the Rx offload mode to determine which CQE mode is supported.
CQE mode is configured at load time and once set will decide if TCP LRO or buffer split can be supported or not.

---
 drivers/net/bnxt/bnxt.h | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/bnxt/bnxt.h +0 -4
index 4a5c224c09..c9fdd36d3e 100644
@@ -1112,12 +1112,8 @@ inline uint16_t bnxt_max_rings(struct bnxt *bp)
 static inline bool
 bnxt_compressed_rx_cqe_mode_enabled(struct bnxt *bp)
 {
-	uint64_t rx_offloads = bp->eth_dev->data->dev_conf.rxmode.offloads;
-
 	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_L2_CQE_MODE &&
 		bp->flags2 & BNXT_FLAGS2_COMPRESSED_RX_CQE &&
-		!(rx_offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) &&
-		!(rx_offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) &&
 		!bp->num_reps && !bp->ieee_1588)
 		return true;
 
Signature · 1 line
2.39.5 (Apple Git-154)
#3 lore raw

PATCH 3/11 net/bnxt: fix Rx handler

In reply to Ajit Khaparde

Fix the code accounting the status of compressed CQE handler. The code was inside the block handling the normal CQE mode. Moved the code out. Without this the Rx datapath was broken for compressed CQEs in scalar mode.

Fixes 5c980062d895 ("net/bnxt: support compressed Rx CQE")
---
 drivers/net/bnxt/bnxt_rxr.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +8 -8
index 5b43bcbea6..b53d9a917a 100644
@@ -1390,14 +1390,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		} else if ((CMP_TYPE(rxcmp) >= CMPL_BASE_TYPE_RX_TPA_START_V2) &&
 			   (CMP_TYPE(rxcmp) <= CMPL_BASE_TYPE_RX_TPA_START_V3)) {
 			rc = bnxt_rx_pkt(&rx_pkts[nb_rx_pkts], rxq, &raw_cons);
-			if (!rc)
-				nb_rx_pkts++;
-			else if (rc == -EBUSY)	/* partial completion */
-				break;
-			else if (rc == -ENODEV)	/* completion for representor */
-				nb_rep_rx_pkts++;
-			else if (rc == -ENOMEM)
-				nb_rx_pkts++;
 		} else if (!BNXT_NUM_ASYNC_CPR(rxq->bp)) {
 			evt =
 			bnxt_event_hwrm_resp_handler(rxq->bp,
@@ -1407,6 +1399,14 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				goto done;
 		}
 
+		if (!rc)
+			nb_rx_pkts++;
+		else if (rc == -EBUSY)	/* partial completion */
+			break;
+		else if (rc == -ENODEV)	/* completion for representor */
+			nb_rep_rx_pkts++;
+		else if (rc == -ENOMEM)
+			nb_rx_pkts++;
 		raw_cons = NEXT_RAW_CMP(raw_cons);
 		/*
 		 * The HW reposting may fall behind if mbuf allocation has
Signature · 1 line
2.39.5 (Apple Git-154)
#4 lore raw

PATCH 4/11 net/bnxt: set burst handler correctly

In reply to Ajit Khaparde

We are incorrectly setting the Rx and Tx burst handlers to static mode by default. Fix that by using the bnxt_receive_function and bnxt_transmit_function calls to determine if the vector mode is enabled and identify the appropriate burst handler during the initialization.

---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +2 -2
index 81a7723c7e..b18247feb2 100644
@@ -6532,8 +6532,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
 	eth_dev->rx_queue_count = bnxt_rx_queue_count_op;
 	eth_dev->rx_descriptor_status = bnxt_rx_descriptor_status_op;
 	eth_dev->tx_descriptor_status = bnxt_tx_descriptor_status_op;
-	eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
-	eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
+	eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
+	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
 
 	/*
 	 * For secondary processes, we don't initialise any further
Signature · 1 line
2.39.5 (Apple Git-154)
#5 lore raw

PATCH 5/11 net/bnxt/truFlow: Fix seg fault when rep are re-attached

In reply to Ajit Khaparde

From: Sangtani Parag Satishbhai <[email protected]>

When the PCI port is detached using the testpmd command, as part of cleanup testpmd removes resources of parent port and all the children's ports and calls the driver specific pci_remove API with the parent rte ethdev to clean-up ethdevs. For the bnxt driver, a condition to check type of ethdev is added in bnxt_pci_remove and based on the condition relevant ethdev is removed (VF/PF or VFR). As the RTE layer always calls PCI remove with the parent ethdev, the bnxt_pci_remove never frees children (VFRs) ethdev. As, these ethdevs were not freed it gives spurious status in re-allocation check(when pci port attach command is executed) and when RTE layers tries to access interrupt specific info from the ethdev due to uninitialized members it access NULL pointer which results in seg fault. The fix is made in bnxt_pci_remove to clean ethdev for parent (PF/VF) along with children (VFRs).

Fixes 322bd6e70272 ("net/bnxt: add port representor infrastructure")
---
 drivers/net/bnxt/bnxt_ethdev.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +15 -7
index b18247feb2..144d4377bd 100644
@@ -6993,6 +6993,8 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 {
 	struct rte_eth_dev *eth_dev;
+	uint16_t port_id;
+	int rc = 0;
 
 	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!eth_dev)
@@ -7002,14 +7004,20 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 			   * +ve value will at least help in proper cleanup
 			   */
 
-	PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d pci remove", eth_dev->data->port_id);
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		if (rte_eth_dev_is_repr(eth_dev))
-			return rte_eth_dev_destroy(eth_dev,
-						   bnxt_representor_uninit);
-		else
-			return rte_eth_dev_destroy(eth_dev,
-						   bnxt_dev_uninit);
+		RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) {
+			PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d pci remove", port_id);
+			eth_dev = &rte_eth_devices[port_id];
+			if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+				rc = rte_eth_dev_destroy(eth_dev,
+							 bnxt_representor_uninit);
+			else
+				rc = rte_eth_dev_destroy(eth_dev,
+							 bnxt_dev_uninit);
+			if (rc != 0)
+				return rc;
+		}
+		return rc;
 	} else {
 		return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
 	}
Signature · 1 line
2.39.5 (Apple Git-154)
#6 lore raw

PATCH 6/11 net/bnxt: address coverity deadcode issue

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

This change addresses the CID 449075: Control flow issues (DEADCODE) reported by coverity associated with the ASSERT_RETURN macro. The change renames the macro and replaces the log macro to use PMD_DRV_LOG_LINE.

Coverity issue: 449075

---
 .../hcapi/cfa_v3/bld/p70/cfa_bld_p70_mpc.c    |  90 +++++------
 .../p70/host/cfa_bld_p70_host_mpc_wrapper.c   | 150 +++++++++---------
 2 files changed, 120 insertions(+), 120 deletions(-)
drivers/net/bnxt/hcapi/cfa_v3/bld/p70/cfa_bld_p70_mpc.c +45 -45
index 445d9aad87..3f8ef3a5f1 100644
@@ -31,9 +31,9 @@
 	} while (0)
 
 #ifdef NXT_ENV_DEBUG
-#define ASSERT_RETURN(ERRNO) CFA_LOG_ERR("Returning error: %d\n", (ERRNO))
+#define LOG_RC(ERRNO) PMD_DRV_LOG_LINE(ERR, "Returning error: %d", (ERRNO))
 #else
-#define ASSERT_RETURN(ERRNO)
+#define LOG_RC(ERRNO)
 #endif
 
 /**
@@ -68,7 +68,7 @@ static int fill_mpc_header(uint8_t *cmd, uint32_t size, uint32_t opaque_val)
 	};
 
 	if (size < sizeof(struct mpc_header)) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -87,17 +87,17 @@ static int compose_mpc_read_clr_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 		sizeof(struct mpc_header) + sizeof(struct cfa_mpc_read_clr_cmd);
 
 	if (parms->data_size != 1) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (parms->tbl_type >= CFA_HW_TABLE_MAX) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -138,17 +138,17 @@ static int compose_mpc_read_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 		sizeof(struct mpc_header) + sizeof(struct cfa_mpc_read_cmd);
 
 	if (parms->data_size < 1 || parms->data_size > 4) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (parms->tbl_type >= CFA_HW_TABLE_MAX) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -194,22 +194,22 @@ static int compose_mpc_write_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 			    parms->data_size * MPC_CFA_CACHE_ACCESS_UNIT_SIZE;
 
 	if (parms->data_size < 1 || parms->data_size > 4) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (parms->tbl_type >= CFA_HW_TABLE_MAX) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (!parms->write.data_ptr) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -252,17 +252,17 @@ static int compose_mpc_evict_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 			    sizeof(struct cfa_mpc_invalidate_cmd);
 
 	if (parms->data_size < 1 || parms->data_size > 4) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (parms->tbl_type >= CFA_HW_TABLE_MAX) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -293,7 +293,7 @@ static int compose_mpc_evict_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 		break;
 	case CFA_MPC_EV_EVICT_TABLE_SCOPE:
 		/* Not supported */
-		ASSERT_RETURN(-ENOTSUP);
+		LOG_RC(-ENOTSUP);
 		return -ENOTSUP;
 	default:
 	case CFA_MPC_EV_EVICT_SCOPE_ADDRESS:
@@ -326,7 +326,7 @@ int cfa_mpc_build_cache_axs_cmd(enum cfa_mpc_opcode opc, uint8_t *cmd_buff,
 {
 	int rc;
 	if (!cmd_buff || !cmd_buff_len || *cmd_buff_len == 0 || !parms) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -344,7 +344,7 @@ int cfa_mpc_build_cache_axs_cmd(enum cfa_mpc_opcode opc, uint8_t *cmd_buff,
 	case CFA_MPC_INVALIDATE:
 		return compose_mpc_evict_msg(cmd_buff, cmd_buff_len, parms);
 	default:
-		ASSERT_RETURN(-ENOTSUP);
+		LOG_RC(-ENOTSUP);
 		return -ENOTSUP;
 	}
 }
@@ -360,17 +360,17 @@ static int compose_mpc_em_search_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 			    e->data_size * MPC_CFA_CACHE_ACCESS_UNIT_SIZE;
 
 	if (e->data_size < 1 || e->data_size > 4) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (!e->em_entry) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -405,17 +405,17 @@ static int compose_mpc_em_insert_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 			    e->data_size * MPC_CFA_CACHE_ACCESS_UNIT_SIZE;
 
 	if (e->data_size < 1 || e->data_size > 4) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (!e->em_entry) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -455,7 +455,7 @@ static int compose_mpc_em_delete_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 			    sizeof(struct cfa_mpc_em_delete_cmd);
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -487,7 +487,7 @@ static int compose_mpc_em_chain_msg(uint8_t *cmd_buff, uint32_t *cmd_buff_len,
 		sizeof(struct mpc_header) + sizeof(struct cfa_mpc_em_chain_cmd);
 
 	if (*cmd_buff_len < cmd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -530,7 +530,7 @@ int cfa_mpc_build_em_op_cmd(enum cfa_mpc_opcode opc, uint8_t *cmd_buff,
 {
 	int rc;
 	if (!cmd_buff || !cmd_buff_len || *cmd_buff_len == 0 || !parms) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -548,7 +548,7 @@ int cfa_mpc_build_em_op_cmd(enum cfa_mpc_opcode opc, uint8_t *cmd_buff,
 	case CFA_MPC_EM_CHAIN:
 		return compose_mpc_em_chain_msg(cmd_buff, cmd_buff_len, parms);
 	default:
-		ASSERT_RETURN(-ENOTSUP);
+		LOG_RC(-ENOTSUP);
 		return -ENOTSUP;
 	}
 
@@ -572,17 +572,17 @@ static int parse_mpc_read_clr_result(uint8_t *resp_buff, uint32_t resp_buff_len,
 					      sizeof(struct mpc_header));
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (result->data_len < rd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (!result->rd_data) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -622,17 +622,17 @@ static int parse_mpc_read_result(uint8_t *resp_buff, uint32_t resp_buff_len,
 					  sizeof(struct mpc_header));
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (result->data_len < rd_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
 	if (!result->rd_data) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -671,7 +671,7 @@ static int parse_mpc_write_result(uint8_t *resp_buff, uint32_t resp_buff_len,
 					   sizeof(struct mpc_header));
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -696,7 +696,7 @@ static int parse_mpc_evict_result(uint8_t *resp_buff, uint32_t resp_buff_len,
 						sizeof(struct mpc_header));
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -728,7 +728,7 @@ int cfa_mpc_parse_cache_axs_resp(enum cfa_mpc_opcode opc, uint8_t *resp_buff,
 				 struct cfa_mpc_cache_axs_result *result)
 {
 	if (!resp_buff || resp_buff_len == 0 || !result) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -743,7 +743,7 @@ int cfa_mpc_parse_cache_axs_resp(enum cfa_mpc_opcode opc, uint8_t *resp_buff,
 	case CFA_MPC_INVALIDATE:
 		return parse_mpc_evict_result(resp_buff, resp_buff_len, result);
 	default:
-		ASSERT_RETURN(-ENOTSUP);
+		LOG_RC(-ENOTSUP);
 		return -ENOTSUP;
 	}
 }
@@ -762,7 +762,7 @@ static int parse_mpc_em_search_result(uint8_t *resp_buff,
 		    sizeof(struct cfa_mpc_em_search_cmp);
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -794,7 +794,7 @@ static int parse_mpc_em_insert_result(uint8_t *resp_buff,
 		    sizeof(struct cfa_mpc_em_insert_cmp);
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -828,7 +828,7 @@ static int parse_mpc_em_delete_result(uint8_t *resp_buff,
 		    sizeof(struct cfa_mpc_em_delete_cmp);
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -859,7 +859,7 @@ static int parse_mpc_em_chain_result(uint8_t *resp_buff, uint32_t resp_buff_len,
 		sizeof(struct mpc_header) + sizeof(struct cfa_mpc_em_chain_cmp);
 
 	if (resp_buff_len < resp_size) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -894,7 +894,7 @@ int cfa_mpc_parse_em_op_resp(enum cfa_mpc_opcode opc, uint8_t *resp_buff,
 			     struct cfa_mpc_em_op_result *result)
 {
 	if (!resp_buff || resp_buff_len == 0 || !result) {
-		ASSERT_RETURN(-EINVAL);
+		LOG_RC(-EINVAL);
 		return -EINVAL;
 	}
 
@@ -912,7 +912,7 @@ int cfa_mpc_parse_em_op_resp(enum cfa_mpc_opcode opc, uint8_t *resp_buff,
 		return parse_mpc_em_chain_result(resp_buff, resp_buff_len,
 						 result);
 	default:
-		ASSERT_RETURN(-ENOTSUP);
+		LOG_RC(-ENOTSUP);
 		return -ENOTSUP;
 	}
 }
drivers/net/bnxt/hcapi/cfa_v3/bld/p70/host/cfa_bld_p70_host_mpc_wrapper.c +75 -75

579 lines not on this page · raw message

Signature · 1 line
2.39.5 (Apple Git-154)
#7 lore raw

PATCH 7/11 net/bnxt: address coverity checked return issues

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

This change addresses the CID 449056: Error handling issues (CHECKED_RETURN) reported by coverity. The changes add return code handling to address the issue.

Coverity issue: 449056

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     | 10 +++++++---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c |  8 +++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +7 -3
index 2429ac2f1a..1a68cf5dfd 100644
@@ -3612,9 +3612,13 @@ ulp_mapper_func_cond_list_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	}
 	/* write the value into result */
-	ulp_operand_read(val, res_local + res_size -
-			 ULP_BITS_2_BYTE_NR(oper_size),
-			 ULP_BITS_2_BYTE_NR(val_len));
+	if (unlikely(ulp_operand_read(val, res_local + res_size -
+				      ULP_BITS_2_BYTE_NR(oper_size),
+				      ULP_BITS_2_BYTE_NR(val_len)))) {
+		BNXT_DRV_DBG(ERR,
+			     "field idx operand read failed\n");
+		return -EINVAL;
+	}
 
 	/* convert the data to cpu format */
 	*res = tfp_be_to_cpu_64(*res);
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +7 -1
index dd5985cd7b..bf3a3deb18 100644
@@ -517,7 +517,13 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,
 		else
 			svif_type = BNXT_ULP_DRV_FUNC_SVIF;
 	}
-	ulp_port_db_svif_get(params->ulp_ctx, ifindex, svif_type, &svif);
+
+	if (ulp_port_db_svif_get(params->ulp_ctx, ifindex,
+				 svif_type, &svif)) {
+			BNXT_DRV_DBG(ERR, "ParseErr:ifindex is not valid\n");
+			return BNXT_TF_RC_ERROR;
+	}
+
 	svif = rte_cpu_to_be_16(svif);
 	mask = rte_cpu_to_be_16(mask);
 	hdr_field = &params->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX];
Signature · 1 line
2.39.5 (Apple Git-154)
#8 lore raw

PATCH 8/11 net/bnxt: address coverity overflow issues

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

This change addresses the CID 449058: Integer handling issues (OVERFLOW_BEFORE_WIDEN) reported by coverity.

Coverity issue: 449058

---
 drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c +1 -1
index 1770069295..c29933b803 100644
@@ -468,7 +468,7 @@ static int alloc_link_pbl(struct tfc_ts_mem_cfg *mem_cfg, uint32_t page_size,
 	 * and page tables. The allocation will occur once only per backing
 	 * store and will located by name and reused on subsequent runs.
 	 */
-	total_size = page_size * total_pages;
+	total_size = (uint64_t)page_size * (uint64_t)total_pages;
 
 	if (total_size <= (1024 * 256))
 		mz_size = RTE_MEMZONE_256KB;
Signature · 1 line
2.39.5 (Apple Git-154)
#9 lore raw

PATCH 9/11 net/bnxt: address coverity integer overflow issues

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

This change addresses the CID 449059: Integer handling issues (INTEGER_OVERFLOW) reported by coverity.

Coverity issue: 449059

---
 drivers/net/bnxt/hcapi/cfa_v3/mm/cfa_mm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bnxt/hcapi/cfa_v3/mm/cfa_mm.c +5 -1
index 61fafadb20..05528dd3e4 100644
@@ -123,7 +123,11 @@ int cfa_mm_open(void *cmm, struct cfa_mm_open_parms *parms)
 	}
 
 	for (i = 0; i < num_blocks; i++) {
-		context->blk_tbl[i].prev_blk_idx = i - 1;
+		if (i == 0)
+			context->blk_tbl[i].prev_blk_idx = CFA_MM_INVALID32;
+		else
+			context->blk_tbl[i].prev_blk_idx = i - 1;
+
 		context->blk_tbl[i].next_blk_idx = i + 1;
 		context->blk_tbl[i].num_free_records = records_per_block;
 		context->blk_tbl[i].first_free_record = 0;
Signature · 1 line
2.39.5 (Apple Git-154)
#10 lore raw

PATCH 10/11 net/bnxt: address coverity uninitialized variables issues

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

This change addresses the CID 449065: Uninitialized variables (UNINIT) issues reported by coverity.

Coverity issue: 449065

---
 drivers/net/bnxt/tf_core/v3/tfc_em.c | 1 +
 drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 1 +
 2 files changed, 2 insertions(+)
drivers/net/bnxt/tf_core/v3/tfc_em.c +1 -0
index a70e35b6b1..d460ff2ee0 100644
@@ -560,6 +560,7 @@ int tfc_em_delete_raw(struct tfc *tfcp,
 	mpc_msg_out.cmp_type = CMPL_BASE_TYPE_MID_PATH_LONG;
 	mpc_msg_out.msg_data = &rx_msg[TFC_MPC_HEADER_SIZE_BYTES];
 	mpc_msg_out.msg_size = TFC_MPC_MAX_RX_BYTES;
+	mpc_msg_out.chnl_id = 0;
 
 	rc = tfc_mpc_send(tfcp->bp,
 			  &mpc_msg_in,
drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c +1 -0
index 5fa8e240db..57cbaaf09c 100644
@@ -224,6 +224,7 @@ static uint32_t ulp_stats_cache_main_loop(void *arg)
 			if (bnxt_ulp_cntxt_acquire_fdb_lock(ctxt))
 				break;
 
+			batch_info.enabled = false;
 			rc = tfc_mpc_batch_start(&batch_info);
 			if (unlikely(rc)) {
 				PMD_DRV_LOG_LINE(ERR,
Signature · 1 line
2.39.5 (Apple Git-154)
#11 lore raw

PATCH 11/11 net/bnxt: address coverity control flow issues

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

This change addresses the CID 449072: Control flow issues (DEADCODE) reported by coverity.

Coverity issue: 449072

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_utils.h +1 -1
index 5e0d906fbd..e6f316539c 100644
@@ -1084,7 +1084,7 @@ bnxt_ulp_cap_feat_process(uint64_t feat_bits, uint64_t *out_bits)
 
 	if (bit & BNXT_ULP_FEATURE_BIT_PARENT_DMAC)
 		BNXT_DRV_DBG(ERR, "Parent Mac Address Feature is enabled\n");
-	if (bit & BNXT_ULP_FEATURE_BIT_PORT_DMAC)
+	else if (bit & BNXT_ULP_FEATURE_BIT_PORT_DMAC)
 		BNXT_DRV_DBG(ERR, "Port Mac Address Feature is enabled\n");
 	if (bit & BNXT_ULP_FEATURE_BIT_MULTI_TUNNEL_FLOW)
 		BNXT_DRV_DBG(ERR, "Multi Tunnel Flow Feature is enabled\n");
Signature · 1 line
2.39.5 (Apple Git-154)
#12 lore raw
In reply to Ajit Khaparde
Quoted 6 lines · Ajit Khaparde

Patchset with bug fixes for bnxt PMD.
Also addresses various Coverity issues reported in the recent Coverity scan.

Please apply.

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

Quoted 36 lines

Ajit Khaparde (4):
net/bnxt: disable TruFlow if compressed CQE is set net/bnxt: simplify check for CQE mode net/bnxt: fix Rx handler
net/bnxt: fix burst handler initialization

Peter Spreadborough (6):
net/bnxt: address coverity deadcode issue net/bnxt: address coverity checked return issues net/bnxt: address coverity overflow issues net/bnxt: address coverity integer overflow issues net/bnxt: address coverity uninitialized variables issues net/bnxt: address coverity control flow issues

Sangtani Parag Satishbhai (1):
net/bnxt/truFlow: Fix seg fault when rep are re-attached

 drivers/net/bnxt/bnxt.h                       |   4 -
 drivers/net/bnxt/bnxt_ethdev.c                |  31 ++--
 drivers/net/bnxt/bnxt_hwrm.c                  |   2 +-
 drivers/net/bnxt/bnxt_rxr.c                   |  16 +-
 .../hcapi/cfa_v3/bld/p70/cfa_bld_p70_mpc.c    |  90 +++++------
 .../p70/host/cfa_bld_p70_host_mpc_wrapper.c   | 150 +++++++++---------
 drivers/net/bnxt/hcapi/cfa_v3/mm/cfa_mm.c     |   6 +-
 drivers/net/bnxt/tf_core/v3/tfc_em.c          |   1 +
 drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c   |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_utils.h      |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  10 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   8 +-
 drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c          |   1 +
 13 files changed, 174 insertions(+), 149 deletions(-)

--
2.39.5 (Apple Git-154)