Skip to contentSkip to conversation

bnxt patchset

PATCH In review Ajit Khaparde 2 participants 73 messages Jun 19, 2018 – Jul 2, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt patchset

Patchset against dpdk-next-net contains bug fixes, some code refactoring and style cleanup.

Please apply.

Ajit Khaparde (15):
net/bnxt: fix clear port stats
net/bnxt: add Tx batching support
net/bnxt: Rx processing optimization
net/bnxt: set min and max descriptor count for Tx and Rx rings net/bnxt: fix dev close operation
net/bnxt: set ring coalesce parameters for Stratus NIC net/bnxt: fix HW Tx checksum offload check
net/bnxt: add support for VF id 0xd800
net/bnxt: fix rx/tx queue start/stop operations net/bnxt: code cleanup style of bnxt vnic
net/bnxt: filter/flow refactoring
net/bnxt: check filter type before clearing it net/bnxt: fix set MTU
net/bnxt: fix incorrect IO address handling in Tx net/bnxt: allocate RSS context only if RSS mode is enabled.

Jay Ding (1):
net/bnxt: check for invalid vnic id

Rob Miller (1):
net/bnxt: update HWRM API to v1.9.2.9

Scott Branden (11):
net/bnxt: code cleanup style of bnxt cpr net/bnxt: code cleanup style of bnxt rxr net/bnxt: code cleanup style of rte pmd bnxt file net/bnxt: code cleanup style of bnxt stats net/bnxt: code cleanup style of bnxt vnic net/bnxt: code cleanup style of bnxt txq net/bnxt: code cleanup style of bnxt rxq net/bnxt: code cleanup style of bnxt txr net/bnxt: code cleanup style of bnxt ring net/bnxt: code cleanup style of bnxt ethdev net/bnxt: move function check zero bytes to bnxt util.h

Somnath Kotur (2):
net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter net/bnxt: fix to move a flow to a different queue

Xiaoxin Peng (1):
net/bnxt: fix Tx with multiple mbuf

 drivers/net/bnxt/Makefile              |    2 +
 drivers/net/bnxt/bnxt.h                |   27 +
 drivers/net/bnxt/bnxt_cpr.c            |   22 +-
 drivers/net/bnxt/bnxt_cpr.h            |   12 +
 drivers/net/bnxt/bnxt_ethdev.c         |  284 +++++---
 drivers/net/bnxt/bnxt_filter.c         | 1090 +----------------------------
 drivers/net/bnxt/bnxt_filter.h         |    1 -
 drivers/net/bnxt/bnxt_flow.c           | 1171 ++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c           |  156 +++--
 drivers/net/bnxt/bnxt_hwrm.h           |    3 +
 drivers/net/bnxt/bnxt_ring.c           |  194 +++++-
 drivers/net/bnxt/bnxt_ring.h           |   41 +-
 drivers/net/bnxt/bnxt_rxq.c            |   76 ++-
 drivers/net/bnxt/bnxt_rxq.h            |   16 +-
 drivers/net/bnxt/bnxt_rxr.c            |   82 ++-
 drivers/net/bnxt/bnxt_rxr.h            |    8 +-
 drivers/net/bnxt/bnxt_stats.c          |   84 ++-
 drivers/net/bnxt/bnxt_stats.h          |   27 +-
 drivers/net/bnxt/bnxt_txq.c            |   24 +-
 drivers/net/bnxt/bnxt_txq.h            |   10 +-
 drivers/net/bnxt/bnxt_txr.c            |  161 +++--
 drivers/net/bnxt/bnxt_txr.h            |   19 +-
 drivers/net/bnxt/bnxt_util.c           |   18 +
 drivers/net/bnxt/bnxt_util.h           |   11 +
 drivers/net/bnxt/bnxt_vnic.c           |   28 +-
 drivers/net/bnxt/bnxt_vnic.h           |    8 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  113 ++-
 drivers/net/bnxt/rte_pmd_bnxt.c        |   97 ++-
 drivers/net/bnxt/rte_pmd_bnxt.h        |   69 +-
 29 files changed, 2314 insertions(+), 1540 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_flow.c
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h
Signature · 1 line
2.15.1 (Apple Git-101)
#1 lore raw

PATCH 1/31 net/bnxt: fix clear port stats

PORT_CLR_STATS is not allowed for VFs, NPAR, MultiHost functions or when SR-IOV is enabled.
Don't send the HWRM command in such cases.

Fixes bfb9c2260be2 ("net/bnxt: support xstats get/reset")
---
 drivers/net/bnxt/bnxt.h      | 4 ++++
 drivers/net/bnxt/bnxt_hwrm.c | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +4 -0
index afaaf8c41..35c3073dd 100644
@@ -98,6 +98,7 @@ struct bnxt_child_vf_info {
 struct bnxt_pf_info {
 #define BNXT_FIRST_PF_FID	1
 #define BNXT_MAX_VFS(bp)	(bp->pf.max_vfs)
+#define BNXT_TOTAL_VFS(bp)	(bp->pf.total_vfs)
 #define BNXT_FIRST_VF_FID	128
 #define BNXT_PF_RINGS_USED(bp)	bnxt_get_num_queues(bp)
 #define BNXT_PF_RINGS_AVAIL(bp)	(bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
@@ -105,6 +106,9 @@ struct bnxt_pf_info {
 	uint16_t		first_vf_id;
 	uint16_t		active_vfs;
 	uint16_t		max_vfs;
+	uint16_t		total_vfs; /* Total VFs possible.
+					    * Not necessarily enabled.
+					    */
 	uint32_t		func_cfg_flags;
 	void			*vf_req_buf;
 	rte_iova_t		vf_req_buf_dma_addr;
drivers/net/bnxt/bnxt_hwrm.c +4 -1
index d6fdc1b88..f441d4610 100644
@@ -506,6 +506,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	if (BNXT_PF(bp)) {
 		bp->pf.port_id = resp->port_id;
 		bp->pf.first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
+		bp->pf.total_vfs = rte_le_to_cpu_16(resp->max_vfs);
 		new_max_vfs = bp->pdev->max_vfs;
 		if (new_max_vfs != bp->pf.max_vfs) {
 			if (bp->pf.vf_info)
@@ -3151,7 +3152,9 @@ int bnxt_hwrm_port_clr_stats(struct bnxt *bp)
 	struct bnxt_pf_info *pf = &bp->pf;
 	int rc;
 
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+	/* Not allowed on NS2 device, NPAR, MultiHost, VF */
+	if (!(bp->flags & BNXT_FLAG_PORT_STATS) || BNXT_VF(bp) ||
+	    BNXT_NPAR(bp) || BNXT_MH(bp) || BNXT_TOTAL_VFS(bp))
 		return 0;
 
 	HWRM_PREP(req, PORT_CLR_STATS);
Signature · 1 line
2.15.1 (Apple Git-101)
#2 lore raw

PATCH 2/31 net/bnxt: add Tx batching support

In reply to Ajit Khaparde

Batch more than one Tx requests such that only one completion is generarted by the HW. We request a Tx completion for first and last Tx request in the batch.

---
 drivers/net/bnxt/bnxt_cpr.h | 12 ++++++
 drivers/net/bnxt/bnxt_txq.h |  1 +
 drivers/net/bnxt/bnxt_txr.c | 97 +++++++++++++++++++++++++++++----------------
 3 files changed, 75 insertions(+), 35 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +12 -0
index 6c1e6d2b0..5b36bf7d7 100644
@@ -22,12 +22,20 @@
 #define ADV_RAW_CMP(idx, n)	((idx) + (n))
 #define NEXT_RAW_CMP(idx)	ADV_RAW_CMP(idx, 1)
 #define RING_CMP(ring, idx)	((idx) & (ring)->ring_mask)
+#define RING_CMPL(ring_mask, idx)	((idx) & (ring_mask))
 #define NEXT_CMP(idx)		RING_CMP(ADV_RAW_CMP(idx, 1))
 #define FLIP_VALID(cons, mask, val)	((cons) >= (mask) ? !(val) : (val))
 
 #define DB_CP_REARM_FLAGS	(DB_KEY_CP | DB_IDX_VALID)
 #define DB_CP_FLAGS		(DB_KEY_CP | DB_IDX_VALID | DB_IRQ_DIS)
 
+#define NEXT_CMPL(cpr, idx, v, inc)	do { \
+	(idx) += (inc); \
+	if (unlikely((idx) == (cpr)->cp_ring_struct->ring_size)) { \
+		(v) = !(v); \
+		idx = 0; \
+	} \
+} while (0)
 #define B_CP_DB_REARM(cpr, raw_cons)					\
 	rte_write32((DB_CP_REARM_FLAGS |				\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
@@ -50,6 +58,10 @@
 	rte_write32((DB_CP_FLAGS |					\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
 		    ((cpr)->cp_doorbell))
+#define B_CP_DB(cpr, raw_cons, ring_mask)				\
+	rte_write32((DB_CP_FLAGS |					\
+		    RING_CMPL((ring_mask), raw_cons)),	\
+		    ((cpr)->cp_doorbell))
 
 struct bnxt_ring;
 struct bnxt_cp_ring_info {
drivers/net/bnxt/bnxt_txq.h +1 -0
index 720ca90cf..f2c712a75 100644
@@ -24,6 +24,7 @@ struct bnxt_tx_queue {
 	uint8_t			wthresh; /* Write-back threshold reg */
 	uint32_t		ctx_curr; /* Hardware context states */
 	uint8_t			tx_deferred_start; /* not in global dev start */
+	uint8_t			cmpl_next; /* Next BD to trigger a compl */
 
 	struct bnxt		*bp;
 	int			index;
drivers/net/bnxt/bnxt_txr.c +62 -35

143 lines not on this page · raw message

Signature · 1 line
2.15.1 (Apple Git-101)
#3 lore raw

PATCH 3/31 net/bnxt: Rx processing optimization

In reply to Ajit Khaparde

1) Use nb_rx_pkts instead of checking producer indices of Rx and aggregator rings to decide if any Rx completions were processed.
2) Post Rx buffers early in Rx processing instead of waiting for the budgeted burst quota.
3) Ring Rx CQ DB after Rx buffers are posted.

---
 drivers/net/bnxt/bnxt_rxr.c | 12 ++++++++----
 drivers/net/bnxt/bnxt_rxr.h |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +8 -4
index 9d8842926..b6b72c553 100644
@@ -540,8 +540,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	int rc = 0;
 	bool evt = false;
 
-	/* If Rx Q was stopped return */
-	if (rxq->rx_deferred_start)
+	/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
+	if (rxq->rx_deferred_start && rxq->queue_id)
 		return 0;
 
 	/* Handle RX burst request */
@@ -572,10 +572,13 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		raw_cons = NEXT_RAW_CMP(raw_cons);
 		if (nb_rx_pkts == nb_pkts || evt)
 			break;
+		/* Post some Rx buf early in case of larger burst processing */
+		if (nb_rx_pkts == BNXT_RX_POST_THRESH)
+			B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 	}
 
 	cpr->cp_raw_cons = raw_cons;
-	if ((prod == rxr->rx_prod && ag_prod == rxr->ag_prod) && !evt) {
+	if (!nb_rx_pkts && !evt) {
 		/*
 		 * For PMD, there is no need to keep on pushing to REARM
 		 * the doorbell if there are no new completions
@@ -583,7 +586,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		return nb_rx_pkts;
 	}
 
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
 	if (prod != rxr->rx_prod)
 		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 
@@ -591,6 +593,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	if (ag_prod != rxr->ag_prod)
 		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
 
+	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
 		int i;
drivers/net/bnxt/bnxt_rxr.h +2 -0
index 5b28f0321..3815a2199 100644
@@ -54,6 +54,8 @@
 #define RX_CMP_IP_CS_UNKNOWN(rxcmp1)					\
 		!((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)
 
+#define BNXT_RX_POST_THRESH	32
+
 enum pkt_hash_types {
 	PKT_HASH_TYPE_NONE,	/* Undefined type */
 	PKT_HASH_TYPE_L2,	/* Input: src_MAC, dest_MAC */
Signature · 1 line
2.15.1 (Apple Git-101)
#4 lore raw

PATCH 4/31 net/bnxt: set min and max descriptor count for Tx and Rx rings

In reply to Ajit Khaparde

Set min and max descriptor count for Tx and Rx rings.

---
 drivers/net/bnxt/bnxt.h        | 3 +++
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++++
 2 files changed, 7 insertions(+)
drivers/net/bnxt/bnxt.h +3 -0
index 35c3073dd..d25bf78af 100644
@@ -24,6 +24,9 @@
 #define VLAN_TAG_SIZE		4
 #define BNXT_MAX_LED		4
 #define BNXT_NUM_VLANS		2
+#define BNXT_MIN_RING_DESC	16
+#define BNXT_MAX_TX_RING_DESC	4096
+#define BNXT_MAX_RX_RING_DESC	8192
 
 struct bnxt_led_info {
 	uint8_t      led_id;
drivers/net/bnxt/bnxt_ethdev.c +4 -0
index 6e56bfd36..33560db0d 100644
@@ -449,6 +449,10 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
 	eth_dev->data->dev_conf.intr_conf.rxq = 1;
+	dev_info->rx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
+	dev_info->rx_desc_lim.nb_max = BNXT_MAX_RX_RING_DESC;
+	dev_info->tx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
+	dev_info->tx_desc_lim.nb_max = BNXT_MAX_TX_RING_DESC;
 
 	/* *INDENT-ON* */
 
Signature · 1 line
2.15.1 (Apple Git-101)
#5 lore raw

PATCH 5/31 net/bnxt: fix dev close operation

In reply to Ajit Khaparde

We are not cleaning up all the memory and also not unregistering the driver during device close operation. This patch fixes the issue.

Fixes 893074951314 (net/bnxt: free memory in close operation)
---
 drivers/net/bnxt/bnxt_ethdev.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +18 -5
index 33560db0d..b3826360c 100644
@@ -152,6 +152,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
+static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
 
 /***********************/
 
@@ -668,6 +669,8 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 		rte_free(bp->grp_info);
 		bp->grp_info = NULL;
 	}
+
+	bnxt_dev_uninit(eth_dev);
 }
 
 static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
@@ -3116,7 +3119,6 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 	return rc;
 }
 
-static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
 
 #define ALLOW_FUNC(x)	\
 	{ \
@@ -3408,13 +3410,15 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 }
 
 static int
-bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
+bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
+{
 	struct bnxt *bp = eth_dev->data->dev_private;
 	int rc;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
+	PMD_DRV_LOG(INFO, "Calling Device uninit\n");
 	bnxt_disable_int(bp);
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp);
@@ -3428,8 +3432,17 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
 	}
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bnxt_free_hwrm_resources(bp);
-	rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
-	rte_memzone_free((const struct rte_memzone *)bp->rx_mem_zone);
+
+	if (bp->tx_mem_zone) {
+		rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
+		bp->tx_mem_zone = NULL;
+	}
+
+	if (bp->rx_mem_zone) {
+		rte_memzone_free((const struct rte_memzone *)bp->rx_mem_zone);
+		bp->rx_mem_zone = NULL;
+	}
+
 	if (bp->dev_stopped == 0)
 		bnxt_dev_close_op(eth_dev);
 	if (bp->pf.vf_info)
@@ -3456,7 +3469,7 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 static struct rte_pci_driver bnxt_rte_pmd = {
 	.id_table = bnxt_pci_id_map,
 	.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
-		RTE_PCI_DRV_INTR_LSC,
+		RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV,
 	.probe = bnxt_pci_probe,
 	.remove = bnxt_pci_remove,
 };
Signature · 1 line
2.15.1 (Apple Git-101)
#6 lore raw

Re: [PATCH 05/31] net/bnxt: fix dev close operation

Quoted 7 lines · Ajit Khaparde

We are not cleaning up all the memory and also not unregistering the driver during device close operation. This patch fixes the issue.

Fixes 893074951314 (net/bnxt: free memory in close operation)

<...>

Quoted 4 lines
drivers/net/bnxt/bnxt_ethdev.c +0 -0
@@ -3408,13 +3410,15 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 }
 
 static int

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

Quoted 10 lines
drivers/net/bnxt/bnxt_ethdev.c +3 -1
-bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
+bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
+{
 	struct bnxt *bp = eth_dev->data->dev_private;
 	int rc;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
+	PMD_DRV_LOG(INFO, "Calling Device uninit\n");

This looks like can be a debug message, what do you think?

<...>

drivers/net/bnxt/bnxt_ethdev.c static int bnxt_pci_remove(struct rte_pci_device *pci_dev) · line 3472

Quoted 6 lines
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -3456,7 +3469,7 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 static struct rte_pci_driver bnxt_rte_pmd = {
 	.id_table = bnxt_pci_id_map,
 	.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
-		RTE_PCI_DRV_INTR_LSC,
+		RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV,

Is Remove interrupts really supported? I can't find the related code in the driver.

You need to call _rte_eth_dev_callback_process() for RTE_ETH_EVENT_INTR_RMV where you handle the interrupt.

And announce the feature "Removal event" in bnxt.ini

#7 lore raw

Re: [PATCH 05/31] net/bnxt: fix dev close operation

Quoted 5 lines
Quoted 2 lines

+ PMD_DRV_LOG(INFO, "Calling Device uninit\n");

This looks like can be a debug message, what do you think?

​Yes. Changed it to debug.
​

Quoted 5 lines

<...>

Review static int bnxt_pci_remove(struct rte_pci_device

Quoted 1 line
(quoted diff) +0 -0
@@ -3456,7 +3469,7 @@ static int bnxt_pci_remove(struct rte_pci_device

*pci_dev)

Quoted 9 lines

drivers/net/bnxt/bnxt_ethdev.c static int bnxt_pci_remove(struct rte_pci_device *pci_dev) · line 3472

Quoted 5 lines
drivers/net/bnxt/bnxt_ethdev.c +1 -1
 static struct rte_pci_driver bnxt_rte_pmd = {
      .id_table = bnxt_pci_id_map,
      .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
-             RTE_PCI_DRV_INTR_LSC,
+             RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV,

Is Remove interrupts really supported? I can't find the related code in the driver.

​That was some left over code. I cleaned it up.

Thanks
​

Quoted 6 lines

You need to call _rte_eth_dev_callback_process() for RTE_ETH_EVENT_INTR_RMV
where you handle the interrupt.

And announce the feature "Removal event" in bnxt.ini

#8 lore raw

PATCH 6/31 net/bnxt: set ring coalesce parameters for Stratus NIC

In reply to Ajit Khaparde

Set ring coalesce parameters for Stratus NIC.
Other skews don't necessarily need this.

---
 drivers/net/bnxt/bnxt.h        | 19 ++++++++++++++++
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++++
 drivers/net/bnxt/bnxt_hwrm.c   | 51 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  2 ++
 drivers/net/bnxt/bnxt_ring.c   | 23 +++++++++++++++++++
 5 files changed, 106 insertions(+)
drivers/net/bnxt/bnxt.h +19 -0
index d25bf78af..bd8d031de 100644
@@ -28,6 +28,14 @@
 #define BNXT_MAX_TX_RING_DESC	4096
 #define BNXT_MAX_RX_RING_DESC	8192
 
+#define BNXT_INT_LAT_TMR_MIN			75
+#define BNXT_INT_LAT_TMR_MAX			150
+#define BNXT_NUM_CMPL_AGGR_INT			36
+#define BNXT_CMPL_AGGR_DMA_TMR			37
+#define BNXT_NUM_CMPL_DMA_AGGR			36
+#define BNXT_CMPL_AGGR_DMA_TMR_DURING_INT	50
+#define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT	12
+
 struct bnxt_led_info {
 	uint8_t      led_id;
 	uint8_t      led_type;
@@ -209,6 +217,16 @@ struct bnxt_ptp_cfg {
 	uint32_t			tx_mapped_regs[BNXT_PTP_TX_REGS];
 };
 
+struct bnxt_coal {
+	uint16_t			num_cmpl_aggr_int;
+	uint16_t			num_cmpl_dma_aggr;
+	uint16_t			num_cmpl_dma_aggr_during_int;
+	uint16_t			int_lat_tmr_max;
+	uint16_t			int_lat_tmr_min;
+	uint16_t			cmpl_aggr_dma_tmr;
+	uint16_t			cmpl_aggr_dma_tmr_during_int;
+};
+
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
 struct bnxt {
 	void				*bar0;
@@ -315,6 +333,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
 int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 bool is_bnxt_supported(struct rte_eth_dev *dev);
+bool bnxt_stratus_device(struct bnxt *bp);
 extern const struct rte_flow_ops bnxt_flow_ops;
 
 extern int bnxt_logtype_driver;
drivers/net/bnxt/bnxt_ethdev.c +11 -0
index b3826360c..1b52425e6 100644
@@ -3073,6 +3073,17 @@ static bool bnxt_vf_pciid(uint16_t id)
 	return false;
 }
 
+bool bnxt_stratus_device(struct bnxt *bp)
+{
+	uint16_t id = bp->pdev->id.device_id;
+
+	if (id == BROADCOM_DEV_ID_STRATUS_NIC ||
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF1 ||
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2)
+		return true;
+	return false;
+}
+
 static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
drivers/net/bnxt/bnxt_hwrm.c +51 -0

54 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 60a4ab16a..b83aab306 100644
@@ -167,4 +167,6 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
 int bnxt_hwrm_ptp_cfg(struct bnxt *bp);
 int bnxt_vnic_rss_configure(struct bnxt *bp,
 			    struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
+			struct bnxt_coal *coal, uint16_t ring_id);
 #endif
drivers/net/bnxt/bnxt_ring.c +23 -0
index bb9f6d1c0..81eb89d74 100644
@@ -258,6 +258,24 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	return 0;
 }
 
+static void bnxt_init_dflt_coal(struct bnxt_coal *coal)
+{
+	/* Tick values in micro seconds.
+	 * 1 coal_buf x bufs_per_record = 1 completion record.
+	 */
+	coal->num_cmpl_aggr_int = BNXT_NUM_CMPL_AGGR_INT;
+	/* This is a 6-bit value and must not be 0, or we'll get non stop IRQ */
+	coal->num_cmpl_dma_aggr = BNXT_NUM_CMPL_DMA_AGGR;
+	/* This is a 6-bit value and must not be 0, or we'll get non stop IRQ */
+	coal->num_cmpl_dma_aggr_during_int = BNXT_NUM_CMPL_DMA_AGGR_DURING_INT;
+	coal->int_lat_tmr_max = BNXT_INT_LAT_TMR_MAX;
+	/* min timer set to 1/2 of interrupt timer */
+	coal->int_lat_tmr_min = BNXT_INT_LAT_TMR_MIN;
+	/* buf timer set to 1/4 of interrupt timer */
+	coal->cmpl_aggr_dma_tmr = BNXT_CMPL_AGGR_DMA_TMR;
+	coal->cmpl_aggr_dma_tmr_during_int = BNXT_CMPL_AGGR_DMA_TMR_DURING_INT;
+}
+
 /* ring_grp usage:
  * [0] = default completion ring
  * [1 -> +rx_cp_nr_rings] = rx_cp, rx rings
@@ -265,9 +283,12 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
  */
 int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 {
+	struct bnxt_coal coal;
 	unsigned int i;
 	int rc = 0;
 
+	bnxt_init_dflt_coal(&coal);
+
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
@@ -291,6 +312,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		cpr->cp_doorbell = (char *)bp->doorbell_base + i * 0x80;
 		bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id;
 		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 
 		if (!i) {
 			/*
@@ -379,6 +401,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 
 		txr->tx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
 		txq->index = idx;
+		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 	}
 
 err_out:
Signature · 1 line
2.15.1 (Apple Git-101)
#9 lore raw

PATCH 7/31 net/bnxt: fix HW Tx checksum offload check

In reply to Ajit Khaparde

Add more checks for checksum calculation offload. Also check for tunnel frames and select the proper buffer descriptor size.

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_txr.h | 10 +++++++++
 2 files changed, 58 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_txr.c +48 -3
index 0fdf0fd08..68645b2f7 100644
@@ -135,7 +135,9 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 
 	if (tx_pkt->ol_flags & (PKT_TX_TCP_SEG | PKT_TX_TCP_CKSUM |
 				PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM |
-				PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM))
+				PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM |
+				PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN |
+				PKT_TX_TUNNEL_GENEVE))
 		long_bd = true;
 
 	tx_buf = &txr->tx_buf_ring[txr->tx_prod];
@@ -203,16 +205,46 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 			/* Outer IP, Inner IP, Inner TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_CKSUM) ==
+			   PKT_TX_OIP_IIP_TCP_CKSUM) {
+			/* Outer IP, Inner IP, Inner TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_UDP_CKSUM) ==
+			   PKT_TX_OIP_IIP_UDP_CKSUM) {
+			/* Outer IP, Inner IP, Inner TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
 		} else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_UDP_CKSUM) ==
 			   PKT_TX_IIP_TCP_UDP_CKSUM) {
 			/* (Inner) IP, (Inner) TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_IIP_UDP_CKSUM) ==
+			   PKT_TX_IIP_UDP_CKSUM) {
+			/* (Inner) IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_CKSUM) ==
+			   PKT_TX_IIP_TCP_CKSUM) {
+			/* (Inner) IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
 		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_UDP_CKSUM) ==
 			   PKT_TX_OIP_TCP_UDP_CKSUM) {
 			/* Outer IP, (Inner) TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_UDP_CKSUM) ==
+			   PKT_TX_OIP_UDP_CKSUM) {
+			/* Outer IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_CKSUM) ==
+			   PKT_TX_OIP_TCP_CKSUM) {
+			/* Outer IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
 		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_CKSUM) ==
 			   PKT_TX_OIP_IIP_CKSUM) {
 			/* Outer IP, Inner IP CSO */
@@ -223,11 +255,23 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 			/* TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
-		} else if (tx_pkt->ol_flags & PKT_TX_IP_CKSUM) {
+		} else if ((tx_pkt->ol_flags & PKT_TX_TCP_CKSUM) ==
+			   PKT_TX_TCP_CKSUM) {
+			/* TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_UDP_CKSUM) ==
+			   PKT_TX_UDP_CKSUM) {
+			/* TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_IP_CKSUM) ==
+			   PKT_TX_IP_CKSUM) {
 			/* IP CSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
 			txbd1->mss = 0;
-		} else if (tx_pkt->ol_flags & PKT_TX_OUTER_IP_CKSUM) {
+		} else if ((tx_pkt->ol_flags & PKT_TX_OUTER_IP_CKSUM) ==
+			   PKT_TX_OUTER_IP_CKSUM) {
 			/* IP CSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_T_IP_CHKSUM;
 			txbd1->mss = 0;
@@ -251,6 +295,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	}
 
 	txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
+	txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags);
 
 	txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
 
drivers/net/bnxt/bnxt_txr.h +10 -0
index 15c7e5a09..7f3c7cdb0 100644
@@ -45,10 +45,20 @@ 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)
+#define PKT_TX_OIP_IIP_UDP_CKSUM	(PKT_TX_UDP_CKSUM | \
+					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
+#define PKT_TX_OIP_IIP_TCP_CKSUM	(PKT_TX_TCP_CKSUM | \
+					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_IIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_IP_CKSUM)
+#define PKT_TX_IIP_TCP_CKSUM		(PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM)
+#define PKT_TX_IIP_UDP_CKSUM		(PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM)
 #define PKT_TX_OIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_OUTER_IP_CKSUM)
+#define PKT_TX_OIP_UDP_CKSUM		(PKT_TX_UDP_CKSUM | \
+					PKT_TX_OUTER_IP_CKSUM)
+#define PKT_TX_OIP_TCP_CKSUM		(PKT_TX_TCP_CKSUM | \
+					PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_OIP_IIP_CKSUM		(PKT_TX_IP_CKSUM |	\
 					 PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_TCP_UDP_CKSUM		(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM)
Signature · 1 line
2.15.1 (Apple Git-101)
#10 lore raw

PATCH 8/31 net/bnxt: add support for VF id 0xd800

In reply to Ajit Khaparde

Add support for StingRay VF device 0xd800

---
 drivers/net/bnxt/bnxt_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -1
index 1b52425e6..5d7f29cf4 100644
@@ -73,6 +73,7 @@ int bnxt_logtype_driver;
 #define BROADCOM_DEV_ID_58802 0xd802
 #define BROADCOM_DEV_ID_58804 0xd804
 #define BROADCOM_DEV_ID_58808 0x16f0
+#define BROADCOM_DEV_ID_58802_VF 0xd800
 
 static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
@@ -116,6 +117,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58802) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58804) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58808) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58802_VF) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
@@ -3068,7 +3070,8 @@ static bool bnxt_vf_pciid(uint16_t id)
 	    id == BROADCOM_DEV_ID_5741X_VF ||
 	    id == BROADCOM_DEV_ID_57414_VF ||
 	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF1 ||
-	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2)
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2 ||
+	    id == BROADCOM_DEV_ID_58802_VF)
 		return true;
 	return false;
 }
Signature · 1 line
2.15.1 (Apple Git-101)
#11 lore raw

Re: [PATCH 08/31] net/bnxt: add support for VF id 0xd800

Quoted 1 line · Ajit Khaparde

Add support for StingRay VF device 0xd800

Can you please document new supported device on doc/guides/nics/bnxt.rst

Quoted 36 lines
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -1
index 1b52425e6..5d7f29cf4 100644
@@ -73,6 +73,7 @@ int bnxt_logtype_driver;
 #define BROADCOM_DEV_ID_58802 0xd802
 #define BROADCOM_DEV_ID_58804 0xd804
 #define BROADCOM_DEV_ID_58808 0x16f0
+#define BROADCOM_DEV_ID_58802_VF 0xd800
 
 static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
@@ -116,6 +117,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58802) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58804) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58808) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58802_VF) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
@@ -3068,7 +3070,8 @@ static bool bnxt_vf_pciid(uint16_t id)
 	    id == BROADCOM_DEV_ID_5741X_VF ||
 	    id == BROADCOM_DEV_ID_57414_VF ||
 	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF1 ||
-	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2)
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2 ||
+	    id == BROADCOM_DEV_ID_58802_VF)
 		return true;
 	return false;
 }
#12 lore raw

Re: [PATCH 08/31] net/bnxt: add support for VF id 0xd800

Quoted 5 lines · Ferruh Yigit
Quoted 1 line · Ajit Khaparde

Add support for StingRay VF device 0xd800

Can you please document new supported device on doc/guides/nics/bnxt.rst

I think we don't need it. ​We are just adding another VF device id. The actual device family is already listed in the document.

#13 lore raw

PATCH 9/31 net/bnxt: fix rx/tx queue start/stop operations

In reply to Ajit Khaparde

Packets destined to the to-be-stopped queue should not be dropped (neither in HW nor in the driver), so re-program the RSS Table without this queue on stop and add it back to the table on start unless it is a Representor VF.

Since 0th entry is used for default ring, use fw_grp_id + 1 to change the RSS table population logic by programming valid IDs instead of the default zeroth entry in case of an invalid fw_grp_id.

Destroy and recreate the trio of Rx rings(compl, Rx, AG) every time in start so that HW is in sync with software.

Fixes 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 10 ++++-
 drivers/net/bnxt/bnxt_hwrm.c   | 94 +++++++++++++++++++-----------------------
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 drivers/net/bnxt/bnxt_ring.c   | 92 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_ring.h   |  1 +
 drivers/net/bnxt/bnxt_rxq.c    | 54 +++++++++++++++++++-----
 drivers/net/bnxt/bnxt_rxq.h    |  4 ++
 drivers/net/bnxt/bnxt_rxr.c    | 14 +++++--
 9 files changed, 204 insertions(+), 67 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index bd8d031de..f92e98d83 100644
@@ -27,6 +27,7 @@
 #define BNXT_MIN_RING_DESC	16
 #define BNXT_MAX_TX_RING_DESC	4096
 #define BNXT_MAX_RX_RING_DESC	8192
+#define BNXT_DB_SIZE		0x80
 
 #define BNXT_INT_LAT_TMR_MIN			75
 #define BNXT_INT_LAT_TMR_MAX			150
drivers/net/bnxt/bnxt_ethdev.c +9 -1
index 5d7f29cf4..d66a29758 100644
@@ -198,13 +198,14 @@ static int bnxt_alloc_mem(struct bnxt *bp)
 
 static int bnxt_init_chip(struct bnxt *bp)
 {
-	unsigned int i;
+	struct bnxt_rx_queue *rxq;
 	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;
 	uint32_t intr_vector = 0;
 	uint32_t queue_id, base = BNXT_MISC_VEC_ID;
 	uint32_t vec = BNXT_MISC_VEC_ID;
+	unsigned int i, j;
 	int rc;
 
 	/* disable uio/vfio intr/eventfd mapping */
@@ -278,6 +279,13 @@ static int bnxt_init_chip(struct bnxt *bp)
 			goto err_out;
 		}
 
+		for (j = 0; j < bp->rx_nr_rings; j++) {
+			rxq = bp->eth_dev->data->rx_queues[j];
+
+			if (rxq->rx_deferred_start)
+				rxq->vnic->fw_grp_ids[j] = INVALID_HW_RING_ID;
+		}
+
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 		if (rc) {
 			PMD_DRV_LOG(ERR,
drivers/net/bnxt/bnxt_hwrm.c +42 -52

126 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +1 -0
index b83aab306..4a237c4b4 100644
@@ -107,6 +107,7 @@ int bnxt_set_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_clear_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 void bnxt_free_all_hwrm_resources(struct bnxt *bp);
 void bnxt_free_hwrm_resources(struct bnxt *bp);
+void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_resources(struct bnxt *bp);
 int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link);
 int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up);
drivers/net/bnxt/bnxt_ring.c +92 -0

98 lines not on this page · raw message

drivers/net/bnxt/bnxt_ring.h +1 -0
index 65bf3e2f5..1446d784f 100644
@@ -70,6 +70,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 			    struct bnxt_rx_queue *rxq,
 			    struct bnxt_cp_ring_info *cp_ring_info,
 			    const char *suffix);
+int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_rings(struct bnxt *bp);
 
 #endif
drivers/net/bnxt/bnxt_rxq.c +44 -10

115 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxq.h +4 -0
index 8307f603c..e5d6001d3 100644
@@ -10,6 +10,9 @@ struct bnxt;
 struct bnxt_rx_ring_info;
 struct bnxt_cp_ring_info;
 struct bnxt_rx_queue {
+	rte_spinlock_t		lock;	/* Synchronize between rx_queue_stop
+					 * and fast path
+					 */
 	struct rte_mempool	*mb_pool; /* mbuf pool for RX ring */
 	struct rte_mbuf		*pkt_first_seg; /* 1st seg of pkt */
 	struct rte_mbuf		*pkt_last_seg; /* Last seg of pkt */
@@ -54,4 +57,5 @@ 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);
+void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq);
 #endif
drivers/net/bnxt/bnxt_rxr.c +10 -4
index b6b72c553..e4d473f4b 100644
@@ -541,7 +541,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	bool evt = false;
 
 	/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
-	if (rxq->rx_deferred_start && rxq->queue_id)
+	if (unlikely(((rxq->rx_deferred_start || !rte_spinlock_trylock(&rxq->lock)) && rxq->queue_id)))
 		return 0;
 
 	/* Handle RX burst request */
@@ -583,7 +583,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * For PMD, there is no need to keep on pushing to REARM
 		 * the doorbell if there are no new completions
 		 */
-		return nb_rx_pkts;
+		goto done;
 	}
 
 	if (prod != rxr->rx_prod)
@@ -618,16 +618,22 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		}
 	}
 
+done:
+	rte_spinlock_unlock(&rxq->lock);
+
 	return nb_rx_pkts;
 }
 
 void bnxt_free_rx_rings(struct bnxt *bp)
 {
 	int i;
+	struct bnxt_rx_queue *rxq;
 
-	for (i = 0; i < (int)bp->rx_nr_rings; i++) {
-		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
+	if (!bp->rx_queues)
+		return;
 
+	for (i = 0; i < (int)bp->rx_nr_rings; i++) {
+		rxq = bp->rx_queues[i];
 		if (!rxq)
 			continue;
 
Signature · 1 line
2.15.1 (Apple Git-101)
#14 lore raw

PATCH 10/31 net/bnxt: code cleanup style of bnxt cpr

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_cpr

---
 drivers/net/bnxt/bnxt_cpr.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +10 -12
index ff20b6fdf..7257bbedc 100644
@@ -74,12 +74,12 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	fwd_cmd = (struct input *)bp->pf.vf_info[vf_id].req_buf;
 
 	if (fw_vf_id < bp->pf.first_vf_id ||
-	    fw_vf_id >= (bp->pf.first_vf_id) + bp->pf.active_vfs) {
+	    fw_vf_id >= bp->pf.first_vf_id + bp->pf.active_vfs) {
 		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,
-			bp->pf.first_vf_id, bp->pf.active_vfs);
+			    "FWD req 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,
+			    bp->pf.first_vf_id, bp->pf.active_vfs);
 		goto reject;
 	}
 
@@ -95,7 +95,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 			if (vfc->enables &
 			    HWRM_FUNC_VF_CFG_INPUT_ENABLES_DFLT_MAC_ADDR) {
 				bnxt_hwrm_func_vf_mac(bp, vf_id,
-				(const uint8_t *)"\x00\x00\x00\x00\x00");
+				     (const uint8_t *)"\x00\x00\x00\x00\x00");
 			}
 		}
 		if (fwd_cmd->req_type == HWRM_CFA_L2_SET_RX_MASK) {
@@ -104,10 +104,10 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 
 			srm->vlan_tag_tbl_addr = rte_cpu_to_le_64(0);
 			srm->num_vlan_tags = rte_cpu_to_le_32(0);
-			srm->mask &= ~rte_cpu_to_le_32(
-				HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY |
-			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN |
-			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN);
+			srm->mask &= ~rte_cpu_to_le_32
+			  (HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY |
+			   HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN |
+			   HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN);
 		}
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
@@ -128,8 +128,6 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 			fw_vf_id - bp->pf.first_vf_id,
 			rte_le_to_cpu_16(fwd_cmd->req_type));
 	}
