Skip to contentSkip to conversation

bnxt patchset

PATCH In review Ajit Khaparde 2 participants 18 messages May 18, 2018 – May 22, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt patchset

Patchset against dpdk-next.
Contains fixes mostly. Please apply.

Ajit Khaparde (7):
net/bnxt: add fallthrough comments for cascading switch cases net/bnxt: fix to initialize tx and rx burst for secondary processes net/bnxt: fix rss hash configuration
net/bnxt: fix to use 1st completion ring for forwarding and async
events
net/bnxt: fix VF resource allocation
net/bnxt: fix xstats support for VF
net/bnxt: fix Rx checksum flags

 drivers/net/bnxt/bnxt.h        |   1 +
 drivers/net/bnxt/bnxt_cpr.c    |  85 ++++++++++------------------------
 drivers/net/bnxt/bnxt_cpr.h    |   5 +-
 drivers/net/bnxt/bnxt_ethdev.c |  54 +++++++++++-----------
 drivers/net/bnxt/bnxt_hwrm.c   | 102 +++++++++++++++++++++++++++++++++++++----
 drivers/net/bnxt/bnxt_hwrm.h   |   3 ++
 drivers/net/bnxt/bnxt_irq.c    |  28 ++---------
 drivers/net/bnxt/bnxt_ring.c   |  45 ++++++++++++------
 drivers/net/bnxt/bnxt_ring.h   |   1 +
 drivers/net/bnxt/bnxt_rxq.c    |   1 +
 drivers/net/bnxt/bnxt_rxr.c    |  21 +++++++--
 drivers/net/bnxt/bnxt_rxr.h    |   6 +++
 drivers/net/bnxt/bnxt_stats.c  |   5 --
 drivers/net/bnxt/bnxt_vnic.c   |   2 +
 drivers/net/bnxt/bnxt_vnic.h   |   1 +
 15 files changed, 215 insertions(+), 145 deletions(-)
Signature · 1 line
2.15.1 (Apple Git-101)
#1 lore raw

PATCH 1/7 net/bnxt: add fallthrough comments for cascading switch cases

The FALLTHROUGH comment for cascading switch cases was missing in a few places. This patch adds that.

---
 drivers/net/bnxt/bnxt_cpr.c    | 1 +
 drivers/net/bnxt/bnxt_ethdev.c | 3 +++
 drivers/net/bnxt/bnxt_hwrm.c   | 4 ++++
 drivers/net/bnxt/bnxt_rxq.c    | 1 +
 4 files changed, 9 insertions(+)
