DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 00/17] bnxt patchset
@ 2019-10-02  5:54 Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix incorrect flow steering Ajit Khaparde
                   ` (17 more replies)
  0 siblings, 18 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

bnxt patchset against dpdk-next-net.
This patchset has been rebased and is dependent on
"bnxt patchset to support device error recovery"
https://patchwork.dpdk.org/project/dpdk/list/?series=6660

Please apply.

--
v1->v2: Rebased to the newer dpdk-next-net code base.

Ajit Khaparde (2):
  net/bnxt: subscribe to link speed change notification
  net/bnxt: fix async link handling and update

Kalesh AP (9):
  net/bnxt: fix rxq stop/start handling
  net/bnxt: fix L2 context calculation for Thor
  net/bnxt: fix use of deferred start of transmit queues
  net/bnxt: remove unnecessary return check
  net/bnxt: remove unused macro
  net/bnxt: remove unnecessary interrupt disable
  net/bnxt: fix accessing variable before null check
  net/bnxt: fix mbuf flags for PTP packets in vector mode Rx
  net/bnxt: use macro for getting default vnic

Rahul Gupta (1):
  net/bnxt: fix Rx queue count devop

Santoshkumar Karanappa Rastapur (3):
  net/bnxt: fix incorrect flow steering
  net/bnxt: fix traffic failure with higher mbuf size
  net/bnxt: fix 40G link failure for Thor

Somnath Kotur (1):
  net/bnxt: support for QinQ insertion and stripping

Stephen Hemminger (1):
  net/bnxt: fix a segfault in secondary process

 drivers/net/bnxt/bnxt.h              |  10 +-
 drivers/net/bnxt/bnxt_cpr.c          |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c       | 171 +++++++++++++++++----------
 drivers/net/bnxt/bnxt_flow.c         |   4 +
 drivers/net/bnxt/bnxt_hwrm.c         | 156 +++++++++++++-----------
 drivers/net/bnxt/bnxt_hwrm.h         |   2 +
 drivers/net/bnxt/bnxt_irq.c          |   2 +-
 drivers/net/bnxt/bnxt_irq.h          |   1 +
 drivers/net/bnxt/bnxt_ring.c         |   8 +-
 drivers/net/bnxt/bnxt_rxq.c          |  91 ++++++++------
 drivers/net/bnxt/bnxt_rxq.h          |   2 +-
 drivers/net/bnxt/bnxt_rxr.c          |  14 +--
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c |  15 ++-
 drivers/net/bnxt/bnxt_txq.c          |   5 +
 drivers/net/bnxt/bnxt_txq.h          |   1 +
 drivers/net/bnxt/bnxt_txr.c          |  19 ++-
 16 files changed, 300 insertions(+), 203 deletions(-)

-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix incorrect flow steering
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur, Lance Richardson,
	Somnath Kotur

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

When user creates a flow similar to an existing flow with just the
destination queue change, we delete the old filter and allocate a new one
with this destination queue change. We were also allocating a new L2
filter matching the same destination mac resulting in 2 L2 filters for the
same destination mac. This was causing any flow matching the destination
mac to be steered to this queue instead of the default queue.
Fixed it by deleting this stale L2 filter.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index deb9733e99..be9b6fad39 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1028,6 +1028,10 @@ 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;
+				/* Clear the new L2 filter that was created
+				 * earlier in bnxt_validate_and_parse_flow.
+				 */
+				bnxt_hwrm_clear_l2_filter(bp, nf);
 				/*
 				 * Same Flow, Different queue
 				 * Clear the old ntuple filter
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix traffic failure with higher mbuf size
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix incorrect flow steering Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: fix rxq stop/start handling Ajit Khaparde
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur, stable, Kalesh AP,
	Somnath Kotur, Lance Richardson

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

Maximum frame length supported by hw is 9600 bytes.
When user launches testpmd with --mbuf-size=9729,
we are posting buffer descriptors of size 9601 to the ring.
This was causing packets getting discarded.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  5 ++++-
 drivers/net/bnxt/bnxt_ethdev.c | 29 +++++++++--------------------
 drivers/net/bnxt/bnxt_hwrm.c   |  3 +++
 drivers/net/bnxt/bnxt_ring.c   |  5 -----
 drivers/net/bnxt/bnxt_rxq.c    |  2 +-
 drivers/net/bnxt/bnxt_rxq.h    |  1 -
 drivers/net/bnxt/bnxt_rxr.c    |  7 ++-----
 7 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 818a49f461..68ac30bb58 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -23,12 +23,15 @@
 
 #define BNXT_MAX_MTU		9574
 #define VLAN_TAG_SIZE		4
+#define BNXT_NUM_VLANS		2
+#define BNXT_MAX_PKT_LEN	(BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\
+				 RTE_ETHER_CRC_LEN +\
+				 (BNXT_NUM_VLANS * VLAN_TAG_SIZE))
 #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
 #define BNXT_MAX_TX_RING_DESC	4096
 #define BNXT_MAX_RX_RING_DESC	8192
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0083ba6e83..4095e9c720 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -545,10 +545,13 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->hash_key_size = 40;
 	max_vnics = bp->max_vnics;
 
+	/* MTU specifics */
+	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
+	dev_info->max_mtu = BNXT_MAX_MTU;
+
 	/* Fast path specifics */
 	dev_info->min_rx_bufsize = 1;
-	dev_info->max_rx_pktlen = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-		RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
+	dev_info->max_rx_pktlen = BNXT_MAX_PKT_LEN;
 
 	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
 	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
@@ -1967,7 +1970,6 @@ bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
-	struct rte_eth_dev_info dev_info;
 	uint32_t new_pkt_size;
 	uint32_t rc = 0;
 	uint32_t i;
@@ -1979,18 +1981,6 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 	new_pkt_size = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
 		       VLAN_TAG_SIZE * BNXT_NUM_VLANS;
 
-	rc = bnxt_dev_info_get_op(eth_dev, &dev_info);
-	if (rc != 0) {
-		PMD_DRV_LOG(ERR, "Error during getting ethernet device info\n");
-		return rc;
-	}
-
-	if (new_mtu < RTE_ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) {
-		PMD_DRV_LOG(ERR, "MTU requested must be within (%d, %d)\n",
-			RTE_ETHER_MIN_MTU, BNXT_MAX_MTU);
-		return -EINVAL;
-	}
-
 #ifdef RTE_ARCH_X86
 	/*
 	 * If vector-mode tx/rx is active, disallow any MTU change that would
@@ -2020,15 +2010,12 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
 
-	eth_dev->data->mtu = new_mtu;
-	PMD_DRV_LOG(INFO, "New MTU is %d\n", eth_dev->data->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 + RTE_ETHER_HDR_LEN +
-					RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
+		vnic->mru = new_mtu + RTE_ETHER_HDR_LEN +
+				RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
 		rc = bnxt_hwrm_vnic_cfg(bp, vnic);
 		if (rc)
 			break;
@@ -2043,6 +2030,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		}
 	}
 
+	PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu);
+
 	return rc;
 }
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 174dc75d54..09330e2382 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1233,6 +1233,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 			mb_pool = bp->rx_queues[0]->mb_pool;
 			rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 				      RTE_PKTMBUF_HEADROOM;
+			rx_buf_size = RTE_MIN(BNXT_MAX_PKT_LEN, rx_buf_size);
 			req.rx_buf_size = rte_cpu_to_le_16(rx_buf_size);
 			enables |=
 				HWRM_RING_ALLOC_INPUT_ENABLES_RX_BUF_SIZE_VALID;
@@ -1263,6 +1264,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		mb_pool = bp->rx_queues[0]->mb_pool;
 		rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 			      RTE_PKTMBUF_HEADROOM;
+		rx_buf_size = RTE_MIN(BNXT_MAX_PKT_LEN, rx_buf_size);
 		req.rx_buf_size = rte_cpu_to_le_16(rx_buf_size);
 
 		req.stat_ctx_id = rte_cpu_to_le_32(stats_ctx_id);
@@ -1879,6 +1881,7 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 
 	size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
 	size -= RTE_PKTMBUF_HEADROOM;
+	size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
 
 	req.jumbo_thresh = rte_cpu_to_le_16(size);
 	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index ec17783cf8..73eee43148 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -561,9 +561,6 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		goto err_out;
 
-	rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-		RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
-
 	if (bp->eth_dev->data->rx_queue_state[queue_index] ==
 	    RTE_ETH_QUEUE_STATE_STARTED) {
 		if (bnxt_init_one_rx_ring(rxq)) {
@@ -640,8 +637,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		if (bnxt_alloc_rx_agg_ring(bp, i))
 			goto err_out;
 
-		rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-					RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
 		if (bnxt_init_one_rx_ring(rxq)) {
 			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index d5fc5268db..192ffd8780 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -331,13 +331,13 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 
-	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_use_size);
 	PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);
 
 	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
 	if (rc)
 		goto out;
 
+	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_size);
 	rxq->queue_id = queue_idx;
 	rxq->port_id = eth_dev->data->port_id;
 	if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC)
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index b5e42d01c0..c60b04426c 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -36,7 +36,6 @@ struct bnxt_rx_queue {
 	struct bnxt_vnic_info	*vnic;
 
 	uint32_t			rx_buf_size;
-	uint32_t			rx_buf_use_size;  /* useable size */
 	struct bnxt_rx_ring_info	*rx_ring;
 	struct bnxt_cp_ring_info	*cp_ring;
 	struct bnxt_cp_ring_info	*nq_ring;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 28487fb38e..f60880c63e 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -713,9 +713,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 	struct bnxt_rx_ring_info *rxr;
 	struct bnxt_ring *ring;
 
-	rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-		RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
-	rxq->rx_buf_size = rxq->rx_buf_use_size + sizeof(struct rte_mbuf);
+	rxq->rx_buf_size = BNXT_MAX_PKT_LEN + sizeof(struct rte_mbuf);
 
 	rxr = rte_zmalloc_socket("bnxt_rx_ring",
 				 sizeof(struct bnxt_rx_ring_info),
@@ -826,8 +824,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	uint16_t size;
 
 	size = rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM;
-	if (rxq->rx_buf_use_size <= size)
-		size = rxq->rx_buf_use_size;
+	size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
 
 	type = RX_PROD_PKT_BD_TYPE_RX_PROD_PKT | RX_PROD_PKT_BD_FLAGS_EOP_PAD;
 
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 03/17] net/bnxt: fix rxq stop/start handling
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix incorrect flow steering Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: subscribe to link speed change notification Ajit Khaparde
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Driver should not change "deferred_start" state of the rx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet receive
functions to determine whether a stopped rx ring should be polled,
introduced a per-rxq flag to track queue stopped/started state.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c       |  2 +-
 drivers/net/bnxt/bnxt_ring.c         |  3 +--
 drivers/net/bnxt/bnxt_rxq.c          | 36 +++++++++++++++++++---------
 drivers/net/bnxt/bnxt_rxq.h          |  1 +
 drivers/net/bnxt/bnxt_rxr.c          |  7 +++---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c |  2 +-
 6 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 4095e9c720..d1c5acb3e2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1945,7 +1945,7 @@ bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
 	qinfo->conf.rx_drop_en = 0;
-	qinfo->conf.rx_deferred_start = 0;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
 }
 
 static void
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 73eee43148..68a690de5a 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -561,8 +561,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		goto err_out;
 
-	if (bp->eth_dev->data->rx_queue_state[queue_index] ==
-	    RTE_ETH_QUEUE_STATE_STARTED) {
+	if (!rxq->rx_started) {
 		if (bnxt_init_one_rx_ring(rxq)) {
 			RTE_LOG(ERR, PMD,
 				"bnxt_init_one_rx_ring failed!\n");
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 192ffd8780..4b506f8653 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -357,9 +357,19 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	}
 	rte_atomic64_init(&rxq->rx_mbuf_alloc_fail);
 
-	rxq->rx_deferred_start = rx_conf->rx_deferred_start;
-	queue_state = rxq->rx_deferred_start ? RTE_ETH_QUEUE_STATE_STOPPED :
-						RTE_ETH_QUEUE_STATE_STARTED;
+	/* rxq 0 must not be stopped when used as async CPR */
+	if (!BNXT_NUM_ASYNC_CPR(bp) && queue_idx == 0)
+		rxq->rx_deferred_start = false;
+	else
+		rxq->rx_deferred_start = rx_conf->rx_deferred_start;
+
+	if (rxq->rx_deferred_start) {
+		queue_state = RTE_ETH_QUEUE_STATE_STOPPED;
+		rxq->rx_started = false;
+	} else {
+		queue_state = RTE_ETH_QUEUE_STATE_STARTED;
+		rxq->rx_started = true;
+	}
 	eth_dev->data->rx_queue_state[queue_idx] = queue_state;
 	rte_spinlock_init(&rxq->lock);
 
@@ -432,6 +442,11 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	/* Set the queue state to started here.
+	 * We check the status of the queue while posting buffer.
+	 * If queue is it started, we do not post buffers for Rx.
+	 */
+	rxq->rx_started = true;
 	bnxt_free_hwrm_rx_ring(bp, rx_queue_id);
 	rc = bnxt_alloc_hwrm_rx_ring(bp, rx_queue_id);
 	if (rc)
@@ -448,20 +463,19 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 			vnic->fw_grp_ids[rx_queue_id] =
 					bp->grp_info[rx_queue_id].fw_grp_id;
+			PMD_DRV_LOG(DEBUG,
+				    "vnic = %p fw_grp_id = %d\n",
+				    vnic, bp->grp_info[rx_queue_id].fw_grp_id);
 		}
 
-		PMD_DRV_LOG(DEBUG,
-			    "vnic = %p fw_grp_id = %d\n",
-			    vnic, bp->grp_info[rx_queue_id].fw_grp_id);
-
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 	}
 
-	if (rc == 0) {
+	if (rc == 0)
 		dev->data->rx_queue_state[rx_queue_id] =
 				RTE_ETH_QUEUE_STATE_STARTED;
-		rxq->rx_deferred_start = false;
-	}
+	else
+		rxq->rx_started = false;
 
 	PMD_DRV_LOG(INFO,
 		    "queue %d, rx_deferred_start %d, state %d!\n",
@@ -500,7 +514,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	}
 
 	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
-	rxq->rx_deferred_start = true;
+	rxq->rx_started = false;
 	PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
 
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index c60b04426c..3693d89a60 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -30,6 +30,7 @@ struct bnxt_rx_queue {
 	uint16_t		port_id; /* Device port identifier */
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
 	uint8_t			rx_deferred_start; /* not in global dev start */
+	uint8_t			rx_started; /* RX queue is started */
 
 	struct bnxt		*bp;
 	int			index;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index f60880c63e..b3cc0d8a04 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -574,10 +574,9 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	if (unlikely(is_bnxt_in_error(rxq->bp)))
 		return 0;
 
-	/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
-	if (unlikely(((rxq->rx_deferred_start ||
-		       !rte_spinlock_trylock(&rxq->lock)) &&
-		      rxq->queue_id)))
+	/* If Rx Q was stopped return */
+	if (unlikely(!rxq->rx_started ||
+		     !rte_spinlock_trylock(&rxq->lock)))
 		return 0;
 
 	/* Handle RX burst request */
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 2e6e83c949..5ae812f3b9 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -224,7 +224,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			     0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */
 
 	/* If Rx Q was stopped return */
-	if (rxq->rx_deferred_start)
+	if (unlikely(!rxq->rx_started))
 		return 0;
 
 	if (rxq->rxrearm_nb >= RTE_BNXT_RXQ_REARM_THRESH)
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 04/17] net/bnxt: subscribe to link speed change notification
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (2 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: fix rxq stop/start handling Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: fix async link handling and update Ajit Khaparde
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Rahul Gupta, Santoshkumar Karanappa Rastapur,
	Kalesh Anakkur Purayil

We are not subscribing to link speed change notification.
This patch addresses that.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 drivers/net/bnxt/bnxt_hwrm.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 09330e2382..b2033ea416 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -738,6 +738,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |
 				 ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |
 				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE |
+				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE |
 				 ASYNC_CMPL_EVENT_ID_RESET_NOTIFY);
 	if (bp->flags & BNXT_FLAG_FW_CAP_ERROR_RECOVERY)
 		req.async_event_fwd[0] |=
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 0d386952b6..5190f43290 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -21,6 +21,8 @@ struct bnxt_cp_ring_info;
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)
 #define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE	\
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE \
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE)
 #define ASYNC_CMPL_EVENT_ID_RESET_NOTIFY \
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY)
 #define ASYNC_CMPL_EVENT_ID_ERROR_RECOVERY \
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 05/17] net/bnxt: fix async link handling and update
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (3 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: subscribe to link speed change notification Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Kalesh Anakkur Purayil, Lance Richardson

When updating the link because of an async link notification
there is no need to set wait_for_completion. At this point
the link related information should be available without need to poll.
Use rte_eth_linkstatus_set instead of memcpy to ensure atomicity
while updating the link status.
We force the physical link down as a part of device stop.
But we are not waiting there enough and handling the async notification
before exiting. It just sits in the default CQ till we do a device start.
Fix it by calling the CQ handler in device stop.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c    |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++----
 drivers/net/bnxt/bnxt_irq.c    |  2 +-
 drivers/net/bnxt/bnxt_irq.h    |  1 +
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 4817672ef0..f58372516a 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -66,7 +66,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
 		/* FALLTHROUGH */
-		bnxt_link_update_op(bp->eth_dev, 1);
+		bnxt_link_update_op(bp->eth_dev, 0);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
 		PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d1c5acb3e2..4d15ba5ceb 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -834,6 +834,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
 
+	bnxt_enable_int(bp);
 	rc = bnxt_hwrm_if_change(bp, 1);
 	if (!rc) {
 		if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
@@ -862,7 +863,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
 	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
 
-	bnxt_enable_int(bp);
 	bp->flags |= BNXT_FLAG_INIT_DONE;
 	eth_dev->data->dev_started = 1;
 	bp->dev_stopped = 0;
@@ -926,7 +926,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 		/* TBD: STOP HW queues DMA */
 		eth_dev->data->dev_link.link_status = 0;
 	}
-	bnxt_set_hwrm_link_config(bp, false);
+	bnxt_dev_set_link_down_op(eth_dev);
+	/* Wait for link to be reset and the async notification to process. */
+	rte_delay_ms(BNXT_LINK_WAIT_INTERVAL * 2);
 
 	/* Clean queue intr-vector mapping */
 	rte_intr_efd_disable(intr_handle);
@@ -938,6 +940,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	bnxt_hwrm_port_clr_stats(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
+	/* Process any remaining notifications in default completion queue */
+	bnxt_int_handler(eth_dev);
 	bnxt_shutdown_nic(bp);
 	bnxt_hwrm_if_change(bp, 0);
 	bp->dev_stopped = 1;
@@ -1084,8 +1088,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	/* 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));
+		rte_eth_linkstatus_set(eth_dev, &new);
 
 		_rte_eth_dev_callback_process(eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index a22700a0da..729d68d704 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -18,7 +18,7 @@
  * Interrupts
  */
 
-static void bnxt_int_handler(void *param)
+void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct bnxt *bp = eth_dev->data->dev_private;
diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h
index 460a97a09c..1b56e08068 100644
--- a/drivers/net/bnxt/bnxt_irq.h
+++ b/drivers/net/bnxt/bnxt_irq.h
@@ -22,5 +22,6 @@ void bnxt_disable_int(struct bnxt *bp);
 void bnxt_enable_int(struct bnxt *bp);
 int bnxt_setup_int(struct bnxt *bp);
 int bnxt_request_int(struct bnxt *bp);
+void bnxt_int_handler(void *param);
 
 #endif
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix 40G link failure for Thor
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (4 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: fix async link handling and update Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix L2 context calculation " Ajit Khaparde
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

Link autonegotiation for 40G is not supported by Thor.
Hence speed needs to be forced and autoneg disabled to configure 40G speed.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index b2033ea416..6e95acb89e 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2679,11 +2679,27 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		goto port_phy_cfg;
 
 	autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds);
+	if (BNXT_CHIP_THOR(bp) &&
+	    dev_conf->link_speeds == ETH_LINK_SPEED_40G) {
+		/* 40G is not supported as part of media auto detect.
+		 * The speed should be forced and autoneg disabled
+		 * to configure 40G speed.
+		 */
+		PMD_DRV_LOG(INFO, "Disabling autoneg for 40G\n");
+		autoneg = 0;
+	}
+
 	speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds);
 	link_req.phy_flags = HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY;
-	/* Autoneg can be done only when the FW allows */
-	if (autoneg == 1 && !(bp->link_info.auto_link_speed ||
-				bp->link_info.force_link_speed)) {
+	/* Autoneg can be done only when the FW allows.
+	 * When user configures fixed speed of 40G and later changes to
+	 * any other speed, auto_link_speed/force_link_speed is still set
+	 * to 40G until link comes up at new speed.
+	 */
+	if (autoneg == 1 &&
+	    !(!BNXT_CHIP_THOR(bp) &&
+	      (bp->link_info.auto_link_speed ||
+	       bp->link_info.force_link_speed))) {
 		link_req.phy_flags |=
 				HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG;
 		link_req.auto_link_speed_mask =
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix L2 context calculation for Thor
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (5 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Somnath Kotur, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

On Wh+, number of L2 context supported by FW is the sum of number of
EM flow count and number of L2 context count returned in HWRM_FUNC_QCFG.
This is not true for Thor. Restrict this only for Whitney for now.

Fixes: ff9c0ca47e81176 ("net/bnxt: save the number of EM flow count")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6e95acb89e..d0f4054412 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -611,8 +611,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
 	bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
 	bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
-	bp->max_l2_ctx =
-		rte_le_to_cpu_16(resp->max_l2_ctxs) + bp->max_rx_em_flows;
+	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
+	if (!BNXT_CHIP_THOR(bp))
+		bp->max_l2_ctx += bp->max_rx_em_flows;
 	/* TODO: For now, do not support VMDq/RFS on VFs. */
 	if (BNXT_PF(bp)) {
 		if (bp->pf.max_vfs)
@@ -858,9 +859,9 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 		/* func_resource_qcaps does not return max_rx_em_flows.
 		 * So use the value provided by func_qcaps.
 		 */
-		bp->max_l2_ctx =
-			rte_le_to_cpu_16(resp->max_l2_ctxs) +
-			bp->max_rx_em_flows;
+		bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
+		if (!BNXT_CHIP_THOR(bp))
+			bp->max_l2_ctx += bp->max_rx_em_flows;
 		bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
 		bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
 	}
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix use of deferred start of transmit queues
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (6 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix L2 context calculation " Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: remove unnecessary return check Ajit Khaparde
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Driver should not change "deferred_start" state of the tx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet transmit
functions to determine whether the queue has been stopped already,
introduced a per-txq flag to track queue stopped/started state.

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

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +-
 drivers/net/bnxt/bnxt_txq.c          | 5 +++++
 drivers/net/bnxt/bnxt_txq.h          | 1 +
 drivers/net/bnxt/bnxt_txr.c          | 6 +++---
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 5ae812f3b9..029053e305 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -482,7 +482,7 @@ bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct bnxt_tx_queue *txq = tx_queue;
 
 	/* Tx queue was stopped; wait for it to be restarted */
-	if (unlikely(txq->tx_deferred_start)) {
+	if (unlikely(!txq->tx_started)) {
 		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
 		return 0;
 	}
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 0901324793..ea20d737fe 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -131,6 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq->bp = bp;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_free_thresh = tx_conf->tx_free_thresh;
+	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	rc = bnxt_init_tx_ring_struct(txq, socket_id);
 	if (rc)
@@ -157,6 +158,10 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->tx_queues[queue_idx] = txq;
 
+	if (txq->tx_deferred_start)
+		txq->tx_started = false;
+	else
+		txq->tx_started = true;
 out:
 	return rc;
 }
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 9190e3f731..7a442516d2 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -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			tx_started; /* TX queue is started */
 
 	struct bnxt		*bp;
 	int			index;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 172b480b2e..99d2009055 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -469,7 +469,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	bnxt_handle_tx_cp(txq);
 
 	/* Tx queue was stopped; wait for it to be restarted */
-	if (txq->tx_deferred_start) {
+	if (unlikely(!txq->tx_started)) {
 		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
 		return 0;
 	}
@@ -518,7 +518,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		return rc;
 
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
-	txq->tx_deferred_start = false;
+	txq->tx_started = true;
 	PMD_DRV_LOG(DEBUG, "Tx queue started\n");
 
 	return 0;
@@ -538,7 +538,7 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	bnxt_handle_tx_cp(txq);
 
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
-	txq->tx_deferred_start = true;
+	txq->tx_started = false;
 	PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
 
 	return 0;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 09/17] net/bnxt: remove unnecessary return check
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (7 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: remove unused macro Ajit Khaparde
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

HWRM_CHECK_RESULT_SILENT() returns if the HWRM command fails.
There is no need to check the return value after this call.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 119 +++++++++++++++++------------------
 1 file changed, 56 insertions(+), 63 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index d0f4054412..1065f21de7 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4379,7 +4379,10 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	struct hwrm_func_backing_store_qcaps_input req = {0};
 	struct hwrm_func_backing_store_qcaps_output *resp =
 		bp->hwrm_cmd_resp_addr;
-	int rc;
+	struct bnxt_ctx_pg_info *ctx_pg;
+	struct bnxt_ctx_mem_info *ctx;
+	int total_alloc_len;
+	int rc, i;
 
 	if (!BNXT_CHIP_THOR(bp) ||
 	    bp->hwrm_spec_code < HWRM_VERSION_1_9_2 ||
@@ -4391,70 +4394,60 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 	HWRM_CHECK_RESULT_SILENT();
 
-	if (!rc) {
-		struct bnxt_ctx_pg_info *ctx_pg;
-		struct bnxt_ctx_mem_info *ctx;
-		int total_alloc_len;
-		int i;
-
-		total_alloc_len = sizeof(*ctx);
-		ctx = rte_malloc("bnxt_ctx_mem", total_alloc_len,
-				 RTE_CACHE_LINE_SIZE);
-		if (!ctx) {
-			rc = -ENOMEM;
-			goto ctx_err;
-		}
-		memset(ctx, 0, total_alloc_len);
+	total_alloc_len = sizeof(*ctx);
+	ctx = rte_zmalloc("bnxt_ctx_mem", total_alloc_len,
+			  RTE_CACHE_LINE_SIZE);
+	if (!ctx) {
+		rc = -ENOMEM;
+		goto ctx_err;
+	}
 
-		ctx_pg = rte_malloc("bnxt_ctx_pg_mem",
-				    sizeof(*ctx_pg) * BNXT_MAX_Q,
-				    RTE_CACHE_LINE_SIZE);
-		if (!ctx_pg) {
-			rc = -ENOMEM;
-			goto ctx_err;
-		}
-		for (i = 0; i < BNXT_MAX_Q; i++, ctx_pg++)
-			ctx->tqm_mem[i] = ctx_pg;
-
-		bp->ctx = ctx;
-		ctx->qp_max_entries = rte_le_to_cpu_32(resp->qp_max_entries);
-		ctx->qp_min_qp1_entries =
-			rte_le_to_cpu_16(resp->qp_min_qp1_entries);
-		ctx->qp_max_l2_entries =
-			rte_le_to_cpu_16(resp->qp_max_l2_entries);
-		ctx->qp_entry_size = rte_le_to_cpu_16(resp->qp_entry_size);
-		ctx->srq_max_l2_entries =
-			rte_le_to_cpu_16(resp->srq_max_l2_entries);
-		ctx->srq_max_entries = rte_le_to_cpu_32(resp->srq_max_entries);
-		ctx->srq_entry_size = rte_le_to_cpu_16(resp->srq_entry_size);
-		ctx->cq_max_l2_entries =
-			rte_le_to_cpu_16(resp->cq_max_l2_entries);
-		ctx->cq_max_entries = rte_le_to_cpu_32(resp->cq_max_entries);
-		ctx->cq_entry_size = rte_le_to_cpu_16(resp->cq_entry_size);
-		ctx->vnic_max_vnic_entries =
-			rte_le_to_cpu_16(resp->vnic_max_vnic_entries);
-		ctx->vnic_max_ring_table_entries =
-			rte_le_to_cpu_16(resp->vnic_max_ring_table_entries);
-		ctx->vnic_entry_size = rte_le_to_cpu_16(resp->vnic_entry_size);
-		ctx->stat_max_entries =
-			rte_le_to_cpu_32(resp->stat_max_entries);
-		ctx->stat_entry_size = rte_le_to_cpu_16(resp->stat_entry_size);
-		ctx->tqm_entry_size = rte_le_to_cpu_16(resp->tqm_entry_size);
-		ctx->tqm_min_entries_per_ring =
-			rte_le_to_cpu_32(resp->tqm_min_entries_per_ring);
-		ctx->tqm_max_entries_per_ring =
-			rte_le_to_cpu_32(resp->tqm_max_entries_per_ring);
-		ctx->tqm_entries_multiple = resp->tqm_entries_multiple;
-		if (!ctx->tqm_entries_multiple)
-			ctx->tqm_entries_multiple = 1;
-		ctx->mrav_max_entries =
-			rte_le_to_cpu_32(resp->mrav_max_entries);
-		ctx->mrav_entry_size = rte_le_to_cpu_16(resp->mrav_entry_size);
-		ctx->tim_entry_size = rte_le_to_cpu_16(resp->tim_entry_size);
-		ctx->tim_max_entries = rte_le_to_cpu_32(resp->tim_max_entries);
-	} else {
-		rc = 0;
+	ctx_pg = rte_malloc("bnxt_ctx_pg_mem",
+			    sizeof(*ctx_pg) * BNXT_MAX_Q,
+			    RTE_CACHE_LINE_SIZE);
+	if (!ctx_pg) {
+		rc = -ENOMEM;
+		goto ctx_err;
 	}
+	for (i = 0; i < BNXT_MAX_Q; i++, ctx_pg++)
+		ctx->tqm_mem[i] = ctx_pg;
+
+	bp->ctx = ctx;
+	ctx->qp_max_entries = rte_le_to_cpu_32(resp->qp_max_entries);
+	ctx->qp_min_qp1_entries =
+		rte_le_to_cpu_16(resp->qp_min_qp1_entries);
+	ctx->qp_max_l2_entries =
+		rte_le_to_cpu_16(resp->qp_max_l2_entries);
+	ctx->qp_entry_size = rte_le_to_cpu_16(resp->qp_entry_size);
+	ctx->srq_max_l2_entries =
+		rte_le_to_cpu_16(resp->srq_max_l2_entries);
+	ctx->srq_max_entries = rte_le_to_cpu_32(resp->srq_max_entries);
+	ctx->srq_entry_size = rte_le_to_cpu_16(resp->srq_entry_size);
+	ctx->cq_max_l2_entries =
+		rte_le_to_cpu_16(resp->cq_max_l2_entries);
+	ctx->cq_max_entries = rte_le_to_cpu_32(resp->cq_max_entries);
+	ctx->cq_entry_size = rte_le_to_cpu_16(resp->cq_entry_size);
+	ctx->vnic_max_vnic_entries =
+		rte_le_to_cpu_16(resp->vnic_max_vnic_entries);
+	ctx->vnic_max_ring_table_entries =
+		rte_le_to_cpu_16(resp->vnic_max_ring_table_entries);
+	ctx->vnic_entry_size = rte_le_to_cpu_16(resp->vnic_entry_size);
+	ctx->stat_max_entries =
+		rte_le_to_cpu_32(resp->stat_max_entries);
+	ctx->stat_entry_size = rte_le_to_cpu_16(resp->stat_entry_size);
+	ctx->tqm_entry_size = rte_le_to_cpu_16(resp->tqm_entry_size);
+	ctx->tqm_min_entries_per_ring =
+		rte_le_to_cpu_32(resp->tqm_min_entries_per_ring);
+	ctx->tqm_max_entries_per_ring =
+		rte_le_to_cpu_32(resp->tqm_max_entries_per_ring);
+	ctx->tqm_entries_multiple = resp->tqm_entries_multiple;
+	if (!ctx->tqm_entries_multiple)
+		ctx->tqm_entries_multiple = 1;
+	ctx->mrav_max_entries =
+		rte_le_to_cpu_32(resp->mrav_max_entries);
+	ctx->mrav_entry_size = rte_le_to_cpu_16(resp->mrav_entry_size);
+	ctx->tim_entry_size = rte_le_to_cpu_16(resp->tim_entry_size);
+	ctx->tim_max_entries = rte_le_to_cpu_32(resp->tim_max_entries);
 ctx_err:
 	HWRM_UNLOCK();
 	return rc;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 10/17] net/bnxt: remove unused macro
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (8 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: remove unnecessary return check Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

remove MAX_NUM_MAC_ADDR macro

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 68ac30bb58..089f86fec7 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -488,7 +488,6 @@ struct bnxt {
 
 	struct bnxt_irq         *irq_tbl;
 
-#define MAX_NUM_MAC_ADDR	32
 	uint8_t			mac_addr[RTE_ETHER_ADDR_LEN];
 
 	uint16_t			hwrm_cmd_seq;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 11/17] net/bnxt: remove unnecessary interrupt disable
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (9 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: remove unused macro Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: fix accessing variable before null check Ajit Khaparde
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Since bnxt_enable_int() is called at start time, invoke bnxt_disable_int()
during stop only. Remove it from device uninit function.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 4d15ba5ceb..74ded7717a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4576,7 +4576,6 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 {
 	int rc;
 
-	bnxt_disable_int(bp);
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp, reconfig_dev);
 	bnxt_hwrm_func_buf_unrgtr(bp);
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 12/17] net/bnxt: fix accessing variable before null check
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (10 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix Rx queue count devop Ajit Khaparde
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Santoshkumar Karanappa Rastapur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Check input argument "rxq" in bnxt_rx_queue_release_mbufs(), to be sure
variable is not NULL before accessing it.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 53 +++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 4b506f8653..dac8ccb167 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -207,39 +207,40 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 	struct bnxt_tpa_info *tpa_info;
 	uint16_t i;
 
+	if (!rxq)
+		return;
+
 	rte_spinlock_lock(&rxq->lock);
 
-	if (rxq) {
-		sw_ring = rxq->rx_ring->rx_buf_ring;
-		if (sw_ring) {
-			for (i = 0;
-			     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
-				if (sw_ring[i].mbuf) {
-					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
-					sw_ring[i].mbuf = NULL;
-				}
+	sw_ring = rxq->rx_ring->rx_buf_ring;
+	if (sw_ring) {
+		for (i = 0;
+		     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
+			if (sw_ring[i].mbuf) {
+				rte_pktmbuf_free_seg(sw_ring[i].mbuf);
+				sw_ring[i].mbuf = NULL;
 			}
 		}
-		/* Free up mbufs in Agg ring */
-		sw_ring = rxq->rx_ring->ag_buf_ring;
-		if (sw_ring) {
-			for (i = 0;
-			     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
-				if (sw_ring[i].mbuf) {
-					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
-					sw_ring[i].mbuf = NULL;
-				}
+	}
+	/* Free up mbufs in Agg ring */
+	sw_ring = rxq->rx_ring->ag_buf_ring;
+	if (sw_ring) {
+		for (i = 0;
+		     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
+			if (sw_ring[i].mbuf) {
+				rte_pktmbuf_free_seg(sw_ring[i].mbuf);
+				sw_ring[i].mbuf = NULL;
 			}
 		}
+	}
 
-		/* Free up mbufs in TPA */
-		tpa_info = rxq->rx_ring->tpa_info;
-		if (tpa_info) {
-			for (i = 0; i < BNXT_TPA_MAX; i++) {
-				if (tpa_info[i].mbuf) {
-					rte_pktmbuf_free_seg(tpa_info[i].mbuf);
-					tpa_info[i].mbuf = NULL;
-				}
+	/* Free up mbufs in TPA */
+	tpa_info = rxq->rx_ring->tpa_info;
+	if (tpa_info) {
+		for (i = 0; i < BNXT_TPA_MAX; i++) {
+			if (tpa_info[i].mbuf) {
+				rte_pktmbuf_free_seg(tpa_info[i].mbuf);
+				tpa_info[i].mbuf = NULL;
 			}
 		}
 	}
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix Rx queue count devop
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (11 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: fix accessing variable before null check Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx Ajit Khaparde
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Rahul Gupta, stable, Somnath Kotur

From: Rahul Gupta <rahul.gupta@broadcom.com>

Fix Computing of number of used descriptors in an Rx queue.

Fixes: 1b7ceba3e375 ("net/bnxt: support Rx queue count")
Cc: stable@dpdk.org
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 74ded7717a..0159be3462 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2096,9 +2096,6 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	struct bnxt_cp_ring_info *cpr;
 	struct bnxt_rx_queue *rxq;
 	struct rx_pkt_cmpl *rxcmp;
-	uint16_t cmp_type;
-	uint8_t cmp = 1;
-	bool valid;
 	int rc;
 
 	rc = is_bnxt_in_error(bp);
@@ -2107,33 +2104,19 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 	rxq = dev->data->rx_queues[rx_queue_id];
 	cpr = rxq->cp_ring;
-	valid = cpr->valid;
+	raw_cons = cpr->cp_raw_cons;
 
-	while (raw_cons < rxq->nb_rx_desc) {
+	while (1) {
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
+		rte_prefetch0(&cpr->cp_desc_ring[cons]);
 		rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
-		if (!CMPL_VALID(rxcmp, valid))
-			goto nothing_to_do;
-		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;
-			desc++;
-		} else if (cmp_type == 0x11) {
-			desc++;
-			cmp = (rxcmp->agg_bufs_v1 &
-				   RX_PKT_CMPL_AGG_BUFS_MASK) >>
-				RX_PKT_CMPL_AGG_BUFS_SFT;
+		if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) {
+			break;
 		} else {
-			cmp = 1;
+			raw_cons++;
+			desc++;
 		}
-nothing_to_do:
-		raw_cons += cmp ? cmp : 2;
 	}
 
 	return desc;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (12 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix Rx queue count devop Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: fix a segfault in secondary process Ajit Khaparde
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

PKT_RX_IEEE1588_PTP and PKT_RX_IEEE1588_TMST flags need to be set
in the offload flags for the received pkt in case of PTP offload.

Fixes: bc4a000f2f53c ("net/bnxt: implement SSE vector mode")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 029053e305..b853a8810a 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -255,6 +255,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			uint16_t cp_cons;
 			struct rte_mbuf *mbuf;
 			__m128i mm_rxcmp, pkt_mb;
+			uint16_t flags_type;
 
 			tmp_raw_cons = NEXT_RAW_CMP(raw_cons);
 			cp_cons = RING_CMP(cpr->cp_ring_struct, tmp_raw_cons);
@@ -288,9 +289,17 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 			rte_compiler_barrier();
 
-			if (rxcmp->flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
+			flags_type = rte_le_to_cpu_16(rxcmp->flags_type);
+
+			if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
 				mbuf->ol_flags |= PKT_RX_RSS_HASH;
 
+#ifdef RTE_LIBRTE_IEEE1588
+			if ((flags_type & RX_PKT_CMPL_FLAGS_MASK) ==
+			    RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP)
+				mbuf->ol_flags |= PKT_RX_IEEE1588_PTP |
+					PKT_RX_IEEE1588_TMST;
+#endif
 			if (rxcmp1->flags2 &
 			    RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) {
 				mbuf->vlan_tci = rxcmp1->metadata &
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 15/17] net/bnxt: fix a segfault in secondary process
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (13 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hemminger, stable

From: Stephen Hemminger <stephen@networkplumber.org>

The secondary process should not modify device state when
init is called. The pci device information pointed to by
dev_private pointer is not correct in secondary process.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0159be3462..5985963bf7 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -521,6 +521,7 @@ static int bnxt_init_nic(struct bnxt *bp)
 static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				struct rte_eth_dev_info *dev_info)
 {
+	struct rte_pci_device *pdev = RTE_DEV_TO_PCI(eth_dev->device);
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint16_t max_vnics, i, j, vpool, vrxq;
 	unsigned int max_rx_rings;
@@ -536,7 +537,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 
 	/* PF/VF specifics */
 	if (BNXT_PF(bp))
-		dev_info->max_vfs = bp->pdev->max_vfs;
+		dev_info->max_vfs = pdev->max_vfs;
+
 	max_rx_rings = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
@@ -4488,12 +4490,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (version_printed++ == 0)
 		PMD_DRV_LOG(INFO, "%s\n", bnxt_version);
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
-	bp = eth_dev->data->dev_private;
-
-	bp->dev_stopped = 1;
-
 	eth_dev->dev_ops = &bnxt_dev_ops;
 	eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
 	eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
@@ -4505,6 +4501,12 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
+	bp = eth_dev->data->dev_private;
+
+	bp->dev_stopped = 1;
+
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
 		bp->flags |= BNXT_FLAG_VF;
 
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 16/17] net/bnxt: support for QinQ insertion and stripping
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (14 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: fix a segfault in secondary process Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: use macro for getting default vnic Ajit Khaparde
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Somnath Kotur

From: Somnath Kotur <somnath.kotur@broadcom.com>

Driver will accelerate only outer/S-VLAN insertion by turning on
the appropriate bits in the Tx Buffer Descriptor when the packet
arrives for transmission.
The TPID to be used for this S-VLAN is conveyed by the vlan_tpid_set
dev_op which will terminate in the driver.
In the Rx path, driver will continue providing the stripped vlan tag
in the mbuf's vlan tci field. This would be the outermost vlan tag
in a double-tagged packet or the vlan tag for a single vlan tagged pkt.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  4 ++
 drivers/net/bnxt/bnxt_ethdev.c | 71 ++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_txr.c    | 13 ++++++-
 3 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 089f86fec7..f8a550ba54 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -521,6 +521,10 @@ struct bnxt {
 	uint16_t		max_stat_ctx;
 	uint16_t		first_vf_id;
 	uint16_t		vlan;
+#define BNXT_OUTER_TPID_MASK	0x0000ffff
+#define BNXT_OUTER_TPID_BD_MASK	0xffff0000
+#define BNXT_OUTER_TPID_BD_SHFT	16
+	uint32_t		outer_tpid_bd;
 	struct bnxt_pf_info	pf;
 	uint8_t			port_partition_type;
 	uint8_t			dev_stopped;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5985963bf7..b3a37e1554 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -151,6 +151,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
 				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
 				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_QINQ_INSERT | \
 				     DEV_TX_OFFLOAD_MULTI_SEGS)
 
 #define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
@@ -161,6 +162,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
 				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
 				     DEV_RX_OFFLOAD_KEEP_CRC | \
+				     DEV_RX_OFFLOAD_VLAN_EXTEND | \
 				     DEV_RX_OFFLOAD_TCP_LRO)
 
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
@@ -1831,15 +1833,77 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 			!!(rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP));
 	}
 
-	if (mask & ETH_VLAN_EXTEND_MASK)
-		PMD_DRV_LOG(ERR, "Extend VLAN Not supported\n");
+	if (mask & ETH_VLAN_EXTEND_MASK) {
+		if (rx_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
+			PMD_DRV_LOG(DEBUG, "Extend VLAN supported\n");
+		else
+			PMD_DRV_LOG(INFO, "Extend VLAN unsupported\n");
+	}
+
+	return 0;
+}
+
+static int
+bnxt_vlan_tpid_set_op(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type,
+		      uint16_t tpid)
+{
+	struct bnxt *bp = dev->data->dev_private;
+	int qinq = dev->data->dev_conf.rxmode.offloads &
+		   DEV_RX_OFFLOAD_VLAN_EXTEND;
+
+	if (vlan_type != ETH_VLAN_TYPE_INNER &&
+	    vlan_type != ETH_VLAN_TYPE_OUTER) {
+		PMD_DRV_LOG(ERR,
+			    "Unsupported vlan type.");
+		return -EINVAL;
+	}
+	if (!qinq) {
+		PMD_DRV_LOG(ERR,
+			    "QinQ not enabled. Needs to be ON as we can "
+			    "accelerate only outer vlan\n");
+		return -EINVAL;
+	}
+
+	if (vlan_type == ETH_VLAN_TYPE_OUTER) {
+		switch (tpid) {
+		case RTE_ETHER_TYPE_QINQ:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8;
+				break;
+		case RTE_ETHER_TYPE_VLAN:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
+				break;
+		case 0x9100:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100;
+				break;
+		case 0x9200:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200;
+				break;
+		case 0x9300:
+			bp->outer_tpid_bd =
+				 TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300;
+				break;
+		default:
+			PMD_DRV_LOG(ERR, "Invalid TPID: %x\n", tpid);
+			return -EINVAL;
+		}
+		bp->outer_tpid_bd |= tpid;
+		PMD_DRV_LOG(INFO, "outer_tpid_bd = %x\n", bp->outer_tpid_bd);
+	} else if (vlan_type == ETH_VLAN_TYPE_INNER) {
+		PMD_DRV_LOG(ERR,
+			    "Can accelerate only outer vlan in QinQ\n");
+		return -EINVAL;
+	}
 
 	return 0;
 }
 
 static int
 bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
-			struct rte_ether_addr *addr)
+			     struct rte_ether_addr *addr)
 {
 	struct bnxt *bp = dev->data->dev_private;
 	/* Default Filter is tied to VNIC 0 */
@@ -3534,6 +3598,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.udp_tunnel_port_del  = bnxt_udp_tunnel_port_del_op,
 	.vlan_filter_set = bnxt_vlan_filter_set_op,
 	.vlan_offload_set = bnxt_vlan_offload_set_op,
+	.vlan_tpid_set = bnxt_vlan_tpid_set_op,
 	.vlan_pvid_set = bnxt_vlan_pvid_set_op,
 	.mtu_set = bnxt_mtu_set_op,
 	.mac_addr_set = bnxt_set_default_mac_addr_op,
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 99d2009055..0ed6581bed 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -134,6 +134,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				struct tx_bd_long **last_txbd)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	uint32_t outer_tpid_bd = 0;
 	struct tx_bd_long *txbd;
 	struct tx_bd_long_hi *txbd1 = NULL;
 	uint32_t vlan_tag_flags, cfa_action;
@@ -155,7 +156,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM |
 				PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM |
 				PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN |
-				PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST))
+				PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST |
+				PKT_TX_QINQ_PKT))
 		long_bd = true;
 
 	nr_bds = long_bd + tx_pkt->nb_segs;
@@ -209,7 +211,14 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
 		vlan_tag_flags = 0;
 		cfa_action = 0;
-		if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
+		/* HW can accelerate only outer vlan in QinQ mode */
+		if (tx_buf->mbuf->ol_flags & PKT_TX_QINQ_PKT) {
+			vlan_tag_flags = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
+				tx_buf->mbuf->vlan_tci_outer;
+			outer_tpid_bd = txq->bp->outer_tpid_bd &
+				BNXT_OUTER_TPID_BD_MASK;
+			vlan_tag_flags |= outer_tpid_bd;
+		} else if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
 			/* shurd: Should this mask at
 			 * TX_BD_LONG_CFA_META_VLAN_VID_MASK?
 			 */
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v2 17/17] net/bnxt: use macro for getting default vnic
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (15 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
@ 2019-10-02  5:54 ` Ajit Khaparde
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
  17 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02  5:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Minor code cleanup. BNXT_GET_DEFAULT_VNIC macro returns the default VNIC
