DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, stable@dpdk.org,
	Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>,
	Lance Richardson <lance.richardson@broadcom.com>
Subject: [dpdk-dev] [PATCH v3 05/16] net/bnxt: fix async link handling and update
Date: Wed,  2 Oct 2019 10:17:34 -0700	[thread overview]
Message-ID: <20191002171745.4504-6-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20191002171745.4504-1-ajit.khaparde@broadcom.com>

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)


  parent reply	other threads:[~2019-10-02 17:19 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Ajit Khaparde [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002171745.4504-6-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=lance.richardson@broadcom.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).