-
-	return;
 }
 
 int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
Signature · 1 line
2.15.1 (Apple Git-101)
#15 lore raw

PATCH 11/31 net/bnxt: code cleanup style of bnxt rxr

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_rxr

---
 drivers/net/bnxt/bnxt_rxr.c | 58 ++++++++++++++++++++++++---------------------
 drivers/net/bnxt/bnxt_rxr.h |  6 +++--
 2 files changed, 35 insertions(+), 29 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +31 -27
index e4d473f4b..13928c388 100644
@@ -72,7 +72,6 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	if (rx_buf == NULL)
 		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
 
-
 	rx_buf->mbuf = mbuf;
 	mbuf->data_off = RTE_PKTMBUF_HEADROOM;
 
@@ -82,7 +81,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 }
 
 static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
-			       struct rte_mbuf *mbuf)
+				      struct rte_mbuf *mbuf)
 {
 	uint16_t prod = RING_NEXT(rxr->rx_ring_struct, rxr->rx_prod);
 	struct bnxt_sw_rx_bd *prod_rx_buf;
@@ -185,7 +184,8 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
 }
 
 static int bnxt_agg_bufs_valid(struct bnxt_cp_ring_info *cpr,
-		uint8_t agg_bufs, uint32_t raw_cp_cons)
+			       uint8_t agg_bufs,
+			       uint32_t raw_cp_cons)
 {
 	uint16_t last_cp_cons;
 	struct rx_pkt_cmpl *agg_cmpl;
@@ -236,8 +236,7 @@ static int bnxt_rx_pages(struct bnxt_rx_queue *rxq,
 		struct rte_mbuf *ag_mbuf;
 		*tmp_raw_cons = NEXT_RAW_CMP(*tmp_raw_cons);
 		cp_cons = RING_CMP(cpr->cp_ring_struct, *tmp_raw_cons);
-		rxcmp = (struct rx_pkt_cmpl *)
-					&cpr->cp_desc_ring[cp_cons];
+		rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cp_cons];
 
 #ifdef BNXT_DEBUG
 		bnxt_dump_cmpl(cp_cons, rxcmp);
@@ -270,11 +269,11 @@ static int bnxt_rx_pages(struct bnxt_rx_queue *rxq,
 	return 0;
 }
 
-static inline struct rte_mbuf *bnxt_tpa_end(
-		struct bnxt_rx_queue *rxq,
-		uint32_t *raw_cp_cons,
-		struct rx_tpa_end_cmpl *tpa_end,
-		struct rx_tpa_end_cmpl_hi *tpa_end1 __rte_unused)
+static inline
+struct rte_mbuf *bnxt_tpa_end(struct bnxt_rx_queue *rxq,
+			      uint32_t *raw_cp_cons,
+			      struct rx_tpa_end_cmpl *tpa_end,
+			      struct rx_tpa_end_cmpl_hi *tpa_end1 __rte_unused)
 {
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
@@ -299,6 +298,7 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 	mbuf->l4_len = tpa_end->payload_offset;
 
 	struct rte_mbuf *new_data = __bnxt_alloc_rx_data(rxq->mb_pool);
+
 	RTE_ASSERT(new_data != NULL);
 	if (!new_data) {
 		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
@@ -368,7 +368,8 @@ bnxt_parse_pkt_type(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1)
 }
 
 static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
-			    struct bnxt_rx_queue *rxq, uint32_t *raw_cons)
+		       struct bnxt_rx_queue *rxq,
+		       uint32_t *raw_cons)
 {
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
@@ -401,14 +402,16 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 
 	cmp_type = CMP_TYPE(rxcmp);
 	if (cmp_type == RX_TPA_START_CMPL_TYPE_RX_TPA_START) {
-		bnxt_tpa_start(rxq, (struct rx_tpa_start_cmpl *)rxcmp,
+		bnxt_tpa_start(rxq,
+			       (struct rx_tpa_start_cmpl *)rxcmp,
 			       (struct rx_tpa_start_cmpl_hi *)rxcmp1);
 		rc = -EINVAL; /* Continue w/o new mbuf */
 		goto next_rx;
 	} else if (cmp_type == RX_TPA_END_CMPL_TYPE_RX_TPA_END) {
-		mbuf = bnxt_tpa_end(rxq, &tmp_raw_cons,
-				   (struct rx_tpa_end_cmpl *)rxcmp,
-				   (struct rx_tpa_end_cmpl_hi *)rxcmp1);
+		mbuf = bnxt_tpa_end(rxq,
+				    &tmp_raw_cons,
+				    (struct rx_tpa_end_cmpl *)rxcmp,
+				    (struct rx_tpa_end_cmpl_hi *)rxcmp1);
 		if (unlikely(!mbuf))
 			return -EBUSY;
 		*rx_pkt = mbuf;
@@ -525,8 +528,9 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	return rc;
 }
 
-uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
-			       uint16_t nb_pkts)
+uint16_t bnxt_recv_pkts(void *rx_queue,
+			struct rte_mbuf **rx_pkts,
+			uint16_t nb_pkts)
 {
 	struct bnxt_rx_queue *rxq = rx_queue;
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
@@ -674,8 +678,8 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 	rxq->rx_ring = rxr;
 
 	ring = rte_zmalloc_socket("bnxt_rx_ring_struct",
-				   sizeof(struct bnxt_ring),
-				   RTE_CACHE_LINE_SIZE, socket_id);
+				  sizeof(struct bnxt_ring),
+				  RTE_CACHE_LINE_SIZE, socket_id);
 	if (ring == NULL)
 		return -ENOMEM;
 	rxr->rx_ring_struct = ring;
@@ -694,8 +698,8 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 	rxq->cp_ring = cpr;
 
 	ring = rte_zmalloc_socket("bnxt_rx_ring_struct",
-				   sizeof(struct bnxt_ring),
-				   RTE_CACHE_LINE_SIZE, socket_id);
+				  sizeof(struct bnxt_ring),
+				  RTE_CACHE_LINE_SIZE, socket_id);
 	if (ring == NULL)
 		return -ENOMEM;
 	cpr->cp_ring_struct = ring;
@@ -709,8 +713,8 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 
 	/* Allocate Aggregator rings */
 	ring = rte_zmalloc_socket("bnxt_rx_ring_struct",
-				   sizeof(struct bnxt_ring),
-				   RTE_CACHE_LINE_SIZE, socket_id);
+				  sizeof(struct bnxt_ring),
+				  RTE_CACHE_LINE_SIZE, socket_id);
 	if (ring == NULL)
 		return -ENOMEM;
 	rxr->ag_ring_struct = ring;
@@ -762,8 +766,8 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	for (i = 0; i < ring->ring_size; i++) {
 		if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
 			PMD_DRV_LOG(WARNING,
-				"init'ed rx ring %d with %d/%d mbufs only\n",
-				rxq->queue_id, i, ring->ring_size);
+				    "rx ring %d only has %d/%d mbufs\n",
+				    rxq->queue_id, i, ring->ring_size);
 			break;
 		}
 		rxr->rx_prod = prod;
@@ -778,8 +782,8 @@ 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) {
 			PMD_DRV_LOG(WARNING,
-			"init'ed AG ring %d with %d/%d mbufs only\n",
-			rxq->queue_id, i, ring->ring_size);
+				    "AG ring %d only has %d/%d mbufs\n",
+				    rxq->queue_id, i, ring->ring_size);
 			break;
 		}
 		rxr->ag_prod = prod;
drivers/net/bnxt/bnxt_rxr.h +4 -2
index 3815a2199..c8ba22ee1 100644
@@ -103,8 +103,10 @@ struct bnxt_rx_ring_info {
 	struct bnxt_tpa_info *tpa_info;
 };
 
-uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
-			       uint16_t nb_pkts);
+uint16_t bnxt_recv_pkts(void *rx_queue,
+			struct rte_mbuf **rx_pkts,
+			uint16_t nb_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);
Signature · 1 line
2.15.1 (Apple Git-101)
#16 lore raw

Re: [PATCH 11/31] net/bnxt: code cleanup style of bnxt rxr

Quoted 25 lines · Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_rxr

---
 drivers/net/bnxt/bnxt_rxr.c | 58 ++++++++++++++++++++++++---------------------
 drivers/net/bnxt/bnxt_rxr.h |  6 +++--
 2 files changed, 35 insertions(+), 29 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -1
index e4d473f4b..13928c388 100644
@@ -72,7 +72,6 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	if (rx_buf == NULL)
 		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
 
-
 	rx_buf->mbuf = mbuf;
 	mbuf->data_off = RTE_PKTMBUF_HEADROOM;
 

drivers/net/bnxt/bnxt_rxr.c static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq, · line 84

Quoted 5 lines
drivers/net/bnxt/bnxt_rxr.c +1 -1
@@ -82,7 +81,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 }
 
 static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
-			       struct rte_mbuf *mbuf)
+				      struct rte_mbuf *mbuf)

Hi Scott,

Since this patch is only for syntax updates, should we expect this to follow DPDK coding convention [1]?

It seems you have align new line to parenthesis but according dpdk coding style new line should have a tab:
http://doc.dpdk.org/guides/contributing/coding_style.html#definitions

This is same for other syntax fix patches.

Note: The coding style discussion is never to end and I don't have any intention to have one, I believe what matters is consistency, please check coding style documentation before sending syntax fix patches.

Also I believe syntax fix patches are not best idea, unless it is fixing a real readability issue. It corrupts the git history and makes harder to backport fixes. Specially when it is not contributing the consistency as well I suggest dropping the patch.

[1]
http://doc.dpdk.org/guides/contributing/coding_style.html

#17 lore raw

PATCH 12/31 net/bnxt: code cleanup style of rte pmd bnxt file

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of rte_pmd_bnxt

---
 drivers/net/bnxt/rte_pmd_bnxt.c | 97 +++++++++++++++++++++++++----------------
 drivers/net/bnxt/rte_pmd_bnxt.h | 69 +++++++++++++++++++----------
 2 files changed, 105 insertions(+), 61 deletions(-)
drivers/net/bnxt/rte_pmd_bnxt.c +60 -37
index c298de83c..e49dba465 100644
@@ -77,6 +77,7 @@ static void
 rte_pmd_bnxt_set_all_queues_drop_en_cb(struct bnxt_vnic_info *vnic, void *onptr)
 {
 	uint8_t *on = onptr;
+
 	vnic->bd_stall = !(*on);
 }
 
@@ -119,9 +120,12 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on)
 
 	/* Stall all active VFs */
 	for (i = 0; i < bp->pf.active_vfs; i++) {
-		rc = bnxt_hwrm_func_vf_vnic_query_and_config(bp, i,
-				rte_pmd_bnxt_set_all_queues_drop_en_cb, &on,
-				bnxt_hwrm_vnic_cfg);
+		rc = bnxt_hwrm_func_vf_vnic_query_and_config
+				(bp,
+				 i,
+				 rte_pmd_bnxt_set_all_queues_drop_en_cb,
+				 &on,
+				 bnxt_hwrm_vnic_cfg);
 		if (rc) {
 			PMD_DRV_LOG(ERR, "Failed to update VF VNIC %d.\n", i);
 			break;
@@ -131,8 +135,9 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on)
 	return rc;
 }
 
-int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
-				struct ether_addr *mac_addr)
+int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port,
+				 uint16_t vf,
+				 struct ether_addr *mac_addr)
 {
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
@@ -163,8 +168,10 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
 	return rc;
 }
 