of the function and fixed code to use the macro.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b3a37e1554..bc9a910ee3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1118,7 +1118,7 @@ static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_PROMISC;
@@ -1143,7 +1143,7 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
@@ -1168,7 +1168,7 @@ static int bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
@@ -1193,7 +1193,7 @@ static int bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI;
@@ -1960,7 +1960,7 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	if (nb_mc_addr > BNXT_MAX_MC_ADDRS) {
 		vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 00/16] bnxt patchset
  2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
                   ` (16 preceding siblings ...)
  2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: use macro for getting default vnic Ajit Khaparde
@ 2019-10-02 17:17 ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 01/16] net/bnxt: fix incorrect flow steering Ajit Khaparde
                     ` (16 more replies)
  17 siblings, 17 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

bnxt patchset against dpdk-next-net.
This patchset has been rebased and is dependent on
"bnxt patchset to support device error recovery"
commit-id 5f30ec0329bf81d8a4a3404faaf450dbceb9463e

Please apply.

v1->v2: 5f30ec0329bf81d8a4a3404faaf450dbceb9463e
v2->v3: Removed an unnecessary patch from v2. No other change.

Ajit Khaparde (2):
  net/bnxt: subscribe to link speed change notification
  net/bnxt: fix async link handling and update

Kalesh AP (8):
  net/bnxt: fix rxq stop/start handling
  net/bnxt: fix L2 context calculation for Thor
  net/bnxt: fix use of deferred start of transmit queues
  net/bnxt: remove unnecessary return check
  net/bnxt: remove unused macro
  net/bnxt: remove unnecessary interrupt disable
  net/bnxt: fix accessing variable before null check
  net/bnxt: use macro for getting default vnic

