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, Huaxing Zhu <huaxing.zhu@corigine.com>,
	Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 3/4] net/nfp: add more logs to debug probe process
Date: Mon, 14 Oct 2024 10:43:57 +0800	[thread overview]
Message-ID: <20241014024358.3873420-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20241014024358.3873420-1-chaoyong.he@corigine.com>

From: Huaxing Zhu <huaxing.zhu@corigine.com>

Add more logs to debug probe process, and modify some log level.
Also add an new entry to the mailmap file.

Signed-off-by: Huaxing Zhu <huaxing.zhu@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 .mailmap                               |  1 +
 drivers/net/nfp/nfp_ethdev.c           |  6 +++++-
 drivers/net/nfp/nfpcore/nfp_mutex.c    | 17 +++++++++++++----
 drivers/net/nfp/nfpcore/nfp_nsp.c      | 15 +++++++++++----
 drivers/net/nfp/nfpcore/nfp_nsp_eth.c  |  5 ++++-
 drivers/net/nfp/nfpcore/nfp_resource.c |  4 +++-
 6 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/.mailmap b/.mailmap
index ec12c42dd4..a4439c9020 100644
--- a/.mailmap
+++ b/.mailmap
@@ -561,6 +561,7 @@ Hrvoje Habjanic <hrvoje.habjanic@zg.ht.hr>
 Huaibin Wang <huaibin.wang@6wind.com>
 Huanle Han <hanxueluo@gmail.com>
 Huawei Xie <huawei.xhw@alibaba-inc.com> <huawei.xie@intel.com>
