Skip to contentSkip to conversation

bnxt patchset

PATCH In review Ajit Khaparde 2 participants 31 messages Jan 22, 2018 – Jan 26, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt patchset

Please consider applying this patchset.

Ajit Khaparde (4):
net/bnxt: fix size of tx ring in HW
net/bnxt: use driver specific dynamic log type
net/bnxt: register for more async events
net/bnxt: check if MAC address is all zeros

Somnath Kotur (1):
net/bnxt: Support for rx/tx_queue_start/stop ops

 drivers/net/bnxt/bnxt.h         |   8 +
 drivers/net/bnxt/bnxt_cpr.c     |  19 ++-
 drivers/net/bnxt/bnxt_ethdev.c  | 356 ++++++++++++++++++++++++----------------
 drivers/net/bnxt/bnxt_filter.c  |  44 ++---
 drivers/net/bnxt/bnxt_filter.h  |   1 +
 drivers/net/bnxt/bnxt_hwrm.c    | 151 ++++++++---------
 drivers/net/bnxt/bnxt_hwrm.h    |  11 ++
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +-
 drivers/net/bnxt/bnxt_rxq.c     |  22 +--
 drivers/net/bnxt/bnxt_rxq.h     |   2 +-
 drivers/net/bnxt/bnxt_rxr.c     |  23 +--
 drivers/net/bnxt/bnxt_rxr.h     |   3 +-
 drivers/net/bnxt/bnxt_stats.c   |  16 +-
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_txq.h     |   1 -
 drivers/net/bnxt/bnxt_txr.c     |  34 +++-
 drivers/net/bnxt/bnxt_txr.h     |   2 +
 drivers/net/bnxt/bnxt_vnic.c    |  14 +-
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 +++---
 20 files changed, 464 insertions(+), 317 deletions(-)
Signature · 1 line
2.14.3 (Apple Git-98)
#1 lore raw

PATCH 1/5 net/bnxt: fix size of tx ring in HW

During Tx ring allocation, the actual ring size configured in the HW ends up being twice the number of txd parameter specified to the driver. The power of 2 ring size wrongly adds a +1 while sending the ring create command to the FW.

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_txr.c +1 -1
index ac77434b7..2f2c87119 100644
@@ -101,7 +101,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	txr->tx_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
+	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)txr->tx_desc_ring;
 	ring->bd_dma = txr->tx_desc_mapping;
Signature · 1 line
2.14.3 (Apple Git-98)
#2 lore raw

Re: [PATCH 1/5] net/bnxt: fix size of tx ring in HW

Quoted 6 lines · Ajit Khaparde

During Tx ring allocation, the actual ring size configured in the HW ends up being twice the number of txd parameter specified to the driver. The power of 2 ring size wrongly adds a +1 while sending the ring create command to the FW.

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")

If you request this fix to be backported to the stable trees, please add following line in commit log just below "Fixes:" line:
Cc: [email protected]

Quoted 19 lines
---
 drivers/net/bnxt/bnxt_txr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_txr.c +1 -1
index ac77434b7..2f2c87119 100644
@@ -101,7 +101,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	txr->tx_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
+	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)txr->tx_desc_ring;
 	ring->bd_dma = txr->tx_desc_mapping;
#3 lore raw

PATCH 2/5 net/bnxt: use driver specific dynamic log type

In reply to Ajit Khaparde

This patch implements driver specific log type doing away with usage of RTE_LOG() for logging.

---
 drivers/net/bnxt/bnxt.h         |   8 ++
 drivers/net/bnxt/bnxt_cpr.c     |  10 +-
 drivers/net/bnxt/bnxt_ethdev.c  | 233 +++++++++++++++++++++-------------------
 drivers/net/bnxt/bnxt_filter.c  |  42 ++++----
 drivers/net/bnxt/bnxt_hwrm.c    | 142 ++++++++++++------------
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +--
 drivers/net/bnxt/bnxt_rxq.c     |  22 ++--
 drivers/net/bnxt/bnxt_rxr.c     |  19 ++--
 drivers/net/bnxt/bnxt_stats.c   |  16 +--
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_vnic.c    |  14 +--
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 ++++-----
 13 files changed, 297 insertions(+), 283 deletions(-)
drivers/net/bnxt/bnxt.h +8 -0
index cf0b1d27c..6776c64a5 100644
@@ -334,4 +334,12 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 bool is_bnxt_supported(struct rte_eth_dev *dev);
 extern const struct rte_flow_ops bnxt_flow_ops;
+
+extern int bnxt_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
+		__func__, ## args)
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt, ## args)
 #endif
drivers/net/bnxt/bnxt_cpr.c +5 -5
index cde8adc3b..663a5223d 100644
@@ -58,7 +58,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
 	default:
-		RTE_LOG(DEBUG, PMD, "handle_async_event id = 0x%x\n", event_id);
+		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
 		break;
 	}
 }
@@ -74,7 +74,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	int rc;
 
 	if (bp->pf.active_vfs <= 0) {
-		RTE_LOG(ERR, PMD, "Forwarded VF with no active VFs\n");
+		PMD_DRV_LOG(ERR, "Forwarded VF with no active VFs\n");
 		return;
 	}
 
@@ -93,7 +93,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 
 	if (fw_vf_id < bp->pf.first_vf_id ||
 	    fw_vf_id >= (bp->pf.first_vf_id) + bp->pf.active_vfs) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 		"FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)\n",
 			fw_vf_id, bp->pf.first_vf_id,
 			(bp->pf.first_vf_id) + bp->pf.active_vfs - 1,
@@ -130,7 +130,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 		if (rc) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 				"Failed to send FWD req VF 0x%x, type 0x%x.\n",
 				fw_vf_id - bp->pf.first_vf_id,
 				rte_le_to_cpu_16(fwd_cmd->req_type));
@@ -141,7 +141,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 reject:
 	rc = bnxt_hwrm_reject_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 	if (rc) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Failed to send REJECT req VF 0x%x, type 0x%x.\n",
 			fw_vf_id - bp->pf.first_vf_id,
 			rte_le_to_cpu_16(fwd_cmd->req_type));
drivers/net/bnxt/bnxt_ethdev.c +122 -111

828 lines not on this page · raw message

drivers/net/bnxt/bnxt_filter.c +21 -21

158 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +69 -73

492 lines not on this page · raw message

drivers/net/bnxt/bnxt_irq.c +2 -2
index 49436cfd9..8ab986936 100644
@@ -84,7 +84,7 @@ static void bnxt_int_handler(void *param)
 					       cpr->cp_ring_struct))
 					goto no_more;
 			}
-			RTE_LOG(INFO, PMD,
+			PMD_DRV_LOG(INFO,
 				"Ignoring %02x completion\n", CMP_TYPE(cmp));
 			break;
 		}
@@ -154,7 +154,7 @@ int bnxt_setup_int(struct bnxt *bp)
 	return 0;
 
 setup_exit:
-	RTE_LOG(ERR, PMD, "bnxt_irq_tbl setup failed\n");
+	PMD_DRV_LOG(ERR, "bnxt_irq_tbl setup failed\n");
 	return rc;
 }
 
drivers/net/bnxt/bnxt_ring.c +6 -6
index 59d1035fd..8fb897216 100644
@@ -176,15 +176,15 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	memset(mz->addr, 0, mz->len);
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Memzone physical address same as virtual.\n");
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Using rte_mem_virt2iova()\n");
 		for (sz = 0; sz < total_alloc_len; sz += getpagesize())
 			rte_mem_lock_page(((char *)mz->addr) + sz);
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 			"unable to map ring address to physical memory\n");
 			return -ENOMEM;
 		}
@@ -326,7 +326,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		ring = rxr->ag_ring_struct;
 		/* Agg ring */
 		if (ring == NULL) {
-			RTE_LOG(ERR, PMD, "Alloc AGG Ring is NULL!\n");
+			PMD_DRV_LOG(ERR, "Alloc AGG Ring is NULL!\n");
 			goto err_out;
 		}
 
@@ -336,7 +336,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 				cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
-		RTE_LOG(DEBUG, PMD, "Alloc AGG Done!\n");
+		PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
 		rxr->ag_prod = 0;
 		rxr->ag_doorbell =
 		    (char *)pci_dev->mem_resource[2].addr +
@@ -347,7 +347,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN +
 					ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
 		if (bnxt_init_one_rx_ring(rxq)) {
-			RTE_LOG(ERR, PMD, "bnxt_init_one_rx_ring failed!\n");
+			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
drivers/net/bnxt/bnxt_rxq.c +11 -11
index f7fbb2856..736936a55 100644
@@ -75,7 +75,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	if (bp->rx_cp_nr_rings < 2) {
 		vnic = bnxt_alloc_vnic(bp);
 		if (!vnic) {
-			RTE_LOG(ERR, PMD, "VNIC alloc failed\n");
+			PMD_DRV_LOG(ERR, "VNIC alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -92,7 +92,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		vnic->end_grp_id = vnic->start_grp_id;
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
-			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
+			PMD_DRV_LOG(ERR, "L2 filter alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -121,7 +121,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			pools = bp->rx_cp_nr_rings;
 			break;
 		default:
-			RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
+			PMD_DRV_LOG(ERR, "Unsupported mq_mod %d\n",
 				dev_conf->rxmode.mq_mode);
 			rc = -EINVAL;
 			goto err_out;
@@ -135,7 +135,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	for (i = 0; i < pools; i++) {
 		vnic = bnxt_alloc_vnic(bp);
 		if (!vnic) {
-			RTE_LOG(ERR, PMD, "VNIC alloc failed\n");
+			PMD_DRV_LOG(ERR, "VNIC alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -166,7 +166,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		}
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
-			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
+			PMD_DRV_LOG(ERR, "L2 filter alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -312,14 +312,14 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (queue_idx >= bp->max_rx_rings) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
 		return -ENOSPC;
 	}
 
 	if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid\n", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid\n", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -332,7 +332,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq = rte_zmalloc_socket("bnxt_rx_queue", sizeof(struct bnxt_rx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!rxq) {
-		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!\n");
+		PMD_DRV_LOG(ERR, "bnxt_rx_queue allocation failed!\n");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -341,8 +341,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 
-	RTE_LOG(DEBUG, PMD, "RX Buf size is %d\n", rxq->rx_buf_use_size);
-	RTE_LOG(DEBUG, PMD, "RX Buf MTU %d\n", eth_dev->data->mtu);
+	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_use_size);
+	PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);
 
 	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
 	if (rc)
@@ -357,7 +357,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate RX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring,
 			"rxr")) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"ring_dma_zone_reserve for rx_ring failed!\n");
 		bnxt_rx_queue_release_op(rxq);
 		rc = -ENOMEM;
drivers/net/bnxt/bnxt_rxr.c +9 -10
index 82c93d6dc..3f07c11b5 100644
@@ -95,9 +95,9 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	}
 
 	if (rxbd == NULL)
-		RTE_LOG(ERR, PMD, "Jumbo Frame. rxbd is NULL\n");
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
 	if (rx_buf == NULL)
-		RTE_LOG(ERR, PMD, "Jumbo Frame. rx_buf is NULL\n");
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
 
 
 	rx_buf->mbuf = mbuf;
@@ -234,7 +234,7 @@ static int bnxt_prod_ag_mbuf(struct bnxt_rx_queue *rxq)
 	/* TODO batch allocation for better performance */
 	while (rte_bitmap_get(rxr->ag_bitmap, next)) {
 		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, next))) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 				"agg mbuf alloc failed: prod=0x%x\n", next);
 			break;
 		}
@@ -512,7 +512,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	 */
 	prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	if (bnxt_alloc_rx_data(rxq, rxr, prod)) {
-		RTE_LOG(ERR, PMD, "mbuf alloc failed with prod=0x%x\n", prod);
+		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n", prod);
 		rc = -ENOMEM;
 		goto rx;
 	}
@@ -601,7 +601,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				rxr->rx_prod = i;
 				B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 			} else {
-				RTE_LOG(ERR, PMD, "Alloc  mbuf failed\n");
+				PMD_DRV_LOG(ERR, "Alloc  mbuf failed\n");
 				break;
 			}
 		}
@@ -744,7 +744,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	prod = rxr->rx_prod;
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
-			RTE_LOG(WARNING, PMD,
+			PMD_DRV_LOG(WARNING,
 				"init'ed rx ring %d with %d/%d mbufs only\n",
 				rxq->queue_id, i, ring->ring_size);
 			break;
@@ -752,7 +752,6 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		rxr->rx_prod = prod;
 		prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	}
-	RTE_LOG(DEBUG, PMD, "%s\n", __func__);
 
 	ring = rxr->ag_ring_struct;
 	type = RX_PROD_AGG_BD_TYPE_RX_PROD_AGG;
@@ -761,7 +760,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
-			RTE_LOG(WARNING, PMD,
+			PMD_DRV_LOG(WARNING,
 			"init'ed AG ring %d with %d/%d mbufs only\n",
 			rxq->queue_id, i, ring->ring_size);
 			break;
@@ -769,7 +768,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		rxr->ag_prod = prod;
 		prod = RING_NEXT(rxr->ag_ring_struct, prod);
 	}
-	RTE_LOG(DEBUG, PMD, "%s AGG Done!\n", __func__);
+	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
 	if (rxr->tpa_info) {
 		for (i = 0; i < BNXT_TPA_MAX; i++) {
@@ -781,7 +780,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 			}
 		}
 	}
-	RTE_LOG(DEBUG, PMD, "%s TPA alloc Done!\n", __func__);
+	PMD_DRV_LOG(DEBUG, "TPA alloc Done!\n");
 
 	return 0;
 }
drivers/net/bnxt/bnxt_stats.c +8 -8
index 470c6438d..bd93cc834 100644
@@ -237,7 +237,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 
 	memset(bnxt_stats, 0, sizeof(*bnxt_stats));
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
-		RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
 		return 0;
 	}
 