Rahul Gupta (1):
  net/bnxt: fix Rx queue count devop

Santoshkumar Karanappa Rastapur (3):
  net/bnxt: fix incorrect flow steering
  net/bnxt: fix traffic failure with higher mbuf size
  net/bnxt: fix 40G link failure for Thor

Somnath Kotur (1):
  net/bnxt: support for QinQ insertion and stripping

Stephen Hemminger (1):
  net/bnxt: fix a segfault in secondary process

 drivers/net/bnxt/bnxt.h              |  10 +-
 drivers/net/bnxt/bnxt_cpr.c          |   2 +-
 drivers/net/bnxt/bnxt_ethdev.c       | 171 +++++++++++++++++----------
 drivers/net/bnxt/bnxt_flow.c         |   4 +
 drivers/net/bnxt/bnxt_hwrm.c         | 156 +++++++++++++-----------
 drivers/net/bnxt/bnxt_hwrm.h         |   2 +
 drivers/net/bnxt/bnxt_irq.c          |   2 +-
 drivers/net/bnxt/bnxt_irq.h          |   1 +
 drivers/net/bnxt/bnxt_ring.c         |   8 +-
 drivers/net/bnxt/bnxt_rxq.c          |  91 ++++++++------
 drivers/net/bnxt/bnxt_rxq.h          |   2 +-
 drivers/net/bnxt/bnxt_rxr.c          |  14 +--
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c |   4 +-
 drivers/net/bnxt/bnxt_txq.c          |   5 +
 drivers/net/bnxt/bnxt_txq.h          |   1 +
 drivers/net/bnxt/bnxt_txr.c          |  19 ++-
 16 files changed, 290 insertions(+), 202 deletions(-)

