DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: dev@dpdk.org
Cc: Rasesh Mody <rasesh.mody@cavium.com>,
	ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com
Subject: [dpdk-dev] [PATCH 08/14] net/qede/base: add MFW support for driver load timeout
Date: Sat, 31 Mar 2018 22:46:58 -0700	[thread overview]
Message-ID: <1522561624-15817-9-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1522561624-15817-1-git-send-email-rasesh.mody@cavium.com>

Add SPQ timeout base driver parameter support management FW timeout values
other than default and none. Have fallback mechanism for old MFWs.
Reduce the defult timeout to 1 sec.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/base/ecore_dev.c     |   66 +++++++++++++++++++++++++++------
 drivers/net/qede/base/ecore_dev_api.h |   14 +++++++
 drivers/net/qede/base/ecore_spq.c     |   16 +++++++-
 drivers/net/qede/base/ecore_spq.h     |   13 +++++++
 drivers/net/qede/base/mcp_public.h    |    2 +
 5 files changed, 97 insertions(+), 14 deletions(-)

diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c
index a3269f4..1b01bba 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -2289,14 +2289,15 @@ static void ecore_reset_mb_shadow(struct ecore_hwfn *p_hwfn,
 }
 
 static void ecore_pglueb_clear_err(struct ecore_hwfn *p_hwfn,
-				     struct ecore_ptt *p_ptt)
+				   struct ecore_ptt *p_ptt)
 {
 	ecore_wr(p_hwfn, p_ptt, PGLUE_B_REG_WAS_ERROR_PF_31_0_CLR,
 		 1 << p_hwfn->abs_pf_id);
 }
 