drivers/net/bnxt/bnxt_cpr.c +1 -0
index 8dde8cc0f..7b4f9a14b 100644
@@ -27,6 +27,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
+		/* FALLTHROUGH */
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
drivers/net/bnxt/bnxt_ethdev.c +3 -0
index 9edcc7b7d..f7f23f75a 100644
@@ -2432,6 +2432,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
 	switch (filter_op) {
 	case RTE_ETH_FILTER_ADD:
 	case RTE_ETH_FILTER_DELETE:
+		/* FALLTHROUGH */
 		filter = bnxt_get_unused_filter(bp);
 		if (filter == NULL) {
 			PMD_DRV_LOG(ERR,
@@ -2897,6 +2898,7 @@ static bool bnxt_dir_type_is_ape_bin_format(uint16_t dir_type)
 	case BNX_DIR_TYPE_KONG_PATCH:
 	case BNX_DIR_TYPE_BONO_FW:
 	case BNX_DIR_TYPE_BONO_PATCH:
+		/* FALLTHROUGH */
 		return true;
 	}
 
@@ -2915,6 +2917,7 @@ static bool bnxt_dir_type_is_other_exec_format(uint16_t dir_type)
 	case BNX_DIR_TYPE_ISCSI_BOOT:
 	case BNX_DIR_TYPE_ISCSI_BOOT_IPV6:
 	case BNX_DIR_TYPE_ISCSI_BOOT_IPV4N6:
+		/* FALLTHROUGH */
 		return true;
 	}
 
drivers/net/bnxt/bnxt_hwrm.c +4 -0
index d975cb87d..28aa7476d 100644
@@ -2002,6 +2002,7 @@ static uint16_t bnxt_parse_eth_link_duplex(uint32_t conf_link_speed)
 	switch (conf_link_speed) {
 	case ETH_LINK_SPEED_10M_HD:
 	case ETH_LINK_SPEED_100M_HD:
+		/* FALLTHROUGH */
 		return HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF;
 	}
 	return hw_link_duplex;
@@ -2022,6 +2023,7 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed)
 	switch (conf_link_speed & ~ETH_LINK_SPEED_FIXED) {
 	case ETH_LINK_SPEED_100M:
 	case ETH_LINK_SPEED_100M_HD:
+		/* FALLTHROUGH */
 		eth_link_speed =
 			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB;
 		break;
@@ -2186,6 +2188,7 @@ static uint16_t bnxt_parse_hw_link_duplex(uint16_t hw_link_duplex)
 	switch (hw_link_duplex) {
 	case HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH:
 	case HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL:
+		/* FALLTHROUGH */
 		eth_link_duplex = ETH_LINK_FULL_DUPLEX;
 		break;
 	case HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF:
@@ -2315,6 +2318,7 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0:
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5:
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR2_0:
+		/* FALLTHROUGH */
 		bp->port_partition_type = resp->port_partition_type;
 		break;
 	default:
drivers/net/bnxt/bnxt_rxq.c +1 -0
index 866fb56b1..c55ddec4b 100644
@@ -77,6 +77,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		switch (dev_conf->rxmode.mq_mode) {
 		case ETH_MQ_RX_VMDQ_RSS:
 		case ETH_MQ_RX_VMDQ_ONLY:
+			/* FALLTHROUGH */
 			/* ETH_8/64_POOLs */
 			pools = conf->nb_queue_pools;
 			/* For each pool, allocate MACVLAN CFA rule & VNIC */
Signature · 1 line
2.15.1 (Apple Git-101)
#2 lore raw

PATCH 2/7 net/bnxt: fix to initialize tx and rx burst for secondary processes

In reply to Ajit Khaparde

We were initializing Tx and Rx burst functions only for primary processes. Fixing it in this patch.

---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +2 -2
index f7f23f75a..af141d453 100644
@@ -3151,10 +3151,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	}
 skip_init:
 	eth_dev->dev_ops = &bnxt_dev_ops;
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
 	eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
 	eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
 
 	if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
 		snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
Signature · 1 line
2.15.1 (Apple Git-101)
#3 lore raw

PATCH 3/7 net/bnxt: fix rss hash configuration

In reply to Ajit Khaparde

While configuring RSS, the FW needs to know the rss_hash_mode that needs to be initialized.
Set hash mode to HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT to allow the FW to use the global mode already configured in the device.

Fixes bcd4bcc4426f ("net/bnxt: configure RSS")
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 drivers/net/bnxt/bnxt_vnic.c | 2 ++
 drivers/net/bnxt/bnxt_vnic.h | 1 +
 3 files changed, 4 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
index 28aa7476d..b285761eb 100644
@@ -1462,6 +1462,7 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 	HWRM_PREP(req, VNIC_RSS_CFG);
 
 	req.hash_type = rte_cpu_to_le_32(vnic->hash_type);
+	req.hash_mode_flags = vnic->hash_mode;
 
 	req.ring_grp_tbl_addr =
 	    rte_cpu_to_le_64(vnic->rss_table_dma_addr);
drivers/net/bnxt/bnxt_vnic.c +2 -0
index 733a5a92c..19d06af55 100644
@@ -49,6 +49,8 @@ void bnxt_init_vnics(struct bnxt *bp)
 		vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE;
 		vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE;
 		vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE;
+		vnic->hash_mode =
+			HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT;
 
 		for (j = 0; j < MAX_QUEUES_PER_VNIC; j++)
 			vnic->fw_grp_ids[j] = (uint16_t)HWRM_NA_SIGNATURE;
drivers/net/bnxt/bnxt_vnic.h +1 -0
index c60bb543c..c521d7e5a 100644
@@ -25,6 +25,7 @@ struct bnxt_vnic_info {
 	uint16_t	dflt_ring_grp;
 	uint16_t	mru;
 	uint16_t	hash_type;
+	uint8_t		hash_mode;
 	rte_iova_t	rss_table_dma_addr;
 	uint16_t	*rss_table;
 	rte_iova_t	rss_hash_key_dma_addr;
Signature · 1 line
2.15.1 (Apple Git-101)
#4 lore raw

PATCH 4/7 net/bnxt: fix to use 1st completion ring for forwarding and async events

In reply to Ajit Khaparde

In order to save completion resource, use the first completion ring from PF or VF as the default completion ring for async event & HWRM forward response handling. Add bnxt_hwrm_set_async_event_cr() to set async_event_cr for either PF or VF.

Fixes 7bc8e9a227cc ("net/bnxt: support async link notification")
---
 drivers/net/bnxt/bnxt_cpr.c    | 84 ++++++++++++------------------------------
 drivers/net/bnxt/bnxt_cpr.h    |  5 +--
 drivers/net/bnxt/bnxt_ethdev.c | 20 +---------
 drivers/net/bnxt/bnxt_hwrm.c   | 19 ++++++++--
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 drivers/net/bnxt/bnxt_irq.c    | 28 +++-----------
 drivers/net/bnxt/bnxt_ring.c   | 45 +++++++++++++++-------
 drivers/net/bnxt/bnxt_rxr.c    | 17 +++++++--
 8 files changed, 91 insertions(+), 128 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +23 -61
index 7b4f9a14b..ff20b6fdf 100644
@@ -132,69 +132,31 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	return;
 }
 
-/* For the default completion ring only */
-int bnxt_alloc_def_cp_ring(struct bnxt *bp)
+int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
 {
-	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
-	struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
-	int rc;
-
-	rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-				  HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-				  0, HWRM_NA_SIGNATURE,
-				  HWRM_NA_SIGNATURE);
-	if (rc)
-		goto err_out;
-	cpr->cp_doorbell = (char *)bp->doorbell_base;
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
-	if (BNXT_PF(bp))
-		rc = bnxt_hwrm_func_cfg_def_cp(bp);
-	else
-		rc = bnxt_hwrm_vf_func_cfg_def_cp(bp);
-
-err_out:
-	return rc;
-}
+	bool evt = 0;
 
-void bnxt_free_def_cp_ring(struct bnxt *bp)
-{
-	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
-
-	if (cpr == NULL)
-		return;
+	if (bp == NULL || cmp == NULL) {
+		PMD_DRV_LOG(ERR, "invalid NULL argument\n");
+		return evt;
+	}
 
-	bnxt_free_ring(cpr->cp_ring_struct);
-	cpr->cp_ring_struct = NULL;
-	rte_free(cpr->cp_ring_struct);
-	rte_free(cpr);
-	bp->def_cp_ring = NULL;
-}
+	switch (CMP_TYPE(cmp)) {
+	case CMPL_BASE_TYPE_HWRM_ASYNC_EVENT:
+		/* Handle any async event */
+		bnxt_handle_async_event(bp, cmp);
+		evt = 1;
+		break;
+	case CMPL_BASE_TYPE_HWRM_FWD_RESP:
+		/* Handle HWRM forwarded responses */
+		bnxt_handle_fwd_req(bp, cmp);
+		evt = 1;
+		break;
+	default:
+		/* Ignore any other events */
+		PMD_DRV_LOG(INFO, "Ignoring %02x completion\n", CMP_TYPE(cmp));
+		break;
+	}
 
-/* For the default completion ring only */
-int bnxt_init_def_ring_struct(struct bnxt *bp, unsigned int socket_id)
-{
-	struct bnxt_cp_ring_info *cpr;
-	struct bnxt_ring *ring;
-
-	cpr = rte_zmalloc_socket("cpr",
-				 sizeof(struct bnxt_cp_ring_info),
-				 RTE_CACHE_LINE_SIZE, socket_id);
-	if (cpr == NULL)
-		return -ENOMEM;
-	bp->def_cp_ring = cpr;
-
-	ring = rte_zmalloc_socket("bnxt_cp_ring_struct",
-				  sizeof(struct bnxt_ring),
-				  RTE_CACHE_LINE_SIZE, socket_id);
-	if (ring == NULL)
-		return -ENOMEM;
-	cpr->cp_ring_struct = ring;
-	ring->bd = (void *)cpr->cp_desc_ring;
-	ring->bd_dma = cpr->cp_desc_mapping;
-	ring->ring_size = rte_align32pow2(DEFAULT_CP_RING_SIZE);
-	ring->ring_mask = ring->ring_size - 1;
-	ring->vmem_size = 0;
-	ring->vmem = NULL;
-
-	return 0;
+	return evt;
 }
drivers/net/bnxt/bnxt_cpr.h +1 -4
index 6091404f1..6c1e6d2b0 100644
@@ -72,12 +72,9 @@ struct bnxt_cp_ring_info {
 #define RX_CMP_L2_ERRORS						\
 	(RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK | RX_PKT_CMPL_ERRORS_CRC_ERROR)
 
-
 struct bnxt;
-int bnxt_alloc_def_cp_ring(struct bnxt *bp);
-void bnxt_free_def_cp_ring(struct bnxt *bp);
-int bnxt_init_def_ring_struct(struct bnxt *bp, unsigned int socket_id);
 void bnxt_handle_async_event(struct bnxt *bp, struct cmpl_base *cmp);
 void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmp);
+int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp);
 
 #endif
drivers/net/bnxt/bnxt_ethdev.c +2 -18
index af141d453..0aba9a3fc 100644
@@ -168,23 +168,12 @@ static void bnxt_free_mem(struct bnxt *bp)
 	bnxt_free_stats(bp);
 	bnxt_free_tx_rings(bp);
 	bnxt_free_rx_rings(bp);