-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 01/16] net/bnxt: fix incorrect flow steering
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 02/16] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
                     ` (15 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur, Lance Richardson,
	Somnath Kotur

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

When user creates a flow similar to an existing flow with just the
destination queue change, we delete the old filter and allocate a new one
with this destination queue change. We were also allocating a new L2
filter matching the same destination mac resulting in 2 L2 filters for the
same destination mac. This was causing any flow matching the destination
mac to be steered to this queue instead of the default queue.
Fixed it by deleting this stale L2 filter.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index deb9733e99..be9b6fad39 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1028,6 +1028,10 @@ 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;
+				/* Clear the new L2 filter that was created
+				 * earlier in bnxt_validate_and_parse_flow.
+				 */
+				bnxt_hwrm_clear_l2_filter(bp, nf);
 				/*
 				 * Same Flow, Different queue
 				 * Clear the old ntuple filter
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 02/16] net/bnxt: fix traffic failure with higher mbuf size
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 01/16] net/bnxt: fix incorrect flow steering Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling Ajit Khaparde
                     ` (14 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur, stable, Kalesh AP,
	Somnath Kotur, Lance Richardson

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

Maximum frame length supported by hw is 9600 bytes.
When user launches testpmd with --mbuf-size=9729,
we are posting buffer descriptors of size 9601 to the ring.
This was causing packets getting discarded.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  5 ++++-
 drivers/net/bnxt/bnxt_ethdev.c | 29 +++++++++--------------------
 drivers/net/bnxt/bnxt_hwrm.c   |  3 +++
 drivers/net/bnxt/bnxt_ring.c   |  5 -----
 drivers/net/bnxt/bnxt_rxq.c    |  2 +-
 drivers/net/bnxt/bnxt_rxq.h    |  1 -
 drivers/net/bnxt/bnxt_rxr.c    |  7 ++-----
 7 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 818a49f461..68ac30bb58 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -23,12 +23,15 @@
 
 #define BNXT_MAX_MTU		9574
 #define VLAN_TAG_SIZE		4
+#define BNXT_NUM_VLANS		2
+#define BNXT_MAX_PKT_LEN	(BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\
+				 RTE_ETHER_CRC_LEN +\
+				 (BNXT_NUM_VLANS * VLAN_TAG_SIZE))
 #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
 #define BNXT_MAX_TX_RING_DESC	4096
 #define BNXT_MAX_RX_RING_DESC	8192
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0083ba6e83..4095e9c720 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -545,10 +545,13 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->hash_key_size = 40;
 	max_vnics = bp->max_vnics;
 
