From: Radu Nicolau <radu.nicolau@intel.com>
To: Jingjing Wu <jingjing.wu@intel.com>, Beilei Xing <beilei.xing@intel.com>
Cc: dev@dpdk.org, declan.doherty@intel.com, abhijit.sinha@intel.com,
qi.z.zhang@intel.com, bruce.richardson@intel.com,
konstantin.ananyev@intel.com,
Radu Nicolau <radu.nicolau@intel.com>
Subject: [dpdk-dev] [PATCH v5 6/6] net/iavf: add watchdog for VFLR
Date: Wed, 6 Oct 2021 10:28:40 +0100 [thread overview]
Message-ID: <20211006092840.3749960-7-radu.nicolau@intel.com> (raw)
In-Reply-To: <20211006092840.3749960-1-radu.nicolau@intel.com>
Add watchdog to iAVF PMD which support monitoring the VFLR register. If
the device is not already in reset then if a VF reset in progress is
detected then notfiy user through callback and set into reset state.
If the device is already in reset then poll for completion of reset.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
drivers/net/iavf/iavf.h | 5 ++
drivers/net/iavf/iavf_ethdev.c | 93 ++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+)
diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index d5f574b4b3..cc03985127 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -29,6 +29,8 @@
#define IAVF_NUM_MACADDR_MAX 64
+#define IAVF_DEV_WATCHDOG_PERIOD 5000
+
#define IAVF_DEFAULT_RX_PTHRESH 8
#define IAVF_DEFAULT_RX_HTHRESH 8
#define IAVF_DEFAULT_RX_WTHRESH 0
@@ -212,6 +214,9 @@ struct iavf_info {
int cmd_retval; /* return value of the cmd response from PF */
uint8_t *aq_resp; /* buffer to store the adminq response from PF */
+ /** iAVF watchdog enable */
+ bool watchdog_enabled;
+
/* Event from pf */
bool dev_closed;
bool link_up;
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index aad6a28585..43b64fb6db 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -24,6 +24,7 @@
#include <rte_malloc.h>
#include <rte_memzone.h>
#include <rte_dev.h>
+#include <rte_alarm.h>
#include "iavf.h"
#include "iavf_rxtx.h"
@@ -239,6 +240,90 @@ iavf_tm_ops_get(struct rte_eth_dev *dev __rte_unused,
return 0;
}
+
+static int
+iavf_vfr_inprogress(struct iavf_hw *hw)
+{
+ int inprogress = 0;
+
+ if ((IAVF_READ_REG(hw, IAVF_VFGEN_RSTAT) &
+ IAVF_VFGEN_RSTAT_VFR_STATE_MASK) ==
+ VIRTCHNL_VFR_INPROGRESS)
+ inprogress = 1;
+
+ if (inprogress)
+ PMD_DRV_LOG(INFO, "Watchdog detected VFR in progress");
+
+ return inprogress;
+}
+
+static void
+iavf_dev_watchdog(void *cb_arg)
+{
+ struct iavf_adapter *adapter = cb_arg;
+ struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
+ int vfr_inprogress = 0, rc = 0;
+
+ /* check if watchdog has been disabled since last call */
+ if (!adapter->vf.watchdog_enabled)
+ return;
+
+ /* If in reset then poll vfr_inprogress register for completion */
+ if (adapter->vf.vf_reset) {
+ vfr_inprogress = iavf_vfr_inprogress(hw);
+
+ if (!vfr_inprogress) {
+ PMD_DRV_LOG(INFO, "VF \"%s\" reset has completed",
+ adapter->eth_dev->data->name);
+ adapter->vf.vf_reset = false;
+ }
+ /* If not in reset then poll vfr_inprogress register for VFLR event */
+ } else {
+ vfr_inprogress = iavf_vfr_inprogress(hw);
+
+ if (vfr_inprogress) {
+ PMD_DRV_LOG(INFO,
+ "VF \"%s\" reset event detected by watchdog",
+ adapter->eth_dev->data->name);
+
+ /* enter reset state with VFLR event */
+ adapter->vf.vf_reset = true;
+
+ rte_eth_dev_callback_process(adapter->eth_dev,
+ RTE_ETH_EVENT_INTR_RESET, NULL);
+ }
+ }
+
+ /* re-alarm watchdog */
+ rc = rte_eal_alarm_set(IAVF_DEV_WATCHDOG_PERIOD,
+ &iavf_dev_watchdog, cb_arg);
+
+ if (rc)
+ PMD_DRV_LOG(ERR, "Failed \"%s\" to reset device watchdog alarm",
+ adapter->eth_dev->data->name);
+}
+
+static void
+iavf_dev_watchdog_enable(struct iavf_adapter *adapter __rte_unused)
+{
+#if (IAVF_DEV_WATCHDOG_PERIOD > 0)
+ PMD_DRV_LOG(INFO, "Enabling device watchdog");
+ adapter->vf.watchdog_enabled = true;
+ if (rte_eal_alarm_set(IAVF_DEV_WATCHDOG_PERIOD,
+ &iavf_dev_watchdog, (void *)adapter))
+ PMD_DRV_LOG(ERR, "Failed to enabled device watchdog");
+#endif
+}
+
+static void
+iavf_dev_watchdog_disable(struct iavf_adapter *adapter __rte_unused)
+{
+#if (IAVF_DEV_WATCHDOG_PERIOD > 0)
+ PMD_DRV_LOG(INFO, "Disabling device watchdog");
+ adapter->vf.watchdog_enabled = false;
+#endif
+}
+
static int
iavf_set_mc_addr_list(struct rte_eth_dev *dev,
struct rte_ether_addr *mc_addrs,
@@ -2448,6 +2533,11 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
iavf_default_rss_disable(adapter);
+
+ /* Start device watchdog */
+ iavf_dev_watchdog_enable(adapter);
+
+
return 0;
flow_init_err:
@@ -2527,6 +2617,9 @@ iavf_dev_close(struct rte_eth_dev *dev)
if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true))
vf->vf_reset = false;
+ /* disable watchdog */
+ iavf_dev_watchdog_disable(adapter);
+
return ret;
}
--
2.25.1
next prev parent reply other threads:[~2021-10-06 9:40 UTC|newest]
Thread overview: 128+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 14:24 [dpdk-dev] [PATCH 0/4] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-09-09 14:24 ` [dpdk-dev] [PATCH 1/4] common/iavf: " Radu Nicolau
2021-09-09 14:24 ` [dpdk-dev] [PATCH 2/4] net/iavf: " Radu Nicolau
2021-09-09 14:24 ` [dpdk-dev] [PATCH 3/4] net/iavf: Add xstats support for inline IPsec crypto Radu Nicolau
2021-09-09 14:24 ` [dpdk-dev] [PATCH 4/4] net/iavf: add watchdog for VFLR Radu Nicolau
2021-09-15 13:32 ` [dpdk-dev] [PATCH v2 0/4] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-09-15 13:32 ` [dpdk-dev] [PATCH v2 1/4] common/iavf: " Radu Nicolau
2021-09-15 13:32 ` [dpdk-dev] [PATCH v2 2/4] net/iavf: " Radu Nicolau
2021-09-18 5:28 ` Wu, Jingjing
2021-09-20 13:44 ` Nicolau, Radu
2021-09-15 13:32 ` [dpdk-dev] [PATCH v2 3/4] net/iavf: Add xstats support for inline IPsec crypto Radu Nicolau
2021-09-15 13:32 ` [dpdk-dev] [PATCH v2 4/4] net/iavf: add watchdog for VFLR Radu Nicolau
2021-09-20 13:51 ` [dpdk-dev] [PATCH v3 0/6] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-09-20 13:51 ` [dpdk-dev] [PATCH v3 1/6] common/iavf: " Radu Nicolau
2021-09-20 13:51 ` [dpdk-dev] [PATCH v3 2/6] net/iavf: rework tx path Radu Nicolau
2021-09-20 13:51 ` [dpdk-dev] [PATCH v3 3/6] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-09-20 13:52 ` [dpdk-dev] [PATCH v3 4/6] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-09-20 13:52 ` [dpdk-dev] [PATCH v3 5/6] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-09-20 13:52 ` [dpdk-dev] [PATCH v3 6/6] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 0/6] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 1/6] common/iavf: " Radu Nicolau
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 2/6] net/iavf: rework tx path Radu Nicolau
2021-10-04 1:24 ` Wu, Jingjing
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 3/6] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-04 1:34 ` Wu, Jingjing
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 4/6] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-04 1:50 ` Wu, Jingjing
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 5/6] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-04 2:01 ` Wu, Jingjing
2021-10-01 9:51 ` [dpdk-dev] [PATCH v4 6/6] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-04 2:15 ` Wu, Jingjing
2021-10-04 11:18 ` Nicolau, Radu
2021-10-04 14:21 ` Nicolau, Radu
2021-10-08 6:19 ` Wu, Jingjing
2021-10-08 10:09 ` Nicolau, Radu
2021-10-06 9:28 ` [dpdk-dev] [PATCH v5 0/6] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-06 9:28 ` [dpdk-dev] [PATCH v5 1/6] common/iavf: " Radu Nicolau
2021-10-06 9:28 ` [dpdk-dev] [PATCH v5 2/6] net/iavf: rework tx path Radu Nicolau
2021-10-06 9:28 ` [dpdk-dev] [PATCH v5 3/6] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-06 9:28 ` [dpdk-dev] [PATCH v5 4/6] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-06 9:28 ` [dpdk-dev] [PATCH v5 5/6] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-06 9:28 ` Radu Nicolau [this message]
2021-10-08 10:19 ` [dpdk-dev] [PATCH v6 0/6] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-08 10:19 ` [dpdk-dev] [PATCH v6 1/6] common/iavf: " Radu Nicolau
2021-10-08 10:20 ` [dpdk-dev] [PATCH v6 2/6] net/iavf: rework tx path Radu Nicolau
2021-10-08 10:20 ` [dpdk-dev] [PATCH v6 3/6] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-08 10:20 ` [dpdk-dev] [PATCH v6 4/6] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-08 10:20 ` [dpdk-dev] [PATCH v6 5/6] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-08 10:20 ` [dpdk-dev] [PATCH v6 6/6] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 0/6] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 1/6] common/iavf: " Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 2/6] net/iavf: rework tx path Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 3/6] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 4/6] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 5/6] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-13 15:33 ` [dpdk-dev] [PATCH v7 6/6] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 0/7] iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 1/7] common/iavf: " Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 2/7] net/iavf: rework tx path Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-18 5:34 ` Wu, Jingjing
2021-10-15 10:15 ` [dpdk-dev] [PATCH v8 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 0/7] iavf: add iAVF IPsec " Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 1/7] common/iavf: " Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 2/7] net/iavf: rework tx path Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-18 10:10 ` [dpdk-dev] [PATCH v9 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 0/7] iavf: add iAVF IPsec " Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 1/7] common/iavf: " Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 2/7] net/iavf: rework tx path Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-19 9:23 ` [dpdk-dev] [PATCH v10 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 0/7] iavf: add iAVF IPsec " Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 1/7] common/iavf: " Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 2/7] net/iavf: rework tx path Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-26 10:38 ` [dpdk-dev] [PATCH v11 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-26 12:30 ` [dpdk-dev] [PATCH v11 0/7] iavf: add iAVF IPsec " Zhang, Qi Z
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 " Radu Nicolau
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 1/7] common/iavf: " Radu Nicolau
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 2/7] net/iavf: rework tx path Radu Nicolau
2021-10-27 0:43 ` Zhang, Qi Z
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-27 0:36 ` Zhang, Qi Z
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-26 13:56 ` [dpdk-dev] [PATCH v12 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-27 0:36 ` [dpdk-dev] [PATCH v12 0/7] iavf: add iAVF IPsec " Zhang, Qi Z
2021-10-28 14:47 ` Ferruh Yigit
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 " Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 1/7] common/iavf: " Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 2/7] net/iavf: rework tx path Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-10-28 15:52 ` [dpdk-dev] [PATCH v13 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 0/7] iavf: add iAVF IPsec " Radu Nicolau
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 1/7] common/iavf: " Radu Nicolau
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 2/7] net/iavf: rework Tx path Radu Nicolau
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 3/7] net/iavf: add support for asynchronous virt channel messages Radu Nicolau
2021-10-29 20:33 ` Ferruh Yigit
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 4/7] net/iavf: add iAVF IPsec inline crypto support Radu Nicolau
2021-10-29 17:33 ` Ferruh Yigit
2021-10-30 20:41 ` David Marchand
2021-11-01 10:45 ` Ferruh Yigit
2021-11-01 11:36 ` Ferruh Yigit
2021-11-01 11:41 ` Ferruh Yigit
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 5/7] net/iavf: add xstats support for inline IPsec crypto Radu Nicolau
2021-10-29 19:32 ` Ferruh Yigit
2021-10-28 16:04 ` [dpdk-dev] [PATCH v13 6/7] net/iavf: add watchdog for VFLR Radu Nicolau
2021-11-05 11:54 ` Ferruh Yigit
2021-10-28 16:05 ` [dpdk-dev] [PATCH v13 7/7] net/iavf: update doc with inline crypto support Radu Nicolau
2021-10-29 13:27 ` Ferruh Yigit
2021-10-29 2:21 ` [dpdk-dev] [PATCH v13 0/7] iavf: add iAVF IPsec " Zhang, Qi Z
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=20211006092840.3749960-7-radu.nicolau@intel.com \
--to=radu.nicolau@intel.com \
--cc=abhijit.sinha@intel.com \
--cc=beilei.xing@intel.com \
--cc=bruce.richardson@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=qi.z.zhang@intel.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).