@@ -272,7 +272,7 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
-		RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
 		return;
 	}
 
@@ -289,7 +289,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	uint64_t tx_drop_pkts;
 
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
-		RTE_LOG(ERR, PMD, "xstats not supported for VF\n");
+		PMD_DRV_LOG(ERR, "xstats not supported for VF\n");
 		return 0;
 	}
 
@@ -371,11 +371,11 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 		bnxt_hwrm_port_clr_stats(bp);
 
 	if (BNXT_VF(bp))
-		RTE_LOG(ERR, PMD, "Operation not supported on a VF device\n");
+		PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
 	if (!BNXT_SINGLE_PF(bp))
-		RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n");
+		PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
-		RTE_LOG(ERR, PMD, "Operation not supported\n");
+		PMD_DRV_LOG(ERR, "Operation not supported\n");
 }
 
 int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
@@ -394,7 +394,7 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 	bnxt_dev_xstats_get_by_id_op(dev, NULL, values_copy, stat_cnt);
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			RTE_LOG(ERR, PMD, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid");
 			return -1;
 		}
 		values[i] = values_copy[ids[i]];
@@ -420,7 +420,7 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
 
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			RTE_LOG(ERR, PMD, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid");
 			return -1;
 		}
 		strcpy(xstats_names[i].name,
drivers/net/bnxt/bnxt_txq.c +5 -5
index 25c33f5e4..53524346d 100644
@@ -109,14 +109,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (queue_idx >= bp->max_tx_rings) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
 		return -ENOSPC;
 	}
 
 	if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -131,7 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq = rte_zmalloc_socket("bnxt_tx_queue", sizeof(struct bnxt_tx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!txq) {
-		RTE_LOG(ERR, PMD, "bnxt_tx_queue allocation failed!");
+		PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -149,14 +149,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate TX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, txq->tx_ring, NULL, txq->cp_ring,
 			"txr")) {
-		RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for tx_ring failed!");
+		PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
 	}
 
 	if (bnxt_init_one_tx_ring(txq)) {
-		RTE_LOG(ERR, PMD, "bnxt_init_one_tx_ring failed!");
+		PMD_DRV_LOG(ERR, "bnxt_init_one_tx_ring failed!");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
drivers/net/bnxt/bnxt_vnic.c +7 -7
index 5bac26053..d4aeb4ca8 100644
@@ -107,7 +107,7 @@ int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 		}
 		temp = STAILQ_NEXT(temp, next);
 	}
-	RTE_LOG(ERR, PMD, "VNIC %p is not found in pool[%d]\n", vnic, pool);
+	PMD_DRV_LOG(ERR, "VNIC %p is not found in pool[%d]\n", vnic, pool);
 	return -EINVAL;
 }
 
@@ -118,7 +118,7 @@ struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp)
 	/* Find the 1st unused vnic from the free_vnic_list pool*/
 	vnic = STAILQ_FIRST(&bp->free_vnic_list);
 	if (!vnic) {
-		RTE_LOG(ERR, PMD, "No more free VNIC resources\n");
+		PMD_DRV_LOG(ERR, "No more free VNIC resources\n");
 		return NULL;
 	}
 	STAILQ_REMOVE_HEAD(&bp->free_vnic_list, next);
@@ -194,13 +194,13 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	}
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Memzone physical address same as virtual.\n");
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Using rte_mem_virt2iova()\n");
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 			"unable to map vnic address to physical memory\n");
 			return -ENOMEM;
 		}
@@ -241,7 +241,7 @@ void bnxt_free_vnic_mem(struct bnxt *bp)
 	for (i = 0; i < max_vnics; i++) {
 		vnic = &bp->vnic_info[i];
 		if (vnic->fw_vnic_id != (uint16_t)HWRM_NA_SIGNATURE) {
-			RTE_LOG(ERR, PMD, "VNIC is not freed yet!\n");
+			PMD_DRV_LOG(ERR, "VNIC is not freed yet!\n");
 			/* TODO Call HWRM to free VNIC */
 		}
 	}
@@ -260,7 +260,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp)
 	vnic_mem = rte_zmalloc("bnxt_vnic_info",
 			       max_vnics * sizeof(struct bnxt_vnic_info), 0);
 	if (vnic_mem == NULL) {
-		RTE_LOG(ERR, PMD, "Failed to alloc memory for %d VNICs",
+		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs",
 			max_vnics);
 		return -ENOMEM;
 	}
drivers/net/bnxt/rte_pmd_bnxt.c +24 -24

187 lines not on this page · raw message

Signature · 1 line
2.14.3 (Apple Git-98)
#4 lore raw

Re: [PATCH 2/5] net/bnxt: use driver specific dynamic log type

Quoted 3 lines · Ajit Khaparde

This patch implements driver specific log type doing away with usage of RTE_LOG() for logging.

<...>

Quoted 7 lines
drivers/net/bnxt/bnxt_ethdev.c +3 -0
@@ -3433,6 +3434,16 @@ bool is_bnxt_supported(struct rte_eth_dev *dev)
 	return is_device_supported(dev, &bnxt_rte_pmd);
 }
 
+static void
+bnxt_init_log(void)
+{

drivers/net/bnxt/bnxt_ethdev.c bool is_bnxt_supported(struct rte_eth_dev *dev) · line 3449

Quoted 10 lines
drivers/net/bnxt/bnxt_ethdev.c +7 -0
+	bnxt_logtype_driver = rte_log_register("pmd.bnxt.driver");
+	if (bnxt_logtype_driver >= 0)
+		rte_log_set_level(bnxt_logtype_driver, RTE_LOG_NOTICE);
+}
+
 RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio-pci");
+
+RTE_INIT(bnxt_init_log);

Compiler giving warning for this [1], briefly asks putting this line above "bnxt_init_log":

[1]
...dpdk/drivers/net/bnxt/bnxt_ethdev.c:3518:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]

RTE_INIT(bnxt_init_log);
^

<...>

#5 lore raw

v2 cover bnxt patchset

Please apply this patchset.
I have incorporated most of the comments that we got in v1. The switch to SPDX tags is in the works and will be submitted separately.

Ajit Khaparde (6):
net/bnxt: fix size of tx ring in HW
net/bnxt: use driver specific dynamic log type
net/bnxt: register for more async events
net/bnxt: check if MAC address is all zeros
net/bnxt: add 100G speed detection
net/bnxt: fix number of pools for RSS

Somnath Kotur (1):
net/bnxt: support for rx/tx_queue_start/stop ops

 drivers/net/bnxt/bnxt.h         |   8 ++
 drivers/net/bnxt/bnxt_cpr.c     |  19 ++-
 drivers/net/bnxt/bnxt_ethdev.c  | 282 +++++++++++++++++++++-------------------
 drivers/net/bnxt/bnxt_filter.c  |  44 +++----
 drivers/net/bnxt/bnxt_filter.h  |   1 +
 drivers/net/bnxt/bnxt_hwrm.c    | 181 +++++++++++++++-----------
 drivers/net/bnxt/bnxt_hwrm.h    |  13 ++
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +-
 drivers/net/bnxt/bnxt_rxq.c     |  77 +++++++++--
 drivers/net/bnxt/bnxt_rxq.h     |   6 +-
 drivers/net/bnxt/bnxt_rxr.c     |  23 ++--
 drivers/net/bnxt/bnxt_rxr.h     |   3 +-
 drivers/net/bnxt/bnxt_stats.c   |  16 +--
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_txq.h     |   1 -
 drivers/net/bnxt/bnxt_txr.c     |  34 ++++-
 drivers/net/bnxt/bnxt_txr.h     |   2 +
 drivers/net/bnxt/bnxt_vnic.c    |  14 +-
 drivers/net/bnxt/bnxt_vnic.h    |   1 -
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 +++----
 21 files changed, 481 insertions(+), 318 deletions(-)
Signature · 1 line
2.14.3 (Apple Git-98)
#6 lore raw

PATCH v2 1/7 net/bnxt: fix size of tx ring in HW

During Tx ring allocation, the actual ring size configured in the HW ends up being twice the number of txd parameter specified to the driver. The power of 2 ring size wrongly adds a +1 while sending the ring create command to the FW.

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_txr.c +1 -1
index ac77434b7..2f2c87119 100644
@@ -101,7 +101,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	txr->tx_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
+	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)txr->tx_desc_ring;
 	ring->bd_dma = txr->tx_desc_mapping;
Signature · 1 line
2.14.3 (Apple Git-98)
#7 lore raw

PATCH v2 2/7 net/bnxt: use driver specific dynamic log type

In reply to Ajit Khaparde

This patch implements driver specific log type doing away with usage of RTE_LOG() for logging.

--
v1 -> v2: address review comments

---
 drivers/net/bnxt/bnxt.h         |   8 ++
 drivers/net/bnxt/bnxt_cpr.c     |  10 +-
 drivers/net/bnxt/bnxt_ethdev.c  | 241 +++++++++++++++++++++-------------------
 drivers/net/bnxt/bnxt_filter.c  |  42 +++----
 drivers/net/bnxt/bnxt_hwrm.c    | 142 ++++++++++++-----------
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +-
 drivers/net/bnxt/bnxt_rxq.c     |  22 ++--
 drivers/net/bnxt/bnxt_rxr.c     |  19 ++--
 drivers/net/bnxt/bnxt_stats.c   |  16 +--
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_vnic.c    |  14 +--
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 ++++----
 13 files changed, 300 insertions(+), 288 deletions(-)
drivers/net/bnxt/bnxt.h +8 -0
index cf0b1d27c..6776c64a5 100644
@@ -334,4 +334,12 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 bool is_bnxt_supported(struct rte_eth_dev *dev);
 extern const struct rte_flow_ops bnxt_flow_ops;
+
+extern int bnxt_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
+		__func__, ## args)
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt, ## args)
 #endif
drivers/net/bnxt/bnxt_cpr.c +5 -5
index cde8adc3b..663a5223d 100644
@@ -58,7 +58,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
 	default:
-		RTE_LOG(DEBUG, PMD, "handle_async_event id = 0x%x\n", event_id);
+		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
 		break;
 	}
 }
@@ -74,7 +74,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	int rc;
 
 	if (bp->pf.active_vfs <= 0) {
-		RTE_LOG(ERR, PMD, "Forwarded VF with no active VFs\n");
+		PMD_DRV_LOG(ERR, "Forwarded VF with no active VFs\n");
 		return;
 	}
 
@@ -93,7 +93,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 
 	if (fw_vf_id < bp->pf.first_vf_id ||
 	    fw_vf_id >= (bp->pf.first_vf_id) + bp->pf.active_vfs) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 		"FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)\n",
 			fw_vf_id, bp->pf.first_vf_id,
 			(bp->pf.first_vf_id) + bp->pf.active_vfs - 1,
@@ -130,7 +130,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 		if (rc) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 				"Failed to send FWD req VF 0x%x, type 0x%x.\n",
 				fw_vf_id - bp->pf.first_vf_id,
 				rte_le_to_cpu_16(fwd_cmd->req_type));
@@ -141,7 +141,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 reject:
 	rc = bnxt_hwrm_reject_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 	if (rc) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Failed to send REJECT req VF 0x%x, type 0x%x.\n",
 			fw_vf_id - bp->pf.first_vf_id,
 			rte_le_to_cpu_16(fwd_cmd->req_type));
drivers/net/bnxt/bnxt_ethdev.c +125 -116

835 lines not on this page · raw message

drivers/net/bnxt/bnxt_filter.c +21 -21

158 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +69 -73

492 lines not on this page · raw message

drivers/net/bnxt/bnxt_irq.c +2 -2
index 49436cfd9..8ab986936 100644
@@ -84,7 +84,7 @@ static void bnxt_int_handler(void *param)
 					       cpr->cp_ring_struct))
 					goto no_more;
 			}
-			RTE_LOG(INFO, PMD,
+			PMD_DRV_LOG(INFO,
 				"Ignoring %02x completion\n", CMP_TYPE(cmp));
 			break;
 		}
@@ -154,7 +154,7 @@ int bnxt_setup_int(struct bnxt *bp)
 	return 0;
 
 setup_exit:
-	RTE_LOG(ERR, PMD, "bnxt_irq_tbl setup failed\n");
+	PMD_DRV_LOG(ERR, "bnxt_irq_tbl setup failed\n");
 	return rc;
 }
 
drivers/net/bnxt/bnxt_ring.c +6 -6
index 59d1035fd..8fb897216 100644
@@ -176,15 +176,15 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	memset(mz->addr, 0, mz->len);
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Memzone physical address same as virtual.\n");
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Using rte_mem_virt2iova()\n");
 		for (sz = 0; sz < total_alloc_len; sz += getpagesize())
 			rte_mem_lock_page(((char *)mz->addr) + sz);
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 			"unable to map ring address to physical memory\n");
 			return -ENOMEM;
 		}
@@ -326,7 +326,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		ring = rxr->ag_ring_struct;
 		/* Agg ring */
 		if (ring == NULL) {
-			RTE_LOG(ERR, PMD, "Alloc AGG Ring is NULL!\n");
+			PMD_DRV_LOG(ERR, "Alloc AGG Ring is NULL!\n");
 			goto err_out;
 		}
 
@@ -336,7 +336,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 				cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
-		RTE_LOG(DEBUG, PMD, "Alloc AGG Done!\n");
+		PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
 		rxr->ag_prod = 0;
 		rxr->ag_doorbell =
 		    (char *)pci_dev->mem_resource[2].addr +