+	/* MTU specifics */
+	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
+	dev_info->max_mtu = BNXT_MAX_MTU;
+
 	/* Fast path specifics */
 	dev_info->min_rx_bufsize = 1;
-	dev_info->max_rx_pktlen = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-		RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
+	dev_info->max_rx_pktlen = BNXT_MAX_PKT_LEN;
 
 	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
 	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
@@ -1967,7 +1970,6 @@ bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
-	struct rte_eth_dev_info dev_info;
 	uint32_t new_pkt_size;
 	uint32_t rc = 0;
 	uint32_t i;
@@ -1979,18 +1981,6 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 	new_pkt_size = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
 		       VLAN_TAG_SIZE * BNXT_NUM_VLANS;
 
-	rc = bnxt_dev_info_get_op(eth_dev, &dev_info);
-	if (rc != 0) {
-		PMD_DRV_LOG(ERR, "Error during getting ethernet device info\n");
-		return rc;
-	}
-
-	if (new_mtu < RTE_ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) {
-		PMD_DRV_LOG(ERR, "MTU requested must be within (%d, %d)\n",
-			RTE_ETHER_MIN_MTU, BNXT_MAX_MTU);
-		return -EINVAL;
-	}
-
 #ifdef RTE_ARCH_X86
 	/*
 	 * If vector-mode tx/rx is active, disallow any MTU change that would
@@ -2020,15 +2010,12 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
 
-	eth_dev->data->mtu = new_mtu;
-	PMD_DRV_LOG(INFO, "New MTU is %d\n", eth_dev->data->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 + RTE_ETHER_HDR_LEN +
-					RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
+		vnic->mru = new_mtu + RTE_ETHER_HDR_LEN +
+				RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
 		rc = bnxt_hwrm_vnic_cfg(bp, vnic);
 		if (rc)
 			break;
@@ -2043,6 +2030,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		}
 	}
 
+	PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu);
+
 	return rc;
 }
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 174dc75d54..09330e2382 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1233,6 +1233,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 			mb_pool = bp->rx_queues[0]->mb_pool;
 			rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 				      RTE_PKTMBUF_HEADROOM;
+			rx_buf_size = RTE_MIN(BNXT_MAX_PKT_LEN, rx_buf_size);
 			req.rx_buf_size = rte_cpu_to_le_16(rx_buf_size);
 			enables |=
 				HWRM_RING_ALLOC_INPUT_ENABLES_RX_BUF_SIZE_VALID;
@@ -1263,6 +1264,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		mb_pool = bp->rx_queues[0]->mb_pool;
 		rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 			      RTE_PKTMBUF_HEADROOM;
+		rx_buf_size = RTE_MIN(BNXT_MAX_PKT_LEN, rx_buf_size);
 		req.rx_buf_size = rte_cpu_to_le_16(rx_buf_size);
 
 		req.stat_ctx_id = rte_cpu_to_le_32(stats_ctx_id);
@@ -1879,6 +1881,7 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 
 	size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
 	size -= RTE_PKTMBUF_HEADROOM;
+	size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
 
 	req.jumbo_thresh = rte_cpu_to_le_16(size);
 	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index ec17783cf8..73eee43148 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -561,9 +561,6 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		goto err_out;
 
-	rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-		RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
-
 	if (bp->eth_dev->data->rx_queue_state[queue_index] ==
 	    RTE_ETH_QUEUE_STATE_STARTED) {
 		if (bnxt_init_one_rx_ring(rxq)) {
@@ -640,8 +637,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		if (bnxt_alloc_rx_agg_ring(bp, i))
 			goto err_out;
 
-		rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-					RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
 		if (bnxt_init_one_rx_ring(rxq)) {
 			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index d5fc5268db..192ffd8780 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -331,13 +331,13 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 
-	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_use_size);
 	PMD_DRV_LOG(DEBUG, "RX Buf MTU %d\n", eth_dev->data->mtu);
 
 	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
 	if (rc)
 		goto out;
 
+	PMD_DRV_LOG(DEBUG, "RX Buf size is %d\n", rxq->rx_buf_size);
 	rxq->queue_id = queue_idx;
 	rxq->port_id = eth_dev->data->port_id;
 	if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC)
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index b5e42d01c0..c60b04426c 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -36,7 +36,6 @@ struct bnxt_rx_queue {
 	struct bnxt_vnic_info	*vnic;
 
 	uint32_t			rx_buf_size;
-	uint32_t			rx_buf_use_size;  /* useable size */
 	struct bnxt_rx_ring_info	*rx_ring;
 	struct bnxt_cp_ring_info	*cp_ring;
 	struct bnxt_cp_ring_info	*nq_ring;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 28487fb38e..f60880c63e 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -713,9 +713,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 	struct bnxt_rx_ring_info *rxr;
 	struct bnxt_ring *ring;
 
