DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rmody@marvell.com>
To: <dev@dpdk.org>
Cc: Shahed Shaikh <shshaikh@marvell.com>, <ferruh.yigit@intel.com>,
	<GR-Everest-DPDK-Dev@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 4/6] net/bnx2x: fix DMAE timeout
Date: Thu, 11 Apr 2019 18:47:40 -0700	[thread overview]
Message-ID: <1555033662-22935-4-git-send-email-rmody@marvell.com> (raw)
Message-ID: <20190412014740.HqxPghSqZAJSYk8-Gyah-z-souNNTGKvWenjIna7ToM@z> (raw)
In-Reply-To: <1555033662-22935-1-git-send-email-rmody@marvell.com>

From: Shahed Shaikh <shshaikh@marvell.com>

In some cases, DPKD application may send packets
while PMD is going through load or unload flow.
This causes firmware to access invalid/unallocated
memory to process transmit buffer. Which results in
error on PCI bus and chip further blocks access to host,
causing a DMAE timeout.

Fix this issue by installing dummy empty transmit and receive
handlers at the beginning of unload path (rte_eth_dev_stop())
and install actual transmit and receive handlers after successful
load of the PMD port (rte_eth_dev_start()). This way, application
won't be able to send packets while device is going through
load/unload flow.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org

Signed-off-by: Shahed Shaikh <shshaikh@marvell.com>
---
 drivers/net/bnx2x/bnx2x_ethdev.c |    9 ++++-----
 drivers/net/bnx2x/bnx2x_rxtx.c   |   21 ++++++++++++++++-----
 drivers/net/bnx2x/bnx2x_rxtx.h   |    3 ++-
 3 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index bcb899a..f85766c 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -213,6 +213,7 @@ void bnx2x_periodic_stop(void *param)
 		return -ENXIO;
 	}
 
+	bnx2x_dev_rxtx_init_dummy(dev);
 	return 0;
 }
 
@@ -242,11 +243,7 @@ void bnx2x_periodic_stop(void *param)
 			PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed");
 	}
 
-	ret = bnx2x_dev_rx_init(dev);
-	if (ret != 0) {
-		PMD_DRV_LOG(DEBUG, sc, "bnx2x_dev_rx_init returned error code");
-		return -3;
-	}
+	bnx2x_dev_rxtx_init(dev);
 
 	bnx2x_print_device_info(sc);
 
@@ -261,6 +258,8 @@ void bnx2x_periodic_stop(void *param)
 
 	PMD_INIT_FUNC_TRACE(sc);
 
+	bnx2x_dev_rxtx_init_dummy(dev);
+
 	if (IS_PF(sc)) {
 		rte_intr_disable(&sc->pci_dev->intr_handle);
 		rte_intr_callback_unregister(&sc->pci_dev->intr_handle,
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index ca28aac..e5a2b25 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -311,7 +311,6 @@
 	txq->tx_bd_tail = 0;
 	txq->tx_bd_head = 0;
 	txq->nb_tx_avail = txq->nb_tx_desc;
-	dev->tx_pkt_burst = bnx2x_xmit_pkts;
 	dev->data->tx_queues[queue_idx] = txq;
 	if (!sc->tx_queues) sc->tx_queues = dev->data->tx_queues;
 
@@ -441,14 +440,26 @@
 	return nb_rx;
 }
 
-int
-bnx2x_dev_rx_init(struct rte_eth_dev *dev)
+static uint16_t
+bnx2x_rxtx_pkts_dummy(__rte_unused void *p_rxq,
+		      __rte_unused struct rte_mbuf **rx_pkts,
+		      __rte_unused uint16_t nb_pkts)
 {
-	dev->rx_pkt_burst = bnx2x_recv_pkts;
-
 	return 0;
 }
 
+void bnx2x_dev_rxtx_init_dummy(struct rte_eth_dev *dev)
+{
+	dev->rx_pkt_burst = bnx2x_rxtx_pkts_dummy;
+	dev->tx_pkt_burst = bnx2x_rxtx_pkts_dummy;
+}
+
+void bnx2x_dev_rxtx_init(struct rte_eth_dev *dev)
+{
+	dev->rx_pkt_burst = bnx2x_recv_pkts;
+	dev->tx_pkt_burst = bnx2x_xmit_pkts;
+}
+
 void
 bnx2x_dev_clear_queues(struct rte_eth_dev *dev)
 {
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.h b/drivers/net/bnx2x/bnx2x_rxtx.h
index 6ad4928..3f4692b 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.h
+++ b/drivers/net/bnx2x/bnx2x_rxtx.h
@@ -74,7 +74,8 @@ int bnx2x_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 
 void bnx2x_dev_rx_queue_release(void *rxq);
 void bnx2x_dev_tx_queue_release(void *txq);
-int bnx2x_dev_rx_init(struct rte_eth_dev *dev);
+void bnx2x_dev_rxtx_init(struct rte_eth_dev *dev);
+void bnx2x_dev_rxtx_init_dummy(struct rte_eth_dev *dev);
 void bnx2x_dev_clear_queues(struct rte_eth_dev *dev);
 
 #endif /* _BNX2X_RXTX_H_ */
-- 
1.7.10.3


  parent reply	other threads:[~2019-04-12  1:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12  1:47 [dpdk-dev] [PATCH 1/6] net/bnx2x: fix eth dev MTU Rasesh Mody
2019-04-12  1:47 ` Rasesh Mody
2019-04-12  1:47 ` [dpdk-dev] [PATCH 2/6] net/bnx2x: fix memory leak Rasesh Mody
2019-04-12  1:47   ` Rasesh Mody
2019-04-12  1:47 ` [dpdk-dev] [PATCH 3/6] net/bnx2x: fix ramrod timeout Rasesh Mody
2019-04-12  1:47   ` Rasesh Mody
2019-04-12  1:47 ` Rasesh Mody [this message]
2019-04-12  1:47   ` [dpdk-dev] [PATCH 4/6] net/bnx2x: fix DMAE timeout Rasesh Mody
2019-04-12  1:47 ` [dpdk-dev] [PATCH 5/6] net/bnx2x: fix race for periodic flags Rasesh Mody
2019-04-12  1:47   ` Rasesh Mody
2019-04-12  1:47 ` [dpdk-dev] [PATCH 6/6] net/bnx2x: fix optic module verification Rasesh Mody
2019-04-12  1:47   ` Rasesh Mody
2019-04-15  8:01 ` [dpdk-dev] [PATCH 1/6] net/bnx2x: fix eth dev MTU Ferruh Yigit
2019-04-15  8:01   ` 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=1555033662-22935-4-git-send-email-rmody@marvell.com \
    --to=rmody@marvell.com \
    --cc=GR-Everest-DPDK-Dev@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=shshaikh@marvell.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).