@@ -347,7 +347,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN +
 					ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
 		if (bnxt_init_one_rx_ring(rxq)) {
-			RTE_LOG(ERR, PMD, "bnxt_init_one_rx_ring failed!\n");
+			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
drivers/net/bnxt/bnxt_rxq.c +11 -11
index f7fbb2856..736936a55 100644
@@ -75,7 +75,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	if (bp->rx_cp_nr_rings < 2) {
 		vnic = bnxt_alloc_vnic(bp);
 		if (!vnic) {
-			RTE_LOG(ERR, PMD, "VNIC alloc failed\n");
+			PMD_DRV_LOG(ERR, "VNIC alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -92,7 +92,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		vnic->end_grp_id = vnic->start_grp_id;
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
-			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
+			PMD_DRV_LOG(ERR, "L2 filter alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -121,7 +121,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			pools = bp->rx_cp_nr_rings;
 			break;
 		default:
-			RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
+			PMD_DRV_LOG(ERR, "Unsupported mq_mod %d\n",
 				dev_conf->rxmode.mq_mode);
 			rc = -EINVAL;
 			goto err_out;
@@ -135,7 +135,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	for (i = 0; i < pools; i++) {
 		vnic = bnxt_alloc_vnic(bp);
 		if (!vnic) {
-			RTE_LOG(ERR, PMD, "VNIC alloc failed\n");
+			PMD_DRV_LOG(ERR, "VNIC alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -166,7 +166,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		}
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
-			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
+			PMD_DRV_LOG(ERR, "L2 filter alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -312,14 +312,14 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (queue_idx >= bp->max_rx_rings) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
 		return -ENOSPC;
 	}
 
 	if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid\n", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid\n", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -332,7 +332,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq = rte_zmalloc_socket("bnxt_rx_queue", sizeof(struct bnxt_rx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!rxq) {
-		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!\n");
+		PMD_DRV_LOG(ERR, "bnxt_rx_queue allocation failed!\n");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -341,8 +341,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 
-	RTE_LOG(DEBUG, PMD, "RX Buf size is %d\n", rxq->rx_buf_use_size);
-	RTE_LOG(DEBUG, PMD, "RX Buf MTU %d\n", eth_dev->data->mtu);
+	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_use_size);
+	PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);
 
 	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
 	if (rc)
@@ -357,7 +357,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate RX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring,
 			"rxr")) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"ring_dma_zone_reserve for rx_ring failed!\n");
 		bnxt_rx_queue_release_op(rxq);
 		rc = -ENOMEM;
drivers/net/bnxt/bnxt_rxr.c +9 -10
index 82c93d6dc..3f07c11b5 100644
@@ -95,9 +95,9 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	}
 
 	if (rxbd == NULL)
-		RTE_LOG(ERR, PMD, "Jumbo Frame. rxbd is NULL\n");
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
 	if (rx_buf == NULL)
-		RTE_LOG(ERR, PMD, "Jumbo Frame. rx_buf is NULL\n");
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
 
 
 	rx_buf->mbuf = mbuf;
@@ -234,7 +234,7 @@ static int bnxt_prod_ag_mbuf(struct bnxt_rx_queue *rxq)
 	/* TODO batch allocation for better performance */
 	while (rte_bitmap_get(rxr->ag_bitmap, next)) {
 		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, next))) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 				"agg mbuf alloc failed: prod=0x%x\n", next);
 			break;
 		}
@@ -512,7 +512,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	 */
 	prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	if (bnxt_alloc_rx_data(rxq, rxr, prod)) {
-		RTE_LOG(ERR, PMD, "mbuf alloc failed with prod=0x%x\n", prod);
+		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n", prod);
 		rc = -ENOMEM;
 		goto rx;
 	}
@@ -601,7 +601,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				rxr->rx_prod = i;
 				B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 			} else {
-				RTE_LOG(ERR, PMD, "Alloc  mbuf failed\n");
+				PMD_DRV_LOG(ERR, "Alloc  mbuf failed\n");
 				break;
 			}
 		}
@@ -744,7 +744,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	prod = rxr->rx_prod;
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
-			RTE_LOG(WARNING, PMD,
+			PMD_DRV_LOG(WARNING,
 				"init'ed rx ring %d with %d/%d mbufs only\n",
 				rxq->queue_id, i, ring->ring_size);
 			break;
@@ -752,7 +752,6 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		rxr->rx_prod = prod;
 		prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	}
-	RTE_LOG(DEBUG, PMD, "%s\n", __func__);
 
 	ring = rxr->ag_ring_struct;
 	type = RX_PROD_AGG_BD_TYPE_RX_PROD_AGG;
@@ -761,7 +760,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
-			RTE_LOG(WARNING, PMD,
+			PMD_DRV_LOG(WARNING,
 			"init'ed AG ring %d with %d/%d mbufs only\n",
 			rxq->queue_id, i, ring->ring_size);
 			break;
@@ -769,7 +768,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		rxr->ag_prod = prod;
 		prod = RING_NEXT(rxr->ag_ring_struct, prod);
 	}
-	RTE_LOG(DEBUG, PMD, "%s AGG Done!\n", __func__);
+	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
 	if (rxr->tpa_info) {
 		for (i = 0; i < BNXT_TPA_MAX; i++) {
@@ -781,7 +780,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 			}
 		}
 	}
-	RTE_LOG(DEBUG, PMD, "%s TPA alloc Done!\n", __func__);
+	PMD_DRV_LOG(DEBUG, "TPA alloc Done!\n");
 
 	return 0;
 }
drivers/net/bnxt/bnxt_stats.c +8 -8
index 470c6438d..bd93cc834 100644
@@ -237,7 +237,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 
 	memset(bnxt_stats, 0, sizeof(*bnxt_stats));
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
-		RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
 		return 0;
 	}
 
@@ -272,7 +272,7 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
-		RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
 		return;
 	}
 
@@ -289,7 +289,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	uint64_t tx_drop_pkts;
 
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
-		RTE_LOG(ERR, PMD, "xstats not supported for VF\n");
+		PMD_DRV_LOG(ERR, "xstats not supported for VF\n");
 		return 0;
 	}
 
@@ -371,11 +371,11 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 		bnxt_hwrm_port_clr_stats(bp);
 
 	if (BNXT_VF(bp))
-		RTE_LOG(ERR, PMD, "Operation not supported on a VF device\n");
+		PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
 	if (!BNXT_SINGLE_PF(bp))
-		RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n");
+		PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
-		RTE_LOG(ERR, PMD, "Operation not supported\n");
+		PMD_DRV_LOG(ERR, "Operation not supported\n");
 }
 
 int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
@@ -394,7 +394,7 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 	bnxt_dev_xstats_get_by_id_op(dev, NULL, values_copy, stat_cnt);
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			RTE_LOG(ERR, PMD, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid");
 			return -1;
 		}
 		values[i] = values_copy[ids[i]];
@@ -420,7 +420,7 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
 
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			RTE_LOG(ERR, PMD, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid");
 			return -1;
 		}
 		strcpy(xstats_names[i].name,
drivers/net/bnxt/bnxt_txq.c +5 -5
index 25c33f5e4..53524346d 100644
@@ -109,14 +109,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (queue_idx >= bp->max_tx_rings) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
 		return -ENOSPC;
 	}
 
 	if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -131,7 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq = rte_zmalloc_socket("bnxt_tx_queue", sizeof(struct bnxt_tx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!txq) {
-		RTE_LOG(ERR, PMD, "bnxt_tx_queue allocation failed!");
+		PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -149,14 +149,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate TX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, txq->tx_ring, NULL, txq->cp_ring,
 			"txr")) {
-		RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for tx_ring failed!");
+		PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
 	}
 
 	if (bnxt_init_one_tx_ring(txq)) {
-		RTE_LOG(ERR, PMD, "bnxt_init_one_tx_ring failed!");
+		PMD_DRV_LOG(ERR, "bnxt_init_one_tx_ring failed!");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
drivers/net/bnxt/bnxt_vnic.c +7 -7
index 5bac26053..d4aeb4ca8 100644
@@ -107,7 +107,7 @@ int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 		}
 		temp = STAILQ_NEXT(temp, next);
 	}
-	RTE_LOG(ERR, PMD, "VNIC %p is not found in pool[%d]\n", vnic, pool);
+	PMD_DRV_LOG(ERR, "VNIC %p is not found in pool[%d]\n", vnic, pool);
 	return -EINVAL;
 }
 
@@ -118,7 +118,7 @@ struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp)
 	/* Find the 1st unused vnic from the free_vnic_list pool*/
 	vnic = STAILQ_FIRST(&bp->free_vnic_list);
 	if (!vnic) {
-		RTE_LOG(ERR, PMD, "No more free VNIC resources\n");
+		PMD_DRV_LOG(ERR, "No more free VNIC resources\n");
 		return NULL;
 	}
 	STAILQ_REMOVE_HEAD(&bp->free_vnic_list, next);
@@ -194,13 +194,13 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	}
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Memzone physical address same as virtual.\n");
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Using rte_mem_virt2iova()\n");
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 			"unable to map vnic address to physical memory\n");
 			return -ENOMEM;
 		}
@@ -241,7 +241,7 @@ void bnxt_free_vnic_mem(struct bnxt *bp)
 	for (i = 0; i < max_vnics; i++) {
 		vnic = &bp->vnic_info[i];
 		if (vnic->fw_vnic_id != (uint16_t)HWRM_NA_SIGNATURE) {
-			RTE_LOG(ERR, PMD, "VNIC is not freed yet!\n");
+			PMD_DRV_LOG(ERR, "VNIC is not freed yet!\n");
 			/* TODO Call HWRM to free VNIC */
 		}
 	}
@@ -260,7 +260,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp)
 	vnic_mem = rte_zmalloc("bnxt_vnic_info",
 			       max_vnics * sizeof(struct bnxt_vnic_info), 0);
 	if (vnic_mem == NULL) {
-		RTE_LOG(ERR, PMD, "Failed to alloc memory for %d VNICs",
+		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs",
 			max_vnics);
 		return -ENOMEM;
 	}
drivers/net/bnxt/rte_pmd_bnxt.c +24 -24

187 lines not on this page · raw message

Signature · 1 line
2.14.3 (Apple Git-98)
#8 lore raw

PATCH v2 3/7 net/bnxt: register for more async events

In reply to Ajit Khaparde

Register for async events from the FW.
New events we are registering for include Link speed config changes, PF driver unload and VF config change. Also log a message when the async event arrives on the completion ring.

---
 drivers/net/bnxt/bnxt_cpr.c  | 11 ++++++++++-
 drivers/net/bnxt/bnxt_hwrm.c |  9 +++++++--
 drivers/net/bnxt/bnxt_hwrm.h | 11 +++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +10 -1
index 663a5223d..737bb060a 100644
@@ -57,8 +57,17 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
+		PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
+		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
+		PMD_DRV_LOG(INFO, "Async event: VF config changed\n");
+		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED:
+		PMD_DRV_LOG(INFO, "Port conn async event\n");
+		break;
 	default:
-		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
+		PMD_DRV_LOG(INFO, "handle_async_event id = 0x%x\n", event_id);
 		break;
 	}
 }
drivers/net/bnxt/bnxt_hwrm.c +7 -2
index fdca424a9..75e03ad5d 100644
@@ -637,8 +637,13 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 			       sizeof(bp->pf.vf_req_fwd)));
 	}
 
-	req.async_event_fwd[0] |= rte_cpu_to_le_32(0x1);   /* TODO: Use MACRO */
-	//memset(req.async_event_fwd, 0xff, sizeof(req.async_event_fwd));
+	req.async_event_fwd[0] |=
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |
+				 ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |
+				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE);
+	req.async_event_fwd[1] |=
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD |
+				 ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
drivers/net/bnxt/bnxt_hwrm.h +11 -0
index 46f6f3208..108f8e81d 100644
@@ -42,6 +42,17 @@ struct bnxt_filter_info;
 struct bnxt_cp_ring_info;
 
 #define HWRM_SEQ_ID_INVALID -1U
+/* Convert Bit field location to value */
+#define ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)
+#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD - 32))
+#define ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE - 32))
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
Signature · 1 line
2.14.3 (Apple Git-98)
#9 lore raw

PATCH v2 4/7 net/bnxt: check if MAC address is all zeros

In reply to Ajit Khaparde

In certain cases the MAC address of a port could be all zeros. Catch it early, log a message and fail the initiaization.

---
 drivers/net/bnxt/bnxt_ethdev.c | 10 ++++++++++
 drivers/net/bnxt/bnxt_filter.c |  2 +-
 drivers/net/bnxt/bnxt_filter.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +10 -0
index daed1fc80..76fff711f 100644
@@ -3246,6 +3246,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		rc = -ENOMEM;
 		goto error_free;
 	}
+
+	if (check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) {
+		PMD_DRV_LOG(ERR,
+			    "Invalid MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n",
+			    bp->dflt_mac_addr[0], bp->dflt_mac_addr[1],
+			    bp->dflt_mac_addr[2], bp->dflt_mac_addr[3],
+			    bp->dflt_mac_addr[4], bp->dflt_mac_addr[5]);
+		rc = -EINVAL;
+		goto error_free;
+	}
 	/* Copy the permanent MAC from the qcap response address now. */
 	memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr));
 	memcpy(&eth_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN);
drivers/net/bnxt/bnxt_filter.c +1 -1
index 0716dd8fd..032e8eed0 100644
@@ -250,7 +250,7 @@ nxt_non_void_action(const struct rte_flow_action *cur)
 	}
 }
 
-static inline int check_zero_bytes(const uint8_t *bytes, int len)
+int check_zero_bytes(const uint8_t *bytes, int len)
 {
 	int i;
 	for (i = 0; i < len; i++)
drivers/net/bnxt/bnxt_filter.h +1 -0
index 2591a87e2..a3c702df6 100644
@@ -97,6 +97,7 @@ struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp);
 void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter);
 struct bnxt_filter_info *bnxt_get_l2_filter(struct bnxt *bp,
 		struct bnxt_filter_info *nf, struct bnxt_vnic_info *vnic);