-int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
-				uint16_t tx_rate, uint64_t q_msk)
+int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port,
+				   uint16_t vf,
+				   uint16_t tx_rate,
+				   uint64_t q_msk)
 {
 	struct rte_eth_dev *eth_dev;
 	struct rte_eth_dev_info dev_info;
@@ -205,7 +212,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
 		return 0;
 
 	rc = bnxt_hwrm_func_bw_cfg(bp, vf, tot_rate,
-				HWRM_FUNC_CFG_INPUT_ENABLES_MAX_BW);
+				   HWRM_FUNC_CFG_INPUT_ENABLES_MAX_BW);
 
 	if (!rc)
 		bp->pf.vf_info[vf].max_tx_rate = tot_rate;
@@ -247,8 +254,9 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 		return 0;
 
 	func_flags = bp->pf.vf_info[vf].func_cfg_flags;
-	func_flags &= ~(HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE |
-	    HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE);
+	func_flags &=
+	  ~(HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE |
+	   HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE);
 
 	if (on)
 		func_flags |=
@@ -298,10 +306,11 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (!rc) {
 		bp->pf.vf_info[vf].vlan_spoof_en = on;
 		if (on) {
-			if (bnxt_hwrm_cfa_vlan_antispoof_cfg(bp,
-				bp->pf.first_vf_id + vf,
-				bp->pf.vf_info[vf].vlan_count,
-				bp->pf.vf_info[vf].vlan_as_table))
+			if (bnxt_hwrm_cfa_vlan_antispoof_cfg
+					(bp,
+					 bp->pf.first_vf_id + vf,
+					 bp->pf.vf_info[vf].vlan_count,
+					 bp->pf.vf_info[vf].vlan_as_table))
 				rc = -1;
 		}
 	} else {
@@ -315,6 +324,7 @@ static void
 rte_pmd_bnxt_set_vf_vlan_stripq_cb(struct bnxt_vnic_info *vnic, void *onptr)
 {
 	uint8_t *on = onptr;
+
 	vnic->vlan_strip = *on;
 }
 
@@ -345,17 +355,22 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 		return -ENOTSUP;
 	}
 
-	rc = bnxt_hwrm_func_vf_vnic_query_and_config(bp, vf,
-				rte_pmd_bnxt_set_vf_vlan_stripq_cb, &on,
-				bnxt_hwrm_vnic_cfg);
+	rc = bnxt_hwrm_func_vf_vnic_query_and_config
+					(bp,
+					 vf,
+					 rte_pmd_bnxt_set_vf_vlan_stripq_cb,
+					 &on,
+					 bnxt_hwrm_vnic_cfg);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Failed to update VF VNIC %d.\n", vf);
 
 	return rc;
 }
 
-int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
-				uint16_t rx_mask, uint8_t on)
+int rte_pmd_bnxt_set_vf_rxmode(uint16_t port,
+			       uint16_t vf,
+			       uint16_t rx_mask,
+			       uint8_t on)
 {
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
@@ -397,10 +412,12 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
 	else
 		bp->pf.vf_info[vf].l2_rx_mask &= ~flag;
 
-	rc = bnxt_hwrm_func_vf_vnic_query_and_config(bp, vf,
-					vf_vnic_set_rxmask_cb,
-					&bp->pf.vf_info[vf].l2_rx_mask,
-					bnxt_set_rx_mask_no_vlan);
+	rc = bnxt_hwrm_func_vf_vnic_query_and_config
+					(bp,
+					 vf,
+					 vf_vnic_set_rxmask_cb,
+					 &bp->pf.vf_info[vf].l2_rx_mask,
+					 bnxt_set_rx_mask_no_vlan);
 	if (rc)
 		PMD_DRV_LOG(ERR, "bnxt_hwrm_func_vf_vnic_set_rxmask failed\n");
 
@@ -433,9 +450,11 @@ static int bnxt_set_vf_table(struct bnxt *bp, uint16_t vf)
 		vnic.fw_vnic_id = dflt_vnic;
 		if (bnxt_hwrm_vnic_qcfg(bp, &vnic,
 					bp->pf.first_vf_id + vf) == 0) {
-			if (bnxt_hwrm_cfa_l2_set_rx_mask(bp, &vnic,
-						bp->pf.vf_info[vf].vlan_count,
-						bp->pf.vf_info[vf].vlan_table))
+			if (bnxt_hwrm_cfa_l2_set_rx_mask
+						(bp,
+						 &vnic,
+						 bp->pf.vf_info[vf].vlan_count,
+						 bp->pf.vf_info[vf].vlan_table))
 				rc = -1;
 		} else {
 			rc = -1;
@@ -445,8 +464,10 @@ static int bnxt_set_vf_table(struct bnxt *bp, uint16_t vf)
 	return rc;
 }
 
-int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
-				    uint64_t vf_mask, uint8_t vlan_on)
+int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port,
+				    uint16_t vlan,
+				    uint64_t vf_mask,
+				    uint8_t vlan_on)
 {
 	struct bnxt_vlan_table_entry *ve;
 	struct bnxt_vlan_antispoof_table_entry *vase;
@@ -482,8 +503,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
 		if (vlan_on) {
 			/* First, search for a duplicate... */
 			for (j = 0; j < cnt; j++) {
-				if (rte_be_to_cpu_16(
-				   bp->pf.vf_info[i].vlan_table[j].vid) == vlan)
+				if (rte_be_to_cpu_16(bp->pf.vf_info[i].vlan_table[j].vid) == vlan)
 					break;
 			}
 			if (j == cnt) {
@@ -491,7 +511,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
 				if (cnt == getpagesize() / sizeof(struct
 				    bnxt_vlan_antispoof_table_entry)) {
 					PMD_DRV_LOG(ERR,
-					     "VLAN anti-spoof table is full\n");
+						    "VLAN anti-spoof table is full\n");
 					PMD_DRV_LOG(ERR,
 						"VF %d cannot add VLAN %u\n",
 						i, vlan);
@@ -517,13 +537,14 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
 			}
 		} else {
 			for (j = 0; j < cnt; j++) {
-				if (rte_be_to_cpu_16(
-				   bp->pf.vf_info[i].vlan_table[j].vid) != vlan)
+				if (rte_be_to_cpu_16(bp->pf.vf_info[i].vlan_table[j].vid) != vlan)
 					continue;
+
 				memmove(&bp->pf.vf_info[i].vlan_table[j],
 					&bp->pf.vf_info[i].vlan_table[j + 1],
 					getpagesize() - ((j + 1) *
 					sizeof(struct bnxt_vlan_table_entry)));
+
 				memmove(&bp->pf.vf_info[i].vlan_as_table[j],
 					&bp->pf.vf_info[i].vlan_as_table[j + 1],
 					getpagesize() - ((j + 1) * sizeof(struct
@@ -647,8 +668,9 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
 					     count);
 }
 
-int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr,
-				uint32_t vf_id)
+int rte_pmd_bnxt_mac_addr_add(uint16_t port,
+			      struct ether_addr *addr,
+			      uint32_t vf_id)
 {
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
@@ -724,8 +746,9 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr,
 }
 
 int
-rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
-		uint16_t vlan_id)
+rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port,
+				uint16_t vf,
+				uint16_t vlan_id)
 {
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
drivers/net/bnxt/rte_pmd_bnxt.h +45 -24

158 lines not on this page · raw message

Signature · 1 line
2.15.1 (Apple Git-101)
#18 lore raw

PATCH 13/31 net/bnxt: code cleanup style of bnxt stats

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_stats

---
 drivers/net/bnxt/bnxt_stats.c | 84 ++++++++++++++++++++++++++-----------------
 drivers/net/bnxt/bnxt_stats.h | 27 +++++++++-----
 2 files changed, 70 insertions(+), 41 deletions(-)
drivers/net/bnxt/bnxt_stats.c +51 -33
index a5d3c8660..d930aa00e 100644
@@ -201,7 +201,7 @@ void bnxt_free_stats(struct bnxt *bp)
 }
 
 int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_stats *bnxt_stats)
+		      struct rte_eth_stats *bnxt_stats)
 {
 	int rc = 0;
 	unsigned int i;
@@ -217,8 +217,11 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
-		rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
-				     bnxt_stats, 1);
+		rc = bnxt_hwrm_ctx_qstats(bp,
+					  cpr->hw_stats_ctx_id,
+					  i,
+					  bnxt_stats,
+					  1);
 		if (unlikely(rc))
 			return rc;
 		bnxt_stats->rx_nombuf +=
@@ -229,8 +232,12 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		struct bnxt_tx_queue *txq = bp->tx_queues[i];
 		struct bnxt_cp_ring_info *cpr = txq->cp_ring;
 
-		rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
-				     bnxt_stats, 0);
+		rc = bnxt_hwrm_ctx_qstats(bp,
+					  cpr->hw_stats_ctx_id,
+					  i,
+					  bnxt_stats,
+					  0);
+
 		if (unlikely(rc))
 			return rc;
 	}
@@ -259,7 +266,8 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 }
 
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_xstat *xstats, unsigned int n)
+			   struct rte_eth_xstat *xstats,
+			   unsigned int n)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
@@ -279,18 +287,20 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	for (i = 0; i < RTE_DIM(bnxt_rx_stats_strings); i++) {
 		uint64_t *rx_stats = (uint64_t *)bp->hw_rx_port_stats;
 		xstats[count].id = count;
-		xstats[count].value = rte_le_to_cpu_64(
-				*(uint64_t *)((char *)rx_stats +
-				bnxt_rx_stats_strings[i].offset));
+		xstats[count].value = rte_le_to_cpu_64
+					(*(uint64_t *)((char *)rx_stats +
+					 bnxt_rx_stats_strings[i].offset));
+
 		count++;
 	}
 
 	for (i = 0; i < RTE_DIM(bnxt_tx_stats_strings); i++) {
 		uint64_t *tx_stats = (uint64_t *)bp->hw_tx_port_stats;
 		xstats[count].id = count;
-		xstats[count].value = rte_le_to_cpu_64(
-				 *(uint64_t *)((char *)tx_stats +
-				bnxt_tx_stats_strings[i].offset));
+		xstats[count].value = rte_le_to_cpu_64
+					(*(uint64_t *)((char *)tx_stats +
+					 bnxt_tx_stats_strings[i].offset));
+
 		count++;
 	}
 
@@ -303,8 +313,8 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 }
 
 int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
-	struct rte_eth_xstat_name *xstats_names,
-	__rte_unused unsigned int limit)
+				 struct rte_eth_xstat_name *xstats_names,
+				 __rte_unused unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
@@ -316,24 +326,27 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
 
 		for (i = 0; i < RTE_DIM(bnxt_rx_stats_strings); i++) {
 			snprintf(xstats_names[count].name,
-				sizeof(xstats_names[count].name),
-				"%s",
-				bnxt_rx_stats_strings[i].name);
+				 sizeof(xstats_names[count].name),
+				 "%s",
+				 bnxt_rx_stats_strings[i].name);
+
 			count++;
 		}
 
 		for (i = 0; i < RTE_DIM(bnxt_tx_stats_strings); i++) {
 			snprintf(xstats_names[count].name,
-				sizeof(xstats_names[count].name),
-				"%s",
-				bnxt_tx_stats_strings[i].name);
+				 sizeof(xstats_names[count].name),
+				 "%s",
+				 bnxt_tx_stats_strings[i].name);
+
 			count++;
 		}
 
 		snprintf(xstats_names[count].name,
-				sizeof(xstats_names[count].name),
-				"%s",
-				bnxt_func_stats_strings[4].name);
+			 sizeof(xstats_names[count].name),
+			 "%s",
+			 bnxt_func_stats_strings[4].name);
+
 		count++;
 	}
 	return stat_cnt;
@@ -354,8 +367,10 @@ void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 		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,
-		uint64_t *values, unsigned int limit)
+int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev,
+				 const uint64_t *ids,
+				 uint64_t *values,
+				 unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
@@ -370,7 +385,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) {
-			PMD_DRV_LOG(ERR, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid\n");
 			return -1;
 		}
 		values[i] = values_copy[ids[i]];
@@ -379,8 +394,9 @@ int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
 }
 
 int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
-				struct rte_eth_xstat_name *xstats_names,
-				const uint64_t *ids, unsigned int limit)
+				       struct rte_eth_xstat_name *xstats_names,
+				       const uint64_t *ids,
+				       unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
@@ -391,16 +407,18 @@ int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
 	if (!ids)
 		return bnxt_dev_xstats_get_names_op(dev, xstats_names,
 						    stat_cnt);
-	bnxt_dev_xstats_get_names_by_id_op(dev, xstats_names_copy, NULL,
-			stat_cnt);
+
+	bnxt_dev_xstats_get_names_by_id_op(dev,
+					   xstats_names_copy,
+					   NULL,
+					   stat_cnt);
 
 	for (i = 0; i < limit; i++) {
 		if (ids[i] >= stat_cnt) {
-			PMD_DRV_LOG(ERR, "id value isn't valid");
+			PMD_DRV_LOG(ERR, "id value isn't valid\n");
 			return -1;
 		}
-		strcpy(xstats_names[i].name,
-				xstats_names_copy[ids[i]].name);
+		strcpy(xstats_names[i].name, xstats_names_copy[ids[i]].name);
 	}
 	return stat_cnt;
 }
drivers/net/bnxt/bnxt_stats.h +19 -8
index b0f135a5a..08570238d 100644
@@ -9,20 +9,31 @@
 #include <rte_ethdev_driver.h>
 
 void bnxt_free_stats(struct bnxt *bp);
+
 int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_stats *bnxt_stats);
+		      struct rte_eth_stats *bnxt_stats);
+
 void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
+
 int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
-	struct rte_eth_xstat_name *xstats_names,
-	__rte_unused unsigned int limit);
+				 struct rte_eth_xstat_name *xstats_names,
+				 __rte_unused unsigned int limit);
+
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
-			   struct rte_eth_xstat *xstats, unsigned int n);
+			   struct rte_eth_xstat *xstats,
+			   unsigned int n);
+
 void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev);
-int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
-				uint64_t *values, unsigned int limit);
+
+int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev,
+				 const uint64_t *ids,
+				 uint64_t *values,
+				 unsigned int limit);
+
 int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
-				struct rte_eth_xstat_name *xstats_names,
-				const uint64_t *ids, unsigned int limit);
+				       struct rte_eth_xstat_name *xstats_names,
+				       const uint64_t *ids,
+				       unsigned int limit);
 
 struct bnxt_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
Signature · 1 line
2.15.1 (Apple Git-101)
#19 lore raw

PATCH 14/31 net/bnxt: code cleanup style of bnxt vnic

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_vnic

---
 drivers/net/bnxt/bnxt_vnic.c | 26 +++++++++++++-------------
 drivers/net/bnxt/bnxt_vnic.h |  8 ++++++--
 2 files changed, 19 insertions(+), 15 deletions(-)
drivers/net/bnxt/bnxt_vnic.c +13 -13
index 19d06af55..5d9d369a3 100644
@@ -64,8 +64,9 @@ void bnxt_init_vnics(struct bnxt *bp)
 		STAILQ_INIT(&bp->ff_pool[i]);
 }
 
-int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
-			  int pool)
+int bnxt_free_vnic(struct bnxt *bp,
+		   struct bnxt_vnic_info *vnic,
+		   int pool)
 {
 	struct bnxt_vnic_info *temp;
 
@@ -143,14 +144,16 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	struct rte_pci_device *pdev = bp->pdev;
 	const struct rte_memzone *mz;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
-	uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP(
-				HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
-				HW_HASH_KEY_SIZE +
-				BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN);
+	uint32_t entry_length;
 	uint16_t max_vnics;
 	int i;
 	rte_iova_t mz_phys_addr;
 
+	entry_length = RTE_CACHE_LINE_ROUNDUP
+			(HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) +
+			 HW_HASH_KEY_SIZE +
+			 BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN);
+
 	max_vnics = bp->max_vnics;
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
 		 "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
@@ -168,14 +171,11 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	}
 	mz_phys_addr = mz->iova;
 	if ((unsigned long)mz->addr == mz_phys_addr) {
-		PMD_DRV_LOG(WARNING,
-			"Memzone physical address same as virtual.\n");
-		PMD_DRV_LOG(WARNING,
-			"Using rte_mem_virt2iova()\n");
+		PMD_DRV_LOG(WARNING, "Memzone phys addr == virtual\n");
+		PMD_DRV_LOG(WARNING, "Using rte_mem_virt2iova()\n");
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
-			PMD_DRV_LOG(ERR,
-			"unable to map vnic address to physical memory\n");
+			PMD_DRV_LOG(ERR, "unable to map vnic addr\n");
 			return -ENOMEM;
 		}
 	}
@@ -234,7 +234,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) {
-		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs",
+		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs\n",
 			max_vnics);
 		return -ENOMEM;
 	}
drivers/net/bnxt/bnxt_vnic.h +6 -2
index c521d7e5a..3401ae098 100644
@@ -58,12 +58,16 @@ struct bnxt_vnic_info {
 
 struct bnxt;
 void bnxt_init_vnics(struct bnxt *bp);
-int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
-			  int pool);
+
+int bnxt_free_vnic(struct bnxt *bp,
+		   struct bnxt_vnic_info *vnic,
+		   int pool);
+
 struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp);
 void bnxt_free_all_vnics(struct bnxt *bp);
 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.15.1 (Apple Git-101)
#20 lore raw

PATCH 15/31 net/bnxt: code cleanup style of bnxt txq

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_txq

---
 drivers/net/bnxt/bnxt_txq.c | 24 ++++++++++++++----------
 drivers/net/bnxt/bnxt_txq.h |  9 +++++----
 2 files changed, 19 insertions(+), 14 deletions(-)
drivers/net/bnxt/bnxt_txq.c +14 -10
index b9b975e4c..677bb9692 100644
@@ -74,10 +74,10 @@ void bnxt_tx_queue_release_op(void *tx_queue)
 }
 
 int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
-			       uint16_t queue_idx,
-			       uint16_t nb_desc,
-			       unsigned int socket_id,
-			       const struct rte_eth_txconf *tx_conf)
+			   uint16_t queue_idx,
+			   uint16_t nb_desc,
+			   unsigned int socket_id,
+			   const struct rte_eth_txconf *tx_conf)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	struct bnxt_tx_queue *txq;
@@ -91,7 +91,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	}
 
 	if (!nb_desc || nb_desc > MAX_TX_DESC_CNT) {
-		PMD_DRV_LOG(ERR, "nb_desc %d is invalid", nb_desc);
+		PMD_DRV_LOG(ERR, "nb_desc %d is invalid\n", nb_desc);
 		rc = -EINVAL;
 		goto out;
 	}
@@ -106,7 +106,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) {
-		PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!");
+		PMD_DRV_LOG(ERR, "bnxt_tx_queue allocation failed!\n");
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -122,16 +122,20 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq->port_id = eth_dev->data->port_id;
 
 	/* Allocate TX ring hardware descriptors */
-	if (bnxt_alloc_rings(bp, queue_idx, txq, NULL, txq->cp_ring,
-			"txr")) {
-		PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
+	if (bnxt_alloc_rings(bp,
+			     queue_idx,
+			     txq,
+			     NULL,
+			     txq->cp_ring,
+			     "txr")) {
+		PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!\n");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
 	}
 
 	if (bnxt_init_one_tx_ring(txq)) {
-		PMD_DRV_LOG(ERR, "bnxt_init_one_tx_ring failed!");
+		PMD_DRV_LOG(ERR, "bnxt_init_one_tx_ring failed!\n");
 		bnxt_tx_queue_release_op(txq);
 		rc = -ENOMEM;
 		goto out;
drivers/net/bnxt/bnxt_txq.h +5 -4
index f2c712a75..9da8f39d8 100644
@@ -40,8 +40,9 @@ void bnxt_free_txq_stats(struct bnxt_tx_queue *txq);
 void bnxt_free_tx_mbufs(struct bnxt *bp);
 void bnxt_tx_queue_release_op(void *tx_queue);
 int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
-			       uint16_t queue_idx,
-			       uint16_t nb_desc,
-			       unsigned int socket_id,
-			       const struct rte_eth_txconf *tx_conf);
+			   uint16_t queue_idx,
+			   uint16_t nb_desc,
+			   unsigned int socket_id,
+			   const struct rte_eth_txconf *tx_conf);
+
 #endif
Signature · 1 line
2.15.1 (Apple Git-101)
#21 lore raw

PATCH 16/31 net/bnxt: code cleanup style of bnxt rxq

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_rxq

---
 drivers/net/bnxt/bnxt_rxq.c | 22 +++++++++++++---------
 drivers/net/bnxt/bnxt_rxq.h | 12 +++++++-----
 2 files changed, 20 insertions(+), 14 deletions(-)
drivers/net/bnxt/bnxt_rxq.c +13 -9
index f405e2575..d622ad4ef 100644
@@ -83,8 +83,8 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			/* For each pool, allocate MACVLAN CFA rule & VNIC */
 			max_pools = RTE_MIN(bp->max_vnics,
 					    RTE_MIN(bp->max_l2_ctx,
-					    RTE_MIN(bp->max_rsscos_ctx,
-						    ETH_64_POOLS)));
+						    RTE_MIN(bp->max_rsscos_ctx,
+							    ETH_64_POOLS)));
 			if (pools > max_pools)
 				pools = max_pools;
 			break;
@@ -280,11 +280,11 @@ void bnxt_rx_queue_release_op(void *rx_queue)
 }
 
 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
-			       uint16_t queue_idx,
-			       uint16_t nb_desc,
-			       unsigned int socket_id,
-			       const struct rte_eth_rxconf *rx_conf,
-			       struct rte_mempool *mp)
+			   uint16_t queue_idx,
+			   uint16_t nb_desc,
+			   unsigned int socket_id,
+			   const struct rte_eth_rxconf *rx_conf,
+			   struct rte_mempool *mp)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
@@ -336,8 +336,12 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->rx_queues[queue_idx] = rxq;
 	/* Allocate RX ring hardware descriptors */
-	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring,
-			"rxr")) {
+	if (bnxt_alloc_rings(bp,
+			     queue_idx,
+			     NULL,
+			     rxq,
+			     rxq->cp_ring,
+			     "rxr")) {
 		PMD_DRV_LOG(ERR,
 			"ring_dma_zone_reserve for rx_ring failed!\n");
 		bnxt_rx_queue_release_op(rxq);
drivers/net/bnxt/bnxt_rxq.h +7 -5
index e5d6001d3..6e6c04010 100644
@@ -42,12 +42,14 @@ struct bnxt_rx_queue {
 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
 int bnxt_mq_rx_configure(struct bnxt *bp);
 void bnxt_rx_queue_release_op(void *rx_queue);
+
 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
-			       uint16_t queue_idx,
-			       uint16_t nb_desc,
-			       unsigned int socket_id,
-			       const struct rte_eth_rxconf *rx_conf,
-			       struct rte_mempool *mp);
+			   uint16_t queue_idx,
+			   uint16_t nb_desc,
+			   unsigned int socket_id,
+			   const struct rte_eth_rxconf *rx_conf,
+			   struct rte_mempool *mp);
+
 void bnxt_free_rx_mbufs(struct bnxt *bp);
 int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
 				 uint16_t queue_id);
Signature · 1 line
2.15.1 (Apple Git-101)
#22 lore raw

PATCH 17/31 net/bnxt: code cleanup style of bnxt vnic

In reply to Ajit Khaparde

code cleanup style of bnxt_vnic.

---
 drivers/net/bnxt/bnxt_vnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_vnic.c +1 -1
index 5d9d369a3..d5d81fd36 100644
@@ -235,7 +235,7 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp)
 			       max_vnics * sizeof(struct bnxt_vnic_info), 0);
 	if (vnic_mem == NULL) {
 		PMD_DRV_LOG(ERR, "Failed to alloc memory for %d VNICs\n",
-			max_vnics);
+			    max_vnics);
 		return -ENOMEM;
 	}
 	bp->vnic_info = vnic_mem;
Signature · 1 line
2.15.1 (Apple Git-101)
#23 lore raw

PATCH 18/31 net/bnxt: code cleanup style of bnxt txr

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_txr

---
 drivers/net/bnxt/bnxt_txr.c | 5 +++--
 drivers/net/bnxt/bnxt_txr.h | 9 +++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_txr.c +3 -2
index 68645b2f7..f8fd22156 100644
@@ -373,8 +373,9 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
 	return nb_tx_pkts;
 }
 
-uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
-			       uint16_t nb_pkts)
+uint16_t bnxt_xmit_pkts(void *tx_queue,
+			struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts)
 {
 	struct bnxt_tx_queue *txq = tx_queue;
 	uint16_t nb_tx_pkts = 0;
drivers/net/bnxt/bnxt_txr.h +5 -4
index 7f3c7cdb0..33cdea5f6 100644
@@ -30,7 +30,7 @@ struct bnxt_tx_ring_info {
 };
 
 struct bnxt_sw_tx_bd {
-	struct rte_mbuf		*mbuf; /* mbuf associated with TX descriptor */
+	struct rte_mbuf		*mbuf;
 	uint8_t			is_gso;
 	unsigned short		nr_bds;
 };
@@ -38,8 +38,10 @@ struct bnxt_sw_tx_bd {
 void bnxt_free_tx_rings(struct bnxt *bp);
 int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq);
 int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);
-uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
-			       uint16_t nb_pkts);
+
+uint16_t 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);
 
@@ -63,7 +65,6 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 					 PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_TCP_UDP_CKSUM		(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM)
 
-
 #define TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM	(TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \
 					TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \
 					TX_BD_LONG_LFLAGS_IP_CHKSUM)
Signature · 1 line
2.15.1 (Apple Git-101)
#24 lore raw

PATCH 19/31 net/bnxt: code cleanup style of bnxt ring

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_ring

---
 drivers/net/bnxt/bnxt_ring.c | 79 ++++++++++++++++++++++++++------------------
 drivers/net/bnxt/bnxt_ring.h | 40 +++++++++++-----------
 2 files changed, 68 insertions(+), 51 deletions(-)
drivers/net/bnxt/bnxt_ring.c +47 -32
index fcbd6bc6e..03a5381a3 100644
@@ -64,10 +64,10 @@ int bnxt_init_ring_grps(struct bnxt *bp)
  * rx bd ring - Only non-zero length if rx_ring_info is not NULL
  */
 int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
-			    struct bnxt_tx_queue *txq,
-			    struct bnxt_rx_queue *rxq,
-			    struct bnxt_cp_ring_info *cp_ring_info,
-			    const char *suffix)
+		     struct bnxt_tx_queue *txq,
+		     struct bnxt_rx_queue *rxq,
+		     struct bnxt_cp_ring_info *cp_ring_info,
+		     const char *suffix)
 {
 	struct bnxt_ring *cp_ring = cp_ring_info->cp_ring_struct;
 	struct bnxt_rx_ring_info *rx_ring_info = rxq ? rxq->rx_ring : NULL;
@@ -90,20 +90,24 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 
 	int tx_vmem_start = cp_vmem_start + cp_vmem_len;
 	int tx_vmem_len =
-	    tx_ring_info ? RTE_CACHE_LINE_ROUNDUP(tx_ring_info->
-						tx_ring_struct->vmem_size) : 0;
+	    tx_ring_info ?
+		RTE_CACHE_LINE_ROUNDUP(tx_ring_info->tx_ring_struct->vmem_size)
+		: 0;
 
 	int rx_vmem_start = tx_vmem_start + tx_vmem_len;
 	int rx_vmem_len = rx_ring_info ?
-		RTE_CACHE_LINE_ROUNDUP(rx_ring_info->
-						rx_ring_struct->vmem_size) : 0;
+		RTE_CACHE_LINE_ROUNDUP(rx_ring_info->rx_ring_struct->vmem_size)
+		: 0;
+
 	int ag_vmem_start = 0;
 	int ag_vmem_len = 0;
 	int cp_ring_start =  0;
 
 	ag_vmem_start = rx_vmem_start + rx_vmem_len;
-	ag_vmem_len = rx_ring_info ? RTE_CACHE_LINE_ROUNDUP(
-				rx_ring_info->ag_ring_struct->vmem_size) : 0;
+	ag_vmem_len = rx_ring_info ?
+		RTE_CACHE_LINE_ROUNDUP(rx_ring_info->ag_ring_struct->vmem_size)
+		: 0;
+
 	cp_ring_start = ag_vmem_start + ag_vmem_len;
 
 	int cp_ring_len = RTE_CACHE_LINE_ROUNDUP(cp_ring->ring_size *
@@ -124,9 +128,11 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 
 	int ag_bitmap_start = ag_ring_start + ag_ring_len;
 	int ag_bitmap_len =  rx_ring_info ?
-		RTE_CACHE_LINE_ROUNDUP(rte_bitmap_get_memory_footprint(
-			rx_ring_info->rx_ring_struct->ring_size *
-			AGG_RING_SIZE_FACTOR)) : 0;
+		RTE_CACHE_LINE_ROUNDUP
+		  (rte_bitmap_get_memory_footprint
+		    (rx_ring_info->rx_ring_struct->ring_size *
+		     AGG_RING_SIZE_FACTOR))
+		: 0;
 
 	int tpa_info_start = ag_bitmap_start + ag_bitmap_len;
 	int tpa_info_len = rx_ring_info ?
@@ -134,6 +140,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 				       sizeof(struct bnxt_tpa_info)) : 0;
 
 	int total_alloc_len = tpa_info_start;
+
 	if (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO)
 		total_alloc_len += tpa_info_len;
 
@@ -144,12 +151,13 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 	mz = rte_memzone_lookup(mz_name);
 	if (!mz) {
-		mz = rte_memzone_reserve_aligned(mz_name, total_alloc_len,
-				SOCKET_ID_ANY,
-				RTE_MEMZONE_2MB |
-				RTE_MEMZONE_SIZE_HINT_ONLY |
-				RTE_MEMZONE_IOVA_CONTIG,
-				getpagesize());
+		mz = rte_memzone_reserve_aligned(mz_name,
+						 total_alloc_len,
+						 SOCKET_ID_ANY,
+						 RTE_MEMZONE_2MB |
+						 RTE_MEMZONE_SIZE_HINT_ONLY |
+						 RTE_MEMZONE_IOVA_CONTIG,
+						 getpagesize());
 		if (mz == NULL)
 			return -ENOMEM;
 	}
@@ -165,7 +173,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 		mz_phys_addr = rte_mem_virt2iova(mz->addr);
 		if (mz_phys_addr == 0) {
 			PMD_DRV_LOG(ERR,
-			"unable to map ring address to physical memory\n");
+				    "unable to map ring addr to phys memory\n");
 			return -ENOMEM;
 		}
 	}
@@ -440,10 +448,12 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 			goto err_out;
 		}
 
-		rc = bnxt_hwrm_ring_alloc(bp, ring,
-				HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
-				map_idx, HWRM_NA_SIGNATURE,
-				cp_ring->fw_ring_id);
+		rc = bnxt_hwrm_ring_alloc(bp,
+					  ring,
+					  HWRM_RING_ALLOC_INPUT_RING_TYPE_RX,
+					  map_idx,
+					  HWRM_NA_SIGNATURE,
+					  cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
 		PMD_DRV_LOG(DEBUG, "Alloc AGG Done!\n");
@@ -473,10 +483,13 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		unsigned int idx = i + bp->rx_cp_nr_rings;
 
 		/* Tx cmpl */
-		rc = bnxt_hwrm_ring_alloc(bp, cp_ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
-					idx, HWRM_NA_SIGNATURE,
-					HWRM_NA_SIGNATURE);
+		rc = bnxt_hwrm_ring_alloc
+			(bp,
+			 cp_ring,
+			 HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL,
+			 idx,
+			 HWRM_NA_SIGNATURE,
+			 HWRM_NA_SIGNATURE);
 		if (rc)
 			goto err_out;
 
@@ -484,10 +497,12 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
 
 		/* Tx ring */
-		rc = bnxt_hwrm_ring_alloc(bp, ring,
-					HWRM_RING_ALLOC_INPUT_RING_TYPE_TX,
-					idx, cpr->hw_stats_ctx_id,
-					cp_ring->fw_ring_id);
+		rc = bnxt_hwrm_ring_alloc(bp,
+					  ring,
+					  HWRM_RING_ALLOC_INPUT_RING_TYPE_TX,
+					  idx,
+					  cpr->hw_stats_ctx_id,
+					  cp_ring->fw_ring_id);
 		if (rc)
 			goto err_out;
 
drivers/net/bnxt/bnxt_ring.h +21 -19
index 1446d784f..9348bf2b2 100644
@@ -10,17 +10,17 @@
 
 #include <rte_memory.h>
 
-#define RING_NEXT(ring, idx)		(((idx) + 1) & (ring)->ring_mask)
-
-#define DB_IDX_MASK						0xffffff
-#define DB_IDX_VALID						(0x1 << 26)
-#define DB_IRQ_DIS						(0x1 << 27)
-#define DB_KEY_TX						(0x0 << 28)
-#define DB_KEY_RX						(0x1 << 28)
-#define DB_KEY_CP						(0x2 << 28)
-#define DB_KEY_ST						(0x3 << 28)
-#define DB_KEY_TX_PUSH						(0x4 << 28)
-#define DB_LONG_TX_PUSH						(0x2 << 24)
+#define RING_NEXT(ring, idx)	(((idx) + 1) & (ring)->ring_mask)
+
+#define DB_IDX_MASK		0xffffff
+#define DB_IDX_VALID		(0x1 << 26)
+#define DB_IRQ_DIS		(0x1 << 27)
+#define DB_KEY_TX		(0x0 << 28)
+#define DB_KEY_RX		(0x1 << 28)
+#define DB_KEY_CP		(0x2 << 28)
+#define DB_KEY_ST		(0x3 << 28)
+#define DB_KEY_TX_PUSH		(0x4 << 28)
+#define DB_LONG_TX_PUSH		(0x2 << 24)
 
 #define DEFAULT_CP_RING_SIZE	256
 #define DEFAULT_RX_RING_SIZE	256
@@ -31,12 +31,13 @@
 #define AGG_RING_MULTIPLIER	2
 
 /* These assume 4k pages */
-#define MAX_RX_DESC_CNT (8 * 1024)
-#define MAX_TX_DESC_CNT (4 * 1024)
-#define MAX_CP_DESC_CNT (16 * 1024)
+#define MAX_RX_DESC_CNT		(8 * 1024)
+#define MAX_TX_DESC_CNT		(4 * 1024)
+#define MAX_CP_DESC_CNT		(16 * 1024)
 
 #define INVALID_HW_RING_ID      ((uint16_t)-1)
-#define INVALID_STATS_CTX_ID		((uint16_t)-1)
+#define INVALID_STATS_CTX_ID	((uint16_t)-1)
+#define INVALID_RING_GRP_ID     ((uint16_t)-1)
 
 struct bnxt_ring {
 	void			*bd;
@@ -65,11 +66,12 @@ struct bnxt_rx_ring_info;
 struct bnxt_cp_ring_info;
 void bnxt_free_ring(struct bnxt_ring *ring);
 int bnxt_init_ring_grps(struct bnxt *bp);
+
 int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
-			    struct bnxt_tx_queue *txq,
-			    struct bnxt_rx_queue *rxq,
-			    struct bnxt_cp_ring_info *cp_ring_info,
-			    const char *suffix);
+		     struct bnxt_tx_queue *txq,
+		     struct bnxt_rx_queue *rxq,
+		     struct bnxt_cp_ring_info *cp_ring_info,
+		     const char *suffix);
 int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_rings(struct bnxt *bp);
 
Signature · 1 line
2.15.1 (Apple Git-101)
#25 lore raw

PATCH 20/31 net/bnxt: code cleanup style of bnxt ethdev

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Cleanup alignment, brackets, debug string style of bnxt_ethdev

---
 drivers/net/bnxt/bnxt_ethdev.c | 204 ++++++++++++++++++++++-------------------
 1 file changed, 112 insertions(+), 92 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +112 -92
index d66a29758..6516aeedd 100644
@@ -315,8 +315,9 @@ static int bnxt_init_chip(struct bnxt *bp)
 		intr_vector = bp->eth_dev->data->nb_rx_queues;
 		PMD_DRV_LOG(DEBUG, "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);
+			PMD_DRV_LOG(ERR,
+				    "At most %d intr queues supported\n",
+				    bp->rx_cp_nr_rings);
 			return -ENOTSUP;
 		}
 		if (rte_intr_efd_enable(intr_handle, intr_vector))
@@ -329,14 +330,15 @@ static int bnxt_init_chip(struct bnxt *bp)
 				    bp->eth_dev->data->nb_rx_queues *
 				    sizeof(int), 0);
 		if (intr_handle->intr_vec == NULL) {
-			PMD_DRV_LOG(ERR, "Failed to allocate %d rx_queues"
-				" intr_vec", bp->eth_dev->data->nb_rx_queues);
+			PMD_DRV_LOG(ERR,
+				    "Failed to allocate %d rx_queues intr_vec\n",
+				    bp->eth_dev->data->nb_rx_queues);
 			return -ENOMEM;
 		}
-		PMD_DRV_LOG(DEBUG, "intr_handle->intr_vec = %p "
-			"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
-			 intr_handle->intr_vec, intr_handle->nb_efd,
-			intr_handle->max_intr);
+		PMD_DRV_LOG(DEBUG,
+			    "intr_handle->intr_vec = %p intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
+			    intr_handle->intr_vec, intr_handle->nb_efd,
+			    intr_handle->max_intr);
 	}
 
 	for (queue_id = 0; queue_id < bp->eth_dev->data->nb_rx_queues;
@@ -404,7 +406,7 @@ static int bnxt_init_nic(struct bnxt *bp)
  */
 
 static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
-				  struct rte_eth_dev_info *dev_info)
+				 struct rte_eth_dev_info *dev_info)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	uint16_t max_vnics, i, j, vpool, vrxq;
@@ -706,15 +708,22 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
 			while (filter) {
 				temp_filter = STAILQ_NEXT(filter, next);
 				if (filter->mac_index == index) {
-					STAILQ_REMOVE(&vnic->filter, filter,
-						      bnxt_filter_info, next);
+					STAILQ_REMOVE(&vnic->filter,
+						      filter,
+						      bnxt_filter_info,
+						      next);
+
 					bnxt_hwrm_clear_l2_filter(bp, filter);
 					filter->mac_index = INVALID_MAC_INDEX;
-					memset(&filter->l2_addr, 0,
+
+					memset(&filter->l2_addr,
+					       0,
 					       ETHER_ADDR_LEN);
-					STAILQ_INSERT_TAIL(
-							&bp->free_filter_list,
-							filter, next);
+
+					STAILQ_INSERT_TAIL
+						(&bp->free_filter_list,
+						 filter,
+						 next);
 				}
 				filter = temp_filter;
 			}
@@ -785,9 +794,10 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 out:
 	/* Timed out or success */
 	if (new.link_status != eth_dev->data->dev_link.link_status ||
-	new.link_speed != eth_dev->data->dev_link.link_speed) {
-		memcpy(&eth_dev->data->dev_link, &new,
-			sizeof(struct rte_eth_link));
+	    new.link_speed != eth_dev->data->dev_link.link_speed) {
+		memcpy(&eth_dev->data->dev_link,
+		       &new,
+		       sizeof(struct rte_eth_link));
 
 		_rte_eth_dev_callback_process(eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
@@ -856,8 +866,8 @@ static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 }
 
 static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
-			    struct rte_eth_rss_reta_entry64 *reta_conf,
-			    uint16_t reta_size)
+			       struct rte_eth_rss_reta_entry64 *reta_conf,
+			       uint16_t reta_size)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
@@ -868,9 +878,9 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 		return -EINVAL;
 
 	if (reta_size != HW_HASH_INDEX_SIZE) {
-		PMD_DRV_LOG(ERR, "The configured hash table lookup size "
-			"(%d) must equal the size supported by the hardware "
-			"(%d)\n", reta_size, HW_HASH_INDEX_SIZE);
+		PMD_DRV_LOG(ERR,
+			    "Configured hash table lookup size (%d) != (%d)\n",
+			    reta_size, HW_HASH_INDEX_SIZE);
 		return -EINVAL;
 	}
 	/* Update the RSS VNIC(s) */
@@ -900,9 +910,9 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 		return -EINVAL;
 
 	if (reta_size != HW_HASH_INDEX_SIZE) {
-		PMD_DRV_LOG(ERR, "The configured hash table lookup size "
-			"(%d) must equal the size supported by the hardware "
-			"(%d)\n", reta_size, HW_HASH_INDEX_SIZE);
+		PMD_DRV_LOG(ERR,
+			    "Configured hash table lookup size (%d) != (%d)\n",
+			    reta_size, HW_HASH_INDEX_SIZE);
 		return -EINVAL;
 	}
 	/* EW - need to revisit here copying from uint64_t to uint16_t */
@@ -1021,8 +1031,8 @@ static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
 		}
 		if (hash_types) {
 			PMD_DRV_LOG(ERR,
-				"Unknwon RSS config from firmware (%08x), RSS disabled",
-				vnic->hash_type);
+				    "Unknown RSS config (%08x), RSS disabled\n",
+				    vnic->hash_type);
 			return -ENOTSUP;
 		}
 	} else {
@@ -1032,7 +1042,7 @@ static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
 }
 
 static int bnxt_flow_ctrl_get_op(struct rte_eth_dev *dev,
-			       struct rte_eth_fc_conf *fc_conf)
+				 struct rte_eth_fc_conf *fc_conf)
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 	struct rte_eth_link link_info;
@@ -1064,7 +1074,7 @@ static int bnxt_flow_ctrl_get_op(struct rte_eth_dev *dev,
 }
 
 static int bnxt_flow_ctrl_set_op(struct rte_eth_dev *dev,
-			       struct rte_eth_fc_conf *fc_conf)
+				 struct rte_eth_fc_conf *fc_conf)
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 
@@ -1120,7 +1130,7 @@ static int bnxt_flow_ctrl_set_op(struct rte_eth_dev *dev,
 /* Add UDP tunneling port */
 static int
 bnxt_udp_tunnel_port_add_op(struct rte_eth_dev *eth_dev,
-			 struct rte_eth_udp_tunnel *udp_tunnel)
+			    struct rte_eth_udp_tunnel *udp_tunnel)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	uint16_t tunnel_type = 0;
@@ -1168,7 +1178,7 @@ bnxt_udp_tunnel_port_add_op(struct rte_eth_dev *eth_dev,
 
 static int
 bnxt_udp_tunnel_port_del_op(struct rte_eth_dev *eth_dev,
-			 struct rte_eth_udp_tunnel *udp_tunnel)
+			    struct rte_eth_udp_tunnel *udp_tunnel)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	uint16_t tunnel_type = 0;
@@ -1256,9 +1266,10 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 					STAILQ_REMOVE(&vnic->filter, filter,
 						      bnxt_filter_info, next);
 					bnxt_hwrm_clear_l2_filter(bp, filter);
-					STAILQ_INSERT_TAIL(
-							&bp->free_filter_list,
-							filter, next);
+					STAILQ_INSERT_TAIL
+							(&bp->free_filter_list,
+							 filter,
+							 next);
 
 					/*
 					 * Need to examine to see if the MAC
@@ -1281,9 +1292,10 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 					memcpy(new_filter->l2_addr,
 					       filter->l2_addr, ETHER_ADDR_LEN);
 					/* MAC only filter */
-					rc = bnxt_hwrm_set_l2_filter(bp,
-							vnic->fw_vnic_id,
-							new_filter);
+					rc = bnxt_hwrm_set_l2_filter
+							(bp,
+							 vnic->fw_vnic_id,
+							 new_filter);
 					if (rc)
 						goto exit;
 					PMD_DRV_LOG(INFO,
@@ -1335,9 +1347,10 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 						      bnxt_filter_info, next);
 					bnxt_hwrm_clear_l2_filter(bp, filter);
 					filter->l2_ovlan = 0;
-					STAILQ_INSERT_TAIL(
-							&bp->free_filter_list,
-							filter, next);
+					STAILQ_INSERT_TAIL
+						(&bp->free_filter_list,
+						 filter,
+						 next);
 				}
 				new_filter = bnxt_alloc_filter(bp);
 				if (!new_filter) {
@@ -1405,6 +1418,7 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 		/* Enable or disable VLAN stripping */
 		for (i = 0; i < bp->nr_vnics; i++) {
 			struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+
 			if (rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
 				vnic->vlan_strip = true;
 			else
@@ -1460,8 +1474,8 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)
 
 static int
 bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
-			  struct ether_addr *mc_addr_set,
-			  uint32_t nb_mc_addr)
+			     struct ether_addr *mc_addr_set,
+			     uint32_t nb_mc_addr)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	char *mc_addr_list = (char *)mc_addr_set;
@@ -1497,8 +1511,9 @@ bnxt_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 	uint8_t fw_updt = (bp->fw_ver >> 8) & 0xff;
 	int ret;
 
-	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
-			fw_major, fw_minor, fw_updt);
+	ret = snprintf(fw_version, fw_size,
+		       "%d.%d.%d",
+		       fw_major, fw_minor, fw_updt);
 
 	ret += 1; /* add the size of '\0' */
 	if (fw_size < (uint32_t)ret)
@@ -1508,8 +1523,9 @@ bnxt_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 }
 
 static void
-bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
-	struct rte_eth_rxq_info *qinfo)
+bnxt_rxq_info_get_op(struct rte_eth_dev *dev,
+		     uint16_t queue_id,
+		     struct rte_eth_rxq_info *qinfo)
 {
 	struct bnxt_rx_queue *rxq;
 
@@ -1525,8 +1541,9 @@ bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 }
 
 static void
-bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
-	struct rte_eth_txq_info *qinfo)
+bnxt_txq_info_get_op(struct rte_eth_dev *dev,
+		     uint16_t queue_id,
+		     struct rte_eth_txq_info *qinfo)
 {
 	struct bnxt_tx_queue *txq;
 
@@ -1561,7 +1578,6 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		return -EINVAL;
 	}
 
-
 	if (new_mtu > ETHER_MTU) {
 		bp->flags |= BNXT_FLAG_JUMBO;
 		bp->eth_dev->data->dev_conf.rxmode.offloads |=
@@ -1655,17 +1671,16 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		valid = FLIP_VALID(cons, cpr->cp_ring_struct->ring_mask, valid);
 		cmp_type = CMP_TYPE(rxcmp);
 		if (cmp_type == RX_TPA_END_CMPL_TYPE_RX_TPA_END) {
-			cmp = (rte_le_to_cpu_32(
-					((struct rx_tpa_end_cmpl *)
-					 (rxcmp))->agg_bufs_v1) &
-			       RX_TPA_END_CMPL_AGG_BUFS_MASK) >>
-				RX_TPA_END_CMPL_AGG_BUFS_SFT;
+			cmp = (rte_le_to_cpu_32
+				(((struct rx_tpa_end_cmpl *)
+				  (rxcmp))->agg_bufs_v1)
+				& RX_TPA_END_CMPL_AGG_BUFS_MASK)
+				>> RX_TPA_END_CMPL_AGG_BUFS_SFT;
 			desc++;
 		} else if (cmp_type == 0x11) {
 			desc++;
-			cmp = (rxcmp->agg_bufs_v1 &
-				   RX_PKT_CMPL_AGG_BUFS_MASK) >>
-				RX_PKT_CMPL_AGG_BUFS_SFT;
+			cmp = (rxcmp->agg_bufs_v1 & RX_PKT_CMPL_AGG_BUFS_MASK)
+				>> RX_PKT_CMPL_AGG_BUFS_SFT;
 		} else {
 			cmp = 1;
 		}
@@ -1710,7 +1725,6 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
 	if (rx_buf->mbuf == NULL)
 		return RTE_ETH_RX_DESC_UNAVAIL;
 
-
 	return RTE_ETH_RX_DESC_AVAIL;
 }
 
@@ -2882,16 +2896,20 @@ bnxt_get_eeprom_length_op(struct rte_eth_dev *dev)
 
 static int
 bnxt_get_eeprom_op(struct rte_eth_dev *dev,
-		struct rte_dev_eeprom_info *in_eeprom)
+		   struct rte_dev_eeprom_info *in_eeprom)
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 	uint32_t index;
 	uint32_t offset;
 
-	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);
+	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);
 
 	if (in_eeprom->offset == 0) /* special offset value to get directory */
 		return bnxt_get_nvram_directory(bp, in_eeprom->length,
@@ -2953,16 +2971,17 @@ static bool bnxt_dir_type_is_executable(uint16_t dir_type)
 
 static int
 bnxt_set_eeprom_op(struct rte_eth_dev *dev,
-		struct rte_dev_eeprom_info *in_eeprom)
+		   struct rte_dev_eeprom_info *in_eeprom)
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 	uint8_t index, dir_op;
 	uint16_t type, ext, ordinal, attr;
 
-	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);
+	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);
 
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR, "NVM write not supported from a VF\n");
@@ -3195,14 +3214,14 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 			 pci_dev->addr.function, "rx_port_stats");
 		mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 		mz = rte_memzone_lookup(mz_name);
-		total_alloc_len = RTE_CACHE_LINE_ROUNDUP(
-				sizeof(struct rx_port_stats) + 512);
+		total_alloc_len = RTE_CACHE_LINE_ROUNDUP
+					(sizeof(struct rx_port_stats) + 512);
 		if (!mz) {
 			mz = rte_memzone_reserve(mz_name, total_alloc_len,
-					SOCKET_ID_ANY,
-					RTE_MEMZONE_2MB |
-					RTE_MEMZONE_SIZE_HINT_ONLY |
-					RTE_MEMZONE_IOVA_CONTIG);
+						 SOCKET_ID_ANY,
+						 RTE_MEMZONE_2MB |
+						 RTE_MEMZONE_SIZE_HINT_ONLY |
+						 RTE_MEMZONE_IOVA_CONTIG);
 			if (mz == NULL)
 				return -ENOMEM;
 		}