-	bnxt_free_def_cp_ring(bp);
 }
 
 static int bnxt_alloc_mem(struct bnxt *bp)
 {
 	int rc;
 
-	/* Default completion ring */
-	rc = bnxt_init_def_ring_struct(bp, SOCKET_ID_ANY);
-	if (rc)
-		goto alloc_mem_err;
-
-	rc = bnxt_alloc_rings(bp, 0, NULL, NULL,
-			      bp->def_cp_ring, "def_cp");
-	if (rc)
-		goto alloc_mem_err;
-
 	rc = bnxt_alloc_vnic_mem(bp);
 	if (rc)
 		goto alloc_mem_err;
@@ -509,11 +498,11 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	/* Inherit new configurations */
 	if (eth_dev->data->nb_rx_queues > bp->max_rx_rings ||
 	    eth_dev->data->nb_tx_queues > bp->max_tx_rings ||
-	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues + 1 >
+	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
 	    bp->max_cp_rings ||
 	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
 	    bp->max_stat_ctx ||
-	    (uint32_t)(eth_dev->data->nb_rx_queues + 1) > bp->max_ring_grps) {
+	    (uint32_t)(eth_dev->data->nb_rx_queues) > bp->max_ring_grps) {
 		PMD_DRV_LOG(ERR,
 			"Insufficient resources to support requested config\n");
 		PMD_DRV_LOG(ERR,
@@ -3383,10 +3372,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto error_free_int;
 
-	rc = bnxt_alloc_def_cp_ring(bp);
-	if (rc)
-		goto error_free_int;
-
 	bnxt_enable_int(bp);
 	bnxt_init_nic(bp);
 
@@ -3394,7 +3379,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 
 error_free_int:
 	bnxt_disable_int(bp);
-	bnxt_free_def_cp_ring(bp);
 	bnxt_hwrm_func_buf_unrgtr(bp);
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp);
drivers/net/bnxt/bnxt_hwrm.c +15 -4
index b285761eb..bf847a828 100644
@@ -1766,7 +1766,7 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
 		struct bnxt_tx_ring_info *txr = txq->tx_ring;
 		struct bnxt_ring *ring = txr->tx_ring_struct;
 		struct bnxt_cp_ring_info *cpr = txq->cp_ring;
-		unsigned int idx = bp->rx_cp_nr_rings + i + 1;
+		unsigned int idx = bp->rx_cp_nr_rings + i;
 
 		if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 			bnxt_hwrm_ring_free(bp, ring,
@@ -1792,13 +1792,12 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
 		struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
 		struct bnxt_ring *ring = rxr->rx_ring_struct;
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
-		unsigned int idx = i + 1;
 
 		if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 			bnxt_hwrm_ring_free(bp, ring,
 					HWRM_RING_FREE_INPUT_RING_TYPE_RX);
 			ring->fw_ring_id = INVALID_HW_RING_ID;
-			bp->grp_info[idx].rx_fw_ring_id = INVALID_HW_RING_ID;
+			bp->grp_info[i].rx_fw_ring_id = INVALID_HW_RING_ID;
 			memset(rxr->rx_desc_ring, 0,
 					rxr->rx_ring_struct->ring_size *
 					sizeof(*rxr->rx_desc_ring));
@@ -1819,7 +1818,7 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
 			bp->grp_info[i].ag_fw_ring_id = INVALID_HW_RING_ID;
 		}
 		if (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {
-			bnxt_free_cp_ring(bp, cpr, idx);
+			bnxt_free_cp_ring(bp, cpr, i);
 			bp->grp_info[i].cp_fw_ring_id = INVALID_HW_RING_ID;
 			cpr->cp_ring_struct->fw_ring_id = INVALID_HW_RING_ID;
 		}
@@ -2933,6 +2932,18 @@ int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf)
 	return rc;
 }
 
+int bnxt_hwrm_set_async_event_cr(struct bnxt *bp)
+{
+	int rc;
+
+	if (BNXT_PF(bp))
+		rc = bnxt_hwrm_func_cfg_def_cp(bp);
+	else
+		rc = bnxt_hwrm_vf_func_cfg_def_cp(bp);
+
+	return rc;
+}
+
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size)
 {
drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 7c161eea0..4813c7fb6 100644
@@ -63,6 +63,7 @@ int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp);
 
 int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
 
+int bnxt_hwrm_set_async_event_cr(struct bnxt *bp);
 int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 			 struct bnxt_ring *ring,
 			 uint32_t ring_type, uint32_t map_index,
drivers/net/bnxt/bnxt_irq.c +5 -23
index fd05f66af..7ef7023eb 100644
@@ -40,30 +40,10 @@ static void bnxt_int_handler(void *param)
 		if (!CMP_VALID(cmp, raw_cons, cpr->cp_ring_struct))
 			break;
 
-		switch (CMP_TYPE(cmp)) {
-		case CMPL_BASE_TYPE_HWRM_ASYNC_EVENT:
-			/* Handle any async event */
-			bnxt_handle_async_event(bp, cmp);
-			break;
-		case CMPL_BASE_TYPE_HWRM_FWD_REQ:
-			/* Handle HWRM forwarded responses */
-			bnxt_handle_fwd_req(bp, cmp);
-			break;
-		default:
-			/* Ignore any other events */
-			if (cmp->type & rte_cpu_to_le_16(0x01)) {
-				if (!CMP_VALID(cmp, raw_cons,
-					       cpr->cp_ring_struct))
-					goto no_more;
-			}
-			PMD_DRV_LOG(INFO,
-				"Ignoring %02x completion\n", CMP_TYPE(cmp));
-			break;
-		}
+		bnxt_event_hwrm_resp_handler(bp, cmp);
 		raw_cons = NEXT_RAW_CMP(raw_cons);
-
 	};
-no_more:
+
 	cpr->cp_raw_cons = raw_cons;
 	B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
 }
@@ -99,7 +79,9 @@ void bnxt_enable_int(struct bnxt *bp)
 {
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 
-	B_CP_DB_ARM(cpr);
+	/* Only the default completion ring */
+	if (cpr != NULL && cpr->cp_doorbell != NULL)
+		B_CP_DB_ARM(cpr);
 }
 
 int bnxt_setup_int(struct bnxt *bp)
drivers/net/bnxt/bnxt_ring.c +31 -14

76 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.c +13 -4
index 6eeb93b7b..a8b5d6683 100644
@@ -534,6 +534,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	uint16_t prod = rxr->rx_prod;
 	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
+	bool evt = false;
 
 	/* If Rx Q was stopped return */
 	if (rxq->rx_deferred_start)
@@ -558,14 +559,19 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				nb_rx_pkts++;
 			if (rc == -EBUSY)	/* partial completion */
 				break;
+		} else {
+			evt =
+			bnxt_event_hwrm_resp_handler(rxq->bp,
+						     (struct cmpl_base *)rxcmp);
 		}
+
 		raw_cons = NEXT_RAW_CMP(raw_cons);
-		if (nb_rx_pkts == nb_pkts)
+		if (nb_rx_pkts == nb_pkts || evt)
 			break;
 	}
 
 	cpr->cp_raw_cons = raw_cons;