+int check_zero_bytes(const uint8_t *bytes, int len);
 
 #define NTUPLE_FLTR_ALLOC_INPUT_EN_SRC_MACADDR	\
 	HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR
Signature · 1 line
2.14.3 (Apple Git-98)
#10 lore raw

PATCH v2 5/7 net/bnxt: support for rx/tx_queue_start/stop ops

In reply to Ajit Khaparde

Currently this is implemented entirely in the PMD as there is no explicit support in the HW. Re-program the RSS Table without this queue on stop and add it back to the table on start.

--
v1->v2: address review comments

---
 drivers/net/bnxt/bnxt_ethdev.c | 33 +++++++++-----------------
 drivers/net/bnxt/bnxt_hwrm.c   | 28 ++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  2 ++
 drivers/net/bnxt/bnxt_rxq.c    | 53 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_rxq.h    |  6 ++++-
 drivers/net/bnxt/bnxt_rxr.c    |  4 ++++
 drivers/net/bnxt/bnxt_rxr.h    |  3 ++-
 drivers/net/bnxt/bnxt_txq.h    |  1 -
 drivers/net/bnxt/bnxt_txr.c    | 32 +++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_txr.h    |  2 ++
 drivers/net/bnxt/bnxt_vnic.h   |  1 -
 11 files changed, 139 insertions(+), 26 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +11 -22
index 76fff711f..2268aba2a 100644
@@ -202,7 +202,7 @@ static int bnxt_alloc_mem(struct bnxt *bp)
 
 static int bnxt_init_chip(struct bnxt *bp)
 {
-	unsigned int i, rss_idx, fw_idx;
+	unsigned int i;
 	struct rte_eth_link new;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
@@ -279,27 +279,12 @@ static int bnxt_init_chip(struct bnxt *bp)
 				i, rc);
 			goto err_out;
 		}
-		if (vnic->rss_table && vnic->hash_type) {
-			/*
-			 * Fill the RSS hash & redirection table with
-			 * ring group ids for all VNICs
-			 */
-			for (rss_idx = 0, fw_idx = 0;
-			     rss_idx < HW_HASH_INDEX_SIZE;
-			     rss_idx++, fw_idx++) {
-				if (vnic->fw_grp_ids[fw_idx] ==
-				    INVALID_HW_RING_ID)
-					fw_idx = 0;
-				vnic->rss_table[rss_idx] =
-						vnic->fw_grp_ids[fw_idx];
-			}
-			rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-			if (rc) {
-				PMD_DRV_LOG(ERR,
-					"HWRM vnic %d set RSS failure rc: %x\n",
-					i, rc);
-				goto err_out;
-			}
+
+		rc = bnxt_vnic_rss_configure(bp, vnic);
+		if (rc) {
+			PMD_DRV_LOG(ERR,
+				    "HWRM vnic set RSS failure rc: %x\n", rc);
+			goto err_out;
 		}
 
 		bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
@@ -3022,6 +3007,10 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.rx_queue_count = bnxt_rx_queue_count_op,
 	.rx_descriptor_status = bnxt_rx_descriptor_status_op,
 	.tx_descriptor_status = bnxt_tx_descriptor_status_op,
+	.rx_queue_start = bnxt_rx_queue_start,
+	.rx_queue_stop = bnxt_rx_queue_stop,
+	.tx_queue_start = bnxt_tx_queue_start,
+	.tx_queue_stop = bnxt_tx_queue_stop,
 	.filter_ctrl = bnxt_filter_ctrl_op,
 	.dev_supported_ptypes_get = bnxt_dev_supported_ptypes_get_op,
 	.get_eeprom_length    = bnxt_get_eeprom_length_op,
drivers/net/bnxt/bnxt_hwrm.c +28 -0
index 75e03ad5d..8fac05251 100644
@@ -3676,3 +3676,31 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 
 	return 0;
 }
+
+int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+	unsigned int rss_idx, fw_idx, i;
+
+	if (vnic->rss_table && vnic->hash_type) {
+		/*
+		 * Fill the RSS hash & redirection table with
+		 * ring group ids for all VNICs
+		 */
+		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+			rss_idx++, fw_idx++) {
+			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+				fw_idx %= bp->rx_cp_nr_rings;
+				if (vnic->fw_grp_ids[fw_idx] !=
+				    INVALID_HW_RING_ID)
+					break;
+				fw_idx++;
+			}
+			if (i == bp->rx_cp_nr_rings)
+				return 0;
+			vnic->rss_table[rss_idx] =
+				vnic->fw_grp_ids[fw_idx];
+		}
+		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	}
+	return 0;
+}
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 108f8e81d..f11e72a35 100644
@@ -187,4 +187,6 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
 			  uint16_t dir_attr, const uint8_t *data,
 			  size_t data_len);
 int bnxt_hwrm_ptp_cfg(struct bnxt *bp);
+int bnxt_vnic_rss_configure(struct bnxt *bp,
+			    struct bnxt_vnic_info *vnic);
 #endif
drivers/net/bnxt/bnxt_rxq.c +53 -0

56 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxq.h +5 -1
index be190195a..c7acaa755 100644
@@ -50,6 +50,7 @@ struct bnxt_rx_queue {
 	uint16_t		reg_idx; /* RX queue register index */
 	uint16_t		port_id; /* Device port identifier */
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
+	uint8_t			rx_deferred_start; /* not in global dev start */
 
 	struct bnxt		*bp;
 	int			index;
@@ -75,5 +76,8 @@ int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
 				 uint16_t queue_id);
 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id);
-
+int bnxt_rx_queue_start(struct rte_eth_dev *dev,
+			uint16_t rx_queue_id);
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev,
+		       uint16_t rx_queue_id);
 #endif
drivers/net/bnxt/bnxt_rxr.c +4 -0
index 3f07c11b5..9e70c8604 100644
@@ -545,6 +545,10 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
 
+	/* If Rx Q was stopped return */
+	if (rxq->rx_deferred_start)
+		return 0;
+
 	/* Handle RX burst request */
 	while (1) {
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
drivers/net/bnxt/bnxt_rxr.h +2 -1
index a94373d19..f3ed49bd6 100644
@@ -120,5 +120,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 void bnxt_free_rx_rings(struct bnxt *bp);
 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id);
 int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);
-
+int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 #endif
drivers/net/bnxt/bnxt_txq.h +0 -1
index f753c10f2..e27c34fa9 100644
@@ -71,5 +71,4 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			       uint16_t nb_desc,
 			       unsigned int socket_id,
 			       const struct rte_eth_txconf *tx_conf);
-
 #endif
drivers/net/bnxt/bnxt_txr.c +32 -0
index 2f2c87119..2c81a37c2 100644
@@ -349,6 +349,11 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	/* Handle TX completions */
 	bnxt_handle_tx_cp(txq);
 
+	/* Tx queue was stopped; wait for it to be restarted */
+	if (txq->tx_deferred_start) {
+		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
+		return 0;
+	}
 	/* Handle TX burst request */
 	for (nb_tx_pkts = 0; nb_tx_pkts < nb_pkts; nb_tx_pkts++) {
 		if (bnxt_start_xmit(tx_pkts[nb_tx_pkts], txq)) {
@@ -364,3 +369,30 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	return nb_tx_pkts;
 }
+
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+	txq->tx_deferred_start = false;
+	PMD_DRV_LOG(DEBUG, "Tx queue started\n");
+
+	return 0;
+}
+
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	/* Handle TX completions */
+	bnxt_handle_tx_cp(txq);
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+	txq->tx_deferred_start = true;
+	PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
+
+	return 0;
+}
drivers/net/bnxt/bnxt_txr.h +2 -0
index 2feac51db..d88b15ab8 100644
@@ -68,6 +68,8 @@ 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);
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 #define PKT_TX_OIP_IIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
drivers/net/bnxt/bnxt_vnic.h +0 -1
index 875dc3c1c..d8d35c7dc 100644
@@ -93,5 +93,4 @@ void bnxt_free_vnic_attributes(struct bnxt *bp);
 int bnxt_alloc_vnic_attributes(struct bnxt *bp);
 void bnxt_free_vnic_mem(struct bnxt *bp);
 int bnxt_alloc_vnic_mem(struct bnxt *bp);
-
 #endif
Signature · 1 line
2.14.3 (Apple Git-98)
#11 lore raw

PATCH v2 6/7 net/bnxt: add 100G speed detection

In reply to Ajit Khaparde

When the driver is loaded on a 100G NIC, the port speed is not displayed correctly. Parse the 100G speed before displaying it.

---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +2 -0
index 8fac05251..d412e51fc 100644
@@ -2139,6 +2139,8 @@ static uint32_t bnxt_parse_hw_link_speed(uint16_t hw_link_speed)
 		break;
 	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB:
 		eth_link_speed = ETH_SPEED_NUM_50G;
+	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB:
+		eth_link_speed = ETH_SPEED_NUM_100G;
 		break;
 	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB:
 	default:
Signature · 1 line
2.14.3 (Apple Git-98)
#12 lore raw

Re: [PATCH v2 6/7] net/bnxt: add 100G speed detection

Quoted 13 lines · Ajit Khaparde

When the driver is loaded on a 100G NIC, the port speed is not displayed correctly. Parse the 100G speed before displaying it.

---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +0 -0
index 8fac05251..d412e51fc 100644

drivers/net/bnxt/bnxt_hwrm.c static uint32_t bnxt_parse_hw_link_speed(uint16_t hw_link_speed) · line 2141

Quoted 3 lines
drivers/net/bnxt/bnxt_hwrm.c +0 -0
@@ -2139,6 +2139,8 @@ static uint32_t bnxt_parse_hw_link_speed(uint16_t hw_link_speed)
 		break;
 	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB:
 		eth_link_speed = ETH_SPEED_NUM_50G;

This case doesn't have a "break" statement, which looks like unintentional, but if it is intentional please put /* Fallthrough */ comment to prevent build error [1].

[1]
...dpdk/drivers/net/bnxt/bnxt_hwrm.c: In function ‘bnxt_parse_hw_link_speed’:
...dpdk/drivers/net/bnxt/bnxt_hwrm.c:2141:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
eth_link_speed = ETH_SPEED_NUM_50G;
...dpdk/drivers/net/bnxt/bnxt_hwrm.c:2142:2: note: here
case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB:
^~~~

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +2 -0
+	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB:
+		eth_link_speed = ETH_SPEED_NUM_100G;
 		break;
 	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB:
 	default:
#13 lore raw

v3 cover bnxt patchset

Please apply this patchset.

Ajit Khaparde (6):
net/bnxt: fix size of tx ring in HW
net/bnxt: use driver specific dynamic log type
net/bnxt: register for more async events
net/bnxt: check if MAC address is all zeros
net/bnxt: add 100G speed detection
net/bnxt: fix number of pools for RSS

Somnath Kotur (1):
net/bnxt: support for rx/tx_queue_start/stop ops

 drivers/net/bnxt/bnxt.h         |   8 ++
 drivers/net/bnxt/bnxt_cpr.c     |  19 ++-
 drivers/net/bnxt/bnxt_ethdev.c  | 282 +++++++++++++++++++++-------------------
 drivers/net/bnxt/bnxt_filter.c  |  44 +++----
 drivers/net/bnxt/bnxt_filter.h  |   1 +
 drivers/net/bnxt/bnxt_hwrm.c    | 182 +++++++++++++++-----------
 drivers/net/bnxt/bnxt_hwrm.h    |  13 ++
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +-
 drivers/net/bnxt/bnxt_rxq.c     |  77 +++++++++--
 drivers/net/bnxt/bnxt_rxq.h     |   6 +-
 drivers/net/bnxt/bnxt_rxr.c     |  23 ++--
 drivers/net/bnxt/bnxt_rxr.h     |   3 +-
 drivers/net/bnxt/bnxt_stats.c   |  16 +--
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_txq.h     |   1 -
 drivers/net/bnxt/bnxt_txr.c     |  34 ++++-
 drivers/net/bnxt/bnxt_txr.h     |   2 +
 drivers/net/bnxt/bnxt_vnic.c    |  14 +-
 drivers/net/bnxt/bnxt_vnic.h    |   1 -
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 +++----
 21 files changed, 482 insertions(+), 318 deletions(-)
Signature · 1 line
2.14.3 (Apple Git-98)
#14 lore raw

PATCH v3 1/7 net/bnxt: fix size of tx ring in HW

During Tx ring allocation, the actual ring size configured in the HW ends up being twice the number of txd parameter specified to the driver. The power of 2 ring size wrongly adds a +1 while sending the ring create command to the FW.

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_txr.c +1 -1
index ac77434b7..2f2c87119 100644
@@ -101,7 +101,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	txr->tx_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
+	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)txr->tx_desc_ring;
 	ring->bd_dma = txr->tx_desc_mapping;
Signature · 1 line
2.14.3 (Apple Git-98)
#15 lore raw

PATCH v3 2/7 net/bnxt: use driver specific dynamic log type

In reply to Ajit Khaparde

This patch implements driver specific log type doing away with usage of RTE_LOG() for logging.

--
v1 -> v2: address review comments

---
 drivers/net/bnxt/bnxt.h         |   8 ++
 drivers/net/bnxt/bnxt_cpr.c     |  10 +-
 drivers/net/bnxt/bnxt_ethdev.c  | 241 +++++++++++++++++++++-------------------
 drivers/net/bnxt/bnxt_filter.c  |  42 +++----
 drivers/net/bnxt/bnxt_hwrm.c    | 142 ++++++++++++-----------
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +-
 drivers/net/bnxt/bnxt_rxq.c     |  22 ++--
 drivers/net/bnxt/bnxt_rxr.c     |  19 ++--
 drivers/net/bnxt/bnxt_stats.c   |  16 +--
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_vnic.c    |  14 +--
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 ++++----
 13 files changed, 300 insertions(+), 288 deletions(-)
