DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: Marcin Wojtas <mw@semihalf.com>,
	Michal Krawczyk <mk@semihalf.com>,
	Guy Tzalik <gtzalik@amazon.com>,
	Evgeny Schemeilin <evgenys@amazon.com>
Cc: dev@dpdk.org, matua@amazon.com
Subject: [dpdk-dev] [PATCH v2 11/26] net/ena: add checking for admin queue state
Date: Mon,  4 Jun 2018 14:09:39 +0200	[thread overview]
Message-ID: <20180604120955.17319-2-mk@semihalf.com> (raw)
In-Reply-To: <20180604120955.17319-1-mk@semihalf.com>

The admin queue can stop responding or became inactive due to unexpected
behaviour of the device. In that case, the whole device should be
restarted.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 37 +++++++++++++++++++++++++++++--------
 drivers/net/ena/ena_ethdev.h |  2 ++
 2 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 98f1b6c0a..d8447215a 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -527,6 +527,8 @@ ena_dev_reset(struct rte_eth_dev *dev)
 	for (i = 0; i < nb_queues; ++i)
 		ena_tx_queue_setup(eth_dev, i, adapter->tx_ring_size, 0, NULL);
 
+	adapter->trigger_reset = false;
+
 	return 0;
 }
 
@@ -1400,21 +1402,40 @@ static void ena_interrupt_handler_rte(void *cb_arg)
 		ena_com_aenq_intr_handler(ena_dev, adapter);
 }
 
+static void check_for_missing_keep_alive(struct ena_adapter *adapter)
+{
+	if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT)
+		return;
+
+	if (unlikely((rte_get_timer_cycles() - adapter->timestamp_wd) >=
+	    adapter->keep_alive_timeout)) {
+		RTE_LOG(ERR, PMD, "Keep alive timeout\n");
+		adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO;
+		adapter->trigger_reset = true;
+	}
+}
+
+/* Check if admin queue is enabled */
+static void check_for_admin_com_state(struct ena_adapter *adapter)
+{
+	if (unlikely(!ena_com_get_admin_running_state(&adapter->ena_dev))) {
+		RTE_LOG(ERR, PMD, "ENA admin queue is not in running state!\n");
+		adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO;
+		adapter->trigger_reset = true;
+	}
+}
+
 static void ena_timer_wd_callback(__rte_unused struct rte_timer *timer,
 				  void *arg)
 {
 	struct ena_adapter *adapter = (struct ena_adapter *)arg;
 	struct rte_eth_dev *dev = adapter->rte_dev;
 
-	if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT)
-		return;
+	check_for_missing_keep_alive(adapter);
+	check_for_admin_com_state(adapter);
 
-	/* Within reasonable timing range no memory barriers are needed */
-	if ((rte_get_timer_cycles() - adapter->timestamp_wd) >=
-	    adapter->keep_alive_timeout) {
-		RTE_LOG(ERR, PMD, "The ENA device is not responding - "
-			"performing device reset...");
-		adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO;
+	if (unlikely(adapter->trigger_reset)) {
+		RTE_LOG(ERR, PMD, "Trigger reset is on\n");
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
 			NULL);
 	}
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index b44cca23e..1f6a7062f 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -194,6 +194,8 @@ struct ena_adapter {
 	struct rte_timer timer_wd;
 	uint64_t timestamp_wd;
 	uint64_t keep_alive_timeout;
+
+	bool trigger_reset;
 };
 
 #endif /* _ENA_ETHDEV_H_ */
-- 
2.14.1

  reply	other threads:[~2018-06-04 12:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 12:09 [dpdk-dev] [PATCH v2 10/26] net/ena: add watchdog and keep alive AENQ handler Michal Krawczyk
2018-06-04 12:09 ` Michal Krawczyk [this message]
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 12/26] net/ena: make watchdog configurable Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 13/26] net/ena: add RX out of order completion Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 14/26] net/ena: linearize Tx mbuf Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 15/26] net/ena: add info about max number of Tx/Rx descriptors Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 16/26] net/ena: unimplemented handler error Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 17/26] net/ena: rework configuration of IO queue numbers Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 18/26] net/ena: validate Tx req id Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 19/26] net/ena: add (un)likely statements Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 20/26] net/ena: adjust error checking and cleaning Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 21/26] net/ena: update numa node Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 22/26] net/ena: check pointer before memset Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 23/26] net/ena: change memory type Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 24/26] net/ena: fix GENMASK_ULL macro Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 25/26] net/ena: store handle after memory allocation Michal Krawczyk
2018-06-04 12:09 ` [dpdk-dev] [PATCH v2 26/26] net/ena: set link speed as none Michal Krawczyk

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=20180604120955.17319-2-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=gtzalik@amazon.com \
    --cc=matua@amazon.com \
    --cc=mw@semihalf.com \
    /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).