-	if (prod == rxr->rx_prod && ag_prod == rxr->ag_prod) {
+	if ((prod == rxr->rx_prod && ag_prod == rxr->ag_prod) && !evt) {
 		/*
 		 * For PMD, there is no need to keep on pushing to REARM
 		 * the doorbell if there are no new completions
@@ -574,9 +580,12 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	}
 
 	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
-	B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+	if (prod != rxr->rx_prod)
+		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+
 	/* Ring the AGG ring DB */
-	B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+	if (ag_prod != rxr->ag_prod)
+		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
Signature · 1 line
2.15.1 (Apple Git-101)
#5 lore raw

PATCH 5/7 net/bnxt: fix VF resource allocation

In reply to Ajit Khaparde

If the resource requirement of a VF is more than what is allotted to it by the FW, a VF can request to reallocate some of the resources.

This is possible only when the NIC is running the Resource Manager aware CHiMP FW.

If necessary, calculate Tx and Rx ring count using the new RM API. Otherwise use the Tx and Rx ring count as-is. Update the cp ring count based on the Tx and Rx ring count.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++---
 drivers/net/bnxt/bnxt_hwrm.c   | 75 +++++++++++++++++++++++++++++++++++++++++-
 drivers/net/bnxt/bnxt_hwrm.h   |  2 ++
 drivers/net/bnxt/bnxt_ring.h   |  1 +
 5 files changed, 98 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index a93fbf533..afaaf8c41 100644
@@ -220,6 +220,7 @@ struct bnxt {
 #define BNXT_FLAG_UPDATE_HASH	(1 << 5)
 #define BNXT_FLAG_PTP_SUPPORTED	(1 << 6)
 #define BNXT_FLAG_MULTI_HOST    (1 << 7)
+#define BNXT_FLAG_NEW_RM	(1 << 30)
 #define BNXT_FLAG_INIT_DONE	(1 << 31)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
drivers/net/bnxt/bnxt_ethdev.c +20 -5
index 0aba9a3fc..62e02aa8a 100644
@@ -406,9 +406,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	/* PF/VF specifics */
 	if (BNXT_PF(bp))
 		dev_info->max_vfs = bp->pdev->max_vfs;
-	max_rx_rings = RTE_MIN(bp->max_vnics, RTE_MIN(bp->max_l2_ctx,
-						RTE_MIN(bp->max_rsscos_ctx,
-						bp->max_stat_ctx)));
+	max_rx_rings = RTE_MIN(bp->max_vnics, bp->max_stat_ctx);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
 	dev_info->max_tx_queues = max_rx_rings;
@@ -494,6 +492,25 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
+	bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
+	bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
+
+	if (BNXT_VF(bp) && (bp->flags & BNXT_FLAG_NEW_RM)) {
+		int rc;
+
+		rc = bnxt_hwrm_func_reserve_vf_resc(bp);
+		if (rc) {
+			PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc);
+			return -ENOSPC;
+		}
+
+		/* legacy driver needs to get updated values */
+		rc = bnxt_hwrm_func_qcaps(bp);
+		if (rc) {
+			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
+			return -ENOSPC;
+		}
+	}
 
 	/* Inherit new configurations */
 	if (eth_dev->data->nb_rx_queues > bp->max_rx_rings ||
@@ -516,8 +533,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		return -ENOSPC;
 	}
 
-	bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
-	bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
 	bp->rx_cp_nr_rings = bp->rx_nr_rings;
 	bp->tx_cp_nr_rings = bp->tx_nr_rings;
 
drivers/net/bnxt/bnxt_hwrm.c +74 -1

99 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 4813c7fb6..60a4ab16a 100644
@@ -111,6 +111,8 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp);
 int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link);
 int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up);
 int bnxt_hwrm_func_qcfg(struct bnxt *bp);
+int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp);
+int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp);
 int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
 int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
drivers/net/bnxt/bnxt_ring.h +1 -0
index 6c86259e8..65bf3e2f5 100644
@@ -28,6 +28,7 @@
 
 #define BNXT_TPA_MAX		64
 #define AGG_RING_SIZE_FACTOR	2
+#define AGG_RING_MULTIPLIER	2
 
 /* These assume 4k pages */
 #define MAX_RX_DESC_CNT (8 * 1024)
Signature · 1 line
2.15.1 (Apple Git-101)
#6 lore raw

PATCH 6/7 net/bnxt: fix xstats support for VF

In reply to Ajit Khaparde

Query of port stats is permitted for VF interfaces as well. Fix the code to allow VFs to query port stats.

Fixes bfb9c2260be2 ("net/bnxt: support xstats get/reset")
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 3 ---
 drivers/net/bnxt/bnxt_stats.c  | 5 -----
 3 files changed, 1 insertion(+), 9 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 62e02aa8a..6e56bfd36 100644
@@ -3160,7 +3160,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
+	if (pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
 		snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
 			 "bnxt_%04x:%02x:%02x:%02x-%s", pci_dev->addr.domain,
 			 pci_dev->addr.bus, pci_dev->addr.devid,
drivers/net/bnxt/bnxt_hwrm.c +0 -3
index ba4ef1676..d6fdc1b88 100644
@@ -3131,9 +3131,6 @@ int bnxt_hwrm_port_qstats(struct bnxt *bp)
 	struct bnxt_pf_info *pf = &bp->pf;
 	int rc;
 
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
-		return 0;
-
 	HWRM_PREP(req, PORT_QSTATS);
 
 	req.port_id = rte_cpu_to_le_16(pf->port_id);
drivers/net/bnxt/bnxt_stats.c +0 -5
index 0797896a6..bbd4e78b7 100644
@@ -266,11 +266,6 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	unsigned int count, i;
 	uint64_t tx_drop_pkts;
 
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
-		PMD_DRV_LOG(ERR, "xstats not supported for VF\n");
-		return 0;
-	}
-
 	bnxt_hwrm_port_qstats(bp);
 	bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, &tx_drop_pkts);
 
Signature · 1 line
2.15.1 (Apple Git-101)
#7 lore raw

PATCH 7/7 net/bnxt: fix Rx checksum flags

In reply to Ajit Khaparde

For frames where the hardware is not able to calculate checksum we are indicating such frames to be bad. And that is incorrect. Indicate PKT_RX_IP_CKSUM_UNKNOWN or PKT_RX_L4_CKSUM_UNKNOWN for such frames.

Fixes 7ec39d8c524b ("net/bnxt: update status of Rx IP/L4 CKSUM")
---
 drivers/net/bnxt/bnxt_rxr.c | 4 ++++
 drivers/net/bnxt/bnxt_rxr.h | 6 ++++++
 2 files changed, 10 insertions(+)
drivers/net/bnxt/bnxt_rxr.c +4 -0
index a8b5d6683..9d8842926 100644
@@ -464,11 +464,15 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 
 	if (likely(RX_CMP_IP_CS_OK(rxcmp1)))
 		mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+	else if (likely(RX_CMP_IP_CS_UNKNOWN(rxcmp1)))
+		mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
 	else
 		mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
 
 	if (likely(RX_CMP_L4_CS_OK(rxcmp1)))
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
+	else if (likely(RX_CMP_L4_CS_UNKNOWN(rxcmp1)))
+		mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
 	else
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
 