drivers/net/bnxt/bnxt.h +8 -0
index cf0b1d27c..6776c64a5 100644
@@ -334,4 +334,12 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 bool is_bnxt_supported(struct rte_eth_dev *dev);
 extern const struct rte_flow_ops bnxt_flow_ops;
+
+extern int bnxt_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
+		__func__, ## args)
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt, ## args)
 #endif
drivers/net/bnxt/bnxt_cpr.c +5 -5
index cde8adc3b..663a5223d 100644
@@ -58,7 +58,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
 	default:
-		RTE_LOG(DEBUG, PMD, "handle_async_event id = 0x%x\n", event_id);
+		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
 		break;
 	}
 }
@@ -74,7 +74,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	int rc;
 
 	if (bp->pf.active_vfs <= 0) {
-		RTE_LOG(ERR, PMD, "Forwarded VF with no active VFs\n");
+		PMD_DRV_LOG(ERR, "Forwarded VF with no active VFs\n");
 		return;
 	}
 
@@ -93,7 +93,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 
 	if (fw_vf_id < bp->pf.first_vf_id ||
 	    fw_vf_id >= (bp->pf.first_vf_id) + bp->pf.active_vfs) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 		"FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)\n",
 			fw_vf_id, bp->pf.first_vf_id,
 			(bp->pf.first_vf_id) + bp->pf.active_vfs - 1,
@@ -130,7 +130,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 		if (rc) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 				"Failed to send FWD req VF 0x%x, type 0x%x.\n",
 				fw_vf_id - bp->pf.first_vf_id,
 				rte_le_to_cpu_16(fwd_cmd->req_type));
@@ -141,7 +141,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 reject:
 	rc = bnxt_hwrm_reject_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 	if (rc) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Failed to send REJECT req VF 0x%x, type 0x%x.\n",
 			fw_vf_id - bp->pf.first_vf_id,
 			rte_le_to_cpu_16(fwd_cmd->req_type));
drivers/net/bnxt/bnxt_ethdev.c +125 -116

835 lines not on this page · raw message

drivers/net/bnxt/bnxt_filter.c +21 -21

158 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +69 -73

492 lines not on this page · raw message

drivers/net/bnxt/bnxt_irq.c +2 -2
index 49436cfd9..8ab986936 100644
@@ -84,7 +84,7 @@ static void bnxt_int_handler(void *param)
 					       cpr->cp_ring_struct))
 					goto no_more;
 			}
-			RTE_LOG(INFO, PMD,
+			PMD_DRV_LOG(INFO,
 				"Ignoring %02x completion\n", CMP_TYPE(cmp));
 			break;
 		}
@@ -154,7 +154,7 @@ int bnxt_setup_int(struct bnxt *bp)
 	return 0;
 
 setup_exit:
-	RTE_LOG(ERR, PMD, "bnxt_irq_tbl setup failed\n");
+	PMD_DRV_LOG(ERR, "bnxt_irq_tbl setup failed\n");
 	return rc;
 }
 
drivers/net/bnxt/bnxt_ring.c +6 -6
index 59d1035fd..8fb897216 100644
@@ -176,15 +176,15 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	memset(mz->addr, 0, mz->len);
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Memzone physical address same as virtual.\n");
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Using rte_mem_virt2iova()\n");
 		for (sz = 0; sz < total_alloc_len; sz += getpagesize())
 			rte_mem_lock_page(((char *)mz->addr) + sz);
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 			"unable to map ring address to physical memory\n");
 			return -ENOMEM;
 		}
@@ -326,7 +326,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		ring = rxr->ag_ring_struct;
 		/* Agg ring */
 		if (ring == NULL) {
-			RTE_LOG(ERR, PMD, "Alloc AGG Ring is NULL!\n");
+			PMD_DRV_LOG(ERR, "Alloc AGG Ring is NULL!\n");
 			goto err_out;
 		}
 
@@ -336,7 +336,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 				cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
-		RTE_LOG(DEBUG, PMD, "Alloc AGG Done!\n");
+		PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
 		rxr->ag_prod = 0;
 		rxr->ag_doorbell =
 		    (char *)pci_dev->mem_resource[2].addr +
@@ -347,7 +347,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN +
 					ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
 		if (bnxt_init_one_rx_ring(rxq)) {
-			RTE_LOG(ERR, PMD, "bnxt_init_one_rx_ring failed!\n");
+			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
drivers/net/bnxt/bnxt_rxq.c +11 -11
index f7fbb2856..736936a55 100644
@@ -75,7 +75,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	if (bp->rx_cp_nr_rings < 2) {
 		vnic = bnxt_alloc_vnic(bp);
 		if (!vnic) {
-			RTE_LOG(ERR, PMD, "VNIC alloc failed\n");
+			PMD_DRV_LOG(ERR, "VNIC alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -92,7 +92,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		vnic->end_grp_id = vnic->start_grp_id;
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
-			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
+			PMD_DRV_LOG(ERR, "L2 filter alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -121,7 +121,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			pools = bp->rx_cp_nr_rings;
 			break;
 		default:
-			RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
+			PMD_DRV_LOG(ERR, "Unsupported mq_mod %d\n",
 				dev_conf->rxmode.mq_mode);
 			rc = -EINVAL;
 			goto err_out;
@@ -135,7 +135,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	for (i = 0; i < pools; i++) {
 		vnic = bnxt_alloc_vnic(bp);
 		if (!vnic) {
-			RTE_LOG(ERR, PMD, "VNIC alloc failed\n");
+			PMD_DRV_LOG(ERR, "VNIC alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -166,7 +166,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		}
 		filter = bnxt_alloc_filter(bp);
 		if (!filter) {
-			RTE_LOG(ERR, PMD, "L2 filter alloc failed\n");
+			PMD_DRV_LOG(ERR, "L2 filter alloc failed\n");
 			rc = -ENOMEM;
 			goto err_out;
 		}
@@ -312,14 +312,14 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (queue_idx >= bp->max_rx_rings) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
 		return -ENOSPC;
 	}
 
 	if (!nb_desc || nb_desc > MAX_RX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid\n", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid\n", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -332,7 +332,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq = rte_zmalloc_socket("bnxt_rx_queue", sizeof(struct bnxt_rx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!rxq) {
-		RTE_LOG(ERR, PMD, "bnxt_rx_queue allocation failed!\n");
+		PMD_DRV_LOG(ERR, "bnxt_rx_queue allocation failed!\n");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -341,8 +341,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 
-	RTE_LOG(DEBUG, PMD, "RX Buf size is %d\n", rxq->rx_buf_use_size);
-	RTE_LOG(DEBUG, PMD, "RX Buf MTU %d\n", eth_dev->data->mtu);
+	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_use_size);
+	PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);
 
 	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
 	if (rc)
@@ -357,7 +357,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate RX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring,
 			"rxr")) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"ring_dma_zone_reserve for rx_ring failed!\n");
 		bnxt_rx_queue_release_op(rxq);
 		rc = -ENOMEM;
drivers/net/bnxt/bnxt_rxr.c +9 -10
index 82c93d6dc..3f07c11b5 100644
@@ -95,9 +95,9 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	}
 
 	if (rxbd == NULL)
-		RTE_LOG(ERR, PMD, "Jumbo Frame. rxbd is NULL\n");
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
 	if (rx_buf == NULL)
-		RTE_LOG(ERR, PMD, "Jumbo Frame. rx_buf is NULL\n");
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
 
 
 	rx_buf->mbuf = mbuf;
@@ -234,7 +234,7 @@ static int bnxt_prod_ag_mbuf(struct bnxt_rx_queue *rxq)
 	/* TODO batch allocation for better performance */
 	while (rte_bitmap_get(rxr->ag_bitmap, next)) {
 		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, next))) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 				"agg mbuf alloc failed: prod=0x%x\n", next);
 			break;
 		}
@@ -512,7 +512,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	 */
 	prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	if (bnxt_alloc_rx_data(rxq, rxr, prod)) {
-		RTE_LOG(ERR, PMD, "mbuf alloc failed with prod=0x%x\n", prod);
+		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n", prod);
 		rc = -ENOMEM;
 		goto rx;
 	}
@@ -601,7 +601,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				rxr->rx_prod = i;
 				B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 			} else {
-				RTE_LOG(ERR, PMD, "Alloc  mbuf failed\n");
+				PMD_DRV_LOG(ERR, "Alloc  mbuf failed\n");
 				break;
 			}
 		}
@@ -744,7 +744,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	prod = rxr->rx_prod;
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
-			RTE_LOG(WARNING, PMD,
+			PMD_DRV_LOG(WARNING,
 				"init'ed rx ring %d with %d/%d mbufs only\n",
 				rxq->queue_id, i, ring->ring_size);
 			break;
@@ -752,7 +752,6 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		rxr->rx_prod = prod;
 		prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	}
-	RTE_LOG(DEBUG, PMD, "%s\n", __func__);
 
 	ring = rxr->ag_ring_struct;
 	type = RX_PROD_AGG_BD_TYPE_RX_PROD_AGG;
@@ -761,7 +760,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
-			RTE_LOG(WARNING, PMD,
+			PMD_DRV_LOG(WARNING,
 			"init'ed AG ring %d with %d/%d mbufs only\n",
 			rxq->queue_id, i, ring->ring_size);
 			break;
@@ -769,7 +768,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 		rxr->ag_prod = prod;
 		prod = RING_NEXT(rxr->ag_ring_struct, prod);
 	}
-	RTE_LOG(DEBUG, PMD, "%s AGG Done!\n", __func__);
+	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
 	if (rxr->tpa_info) {
 		for (i = 0; i < BNXT_TPA_MAX; i++) {
@@ -781,7 +780,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 			}
 		}
 	}
-	RTE_LOG(DEBUG, PMD, "%s TPA alloc Done!\n", __func__);
+	PMD_DRV_LOG(DEBUG, "TPA alloc Done!\n");
 
 	return 0;
 }
drivers/net/bnxt/bnxt_stats.c +8 -8
index 470c6438d..bd93cc834 100644
@@ -237,7 +237,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 
 	memset(bnxt_stats, 0, sizeof(*bnxt_stats));
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
-		RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
 		return 0;
 	}
 
@@ -272,7 +272,7 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
-		RTE_LOG(ERR, PMD, "Device Initialization not complete!\n");
+		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
 		return;
 	}
 
@@ -289,7 +289,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	uint64_t tx_drop_pkts;
 
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
-		RTE_LOG(ERR, PMD, "xstats not supported for VF\n");
+		PMD_DRV_LOG(ERR, "xstats not supported for VF\n");
 		return 0;
 	}
 
@@ -371,11 +371,11 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 		bnxt_hwrm_port_clr_stats(bp);
 
 	if (BNXT_VF(bp))
-		RTE_LOG(ERR, PMD, "Operation not supported on a VF device\n");
+		PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
 	if (!BNXT_SINGLE_PF(bp))
-		RTE_LOG(ERR, PMD, "Operation not supported on a MF device\n");
+		PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
 	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
-		RTE_LOG(ERR, PMD, "Operation not supported\n");
+		PMD_DRV_LOG(ERR, "Operation not supported\n");
 }
 
 int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
@@ -394,7 +394,7 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 	bnxt_dev_xstats_get_by_id_op(dev, NULL, values_copy, stat_cnt);
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			RTE_LOG(ERR, PMD, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid");
 			return -1;
 		}
 		values[i] = values_copy[ids[i]];
