Skip to contentSkip to conversation

bnxt patch series

PATCH In review Ajit Khaparde 2 participants 10 messages Jun 8, 2019 – Jun 12, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt patch series

This is a patchset against dpdk-next-net tree on top of commit d800226ab9ede99ab9bc56a691555568e6e587f1. Please apply.

Kalesh AP (1):
net/bnxt: fix output of port xstats

Naresh Kumar PBS (2):
net/bnxt: fix interrupt vector array initialization net/bnxt: address build errors reported by intel compiler

Somnath Kotur (3):
net/bnxt: add code to redirect tunnel packets net/bnxt: fix to check for NULL completion ring doorbell in
int_handler
net/bnxt: driver to use configured MTU value during load

 drivers/net/bnxt/bnxt.h        |   1 +
 drivers/net/bnxt/bnxt_cpr.c    |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c |  28 ++--
 drivers/net/bnxt/bnxt_filter.h |   5 +-
 drivers/net/bnxt/bnxt_flow.c   | 236 ++++++++++++++++++++++++++++-----
 drivers/net/bnxt/bnxt_hwrm.c   |  88 +++++++++++-
 drivers/net/bnxt/bnxt_hwrm.h   |   7 +-
 drivers/net/bnxt/bnxt_irq.c    |   2 +-
 drivers/net/bnxt/bnxt_stats.c  |   2 +
 9 files changed, 321 insertions(+), 50 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
#1 lore raw

PATCH 1/6 net/bnxt: add code to redirect tunnel packets

From: Somnath Kotur <[email protected]>

Add code to redirect GRE, NVGRE and VXLAN tunnel packets to the specified VF.

---
 drivers/net/bnxt/bnxt.h        |   1 +
 drivers/net/bnxt/bnxt_filter.h |   5 +-
 drivers/net/bnxt/bnxt_flow.c   | 236 ++++++++++++++++++++++++++++-----
 drivers/net/bnxt/bnxt_hwrm.c   |  83 ++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |   5 +
 5 files changed, 295 insertions(+), 35 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index 641790fef..942da7ff0 100644