drivers/net/bnxt/bnxt_rxr.h +6 -0
index e8c47ca56..5b28f0321 100644
@@ -36,6 +36,9 @@
 	    (((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS) &&		\
 	     !((rxcmp1)->errors_v2 & RX_CMP_L4_CS_ERR_BITS))
 
+#define RX_CMP_L4_CS_UNKNOWN(rxcmp1)					\
+	    !((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS)
+
 #define RX_CMP_IP_CS_ERR_BITS	\
 	rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR | \
 			 RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR)
@@ -48,6 +51,9 @@
 		(((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS) &&	\
 		!((rxcmp1)->errors_v2 & RX_CMP_IP_CS_ERR_BITS))
 
+#define RX_CMP_IP_CS_UNKNOWN(rxcmp1)					\
+		!((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)
+
 enum pkt_hash_types {
 	PKT_HASH_TYPE_NONE,	/* Undefined type */
 	PKT_HASH_TYPE_L2,	/* Input: src_MAC, dest_MAC */
Signature · 1 line
2.15.1 (Apple Git-101)
#8 lore raw
In reply to Ajit Khaparde
Quoted 12 lines · Ajit Khaparde

Patchset against dpdk-next.
Contains fixes mostly. Please apply.

Ajit Khaparde (7):
net/bnxt: add fallthrough comments for cascading switch cases net/bnxt: fix to initialize tx and rx burst for secondary processes net/bnxt: fix rss hash configuration
net/bnxt: fix to use 1st completion ring for forwarding and async
events
net/bnxt: fix VF resource allocation
net/bnxt: fix xstats support for VF
net/bnxt: fix Rx checksum flags

Hi Ajit,

Can you please send a new version with ./devtools/check-git-log.sh checks fixed:

$ ./devtools/check-git-log.sh -7
Wrong headline lowercase:
        net/bnxt: fix to initialize tx and rx burst for secondary processes
        net/bnxt: fix rss hash configuration
Headline too long:
        net/bnxt: add fallthrough comments for cascading switch cases
        net/bnxt: fix to initialize tx and rx burst for secondary processes
        net/bnxt: fix to use 1st completion ring for forwarding and async events
Missing 'Fixes' tag:
        net/bnxt: fix to initialize tx and rx burst for secondary processes
Is it candidate for Cc: [email protected] backport?
        net/bnxt: fix rss hash configuration
        net/bnxt: fix to use 1st completion ring for forwarding and async events
        net/bnxt: fix VF resource allocation
        net/bnxt: fix xstats support for VF
#9 lore raw

v2 cover bnxt patchset

Patchset contains fixes mostly; against dpdk-next-net. Please apply.

v1->v2: updated commit log, messages as requested.

Ajit Khaparde (7):
net/bnxt: add fallthrough comment
net/bnxt: fix Tx and Rx burst for secondary processes net/bnxt: fix RSS hash configuration
net/bnxt: fix to use 1st cmpl ring for fwd and async event net/bnxt: fix VF resource allocation
net/bnxt: fix xstats support for VF
net/bnxt: fix Rx checksum flags

 drivers/net/bnxt/bnxt.h        |   1 +
 drivers/net/bnxt/bnxt_cpr.c    |  85 ++++++++++------------------------
 drivers/net/bnxt/bnxt_cpr.h    |   5 +-
 drivers/net/bnxt/bnxt_ethdev.c |  54 +++++++++++-----------
 drivers/net/bnxt/bnxt_hwrm.c   | 102 +++++++++++++++++++++++++++++++++++++----
 drivers/net/bnxt/bnxt_hwrm.h   |   3 ++
 drivers/net/bnxt/bnxt_irq.c    |  28 ++---------
 drivers/net/bnxt/bnxt_ring.c   |  45 ++++++++++++------
 drivers/net/bnxt/bnxt_ring.h   |   1 +
 drivers/net/bnxt/bnxt_rxq.c    |   1 +
 drivers/net/bnxt/bnxt_rxr.c    |  21 +++++++--
 drivers/net/bnxt/bnxt_rxr.h    |   6 +++
 drivers/net/bnxt/bnxt_stats.c  |   5 --
 drivers/net/bnxt/bnxt_vnic.c   |   2 +
 drivers/net/bnxt/bnxt_vnic.h   |   1 +
 15 files changed, 215 insertions(+), 145 deletions(-)
Signature · 1 line
2.15.1 (Apple Git-101)
#10 lore raw

PATCH v2 1/7 net/bnxt: add fallthrough comment

The FALLTHROUGH comment for cascading switch cases was missing in a few places. This patch adds that.

--
v1->v2: fix long headline

---
 drivers/net/bnxt/bnxt_cpr.c    | 1 +
 drivers/net/bnxt/bnxt_ethdev.c | 3 +++
 drivers/net/bnxt/bnxt_hwrm.c   | 4 ++++
 drivers/net/bnxt/bnxt_rxq.c    | 1 +
 4 files changed, 9 insertions(+)
drivers/net/bnxt/bnxt_cpr.c +1 -0
index 8dde8cc0f..7b4f9a14b 100644
@@ -27,6 +27,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
+		/* FALLTHROUGH */
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
drivers/net/bnxt/bnxt_ethdev.c +3 -0
index 9edcc7b7d..f7f23f75a 100644
@@ -2432,6 +2432,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
 	switch (filter_op) {
 	case RTE_ETH_FILTER_ADD:
 	case RTE_ETH_FILTER_DELETE:
+		/* FALLTHROUGH */
 		filter = bnxt_get_unused_filter(bp);
 		if (filter == NULL) {
 			PMD_DRV_LOG(ERR,
@@ -2897,6 +2898,7 @@ static bool bnxt_dir_type_is_ape_bin_format(uint16_t dir_type)
 	case BNX_DIR_TYPE_KONG_PATCH:
 	case BNX_DIR_TYPE_BONO_FW:
 	case BNX_DIR_TYPE_BONO_PATCH:
+		/* FALLTHROUGH */
 		return true;
 	}
 
@@ -2915,6 +2917,7 @@ static bool bnxt_dir_type_is_other_exec_format(uint16_t dir_type)
 	case BNX_DIR_TYPE_ISCSI_BOOT:
 	case BNX_DIR_TYPE_ISCSI_BOOT_IPV6:
 	case BNX_DIR_TYPE_ISCSI_BOOT_IPV4N6:
+		/* FALLTHROUGH */
 		return true;
 	}
 
drivers/net/bnxt/bnxt_hwrm.c +4 -0
index d975cb87d..28aa7476d 100644
@@ -2002,6 +2002,7 @@ static uint16_t bnxt_parse_eth_link_duplex(uint32_t conf_link_speed)
 	switch (conf_link_speed) {
 	case ETH_LINK_SPEED_10M_HD:
 	case ETH_LINK_SPEED_100M_HD:
+		/* FALLTHROUGH */
 		return HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF;
 	}
 	return hw_link_duplex;
@@ -2022,6 +2023,7 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed)
 	switch (conf_link_speed & ~ETH_LINK_SPEED_FIXED) {
 	case ETH_LINK_SPEED_100M:
 	case ETH_LINK_SPEED_100M_HD:
+		/* FALLTHROUGH */
 		eth_link_speed =
 			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB;
 		break;
@@ -2186,6 +2188,7 @@ static uint16_t bnxt_parse_hw_link_duplex(uint16_t hw_link_duplex)
 	switch (hw_link_duplex) {
 	case HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH:
 	case HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL:
+		/* FALLTHROUGH */
 		eth_link_duplex = ETH_LINK_FULL_DUPLEX;
 		break;
 	case HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF:
@@ -2315,6 +2318,7 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0:
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5:
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR2_0:
+		/* FALLTHROUGH */
 		bp->port_partition_type = resp->port_partition_type;
 		break;
 	default:
drivers/net/bnxt/bnxt_rxq.c +1 -0
index 866fb56b1..c55ddec4b 100644
@@ -77,6 +77,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		switch (dev_conf->rxmode.mq_mode) {
 		case ETH_MQ_RX_VMDQ_RSS:
 		case ETH_MQ_RX_VMDQ_ONLY:
+			/* FALLTHROUGH */
 			/* ETH_8/64_POOLs */
 			pools = conf->nb_queue_pools;
 			/* For each pool, allocate MACVLAN CFA rule & VNIC */
Signature · 1 line
2.15.1 (Apple Git-101)
#11 lore raw

PATCH v2 2/7 net/bnxt: fix Tx and Rx burst for secondary processes

In reply to Ajit Khaparde

We were initializing Tx and Rx burst functions only for primary processes. Fixing it in this patch.

Fixes 88920136688c ("net/bnxt: support xstats get by id")

--
v1->v2: shorten and update commit log and message.

---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +2 -2
index f7f23f75a..af141d453 100644
@@ -3151,10 +3151,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	}
 skip_init:
 	eth_dev->dev_ops = &bnxt_dev_ops;
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
 	eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
 	eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
 
 	if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
 		snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
Signature · 1 line
2.15.1 (Apple Git-101)
#12 lore raw

PATCH v2 3/7 net/bnxt: fix RSS hash configuration

In reply to Ajit Khaparde

While configuring RSS, the FW needs to know the rss_hash_mode that needs to be initialized.
Set hash mode to HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT to allow the FW to use the global mode already configured in the device.

Fixes bcd4bcc4426f ("net/bnxt: configure RSS")

--
v1->v2: update commit log and message

---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 drivers/net/bnxt/bnxt_vnic.c | 2 ++
 drivers/net/bnxt/bnxt_vnic.h | 1 +
 3 files changed, 4 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
index 28aa7476d..b285761eb 100644
@@ -1462,6 +1462,7 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 	HWRM_PREP(req, VNIC_RSS_CFG);
 
 	req.hash_type = rte_cpu_to_le_32(vnic->hash_type);
+	req.hash_mode_flags = vnic->hash_mode;
 
 	req.ring_grp_tbl_addr =
 	    rte_cpu_to_le_64(vnic->rss_table_dma_addr);
drivers/net/bnxt/bnxt_vnic.c +2 -0
index 733a5a92c..19d06af55 100644
@@ -49,6 +49,8 @@ void bnxt_init_vnics(struct bnxt *bp)
 		vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE;
 		vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE;
 		vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE;
+		vnic->hash_mode =
+			HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT;
 
 		for (j = 0; j < MAX_QUEUES_PER_VNIC; j++)
 			vnic->fw_grp_ids[j] = (uint16_t)HWRM_NA_SIGNATURE;
drivers/net/bnxt/bnxt_vnic.h +1 -0
index c60bb543c..c521d7e5a 100644
@@ -25,6 +25,7 @@ struct bnxt_vnic_info {
 	uint16_t	dflt_ring_grp;
 	uint16_t	mru;
 	uint16_t	hash_type;
+	uint8_t		hash_mode;
 	rte_iova_t	rss_table_dma_addr;
 	uint16_t	*rss_table;
 	rte_iova_t	rss_hash_key_dma_addr;
Signature · 1 line
2.15.1 (Apple Git-101)
#13 lore raw

PATCH v2 4/7 net/bnxt: fix to use 1st cmpl ring for fwd and async event

In reply to Ajit Khaparde

In order to save completion resource, use the first completion ring from PF or VF as the default completion ring for async event & HWRM forward response handling. Add bnxt_hwrm_set_async_event_cr() to set async_event_cr for either PF or VF.

Fixes 7bc8e9a227cc ("net/bnxt: support async link notification")

--
v1->v2: shorten headline

---
 drivers/net/bnxt/bnxt_cpr.c    | 84 ++++++++++++------------------------------
 drivers/net/bnxt/bnxt_cpr.h    |  5 +--
 drivers/net/bnxt/bnxt_ethdev.c | 20 +---------
 drivers/net/bnxt/bnxt_hwrm.c   | 19 ++++++++--
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 drivers/net/bnxt/bnxt_irq.c    | 28 +++-----------
 drivers/net/bnxt/bnxt_ring.c   | 45 +++++++++++++++-------
 drivers/net/bnxt/bnxt_rxr.c    | 17 +++++++--
 8 files changed, 91 insertions(+), 128 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +23 -61
index 7b4f9a14b..ff20b6fdf 100644
@@ -132,69 +132,31 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	return;
 }
 
-/* For the default completion ring only */
-int bnxt_alloc_def_cp_ring(struct bnxt *bp)
+int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
 {
-	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
-	struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
-	int rc;
-
-	rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-				  HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-				  0, HWRM_NA_SIGNATURE,
-				  HWRM_NA_SIGNATURE);
-	if (rc)
-		goto err_out;
-	cpr->cp_doorbell = (char *)bp->doorbell_base;
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
-	if (BNXT_PF(bp))
-		rc = bnxt_hwrm_func_cfg_def_cp(bp);
-	else
-		rc = bnxt_hwrm_vf_func_cfg_def_cp(bp);
-
-err_out:
-	return rc;
-}
+	bool evt = 0;
 
-void bnxt_free_def_cp_ring(struct bnxt *bp)
-{
-	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
-
-	if (cpr == NULL)
-		return;
+	if (bp == NULL || cmp == NULL) {
+		PMD_DRV_LOG(ERR, "invalid NULL argument\n");
+		return evt;
+	}
 
-	bnxt_free_ring(cpr->cp_ring_struct);
-	cpr->cp_ring_struct = NULL;
-	rte_free(cpr->cp_ring_struct);
-	rte_free(cpr);
-	bp->def_cp_ring = NULL;
-}
+	switch (CMP_TYPE(cmp)) {
+	case CMPL_BASE_TYPE_HWRM_ASYNC_EVENT:
+		/* Handle any async event */
+		bnxt_handle_async_event(bp, cmp);
+		evt = 1;
+		break;
+	case CMPL_BASE_TYPE_HWRM_FWD_RESP:
+		/* Handle HWRM forwarded responses */
+		bnxt_handle_fwd_req(bp, cmp);
+		evt = 1;
+		break;
+	default:
+		/* Ignore any other events */
+		PMD_DRV_LOG(INFO, "Ignoring %02x completion\n", CMP_TYPE(cmp));
+		break;
+	}
 
-/* For the default completion ring only */
-int bnxt_init_def_ring_struct(struct bnxt *bp, unsigned int socket_id)
-{
-	struct bnxt_cp_ring_info *cpr;
-	struct bnxt_ring *ring;
-
-	cpr = rte_zmalloc_socket("cpr",
-				 sizeof(struct bnxt_cp_ring_info),
-				 RTE_CACHE_LINE_SIZE, socket_id);
-	if (cpr == NULL)
-		return -ENOMEM;
-	bp->def_cp_ring = cpr;
-
-	ring = rte_zmalloc_socket("bnxt_cp_ring_struct",
-				  sizeof(struct bnxt_ring),
-				  RTE_CACHE_LINE_SIZE, socket_id);
-	if (ring == NULL)
-		return -ENOMEM;
-	cpr->cp_ring_struct = ring;
-	ring->bd = (void *)cpr->cp_desc_ring;
-	ring->bd_dma = cpr->cp_desc_mapping;
-	ring->ring_size = rte_align32pow2(DEFAULT_CP_RING_SIZE);
-	ring->ring_mask = ring->ring_size - 1;
-	ring->vmem_size = 0;
-	ring->vmem = NULL;
-
-	return 0;
+	return evt;
 }
drivers/net/bnxt/bnxt_cpr.h +1 -4
index 6091404f1..6c1e6d2b0 100644
@@ -72,12 +72,9 @@ struct bnxt_cp_ring_info {
 #define RX_CMP_L2_ERRORS						\
 	(RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK | RX_PKT_CMPL_ERRORS_CRC_ERROR)
 
-
 struct bnxt;
-int bnxt_alloc_def_cp_ring(struct bnxt *bp);
-void bnxt_free_def_cp_ring(struct bnxt *bp);
-int bnxt_init_def_ring_struct(struct bnxt *bp, unsigned int socket_id);
 void bnxt_handle_async_event(struct bnxt *bp, struct cmpl_base *cmp);
 void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmp);
+int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp);
 
 #endif
drivers/net/bnxt/bnxt_ethdev.c +2 -18
index af141d453..0aba9a3fc 100644
@@ -168,23 +168,12 @@ static void bnxt_free_mem(struct bnxt *bp)
 	bnxt_free_stats(bp);
 	bnxt_free_tx_rings(bp);
 	bnxt_free_rx_rings(bp);
-	bnxt_free_def_cp_ring(bp);
 }
 
 static int bnxt_alloc_mem(struct bnxt *bp)
 {
 	int rc;
 
-	/* Default completion ring */
-	rc = bnxt_init_def_ring_struct(bp, SOCKET_ID_ANY);
-	if (rc)
-		goto alloc_mem_err;
-
-	rc = bnxt_alloc_rings(bp, 0, NULL, NULL,
-			      bp->def_cp_ring, "def_cp");
-	if (rc)
-		goto alloc_mem_err;
-
 	rc = bnxt_alloc_vnic_mem(bp);
 	if (rc)
 		goto alloc_mem_err;
@@ -509,11 +498,11 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	/* Inherit new configurations */
 	if (eth_dev->data->nb_rx_queues > bp->max_rx_rings ||
 	    eth_dev->data->nb_tx_queues > bp->max_tx_rings ||
-	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues + 1 >
+	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
 	    bp->max_cp_rings ||
 	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
 	    bp->max_stat_ctx ||
-	    (uint32_t)(eth_dev->data->nb_rx_queues + 1) > bp->max_ring_grps) {
+	    (uint32_t)(eth_dev->data->nb_rx_queues) > bp->max_ring_grps) {
 		PMD_DRV_LOG(ERR,
 			"Insufficient resources to support requested config\n");
 		PMD_DRV_LOG(ERR,
@@ -3383,10 +3372,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto error_free_int;
 
-	rc = bnxt_alloc_def_cp_ring(bp);
-	if (rc)
-		goto error_free_int;
-
 	bnxt_enable_int(bp);
 	bnxt_init_nic(bp);
 
@@ -3394,7 +3379,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 
 error_free_int:
 	bnxt_disable_int(bp);
-	bnxt_free_def_cp_ring(bp);
 	bnxt_hwrm_func_buf_unrgtr(bp);
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp);
drivers/net/bnxt/bnxt_hwrm.c +15 -4
index b285761eb..bf847a828 100644
@@ -1766,7 +1766,7 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
 		struct bnxt_tx_ring_info *txr = txq->tx_ring;
 		struct bnxt_ring *ring = txr->tx_ring_struct;
 		struct bnxt_cp_ring_info *cpr = txq->cp_ring;
-		unsigned int idx = bp->rx_cp_nr_rings + i + 1;
+		unsigned int idx = bp->rx_cp_nr_rings + i;
 
 		if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 			bnxt_hwrm_ring_free(bp, ring,
@@ -1792,13 +1792,12 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
 		struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
 		struct bnxt_ring *ring = rxr->rx_ring_struct;
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
-		unsigned int idx = i + 1;
 
 		if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 			bnxt_hwrm_ring_free(bp, ring,
 					HWRM_RING_FREE_INPUT_RING_TYPE_RX);
 			ring->fw_ring_id = INVALID_HW_RING_ID;
-			bp->grp_info[idx].rx_fw_ring_id = INVALID_HW_RING_ID;
+			bp->grp_info[i].rx_fw_ring_id = INVALID_HW_RING_ID;
 			memset(rxr->rx_desc_ring, 0,
 					rxr->rx_ring_struct->ring_size *
 					sizeof(*rxr->rx_desc_ring));
@@ -1819,7 +1818,7 @@ int bnxt_free_all_hwrm_rings(struct bnxt *bp)
 			bp->grp_info[i].ag_fw_ring_id = INVALID_HW_RING_ID;
 		}
 		if (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {
-			bnxt_free_cp_ring(bp, cpr, idx);
+			bnxt_free_cp_ring(bp, cpr, i);
 			bp->grp_info[i].cp_fw_ring_id = INVALID_HW_RING_ID;
 			cpr->cp_ring_struct->fw_ring_id = INVALID_HW_RING_ID;
 		}
@@ -2933,6 +2932,18 @@ int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf)
 	return rc;
 }
 
+int bnxt_hwrm_set_async_event_cr(struct bnxt *bp)
+{
+	int rc;
+
+	if (BNXT_PF(bp))
+		rc = bnxt_hwrm_func_cfg_def_cp(bp);
+	else
+		rc = bnxt_hwrm_vf_func_cfg_def_cp(bp);
+
+	return rc;
+}
+
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size)
 {
drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 7c161eea0..4813c7fb6 100644
@@ -63,6 +63,7 @@ int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp);
 
 int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
 
+int bnxt_hwrm_set_async_event_cr(struct bnxt *bp);
 int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 			 struct bnxt_ring *ring,
 			 uint32_t ring_type, uint32_t map_index,
drivers/net/bnxt/bnxt_irq.c +5 -23
index fd05f66af..7ef7023eb 100644
@@ -40,30 +40,10 @@ static void bnxt_int_handler(void *param)
 		if (!CMP_VALID(cmp, raw_cons, cpr->cp_ring_struct))
 			break;
 
-		switch (CMP_TYPE(cmp)) {
-		case CMPL_BASE_TYPE_HWRM_ASYNC_EVENT:
-			/* Handle any async event */
-			bnxt_handle_async_event(bp, cmp);
-			break;
-		case CMPL_BASE_TYPE_HWRM_FWD_REQ:
-			/* Handle HWRM forwarded responses */
-			bnxt_handle_fwd_req(bp, cmp);
-			break;
-		default:
-			/* Ignore any other events */
-			if (cmp->type & rte_cpu_to_le_16(0x01)) {
-				if (!CMP_VALID(cmp, raw_cons,
-					       cpr->cp_ring_struct))
-					goto no_more;
-			}
-			PMD_DRV_LOG(INFO,
-				"Ignoring %02x completion\n", CMP_TYPE(cmp));
-			break;
-		}
+		bnxt_event_hwrm_resp_handler(bp, cmp);
 		raw_cons = NEXT_RAW_CMP(raw_cons);
-
 	};
-no_more:
+
 	cpr->cp_raw_cons = raw_cons;
 	B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
 }
@@ -99,7 +79,9 @@ void bnxt_enable_int(struct bnxt *bp)
 {
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 
-	B_CP_DB_ARM(cpr);
+	/* Only the default completion ring */
+	if (cpr != NULL && cpr->cp_doorbell != NULL)
+		B_CP_DB_ARM(cpr);
 }
 
 int bnxt_setup_int(struct bnxt *bp)
drivers/net/bnxt/bnxt_ring.c +31 -14

76 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.c +13 -4
index 6eeb93b7b..a8b5d6683 100644
@@ -534,6 +534,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	uint16_t prod = rxr->rx_prod;
 	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
+	bool evt = false;
 
 	/* If Rx Q was stopped return */
 	if (rxq->rx_deferred_start)
@@ -558,14 +559,19 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				nb_rx_pkts++;
 			if (rc == -EBUSY)	/* partial completion */
 				break;
+		} else {
+			evt =
+			bnxt_event_hwrm_resp_handler(rxq->bp,
+						     (struct cmpl_base *)rxcmp);
 		}