@@ -420,7 +420,7 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
 
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			RTE_LOG(ERR, PMD, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid");
 			return -1;
 		}
 		strcpy(xstats_names[i].name,
drivers/net/bnxt/bnxt_txq.c +5 -5
index 25c33f5e4..53524346d 100644
@@ -109,14 +109,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	int rc = 0;
 
 	if (queue_idx >= bp->max_tx_rings) {
-		RTE_LOG(ERR, PMD,
+		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
 		return -ENOSPC;
 	}
 
 	if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) {
-		RTE_LOG(ERR, PMD, "nb_desc %d is invalid", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -131,7 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq = rte_zmalloc_socket("bnxt_tx_queue", sizeof(struct bnxt_tx_queue),
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (!txq) {
-		RTE_LOG(ERR, PMD, "bnxt_tx_queue allocation failed!");
+		PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -149,14 +149,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	/* Allocate TX ring hardware descriptors */
 	if (bnxt_alloc_rings(bp, queue_idx, txq->tx_ring, NULL, txq->cp_ring,
 			"txr")) {
-		RTE_LOG(ERR, PMD, "ring_dma_zone_reserve for tx_ring failed!");
+		PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
 	}
 
 	if (bnxt_init_one_tx_ring(txq)) {
-		RTE_LOG(ERR, PMD, "bnxt_init_one_tx_ring failed!");
+		PMD_DRV_LOG(ERR, "bnxt_init_one_tx_ring failed!");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
drivers/net/bnxt/bnxt_vnic.c +7 -7
index 5bac26053..d4aeb4ca8 100644
@@ -107,7 +107,7 @@ int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 		}
 		temp = STAILQ_NEXT(temp, next);
 	}
-	RTE_LOG(ERR, PMD, "VNIC %p is not found in pool[%d]\n", vnic, pool);
+	PMD_DRV_LOG(ERR, "VNIC %p is not found in pool[%d]\n", vnic, pool);
 	return -EINVAL;
 }
 
@@ -118,7 +118,7 @@ struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp)
 	/* Find the 1st unused vnic from the free_vnic_list pool*/
 	vnic = STAILQ_FIRST(&bp->free_vnic_list);
 	if (!vnic) {
-		RTE_LOG(ERR, PMD, "No more free VNIC resources\n");
+		PMD_DRV_LOG(ERR, "No more free VNIC resources\n");
 		return NULL;
 	}
 	STAILQ_REMOVE_HEAD(&bp->free_vnic_list, next);
@@ -194,13 +194,13 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	}
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Memzone physical address same as virtual.\n");
-		RTE_LOG(WARNING, PMD,
+		PMD_DRV_LOG(WARNING,
 			"Using rte_mem_virt2iova()\n");
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			RTE_LOG(ERR, PMD,
+			PMD_DRV_LOG(ERR,
 			"unable to map vnic address to physical memory\n");
 			return -ENOMEM;
 		}
@@ -241,7 +241,7 @@ void bnxt_free_vnic_mem(struct bnxt *bp)
 	for (i = 0; i < max_vnics; i++) {
 		vnic = &bp->vnic_info[i];
 		if (vnic->fw_vnic_id != (uint16_t)HWRM_NA_SIGNATURE) {
-			RTE_LOG(ERR, PMD, "VNIC is not freed yet!\n");
+			PMD_DRV_LOG(ERR, "VNIC is not freed yet!\n");
 			/* TODO Call HWRM to free VNIC */
 		}
 	}
@@ -260,7 +260,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp)
 	vnic_mem = rte_zmalloc("bnxt_vnic_info",
 			       max_vnics * sizeof(struct bnxt_vnic_info), 0);
 	if (vnic_mem == NULL) {
-		RTE_LOG(ERR, PMD, "Failed to alloc memory for %d VNICs",
+		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs",
 			max_vnics);
 		return -ENOMEM;
 	}
drivers/net/bnxt/rte_pmd_bnxt.c +24 -24

187 lines not on this page · raw message

Signature · 1 line
2.14.3 (Apple Git-98)
#16 lore raw

PATCH v3 3/7 net/bnxt: register for more async events

In reply to Ajit Khaparde

Register for async events from the FW.
New events we are registering for include Link speed config changes, PF driver unload and VF config change. Also log a message when the async event arrives on the completion ring.

---
 drivers/net/bnxt/bnxt_cpr.c  | 11 ++++++++++-
 drivers/net/bnxt/bnxt_hwrm.c |  9 +++++++--
 drivers/net/bnxt/bnxt_hwrm.h | 11 +++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +10 -1
index 663a5223d..737bb060a 100644
@@ -57,8 +57,17 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
+		PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
+		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
+		PMD_DRV_LOG(INFO, "Async event: VF config changed\n");
+		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED:
+		PMD_DRV_LOG(INFO, "Port conn async event\n");
+		break;
 	default:
-		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
+		PMD_DRV_LOG(INFO, "handle_async_event id = 0x%x\n", event_id);
 		break;
 	}
 }
drivers/net/bnxt/bnxt_hwrm.c +7 -2
index fdca424a9..75e03ad5d 100644
@@ -637,8 +637,13 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 			       sizeof(bp->pf.vf_req_fwd)));
 	}
 
-	req.async_event_fwd[0] |= rte_cpu_to_le_32(0x1);   /* TODO: Use MACRO */
-	//memset(req.async_event_fwd, 0xff, sizeof(req.async_event_fwd));
+	req.async_event_fwd[0] |=
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |
+				 ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |
+				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE);
+	req.async_event_fwd[1] |=
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD |
+				 ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
drivers/net/bnxt/bnxt_hwrm.h +11 -0
index 46f6f3208..108f8e81d 100644
@@ -42,6 +42,17 @@ struct bnxt_filter_info;
 struct bnxt_cp_ring_info;
 
 #define HWRM_SEQ_ID_INVALID -1U
+/* Convert Bit field location to value */
+#define ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)
+#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD - 32))
+#define ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE - 32))
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
Signature · 1 line
2.14.3 (Apple Git-98)
#17 lore raw

PATCH v3 4/7 net/bnxt: check if MAC address is all zeros

In reply to Ajit Khaparde

In certain cases the MAC address of a port could be all zeros. Catch it early, log a message and fail the initiaization.

---
 drivers/net/bnxt/bnxt_ethdev.c | 10 ++++++++++
 drivers/net/bnxt/bnxt_filter.c |  2 +-
 drivers/net/bnxt/bnxt_filter.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +10 -0
index daed1fc80..76fff711f 100644
@@ -3246,6 +3246,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		rc = -ENOMEM;
 		goto error_free;
 	}
+
+	if (check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) {
+		PMD_DRV_LOG(ERR,
+			    "Invalid MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n",
+			    bp->dflt_mac_addr[0], bp->dflt_mac_addr[1],
+			    bp->dflt_mac_addr[2], bp->dflt_mac_addr[3],
+			    bp->dflt_mac_addr[4], bp->dflt_mac_addr[5]);
+		rc = -EINVAL;
+		goto error_free;
+	}
 	/* Copy the permanent MAC from the qcap response address now. */
 	memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr));
 	memcpy(&eth_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN);
drivers/net/bnxt/bnxt_filter.c +1 -1
index 0716dd8fd..032e8eed0 100644
@@ -250,7 +250,7 @@ nxt_non_void_action(const struct rte_flow_action *cur)
 	}
 }
 
-static inline int check_zero_bytes(const uint8_t *bytes, int len)
+int check_zero_bytes(const uint8_t *bytes, int len)
 {
 	int i;
 	for (i = 0; i < len; i++)
drivers/net/bnxt/bnxt_filter.h +1 -0
index 2591a87e2..a3c702df6 100644
@@ -97,6 +97,7 @@ struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp);
 void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter);
 struct bnxt_filter_info *bnxt_get_l2_filter(struct bnxt *bp,
 		struct bnxt_filter_info *nf, struct bnxt_vnic_info *vnic);
+int check_zero_bytes(const uint8_t *bytes, int len);
 
 #define NTUPLE_FLTR_ALLOC_INPUT_EN_SRC_MACADDR	\
 	HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR
Signature · 1 line
2.14.3 (Apple Git-98)
#18 lore raw

PATCH v3 5/7 net/bnxt: support for rx/tx_queue_start/stop ops

In reply to Ajit Khaparde

Currently this is implemented entirely in the PMD as there is no explicit support in the HW. Re-program the RSS Table without this queue on stop and add it back to the table on start.

--
v1->v2: address review comments

---
 drivers/net/bnxt/bnxt_ethdev.c | 33 +++++++++-----------------
 drivers/net/bnxt/bnxt_hwrm.c   | 28 ++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  2 ++
 drivers/net/bnxt/bnxt_rxq.c    | 53 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_rxq.h    |  6 ++++-
 drivers/net/bnxt/bnxt_rxr.c    |  4 ++++
 drivers/net/bnxt/bnxt_rxr.h    |  3 ++-
 drivers/net/bnxt/bnxt_txq.h    |  1 -
 drivers/net/bnxt/bnxt_txr.c    | 32 +++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_txr.h    |  2 ++
 drivers/net/bnxt/bnxt_vnic.h   |  1 -
 11 files changed, 139 insertions(+), 26 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +11 -22
index 76fff711f..2268aba2a 100644
@@ -202,7 +202,7 @@ static int bnxt_alloc_mem(struct bnxt *bp)
 
 static int bnxt_init_chip(struct bnxt *bp)
 {
-	unsigned int i, rss_idx, fw_idx;
+	unsigned int i;
 	struct rte_eth_link new;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
@@ -279,27 +279,12 @@ static int bnxt_init_chip(struct bnxt *bp)
 				i, rc);
 			goto err_out;
 		}
-		if (vnic->rss_table && vnic->hash_type) {
-			/*
-			 * Fill the RSS hash & redirection table with
-			 * ring group ids for all VNICs
-			 */
-			for (rss_idx = 0, fw_idx = 0;
-			     rss_idx < HW_HASH_INDEX_SIZE;
-			     rss_idx++, fw_idx++) {
-				if (vnic->fw_grp_ids[fw_idx] ==
-				    INVALID_HW_RING_ID)
-					fw_idx = 0;
-				vnic->rss_table[rss_idx] =
-						vnic->fw_grp_ids[fw_idx];
-			}
-			rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-			if (rc) {
-				PMD_DRV_LOG(ERR,
-					"HWRM vnic %d set RSS failure rc: %x\n",
-					i, rc);
-				goto err_out;
-			}
+
+		rc = bnxt_vnic_rss_configure(bp, vnic);
+		if (rc) {
+			PMD_DRV_LOG(ERR,
+				    "HWRM vnic set RSS failure rc: %x\n", rc);
+			goto err_out;
 		}
 
 		bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
@@ -3022,6 +3007,10 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.rx_queue_count = bnxt_rx_queue_count_op,
 	.rx_descriptor_status = bnxt_rx_descriptor_status_op,
 	.tx_descriptor_status = bnxt_tx_descriptor_status_op,
+	.rx_queue_start = bnxt_rx_queue_start,
+	.rx_queue_stop = bnxt_rx_queue_stop,
+	.tx_queue_start = bnxt_tx_queue_start,
+	.tx_queue_stop = bnxt_tx_queue_stop,
 	.filter_ctrl = bnxt_filter_ctrl_op,
 	.dev_supported_ptypes_get = bnxt_dev_supported_ptypes_get_op,
 	.get_eeprom_length    = bnxt_get_eeprom_length_op,
drivers/net/bnxt/bnxt_hwrm.c +28 -0
index 75e03ad5d..8fac05251 100644
@@ -3676,3 +3676,31 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 
 	return 0;
 }
+
+int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+	unsigned int rss_idx, fw_idx, i;
+
+	if (vnic->rss_table && vnic->hash_type) {
+		/*
+		 * Fill the RSS hash & redirection table with
+		 * ring group ids for all VNICs
+		 */
+		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+			rss_idx++, fw_idx++) {
+			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+				fw_idx %= bp->rx_cp_nr_rings;
+				if (vnic->fw_grp_ids[fw_idx] !=
+				    INVALID_HW_RING_ID)
+					break;
+				fw_idx++;
+			}
+			if (i == bp->rx_cp_nr_rings)
+				return 0;
+			vnic->rss_table[rss_idx] =
+				vnic->fw_grp_ids[fw_idx];
+		}
+		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	}
+	return 0;
+}
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 108f8e81d..f11e72a35 100644
@@ -187,4 +187,6 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
 			  uint16_t dir_attr, const uint8_t *data,
 			  size_t data_len);
 int bnxt_hwrm_ptp_cfg(struct bnxt *bp);
+int bnxt_vnic_rss_configure(struct bnxt *bp,
+			    struct bnxt_vnic_info *vnic);
 #endif
drivers/net/bnxt/bnxt_rxq.c +53 -0

56 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxq.h +5 -1
index be190195a..c7acaa755 100644
@@ -50,6 +50,7 @@ struct bnxt_rx_queue {
 	uint16_t		reg_idx; /* RX queue register index */
 	uint16_t		port_id; /* Device port identifier */
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
+	uint8_t			rx_deferred_start; /* not in global dev start */
 
 	struct bnxt		*bp;
 	int			index;
@@ -75,5 +76,8 @@ int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
 				 uint16_t queue_id);
 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id);
-
+int bnxt_rx_queue_start(struct rte_eth_dev *dev,
+			uint16_t rx_queue_id);
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev,
+		       uint16_t rx_queue_id);
 #endif
drivers/net/bnxt/bnxt_rxr.c +4 -0
index 3f07c11b5..9e70c8604 100644
@@ -545,6 +545,10 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
 
+	/* If Rx Q was stopped return */
+	if (rxq->rx_deferred_start)
+		return 0;
+
 	/* Handle RX burst request */
 	while (1) {
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
drivers/net/bnxt/bnxt_rxr.h +2 -1
index a94373d19..f3ed49bd6 100644
@@ -120,5 +120,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 void bnxt_free_rx_rings(struct bnxt *bp);
 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id);
 int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);
-
+int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 #endif
drivers/net/bnxt/bnxt_txq.h +0 -1
index f753c10f2..e27c34fa9 100644
@@ -71,5 +71,4 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			       uint16_t nb_desc,
 			       unsigned int socket_id,
 			       const struct rte_eth_txconf *tx_conf);
-
 #endif
drivers/net/bnxt/bnxt_txr.c +32 -0
index 2f2c87119..2c81a37c2 100644
@@ -349,6 +349,11 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	/* Handle TX completions */
 	bnxt_handle_tx_cp(txq);
 
+	/* Tx queue was stopped; wait for it to be restarted */
+	if (txq->tx_deferred_start) {
+		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
+		return 0;
+	}
 	/* Handle TX burst request */
 	for (nb_tx_pkts = 0; nb_tx_pkts < nb_pkts; nb_tx_pkts++) {
 		if (bnxt_start_xmit(tx_pkts[nb_tx_pkts], txq)) {
@@ -364,3 +369,30 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	return nb_tx_pkts;
 }
+
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+	txq->tx_deferred_start = false;
+	PMD_DRV_LOG(DEBUG, "Tx queue started\n");
+
+	return 0;
+}
+
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	/* Handle TX completions */
+	bnxt_handle_tx_cp(txq);
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+	txq->tx_deferred_start = true;
+	PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
+
+	return 0;
+}
drivers/net/bnxt/bnxt_txr.h +2 -0
index 2feac51db..d88b15ab8 100644
@@ -68,6 +68,8 @@ 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);
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 #define PKT_TX_OIP_IIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
drivers/net/bnxt/bnxt_vnic.h +0 -1
index 875dc3c1c..d8d35c7dc 100644
@@ -93,5 +93,4 @@ void bnxt_free_vnic_attributes(struct bnxt *bp);
 int bnxt_alloc_vnic_attributes(struct bnxt *bp);
 void bnxt_free_vnic_mem(struct bnxt *bp);
 int bnxt_alloc_vnic_mem(struct bnxt *bp);
-
 #endif