-	rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +
-		RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);
-	rxq->rx_buf_size = rxq->rx_buf_use_size + sizeof(struct rte_mbuf);
+	rxq->rx_buf_size = BNXT_MAX_PKT_LEN + sizeof(struct rte_mbuf);
 
 	rxr = rte_zmalloc_socket("bnxt_rx_ring",
 				 sizeof(struct bnxt_rx_ring_info),
@@ -826,8 +824,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	uint16_t size;
 
 	size = rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM;
-	if (rxq->rx_buf_use_size <= size)
-		size = rxq->rx_buf_use_size;
+	size = RTE_MIN(BNXT_MAX_PKT_LEN, size);
 
 	type = RX_PROD_PKT_BD_TYPE_RX_PROD_PKT | RX_PROD_PKT_BD_FLAGS_EOP_PAD;
 
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 01/16] net/bnxt: fix incorrect flow steering Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 02/16] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 04/16] net/bnxt: subscribe to link speed change notification Ajit Khaparde
                     ` (13 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Driver should not change "deferred_start" state of the rx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet receive
functions to determine whether a stopped rx ring should be polled,
introduced a per-rxq flag to track queue stopped/started state.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c       |  2 +-
 drivers/net/bnxt/bnxt_ring.c         |  3 +--
 drivers/net/bnxt/bnxt_rxq.c          | 36 +++++++++++++++++++---------
 drivers/net/bnxt/bnxt_rxq.h          |  1 +
 drivers/net/bnxt/bnxt_rxr.c          |  7 +++---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c |  2 +-
 6 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 4095e9c720..d1c5acb3e2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1945,7 +1945,7 @@ bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
 	qinfo->conf.rx_drop_en = 0;
-	qinfo->conf.rx_deferred_start = 0;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
 }
 
 static void
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 73eee43148..68a690de5a 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -561,8 +561,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		goto err_out;
 
-	if (bp->eth_dev->data->rx_queue_state[queue_index] ==
-	    RTE_ETH_QUEUE_STATE_STARTED) {
+	if (!rxq->rx_started) {
 		if (bnxt_init_one_rx_ring(rxq)) {
 			RTE_LOG(ERR, PMD,
 				"bnxt_init_one_rx_ring failed!\n");
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 192ffd8780..4b506f8653 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -357,9 +357,19 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	}
 	rte_atomic64_init(&rxq->rx_mbuf_alloc_fail);
 
-	rxq->rx_deferred_start = rx_conf->rx_deferred_start;
-	queue_state = rxq->rx_deferred_start ? RTE_ETH_QUEUE_STATE_STOPPED :
-						RTE_ETH_QUEUE_STATE_STARTED;
+	/* rxq 0 must not be stopped when used as async CPR */
+	if (!BNXT_NUM_ASYNC_CPR(bp) && queue_idx == 0)
+		rxq->rx_deferred_start = false;
+	else
+		rxq->rx_deferred_start = rx_conf->rx_deferred_start;
+
+	if (rxq->rx_deferred_start) {
+		queue_state = RTE_ETH_QUEUE_STATE_STOPPED;
+		rxq->rx_started = false;
+	} else {
+		queue_state = RTE_ETH_QUEUE_STATE_STARTED;
+		rxq->rx_started = true;
+	}
 	eth_dev->data->rx_queue_state[queue_idx] = queue_state;
 	rte_spinlock_init(&rxq->lock);
 
@@ -432,6 +442,11 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	/* Set the queue state to started here.
+	 * We check the status of the queue while posting buffer.
+	 * If queue is it started, we do not post buffers for Rx.
+	 */
+	rxq->rx_started = true;
 	bnxt_free_hwrm_rx_ring(bp, rx_queue_id);
 	rc = bnxt_alloc_hwrm_rx_ring(bp, rx_queue_id);
 	if (rc)
@@ -448,20 +463,19 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 			vnic->fw_grp_ids[rx_queue_id] =
 					bp->grp_info[rx_queue_id].fw_grp_id;
+			PMD_DRV_LOG(DEBUG,
+				    "vnic = %p fw_grp_id = %d\n",
+				    vnic, bp->grp_info[rx_queue_id].fw_grp_id);
 		}
 
-		PMD_DRV_LOG(DEBUG,
-			    "vnic = %p fw_grp_id = %d\n",
-			    vnic, bp->grp_info[rx_queue_id].fw_grp_id);
-
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 	}
 
-	if (rc == 0) {
+	if (rc == 0)
 		dev->data->rx_queue_state[rx_queue_id] =
 				RTE_ETH_QUEUE_STATE_STARTED;
-		rxq->rx_deferred_start = false;
-	}
+	else
+		rxq->rx_started = false;
 
 	PMD_DRV_LOG(INFO,
 		    "queue %d, rx_deferred_start %d, state %d!\n",
@@ -500,7 +514,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	}
 
 	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
-	rxq->rx_deferred_start = true;
+	rxq->rx_started = false;
 	PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
 
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index c60b04426c..3693d89a60 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -30,6 +30,7 @@ struct bnxt_rx_queue {
 	uint16_t		port_id; /* Device port identifier */
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
 	uint8_t			rx_deferred_start; /* not in global dev start */
+	uint8_t			rx_started; /* RX queue is started */
 
 	struct bnxt		*bp;
 	int			index;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index f60880c63e..b3cc0d8a04 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -574,10 +574,9 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	if (unlikely(is_bnxt_in_error(rxq->bp)))
 		return 0;
 
-	/* If Rx Q was stopped return. RxQ0 cannot be stopped. */
-	if (unlikely(((rxq->rx_deferred_start ||
-		       !rte_spinlock_trylock(&rxq->lock)) &&
-		      rxq->queue_id)))
+	/* If Rx Q was stopped return */
+	if (unlikely(!rxq->rx_started ||
+		     !rte_spinlock_trylock(&rxq->lock)))
 		return 0;
 
 	/* Handle RX burst request */
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 2e6e83c949..5ae812f3b9 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -224,7 +224,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			     0xFF, 0xFF, 0xFF, 0xFF); /* pkt_type (zeroes) */
 
 	/* If Rx Q was stopped return */
-	if (rxq->rx_deferred_start)
+	if (unlikely(!rxq->rx_started))
 		return 0;
 
 	if (rxq->rxrearm_nb >= RTE_BNXT_RXQ_REARM_THRESH)
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 04/16] net/bnxt: subscribe to link speed change notification
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (2 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 05/16] net/bnxt: fix async link handling and update Ajit Khaparde
                     ` (12 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Rahul Gupta, Santoshkumar Karanappa Rastapur,
	Kalesh Anakkur Purayil

We are not subscribing to link speed change notification.
This patch addresses that.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 drivers/net/bnxt/bnxt_hwrm.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 09330e2382..b2033ea416 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -738,6 +738,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |
 				 ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |
 				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE |
+				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE |
 				 ASYNC_CMPL_EVENT_ID_RESET_NOTIFY);
 	if (bp->flags & BNXT_FLAG_FW_CAP_ERROR_RECOVERY)
 		req.async_event_fwd[0] |=
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 0d386952b6..5190f43290 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -21,6 +21,8 @@ struct bnxt_cp_ring_info;
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)
 #define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE	\
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE)
+#define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE \
+	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE)
 #define ASYNC_CMPL_EVENT_ID_RESET_NOTIFY \
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY)
 #define ASYNC_CMPL_EVENT_ID_ERROR_RECOVERY \
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 05/16] net/bnxt: fix async link handling and update
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (3 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 04/16] net/bnxt: subscribe to link speed change notification Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 06/16] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
                     ` (11 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Kalesh Anakkur Purayil, Lance Richardson

When updating the link because of an async link notification
there is no need to set wait_for_completion. At this point
the link related information should be available without need to poll.
Use rte_eth_linkstatus_set instead of memcpy to ensure atomicity
while updating the link status.
We force the physical link down as a part of device stop.
But we are not waiting there enough and handling the async notification
before exiting. It just sits in the default CQ till we do a device start.
Fix it by calling the CQ handler in device stop.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c    |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++----
 drivers/net/bnxt/bnxt_irq.c    |  2 +-
 drivers/net/bnxt/bnxt_irq.h    |  1 +
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 4817672ef0..f58372516a 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -66,7 +66,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
 		/* FALLTHROUGH */
-		bnxt_link_update_op(bp->eth_dev, 1);
+		bnxt_link_update_op(bp->eth_dev, 0);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
 		PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d1c5acb3e2..4d15ba5ceb 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -834,6 +834,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
 
+	bnxt_enable_int(bp);
 	rc = bnxt_hwrm_if_change(bp, 1);
 	if (!rc) {
 		if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
@@ -862,7 +863,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
 	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
 
-	bnxt_enable_int(bp);
 	bp->flags |= BNXT_FLAG_INIT_DONE;
 	eth_dev->data->dev_started = 1;
 	bp->dev_stopped = 0;
@@ -926,7 +926,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 		/* TBD: STOP HW queues DMA */
 		eth_dev->data->dev_link.link_status = 0;
 	}
-	bnxt_set_hwrm_link_config(bp, false);
+	bnxt_dev_set_link_down_op(eth_dev);
+	/* Wait for link to be reset and the async notification to process. */
+	rte_delay_ms(BNXT_LINK_WAIT_INTERVAL * 2);
 
 	/* Clean queue intr-vector mapping */
 	rte_intr_efd_disable(intr_handle);
@@ -938,6 +940,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	bnxt_hwrm_port_clr_stats(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
+	/* Process any remaining notifications in default completion queue */
+	bnxt_int_handler(eth_dev);
 	bnxt_shutdown_nic(bp);
 	bnxt_hwrm_if_change(bp, 0);
 	bp->dev_stopped = 1;
@@ -1084,8 +1088,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	/* 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));
+		rte_eth_linkstatus_set(eth_dev, &new);
 
 		_rte_eth_dev_callback_process(eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index a22700a0da..729d68d704 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -18,7 +18,7 @@
  * Interrupts
  */
 
-static void bnxt_int_handler(void *param)
+void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
 	struct bnxt *bp = eth_dev->data->dev_private;
diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h
index 460a97a09c..1b56e08068 100644
--- a/drivers/net/bnxt/bnxt_irq.h
+++ b/drivers/net/bnxt/bnxt_irq.h
@@ -22,5 +22,6 @@ void bnxt_disable_int(struct bnxt *bp);
 void bnxt_enable_int(struct bnxt *bp);
 int bnxt_setup_int(struct bnxt *bp);
 int bnxt_request_int(struct bnxt *bp);
+void bnxt_int_handler(void *param);
 
 #endif
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 06/16] net/bnxt: fix 40G link failure for Thor
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (4 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 05/16] net/bnxt: fix async link handling and update Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 07/16] net/bnxt: fix L2 context calculation " Ajit Khaparde
                     ` (10 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Santoshkumar Karanappa Rastapur

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

Link autonegotiation for 40G is not supported by Thor.
Hence speed needs to be forced and autoneg disabled to configure 40G speed.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index b2033ea416..6e95acb89e 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2679,11 +2679,27 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		goto port_phy_cfg;
 
 	autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds);
+	if (BNXT_CHIP_THOR(bp) &&
+	    dev_conf->link_speeds == ETH_LINK_SPEED_40G) {
+		/* 40G is not supported as part of media auto detect.
+		 * The speed should be forced and autoneg disabled
+		 * to configure 40G speed.
+		 */
+		PMD_DRV_LOG(INFO, "Disabling autoneg for 40G\n");
+		autoneg = 0;
+	}
+
 	speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds);
 	link_req.phy_flags = HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY;