+
 		raw_cons = NEXT_RAW_CMP(raw_cons);
-		if (nb_rx_pkts == nb_pkts)
+		if (nb_rx_pkts == nb_pkts || evt)
 			break;
 	}
 
 	cpr->cp_raw_cons = raw_cons;
-	if (prod == rxr->rx_prod && ag_prod == rxr->ag_prod) {
+	if ((prod == rxr->rx_prod && ag_prod == rxr->ag_prod) && !evt) {
 		/*
 		 * For PMD, there is no need to keep on pushing to REARM
 		 * the doorbell if there are no new completions
@@ -574,9 +580,12 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	}
 
 	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
-	B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+	if (prod != rxr->rx_prod)
+		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
+
 	/* Ring the AGG ring DB */
-	B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
+	if (ag_prod != rxr->ag_prod)
+		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
Signature · 1 line
2.15.1 (Apple Git-101)
#14 lore raw

PATCH v2 5/7 net/bnxt: fix VF resource allocation

In reply to Ajit Khaparde

If the resource requirement of a VF is more than what is allotted to it by the FW, a VF can request to reallocate some of the resources.

This is possible only when the NIC is running the Resource Manager aware CHiMP FW.

If necessary, calculate Tx and Rx ring count using the new RM API. Otherwise use the Tx and Rx ring count as-is. Update the cp ring count based on the Tx and Rx ring count.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++---
 drivers/net/bnxt/bnxt_hwrm.c   | 75 +++++++++++++++++++++++++++++++++++++++++-
 drivers/net/bnxt/bnxt_hwrm.h   |  2 ++
 drivers/net/bnxt/bnxt_ring.h   |  1 +
 5 files changed, 98 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index a93fbf533..afaaf8c41 100644
@@ -220,6 +220,7 @@ struct bnxt {
 #define BNXT_FLAG_UPDATE_HASH	(1 << 5)
 #define BNXT_FLAG_PTP_SUPPORTED	(1 << 6)
 #define BNXT_FLAG_MULTI_HOST    (1 << 7)
+#define BNXT_FLAG_NEW_RM	(1 << 30)
 #define BNXT_FLAG_INIT_DONE	(1 << 31)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
drivers/net/bnxt/bnxt_ethdev.c +20 -5
index 0aba9a3fc..62e02aa8a 100644
@@ -406,9 +406,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	/* PF/VF specifics */
 	if (BNXT_PF(bp))
 		dev_info->max_vfs = bp->pdev->max_vfs;
-	max_rx_rings = RTE_MIN(bp->max_vnics, RTE_MIN(bp->max_l2_ctx,
-						RTE_MIN(bp->max_rsscos_ctx,
-						bp->max_stat_ctx)));
+	max_rx_rings = RTE_MIN(bp->max_vnics, bp->max_stat_ctx);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
 	dev_info->max_tx_queues = max_rx_rings;
@@ -494,6 +492,25 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
+	bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
+	bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
+
+	if (BNXT_VF(bp) && (bp->flags & BNXT_FLAG_NEW_RM)) {
+		int rc;
+
+		rc = bnxt_hwrm_func_reserve_vf_resc(bp);
+		if (rc) {
+			PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc);
+			return -ENOSPC;
+		}
+
+		/* legacy driver needs to get updated values */
+		rc = bnxt_hwrm_func_qcaps(bp);
+		if (rc) {
+			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
+			return -ENOSPC;
+		}
+	}
 
 	/* Inherit new configurations */
 	if (eth_dev->data->nb_rx_queues > bp->max_rx_rings ||
@@ -516,8 +533,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		return -ENOSPC;
 	}
 
-	bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
-	bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
 	bp->rx_cp_nr_rings = bp->rx_nr_rings;
 	bp->tx_cp_nr_rings = bp->tx_nr_rings;
 
drivers/net/bnxt/bnxt_hwrm.c +74 -1

99 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 4813c7fb6..60a4ab16a 100644
@@ -111,6 +111,8 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp);
 int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link);
 int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up);
 int bnxt_hwrm_func_qcfg(struct bnxt *bp);