Signature · 1 line
2.14.3 (Apple Git-98)
#19 lore raw

PATCH v3 6/7 net/bnxt: add 100G speed detection

In reply to Ajit Khaparde

When the driver is loaded on a 100G NIC, the port speed is not displayed correctly. Parse the 100G speed before displaying it.

--
v1->v2: add a missing break statement

---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
index 8fac05251..4987cf0a9 100644
@@ -2140,6 +2140,9 @@ static uint32_t bnxt_parse_hw_link_speed(uint16_t hw_link_speed)
 	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB:
 		eth_link_speed = ETH_SPEED_NUM_50G;
 		break;
+	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB:
+		eth_link_speed = ETH_SPEED_NUM_100G;
+		break;
 	case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB:
 	default:
 		PMD_DRV_LOG(ERR, "HWRM link speed %d not defined\n",
Signature · 1 line
2.14.3 (Apple Git-98)
#20 lore raw

PATCH v3 7/7 net/bnxt: fix number of pools for RSS

In reply to Ajit Khaparde

While using RSS, the pool count should be 1.

Fixes 8103a57ab432a ("net/bnxt: handle Rx multi queue creation properly")
---
 drivers/net/bnxt/bnxt_rxq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_rxq.c +1 -1
index 16304865d..d49f35462 100644
@@ -118,7 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 				pools = max_pools;
 			break;
 		case ETH_MQ_RX_RSS:
-			pools = bp->rx_cp_nr_rings;
+			pools = 1;
 			break;
 		default:
 			PMD_DRV_LOG(ERR, "Unsupported mq_mod %d\n",
Signature · 1 line
2.14.3 (Apple Git-98)
#21 lore raw
In reply to Ajit Khaparde
Quoted 10 lines · Ajit Khaparde

Please apply this patchset.

Ajit Khaparde (6):
net/bnxt: fix size of tx ring in HW
net/bnxt: use driver specific dynamic log type
net/bnxt: register for more async events
net/bnxt: check if MAC address is all zeros
net/bnxt: add 100G speed detection
net/bnxt: fix number of pools for RSS

Quoted 2 lines

Somnath Kotur (1):
net/bnxt: support for rx/tx_queue_start/stop ops

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

#22 lore raw

Re: [PATCH v2 6/7] net/bnxt: add 100G speed detection

In reply to Ferruh Yigit
Quoted 19 lines · Ferruh Yigit

drivers/net/bnxt/bnxt_hwrm.c static uint32_t bnxt_parse_hw_link_speed(uint16_t

Quoted 13 lines · Ajit Khaparde

When the driver is loaded on a 100G NIC, the port speed is not displayed correctly. Parse the 100G speed before displaying it.

---
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +0 -0
index 8fac05251..d412e51fc 100644
@@ -2139,6 +2139,8 @@ static uint32_t bnxt_parse_hw_link_speed(uint16_t

hw_link_speed)

drivers/net/bnxt/bnxt_hwrm.c static uint32_t bnxt_parse_hw_link_speed(uint16_t hw_link_speed) · line 2141

Quoted 3 lines
drivers/net/bnxt/bnxt_hwrm.c +0 -0
              break;
      case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB:
              eth_link_speed = ETH_SPEED_NUM_50G;
Quoted 6 lines

This case doesn't have a "break" statement, which looks like unintentional, but
if it is intentional please put /* Fallthrough */ comment to prevent build error
[1].

​No. Its unintentional. I copy pasted those lines from the test setup and ​missed it.

I am sending a fresh set. ​Thanks​

Quoted 20 lines

[1]
...dpdk/drivers/net/bnxt/bnxt_hwrm.c: In function ‘bnxt_parse_hw_link_speed’:
...dpdk/drivers/net/bnxt/bnxt_hwrm.c:2141:18: error: this statement may fall
through [-Werror=implicit-fallthrough=]
eth_link_speed = ETH_SPEED_NUM_50G;
...dpdk/drivers/net/bnxt/bnxt_hwrm.c:2142:2: note: here
case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB:
^~~~

Quoted 6 lines
drivers/net/bnxt/bnxt_hwrm.c +2 -0
+     case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB:
+             eth_link_speed = ETH_SPEED_NUM_100G;
              break;
      case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB:
      default:
#23 lore raw

PATCH v2 7/7 net/bnxt: fix number of pools for RSS

In reply to Ajit Khaparde

While using RSS, the pool count should be 1.

Fixes 8103a57ab432a ("net/bnxt: handle Rx multi queue creation properly")
---
 drivers/net/bnxt/bnxt_rxq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_rxq.c +1 -1
index 16304865d..d49f35462 100644
@@ -118,7 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 				pools = max_pools;
 			break;
 		case ETH_MQ_RX_RSS:
-			pools = bp->rx_cp_nr_rings;
+			pools = 1;
 			break;
 		default:
 			PMD_DRV_LOG(ERR, "Unsupported mq_mod %d\n",
Signature · 1 line
2.14.3 (Apple Git-98)
#24 lore raw
In reply to Ajit Khaparde
Quoted 12 lines · Ajit Khaparde

Please apply this patchset.
I have incorporated most of the comments that we got in v1. The switch to SPDX tags is in the works and will be submitted separately.

Ajit Khaparde (6):
net/bnxt: fix size of tx ring in HW
net/bnxt: use driver specific dynamic log type
net/bnxt: register for more async events
net/bnxt: check if MAC address is all zeros
net/bnxt: add 100G speed detection
net/bnxt: fix number of pools for RSS

Quoted 2 lines

Somnath Kotur (1):
net/bnxt: support for rx/tx_queue_start/stop ops

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

Except 6/7, which looks like can be independent patch. And since rc2 is close, I didn't want that patch to block the set.

#25 lore raw
Quoted 13 lines · Ferruh Yigit
Quoted 12 lines · Ajit Khaparde

Please apply this patchset.
I have incorporated most of the comments that we got in v1. The switch to SPDX tags is in the works and will be submitted separately.

Ajit Khaparde (6):
net/bnxt: fix size of tx ring in HW
net/bnxt: use driver specific dynamic log type
net/bnxt: register for more async events
net/bnxt: check if MAC address is all zeros
net/bnxt: add 100G speed detection
net/bnxt: fix number of pools for RSS

Quoted 7 lines
Quoted 2 lines

Somnath Kotur (1):
net/bnxt: support for rx/tx_queue_start/stop ops

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

Except 6/7, which looks like can be independent patch. And since rc2 is close, I didn't want that patch to block the set.

Ahh, new version arrived while I am writing this mail, so I will drop existing ones and apply new version of the set. Thanks.

#26 lore raw

PATCH 3/5 net/bnxt: register for more async events

In reply to Ajit Khaparde

Register for async events from the FW.
New events we are registering for include Link speed config changes, PF driver unload and VF config change. Also log a message when the async event arrives on the completion ring.

---
 drivers/net/bnxt/bnxt_cpr.c  | 11 ++++++++++-
 drivers/net/bnxt/bnxt_hwrm.c |  9 +++++++--
 drivers/net/bnxt/bnxt_hwrm.h | 11 +++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +10 -1
index 663a5223d..737bb060a 100644
@@ -57,8 +57,17 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
 		bnxt_link_update_op(bp->eth_dev, 1);
 		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
+		PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
+		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
+		PMD_DRV_LOG(INFO, "Async event: VF config changed\n");
+		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED:
+		PMD_DRV_LOG(INFO, "Port conn async event\n");
+		break;
 	default:
-		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
+		PMD_DRV_LOG(INFO, "handle_async_event id = 0x%x\n", event_id);
 		break;
 	}
 }
drivers/net/bnxt/bnxt_hwrm.c +7 -2
index fdca424a9..75e03ad5d 100644
@@ -637,8 +637,13 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 			       sizeof(bp->pf.vf_req_fwd)));
 	}
 
-	req.async_event_fwd[0] |= rte_cpu_to_le_32(0x1);   /* TODO: Use MACRO */
-	//memset(req.async_event_fwd, 0xff, sizeof(req.async_event_fwd));
+	req.async_event_fwd[0] |=
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |
+				 ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |
+				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE);
+	req.async_event_fwd[1] |=
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD |
+				 ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
drivers/net/bnxt/bnxt_hwrm.h +11 -0
index 46f6f3208..108f8e81d 100644
@@ -42,6 +42,17 @@ struct bnxt_filter_info;
 struct bnxt_cp_ring_info;
 
 #define HWRM_SEQ_ID_INVALID -1U
+/* Convert Bit field location to value */
+#define ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)
+#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE	\
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD - 32))
+#define ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE - 32))
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
Signature · 1 line
2.14.3 (Apple Git-98)
#27 lore raw

PATCH 4/5 net/bnxt: check if MAC address is all zeros

In reply to Ajit Khaparde

In certain cases the MAC address of a port could be all zeros. Catch it early, log a message and fail the initiaization.

---
 drivers/net/bnxt/bnxt_ethdev.c | 10 ++++++++++
 drivers/net/bnxt/bnxt_filter.c |  2 +-
 drivers/net/bnxt/bnxt_filter.h |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +10 -0
index af4673dc2..ebc2dfab2 100644
@@ -3247,6 +3247,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		rc = -ENOMEM;
 		goto error_free;
 	}
+
+	if (check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) {
+		PMD_DRV_LOG(ERR,
+			    "Invalid MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n",
+			    bp->dflt_mac_addr[0], bp->dflt_mac_addr[1],
+			    bp->dflt_mac_addr[2], bp->dflt_mac_addr[3],
+			    bp->dflt_mac_addr[4], bp->dflt_mac_addr[5]);
+		rc = -EINVAL;
+		goto error_free;
+	}
 	/* Copy the permanent MAC from the qcap response address now. */
 	memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr));
 	memcpy(&eth_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN);
drivers/net/bnxt/bnxt_filter.c +1 -1
index 0716dd8fd..032e8eed0 100644
@@ -250,7 +250,7 @@ nxt_non_void_action(const struct rte_flow_action *cur)
 	}
 }
 
-static inline int check_zero_bytes(const uint8_t *bytes, int len)
+int check_zero_bytes(const uint8_t *bytes, int len)
 {
 	int i;
 	for (i = 0; i < len; i++)
drivers/net/bnxt/bnxt_filter.h +1 -0
index 2591a87e2..a3c702df6 100644
@@ -97,6 +97,7 @@ struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp);
 void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter);
 struct bnxt_filter_info *bnxt_get_l2_filter(struct bnxt *bp,
 		struct bnxt_filter_info *nf, struct bnxt_vnic_info *vnic);
+int check_zero_bytes(const uint8_t *bytes, int len);
 
 #define NTUPLE_FLTR_ALLOC_INPUT_EN_SRC_MACADDR	\
 	HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR
Signature · 1 line
2.14.3 (Apple Git-98)
#28 lore raw

Re: [PATCH 4/5] net/bnxt: check if MAC address is all zeros

Quoted 4 lines · Ajit Khaparde

In certain cases the MAC address of a port could be all zeros. Catch it early, log a message and fail the initiaization.

<...>

drivers/net/bnxt/bnxt_ethdev.c bnxt_dev_init(struct rte_eth_dev *eth_dev) · line 3251

Quoted 6 lines
drivers/net/bnxt/bnxt_ethdev.c +2 -0
@@ -3247,6 +3247,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		rc = -ENOMEM;
 		goto error_free;
 	}
+
+	if (check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) {

There is already a function is_zero_ether_addr() which can be used here that prevents exposing your check_zero_bytes() function, up to you which one to use.

#29 lore raw

PATCH 5/5 net/bnxt: Support for rx/tx_queue_start/stop ops

In reply to Ajit Khaparde

Currently this is implemented entirely in the PMD as there is no explicit support in the HW. Re-program the RSS Table without this queue on stop and add it back to the table on start.

---
 drivers/net/bnxt/bnxt_ethdev.c | 125 ++++++++++++++++++++++++++++++-----------
 drivers/net/bnxt/bnxt_rxq.h    |   2 +-
 drivers/net/bnxt/bnxt_rxr.c    |   4 ++
 drivers/net/bnxt/bnxt_rxr.h    |   3 +-
 drivers/net/bnxt/bnxt_txq.h    |   1 -
 drivers/net/bnxt/bnxt_txr.c    |  32 +++++++++++
 drivers/net/bnxt/bnxt_txr.h    |   2 +
 7 files changed, 133 insertions(+), 36 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +92 -33
index ebc2dfab2..82d2416ba 100644
@@ -1,4 +1,4 @@
-/*-
+/*
  *   BSD LICENSE
  *
  *   Copyright(c) Broadcom Limited.
@@ -200,9 +200,37 @@ static int bnxt_alloc_mem(struct bnxt *bp)
 	return rc;
 }
 
+static int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+	unsigned int rss_idx, fw_idx, i;
+
+	if (vnic->rss_table && vnic->hash_type) {
+		/*
+		 * Fill the RSS hash & redirection table with
+		 * ring group ids for all VNICs
+		 */
+		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+			rss_idx++, fw_idx++) {
+			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+				fw_idx %= bp->rx_cp_nr_rings;
+				if (vnic->fw_grp_ids[fw_idx] !=
+				    INVALID_HW_RING_ID)
+					break;
+				fw_idx++;
+			}
+			if (i == bp->rx_cp_nr_rings)
+				return 0;
+			vnic->rss_table[rss_idx] =
+				vnic->fw_grp_ids[fw_idx];
+		}
+		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	}
+	return 0;
+}
+
 static int bnxt_init_chip(struct bnxt *bp)
 {
-	unsigned int i, rss_idx, fw_idx;
+	unsigned int i;
 	struct rte_eth_link new;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
@@ -279,27 +307,12 @@ static int bnxt_init_chip(struct bnxt *bp)
 				i, rc);
 			goto err_out;
 		}