@@ -3216,7 +3235,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 			mz_phys_addr = rte_mem_virt2iova(mz->addr);
 			if (mz_phys_addr == 0) {
 				PMD_DRV_LOG(ERR,
-				"unable to map address to physical memory\n");
+					"unable to map addr to phys memory\n");
 				return -ENOMEM;
 			}
 		}
@@ -3231,15 +3250,15 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 			 pci_dev->addr.function, "tx_port_stats");
 		mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 		mz = rte_memzone_lookup(mz_name);
-		total_alloc_len = RTE_CACHE_LINE_ROUNDUP(
-				sizeof(struct tx_port_stats) + 512);
+		total_alloc_len = RTE_CACHE_LINE_ROUNDUP
+					(sizeof(struct tx_port_stats) + 512);
 		if (!mz) {
 			mz = rte_memzone_reserve(mz_name,
-					total_alloc_len,
-					SOCKET_ID_ANY,
-					RTE_MEMZONE_2MB |
-					RTE_MEMZONE_SIZE_HINT_ONLY |
-					RTE_MEMZONE_IOVA_CONTIG);
+						 total_alloc_len,
+						 SOCKET_ID_ANY,
+						 RTE_MEMZONE_2MB |
+						 RTE_MEMZONE_SIZE_HINT_ONLY |
+						 RTE_MEMZONE_IOVA_CONTIG);
 			if (mz == NULL)
 				return -ENOMEM;
 		}
@@ -3253,7 +3272,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 			mz_phys_addr = rte_mem_virt2iova(mz->addr);
 			if (mz_phys_addr == 0) {
 				PMD_DRV_LOG(ERR,
-				"unable to map address to physical memory\n");
+					    "unable to map to phys memory\n");
 				return -ENOMEM;
 			}
 		}
@@ -3298,10 +3317,11 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		goto error_free;
 	}
 	eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl",
-					ETHER_ADDR_LEN * bp->max_l2_ctx, 0);
+					       ETHER_ADDR_LEN * bp->max_l2_ctx,
+					       0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		PMD_DRV_LOG(ERR,
-			"Failed to alloc %u bytes needed to store MAC addr tbl",
+			"Failed to alloc %u bytes to store MAC addr tbl\n",
 			ETHER_ADDR_LEN * bp->max_l2_ctx);
 		rc = -ENOMEM;
 		goto error_free;
@@ -3328,7 +3348,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	bp->grp_info = rte_zmalloc("bnxt_grp_info",
-				sizeof(*bp->grp_info) * bp->max_ring_grps, 0);
+				   sizeof(*bp->grp_info) * bp->max_ring_grps,
+				   0);
 	if (!bp->grp_info) {
 		PMD_DRV_LOG(ERR,
 			"Failed to alloc %zu bytes to store group info table\n",
@@ -3339,8 +3360,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 
 	/* Forward all requests if firmware is new enough */
 	if (((bp->fw_ver >= ((20 << 24) | (6 << 16) | (100 << 8))) &&
-	    (bp->fw_ver < ((20 << 24) | (7 << 16)))) ||
-	    ((bp->fw_ver >= ((20 << 24) | (8 << 16))))) {
+	     (bp->fw_ver < ((20 << 24) | (7 << 16)))) ||
+	    (bp->fw_ver >= ((20 << 24) | (8 << 16)))) {
 		memset(bp->pf.vf_req_fwd, 0xff, sizeof(bp->pf.vf_req_fwd));
 	} else {
 		PMD_DRV_LOG(WARNING,
@@ -3363,8 +3384,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	ALLOW_FUNC(HWRM_VNIC_TPA_CFG);
 	rc = bnxt_hwrm_func_driver_register(bp);
 	if (rc) {
-		PMD_DRV_LOG(ERR,
-			"Failed to register driver");
+		PMD_DRV_LOG(ERR, "Failed to register driver\n");
 		rc = -EBUSY;
 		goto error_free;
 	}
@@ -3477,7 +3497,7 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
 }
 
 static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
-	struct rte_pci_device *pci_dev)
+			  struct rte_pci_device *pci_dev)
 {
 	return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct bnxt),
 		bnxt_dev_init);
Signature · 1 line
2.15.1 (Apple Git-101)
#26 lore raw

PATCH 21/31 net/bnxt: move function check zero bytes to bnxt util.h

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Move check_zero_bytes into new bnxt_util.h file.

---
 drivers/net/bnxt/Makefile      |  1 +
 drivers/net/bnxt/bnxt_ethdev.c |  1 +
 drivers/net/bnxt/bnxt_filter.c |  9 ---------
 drivers/net/bnxt/bnxt_filter.h |  1 -
 drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
 drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
 6 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h
drivers/net/bnxt/Makefile +1 -0
index fd0cb5235..80db03ea8 100644
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_util.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += rte_pmd_bnxt.c
 
 #
drivers/net/bnxt/bnxt_ethdev.c +1 -0
index 6516aeedd..9cfa43778 100644
@@ -26,6 +26,7 @@
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 #include "bnxt_nvm_defs.h"
+#include "bnxt_util.h"
 
 #define DRV_MODULE_NAME		"bnxt"
 static const char bnxt_version[] =
drivers/net/bnxt/bnxt_filter.c +0 -9
index e36da9977..72989ab67 100644
@@ -231,15 +231,6 @@ nxt_non_void_action(const struct rte_flow_action *cur)
 	}
 }
 
-int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
-{
-	int i;
-	for (i = 0; i < len; i++)
-		if (bytes[i] != 0x00)
-			return 0;
-	return 1;
-}
-
 static int
 bnxt_filter_type_check(const struct rte_flow_item pattern[],
 		       struct rte_flow_error *error __rte_unused)
drivers/net/bnxt/bnxt_filter.h +0 -1
index d27be7032..a1ecfb19d 100644
@@ -69,7 +69,6 @@ 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 bnxt_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
drivers/net/bnxt/bnxt_util.c new file +18 -0
new file mode 100644
index 000000000..7d3342719
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
+ */
+
+#include <inttypes.h>
+
+#include "bnxt_util.h"
+
+int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
+{
+	int i;
+
+	for (i = 0; i < len; i++)
+		if (bytes[i] != 0x00)
+			return 0;
+	return 1;
+}
drivers/net/bnxt/bnxt_util.h new file +11 -0
new file mode 100644
index 000000000..2378833cc
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _BNXT_UTIL_H_
+#define _BNXT_UTIL_H_
+
+int bnxt_check_zero_bytes(const uint8_t *bytes, int len);
+
+#endif /* _BNXT_UTIL_H_ */
Signature · 1 line
2.15.1 (Apple Git-101)
#27 lore raw

PATCH 22/31 net/bnxt: filter/flow refactoring

In reply to Ajit Khaparde

In preparation of more rte_flow support it has been decided to separate out filter and flow into their own files. Functionally the same.

---
 drivers/net/bnxt/Makefile      |    1 +
 drivers/net/bnxt/bnxt_filter.c | 1060 ------------------------------------
 drivers/net/bnxt/bnxt_flow.c   | 1167 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1168 insertions(+), 1060 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_flow.c
drivers/net/bnxt/Makefile +1 -0
index 80db03ea8..8be3cb0e4 100644
@@ -29,6 +29,7 @@ EXPORT_MAP := rte_pmd_bnxt_version.map
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_cpr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_filter.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_flow.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_hwrm.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_ring.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_rxq.c
drivers/net/bnxt/bnxt_filter.c +0 -1060

1,063 lines not on this page · raw message

drivers/net/bnxt/bnxt_flow.c new file +1167 -0

1,167 lines not on this page · raw message

Signature · 1 line
2.15.1 (Apple Git-101)
#29 lore raw

PATCH 23/31 net/bnxt: check for invalid vnic id

In reply to Ajit Khaparde

From: Jay Ding <[email protected]>

Add checking for VNIC id before sending message to firmware in bnxt_hwrm_vnic_plcmode_cfg().

---
 drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
index 64687a69b..910129f12 100644
@@ -1560,6 +1560,11 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 	struct hwrm_vnic_plcmodes_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint16_t size;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+		PMD_DRV_LOG(DEBUG, "VNIC ID %x\n", vnic->fw_vnic_id);
+		return rc;
+	}
+
 	HWRM_PREP(req, VNIC_PLCMODES_CFG);
 
 	req.flags = rte_cpu_to_le_32(
Signature · 1 line
2.15.1 (Apple Git-101)
#30 lore raw

Re: [PATCH 23/31] net/bnxt: check for invalid vnic id

Quoted 4 lines · Ajit Khaparde

From: Jay Ding <[email protected]>

Add checking for VNIC id before sending message to firmware in bnxt_hwrm_vnic_plcmode_cfg().

Can you please add more information, when fw_vnic_id == INVALID_HW_RING_ID, what does it mean to have fw_vnic_id == INVALID_HW_RING_ID, what is the expected result without this check?

If this is fixing an issue please update commit according with proper Fixex/stable tags that patch can be backported to stable trees.

Quoted 25 lines
---
 drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
index 64687a69b..910129f12 100644
@@ -1560,6 +1560,11 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 	struct hwrm_vnic_plcmodes_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint16_t size;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+		PMD_DRV_LOG(DEBUG, "VNIC ID %x\n", vnic->fw_vnic_id);
+		return rc;
+	}
+
 	HWRM_PREP(req, VNIC_PLCMODES_CFG);
 
 	req.flags = rte_cpu_to_le_32(
#31 lore raw

PATCH 24/31 net/bnxt: update HWRM API to v1.9.2.9

In reply to Ajit Khaparde

From: Rob Miller <[email protected]>

update HWRM API to v1.9.2.9

---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 113 ++++++++++++++++++++++++++++++++-
 1 file changed, 111 insertions(+), 2 deletions(-)
drivers/net/bnxt/hsi_struct_def_dpdk.h +111 -2
index fd6d8807e..f5c7b4228 100644
@@ -686,8 +686,8 @@ struct hwrm_err_output {
 #define HWRM_VERSION_MINOR 9
 #define HWRM_VERSION_UPDATE 2
 /* non-zero means beta version */
-#define HWRM_VERSION_RSVD 6
-#define HWRM_VERSION_STR "1.9.2.6"
+#define HWRM_VERSION_RSVD 9
+#define HWRM_VERSION_STR "1.9.2.9"
 
 /****************
  * hwrm_ver_get *
@@ -3183,6 +3183,9 @@ struct hwrm_async_event_cmpl {
 	/* LLFC/PFC Configuration Change */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LLFC_PFC_CHANGE \
 		UINT32_C(0x34)
+	/* Default VNIC Configuration Change */
+	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE \
+		UINT32_C(0x35)
 	/* HWRM Error */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR \
 		UINT32_C(0xff)
@@ -3280,6 +3283,11 @@ struct hwrm_async_event_cmpl_link_status_change {
 		UINT32_C(0xffff0)
 	#define HWRM_ASYNC_EVENT_CMPL_LINK_STATUS_CHANGE_EVENT_DATA1_PORT_ID_SFT \
 		4
+	/* Indicates the physical function this event occured on. */
+	#define HWRM_ASYNC_EVENT_CMPL_LINK_STATUS_CHANGE_EVENT_DATA1_PF_ID_MASK \
+		UINT32_C(0xff00000)
+	#define HWRM_ASYNC_EVENT_CMPL_LINK_STATUS_CHANGE_EVENT_DATA1_PF_ID_SFT \
+		20
 } __attribute__((packed));
 
 /* hwrm_async_event_cmpl_link_mtu_change (size:128b/16B) */
@@ -4087,6 +4095,10 @@ struct hwrm_async_event_cmpl_vf_flr {
 	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_VF_ID_MASK \
 		UINT32_C(0xffff)
 	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_VF_ID_SFT 0
+	/* Indicates the physical function this event occured on. */
+	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_PF_ID_MASK \
+		UINT32_C(0xff0000)
+	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_PF_ID_SFT 16
 } __attribute__((packed));
 
 /* hwrm_async_event_cmpl_vf_mac_addr_change (size:128b/16B) */
@@ -4354,6 +4366,88 @@ struct hwrm_async_event_cmpl_llfc_pfc_change {
 		5
 } __attribute__((packed));
 
+/* hwrm_async_event_cmpl_default_vnic_change (size:128b/16B) */
+struct hwrm_async_event_cmpl_default_vnic_change {
+	uint16_t	type;
+	/*
+	 * This field indicates the exact type of the completion.
+	 * By convention, the LSB identifies the length of the
+	 * record in 16B units.  Even values indicate 16B
+	 * records.  Odd values indicate 32B
+	 * records.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_MASK \
+		UINT32_C(0x3f)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_SFT \
+		0
+	/* HWRM Asynchronous Event Information */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_HWRM_ASYNC_EVENT \
+		UINT32_C(0x2e)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_HWRM_ASYNC_EVENT
+	/* unused1 is 10 b */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_UNUSED1_MASK \
+		UINT32_C(0xffc0)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_UNUSED1_SFT \
+		6
+	/* Identifiers of events. */
+	uint16_t	event_id;
+	/* Notification of a default vnic allocaiton or free */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_ID_ALLOC_FREE_NOTIFICATION \
+		UINT32_C(0x35)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_ID_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_ID_ALLOC_FREE_NOTIFICATION
+	/* Event specific data */
+	uint32_t	event_data2;
+	uint8_t	opaque_v;
+	/*
+	 * This value is written by the NIC such that it will be different
+	 * for each pass through the completion queue.   The even passes
+	 * will write 1.  The odd passes will write 0.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_V \
+		UINT32_C(0x1)
+	/* opaque is 7 b */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_OPAQUE_MASK \
+		UINT32_C(0xfe)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_OPAQUE_SFT 1
+	/* 8-lsb timestamp from POR (100-msec resolution) */
+	uint8_t	timestamp_lo;
+	/* 16-lsb timestamp from POR (100-msec resolution) */
+	uint16_t	timestamp_hi;
+	/* Event specific data */
+	uint32_t	event_data1;
+	/* Indicates default vnic configuration change */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_MASK \
+		UINT32_C(0x3)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_SFT \
+		0
+	/*
+	 * If this field is set to 1, then it indicates that
+	 * a default VNIC has been allocate.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_ALLOC \
+		UINT32_C(0x1)
+	/*
+	 * If this field is set to 2, then it indicates that
+	 * a default VNIC has been freed.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_FREE \
+		UINT32_C(0x2)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_FREE
+	/* Indicates the physical function this event occured on. */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_PF_ID_MASK \
+		UINT32_C(0x3fc)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_PF_ID_SFT \
+		2
+	/* Indicates the virtual function this event occured on */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_MASK \
+		UINT32_C(0x3fffc00)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT \
+		10
+} __attribute__((packed));
+
 /* hwrm_async_event_cmpl_hwrm_error (size:128b/16B) */
 struct hwrm_async_event_cmpl_hwrm_error {
 	uint16_t	type;
@@ -5196,6 +5290,21 @@ struct hwrm_func_qcaps_output {
 	 */
 	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PCIE_STATS_SUPPORTED \
 		UINT32_C(0x10000)
+	/*
+	 * If the query is for a VF, then this flag shall be ignored,
+	 * If this query is for a PF and this flag is set to 1,
+	 * then the PF has the capability to adopt the VF's belonging
+	 * to another PF.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ADOPTED_PF_SUPPORTED \
+		UINT32_C(0x20000)
+	/*
+	 * If the query is for a VF, then this flag shall be ignored,
+	 * If this query is for a PF and this flag is set to 1,
+	 * then the PF has the capability to administer another PF.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ADMIN_PF_SUPPORTED \
+		UINT32_C(0x40000)
 	/*
 	 * This value is current MAC address configured for this
 	 * function. A value of 00-00-00-00-00-00 indicates no
Signature · 1 line
2.15.1 (Apple Git-101)
#32 lore raw

Re: [PATCH 24/31] net/bnxt: update HWRM API to v1.9.2.9

Quoted 3 lines · Ajit Khaparde

From: Rob Miller <[email protected]>

update HWRM API to v1.9.2.9

Does it make sense to update release notes to document this update?

Quoted 6 lines
#33 lore raw

Re: [PATCH 24/31] net/bnxt: update HWRM API to v1.9.2.9

Quoted 7 lines · Ferruh Yigit
Quoted 3 lines · Ajit Khaparde

From: Rob Miller <[email protected]>

update HWRM API to v1.9.2.9

Does it make sense to update release notes to document this update?

​Since there are a few more weeks for release,
there is a good chance of updating the HWRM version.
I will update the release notes as we get close to the release depending on what version we end up with. I hope that is ok?
​

#34 lore raw

PATCH 25/31 net/bnxt: fix Tx with multiple mbuf

In reply to Ajit Khaparde

From: Xiaoxin Peng <[email protected]>

When using multi-mbuf to xmit large packets, we need to use total packet lengths (sum of all segments) to set txbd->flags_type. Packets will not be sent when using tx_pkt->data_len(The first segment of packets).

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_txr.c +2 -2
index f8fd22156..23c8e6660 100644
@@ -160,10 +160,10 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		*cmpl_next = false;
 	}
 	txbd->len = tx_pkt->data_len;
-	if (txbd->len >= 2014)
+	if (tx_pkt->pkt_len >= 2014)
 		txbd->flags_type |= TX_BD_LONG_FLAGS_LHINT_GTE2K;
 	else
-		txbd->flags_type |= lhint_arr[txbd->len >> 9];
+		txbd->flags_type |= lhint_arr[tx_pkt->pkt_len >> 9];
 	txbd->address = rte_cpu_to_le_32(rte_mbuf_data_iova(tx_buf->mbuf));
 
 	if (long_bd) {
Signature · 1 line
2.15.1 (Apple Git-101)
#35 lore raw

PATCH 26/31 net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

The L2 filter id is needed in many scenarios particularly when we are repurposing the same ntuple filter with different destination queues.

Fixes 1383434c9089("net/bnxt: reset L2 filter id once filter is freed")
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -1
index 910129f12..ba8e44a9b 100644
@@ -3798,7 +3798,6 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 	HWRM_UNLOCK();
 
 	filter->fw_ntuple_filter_id = UINT64_MAX;
-	filter->fw_l2_filter_id = UINT64_MAX;
 
 	return 0;
 }
Signature · 1 line
2.15.1 (Apple Git-101)
#36 lore raw

PATCH 27/31 net/bnxt: check filter type before clearing it

In reply to Ajit Khaparde

In bnxt_free_filter_mem(), check the filter type and call the appropriate HWRM command to clear the filter from HW.

---
 drivers/net/bnxt/bnxt_filter.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_filter.c +17 -4
index 31757d32c..1038941e8 100644
@@ -117,16 +117,29 @@ void bnxt_free_filter_mem(struct bnxt *bp)
 	max_filters = bp->max_l2_ctx;
 	for (i = 0; i < max_filters; i++) {
 		filter = &bp->filter_info[i];
-		if (filter->fw_l2_filter_id != ((uint64_t)-1)) {
-			PMD_DRV_LOG(ERR, "HWRM filter is not freed??\n");
+		if (filter->fw_l2_filter_id != ((uint64_t)-1) &&
+		    filter->filter_type == HWRM_CFA_L2_FILTER) {
+			PMD_DRV_LOG(ERR, "L2 filter is not free\n");
 			/* Call HWRM to try to free filter again */
 			rc = bnxt_hwrm_clear_l2_filter(bp, filter);
 			if (rc)
 				PMD_DRV_LOG(ERR,
-				       "HWRM filter cannot be freed rc = %d\n",
-					rc);
+					    "Cannot free L2 filter: %d\n",
+					    rc);
 		}
 		filter->fw_l2_filter_id = UINT64_MAX;
+
+		if (filter->fw_ntuple_filter_id != ((uint64_t)-1) &&
+		    filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
+			PMD_DRV_LOG(ERR, "NTUPLE filter is not free\n");
+			/* Call HWRM to try to free filter again */
+			rc = bnxt_hwrm_clear_ntuple_filter(bp, filter);
+			if (rc)
+				PMD_DRV_LOG(ERR,
+					    "Cannot free NTUPLE filter: %d\n",
+					    rc);
+		}
+		filter->fw_ntuple_filter_id = UINT64_MAX;
 	}
 	STAILQ_INIT(&bp->free_filter_list);
 
Signature · 1 line
2.15.1 (Apple Git-101)
#37 lore raw

Re: [PATCH 27/31] net/bnxt: check filter type before clearing it

Quoted 2 lines · Ajit Khaparde

In bnxt_free_filter_mem(), check the filter type and call the appropriate HWRM command to clear the filter from HW.

Just to double check, is this check to fix an issue? If so do you want to backport the fix into stable trees?

Quoted 2 lines

<...>

#38 lore raw

PATCH 28/31 net/bnxt: fix set MTU

In reply to Ajit Khaparde

There is no need to update hardware configuration if new MTU is not greater than the max data the mbuf can accommodate.

Fixes daef48efe5e5 ("net/bnxt: support set MTU")
---
 drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +9 -3
index 9cfa43778..1145bc195 100644
@@ -1597,6 +1597,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	for (i = 0; i < bp->nr_vnics; i++) {
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+		uint16_t size = 0;
 
 		vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN +
 					ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
@@ -1604,9 +1605,14 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		if (rc)
 			break;
 
-		rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
-		if (rc)
-			return rc;
+		size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
+		size -= RTE_PKTMBUF_HEADROOM;
+
+		if (size < new_mtu) {
+			rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+			if (rc)
+				return rc;
+		}
 	}
 
 	return rc;
Signature · 1 line
2.15.1 (Apple Git-101)
#39 lore raw

Re: [PATCH 28/31] net/bnxt: fix set MTU

Quoted 2 lines · Ajit Khaparde

There is no need to update hardware configuration if new MTU is not greater than the max data the mbuf can accommodate.

If app sets a smaller MTU won't it expect that HW will drop received packets bigger than provided size? Will this logic work if HW is not updated?

Quoted 40 lines
Fixes daef48efe5e5 ("net/bnxt: support set MTU")
---
 drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +9 -3
index 9cfa43778..1145bc195 100644
@@ -1597,6 +1597,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	for (i = 0; i < bp->nr_vnics; i++) {
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+		uint16_t size = 0;
 
 		vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN +
 					ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
@@ -1604,9 +1605,14 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		if (rc)
 			break;
 
-		rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
-		if (rc)
-			return rc;
+		size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
+		size -= RTE_PKTMBUF_HEADROOM;
+
+		if (size < new_mtu) {
+			rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+			if (rc)
+				return rc;
+		}
 	}
 
 	return rc;
#40 lore raw

Re: [PATCH 28/31] net/bnxt: fix set MTU

Quoted 8 lines · Ferruh Yigit
Quoted 2 lines · Ajit Khaparde

There is no need to update hardware configuration if new MTU is not greater than the max data the mbuf can accommodate.

If app sets a smaller MTU won't it expect that HW will drop received packets
bigger than provided size? Will this logic work if HW is not updated?

​Actually, the commit message needs rephrased.
The behavior you mentioned will not be impacted.
​The hardware will honor the MTU configured.​

#41 lore raw

PATCH 29/31 net/bnxt: fix incorrect IO address handling in Tx

In reply to Ajit Khaparde

rte_mbuf_data_iova returns a 64-bit address. But we are incorrectly using only 32-bits of that. Use rte_cpu_to_le_64 instead of rte_cpu_to_le_32

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_txr.c +2 -2
index 23c8e6660..4e684f208 100644
@@ -164,7 +164,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		txbd->flags_type |= TX_BD_LONG_FLAGS_LHINT_GTE2K;
 	else
 		txbd->flags_type |= lhint_arr[tx_pkt->pkt_len >> 9];
-	txbd->address = rte_cpu_to_le_32(rte_mbuf_data_iova(tx_buf->mbuf));
+	txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(tx_buf->mbuf));
 
 	if (long_bd) {
 		txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
@@ -287,7 +287,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		tx_buf = &txr->tx_buf_ring[txr->tx_prod];
 
 		txbd = &txr->tx_desc_ring[txr->tx_prod];
-		txbd->address = rte_cpu_to_le_32(rte_mbuf_data_iova(m_seg));
+		txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(m_seg));
 		txbd->flags_type |= TX_BD_SHORT_TYPE_TX_BD_SHORT;
 		txbd->len = m_seg->data_len;
 
Signature · 1 line
2.15.1 (Apple Git-101)
#42 lore raw

PATCH 30/31 net/bnxt: allocate RSS context only if RSS mode is enabled.

In reply to Ajit Khaparde

allocate RSS context only if RSS mode is enabled.

---
 drivers/net/bnxt/bnxt_ethdev.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +10 -6
index 1145bc195..dfae6e2d2 100644
@@ -248,6 +248,7 @@ static int bnxt_init_chip(struct bnxt *bp)
 
 	/* VNIC configuration */
 	for (i = 0; i < bp->nr_vnics; i++) {
+		struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
 
 		rc = bnxt_hwrm_vnic_alloc(bp, vnic);
@@ -257,12 +258,15 @@ static int bnxt_init_chip(struct bnxt *bp)
 			goto err_out;
 		}
 