@@ -430,6 +430,7 @@ struct bnxt {
 	uint16_t		max_l2_ctx;
 	uint16_t		max_vnics;
 	uint16_t		max_stat_ctx;
+	uint16_t		first_vf_id;
 	uint16_t		vlan;
 	struct bnxt_pf_info	pf;
 	uint8_t			port_partition_type;
drivers/net/bnxt/bnxt_filter.h +4 -1
index f8bad29de..4fda3f03a 100644
@@ -19,7 +19,8 @@ struct bnxt_filter_info {
 #define HWRM_CFA_L2_FILTER	0
 #define HWRM_CFA_EM_FILTER	1
 #define HWRM_CFA_NTUPLE_FILTER	2
-	uint8_t                 filter_type;    //L2 or EM or NTUPLE filter
+#define HWRM_CFA_TUNNEL_REDIRECT_FILTER	3
+	uint8_t                 filter_type;
 	uint32_t                dst_id;
 
 	/* Filter Characteristics */
@@ -120,6 +121,8 @@ struct bnxt_filter_info *bnxt_get_l2_filter(struct bnxt *bp,
 	HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN
 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_NVGRE	\
 	HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE
+#define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE  \
+	HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE
 #define L2_FILTER_ALLOC_INPUT_EN_L2_ADDR_MASK	\
 	HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK
 #define NTUPLE_FLTR_ALLOC_INPUT_IP_PROTOCOL_UDP	\
drivers/net/bnxt/bnxt_flow.c +202 -34

381 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +83 -0

92 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +5 -0
index f286bcd8b..cd8bb79f9 100644
@@ -191,4 +191,9 @@ int bnxt_hwrm_ext_port_qstats(struct bnxt *bp);
 int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_backing_store_cfg(struct bnxt *bp, uint32_t enables);
 int bnxt_alloc_ctx_mem(struct bnxt *bp);
+int bnxt_hwrm_tunnel_redirect(struct bnxt *bp, uint8_t type);
+int bnxt_hwrm_tunnel_redirect_free(struct bnxt *bp, uint8_t type);
+int bnxt_hwrm_tunnel_redirect_query(struct bnxt *bp, uint32_t *type);
+int bnxt_hwrm_tunnel_redirect_info(struct bnxt *bp, uint8_t tun_type,
+				   uint16_t *dst_fid);
 #endif
Signature · 1 line
2.20.1 (Apple Git-117)
#2 lore raw

PATCH 2/6 net/bnxt: fix to check for NULL completion ring doorbell in int_handler

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

It is observed that sometimes during init, the bnxt_int_handler() gets invoked while the cpr->cp_db.doorbell is not yet initialized. Check for the same and return.

---
 drivers/net/bnxt/bnxt_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_irq.c +1 -1
index 918f3dcf4..e1b9a2b04 100644
@@ -31,7 +31,7 @@ static void bnxt_int_handler(void *param)
 
 	raw_cons = cpr->cp_raw_cons;
 	while (1) {
-		if (!cpr || !cpr->cp_ring_struct)
+		if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.cp_doorbell)
 			return;
 
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
Signature · 1 line
2.20.1 (Apple Git-117)
#3 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/bnxt: fix to check for NULL completion ring doorbell in int_handler

Quoted 18 lines · Ajit Khaparde

From: Somnath Kotur <[email protected]>

It is observed that sometimes during init, the bnxt_int_handler() gets invoked while the cpr->cp_db.doorbell is not yet initialized. Check for the same and return.

---
 drivers/net/bnxt/bnxt_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_irq.c +0 -0
index 918f3dcf4..e1b9a2b04 100644

drivers/net/bnxt/bnxt_irq.c static void bnxt_int_handler(void *param) · line 34

Quoted 5 lines
drivers/net/bnxt/bnxt_irq.c +1 -1
@@ -31,7 +31,7 @@ static void bnxt_int_handler(void *param)
 
 	raw_cons = cpr->cp_raw_cons;
 	while (1) {
-		if (!cpr || !cpr->cp_ring_struct)
+		if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.cp_doorbell)

This conflicts with patch from Lance Richardson, which is already merged to next-net, and renames 'cp_doorbell' to 'doorbell'

Can you please send new version of the patchset rebasing latest next-net?

#4 lore raw

Re: [dpdk-dev] [PATCH 2/6] net/bnxt: fix to check for NULL completion ring doorbell in int_handler

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

From: Somnath Kotur <[email protected]>

It is observed that sometimes during init, the bnxt_int_handler() gets invoked while the cpr->cp_db.doorbell is not yet initialized. Check for the same and return.

---
 drivers/net/bnxt/bnxt_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_irq.c +0 -0
index 918f3dcf4..e1b9a2b04 100644

drivers/net/bnxt/bnxt_irq.c static void bnxt_int_handler(void *param) · line 34

Quoted 5 lines
drivers/net/bnxt/bnxt_irq.c +1 -1
@@ -31,7 +31,7 @@ static void bnxt_int_handler(void *param)
 
 	raw_cons = cpr->cp_raw_cons;
 	while (1) {
-		if (!cpr || !cpr->cp_ring_struct)
+		if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.cp_doorbell)

This conflicts with patch from Lance Richardson, which is already merged to next-net, and renames 'cp_doorbell' to 'doorbell'

Quoted 2 lines

Can you please send new version of the patchset rebasing latest next-net?

This looks simple enough to resolve,
another issue is s/ETHER_MIN_MTU/RTE_ETHER_MIN_MTU, also straightforward Let me resolve myself instead of sending new version

#5 lore raw

PATCH 3/6 net/bnxt: driver to use configured MTU value during load

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

The MTU value of a port can be (re)configured out-of-band. FW will be returning this configured MTU as part of func_qcfg cmd. Driver to use this value during load time.

---
 drivers/net/bnxt/bnxt_cpr.c    | 2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 7 ++++++-
 drivers/net/bnxt/bnxt_hwrm.c   | 5 ++++-
 drivers/net/bnxt/bnxt_hwrm.h   | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +1 -1
index 0fd6e51e5..655bcf1a8 100644
@@ -35,7 +35,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
 		PMD_DRV_LOG(INFO, "Async event: VF config changed\n");
-		bnxt_hwrm_func_qcfg(bp);
+		bnxt_hwrm_func_qcfg(bp, NULL);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED:
 		PMD_DRV_LOG(INFO, "Port conn async event\n");
drivers/net/bnxt/bnxt_ethdev.c +6 -1
index ee775b125..e527df1bf 100644
@@ -3654,6 +3654,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	uint32_t total_alloc_len;
 	rte_iova_t mz_phys_addr;
 	struct bnxt *bp;
+	uint16_t mtu;
 	int rc;
 
 	if (version_printed++ == 0)
@@ -3906,12 +3907,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		pci_dev->mem_resource[0].phys_addr,
 		pci_dev->mem_resource[0].addr);
 
-	rc = bnxt_hwrm_func_qcfg(bp);
+	rc = bnxt_hwrm_func_qcfg(bp, &mtu);
 	if (rc) {
 		PMD_DRV_LOG(ERR, "hwrm func qcfg failed\n");
 		goto error_free;
 	}
 
+	if (mtu >= ETHER_MIN_MTU && mtu <= BNXT_MAX_MTU &&
+	    mtu != eth_dev->data->mtu)
+		eth_dev->data->mtu = mtu;
+
 	if (BNXT_PF(bp)) {
 		//if (bp->pf.active_vfs) {
 			// TODO: Deallocate VF resources?
drivers/net/bnxt/bnxt_hwrm.c +4 -1
index 09fee3d39..696974c83 100644
@@ -2638,7 +2638,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 }
 
 /* JIRA 22088 */
-int bnxt_hwrm_func_qcfg(struct bnxt *bp)
+int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)
 {
 	struct hwrm_func_qcfg_input req = {0};
 	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
@@ -2663,6 +2663,9 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 		PMD_DRV_LOG(INFO, "Trusted VF cap enabled\n");
 	}
 
+	if (mtu)
+		*mtu = resp->mtu;
+
 	switch (resp->port_partition_type) {
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0:
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5:
drivers/net/bnxt/bnxt_hwrm.h +1 -1
index cd8bb79f9..e35462cb4 100644
@@ -127,7 +127,7 @@ 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);
-int bnxt_hwrm_func_qcfg(struct bnxt *bp);
+int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu);
 int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp, bool test);
 int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);