-		if (vnic->rss_table && vnic->hash_type) {
-			/*
-			 * Fill the RSS hash & redirection table with
-			 * ring group ids for all VNICs
-			 */
-			for (rss_idx = 0, fw_idx = 0;
-			     rss_idx < HW_HASH_INDEX_SIZE;
-			     rss_idx++, fw_idx++) {
-				if (vnic->fw_grp_ids[fw_idx] ==
-				    INVALID_HW_RING_ID)
-					fw_idx = 0;
-				vnic->rss_table[rss_idx] =
-						vnic->fw_grp_ids[fw_idx];
-			}
-			rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-			if (rc) {
-				PMD_DRV_LOG(ERR,
-					"HWRM vnic %d set RSS failure rc: %x\n",
-					i, rc);
-				goto err_out;
-			}
+
+		rc = bnxt_vnic_rss_configure(bp, vnic);
+		if (rc) {
+			PMD_DRV_LOG(ERR,
+				    "HWRM vnic set RSS failure rc: %x\n", rc);
+			goto err_out;
 		}
 
 		bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
@@ -321,8 +334,7 @@ static int bnxt_init_chip(struct bnxt *bp)
 	     !RTE_ETH_DEV_SRIOV(bp->eth_dev).active) &&
 	    bp->eth_dev->data->dev_conf.intr_conf.rxq != 0) {
 		intr_vector = bp->eth_dev->data->nb_rx_queues;
-		PMD_DRV_LOG(INFO, "%s(): intr_vector = %d\n", __func__,
-			intr_vector);
+		PMD_DRV_LOG(INFO, "intr_vector = %d\n", intr_vector);
 		if (intr_vector > bp->rx_cp_nr_rings) {
 			PMD_DRV_LOG(ERR, "At most %d intr queues supported",
 					bp->rx_cp_nr_rings);
@@ -342,9 +354,9 @@ static int bnxt_init_chip(struct bnxt *bp)
 				" intr_vec", bp->eth_dev->data->nb_rx_queues);
 			return -ENOMEM;
 		}
-		PMD_DRV_LOG(DEBUG, "%s(): intr_handle->intr_vec = %p "
+		PMD_DRV_LOG(DEBUG, "intr_handle->intr_vec = %p "
 			"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
-			 __func__, intr_handle->intr_vec, intr_handle->nb_efd,
+			 intr_handle->intr_vec, intr_handle->nb_efd,
 			intr_handle->max_intr);
 	}
 
@@ -2842,8 +2854,8 @@ bnxt_get_eeprom_length_op(struct rte_eth_dev *dev)
 	uint32_t dir_entries;
 	uint32_t entry_length;
 
-	PMD_DRV_LOG(INFO, "%s(): %04x:%02x:%02x:%02x\n",
-		__func__, bp->pdev->addr.domain, bp->pdev->addr.bus,
+	PMD_DRV_LOG(INFO, "%04x:%02x:%02x:%02x\n",
+		bp->pdev->addr.domain, bp->pdev->addr.bus,
 		bp->pdev->addr.devid, bp->pdev->addr.function);
 
 	rc = bnxt_hwrm_nvm_get_dir_info(bp, &dir_entries, &entry_length);
@@ -2861,8 +2873,8 @@ bnxt_get_eeprom_op(struct rte_eth_dev *dev,
 	uint32_t index;
 	uint32_t offset;
 
-	PMD_DRV_LOG(INFO, "%s(): %04x:%02x:%02x:%02x in_eeprom->offset = %d "
-		"len = %d\n", __func__, bp->pdev->addr.domain,
+	PMD_DRV_LOG(INFO, "%04x:%02x:%02x:%02x in_eeprom->offset = %d "
+		"len = %d\n", bp->pdev->addr.domain,
 		bp->pdev->addr.bus, bp->pdev->addr.devid,
 		bp->pdev->addr.function, in_eeprom->offset, in_eeprom->length);
 
@@ -2930,8 +2942,8 @@ bnxt_set_eeprom_op(struct rte_eth_dev *dev,
 	uint8_t index, dir_op;
 	uint16_t type, ext, ordinal, attr;
 
-	PMD_DRV_LOG(INFO, "%s(): %04x:%02x:%02x:%02x in_eeprom->offset = %d "
-		"len = %d\n", __func__, bp->pdev->addr.domain,
+	PMD_DRV_LOG(INFO, "%04x:%02x:%02x:%02x in_eeprom->offset = %d "
+		"len = %d\n", bp->pdev->addr.domain,
 		bp->pdev->addr.bus, bp->pdev->addr.devid,
 		bp->pdev->addr.function, in_eeprom->offset, in_eeprom->length);
 
@@ -2969,6 +2981,49 @@ bnxt_set_eeprom_op(struct rte_eth_dev *dev,
 	return 0;
 }
 
+int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
+	struct bnxt_rx_queue *rxq = bp->rx_queues[rx_queue_id];
+	struct bnxt_vnic_info *vnic = NULL;
+
+	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+	rxq->rx_deferred_start = false;
+	PMD_DRV_LOG(INFO, "Rx queue started %d\n", rx_queue_id);
+	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
+		vnic = rxq->vnic;
+		if (vnic->fw_grp_ids[rx_queue_id] != INVALID_HW_RING_ID)
+			return 0;
+		PMD_DRV_LOG(DEBUG, "vnic = %p fw_grp_id = %d\n",
+			vnic, bp->grp_info[rx_queue_id + 1].fw_grp_id);
+		vnic->fw_grp_ids[rx_queue_id] =
+					bp->grp_info[rx_queue_id + 1].fw_grp_id;
+		return bnxt_vnic_rss_configure(bp, vnic);
+	}
+
+	return 0;
+}
+
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
+	struct bnxt_rx_queue *rxq = bp->rx_queues[rx_queue_id];
+	struct bnxt_vnic_info *vnic = NULL;
+
+	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+	rxq->rx_deferred_start = true;
+	PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
+
+	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
+		vnic = rxq->vnic;
+		vnic->fw_grp_ids[rx_queue_id] = INVALID_HW_RING_ID;
+		return bnxt_vnic_rss_configure(bp, vnic);
+	}
+	return 0;
+}
+
 /*
  * Initialization
  */
@@ -3023,6 +3078,10 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.rx_queue_count = bnxt_rx_queue_count_op,
 	.rx_descriptor_status = bnxt_rx_descriptor_status_op,
 	.tx_descriptor_status = bnxt_tx_descriptor_status_op,
+	.rx_queue_start = bnxt_rx_queue_start,
+	.rx_queue_stop = bnxt_rx_queue_stop,
+	.tx_queue_start = bnxt_tx_queue_start,
+	.tx_queue_stop = bnxt_tx_queue_stop,
 	.filter_ctrl = bnxt_filter_ctrl_op,
 	.dev_supported_ptypes_get = bnxt_dev_supported_ptypes_get_op,
 	.get_eeprom_length    = bnxt_get_eeprom_length_op,
drivers/net/bnxt/bnxt_rxq.h +1 -1
index be190195a..6bceee087 100644
@@ -50,6 +50,7 @@ struct bnxt_rx_queue {
 	uint16_t		reg_idx; /* RX queue register index */
 	uint16_t		port_id; /* Device port identifier */
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
+	uint8_t			rx_deferred_start; /* not in global dev start */
 
 	struct bnxt		*bp;
 	int			index;
@@ -75,5 +76,4 @@ int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
 				 uint16_t queue_id);
 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id);
-
 #endif
drivers/net/bnxt/bnxt_rxr.c +4 -0
index 3f07c11b5..9e70c8604 100644
@@ -545,6 +545,10 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
 
+	/* If Rx Q was stopped return */
+	if (rxq->rx_deferred_start)
+		return 0;
+
 	/* Handle RX burst request */
 	while (1) {
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
drivers/net/bnxt/bnxt_rxr.h +2 -1
index a94373d19..f3ed49bd6 100644
@@ -120,5 +120,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 void bnxt_free_rx_rings(struct bnxt *bp);
 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id);
 int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);
-
+int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 #endif
drivers/net/bnxt/bnxt_txq.h +0 -1
index f753c10f2..e27c34fa9 100644
@@ -71,5 +71,4 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			       uint16_t nb_desc,
 			       unsigned int socket_id,
 			       const struct rte_eth_txconf *tx_conf);
-
 #endif
drivers/net/bnxt/bnxt_txr.c +32 -0
index 2f2c87119..2c81a37c2 100644
@@ -349,6 +349,11 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	/* Handle TX completions */
 	bnxt_handle_tx_cp(txq);
 
+	/* Tx queue was stopped; wait for it to be restarted */
+	if (txq->tx_deferred_start) {
+		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
+		return 0;
+	}
 	/* Handle TX burst request */
 	for (nb_tx_pkts = 0; nb_tx_pkts < nb_pkts; nb_tx_pkts++) {
 		if (bnxt_start_xmit(tx_pkts[nb_tx_pkts], txq)) {
@@ -364,3 +369,30 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	return nb_tx_pkts;
 }
+
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+	txq->tx_deferred_start = false;
+	PMD_DRV_LOG(DEBUG, "Tx queue started\n");
+
+	return 0;
+}
+
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	/* Handle TX completions */
+	bnxt_handle_tx_cp(txq);
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+	txq->tx_deferred_start = true;
+	PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
+
+	return 0;
+}
drivers/net/bnxt/bnxt_txr.h +2 -0
index 2feac51db..d88b15ab8 100644
@@ -68,6 +68,8 @@ 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);
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 #define PKT_TX_OIP_IIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
Signature · 1 line
2.14.3 (Apple Git-98)
#30 lore raw

Re: [PATCH 5/5] net/bnxt: Support for rx/tx_queue_start/stop ops

Quoted 6 lines · Ajit Khaparde

Currently this is implemented entirely in the PMD as there is no explicit support in the HW. Re-program the RSS Table without this queue on stop and add it back to the table on start.

<...>

drivers/net/bnxt/bnxt_ethdev.c line 4

Quoted 6 lines
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -1,4 +1,4 @@
-/*-
+/*
  *   BSD LICENSE
  *
  *   Copyright(c) Broadcom Limited.

Unrelated but since I saw this, do you plan switching to the SPDX tags?

<...>

drivers/net/bnxt/bnxt_ethdev.c static int bnxt_init_chip(struct bnxt *bp) · line 337

Quoted 7 lines
drivers/net/bnxt/bnxt_ethdev.c +1 -2
@@ -321,8 +334,7 @@ static int bnxt_init_chip(struct bnxt *bp)
 	     !RTE_ETH_DEV_SRIOV(bp->eth_dev).active) &&
 	    bp->eth_dev->data->dev_conf.intr_conf.rxq != 0) {
 		intr_vector = bp->eth_dev->data->nb_rx_queues;
-		PMD_DRV_LOG(INFO, "%s(): intr_vector = %d\n", __func__,
-			intr_vector);
+		PMD_DRV_LOG(INFO, "intr_vector = %d\n", intr_vector);

With new logging macro "__func__" is duplicate, why not fix them all in the patch 2/5 that introduces new macro?

<...>

Quoted 36 lines
drivers/net/bnxt/bnxt_ethdev.c +32 -0
@@ -2969,6 +2981,49 @@ bnxt_set_eeprom_op(struct rte_eth_dev *dev,
 	return 0;
 }
 
+int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
+	struct bnxt_rx_queue *rxq = bp->rx_queues[rx_queue_id];
+	struct bnxt_vnic_info *vnic = NULL;
+
+	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+	rxq->rx_deferred_start = false;
+	PMD_DRV_LOG(INFO, "Rx queue started %d\n", rx_queue_id);
+	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
+		vnic = rxq->vnic;
+		if (vnic->fw_grp_ids[rx_queue_id] != INVALID_HW_RING_ID)
+			return 0;
+		PMD_DRV_LOG(DEBUG, "vnic = %p fw_grp_id = %d\n",
+			vnic, bp->grp_info[rx_queue_id + 1].fw_grp_id);
+		vnic->fw_grp_ids[rx_queue_id] =
+					bp->grp_info[rx_queue_id + 1].fw_grp_id;
+		return bnxt_vnic_rss_configure(bp, vnic);
+	}
+
+	return 0;
+}
+
+int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
+	struct bnxt_rx_queue *rxq = bp->rx_queues[rx_queue_id];
+	struct bnxt_vnic_info *vnic = NULL;
+
+	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/bnxt/bnxt_ethdev.c bnxt_set_eeprom_op(struct rte_eth_dev *dev, · line 3025

Quoted 10 lines
drivers/net/bnxt/bnxt_ethdev.c +10 -0
+	rxq->rx_deferred_start = true;
+	PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
+
+	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
+		vnic = rxq->vnic;
+		vnic->fw_grp_ids[rx_queue_id] = INVALID_HW_RING_ID;
+		return bnxt_vnic_rss_configure(bp, vnic);
+	}
+	return 0;
+}

There is already a source file "bnxt_rxq.c", which seems for Rxq related functions, why not add new functions there?

<...>

Quoted 21 lines
drivers/net/bnxt/bnxt_txr.c +17 -0
@@ -364,3 +369,30 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	return nb_tx_pkts;
 }
+
+int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+	txq->tx_deferred_start = false;
+	PMD_DRV_LOG(DEBUG, "Tx queue started\n");
+
+	return 0;
+}
+
+int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
+{
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];

drivers/net/bnxt/bnxt_txr.c uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, · line 398

Quoted 10 lines
drivers/net/bnxt/bnxt_txr.c +10 -0
+
+	/* Handle TX completions */
+	bnxt_handle_tx_cp(txq);
+
+	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+	txq->tx_deferred_start = true;
+	PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
+
+	return 0;
+}

Similar question for these functions, they seem implemented in txr (Tx Ring ?) source file, bnxt_txq.c seems better fit, what do you think?

<...>