+int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp);
+int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp);
 int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
 int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
drivers/net/bnxt/bnxt_ring.h +1 -0
index 6c86259e8..65bf3e2f5 100644
@@ -28,6 +28,7 @@
 
 #define BNXT_TPA_MAX		64
 #define AGG_RING_SIZE_FACTOR	2
+#define AGG_RING_MULTIPLIER	2
 
 /* These assume 4k pages */
 #define MAX_RX_DESC_CNT (8 * 1024)
Signature · 1 line
2.15.1 (Apple Git-101)
#15 lore raw

PATCH v2 6/7 net/bnxt: fix xstats support for VF

In reply to Ajit Khaparde

Query of port stats is permitted for VF interfaces as well. Fix the code to allow VFs to query port stats.

Fixes bfb9c2260be2 ("net/bnxt: support xstats get/reset")

--
v1->v2: add [email protected] for backport

---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 3 ---
 drivers/net/bnxt/bnxt_stats.c  | 5 -----
 3 files changed, 1 insertion(+), 9 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 62e02aa8a..6e56bfd36 100644
@@ -3160,7 +3160,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
+	if (pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) {
 		snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
 			 "bnxt_%04x:%02x:%02x:%02x-%s", pci_dev->addr.domain,
 			 pci_dev->addr.bus, pci_dev->addr.devid,
drivers/net/bnxt/bnxt_hwrm.c +0 -3
index ba4ef1676..d6fdc1b88 100644
@@ -3131,9 +3131,6 @@ int bnxt_hwrm_port_qstats(struct bnxt *bp)
 	struct bnxt_pf_info *pf = &bp->pf;
 	int rc;
 
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
-		return 0;
-
 	HWRM_PREP(req, PORT_QSTATS);
 
 	req.port_id = rte_cpu_to_le_16(pf->port_id);
drivers/net/bnxt/bnxt_stats.c +0 -5
index 0797896a6..bbd4e78b7 100644
@@ -266,11 +266,6 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	unsigned int count, i;
 	uint64_t tx_drop_pkts;
 
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
-		PMD_DRV_LOG(ERR, "xstats not supported for VF\n");
-		return 0;
-	}
-
 	bnxt_hwrm_port_qstats(bp);
 	bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, &tx_drop_pkts);
 