-	/* Autoneg can be done only when the FW allows */
-	if (autoneg == 1 && !(bp->link_info.auto_link_speed ||
-				bp->link_info.force_link_speed)) {
+	/* Autoneg can be done only when the FW allows.
+	 * When user configures fixed speed of 40G and later changes to
+	 * any other speed, auto_link_speed/force_link_speed is still set
+	 * to 40G until link comes up at new speed.
+	 */
+	if (autoneg == 1 &&
+	    !(!BNXT_CHIP_THOR(bp) &&
+	      (bp->link_info.auto_link_speed ||
+	       bp->link_info.force_link_speed))) {
 		link_req.phy_flags |=
 				HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG;
 		link_req.auto_link_speed_mask =
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 07/16] net/bnxt: fix L2 context calculation for Thor
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (5 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 06/16] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 08/16] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
                     ` (9 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Somnath Kotur, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

On Wh+, number of L2 context supported by FW is the sum of number of
EM flow count and number of L2 context count returned in HWRM_FUNC_QCFG.
This is not true for Thor. Restrict this only for Whitney for now.

Fixes: ff9c0ca47e81176 ("net/bnxt: save the number of EM flow count")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6e95acb89e..d0f4054412 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -611,8 +611,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
 	bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
 	bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
-	bp->max_l2_ctx =
-		rte_le_to_cpu_16(resp->max_l2_ctxs) + bp->max_rx_em_flows;
+	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
+	if (!BNXT_CHIP_THOR(bp))
+		bp->max_l2_ctx += bp->max_rx_em_flows;
 	/* TODO: For now, do not support VMDq/RFS on VFs. */
 	if (BNXT_PF(bp)) {
 		if (bp->pf.max_vfs)
@@ -858,9 +859,9 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 		/* func_resource_qcaps does not return max_rx_em_flows.
 		 * So use the value provided by func_qcaps.
 		 */
-		bp->max_l2_ctx =
-			rte_le_to_cpu_16(resp->max_l2_ctxs) +
-			bp->max_rx_em_flows;
+		bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
+		if (!BNXT_CHIP_THOR(bp))
+			bp->max_l2_ctx += bp->max_rx_em_flows;
 		bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
 		bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
 	}
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 08/16] net/bnxt: fix use of deferred start of transmit queues
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (6 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 07/16] net/bnxt: fix L2 context calculation " Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 09/16] net/bnxt: remove unnecessary return check Ajit Khaparde
                     ` (8 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Driver should not change "deferred_start" state of the tx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet transmit
functions to determine whether the queue has been stopped already,
introduced a per-txq flag to track queue stopped/started state.

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

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +-
 drivers/net/bnxt/bnxt_txq.c          | 5 +++++
 drivers/net/bnxt/bnxt_txq.h          | 1 +
 drivers/net/bnxt/bnxt_txr.c          | 6 +++---
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 5ae812f3b9..029053e305 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -482,7 +482,7 @@ bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct bnxt_tx_queue *txq = tx_queue;
 
 	/* Tx queue was stopped; wait for it to be restarted */
-	if (unlikely(txq->tx_deferred_start)) {
+	if (unlikely(!txq->tx_started)) {
 		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
 		return 0;
 	}
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 0901324793..ea20d737fe 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -131,6 +131,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq->bp = bp;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_free_thresh = tx_conf->tx_free_thresh;
+	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	rc = bnxt_init_tx_ring_struct(txq, socket_id);
 	if (rc)
@@ -157,6 +158,10 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->tx_queues[queue_idx] = txq;
 
+	if (txq->tx_deferred_start)
+		txq->tx_started = false;
+	else
+		txq->tx_started = true;
 out:
 	return rc;
 }
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 9190e3f731..7a442516d2 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -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			tx_started; /* TX queue is started */
 
 	struct bnxt		*bp;
 	int			index;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 172b480b2e..99d2009055 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -469,7 +469,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	bnxt_handle_tx_cp(txq);
 
 	/* Tx queue was stopped; wait for it to be restarted */
-	if (txq->tx_deferred_start) {
+	if (unlikely(!txq->tx_started)) {
 		PMD_DRV_LOG(DEBUG, "Tx q stopped;return\n");
 		return 0;
 	}
@@ -518,7 +518,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		return rc;
 
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
-	txq->tx_deferred_start = false;
+	txq->tx_started = true;
 	PMD_DRV_LOG(DEBUG, "Tx queue started\n");
 
 	return 0;
@@ -538,7 +538,7 @@ int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	bnxt_handle_tx_cp(txq);
 
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
-	txq->tx_deferred_start = true;
+	txq->tx_started = false;
 	PMD_DRV_LOG(DEBUG, "Tx queue stopped\n");
 
 	return 0;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 09/16] net/bnxt: remove unnecessary return check
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (7 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 08/16] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 10/16] net/bnxt: remove unused macro Ajit Khaparde
                     ` (7 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

HWRM_CHECK_RESULT_SILENT() returns if the HWRM command fails.
There is no need to check the return value after this call.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 119 +++++++++++++++++------------------
 1 file changed, 56 insertions(+), 63 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index d0f4054412..1065f21de7 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4379,7 +4379,10 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	struct hwrm_func_backing_store_qcaps_input req = {0};
 	struct hwrm_func_backing_store_qcaps_output *resp =
 		bp->hwrm_cmd_resp_addr;
-	int rc;
+	struct bnxt_ctx_pg_info *ctx_pg;
+	struct bnxt_ctx_mem_info *ctx;
+	int total_alloc_len;
+	int rc, i;
 
 	if (!BNXT_CHIP_THOR(bp) ||
 	    bp->hwrm_spec_code < HWRM_VERSION_1_9_2 ||
@@ -4391,70 +4394,60 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 	HWRM_CHECK_RESULT_SILENT();
 
-	if (!rc) {
-		struct bnxt_ctx_pg_info *ctx_pg;
-		struct bnxt_ctx_mem_info *ctx;
-		int total_alloc_len;
-		int i;
-
-		total_alloc_len = sizeof(*ctx);
-		ctx = rte_malloc("bnxt_ctx_mem", total_alloc_len,
-				 RTE_CACHE_LINE_SIZE);
-		if (!ctx) {
-			rc = -ENOMEM;
-			goto ctx_err;
-		}
-		memset(ctx, 0, total_alloc_len);
+	total_alloc_len = sizeof(*ctx);
+	ctx = rte_zmalloc("bnxt_ctx_mem", total_alloc_len,
+			  RTE_CACHE_LINE_SIZE);
+	if (!ctx) {
+		rc = -ENOMEM;
+		goto ctx_err;
+	}
 
-		ctx_pg = rte_malloc("bnxt_ctx_pg_mem",
-				    sizeof(*ctx_pg) * BNXT_MAX_Q,
-				    RTE_CACHE_LINE_SIZE);
-		if (!ctx_pg) {
-			rc = -ENOMEM;
-			goto ctx_err;
-		}
-		for (i = 0; i < BNXT_MAX_Q; i++, ctx_pg++)
-			ctx->tqm_mem[i] = ctx_pg;
-
-		bp->ctx = ctx;
-		ctx->qp_max_entries = rte_le_to_cpu_32(resp->qp_max_entries);
-		ctx->qp_min_qp1_entries =
-			rte_le_to_cpu_16(resp->qp_min_qp1_entries);
-		ctx->qp_max_l2_entries =
-			rte_le_to_cpu_16(resp->qp_max_l2_entries);
-		ctx->qp_entry_size = rte_le_to_cpu_16(resp->qp_entry_size);
-		ctx->srq_max_l2_entries =
-			rte_le_to_cpu_16(resp->srq_max_l2_entries);
-		ctx->srq_max_entries = rte_le_to_cpu_32(resp->srq_max_entries);
-		ctx->srq_entry_size = rte_le_to_cpu_16(resp->srq_entry_size);
-		ctx->cq_max_l2_entries =
-			rte_le_to_cpu_16(resp->cq_max_l2_entries);
-		ctx->cq_max_entries = rte_le_to_cpu_32(resp->cq_max_entries);
-		ctx->cq_entry_size = rte_le_to_cpu_16(resp->cq_entry_size);
-		ctx->vnic_max_vnic_entries =
-			rte_le_to_cpu_16(resp->vnic_max_vnic_entries);
-		ctx->vnic_max_ring_table_entries =
-			rte_le_to_cpu_16(resp->vnic_max_ring_table_entries);
-		ctx->vnic_entry_size = rte_le_to_cpu_16(resp->vnic_entry_size);
-		ctx->stat_max_entries =
-			rte_le_to_cpu_32(resp->stat_max_entries);
-		ctx->stat_entry_size = rte_le_to_cpu_16(resp->stat_entry_size);
-		ctx->tqm_entry_size = rte_le_to_cpu_16(resp->tqm_entry_size);
-		ctx->tqm_min_entries_per_ring =
-			rte_le_to_cpu_32(resp->tqm_min_entries_per_ring);
-		ctx->tqm_max_entries_per_ring =
-			rte_le_to_cpu_32(resp->tqm_max_entries_per_ring);
-		ctx->tqm_entries_multiple = resp->tqm_entries_multiple;
-		if (!ctx->tqm_entries_multiple)
-			ctx->tqm_entries_multiple = 1;
-		ctx->mrav_max_entries =
-			rte_le_to_cpu_32(resp->mrav_max_entries);
-		ctx->mrav_entry_size = rte_le_to_cpu_16(resp->mrav_entry_size);
-		ctx->tim_entry_size = rte_le_to_cpu_16(resp->tim_entry_size);
-		ctx->tim_max_entries = rte_le_to_cpu_32(resp->tim_max_entries);
-	} else {
-		rc = 0;
+	ctx_pg = rte_malloc("bnxt_ctx_pg_mem",
+			    sizeof(*ctx_pg) * BNXT_MAX_Q,
+			    RTE_CACHE_LINE_SIZE);
+	if (!ctx_pg) {
+		rc = -ENOMEM;
+		goto ctx_err;
 	}
+	for (i = 0; i < BNXT_MAX_Q; i++, ctx_pg++)
+		ctx->tqm_mem[i] = ctx_pg;
+
+	bp->ctx = ctx;
+	ctx->qp_max_entries = rte_le_to_cpu_32(resp->qp_max_entries);
+	ctx->qp_min_qp1_entries =
+		rte_le_to_cpu_16(resp->qp_min_qp1_entries);
+	ctx->qp_max_l2_entries =
+		rte_le_to_cpu_16(resp->qp_max_l2_entries);
+	ctx->qp_entry_size = rte_le_to_cpu_16(resp->qp_entry_size);
+	ctx->srq_max_l2_entries =
+		rte_le_to_cpu_16(resp->srq_max_l2_entries);
+	ctx->srq_max_entries = rte_le_to_cpu_32(resp->srq_max_entries);
+	ctx->srq_entry_size = rte_le_to_cpu_16(resp->srq_entry_size);
+	ctx->cq_max_l2_entries =
+		rte_le_to_cpu_16(resp->cq_max_l2_entries);
+	ctx->cq_max_entries = rte_le_to_cpu_32(resp->cq_max_entries);
+	ctx->cq_entry_size = rte_le_to_cpu_16(resp->cq_entry_size);
+	ctx->vnic_max_vnic_entries =
+		rte_le_to_cpu_16(resp->vnic_max_vnic_entries);
+	ctx->vnic_max_ring_table_entries =
+		rte_le_to_cpu_16(resp->vnic_max_ring_table_entries);
+	ctx->vnic_entry_size = rte_le_to_cpu_16(resp->vnic_entry_size);
+	ctx->stat_max_entries =
+		rte_le_to_cpu_32(resp->stat_max_entries);
+	ctx->stat_entry_size = rte_le_to_cpu_16(resp->stat_entry_size);
+	ctx->tqm_entry_size = rte_le_to_cpu_16(resp->tqm_entry_size);
+	ctx->tqm_min_entries_per_ring =
+		rte_le_to_cpu_32(resp->tqm_min_entries_per_ring);
+	ctx->tqm_max_entries_per_ring =
+		rte_le_to_cpu_32(resp->tqm_max_entries_per_ring);
+	ctx->tqm_entries_multiple = resp->tqm_entries_multiple;
+	if (!ctx->tqm_entries_multiple)
+		ctx->tqm_entries_multiple = 1;
+	ctx->mrav_max_entries =
+		rte_le_to_cpu_32(resp->mrav_max_entries);
+	ctx->mrav_entry_size = rte_le_to_cpu_16(resp->mrav_entry_size);
+	ctx->tim_entry_size = rte_le_to_cpu_16(resp->tim_entry_size);
+	ctx->tim_max_entries = rte_le_to_cpu_32(resp->tim_max_entries);
 ctx_err:
 	HWRM_UNLOCK();
 	return rc;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 10/16] net/bnxt: remove unused macro
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (8 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 09/16] net/bnxt: remove unnecessary return check Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 11/16] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
                     ` (6 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

remove MAX_NUM_MAC_ADDR macro

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 68ac30bb58..089f86fec7 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -488,7 +488,6 @@ struct bnxt {
 
 	struct bnxt_irq         *irq_tbl;
 
-#define MAX_NUM_MAC_ADDR	32
 	uint8_t			mac_addr[RTE_ETHER_ADDR_LEN];
 
 	uint16_t			hwrm_cmd_seq;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 11/16] net/bnxt: remove unnecessary interrupt disable
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (9 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 10/16] net/bnxt: remove unused macro Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 12/16] net/bnxt: fix accessing variable before null check Ajit Khaparde
                     ` (5 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Lance Richardson

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Since bnxt_enable_int() is called at start time, invoke bnxt_disable_int()
during stop only. Remove it from device uninit function.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 4d15ba5ceb..74ded7717a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4576,7 +4576,6 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 {
 	int rc;
 
-	bnxt_disable_int(bp);
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp, reconfig_dev);
 	bnxt_hwrm_func_buf_unrgtr(bp);
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 12/16] net/bnxt: fix accessing variable before null check
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (10 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 11/16] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop Ajit Khaparde
                     ` (4 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Santoshkumar Karanappa Rastapur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Check input argument "rxq" in bnxt_rx_queue_release_mbufs(), to be sure
variable is not NULL before accessing it.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 53 +++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 4b506f8653..dac8ccb167 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -207,39 +207,40 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 	struct bnxt_tpa_info *tpa_info;
 	uint16_t i;
 
+	if (!rxq)
+		return;
+
 	rte_spinlock_lock(&rxq->lock);
 
-	if (rxq) {
-		sw_ring = rxq->rx_ring->rx_buf_ring;
-		if (sw_ring) {
-			for (i = 0;
-			     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
-				if (sw_ring[i].mbuf) {
-					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
-					sw_ring[i].mbuf = NULL;
-				}
+	sw_ring = rxq->rx_ring->rx_buf_ring;
+	if (sw_ring) {
+		for (i = 0;
+		     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
+			if (sw_ring[i].mbuf) {
+				rte_pktmbuf_free_seg(sw_ring[i].mbuf);
+				sw_ring[i].mbuf = NULL;
 			}
 		}
-		/* Free up mbufs in Agg ring */
-		sw_ring = rxq->rx_ring->ag_buf_ring;
-		if (sw_ring) {
-			for (i = 0;
-			     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
-				if (sw_ring[i].mbuf) {
-					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
-					sw_ring[i].mbuf = NULL;
-				}
+	}
+	/* Free up mbufs in Agg ring */
+	sw_ring = rxq->rx_ring->ag_buf_ring;
+	if (sw_ring) {
+		for (i = 0;
+		     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
+			if (sw_ring[i].mbuf) {
+				rte_pktmbuf_free_seg(sw_ring[i].mbuf);
+				sw_ring[i].mbuf = NULL;
 			}
 		}
+	}
 
-		/* Free up mbufs in TPA */
-		tpa_info = rxq->rx_ring->tpa_info;
-		if (tpa_info) {
-			for (i = 0; i < BNXT_TPA_MAX; i++) {
-				if (tpa_info[i].mbuf) {
-					rte_pktmbuf_free_seg(tpa_info[i].mbuf);
-					tpa_info[i].mbuf = NULL;
-				}
+	/* Free up mbufs in TPA */
+	tpa_info = rxq->rx_ring->tpa_info;
+	if (tpa_info) {
+		for (i = 0; i < BNXT_TPA_MAX; i++) {
+			if (tpa_info[i].mbuf) {
+				rte_pktmbuf_free_seg(tpa_info[i].mbuf);
+				tpa_info[i].mbuf = NULL;
 			}
 		}
 	}
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (11 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 12/16] net/bnxt: fix accessing variable before null check Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process Ajit Khaparde
                     ` (3 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Rahul Gupta, stable, Somnath Kotur

From: Rahul Gupta <rahul.gupta@broadcom.com>

Fix Computing of number of used descriptors in an Rx queue.

Fixes: 1b7ceba3e375 ("net/bnxt: support Rx queue count")
Cc: stable@dpdk.org
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 74ded7717a..0159be3462 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2096,9 +2096,6 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	struct bnxt_cp_ring_info *cpr;
 	struct bnxt_rx_queue *rxq;
 	struct rx_pkt_cmpl *rxcmp;
-	uint16_t cmp_type;
-	uint8_t cmp = 1;
-	bool valid;
 	int rc;
 
 	rc = is_bnxt_in_error(bp);
@@ -2107,33 +2104,19 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 	rxq = dev->data->rx_queues[rx_queue_id];
 	cpr = rxq->cp_ring;
-	valid = cpr->valid;
+	raw_cons = cpr->cp_raw_cons;
 
-	while (raw_cons < rxq->nb_rx_desc) {
+	while (1) {
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
+		rte_prefetch0(&cpr->cp_desc_ring[cons]);
 		rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
-		if (!CMPL_VALID(rxcmp, valid))
-			goto nothing_to_do;
-		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;
-			desc++;
-		} else if (cmp_type == 0x11) {
-			desc++;
-			cmp = (rxcmp->agg_bufs_v1 &
-				   RX_PKT_CMPL_AGG_BUFS_MASK) >>
-				RX_PKT_CMPL_AGG_BUFS_SFT;
+		if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) {
+			break;
 		} else {
-			cmp = 1;
+			raw_cons++;
+			desc++;
 		}
-nothing_to_do:
-		raw_cons += cmp ? cmp : 2;
 	}
 
 	return desc;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (12 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 15/16] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
                     ` (2 subsequent siblings)
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Stephen Hemminger, stable

From: Stephen Hemminger <stephen@networkplumber.org>

The secondary process should not modify device state when
init is called. The pci device information pointed to by
dev_private pointer is not correct in secondary process.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0159be3462..5985963bf7 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -521,6 +521,7 @@ static int bnxt_init_nic(struct bnxt *bp)
 static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				struct rte_eth_dev_info *dev_info)
 {
+	struct rte_pci_device *pdev = RTE_DEV_TO_PCI(eth_dev->device);
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint16_t max_vnics, i, j, vpool, vrxq;
 	unsigned int max_rx_rings;
@@ -536,7 +537,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 
 	/* PF/VF specifics */
 	if (BNXT_PF(bp))
-		dev_info->max_vfs = bp->pdev->max_vfs;
+		dev_info->max_vfs = pdev->max_vfs;
+
 	max_rx_rings = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
@@ -4488,12 +4490,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (version_printed++ == 0)
 		PMD_DRV_LOG(INFO, "%s\n", bnxt_version);
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
-	bp = eth_dev->data->dev_private;
-
-	bp->dev_stopped = 1;
-
 	eth_dev->dev_ops = &bnxt_dev_ops;
 	eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
 	eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
@@ -4505,6 +4501,12 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
+	bp = eth_dev->data->dev_private;
+
+	bp->dev_stopped = 1;
+
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
 		bp->flags |= BNXT_FLAG_VF;
 
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 15/16] net/bnxt: support for QinQ insertion and stripping
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (13 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 16/16] net/bnxt: use macro for getting default vnic Ajit Khaparde
  2019-10-02 18:35   ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ferruh Yigit
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Somnath Kotur

From: Somnath Kotur <somnath.kotur@broadcom.com>

Driver will accelerate only outer/S-VLAN insertion by turning on
the appropriate bits in the Tx Buffer Descriptor when the packet
arrives for transmission.
The TPID to be used for this S-VLAN is conveyed by the vlan_tpid_set
dev_op which will terminate in the driver.
In the Rx path, driver will continue providing the stripped vlan tag
in the mbuf's vlan tci field. This would be the outermost vlan tag
in a double-tagged packet or the vlan tag for a single vlan tagged pkt.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  4 ++
 drivers/net/bnxt/bnxt_ethdev.c | 71 ++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_txr.c    | 13 ++++++-
 3 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 089f86fec7..f8a550ba54 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -521,6 +521,10 @@ struct bnxt {
 	uint16_t		max_stat_ctx;
 	uint16_t		first_vf_id;
 	uint16_t		vlan;
+#define BNXT_OUTER_TPID_MASK	0x0000ffff
+#define BNXT_OUTER_TPID_BD_MASK	0xffff0000
+#define BNXT_OUTER_TPID_BD_SHFT	16
+	uint32_t		outer_tpid_bd;
 	struct bnxt_pf_info	pf;
 	uint8_t			port_partition_type;
 	uint8_t			dev_stopped;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5985963bf7..b3a37e1554 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -151,6 +151,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
 				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
 				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_QINQ_INSERT | \
 				     DEV_TX_OFFLOAD_MULTI_SEGS)
 
 #define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
@@ -161,6 +162,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
 				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
 				     DEV_RX_OFFLOAD_KEEP_CRC | \
+				     DEV_RX_OFFLOAD_VLAN_EXTEND | \
 				     DEV_RX_OFFLOAD_TCP_LRO)
 
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
@@ -1831,15 +1833,77 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 			!!(rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP));
 	}
 
-	if (mask & ETH_VLAN_EXTEND_MASK)
-		PMD_DRV_LOG(ERR, "Extend VLAN Not supported\n");
+	if (mask & ETH_VLAN_EXTEND_MASK) {
+		if (rx_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
+			PMD_DRV_LOG(DEBUG, "Extend VLAN supported\n");
+		else
+			PMD_DRV_LOG(INFO, "Extend VLAN unsupported\n");
+	}
+
+	return 0;
+}
+
+static int
+bnxt_vlan_tpid_set_op(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type,
+		      uint16_t tpid)
+{
+	struct bnxt *bp = dev->data->dev_private;
+	int qinq = dev->data->dev_conf.rxmode.offloads &
+		   DEV_RX_OFFLOAD_VLAN_EXTEND;
+
+	if (vlan_type != ETH_VLAN_TYPE_INNER &&
+	    vlan_type != ETH_VLAN_TYPE_OUTER) {
+		PMD_DRV_LOG(ERR,
+			    "Unsupported vlan type.");
+		return -EINVAL;
+	}
+	if (!qinq) {
+		PMD_DRV_LOG(ERR,
+			    "QinQ not enabled. Needs to be ON as we can "
+			    "accelerate only outer vlan\n");
+		return -EINVAL;
+	}
+
+	if (vlan_type == ETH_VLAN_TYPE_OUTER) {
+		switch (tpid) {
+		case RTE_ETHER_TYPE_QINQ:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8;
+				break;
+		case RTE_ETHER_TYPE_VLAN:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
+				break;
+		case 0x9100:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100;
+				break;
+		case 0x9200:
+			bp->outer_tpid_bd =
+				TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200;
+				break;
+		case 0x9300:
+			bp->outer_tpid_bd =
+				 TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300;
+				break;
+		default:
+			PMD_DRV_LOG(ERR, "Invalid TPID: %x\n", tpid);
+			return -EINVAL;
+		}
+		bp->outer_tpid_bd |= tpid;
+		PMD_DRV_LOG(INFO, "outer_tpid_bd = %x\n", bp->outer_tpid_bd);
+	} else if (vlan_type == ETH_VLAN_TYPE_INNER) {
+		PMD_DRV_LOG(ERR,
+			    "Can accelerate only outer vlan in QinQ\n");
+		return -EINVAL;
+	}
 
 	return 0;
 }
 
 static int
 bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
-			struct rte_ether_addr *addr)
+			     struct rte_ether_addr *addr)
 {
 	struct bnxt *bp = dev->data->dev_private;
 	/* Default Filter is tied to VNIC 0 */
@@ -3534,6 +3598,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.udp_tunnel_port_del  = bnxt_udp_tunnel_port_del_op,
 	.vlan_filter_set = bnxt_vlan_filter_set_op,
 	.vlan_offload_set = bnxt_vlan_offload_set_op,
+	.vlan_tpid_set = bnxt_vlan_tpid_set_op,
 	.vlan_pvid_set = bnxt_vlan_pvid_set_op,
 	.mtu_set = bnxt_mtu_set_op,
 	.mac_addr_set = bnxt_set_default_mac_addr_op,
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 99d2009055..0ed6581bed 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -134,6 +134,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				struct tx_bd_long **last_txbd)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	uint32_t outer_tpid_bd = 0;
 	struct tx_bd_long *txbd;
 	struct tx_bd_long_hi *txbd1 = NULL;
 	uint32_t vlan_tag_flags, cfa_action;
@@ -155,7 +156,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM |
 				PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM |
 				PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN |
-				PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST))
+				PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST |
+				PKT_TX_QINQ_PKT))
 		long_bd = true;
 
 	nr_bds = long_bd + tx_pkt->nb_segs;