Signature · 1 line
2.20.1 (Apple Git-117)
#6 lore raw

PATCH 4/6 net/bnxt: fix output of port xstats

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

If the HWRM_PORT_QSTATS_EXT fails to initialize fw_rx_port_stats_ext_size or fw_tx_port_stats_ext_size, the driver can end up passing junk statistics to the application.

Instead of relying on the application to initialize the xstats buffer before calling the xstats_get dev_op, memset xstats with zeros to avoid returning or displaying incorrect statistics.

Also fixed the buffer starting offset.

Fixes f55e12f33416 ("net/bnxt: support extended port counters")
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 ++++--
 drivers/net/bnxt/bnxt_stats.c  | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -2
index e527df1bf..4133d0bef 100644
@@ -3775,7 +3775,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 			goto skip_ext_stats;
 
 		bp->hw_rx_port_stats_ext = (void *)
-			(bp->hw_rx_port_stats + sizeof(struct rx_port_stats));
+			((uint8_t *)bp->hw_rx_port_stats +
+			 sizeof(struct rx_port_stats));
 		bp->hw_rx_port_stats_ext_map = bp->hw_rx_port_stats_map +
 			sizeof(struct rx_port_stats);
 		bp->flags |= BNXT_FLAG_EXT_RX_PORT_STATS;