-		rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic);
-		if (rc) {
-			PMD_DRV_LOG(ERR,
-				"HWRM vnic %d ctx alloc failure rc: %x\n",
-				i, rc);
-			goto err_out;
+		/* Alloc RSS context only if RSS mode is enabled */
+		if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
+			rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic);
+			if (rc) {
+				PMD_DRV_LOG(ERR,
+					"HWRM vnic %d ctx alloc failure rc: %x\n",
+					i, rc);
+				goto err_out;
+			}
 		}
 
 		rc = bnxt_hwrm_vnic_cfg(bp, vnic);
Signature · 1 line
2.15.1 (Apple Git-101)
#43 lore raw

PATCH 31/31 net/bnxt: fix to move a flow to a different queue

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

While moving a flow to a different destination queue, the l2_filter_id being passed to the FW command was incorrect. Fix it by re-using the matching filter's l2_filter_id since that is supposed to be the same in this case.

Fixes 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
---
 drivers/net/bnxt/bnxt_flow.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +5 -1
index a491e9dbf..ac7656741 100644
@@ -968,9 +968,13 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf)
 				    sizeof(nf->dst_ipaddr_mask))) {
 				if (mf->dst_id == nf->dst_id)
 					return -EEXIST;
-				/* Same Flow, Different queue
+				/*
+				 * Same Flow, Different queue
 				 * Clear the old ntuple filter
+				 * Reuse the matching L2 filter
+				 * ID for the new filter
 				 */
+				nf->fw_l2_filter_id = mf->fw_l2_filter_id;
 				if (nf->filter_type == HWRM_CFA_EM_FILTER)
 					bnxt_hwrm_clear_em_filter(bp, mf);
 				if (nf->filter_type == HWRM_CFA_NTUPLE_FILTER)
Signature · 1 line
2.15.1 (Apple Git-101)
#44 lore raw
In reply to Ajit Khaparde
Quoted 41 lines · Ajit Khaparde

Patchset against dpdk-next-net contains bug fixes, some code refactoring and style cleanup.

Please apply.

Ajit Khaparde (15):
net/bnxt: fix clear port stats
net/bnxt: add Tx batching support
net/bnxt: Rx processing optimization
net/bnxt: set min and max descriptor count for Tx and Rx rings net/bnxt: fix dev close operation
net/bnxt: set ring coalesce parameters for Stratus NIC net/bnxt: fix HW Tx checksum offload check
net/bnxt: add support for VF id 0xd800
net/bnxt: fix rx/tx queue start/stop operations net/bnxt: code cleanup style of bnxt vnic
net/bnxt: filter/flow refactoring
net/bnxt: check filter type before clearing it net/bnxt: fix set MTU
net/bnxt: fix incorrect IO address handling in Tx net/bnxt: allocate RSS context only if RSS mode is enabled.

Jay Ding (1):
net/bnxt: check for invalid vnic id

Rob Miller (1):
net/bnxt: update HWRM API to v1.9.2.9

Scott Branden (11):
net/bnxt: code cleanup style of bnxt cpr net/bnxt: code cleanup style of bnxt rxr net/bnxt: code cleanup style of rte pmd bnxt file net/bnxt: code cleanup style of bnxt stats net/bnxt: code cleanup style of bnxt vnic net/bnxt: code cleanup style of bnxt txq net/bnxt: code cleanup style of bnxt rxq net/bnxt: code cleanup style of bnxt txr net/bnxt: code cleanup style of bnxt ring net/bnxt: code cleanup style of bnxt ethdev net/bnxt: move function check zero bytes to bnxt util.h

Quoted 6 lines

Somnath Kotur (2):
net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter net/bnxt: fix to move a flow to a different queue

Xiaoxin Peng (1):
net/bnxt: fix Tx with multiple mbuf

Hi Ajit,

./devtools/check-git-log.sh is giving some errors [1], can you please check them?

[1]
Wrong headline format:
net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter net/bnxt: allocate RSS context only if RSS mode is enabled.
Wrong headline uppercase:
net/bnxt: Rx processing optimization
net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter
Wrong headline lowercase:
net/bnxt: fix rx/tx queue start/stop operations
net/bnxt: code cleanup style of rte pmd bnxt file
Headline too long:
net/bnxt: set min and max descriptor count for Tx and Rx rings net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter
Line too long:
we are repurposing the same ntuple filter with different destination queues.
Wrong tag:

        Fixes: 893074951314 (net/bnxt: free memory in close operation)
        Fixes: 1383434c9089("net/bnxt: reset L2 filter id once filter is freed")
Wrong 'Fixes' reference:
        Fixes: 893074951314 (net/bnxt: free memory in close operation)
        Fixes: 1383434c9089("net/bnxt: reset L2 filter id once filter is freed")

Is it candidate for Cc: [email protected] backport?
net/bnxt: fix rx/tx queue start/stop operations net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter

#45 lore raw

v2 cover bnxt patchset

Patchset against dpdk-next-net. Please apply.

v1->v2:
Takes care of the various comments made in the previous version. I am dropping the style changes for now. I will send them later after addressing the coding convention issues.

Ajit Khaparde (16):
net/bnxt: fix clear port stats
net/bnxt: add Tx batching support
net/bnxt: optimize receive processing code net/bnxt: set MIN/MAX descriptor count fox Tx and Rx Rings net/bnxt: fix dev close operation
net/bnxt: set ring coalesce parameters for Stratus NIC net/bnxt: fix HW Tx checksum offload check net/bnxt: add support for VF id 0xd800
net/bnxt: fix Rx/Tx queue start/stop operations net/bnxt: refactor filter/flow
net/bnxt: check filter type before clearing it net/bnxt: fix set MTU
net/bnxt: fix incorrect IO address handling in Tx net/bnxt: allocate RSS context only if RSS mode is enabled net/bnxt: check VF resources if resource manager is enabled net/bnxt: fix Rx ring count limitation

Jay Ding (1):
net/bnxt: check for invalid vnic id

Rob Miller (1):
net/bnxt: update HWRM API to v1.9.2.9

Scott Branden (1):
net/bnxt: move function check zero bytes to bnxt util.h

Somnath Kotur (3):
net/bnxt: revert reset of L2 filter id net/bnxt: fix to move a flow to a different queue net/bnxt: use correct flags during VLAN configuration

Xiaoxin Peng (1):
net/bnxt: fix Tx with multiple mbuf

 drivers/net/bnxt/Makefile              |    2 +
 drivers/net/bnxt/bnxt.h                |   32 +
 drivers/net/bnxt/bnxt_cpr.h            |   12 +
 drivers/net/bnxt/bnxt_ethdev.c         |  120 +++-
 drivers/net/bnxt/bnxt_filter.c         | 1090 +----------------------------
 drivers/net/bnxt/bnxt_filter.h         |    1 -
 drivers/net/bnxt/bnxt_flow.c           | 1171 ++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c           |  224 ++++--
 drivers/net/bnxt/bnxt_hwrm.h           |    9 +-
 drivers/net/bnxt/bnxt_ring.c           |  115 ++++
 drivers/net/bnxt/bnxt_ring.h           |    1 +
 drivers/net/bnxt/bnxt_rxq.c            |   54 +-
 drivers/net/bnxt/bnxt_rxq.h            |    4 +
 drivers/net/bnxt/bnxt_rxr.c            |   26 +-
 drivers/net/bnxt/bnxt_rxr.h            |    2 +
 drivers/net/bnxt/bnxt_txq.h            |    1 +
 drivers/net/bnxt/bnxt_txr.c            |  156 +++--
 drivers/net/bnxt/bnxt_txr.h            |   10 +
 drivers/net/bnxt/bnxt_util.c           |   18 +
 drivers/net/bnxt/bnxt_util.h           |   11 +
 drivers/net/bnxt/bnxt_vnic.c           |    5 +-
 drivers/net/bnxt/bnxt_vnic.h           |    6 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  113 ++-
 23 files changed, 1952 insertions(+), 1231 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_flow.c
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h
Signature · 1 line
2.15.2 (Apple Git-101.1)
#46 lore raw

PATCH v2 1/23 net/bnxt: fix clear port stats

PORT_CLR_STATS is not allowed for VFs, NPAR, MultiHost functions or when SR-IOV is enabled.
Don't send the HWRM command in such cases.

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

--
v1->v2: Fix a checkpatch warning.

---
 drivers/net/bnxt/bnxt.h      | 4 ++++
 drivers/net/bnxt/bnxt_hwrm.c | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +4 -0
index afaaf8c41..d19aea569 100644
@@ -98,6 +98,7 @@ struct bnxt_child_vf_info {
 struct bnxt_pf_info {
 #define BNXT_FIRST_PF_FID	1
 #define BNXT_MAX_VFS(bp)	(bp->pf.max_vfs)
+#define BNXT_TOTAL_VFS(bp)	((bp)->pf.total_vfs)
 #define BNXT_FIRST_VF_FID	128
 #define BNXT_PF_RINGS_USED(bp)	bnxt_get_num_queues(bp)
 #define BNXT_PF_RINGS_AVAIL(bp)	(bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
@@ -105,6 +106,9 @@ struct bnxt_pf_info {
 	uint16_t		first_vf_id;
 	uint16_t		active_vfs;
 	uint16_t		max_vfs;
+	uint16_t		total_vfs; /* Total VFs possible.
+					    * Not necessarily enabled.
+					    */
 	uint32_t		func_cfg_flags;
 	void			*vf_req_buf;
 	rte_iova_t		vf_req_buf_dma_addr;
drivers/net/bnxt/bnxt_hwrm.c +4 -1
index d6fdc1b88..f441d4610 100644
@@ -506,6 +506,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	if (BNXT_PF(bp)) {
 		bp->pf.port_id = resp->port_id;
 		bp->pf.first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
+		bp->pf.total_vfs = rte_le_to_cpu_16(resp->max_vfs);
 		new_max_vfs = bp->pdev->max_vfs;
 		if (new_max_vfs != bp->pf.max_vfs) {
 			if (bp->pf.vf_info)
@@ -3151,7 +3152,9 @@ int bnxt_hwrm_port_clr_stats(struct bnxt *bp)
 	struct bnxt_pf_info *pf = &bp->pf;
 	int rc;
 
-	if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+	/* Not allowed on NS2 device, NPAR, MultiHost, VF */
+	if (!(bp->flags & BNXT_FLAG_PORT_STATS) || BNXT_VF(bp) ||
+	    BNXT_NPAR(bp) || BNXT_MH(bp) || BNXT_TOTAL_VFS(bp))
 		return 0;
 
 	HWRM_PREP(req, PORT_CLR_STATS);
Signature · 1 line
2.15.2 (Apple Git-101.1)
#47 lore raw

PATCH v2 2/23 net/bnxt: add Tx batching support

In reply to Ajit Khaparde

Batch more than one Tx requests such that only one completion is generarted by the HW. We request a Tx completion for first and last Tx request in the batch.

---
 drivers/net/bnxt/bnxt_cpr.h | 12 ++++++
 drivers/net/bnxt/bnxt_txq.h |  1 +
 drivers/net/bnxt/bnxt_txr.c | 97 +++++++++++++++++++++++++++++----------------
 3 files changed, 75 insertions(+), 35 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +12 -0
index 6c1e6d2b0..c7af56983 100644
@@ -22,12 +22,20 @@
 #define ADV_RAW_CMP(idx, n)	((idx) + (n))
 #define NEXT_RAW_CMP(idx)	ADV_RAW_CMP(idx, 1)
 #define RING_CMP(ring, idx)	((idx) & (ring)->ring_mask)
+#define RING_CMPL(ring_mask, idx)	((idx) & (ring_mask))
 #define NEXT_CMP(idx)		RING_CMP(ADV_RAW_CMP(idx, 1))
 #define FLIP_VALID(cons, mask, val)	((cons) >= (mask) ? !(val) : (val))
 
 #define DB_CP_REARM_FLAGS	(DB_KEY_CP | DB_IDX_VALID)
 #define DB_CP_FLAGS		(DB_KEY_CP | DB_IDX_VALID | DB_IRQ_DIS)
 
+#define NEXT_CMPL(cpr, idx, v, inc)	do { \
+	(idx) += (inc); \
+	if (unlikely((idx) == (cpr)->cp_ring_struct->ring_size)) { \
+		(v) = !(v); \
+		(idx) = 0; \
+	} \
+} while (0)
 #define B_CP_DB_REARM(cpr, raw_cons)					\
 	rte_write32((DB_CP_REARM_FLAGS |				\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
@@ -50,6 +58,10 @@
 	rte_write32((DB_CP_FLAGS |					\
 		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
 		    ((cpr)->cp_doorbell))
+#define B_CP_DB(cpr, raw_cons, ring_mask)				\
+	rte_write32((DB_CP_FLAGS |					\
+		    RING_CMPL((ring_mask), raw_cons)),	\
+		    ((cpr)->cp_doorbell))
 
 struct bnxt_ring;
 struct bnxt_cp_ring_info {
drivers/net/bnxt/bnxt_txq.h +1 -0
index 720ca90cf..f2c712a75 100644
@@ -24,6 +24,7 @@ struct bnxt_tx_queue {
 	uint8_t			wthresh; /* Write-back threshold reg */
 	uint32_t		ctx_curr; /* Hardware context states */
 	uint8_t			tx_deferred_start; /* not in global dev start */
+	uint8_t			cmpl_next; /* Next BD to trigger a compl */
 
 	struct bnxt		*bp;
 	int			index;
drivers/net/bnxt/bnxt_txr.c +62 -35

143 lines not on this page · raw message

Signature · 1 line
2.15.2 (Apple Git-101.1)
#48 lore raw

PATCH v2 3/23 net/bnxt: optimize receive processing code

In reply to Ajit Khaparde

1) Use nb_rx_pkts instead of checking producer indices of Rx and aggregator rings to decide if any Rx completions were processed.
2) Post Rx buffers early in Rx processing instead of waiting for the budgeted burst quota.
3) Ring Rx CQ DB after Rx buffers are posted.

--
v1->v2: fix commit log

---
 drivers/net/bnxt/bnxt_rxr.c | 12 ++++++++----
 drivers/net/bnxt/bnxt_rxr.h |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +8 -4
index 9d8842926..b6b72c553 100644
@@ -540,8 +540,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	int rc = 0;
 	bool evt = false;
 
-	/* If Rx Q was stopped return */
-	if (rxq->rx_deferred_start)
+	/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
+	if (rxq->rx_deferred_start && rxq->queue_id)
 		return 0;
 
 	/* Handle RX burst request */
@@ -572,10 +572,13 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		raw_cons = NEXT_RAW_CMP(raw_cons);
 		if (nb_rx_pkts == nb_pkts || evt)
 			break;
+		/* Post some Rx buf early in case of larger burst processing */
+		if (nb_rx_pkts == BNXT_RX_POST_THRESH)
+			B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 	}
 
 	cpr->cp_raw_cons = raw_cons;
-	if ((prod == rxr->rx_prod && ag_prod == rxr->ag_prod) && !evt) {
+	if (!nb_rx_pkts && !evt) {
 		/*
 		 * For PMD, there is no need to keep on pushing to REARM
 		 * the doorbell if there are no new completions
@@ -583,7 +586,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		return nb_rx_pkts;
 	}
 
-	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
 	if (prod != rxr->rx_prod)
 		B_RX_DB(rxr->rx_doorbell, rxr->rx_prod);
 
@@ -591,6 +593,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	if (ag_prod != rxr->ag_prod)
 		B_RX_DB(rxr->ag_doorbell, rxr->ag_prod);
 
+	B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
 		int i;
drivers/net/bnxt/bnxt_rxr.h +2 -0
index 5b28f0321..3815a2199 100644
@@ -54,6 +54,8 @@
 #define RX_CMP_IP_CS_UNKNOWN(rxcmp1)					\
 		!((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)
 
+#define BNXT_RX_POST_THRESH	32
+
 enum pkt_hash_types {
 	PKT_HASH_TYPE_NONE,	/* Undefined type */
 	PKT_HASH_TYPE_L2,	/* Input: src_MAC, dest_MAC */
Signature · 1 line
2.15.2 (Apple Git-101.1)
#49 lore raw

PATCH v2 4/23 net/bnxt: set MIN/MAX descriptor count fox Tx and Rx Rings

In reply to Ajit Khaparde

Set MIN and MAX descriptor count for TX and RX rings.

--
v1->v2: fix commit log

---
 drivers/net/bnxt/bnxt.h        | 3 +++
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++++
 2 files changed, 7 insertions(+)
drivers/net/bnxt/bnxt.h +3 -0
index d19aea569..9a70617fc 100644
@@ -24,6 +24,9 @@
 #define VLAN_TAG_SIZE		4
 #define BNXT_MAX_LED		4
 #define BNXT_NUM_VLANS		2
+#define BNXT_MIN_RING_DESC	16
+#define BNXT_MAX_TX_RING_DESC	4096
+#define BNXT_MAX_RX_RING_DESC	8192
 
 struct bnxt_led_info {
 	uint8_t      led_id;
drivers/net/bnxt/bnxt_ethdev.c +4 -0
index 6e56bfd36..33560db0d 100644
@@ -449,6 +449,10 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
 	eth_dev->data->dev_conf.intr_conf.rxq = 1;
+	dev_info->rx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
+	dev_info->rx_desc_lim.nb_max = BNXT_MAX_RX_RING_DESC;
+	dev_info->tx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
+	dev_info->tx_desc_lim.nb_max = BNXT_MAX_TX_RING_DESC;
 
 	/* *INDENT-ON* */
 
Signature · 1 line
2.15.2 (Apple Git-101.1)
#50 lore raw

PATCH v2 5/23 net/bnxt: fix dev close operation

In reply to Ajit Khaparde

We are not cleaning up all the memory and also not unregistering the driver during device close operation. This patch fixes the issue.

Fixes 893074951314 ("net/bnxt: free memory in close operation")

--
v1->v2: Remove incorrectly added RTE_PCI_DRV_INTR_RMV.

---
 drivers/net/bnxt/bnxt_ethdev.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +17 -4
index 33560db0d..233a7c312 100644
@@ -152,6 +152,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
+static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
 
 /***********************/
 
@@ -668,6 +669,8 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 		rte_free(bp->grp_info);
 		bp->grp_info = NULL;
 	}
+
+	bnxt_dev_uninit(eth_dev);
 }
 
 static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
@@ -3116,7 +3119,6 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 	return rc;
 }
 
-static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
 
 #define ALLOW_FUNC(x)	\
 	{ \
@@ -3408,13 +3410,15 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 }
 
 static int
-bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
+bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
+{
 	struct bnxt *bp = eth_dev->data->dev_private;
 	int rc;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
+	PMD_DRV_LOG(DEBUG, "Calling Device uninit\n");
 	bnxt_disable_int(bp);
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp);
@@ -3428,8 +3432,17 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
 	}
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bnxt_free_hwrm_resources(bp);
-	rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
-	rte_memzone_free((const struct rte_memzone *)bp->rx_mem_zone);
+
+	if (bp->tx_mem_zone) {
+		rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
+		bp->tx_mem_zone = NULL;
+	}
+
+	if (bp->rx_mem_zone) {
+		rte_memzone_free((const struct rte_memzone *)bp->rx_mem_zone);
+		bp->rx_mem_zone = NULL;
+	}
+
 	if (bp->dev_stopped == 0)
 		bnxt_dev_close_op(eth_dev);
 	if (bp->pf.vf_info)
Signature · 1 line
2.15.2 (Apple Git-101.1)
#51 lore raw

PATCH v2 6/23 net/bnxt: set ring coalesce parameters for Stratus NIC

In reply to Ajit Khaparde

Set ring coalesce parameters for Stratus NIC.
Other skews don't necessarily need this.

---
 drivers/net/bnxt/bnxt.h        | 19 ++++++++++++++++
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++++
 drivers/net/bnxt/bnxt_hwrm.c   | 51 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  2 ++
 drivers/net/bnxt/bnxt_ring.c   | 23 +++++++++++++++++++
 5 files changed, 106 insertions(+)
drivers/net/bnxt/bnxt.h +19 -0
index 9a70617fc..1a746097b 100644
@@ -28,6 +28,14 @@
 #define BNXT_MAX_TX_RING_DESC	4096
 #define BNXT_MAX_RX_RING_DESC	8192
 
+#define BNXT_INT_LAT_TMR_MIN			75
+#define BNXT_INT_LAT_TMR_MAX			150
+#define BNXT_NUM_CMPL_AGGR_INT			36
+#define BNXT_CMPL_AGGR_DMA_TMR			37
+#define BNXT_NUM_CMPL_DMA_AGGR			36
+#define BNXT_CMPL_AGGR_DMA_TMR_DURING_INT	50
+#define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT	12
+
 struct bnxt_led_info {
 	uint8_t      led_id;
 	uint8_t      led_type;
@@ -209,6 +217,16 @@ struct bnxt_ptp_cfg {
 	uint32_t			tx_mapped_regs[BNXT_PTP_TX_REGS];
 };
 
+struct bnxt_coal {
+	uint16_t			num_cmpl_aggr_int;
+	uint16_t			num_cmpl_dma_aggr;
+	uint16_t			num_cmpl_dma_aggr_during_int;
+	uint16_t			int_lat_tmr_max;
+	uint16_t			int_lat_tmr_min;
+	uint16_t			cmpl_aggr_dma_tmr;
+	uint16_t			cmpl_aggr_dma_tmr_during_int;
+};
+
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
 struct bnxt {
 	void				*bar0;
@@ -315,6 +333,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
 int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
 
 bool is_bnxt_supported(struct rte_eth_dev *dev);
+bool bnxt_stratus_device(struct bnxt *bp);
 extern const struct rte_flow_ops bnxt_flow_ops;
 
 extern int bnxt_logtype_driver;
drivers/net/bnxt/bnxt_ethdev.c +11 -0
index 233a7c312..15dab10bb 100644
@@ -3073,6 +3073,17 @@ static bool bnxt_vf_pciid(uint16_t id)
 	return false;
 }
 
+bool bnxt_stratus_device(struct bnxt *bp)
+{
+	uint16_t id = bp->pdev->id.device_id;
+
+	if (id == BROADCOM_DEV_ID_STRATUS_NIC ||
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF1 ||
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2)
+		return true;
+	return false;
+}
+
 static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
drivers/net/bnxt/bnxt_hwrm.c +51 -0

54 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 60a4ab16a..b83aab306 100644
@@ -167,4 +167,6 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
 int bnxt_hwrm_ptp_cfg(struct bnxt *bp);
 int bnxt_vnic_rss_configure(struct bnxt *bp,
 			    struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
+			struct bnxt_coal *coal, uint16_t ring_id);
 #endif
drivers/net/bnxt/bnxt_ring.c +23 -0
index bb9f6d1c0..81eb89d74 100644
@@ -258,6 +258,24 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	return 0;
 }
 
+static void bnxt_init_dflt_coal(struct bnxt_coal *coal)
+{
+	/* Tick values in micro seconds.
+	 * 1 coal_buf x bufs_per_record = 1 completion record.
+	 */
+	coal->num_cmpl_aggr_int = BNXT_NUM_CMPL_AGGR_INT;
+	/* This is a 6-bit value and must not be 0, or we'll get non stop IRQ */
+	coal->num_cmpl_dma_aggr = BNXT_NUM_CMPL_DMA_AGGR;
+	/* This is a 6-bit value and must not be 0, or we'll get non stop IRQ */
+	coal->num_cmpl_dma_aggr_during_int = BNXT_NUM_CMPL_DMA_AGGR_DURING_INT;
+	coal->int_lat_tmr_max = BNXT_INT_LAT_TMR_MAX;
+	/* min timer set to 1/2 of interrupt timer */
+	coal->int_lat_tmr_min = BNXT_INT_LAT_TMR_MIN;
+	/* buf timer set to 1/4 of interrupt timer */
+	coal->cmpl_aggr_dma_tmr = BNXT_CMPL_AGGR_DMA_TMR;
+	coal->cmpl_aggr_dma_tmr_during_int = BNXT_CMPL_AGGR_DMA_TMR_DURING_INT;
+}
+
 /* ring_grp usage:
  * [0] = default completion ring
  * [1 -> +rx_cp_nr_rings] = rx_cp, rx rings
@@ -265,9 +283,12 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
  */
 int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 {
+	struct bnxt_coal coal;
 	unsigned int i;
 	int rc = 0;
 
+	bnxt_init_dflt_coal(&coal);
+
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
@@ -291,6 +312,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		cpr->cp_doorbell = (char *)bp->doorbell_base + i * 0x80;
 		bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id;
 		B_CP_DIS_DB(cpr, cpr->cp_raw_cons);
+		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 
 		if (!i) {
 			/*
@@ -379,6 +401,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 
 		txr->tx_doorbell = (char *)bp->doorbell_base + idx * 0x80;
 		txq->index = idx;
+		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 	}
 
 err_out:
Signature · 1 line
2.15.2 (Apple Git-101.1)
#52 lore raw

PATCH v2 7/23 net/bnxt: fix HW Tx checksum offload check

In reply to Ajit Khaparde

Add more checks for checksum calculation offload. Also check for tunnel frames and select the proper buffer descriptor size.

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_txr.h | 10 +++++++++
 2 files changed, 58 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_txr.c +48 -3
index 0fdf0fd08..68645b2f7 100644
@@ -135,7 +135,9 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 
 	if (tx_pkt->ol_flags & (PKT_TX_TCP_SEG | PKT_TX_TCP_CKSUM |
 				PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM |
-				PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM))
+				PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM |
+				PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN |
+				PKT_TX_TUNNEL_GENEVE))
 		long_bd = true;
 
 	tx_buf = &txr->tx_buf_ring[txr->tx_prod];
@@ -203,16 +205,46 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 			/* Outer IP, Inner IP, Inner TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_CKSUM) ==
+			   PKT_TX_OIP_IIP_TCP_CKSUM) {
+			/* Outer IP, Inner IP, Inner TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_UDP_CKSUM) ==
+			   PKT_TX_OIP_IIP_UDP_CKSUM) {
+			/* Outer IP, Inner IP, Inner TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
 		} else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_UDP_CKSUM) ==
 			   PKT_TX_IIP_TCP_UDP_CKSUM) {
 			/* (Inner) IP, (Inner) TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_IIP_UDP_CKSUM) ==
+			   PKT_TX_IIP_UDP_CKSUM) {
+			/* (Inner) IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_IIP_TCP_CKSUM) ==
+			   PKT_TX_IIP_TCP_CKSUM) {
+			/* (Inner) IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_IP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
 		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_UDP_CKSUM) ==
 			   PKT_TX_OIP_TCP_UDP_CKSUM) {
 			/* Outer IP, (Inner) TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_UDP_CKSUM) ==
+			   PKT_TX_OIP_UDP_CKSUM) {
+			/* Outer IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_TCP_CKSUM) ==
+			   PKT_TX_OIP_TCP_CKSUM) {
+			/* Outer IP, (Inner) TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_FLG_TIP_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
 		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_CKSUM) ==
 			   PKT_TX_OIP_IIP_CKSUM) {
 			/* Outer IP, Inner IP CSO */
@@ -223,11 +255,23 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 			/* TCP/UDP CSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
 			txbd1->mss = 0;
-		} else if (tx_pkt->ol_flags & PKT_TX_IP_CKSUM) {
+		} else if ((tx_pkt->ol_flags & PKT_TX_TCP_CKSUM) ==
+			   PKT_TX_TCP_CKSUM) {
+			/* TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_UDP_CKSUM) ==
+			   PKT_TX_UDP_CKSUM) {
+			/* TCP/UDP CSO */
+			txbd1->lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+			txbd1->mss = 0;
+		} else if ((tx_pkt->ol_flags & PKT_TX_IP_CKSUM) ==
+			   PKT_TX_IP_CKSUM) {
 			/* IP CSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
 			txbd1->mss = 0;
-		} else if (tx_pkt->ol_flags & PKT_TX_OUTER_IP_CKSUM) {
+		} else if ((tx_pkt->ol_flags & PKT_TX_OUTER_IP_CKSUM) ==
+			   PKT_TX_OUTER_IP_CKSUM) {
 			/* IP CSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_T_IP_CHKSUM;
 			txbd1->mss = 0;
@@ -251,6 +295,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	}
 
 	txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
+	txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags);
 
 	txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
 
drivers/net/bnxt/bnxt_txr.h +10 -0
index 15c7e5a09..7f3c7cdb0 100644
@@ -45,10 +45,20 @@ 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)
+#define PKT_TX_OIP_IIP_UDP_CKSUM	(PKT_TX_UDP_CKSUM | \
+					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
+#define PKT_TX_OIP_IIP_TCP_CKSUM	(PKT_TX_TCP_CKSUM | \
+					PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_IIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_IP_CKSUM)
+#define PKT_TX_IIP_TCP_CKSUM		(PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM)
+#define PKT_TX_IIP_UDP_CKSUM		(PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM)
 #define PKT_TX_OIP_TCP_UDP_CKSUM	(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
 					PKT_TX_OUTER_IP_CKSUM)
+#define PKT_TX_OIP_UDP_CKSUM		(PKT_TX_UDP_CKSUM | \
+					PKT_TX_OUTER_IP_CKSUM)
+#define PKT_TX_OIP_TCP_CKSUM		(PKT_TX_TCP_CKSUM | \
+					PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_OIP_IIP_CKSUM		(PKT_TX_IP_CKSUM |	\
 					 PKT_TX_OUTER_IP_CKSUM)
 #define PKT_TX_TCP_UDP_CKSUM		(PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM)
Signature · 1 line
2.15.2 (Apple Git-101.1)
#53 lore raw

PATCH v2 8/23 net/bnxt: add support for VF id 0xd800

In reply to Ajit Khaparde

Add support for StingRay VF device 0xd800

---
 drivers/net/bnxt/bnxt_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -1
index 15dab10bb..0bb3f29d9 100644
@@ -73,6 +73,7 @@ int bnxt_logtype_driver;
 #define BROADCOM_DEV_ID_58802 0xd802
 #define BROADCOM_DEV_ID_58804 0xd804
 #define BROADCOM_DEV_ID_58808 0x16f0
+#define BROADCOM_DEV_ID_58802_VF 0xd800
 
 static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
@@ -116,6 +117,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58802) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58804) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58808) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58802_VF) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
@@ -3068,7 +3070,8 @@ static bool bnxt_vf_pciid(uint16_t id)
 	    id == BROADCOM_DEV_ID_5741X_VF ||
 	    id == BROADCOM_DEV_ID_57414_VF ||
 	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF1 ||
-	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2)
+	    id == BROADCOM_DEV_ID_STRATUS_NIC_VF2 ||
+	    id == BROADCOM_DEV_ID_58802_VF)
 		return true;
 	return false;
 }
Signature · 1 line
2.15.2 (Apple Git-101.1)
#54 lore raw

PATCH v2 9/23 net/bnxt: fix Rx/Tx queue start/stop operations

In reply to Ajit Khaparde

Packets destined to the to-be-stopped queue should not be dropped (neither in HW nor in the driver), so re-program the RSS Table without this queue on stop and add it back to the table on start unless it is a Representor VF.

Since 0th entry is used for default ring, use fw_grp_id + 1 to change the RSS table population logic by programming valid IDs instead of the default zeroth entry in case of an invalid fw_grp_id.

Destroy and recreate the trio of Rx rings(compl, Rx, AG) every time in start so that HW is in sync with software.

Fixes 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")

--
v1->v2: Fix checkpatch warning.

---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 10 ++++-
 drivers/net/bnxt/bnxt_hwrm.c   | 94 +++++++++++++++++++-----------------------
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 drivers/net/bnxt/bnxt_ring.c   | 92 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_ring.h   |  1 +
 drivers/net/bnxt/bnxt_rxq.c    | 54 +++++++++++++++++++-----
 drivers/net/bnxt/bnxt_rxq.h    |  4 ++
 drivers/net/bnxt/bnxt_rxr.c    | 16 +++++--
 9 files changed, 206 insertions(+), 67 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index 1a746097b..246b8d4d8 100644
@@ -27,6 +27,7 @@
 #define BNXT_MIN_RING_DESC	16
 #define BNXT_MAX_TX_RING_DESC	4096
 #define BNXT_MAX_RX_RING_DESC	8192
+#define BNXT_DB_SIZE		0x80
 
 #define BNXT_INT_LAT_TMR_MIN			75
 #define BNXT_INT_LAT_TMR_MAX			150
drivers/net/bnxt/bnxt_ethdev.c +9 -1
index 0bb3f29d9..22cf8fb93 100644
@@ -198,13 +198,14 @@ static int bnxt_alloc_mem(struct bnxt *bp)
 
 static int bnxt_init_chip(struct bnxt *bp)
 {
-	unsigned int i;
+	struct bnxt_rx_queue *rxq;
 	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;
 	uint32_t intr_vector = 0;
 	uint32_t queue_id, base = BNXT_MISC_VEC_ID;
 	uint32_t vec = BNXT_MISC_VEC_ID;
+	unsigned int i, j;
 	int rc;
 
 	/* disable uio/vfio intr/eventfd mapping */
@@ -278,6 +279,13 @@ static int bnxt_init_chip(struct bnxt *bp)
 			goto err_out;
 		}
 
+		for (j = 0; j < bp->rx_nr_rings; j++) {
+			rxq = bp->eth_dev->data->rx_queues[j];
+
+			if (rxq->rx_deferred_start)
+				rxq->vnic->fw_grp_ids[j] = INVALID_HW_RING_ID;
+		}
+
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 		if (rc) {
 			PMD_DRV_LOG(ERR,
drivers/net/bnxt/bnxt_hwrm.c +42 -52

126 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +1 -0
index b83aab306..4a237c4b4 100644
@@ -107,6 +107,7 @@ int bnxt_set_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_clear_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 void bnxt_free_all_hwrm_resources(struct bnxt *bp);
 void bnxt_free_hwrm_resources(struct bnxt *bp);
+void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_resources(struct bnxt *bp);
 int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link);
 int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up);
drivers/net/bnxt/bnxt_ring.c +92 -0

98 lines not on this page · raw message

drivers/net/bnxt/bnxt_ring.h +1 -0
index 65bf3e2f5..1446d784f 100644
@@ -70,6 +70,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 			    struct bnxt_rx_queue *rxq,
 			    struct bnxt_cp_ring_info *cp_ring_info,
 			    const char *suffix);
+int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_rings(struct bnxt *bp);
 
 #endif
drivers/net/bnxt/bnxt_rxq.c +44 -10

115 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxq.h +4 -0
index 8307f603c..e5d6001d3 100644
@@ -10,6 +10,9 @@ struct bnxt;
 struct bnxt_rx_ring_info;
 struct bnxt_cp_ring_info;
 struct bnxt_rx_queue {
+	rte_spinlock_t		lock;	/* Synchronize between rx_queue_stop
+					 * and fast path
+					 */
 	struct rte_mempool	*mb_pool; /* mbuf pool for RX ring */
 	struct rte_mbuf		*pkt_first_seg; /* 1st seg of pkt */
 	struct rte_mbuf		*pkt_last_seg; /* Last seg of pkt */
@@ -54,4 +57,5 @@ 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);
+void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq);
 #endif
drivers/net/bnxt/bnxt_rxr.c +12 -4
index b6b72c553..c7bc88481 100644
@@ -541,7 +541,9 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	bool evt = false;
 
 	/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
-	if (rxq->rx_deferred_start && rxq->queue_id)
+	if (unlikely(((rxq->rx_deferred_start ||
+		       !rte_spinlock_trylock(&rxq->lock)) &&
+		      rxq->queue_id)))
 		return 0;
 
 	/* Handle RX burst request */
@@ -583,7 +585,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * For PMD, there is no need to keep on pushing to REARM
 		 * the doorbell if there are no new completions
 		 */
-		return nb_rx_pkts;
+		goto done;
 	}
 
 	if (prod != rxr->rx_prod)
@@ -618,16 +620,22 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		}
 	}
 
+done:
+	rte_spinlock_unlock(&rxq->lock);
+
 	return nb_rx_pkts;
 }
 
 void bnxt_free_rx_rings(struct bnxt *bp)
 {
 	int i;
+	struct bnxt_rx_queue *rxq;
 
-	for (i = 0; i < (int)bp->rx_nr_rings; i++) {
-		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
+	if (!bp->rx_queues)
+		return;
 
+	for (i = 0; i < (int)bp->rx_nr_rings; i++) {
+		rxq = bp->rx_queues[i];
 		if (!rxq)
 			continue;
 
Signature · 1 line
2.15.2 (Apple Git-101.1)
#55 lore raw

PATCH v2 10/23 net/bnxt: move function check zero bytes to bnxt util.h

In reply to Ajit Khaparde

From: Scott Branden <[email protected]>

Move check_zero_bytes into new bnxt_util.h file.

---
 drivers/net/bnxt/Makefile      |  1 +
 drivers/net/bnxt/bnxt_ethdev.c |  1 +
 drivers/net/bnxt/bnxt_filter.c |  9 ---------
 drivers/net/bnxt/bnxt_filter.h |  1 -
 drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
 drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
 6 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h
drivers/net/bnxt/Makefile +1 -0
index fd0cb5235..80db03ea8 100644
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_util.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += rte_pmd_bnxt.c
 
 #
drivers/net/bnxt/bnxt_ethdev.c +1 -0
index 22cf8fb93..ab3f5c8e7 100644
@@ -26,6 +26,7 @@
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 #include "bnxt_nvm_defs.h"
+#include "bnxt_util.h"
 
 #define DRV_MODULE_NAME		"bnxt"
 static const char bnxt_version[] =
drivers/net/bnxt/bnxt_filter.c +0 -9
index e36da9977..72989ab67 100644
@@ -231,15 +231,6 @@ nxt_non_void_action(const struct rte_flow_action *cur)
 	}
 }
 
-int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
-{
-	int i;
-	for (i = 0; i < len; i++)
-		if (bytes[i] != 0x00)
-			return 0;
-	return 1;
-}
-
 static int
 bnxt_filter_type_check(const struct rte_flow_item pattern[],
 		       struct rte_flow_error *error __rte_unused)
drivers/net/bnxt/bnxt_filter.h +0 -1
index d27be7032..a1ecfb19d 100644
@@ -69,7 +69,6 @@ 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 bnxt_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
drivers/net/bnxt/bnxt_util.c new file +18 -0
new file mode 100644
index 000000000..7d3342719
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
+ */
+
+#include <inttypes.h>
+
+#include "bnxt_util.h"
+
+int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
+{
+	int i;
+
+	for (i = 0; i < len; i++)
+		if (bytes[i] != 0x00)
+			return 0;
+	return 1;
+}
drivers/net/bnxt/bnxt_util.h new file +11 -0
new file mode 100644
index 000000000..2378833cc
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _BNXT_UTIL_H_
+#define _BNXT_UTIL_H_
+
+int bnxt_check_zero_bytes(const uint8_t *bytes, int len);
+
+#endif /* _BNXT_UTIL_H_ */
Signature · 1 line
2.15.2 (Apple Git-101.1)
#56 lore raw

Re: [PATCH v2 10/23] net/bnxt: move function check zero bytes to bnxt util.h

Quoted 22 lines · Ajit Khaparde

From: Scott Branden <[email protected]>

Move check_zero_bytes into new bnxt_util.h file.

---
 drivers/net/bnxt/Makefile      |  1 +
 drivers/net/bnxt/bnxt_ethdev.c |  1 +
 drivers/net/bnxt/bnxt_filter.c |  9 ---------
 drivers/net/bnxt/bnxt_filter.h |  1 -
 drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
 drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
 6 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h
drivers/net/bnxt/Makefile +0 -0
index fd0cb5235..80db03ea8 100644

drivers/net/bnxt/Makefile SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c · line 41

Quoted 4 lines
drivers/net/bnxt/Makefile +1 -0
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_util.c

This breaks the meson build and similar change required for meson, same with bnxt_flow.c in other patch, if there is no other issue I can fix this while merging.

#57 lore raw

Re: [PATCH v2 10/23] net/bnxt: move function check zero bytes to bnxt util.h

Quoted 18 lines · Ferruh Yigit
Quoted 17 lines · Ajit Khaparde

From: Scott Branden <[email protected]>

Move check_zero_bytes into new bnxt_util.h file.

---
 drivers/net/bnxt/Makefile      |  1 +
 drivers/net/bnxt/bnxt_ethdev.c |  1 +
 drivers/net/bnxt/bnxt_filter.c |  9 ---------
 drivers/net/bnxt/bnxt_filter.h |  1 -
 drivers/net/bnxt/bnxt_util.c   | 18 ++++++++++++++++++
 drivers/net/bnxt/bnxt_util.h   | 11 +++++++++++
 6 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_util.c
 create mode 100644 drivers/net/bnxt/bnxt_util.h
Quoted 12 lines

drivers/net/bnxt/Makefile SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c · line 41

Quoted 9 lines
drivers/net/bnxt/Makefile +1 -0
index fd0cb5235..80db03ea8 100644
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txq.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_txr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_util.c

This breaks the meson build and similar change required for meson, same with bnxt_flow.c in other patch, if there is no other issue I can fix this while merging.

This patch also breaks the Makefile build, 'bnxt_filter.c' requires:
#include "bnxt_util.h"

#58 lore raw

PATCH v2 11/23 net/bnxt: refactor filter/flow

In reply to Ajit Khaparde

In preparation of more rte_flow support it has been decided to separate out filter and flow into their own files. Functionally the same.

--
v1->v2: Fix commit log.

---
 drivers/net/bnxt/Makefile      |    1 +
 drivers/net/bnxt/bnxt_filter.c | 1060 ------------------------------------
 drivers/net/bnxt/bnxt_flow.c   | 1167 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1168 insertions(+), 1060 deletions(-)
 create mode 100644 drivers/net/bnxt/bnxt_flow.c
drivers/net/bnxt/Makefile +1 -0
index 80db03ea8..8be3cb0e4 100644
@@ -29,6 +29,7 @@ EXPORT_MAP := rte_pmd_bnxt_version.map
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_cpr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_filter.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_flow.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_hwrm.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_ring.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_rxq.c
drivers/net/bnxt/bnxt_filter.c +0 -1060

1,063 lines not on this page · raw message

drivers/net/bnxt/bnxt_flow.c new file +1167 -0

1,167 lines not on this page · raw message

Signature · 1 line
2.15.2 (Apple Git-101.1)
#59 lore raw

PATCH v2 12/23 net/bnxt: check for invalid vnic id

In reply to Ajit Khaparde

From: Jay Ding <[email protected]>

Passing an invalid fw_vnic_id to the firmware will cause the bnxt_hwrm_vnic_plcmode_cfg command to fail.
Add a check for VNIC id before sending message to firmware.

Fixes daef48efe5e5 ("net/bnxt: support set MTU")

--
v1->v2: Fix commit message.

---
 drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
index 64687a69b..910129f12 100644
@@ -1560,6 +1560,11 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 	struct hwrm_vnic_plcmodes_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint16_t size;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID) {
+		PMD_DRV_LOG(DEBUG, "VNIC ID %x\n", vnic->fw_vnic_id);
+		return rc;
+	}
+
 	HWRM_PREP(req, VNIC_PLCMODES_CFG);
 
 	req.flags = rte_cpu_to_le_32(
Signature · 1 line
2.15.2 (Apple Git-101.1)
#60 lore raw

PATCH v2 13/23 net/bnxt: update HWRM API to v1.9.2.9

In reply to Ajit Khaparde

From: Rob Miller <[email protected]>

update HWRM API to v1.9.2.9

---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 113 ++++++++++++++++++++++++++++++++-
 1 file changed, 111 insertions(+), 2 deletions(-)
drivers/net/bnxt/hsi_struct_def_dpdk.h +111 -2
index fd6d8807e..f5c7b4228 100644
@@ -686,8 +686,8 @@ struct hwrm_err_output {
 #define HWRM_VERSION_MINOR 9
 #define HWRM_VERSION_UPDATE 2
 /* non-zero means beta version */
-#define HWRM_VERSION_RSVD 6
-#define HWRM_VERSION_STR "1.9.2.6"
+#define HWRM_VERSION_RSVD 9
+#define HWRM_VERSION_STR "1.9.2.9"
 
 /****************
  * hwrm_ver_get *
@@ -3183,6 +3183,9 @@ struct hwrm_async_event_cmpl {
 	/* LLFC/PFC Configuration Change */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LLFC_PFC_CHANGE \
 		UINT32_C(0x34)
+	/* Default VNIC Configuration Change */
+	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE \
+		UINT32_C(0x35)
 	/* HWRM Error */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR \
 		UINT32_C(0xff)
@@ -3280,6 +3283,11 @@ struct hwrm_async_event_cmpl_link_status_change {
 		UINT32_C(0xffff0)
 	#define HWRM_ASYNC_EVENT_CMPL_LINK_STATUS_CHANGE_EVENT_DATA1_PORT_ID_SFT \
 		4
+	/* Indicates the physical function this event occured on. */
+	#define HWRM_ASYNC_EVENT_CMPL_LINK_STATUS_CHANGE_EVENT_DATA1_PF_ID_MASK \
+		UINT32_C(0xff00000)
+	#define HWRM_ASYNC_EVENT_CMPL_LINK_STATUS_CHANGE_EVENT_DATA1_PF_ID_SFT \
+		20
 } __attribute__((packed));
 
 /* hwrm_async_event_cmpl_link_mtu_change (size:128b/16B) */
@@ -4087,6 +4095,10 @@ struct hwrm_async_event_cmpl_vf_flr {
 	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_VF_ID_MASK \
 		UINT32_C(0xffff)
 	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_VF_ID_SFT 0
+	/* Indicates the physical function this event occured on. */
+	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_PF_ID_MASK \
+		UINT32_C(0xff0000)
+	#define HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_PF_ID_SFT 16
 } __attribute__((packed));
 
 /* hwrm_async_event_cmpl_vf_mac_addr_change (size:128b/16B) */
@@ -4354,6 +4366,88 @@ struct hwrm_async_event_cmpl_llfc_pfc_change {
 		5
 } __attribute__((packed));
 
+/* hwrm_async_event_cmpl_default_vnic_change (size:128b/16B) */
+struct hwrm_async_event_cmpl_default_vnic_change {
+	uint16_t	type;
+	/*
+	 * This field indicates the exact type of the completion.
+	 * By convention, the LSB identifies the length of the
+	 * record in 16B units.  Even values indicate 16B
+	 * records.  Odd values indicate 32B
+	 * records.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_MASK \
+		UINT32_C(0x3f)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_SFT \
+		0
+	/* HWRM Asynchronous Event Information */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_HWRM_ASYNC_EVENT \
+		UINT32_C(0x2e)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_TYPE_HWRM_ASYNC_EVENT
+	/* unused1 is 10 b */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_UNUSED1_MASK \
+		UINT32_C(0xffc0)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_UNUSED1_SFT \
+		6
+	/* Identifiers of events. */
+	uint16_t	event_id;
+	/* Notification of a default vnic allocaiton or free */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_ID_ALLOC_FREE_NOTIFICATION \
+		UINT32_C(0x35)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_ID_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_ID_ALLOC_FREE_NOTIFICATION
+	/* Event specific data */
+	uint32_t	event_data2;
+	uint8_t	opaque_v;
+	/*
+	 * This value is written by the NIC such that it will be different
+	 * for each pass through the completion queue.   The even passes
+	 * will write 1.  The odd passes will write 0.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_V \
+		UINT32_C(0x1)
+	/* opaque is 7 b */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_OPAQUE_MASK \
+		UINT32_C(0xfe)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_OPAQUE_SFT 1
+	/* 8-lsb timestamp from POR (100-msec resolution) */
+	uint8_t	timestamp_lo;
+	/* 16-lsb timestamp from POR (100-msec resolution) */
+	uint16_t	timestamp_hi;
+	/* Event specific data */
+	uint32_t	event_data1;
+	/* Indicates default vnic configuration change */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_MASK \
+		UINT32_C(0x3)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_SFT \
+		0
+	/*
+	 * If this field is set to 1, then it indicates that
+	 * a default VNIC has been allocate.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_ALLOC \
+		UINT32_C(0x1)
+	/*
+	 * If this field is set to 2, then it indicates that
+	 * a default VNIC has been freed.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_FREE \
+		UINT32_C(0x2)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_FREE
+	/* Indicates the physical function this event occured on. */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_PF_ID_MASK \
+		UINT32_C(0x3fc)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_PF_ID_SFT \
+		2
+	/* Indicates the virtual function this event occured on */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_MASK \
+		UINT32_C(0x3fffc00)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT \
+		10
+} __attribute__((packed));
+
 /* hwrm_async_event_cmpl_hwrm_error (size:128b/16B) */
 struct hwrm_async_event_cmpl_hwrm_error {
 	uint16_t	type;
@@ -5196,6 +5290,21 @@ struct hwrm_func_qcaps_output {
 	 */
 	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PCIE_STATS_SUPPORTED \
 		UINT32_C(0x10000)
+	/*
+	 * If the query is for a VF, then this flag shall be ignored,
+	 * If this query is for a PF and this flag is set to 1,
+	 * then the PF has the capability to adopt the VF's belonging
+	 * to another PF.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ADOPTED_PF_SUPPORTED \
+		UINT32_C(0x20000)
+	/*
+	 * If the query is for a VF, then this flag shall be ignored,
+	 * If this query is for a PF and this flag is set to 1,
+	 * then the PF has the capability to administer another PF.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ADMIN_PF_SUPPORTED \
+		UINT32_C(0x40000)
 	/*
 	 * This value is current MAC address configured for this
 	 * function. A value of 00-00-00-00-00-00 indicates no
Signature · 1 line
2.15.2 (Apple Git-101.1)
#61 lore raw

PATCH v2 14/23 net/bnxt: fix Tx with multiple mbuf

In reply to Ajit Khaparde

From: Xiaoxin Peng <[email protected]>

When using multi-mbuf to xmit large packets, we need to use total packet lengths (sum of all segments) to set txbd->flags_type. Packets will not be sent when using tx_pkt->data_len(The first segment of packets).

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_txr.c +2 -2
index 68645b2f7..e85511f9a 100644
@@ -160,10 +160,10 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		*cmpl_next = false;
 	}
 	txbd->len = tx_pkt->data_len;
-	if (txbd->len >= 2014)
+	if (tx_pkt->pkt_len >= 2014)
 		txbd->flags_type |= TX_BD_LONG_FLAGS_LHINT_GTE2K;
 	else
-		txbd->flags_type |= lhint_arr[txbd->len >> 9];
+		txbd->flags_type |= lhint_arr[tx_pkt->pkt_len >> 9];
 	txbd->address = rte_cpu_to_le_32(rte_mbuf_data_iova(tx_buf->mbuf));
 
 	if (long_bd) {
Signature · 1 line
2.15.2 (Apple Git-101.1)
#62 lore raw

PATCH v2 15/23 net/bnxt: revert reset of L2 filter id

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

The L2 filter id is needed in many scenarios particularly when we are repurposing the same ntuple filter with different destination queues. This patch reverts a commit in which the L2 filter id was being reset in clear_ntuple_filter().

Fixes 1383434c9089 ("net/bnxt: reset L2 filter id once filter is freed")

--
v1->v2: update commit message.

---
 drivers/net/bnxt/bnxt_hwrm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -1
index 910129f12..ba8e44a9b 100644
@@ -3798,7 +3798,6 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 	HWRM_UNLOCK();
 
 	filter->fw_ntuple_filter_id = UINT64_MAX;
-	filter->fw_l2_filter_id = UINT64_MAX;
 
 	return 0;
 }
Signature · 1 line
2.15.2 (Apple Git-101.1)
#63 lore raw

PATCH v2 16/23 net/bnxt: check filter type before clearing it

In reply to Ajit Khaparde

In bnxt_free_filter_mem(), check the filter type and call the appropriate HWRM command to clear the filter from HW.

Fixes 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")

--
v1->v2: add [email protected] in Cc.

---
 drivers/net/bnxt/bnxt_filter.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_filter.c +17 -4
index 31757d32c..1038941e8 100644
@@ -117,16 +117,29 @@ void bnxt_free_filter_mem(struct bnxt *bp)
 	max_filters = bp->max_l2_ctx;
 	for (i = 0; i < max_filters; i++) {
 		filter = &bp->filter_info[i];
-		if (filter->fw_l2_filter_id != ((uint64_t)-1)) {
-			PMD_DRV_LOG(ERR, "HWRM filter is not freed??\n");
+		if (filter->fw_l2_filter_id != ((uint64_t)-1) &&
+		    filter->filter_type == HWRM_CFA_L2_FILTER) {
+			PMD_DRV_LOG(ERR, "L2 filter is not free\n");
 			/* Call HWRM to try to free filter again */
 			rc = bnxt_hwrm_clear_l2_filter(bp, filter);
 			if (rc)
 				PMD_DRV_LOG(ERR,
-				       "HWRM filter cannot be freed rc = %d\n",
-					rc);
+					    "Cannot free L2 filter: %d\n",
+					    rc);
 		}
 		filter->fw_l2_filter_id = UINT64_MAX;
+
+		if (filter->fw_ntuple_filter_id != ((uint64_t)-1) &&
+		    filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
+			PMD_DRV_LOG(ERR, "NTUPLE filter is not free\n");
+			/* Call HWRM to try to free filter again */
+			rc = bnxt_hwrm_clear_ntuple_filter(bp, filter);
+			if (rc)
+				PMD_DRV_LOG(ERR,
+					    "Cannot free NTUPLE filter: %d\n",
+					    rc);
+		}
+		filter->fw_ntuple_filter_id = UINT64_MAX;
 	}
 	STAILQ_INIT(&bp->free_filter_list);
 
Signature · 1 line
2.15.2 (Apple Git-101.1)
#64 lore raw

PATCH v2 17/23 net/bnxt: fix set MTU

In reply to Ajit Khaparde

There is no need to update bnxt_hwrm_vnic_plcmode_cfg if new MTU is not greater than the max data the mbuf can accommodate.

Fixes daef48efe5e5 ("net/bnxt: support set MTU")

--
v1->v2: update commit log

---
 drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +9 -3
index ab3f5c8e7..fe95e01ca 100644
@@ -1581,6 +1581,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	for (i = 0; i < bp->nr_vnics; i++) {
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+		uint16_t size = 0;
 
 		vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN +
 					ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
@@ -1588,9 +1589,14 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		if (rc)
 			break;
 
-		rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
-		if (rc)
-			return rc;
+		size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
+		size -= RTE_PKTMBUF_HEADROOM;
+
+		if (size < new_mtu) {
+			rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+			if (rc)
+				return rc;
+		}
 	}
 
 	return rc;
Signature · 1 line
2.15.2 (Apple Git-101.1)
#65 lore raw

PATCH v2 18/23 net/bnxt: fix incorrect IO address handling in Tx

In reply to Ajit Khaparde

rte_mbuf_data_iova returns a 64-bit address. But we are incorrectly using only 32-bits of that. Use rte_cpu_to_le_64 instead of rte_cpu_to_le_32

Fixes 6eb3cc2294fd ("net/bnxt: add initial Tx code")
---
 drivers/net/bnxt/bnxt_txr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_txr.c +2 -2
index e85511f9a..67bb35e06 100644
@@ -164,7 +164,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		txbd->flags_type |= TX_BD_LONG_FLAGS_LHINT_GTE2K;
 	else
 		txbd->flags_type |= lhint_arr[tx_pkt->pkt_len >> 9];
-	txbd->address = rte_cpu_to_le_32(rte_mbuf_data_iova(tx_buf->mbuf));
+	txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(tx_buf->mbuf));
 
 	if (long_bd) {
 		txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
@@ -287,7 +287,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		tx_buf = &txr->tx_buf_ring[txr->tx_prod];
 
 		txbd = &txr->tx_desc_ring[txr->tx_prod];
-		txbd->address = rte_cpu_to_le_32(rte_mbuf_data_iova(m_seg));
+		txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(m_seg));
 		txbd->flags_type |= TX_BD_SHORT_TYPE_TX_BD_SHORT;
 		txbd->len = m_seg->data_len;
 
