DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
	James Hershaw <james.hershaw@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 1/3] net/nfp: remove panic usage during reconfig
Date: Fri,  3 Feb 2023 15:57:34 +0800	[thread overview]
Message-ID: <20230203075736.18616-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230203075736.18616-1-chaoyong.he@corigine.com>

From: James Hershaw <james.hershaw@corigine.com>

Remove usage of the rte_panic() function from the nfp PMD. It is better
to return error values and allow the application to handle the error.

Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_common.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 4f21d9978d..7a60add3a6 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -63,8 +63,10 @@ __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update)
 	PMD_DRV_LOG(DEBUG, "Writing to the configuration queue (%p)...",
 		    hw->qcp_cfg);
 
-	if (hw->qcp_cfg == NULL)
-		rte_panic("Bad configuration queue pointer\n");
+	if (hw->qcp_cfg == NULL) {
+		PMD_INIT_LOG(ERR, "Bad configuration queue pointer");
+		return -ENXIO;
+	}
 
 	nfp_qcp_ptr_add(hw->qcp_cfg, NFP_QCP_WRITE_PTR, 1);
 
@@ -85,7 +87,7 @@ __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update)
 		if (cnt >= NFP_NET_POLL_TIMEOUT) {
 			PMD_INIT_LOG(ERR, "Reconfig timeout for 0x%08x after"
 					  " %dms", update, cnt);
-			rte_panic("Exiting\n");
+			return -EIO;
 		}
 		nanosleep(&wait, 0); /* waiting for a 1ms */
 	}
@@ -121,16 +123,14 @@ nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update)
 
 	rte_spinlock_unlock(&hw->reconfig_lock);
 
-	if (!err)
-		return 0;
+	if (err != 0) {
+		PMD_INIT_LOG(ERR, "Error nfp_net reconfig for ctrl: %x update: %x",
+			     ctrl, update);
+		return -EIO;
+	}
+
+	return 0;
 
-	/*
-	 * Reconfig errors imply situations where they can be handled.
-	 * Otherwise, rte_panic is called inside __nfp_net_reconfig
-	 */
-	PMD_INIT_LOG(ERR, "Error nfp_net reconfig for ctrl: %x update: %x",
-		     ctrl, update);
-	return -EIO;
 }
 
 /*
-- 
2.29.3


  reply	other threads:[~2023-02-03  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03  7:57 [PATCH 0/3] remove usage of rte_panic() and ASSERT() from PMD Chaoyong He
2023-02-03  7:57 ` Chaoyong He [this message]
2023-02-03  7:57 ` [PATCH 2/3] net/nfp: remove panic usage for multisegment Tx Chaoyong He
2023-02-03  7:57 ` [PATCH 3/3] net/nfp: remove ASSERT() macro Chaoyong He
2023-02-03 18:57 ` [PATCH 0/3] remove usage of rte_panic() and ASSERT() from PMD 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=20230203075736.18616-2-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=james.hershaw@corigine.com \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.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).