@@ -3783,7 +3784,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 
 		if (bp->hwrm_spec_code < HWRM_SPEC_CODE_1_9_2) {
 			bp->hw_tx_port_stats_ext = (void *)
-			(bp->hw_tx_port_stats + sizeof(struct tx_port_stats));
+				((uint8_t *)bp->hw_tx_port_stats +
+				 sizeof(struct tx_port_stats));
 			bp->hw_tx_port_stats_ext_map =
 				bp->hw_tx_port_stats_map +
 				sizeof(struct tx_port_stats);
drivers/net/bnxt/bnxt_stats.c +2 -0
index ad2888774..3cd5144ec 100644
@@ -415,6 +415,8 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	unsigned int stat_size = sizeof(uint64_t);
 	unsigned int stat_count;
 
+	memset(xstats, 0, sizeof(*xstats));
+
 	bnxt_hwrm_port_qstats(bp);
 	bnxt_hwrm_func_qstats_tx_drop(bp, 0xffff, &tx_drop_pkts);
 	bnxt_hwrm_ext_port_qstats(bp);
Signature · 1 line
2.20.1 (Apple Git-117)
#7 lore raw

PATCH 5/6 net/bnxt: fix interrupt vector array initialization

In reply to Ajit Khaparde

From: Naresh Kumar PBS <[email protected]>

Initialize the vector array when it is valid, thereby preventing a case were it may be accessed when the array is unallocated

Fixes 1fe427fd08ee ("net/bnxt: support enable/disable interrupt")
---
 drivers/net/bnxt/bnxt_ethdev.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +6 -7
index 4133d0bef..4dd845992 100644
@@ -412,13 +412,12 @@ static int bnxt_init_chip(struct bnxt *bp)
 			"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;
-	     queue_id++) {
-		intr_handle->intr_vec[queue_id] = vec;
-		if (vec < base + intr_handle->nb_efd - 1)
-			vec++;
+		for (queue_id = 0; queue_id < bp->eth_dev->data->nb_rx_queues;
+		     queue_id++) {
+			intr_handle->intr_vec[queue_id] = vec;
+			if (vec < base + intr_handle->nb_efd - 1)
+				vec++;
+		}
 	}
 
 	/* enable uio/vfio intr/eventfd mapping */
Signature · 1 line
2.20.1 (Apple Git-117)
#8 lore raw

PATCH 6/6 net/bnxt: address build errors reported by intel compiler

In reply to Ajit Khaparde

From: Naresh Kumar PBS <[email protected]>

Address build errors reported by intel compiler while compiling on Windows. Instead of typeof() using the actual type in ALLOW_FUNC

---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 4dd845992..c76f7d5db 100644
@@ -3639,7 +3639,7 @@ int bnxt_alloc_ctx_mem(struct bnxt *bp)
 
 #define ALLOW_FUNC(x)	\
 	{ \
-		typeof(x) arg = (x); \
+		uint32_t arg = (x); \
 		bp->pf.vf_req_fwd[((arg) >> 5)] &= \
 		~rte_cpu_to_le_32(1 << ((arg) & 0x1f)); \
 	}
Signature · 1 line
2.20.1 (Apple Git-117)
#9 lore raw
In reply to Ajit Khaparde
Quoted 12 lines · Ajit Khaparde

This is a patchset against dpdk-next-net tree on top of commit d800226ab9ede99ab9bc56a691555568e6e587f1. Please apply.

Kalesh AP (1):
net/bnxt: fix output of port xstats

Naresh Kumar PBS (2):
net/bnxt: fix interrupt vector array initialization net/bnxt: address build errors reported by intel compiler

Quoted 5 lines

Somnath Kotur (3):
net/bnxt: add code to redirect tunnel packets net/bnxt: fix to check for NULL completion ring doorbell in
int_handler
net/bnxt: driver to use configured MTU value during load

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