Signature · 1 line
2.15.2 (Apple Git-101.1)
#66 lore raw

PATCH v2 19/23 net/bnxt: allocate RSS context only if RSS mode is enabled

In reply to Ajit Khaparde

allocate RSS context only if RSS mode is enabled.

--
v1->v2: fix commit log

---
 drivers/net/bnxt/bnxt_ethdev.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +10 -6
index fe95e01ca..44c6cfa0a 100644
@@ -248,6 +248,7 @@ static int bnxt_init_chip(struct bnxt *bp)
 
 	/* VNIC configuration */
 	for (i = 0; i < bp->nr_vnics; i++) {
+		struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
 
 		rc = bnxt_hwrm_vnic_alloc(bp, vnic);
@@ -257,12 +258,15 @@ static int bnxt_init_chip(struct bnxt *bp)
 			goto err_out;
 		}
 
-		rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic);
-		if (rc) {
-			PMD_DRV_LOG(ERR,
-				"HWRM vnic %d ctx alloc failure rc: %x\n",
-				i, rc);
-			goto err_out;
+		/* Alloc RSS context only if RSS mode is enabled */
+		if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
+			rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic);
+			if (rc) {
+				PMD_DRV_LOG(ERR,
+					"HWRM vnic %d ctx alloc failure rc: %x\n",
+					i, rc);
+				goto err_out;
+			}
 		}
 
 		rc = bnxt_hwrm_vnic_cfg(bp, vnic);