@@ -209,7 +211,14 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
 		vlan_tag_flags = 0;
 		cfa_action = 0;
-		if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
+		/* HW can accelerate only outer vlan in QinQ mode */
+		if (tx_buf->mbuf->ol_flags & PKT_TX_QINQ_PKT) {
+			vlan_tag_flags = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
+				tx_buf->mbuf->vlan_tci_outer;
+			outer_tpid_bd = txq->bp->outer_tpid_bd &
+				BNXT_OUTER_TPID_BD_MASK;
+			vlan_tag_flags |= outer_tpid_bd;
+		} else if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
 			/* shurd: Should this mask at
 			 * TX_BD_LONG_CFA_META_VLAN_VID_MASK?
 			 */
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [dpdk-dev] [PATCH v3 16/16] net/bnxt: use macro for getting default vnic
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (14 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 15/16] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
@ 2019-10-02 17:17   ` Ajit Khaparde
  2019-10-02 18:35   ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ferruh Yigit
  16 siblings, 0 replies; 36+ messages in thread
From: Ajit Khaparde @ 2019-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Minor code cleanup. BNXT_GET_DEFAULT_VNIC macro returns the default VNIC
of the function and fixed code to use the macro.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b3a37e1554..bc9a910ee3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1118,7 +1118,7 @@ static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_PROMISC;
@@ -1143,7 +1143,7 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
@@ -1168,7 +1168,7 @@ static int bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
@@ -1193,7 +1193,7 @@ static int bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 	if (bp->vnic_info == NULL)
 		return 0;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI;
@@ -1960,7 +1960,7 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	vnic = &bp->vnic_info[0];
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
 
 	if (nb_mc_addr > BNXT_MAX_MC_ADDRS) {
 		vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [dpdk-dev] [PATCH v3 00/16] bnxt patchset
  2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
                     ` (15 preceding siblings ...)
  2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 16/16] net/bnxt: use macro for getting default vnic Ajit Khaparde
@ 2019-10-02 18:35   ` Ferruh Yigit
  16 siblings, 0 replies; 36+ messages in thread
From: Ferruh Yigit @ 2019-10-02 18:35 UTC (permalink / raw)
  To: Ajit Khaparde, dev

On 10/2/2019 6:17 PM, Ajit Khaparde wrote:
> bnxt patchset against dpdk-next-net.
> This patchset has been rebased and is dependent on
> "bnxt patchset to support device error recovery"
> commit-id 5f30ec0329bf81d8a4a3404faaf450dbceb9463e
> 
> Please apply.
> 
> v1->v2: 5f30ec0329bf81d8a4a3404faaf450dbceb9463e
> v2->v3: Removed an unnecessary patch from v2. No other change.
> 
> Ajit Khaparde (2):
>   net/bnxt: subscribe to link speed change notification
>   net/bnxt: fix async link handling and update
> 
> Kalesh AP (8):
>   net/bnxt: fix rxq stop/start handling
>   net/bnxt: fix L2 context calculation for Thor
>   net/bnxt: fix use of deferred start of transmit queues
>   net/bnxt: remove unnecessary return check
>   net/bnxt: remove unused macro
>   net/bnxt: remove unnecessary interrupt disable
>   net/bnxt: fix accessing variable before null check
>   net/bnxt: use macro for getting default vnic
> 
> Rahul Gupta (1):
>   net/bnxt: fix Rx queue count devop
> 
> Santoshkumar Karanappa Rastapur (3):
>   net/bnxt: fix incorrect flow steering
>   net/bnxt: fix traffic failure with higher mbuf size
>   net/bnxt: fix 40G link failure for Thor
> 
> Somnath Kotur (1):
>   net/bnxt: support for QinQ insertion and stripping
> 
> Stephen Hemminger (1):
>   net/bnxt: fix a segfault in secondary process

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2019-10-02 18:35 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02  5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix incorrect flow steering Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: subscribe to link speed change notification Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: fix async link handling and update Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix L2 context calculation " Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: remove unnecessary return check Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: remove unused macro Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix Rx queue count devop Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: fix a segfault in secondary process Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
2019-10-02  5:54 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: use macro for getting default vnic Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 01/16] net/bnxt: fix incorrect flow steering Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 02/16] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 04/16] net/bnxt: subscribe to link speed change notification Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 05/16] net/bnxt: fix async link handling and update Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 06/16] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 07/16] net/bnxt: fix L2 context calculation " Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 08/16] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 09/16] net/bnxt: remove unnecessary return check Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 10/16] net/bnxt: remove unused macro Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 11/16] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 12/16] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 15/16] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
2019-10-02 17:17   ` [dpdk-dev] [PATCH v3 16/16] net/bnxt: use macro for getting default vnic Ajit Khaparde
2019-10-02 18:35   ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).