+Huaxing Zhu <huaxing.zhu@corigine.com>
 Huichao Cai <chcchc88@163.com>
 Huilong Xu <huilongx.xu@intel.com>
 Huisong Li <lihuisong@huawei.com>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index a199988999..8cbbadb4de 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1297,13 +1297,17 @@ nfp_fw_upload(struct nfp_nsp *nsp,
 static void
 nfp_fw_unload(struct nfp_cpp *cpp)
 {
+	int err;
 	struct nfp_nsp *nsp;
 
 	nsp = nfp_nsp_open(cpp);
 	if (nsp == NULL)
 		return;
 
-	nfp_nsp_device_soft_reset(nsp);
+	err = nfp_nsp_device_soft_reset(nsp);
+	if (err != 0)
+		PMD_DRV_LOG(WARNING, "Failed to do soft reset when nfp fw unload.");
+
 	nfp_nsp_close(nsp);
 }
 
diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c
index edb78dfdc9..9a4dc1e14e 100644
--- a/drivers/net/nfp/nfpcore/nfp_mutex.c
+++ b/drivers/net/nfp/nfpcore/nfp_mutex.c
@@ -308,11 +308,16 @@ nfp_cpp_mutex_trylock(struct nfp_cpp_mutex *mutex)
 
 	/* Verify that the lock marker is not damaged */
 	err = nfp_cpp_readl(cpp, mur, mutex->address + 4, &key);
-	if (err < 0)
+	if (err < 0) {
+		PMD_DRV_LOG(ERR, "Failed to read key.");
 		return err;
+	}
 
-	if (key != mutex->key)
+	if (key != mutex->key) {
+		PMD_DRV_LOG(ERR, "Key: %x is not same with the mutex: %x.",
+				key, mutex->key);
 		return -EPERM;
+	}
 
 	/*
 	 * Compare against the unlocked state, and if true,
@@ -335,8 +340,10 @@ nfp_cpp_mutex_trylock(struct nfp_cpp_mutex *mutex)
 	 * atomic, which returns the original value.
 	 */
 	err = nfp_cpp_readl(cpp, mus, mutex->address, &tmp);
-	if (err < 0)
+	if (err < 0) {
+		PMD_DRV_LOG(ERR, "Failed to read tmp.");
 		return err;
+	}
 
 	/* Was it unlocked? */
 	if (nfp_mutex_is_unlocked(tmp)) {
@@ -350,8 +357,10 @@ nfp_cpp_mutex_trylock(struct nfp_cpp_mutex *mutex)
 		 * debug and bookkeeping.
 		 */
 		err = nfp_cpp_writel(cpp, muw, mutex->address, value);
-		if (err < 0)
+		if (err < 0) {
+			PMD_DRV_LOG(ERR, "Failed to write value.");
 			return err;
+		}
 
 		mutex->depth = 1;
 		return 0;
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 2ac39b10b5..32f092eda1 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -252,6 +252,7 @@ nfp_nsp_open(struct nfp_cpp *cpp)
 
 	state = malloc(sizeof(*state));
 	if (state == NULL) {
+		PMD_DRV_LOG(ERR, "NSP - failed to malloc name %s", NFP_RESOURCE_NSP);
 		nfp_resource_release(res);
 		return NULL;
 	}
@@ -369,8 +370,10 @@ nfp_nsp_command_real(struct nfp_nsp *state,
 	}
 
 	err = nfp_cpp_writeq(cpp, nsp_cpp, nsp_buffer, arg->buf);
-	if (err < 0)
+	if (err < 0) {
+		PMD_DRV_LOG(ERR, "CPP write buffer failed. err %d", err);
 		return err;
+	}
 
 	err = nfp_cpp_writeq(cpp, nsp_cpp, nsp_command,
 			FIELD_PREP(NSP_COMMAND_OPTION, arg->option) |
@@ -378,8 +381,10 @@ nfp_nsp_command_real(struct nfp_nsp *state,
 			FIELD_PREP(NSP_COMMAND_CODE, arg->code) |
 			FIELD_PREP(NSP_COMMAND_DMA_BUF, arg->dma) |
 			FIELD_PREP(NSP_COMMAND_START, 1));
-	if (err < 0)
+	if (err < 0) {
+		PMD_DRV_LOG(ERR, "CPP write command failed. err %d", err);
 		return err;
+	}
 
 	/* Wait for NSP_COMMAND_START to go to 0 */
 	err = nfp_nsp_wait_reg(cpp, &reg, nsp_cpp, nsp_command,
@@ -400,15 +405,17 @@ nfp_nsp_command_real(struct nfp_nsp *state,
 	}
 
 	err = nfp_cpp_readq(cpp, nsp_cpp, nsp_command, &ret_val);
-	if (err < 0)
+	if (err < 0) {
+		PMD_DRV_LOG(ERR, "CPP read return value failed. err %d", err);
 		return err;
+	}
 
 	ret_val = FIELD_GET(NSP_COMMAND_OPTION, ret_val);
 
 	err = FIELD_GET(NSP_STATUS_RESULT, reg);
 	if (err != 0) {
 		if (!arg->error_quiet)
-			PMD_DRV_LOG(WARNING, "Result (error) code set: %d (%d) command: %d",
+			PMD_DRV_LOG(ERR, "Result (error) code set: %d (%d) command: %d",
 					-err, (int)ret_val, arg->code);
 
 		if (arg->error_cb != 0)
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index 87db928c08..d1b43a75f0 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -347,12 +347,15 @@ nfp_eth_config_start(struct nfp_cpp *cpp,
 	union eth_table_entry *entries;
 
 	entries = malloc(NSP_ETH_TABLE_SIZE);
-	if (entries == NULL)
+	if (entries == NULL) {
+		PMD_DRV_LOG(ERR, "Malloc entries failed.");
 		return NULL;
+	}
 
 	memset(entries, 0, NSP_ETH_TABLE_SIZE);
 	nsp = nfp_nsp_open(cpp);
 	if (nsp == NULL) {
+		PMD_DRV_LOG(ERR, "NSP open failed.");
 		free(entries);
 		return nsp;
 	}
diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c
index d59d2d6c1e..b05144036a 100644
--- a/drivers/net/nfp/nfpcore/nfp_resource.c
+++ b/drivers/net/nfp/nfpcore/nfp_resource.c
@@ -161,8 +161,10 @@ nfp_resource_acquire(struct nfp_cpp *cpp,
 	struct nfp_cpp_mutex *dev_mutex;
 
 	res = malloc(sizeof(*res));
-	if (res == NULL)
+	if (res == NULL) {
+		PMD_DRV_LOG(ERR, "RESOURCE - Malloc NSP memory failed.");
 		return NULL;
+	}
 
 	memset(res, 0, sizeof(*res));
 
-- 
2.39.1


  parent reply	other threads:[~2024-10-14  2:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  2:43 [PATCH 0/4] debug enhancement and bug fix Chaoyong He
2024-10-14  2:43 ` [PATCH 1/4] net/nfp: notify flower firmware about PF speed Chaoyong He
2024-10-14  2:43 ` [PATCH 2/4] net/nfp: do not set the IPv6 flag in transport mode Chaoyong He
2024-10-14  2:43 ` Chaoyong He [this message]
2024-10-14  2:43 ` [PATCH 4/4] net/nfp: clear errors status of aer after soft reset Chaoyong He
2024-10-16 23:08 ` [PATCH 0/4] debug enhancement and bug fix 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=20241014024358.3873420-4-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=huaxing.zhu@corigine.com \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@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).