-static void
-ecore_fill_load_req_params(struct ecore_load_req_params *p_load_req,
+static enum _ecore_status_t
+ecore_fill_load_req_params(struct ecore_hwfn *p_hwfn,
+			   struct ecore_load_req_params *p_load_req,
 			   struct ecore_drv_load_params *p_drv_load)
 {
 	/* Make sure that if ecore-client didn't provide inputs, all the
@@ -2308,15 +2309,51 @@ static void ecore_pglueb_clear_err(struct ecore_hwfn *p_hwfn,
 
 	OSAL_MEM_ZERO(p_load_req, sizeof(*p_load_req));
 
-	if (p_drv_load != OSAL_NULL) {
-		p_load_req->drv_role = p_drv_load->is_crash_kernel ?
-				       ECORE_DRV_ROLE_KDUMP :
-				       ECORE_DRV_ROLE_OS;
+	if (p_drv_load == OSAL_NULL)
+		goto out;
+
+	p_load_req->drv_role = p_drv_load->is_crash_kernel ?
+			       ECORE_DRV_ROLE_KDUMP :
+			       ECORE_DRV_ROLE_OS;
+	p_load_req->avoid_eng_reset = p_drv_load->avoid_eng_reset;
+	p_load_req->override_force_load = p_drv_load->override_force_load;
+
+	/* Old MFW versions don't support timeout values other than default and
+	 * none, so these values are replaced according to the fall-back action.
+	 */
+
+	if (p_drv_load->mfw_timeout_val == ECORE_LOAD_REQ_LOCK_TO_DEFAULT ||
+	    p_drv_load->mfw_timeout_val == ECORE_LOAD_REQ_LOCK_TO_NONE ||
+	    (p_hwfn->mcp_info->capabilities &
+	     FW_MB_PARAM_FEATURE_SUPPORT_DRV_LOAD_TO)) {
 		p_load_req->timeout_val = p_drv_load->mfw_timeout_val;
-		p_load_req->avoid_eng_reset = p_drv_load->avoid_eng_reset;
-		p_load_req->override_force_load =
-			p_drv_load->override_force_load;
+		goto out;
 	}
+
+	switch (p_drv_load->mfw_timeout_fallback) {
+	case ECORE_TO_FALLBACK_TO_NONE:
+		p_load_req->timeout_val = ECORE_LOAD_REQ_LOCK_TO_NONE;
+		break;
+	case ECORE_TO_FALLBACK_TO_DEFAULT:
+		p_load_req->timeout_val = ECORE_LOAD_REQ_LOCK_TO_DEFAULT;
+		break;
+	case ECORE_TO_FALLBACK_FAIL_LOAD:
+		DP_NOTICE(p_hwfn, false,
+			  "Received %d as a value for MFW timeout while the MFW supports only default [%d] or none [%d]. Abort.\n",
+			  p_drv_load->mfw_timeout_val,
+			  ECORE_LOAD_REQ_LOCK_TO_DEFAULT,
+			  ECORE_LOAD_REQ_LOCK_TO_NONE);
+		return ECORE_ABORTED;
+	}
+
+	DP_INFO(p_hwfn,
+		"Modified the MFW timeout value from %d to %s [%d] due to lack of MFW support\n",
+		p_drv_load->mfw_timeout_val,
+		(p_load_req->timeout_val == ECORE_LOAD_REQ_LOCK_TO_DEFAULT) ?
+		"default" : "none",
+		p_load_req->timeout_val);
+out:
+	return ECORE_SUCCESS;
 }
 
 enum _ecore_status_t ecore_vf_start(struct ecore_hwfn *p_hwfn,
@@ -2372,8 +2409,13 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
 		if (rc != ECORE_SUCCESS)
 			return rc;
 
-		ecore_fill_load_req_params(&load_req_params,
-					   p_params->p_drv_load_params);
+		ecore_set_spq_block_timeout(p_hwfn, p_params->spq_timeout_ms);
+
+		rc = ecore_fill_load_req_params(p_hwfn, &load_req_params,
+						p_params->p_drv_load_params);
+		if (rc != ECORE_SUCCESS)
+			return rc;
+
 		rc = ecore_mcp_load_req(p_hwfn, p_hwfn->p_main_ptt,
 					&load_req_params);
 		if (rc != ECORE_SUCCESS) {
diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h
index 98bcabe..1d3fc56 100644
--- a/drivers/net/qede/base/ecore_dev_api.h
+++ b/drivers/net/qede/base/ecore_dev_api.h
@@ -57,6 +57,12 @@ void ecore_init_dp(struct ecore_dev *p_dev,
  */
 void ecore_resc_setup(struct ecore_dev *p_dev);
 
+enum ecore_mfw_timeout_fallback {
+	ECORE_TO_FALLBACK_TO_NONE,
+	ECORE_TO_FALLBACK_TO_DEFAULT,
+	ECORE_TO_FALLBACK_FAIL_LOAD,
+};
+
 enum ecore_override_force_load {
 	ECORE_OVERRIDE_FORCE_LOAD_NONE,
 	ECORE_OVERRIDE_FORCE_LOAD_ALWAYS,
@@ -79,6 +85,11 @@ struct ecore_drv_load_params {
 #define ECORE_LOAD_REQ_LOCK_TO_DEFAULT	0
 #define ECORE_LOAD_REQ_LOCK_TO_NONE	255
 
+	/* Action to take in case the MFW doesn't support timeout values other
+	 * than default and none.
+	 */
+	enum ecore_mfw_timeout_fallback mfw_timeout_fallback;
+
 	/* Avoid engine reset when first PF loads on it */
 	bool avoid_eng_reset;
 
@@ -104,6 +115,9 @@ struct ecore_hw_init_params {
 
 	/* Driver load parameters */
 	struct ecore_drv_load_params *p_drv_load_params;
+
+	/* SPQ block timeout in msec */
+	u32 spq_timeout_ms;
 };
 
 /**
diff --git a/drivers/net/qede/base/ecore_spq.c b/drivers/net/qede/base/ecore_spq.c
index 70ffa8c..a213bb8 100644
--- a/drivers/net/qede/base/ecore_spq.c
+++ b/drivers/net/qede/base/ecore_spq.c
@@ -30,7 +30,7 @@
 
 #define SPQ_BLOCK_DELAY_MAX_ITER	(10)
 #define SPQ_BLOCK_DELAY_US		(10)
-#define SPQ_BLOCK_SLEEP_MAX_ITER	(1000)
+#define SPQ_BLOCK_SLEEP_MAX_ITER	(200)
 #define SPQ_BLOCK_SLEEP_MS		(5)
 
 /***************************************************************************
@@ -60,8 +60,12 @@ static enum _ecore_status_t __ecore_spq_block(struct ecore_hwfn *p_hwfn,
 	u32 iter_cnt;
 
 	comp_done = (struct ecore_spq_comp_done *)p_ent->comp_cb.cookie;
-	iter_cnt = sleep_between_iter ? SPQ_BLOCK_SLEEP_MAX_ITER
+	iter_cnt = sleep_between_iter ? p_hwfn->p_spq->block_sleep_max_iter
 				      : SPQ_BLOCK_DELAY_MAX_ITER;
+#ifndef ASIC_ONLY
+	if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && sleep_between_iter)
+		iter_cnt *= 5;
+#endif
 
 	while (iter_cnt--) {
 		OSAL_POLL_MODE_DPC(p_hwfn);
@@ -138,6 +142,14 @@ static enum _ecore_status_t ecore_spq_block(struct ecore_hwfn *p_hwfn,
 	return ECORE_BUSY;
 }
 
+void ecore_set_spq_block_timeout(struct ecore_hwfn *p_hwfn,
+				 u32 spq_timeout_ms)
+{
+	p_hwfn->p_spq->block_sleep_max_iter = spq_timeout_ms ?
+		spq_timeout_ms / SPQ_BLOCK_SLEEP_MS :
+		SPQ_BLOCK_SLEEP_MAX_ITER;
+}
+
 /***************************************************************************
  * SPQ entries inner API
  ***************************************************************************/
diff --git a/drivers/net/qede/base/ecore_spq.h b/drivers/net/qede/base/ecore_spq.h
index 526cff0..94ae9a6 100644
--- a/drivers/net/qede/base/ecore_spq.h
+++ b/drivers/net/qede/base/ecore_spq.h
@@ -116,6 +116,9 @@ struct ecore_spq {
 	dma_addr_t			p_phys;
 	struct ecore_spq_entry		*p_virt;
 
+	/* SPQ max sleep iterations used in __ecore_spq_block() */
+	u32				block_sleep_max_iter;
+
 	/* Bitmap for handling out-of-order completions */
 #define SPQ_RING_SIZE		\
 	(CORE_SPQE_PAGE_SIZE_BYTES / sizeof(struct slow_path_element))
@@ -150,6 +153,16 @@ struct ecore_spq {
 struct ecore_hwfn;
 
 /**
+ * @brief ecore_set_spq_block_timeout - calculates the maximum sleep
+ * iterations used in __ecore_spq_block();
+ *
+ * @param p_hwfn
+ * @param spq_timeout_ms
+ */
+void ecore_set_spq_block_timeout(struct ecore_hwfn *p_hwfn,
+				 u32 spq_timeout_ms);
+
+/**
  * @brief ecore_spq_post - Posts a Slow hwfn request to FW, or lacking that
  *        Pends it to the future list.
  *
diff --git a/drivers/net/qede/base/mcp_public.h b/drivers/net/qede/base/mcp_public.h
index 81ca663..d3666a7 100644
--- a/drivers/net/qede/base/mcp_public.h
+++ b/drivers/net/qede/base/mcp_public.h
@@ -1777,6 +1777,8 @@ struct public_drv_mb {
 #define FW_MB_PARAM_FEATURE_SUPPORT_SMARTLINQ   0x00000001
 /* MFW supports EEE */
 #define FW_MB_PARAM_FEATURE_SUPPORT_EEE         0x00000002
+/* MFW supports DRV_LOAD Timeout */
+#define FW_MB_PARAM_FEATURE_SUPPORT_DRV_LOAD_TO  0x00000004
 /* MFW supports virtual link */
 #define FW_MB_PARAM_FEATURE_SUPPORT_VLINK       0x00010000
 
-- 
1.7.10.3

  parent reply	other threads:[~2018-04-01  5:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  5:46 [dpdk-dev] [PATCH 00/14] net/qede/base: update PMD version to 2.8.0.1 Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 01/14] net/qede/base: use path ID for HW init Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 02/14] net/qede/base: protect DMAE transactions Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 03/14] net/qede/base: add DMAE sanity check Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 04/14] net/qede/base: upgrade FW to 8.33.12.0 Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 05/14] net/qede/base: symantic changes Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 06/14] net/qede/base: add new chain API Rasesh Mody
2018-04-01  5:46 ` [dpdk-dev] [PATCH 07/14] net/qede/base: allow changing VF MAC address Rasesh Mody
2018-04-01  5:46 ` Rasesh Mody [this message]
2018-04-01  5:46 ` [dpdk-dev] [PATCH 09/14] net/qede/base: refine error handling Rasesh Mody
2018-04-01  5:47 ` [dpdk-dev] [PATCH 10/14] net/qede/base: add stats counter for link state Rasesh Mody
2018-04-01  5:47 ` [dpdk-dev] [PATCH 11/14] net/qede/base: add APIs for xcvr Rasesh Mody
2018-04-01  5:47 ` [dpdk-dev] [PATCH 12/14] net/qede/base: fix to support OVLAN mode Rasesh Mody
2018-04-01  5:47 ` [dpdk-dev] [PATCH 13/14] net/qede/base: add packet pacing support Rasesh Mody
2018-04-01  5:47 ` [dpdk-dev] [PATCH 14/14] net/qede: update PMD version to 2.8.0.1 Rasesh Mody
2018-04-06  9:03 ` [dpdk-dev] [PATCH 00/14] net/qede/base: " Ferruh Yigit
2018-04-09  4:49   ` Mody, Rasesh
2018-04-09  4:47 ` [dpdk-dev] [PATCH v2 " Rasesh Mody
2018-04-09 17:10   ` Ferruh Yigit
2018-04-09  4:47 ` [dpdk-dev] [PATCH v2 01/14] net/qede/base: use path ID for HW init Rasesh Mody
2018-04-09  4:47 ` [dpdk-dev] [PATCH v2 02/14] net/qede/base: protect DMAE transactions Rasesh Mody
2018-04-09  4:47 ` [dpdk-dev] [PATCH v2 03/14] net/qede/base: add DMAE sanity check Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 04/14] net/qede/base: upgrade FW to 8.33.12.0 Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 05/14] net/qede/base: symantic changes Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 06/14] net/qede/base: add new chain API Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 07/14] net/qede/base: allow changing VF MAC address Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 08/14] net/qede/base: add MFW support for driver load timeout Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 09/14] net/qede/base: refine error handling Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 10/14] net/qede/base: add stats counter for link state Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 11/14] net/qede/base: add APIs for xcvr Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 12/14] net/qede/base: fix to support OVLAN mode Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 13/14] net/qede/base: add packet pacing support Rasesh Mody
2018-04-09  4:48 ` [dpdk-dev] [PATCH v2 14/14] net/qede: update PMD version to 2.8.0.1 Rasesh Mody

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=1522561624-15817-9-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@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).