Signature · 1 line
2.15.1 (Apple Git-101)
#16 lore raw

PATCH v2 7/7 net/bnxt: fix Rx checksum flags

In reply to Ajit Khaparde

For frames where the hardware is not able to calculate checksum we are indicating such frames to be bad. And that is incorrect. Indicate PKT_RX_IP_CKSUM_UNKNOWN or PKT_RX_L4_CKSUM_UNKNOWN for such frames.

Fixes 7ec39d8c524b ("net/bnxt: update status of Rx IP/L4 CKSUM")
---
 drivers/net/bnxt/bnxt_rxr.c | 4 ++++
 drivers/net/bnxt/bnxt_rxr.h | 6 ++++++
 2 files changed, 10 insertions(+)
drivers/net/bnxt/bnxt_rxr.c +4 -0
index a8b5d6683..9d8842926 100644
@@ -464,11 +464,15 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 
 	if (likely(RX_CMP_IP_CS_OK(rxcmp1)))
 		mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+	else if (likely(RX_CMP_IP_CS_UNKNOWN(rxcmp1)))
+		mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
 	else
 		mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
 
 	if (likely(RX_CMP_L4_CS_OK(rxcmp1)))
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
+	else if (likely(RX_CMP_L4_CS_UNKNOWN(rxcmp1)))
+		mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
 	else
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
 
drivers/net/bnxt/bnxt_rxr.h +6 -0
index e8c47ca56..5b28f0321 100644
@@ -36,6 +36,9 @@
 	    (((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS) &&		\
 	     !((rxcmp1)->errors_v2 & RX_CMP_L4_CS_ERR_BITS))
 
+#define RX_CMP_L4_CS_UNKNOWN(rxcmp1)					\
+	    !((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS)
+
 #define RX_CMP_IP_CS_ERR_BITS	\
 	rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR | \
 			 RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR)
@@ -48,6 +51,9 @@
 		(((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS) &&	\
 		!((rxcmp1)->errors_v2 & RX_CMP_IP_CS_ERR_BITS))
 
+#define RX_CMP_IP_CS_UNKNOWN(rxcmp1)					\
+		!((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)
+
 enum pkt_hash_types {
 	PKT_HASH_TYPE_NONE,	/* Undefined type */
 	PKT_HASH_TYPE_L2,	/* Input: src_MAC, dest_MAC */
Signature · 1 line
2.15.1 (Apple Git-101)
#17 lore raw
In reply to Ajit Khaparde
Quoted 5 lines · Ajit Khaparde

Patchset contains fixes mostly; against dpdk-next-net. Please apply.

v1->v2: updated commit log, messages as requested.

Quoted 8 lines

Ajit Khaparde (7):
net/bnxt: add fallthrough comment
net/bnxt: fix Tx and Rx burst for secondary processes net/bnxt: fix RSS hash configuration
net/bnxt: fix to use 1st cmpl ring for fwd and async event net/bnxt: fix VF resource allocation
net/bnxt: fix xstats support for VF
net/bnxt: fix Rx checksum flags

Series applied to dpdk-next-net/master, thanks.