Signature · 1 line
2.15.2 (Apple Git-101.1)
#67 lore raw

PATCH v2 20/23 net/bnxt: fix to move a flow to a different queue

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

While moving a flow to a different destination queue, the l2_filter_id being passed to the FW command was incorrect. Fix it by re-using the matching filter's l2_filter_id since that is supposed to be the same in this case.

Fixes 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
---
 drivers/net/bnxt/bnxt_flow.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +5 -1
index a491e9dbf..ac7656741 100644
@@ -968,9 +968,13 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf)
 				    sizeof(nf->dst_ipaddr_mask))) {
 				if (mf->dst_id == nf->dst_id)
 					return -EEXIST;
-				/* Same Flow, Different queue
+				/*
+				 * Same Flow, Different queue
 				 * Clear the old ntuple filter
+				 * Reuse the matching L2 filter
+				 * ID for the new filter
 				 */
+				nf->fw_l2_filter_id = mf->fw_l2_filter_id;
 				if (nf->filter_type == HWRM_CFA_EM_FILTER)
 					bnxt_hwrm_clear_em_filter(bp, mf);
 				if (nf->filter_type == HWRM_CFA_NTUPLE_FILTER)
Signature · 1 line
2.15.2 (Apple Git-101.1)
#68 lore raw

PATCH v2 21/23 net/bnxt: check VF resources if resource manager is enabled

In reply to Ajit Khaparde

If HWRM resource manager is enabled, check VF resources before proceeding. Make sure there are enough resources allocated and return an error in case of insufficient error.

---
 drivers/net/bnxt/bnxt.h        |  5 ++++
 drivers/net/bnxt/bnxt_ethdev.c | 21 ++++++++++-----
 drivers/net/bnxt/bnxt_hwrm.c   | 59 +++++++++++++++++++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_hwrm.h   |  6 ++++-
 4 files changed, 80 insertions(+), 11 deletions(-)
drivers/net/bnxt/bnxt.h +5 -0
index 246b8d4d8..db5c4eb0d 100644
@@ -22,6 +22,10 @@
 
 #define BNXT_MAX_MTU		9500
 #define VLAN_TAG_SIZE		4
+#define BNXT_VF_RSV_NUM_RSS_CTX	1
+#define BNXT_VF_RSV_NUM_L2_CTX	4
+/* TODO: For now, do not support VMDq/RFS on VFs. */
+#define BNXT_VF_RSV_NUM_VNIC	1
 #define BNXT_MAX_LED		4
 #define BNXT_NUM_VLANS		2
 #define BNXT_MIN_RING_DESC	16
@@ -328,6 +332,7 @@ struct bnxt {
 	struct bnxt_led_info	leds[BNXT_MAX_LED];
 	uint8_t			num_leds;
 	struct bnxt_ptp_cfg     *ptp_cfg;
+	uint16_t		vf_resv_strategy;
 };
 
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
drivers/net/bnxt/bnxt_ethdev.c +14 -7
index 44c6cfa0a..34c3d6ba3 100644
@@ -509,6 +509,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+	int rc;
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
@@ -516,19 +517,23 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
 
 	if (BNXT_VF(bp) && (bp->flags & BNXT_FLAG_NEW_RM)) {
-		int rc;
+		rc = bnxt_hwrm_check_vf_rings(bp);
+		if (rc) {
+			PMD_DRV_LOG(ERR, "HWRM insufficient resources\n");
+			return -ENOSPC;
+		}
 
-		rc = bnxt_hwrm_func_reserve_vf_resc(bp);
+		rc = bnxt_hwrm_func_reserve_vf_resc(bp, false);
 		if (rc) {
 			PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc);
 			return -ENOSPC;
 		}
-
+	} else {
 		/* legacy driver needs to get updated values */
 		rc = bnxt_hwrm_func_qcaps(bp);
 		if (rc) {
 			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
-			return -ENOSPC;
+			return rc;
 		}
 	}
 
@@ -539,7 +544,9 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	    bp->max_cp_rings ||
 	    eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues >
 	    bp->max_stat_ctx ||
-	    (uint32_t)(eth_dev->data->nb_rx_queues) > bp->max_ring_grps) {
+	    (uint32_t)(eth_dev->data->nb_rx_queues) > bp->max_ring_grps ||
+	    (!(eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS) &&
+	     bp->max_vnics < eth_dev->data->nb_rx_queues)) {
 		PMD_DRV_LOG(ERR,
 			"Insufficient resources to support requested config\n");
 		PMD_DRV_LOG(ERR,
@@ -547,9 +554,9 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 			eth_dev->data->nb_tx_queues,
 			eth_dev->data->nb_rx_queues);
 		PMD_DRV_LOG(ERR,
-			"Res available: TxQ %d, RxQ %d, CQ %d Stat %d, Grp %d\n",
+			"MAX: TxQ %d, RxQ %d, CQ %d Stat %d, Grp %d, Vnic %d\n",
 			bp->max_tx_rings, bp->max_rx_rings, bp->max_cp_rings,
-			bp->max_stat_ctx, bp->max_ring_grps);
+			bp->max_stat_ctx, bp->max_ring_grps, bp->max_vnics);
 		return -ENOSPC;
 	}
 
drivers/net/bnxt/bnxt_hwrm.c +56 -3

94 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +5 -1
index 4a237c4b4..379aac6e1 100644
@@ -29,6 +29,9 @@ struct bnxt_cp_ring_info;
 #define HWRM_QUEUE_SERVICE_PROFILE_LOSSY \
 	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY
 
+#define HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MINIMAL_STATIC \
+	HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESERVATION_STRATEGY_MINIMAL_STATIC
+
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic,
@@ -113,7 +116,7 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link);
 int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up);
 int bnxt_hwrm_func_qcfg(struct bnxt *bp);
 int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp);
-int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp);
+int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp, bool test);
 int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
 int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_vf_mac(struct bnxt *bp, uint16_t vf,
@@ -170,4 +173,5 @@ int bnxt_vnic_rss_configure(struct bnxt *bp,
 			    struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
 			struct bnxt_coal *coal, uint16_t ring_id);
+int bnxt_hwrm_check_vf_rings(struct bnxt *bp);
 #endif
Signature · 1 line
2.15.2 (Apple Git-101.1)
#69 lore raw

PATCH v2 22/23 net/bnxt: fix Rx ring count limitation

In reply to Ajit Khaparde

Fixed size of fw_grp_ids in VNIC is limiting the number of Rx rings being created. With this patch we are allocating fw_grp_ids dynamically, allowing us to get over this artificial limit.

Fixes 9738793f28ec ("net/bnxt: add VNIC functions and structs")
---
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++++++
 drivers/net/bnxt/bnxt_hwrm.c   |  5 ++++-
 drivers/net/bnxt/bnxt_vnic.c   |  5 +----
 drivers/net/bnxt/bnxt_vnic.h   |  6 +-----
 4 files changed, 17 insertions(+), 10 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +11 -0
index 34c3d6ba3..a1f835ed9 100644
@@ -250,6 +250,17 @@ static int bnxt_init_chip(struct bnxt *bp)
 	for (i = 0; i < bp->nr_vnics; i++) {
 		struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+		uint32_t size = sizeof(*vnic->fw_grp_ids) * bp->max_ring_grps;
+
+		vnic->fw_grp_ids = rte_zmalloc("vnic_fw_grp_ids", size, 0);
+		if (!vnic->fw_grp_ids) {
+			PMD_DRV_LOG(ERR,
+				    "Failed to alloc %d bytes for group ids\n",
+				    size);
+			rc = -ENOMEM;
+			goto err_out;
+		}
+		memset(vnic->fw_grp_ids, -1, size);
 
 		rc = bnxt_hwrm_vnic_alloc(bp, vnic);
 		if (rc) {
drivers/net/bnxt/bnxt_hwrm.c +4 -1
index de04fe863..37aefbdc9 100644
@@ -1319,8 +1319,9 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	/* map ring groups to this vnic */
 	PMD_DRV_LOG(DEBUG, "Alloc VNIC. Start %x, End %x\n",
 		vnic->start_grp_id, vnic->end_grp_id);
-	for (i = vnic->start_grp_id, j = 0; i <= vnic->end_grp_id; i++, j++)
+	for (i = vnic->start_grp_id, j = 0; i < vnic->end_grp_id; i++, j++)
 		vnic->fw_grp_ids[j] = bp->grp_info[i].fw_grp_id;
+
 	vnic->dflt_ring_grp = bp->grp_info[vnic->start_grp_id].fw_grp_id;
 	vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE;
 	vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE;
@@ -2106,6 +2107,8 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 		bnxt_hwrm_vnic_tpa_cfg(bp, vnic, false);
 
 		bnxt_hwrm_vnic_free(bp, vnic);
+
+		rte_free(vnic->fw_grp_ids);
 	}
 	/* Ring resources */
 	bnxt_free_all_hwrm_rings(bp);
drivers/net/bnxt/bnxt_vnic.c +1 -4
index 19d06af55..c0577cd76 100644
@@ -39,7 +39,7 @@ void bnxt_init_vnics(struct bnxt *bp)
 {
 	struct bnxt_vnic_info *vnic;
 	uint16_t max_vnics;
-	int i, j;
+	int i;
 
 	max_vnics = bp->max_vnics;
 	STAILQ_INIT(&bp->free_vnic_list);
@@ -52,9 +52,6 @@ void bnxt_init_vnics(struct bnxt *bp)
 		vnic->hash_mode =
 			HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT;
 
-		for (j = 0; j < MAX_QUEUES_PER_VNIC; j++)
-			vnic->fw_grp_ids[j] = (uint16_t)HWRM_NA_SIGNATURE;
-
 		prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE);
 		STAILQ_INIT(&vnic->filter);
 		STAILQ_INIT(&vnic->flow_list);
drivers/net/bnxt/bnxt_vnic.h +1 -5
index c521d7e5a..9029f78c3 100644
@@ -15,13 +15,9 @@ struct bnxt_vnic_info {
 
 	uint16_t	fw_vnic_id; /* returned by Chimp during alloc */
 	uint16_t	rss_rule;
-#define MAX_NUM_TRAFFIC_CLASSES		8
-#define MAX_NUM_RSS_QUEUES_PER_VNIC	16
-#define MAX_QUEUES_PER_VNIC	(MAX_NUM_RSS_QUEUES_PER_VNIC + \
-				 MAX_NUM_TRAFFIC_CLASSES)
 	uint16_t	start_grp_id;
 	uint16_t	end_grp_id;
-	uint16_t	fw_grp_ids[MAX_QUEUES_PER_VNIC];
+	uint16_t	*fw_grp_ids;
 	uint16_t	dflt_ring_grp;
 	uint16_t	mru;
 	uint16_t	hash_type;
Signature · 1 line
2.15.2 (Apple Git-101.1)
#70 lore raw

PATCH v2 23/23 net/bnxt: use correct flags during VLAN configuration

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

Setting of VLAN filter cmd was being done with incorrect flag value. We need to use inner vlan fields instead of outer vlan.

Fixes 7fe5668d2ea3 ("net/bnxt: support VLAN filter and strip")
---
 drivers/net/bnxt/bnxt_ethdev.c | 10 +++++-----
 drivers/net/bnxt/bnxt_hwrm.c   |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -5
index a1f835ed9..418d3bede 100644
@@ -1327,9 +1327,9 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 	struct bnxt_vnic_info *vnic;
 	unsigned int i;
 	int rc = 0;
-	uint32_t en = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN |
-		HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK;
-	uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN;
+	uint32_t en = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN |
+		HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK;
+	uint32_t chk = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN;
 
 	/* Cycle through all VNICs */
 	for (i = 0; i < bp->nr_vnics; i++) {
@@ -1376,8 +1376,8 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 				memcpy(new_filter->l2_addr, filter->l2_addr,
 				       ETHER_ADDR_LEN);
 				/* MAC + VLAN ID filter */
-				new_filter->l2_ovlan = vlan_id;
-				new_filter->l2_ovlan_mask = 0xF000;
+				new_filter->l2_ivlan = vlan_id;
+				new_filter->l2_ivlan_mask = 0xF000;
 				new_filter->enables |= en;
 				rc = bnxt_hwrm_set_l2_filter(bp,
 							     vnic->fw_vnic_id,
drivers/net/bnxt/bnxt_hwrm.c +2 -2
index 37aefbdc9..02562f78c 100644
@@ -388,13 +388,13 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp,
 		req.l2_ovlan = filter->l2_ovlan;
 	if (enables &
 	    HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN)
-		req.l2_ovlan = filter->l2_ivlan;
+		req.l2_ivlan = filter->l2_ivlan;
 	if (enables &
 	    HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK)
 		req.l2_ovlan_mask = filter->l2_ovlan_mask;
 	if (enables &
 	    HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK)
-		req.l2_ovlan_mask = filter->l2_ivlan_mask;
+		req.l2_ivlan_mask = filter->l2_ivlan_mask;
 	if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID)
 		req.src_id = rte_cpu_to_le_32(filter->src_id);
 	if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE)
Signature · 1 line
2.15.2 (Apple Git-101.1)
#71 lore raw
In reply to Ajit Khaparde
Quoted 35 lines · Ajit Khaparde

Patchset against dpdk-next-net. Please apply.

v1->v2:
Takes care of the various comments made in the previous version. I am dropping the style changes for now. I will send them later after addressing the coding convention issues.

Ajit Khaparde (16):
net/bnxt: fix clear port stats
net/bnxt: add Tx batching support
net/bnxt: optimize receive processing code net/bnxt: set MIN/MAX descriptor count fox Tx and Rx Rings net/bnxt: fix dev close operation
net/bnxt: set ring coalesce parameters for Stratus NIC net/bnxt: fix HW Tx checksum offload check net/bnxt: add support for VF id 0xd800
net/bnxt: fix Rx/Tx queue start/stop operations net/bnxt: refactor filter/flow
net/bnxt: check filter type before clearing it net/bnxt: fix set MTU
net/bnxt: fix incorrect IO address handling in Tx net/bnxt: allocate RSS context only if RSS mode is enabled net/bnxt: check VF resources if resource manager is enabled net/bnxt: fix Rx ring count limitation

Jay Ding (1):
net/bnxt: check for invalid vnic id

Rob Miller (1):
net/bnxt: update HWRM API to v1.9.2.9

Scott Branden (1):
net/bnxt: move function check zero bytes to bnxt util.h

Quoted 7 lines

Somnath Kotur (3):
net/bnxt: revert reset of L2 filter id net/bnxt: fix to move a flow to a different queue net/bnxt: use correct flags during VLAN configuration

Xiaoxin Peng (1):
net/bnxt: fix Tx with multiple mbuf

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

Build errors commented on patch fixed while applying, please double check.

#72 lore raw
In reply to Ferruh Yigit
Quoted 50 lines · Ferruh Yigit
Quoted 41 lines · Ajit Khaparde

Patchset against dpdk-next-net contains bug fixes, some code refactoring and style cleanup.

Please apply.

Ajit Khaparde (15):
net/bnxt: fix clear port stats
net/bnxt: add Tx batching support
net/bnxt: Rx processing optimization
net/bnxt: set min and max descriptor count for Tx and Rx rings net/bnxt: fix dev close operation
net/bnxt: set ring coalesce parameters for Stratus NIC net/bnxt: fix HW Tx checksum offload check
net/bnxt: add support for VF id 0xd800
net/bnxt: fix rx/tx queue start/stop operations net/bnxt: code cleanup style of bnxt vnic
net/bnxt: filter/flow refactoring
net/bnxt: check filter type before clearing it net/bnxt: fix set MTU
net/bnxt: fix incorrect IO address handling in Tx net/bnxt: allocate RSS context only if RSS mode is enabled.

Jay Ding (1):
net/bnxt: check for invalid vnic id

Rob Miller (1):
net/bnxt: update HWRM API to v1.9.2.9

Scott Branden (11):
net/bnxt: code cleanup style of bnxt cpr net/bnxt: code cleanup style of bnxt rxr net/bnxt: code cleanup style of rte pmd bnxt file net/bnxt: code cleanup style of bnxt stats net/bnxt: code cleanup style of bnxt vnic net/bnxt: code cleanup style of bnxt txq net/bnxt: code cleanup style of bnxt rxq net/bnxt: code cleanup style of bnxt txr net/bnxt: code cleanup style of bnxt ring net/bnxt: code cleanup style of bnxt ethdev net/bnxt: move function check zero bytes to bnxt util.h

Quoted 6 lines

Somnath Kotur (2):
net/bnxt: Revert reset of L2 filter id in clear_ntuple_filter net/bnxt: fix to move a flow to a different queue

Xiaoxin Peng (1):
net/bnxt: fix Tx with multiple mbuf

Quoted 6 lines

Hi Ajit,

​​
./devtools/check-git-log.sh is giving some errors [1], can you please check them?

​Took care of this and other comments as well.​

​ Thanks​