DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] cleanup the PMD
@ 2023-02-06  7:05 Chaoyong He
  2023-02-06  7:05 ` [PATCH 1/3] net/nfp: remove usage of print statements Chaoyong He
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Chaoyong He @ 2023-02-06  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Chaoyong He

This patch series aims to better align the PMD with
the preferred DPDK coding style.
- Remove the usage of 'printf()'
- Remove the unneeded header file includes
- Explicitly compare pointer with NULL
- Explicitly compare integer with 0

James Hershaw (3):
  net/nfp: remove usage of print statements
  net/nfp: remove unnecessary include
  net/nfp: explicitly compare to null and 0

 drivers/net/nfp/nfp_common.c               | 25 +++---
 drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
 drivers/net/nfp/nfp_ethdev.c               |  2 +-
 drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
 drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
 drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
 drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
 drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
 drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
 drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
 drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
 drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
 drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
 drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
 drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
 drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
 17 files changed, 176 insertions(+), 202 deletions(-)

-- 
2.29.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] net/nfp: remove usage of print statements
  2023-02-06  7:05 [PATCH 0/3] cleanup the PMD Chaoyong He
@ 2023-02-06  7:05 ` Chaoyong He
  2023-02-06  7:05 ` [PATCH 2/3] net/nfp: remove unnecessary include Chaoyong He
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Chaoyong He @ 2023-02-06  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, James Hershaw, Chaoyong He

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

Removal of the usage of printf() statements from the nfp PMD in favour
of appropriate RTE logging functions in compliance with the standard.

Debug messages are now logged using the appropriate RTE_LOG functions so
it is no longer necessary to print specific statements when compiled in
with the DEBUG tag, rather log these messages using the appropriate
functions regardless of whether the DEBUG tag is set or not.

Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 71 +++++++++-------------
 drivers/net/nfp/nfpcore/nfp_cppcore.c      |  3 +-
 drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 17 +++---
 drivers/net/nfp/nfpcore/nfp_mip.c          | 12 ++--
 drivers/net/nfp/nfpcore/nfp_mutex.c        | 10 ++-
 drivers/net/nfp/nfpcore/nfp_nsp.c          | 30 +++++----
 drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     |  4 +-
 drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 16 ++---
 drivers/net/nfp/nfpcore/nfp_resource.c     |  5 +-
 drivers/net/nfp/nfpcore/nfp_rtsym.c        | 28 +++------
 10 files changed, 87 insertions(+), 109 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index 22c8bc4b14..8d7eb96da1 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -34,6 +34,7 @@
 #include <rte_string_fns.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_target.h"
 #include "nfp6000/nfp6000.h"
 
@@ -173,23 +174,17 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config,
 		newcfg |= NFP_PCIE_BAR_PCIE2CPP_TOKEN_BASEADDRESS(tok);
 
 		if ((offset & mask) != ((offset + size - 1) & mask)) {
-			printf("BAR%d: Won't use for Fixed mapping\n",
-				bar->index);
-			printf("\t<%#llx,%#llx>, action=%d\n",
-				(unsigned long long)offset,
-				(unsigned long long)(offset + size), act);
-			printf("\tBAR too small (0x%llx).\n",
-				(unsigned long long)mask);
+			PMD_DRV_LOG(ERR, "BAR%d: Won't use for Fixed mapping <%#llx,%#llx>, action=%d BAR too small (0x%llx)",
+				    bar->index, (unsigned long long)offset,
+				    (unsigned long long)(offset + size), act,
+				    (unsigned long long)mask);
 			return -EINVAL;
 		}
 		offset &= mask;
 
-#ifdef DEBUG
-		printf("BAR%d: Created Fixed mapping\n", bar->index);
-		printf("\t%d:%d:%d:0x%#llx-0x%#llx>\n", tgt, act, tok,
-			(unsigned long long)offset,
-			(unsigned long long)(offset + mask));
-#endif
+		PMD_DRV_LOG(DEBUG, "BAR%d: Created Fixed mapping %d:%d:%d:0x%#llx-0x%#llx>",
+			    bar->index, tgt, act, tok, (unsigned long long)offset,
+			    (unsigned long long)(offset + mask));
 
 		bitsize = 40 - 16;
 	} else {
@@ -204,33 +199,27 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config,
 		newcfg |= NFP_PCIE_BAR_PCIE2CPP_TOKEN_BASEADDRESS(tok);
 
 		if ((offset & mask) != ((offset + size - 1) & mask)) {
-			printf("BAR%d: Won't use for bulk mapping\n",
-				bar->index);
-			printf("\t<%#llx,%#llx>\n", (unsigned long long)offset,
-				(unsigned long long)(offset + size));
-			printf("\ttarget=%d, token=%d\n", tgt, tok);
-			printf("\tBAR too small (%#llx) - (%#llx != %#llx).\n",
-				(unsigned long long)mask,
-				(unsigned long long)(offset & mask),
-				(unsigned long long)(offset + size - 1) & mask);
-
+			PMD_DRV_LOG(ERR, "BAR%d: Won't use for bulk mapping <%#llx,%#llx> target=%d, token=%d BAR too small (%#llx) - (%#llx != %#llx).",
+				    bar->index, (unsigned long long)offset,
+				    (unsigned long long)(offset + size),
+				    tgt, tok, (unsigned long long)mask,
+				    (unsigned long long)(offset & mask),
+				    (unsigned long long)(offset + size - 1) & mask);
 			return -EINVAL;
 		}
 
 		offset &= mask;
 
-#ifdef DEBUG
-		printf("BAR%d: Created bulk mapping %d:x:%d:%#llx-%#llx\n",
-			bar->index, tgt, tok, (unsigned long long)offset,
-			(unsigned long long)(offset + ~mask));
-#endif
+		PMD_DRV_LOG(DEBUG, "BAR%d: Created bulk mapping %d:x:%d:%#llx-%#llx",
+			    bar->index, tgt, tok, (unsigned long long)offset,
+			    (unsigned long long)(offset + ~mask));
 
 		bitsize = 40 - 21;
 	}
 
 	if (bar->bitsize < bitsize) {
-		printf("BAR%d: Too small for %d:%d:%d\n", bar->index, tgt, tok,
-			act);
+		PMD_DRV_LOG(ERR, "BAR%d: Too small for %d:%d:%d", bar->index,
+			    tgt, tok, act);
 		return -EINVAL;
 	}
 
@@ -263,9 +252,7 @@ nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar,
 	*(uint32_t *)(bar->csr) = newcfg;
 
 	bar->barcfg = newcfg;
-#ifdef DEBUG
-	printf("BAR%d: updated to 0x%08x\n", bar->index, newcfg);
-#endif
+	PMD_DRV_LOG(DEBUG, "BAR%d: updated to 0x%08x", bar->index, newcfg);
 
 	return 0;
 }
@@ -535,7 +522,7 @@ nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr,
 
 	/* Unaligned? Translate to an explicit access */
 	if ((priv->offset + offset) & (width - 1)) {
-		printf("aread_read unaligned!!!\n");
+		PMD_DRV_LOG(ERR, "aread_read unaligned!!!");
 		return -EINVAL;
 	}
 
@@ -702,7 +689,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
 	desc->secondary_lock = open(lockfile, O_RDWR | O_CREAT | O_NONBLOCK,
 				    0666);
 	if (desc->secondary_lock < 0) {
-		RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");
+		PMD_DRV_LOG(ERR, "NFP lock for secondary process failed");
 		free(lockfile);
 		return desc->secondary_lock;
 	}
@@ -711,7 +698,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
 	lock.l_whence = SEEK_SET;
 	rc = fcntl(desc->secondary_lock, F_SETLK, &lock);
 	if (rc < 0) {
-		RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");
+		PMD_DRV_LOG(ERR, "NFP lock for secondary process failed");
 		close(desc->secondary_lock);
 	}
 
@@ -725,7 +712,7 @@ nfp6000_set_model(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 	uint32_t model;
 
 	if (rte_pci_read_config(dev, &model, 4, 0x2e) < 0) {
-		printf("nfp set model failed\n");
+		PMD_DRV_LOG(ERR, "nfp set model failed");
 		return -1;
 	}
 
@@ -741,7 +728,7 @@ nfp6000_set_interface(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 	uint16_t interface;
 
 	if (rte_pci_read_config(dev, &interface, 2, 0x154) < 0) {
-		printf("nfp set interface failed\n");
+		PMD_DRV_LOG(ERR, "nfp set interface failed");
 		return -1;
 	}
 
@@ -760,14 +747,14 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 
 	pos = rte_pci_find_ext_capability(dev, RTE_PCI_EXT_CAP_ID_DSN);
 	if (pos <= 0) {
-		printf("PCI_EXT_CAP_ID_DSN not found. nfp set serial failed\n");
+		PMD_DRV_LOG(ERR, "PCI_EXT_CAP_ID_DSN not found. nfp set serial failed");
 		return -1;
 	} else {
 		pos += 6;
 	}
 
 	if (rte_pci_read_config(dev, &tmp, 2, pos) < 0) {
-		printf("nfp set serial failed\n");
+		PMD_DRV_LOG(ERR, "nfp set serial failed");
 		return -1;
 	}
 
@@ -776,7 +763,7 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 
 	pos += 2;
 	if (rte_pci_read_config(dev, &tmp, 2, pos) < 0) {
-		printf("nfp set serial failed\n");
+		PMD_DRV_LOG(ERR, "nfp set serial failed");
 		return -1;
 	}
 
@@ -785,7 +772,7 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 
 	pos += 2;
 	if (rte_pci_read_config(dev, &tmp, 2, pos) < 0) {
-		printf("nfp set serial failed\n");
+		PMD_DRV_LOG(ERR, "nfp set serial failed");
 		return -1;
 	}
 
diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c
index 37799af558..e1e0a143f9 100644
--- a/drivers/net/nfp/nfpcore/nfp_cppcore.c
+++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c
@@ -15,6 +15,7 @@
 #include <ethdev_pci.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_target.h"
 #include "nfp6000/nfp6000.h"
 #include "nfp6000/nfp_xpb.h"
@@ -701,7 +702,7 @@ nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination,
 
 	area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length);
 	if (!area) {
-		printf("Area allocation/acquire failed\n");
+		PMD_DRV_LOG(ERR, "Area allocation/acquire failed");
 		return -1;
 	}
 
diff --git a/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/drivers/net/nfp/nfpcore/nfp_hwinfo.c
index 9f848bde79..9b66569953 100644
--- a/drivers/net/nfp/nfpcore/nfp_hwinfo.c
+++ b/drivers/net/nfp/nfpcore/nfp_hwinfo.c
@@ -20,6 +20,7 @@
 #include <time.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp6000/nfp6000.h"
 #include "nfp_resource.h"
 #include "nfp_hwinfo.h"
@@ -40,12 +41,12 @@ nfp_hwinfo_db_walk(struct nfp_hwinfo *hwinfo, uint32_t size)
 	     key = val + strlen(val) + 1) {
 		val = key + strlen(key) + 1;
 		if (val >= end) {
-			printf("Bad HWINFO - overflowing key\n");
+			PMD_DRV_LOG(ERR, "Bad HWINFO - overflowing value");
 			return -EINVAL;
 		}
 
 		if (val + strlen(val) + 1 > end) {
-			printf("Bad HWINFO - overflowing value\n");
+			PMD_DRV_LOG(ERR, "Bad HWINFO - overflowing value");
 			return -EINVAL;
 		}
 	}
@@ -59,7 +60,7 @@ nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len)
 
 	size = db->size;
 	if (size > len) {
-		printf("Unsupported hwinfo size %u > %u\n", size, len);
+		PMD_DRV_LOG(ERR, "Unsupported hwinfo size %u > %u", size, len);
 		return -EINVAL;
 	}
 
@@ -67,8 +68,8 @@ nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len)
 	new_crc = nfp_crc32_posix((char *)db, size);
 	crc = (uint32_t *)(db->start + size);
 	if (new_crc != *crc) {
-		printf("Corrupt hwinfo table (CRC mismatch)\n");
-		printf("\tcalculated 0x%x, expected 0x%x\n", new_crc, *crc);
+		PMD_DRV_LOG(ERR, "Corrupt hwinfo table (CRC mismatch) calculated 0x%x, expected 0x%x",
+			    new_crc, *crc);
 		return -EINVAL;
 	}
 
@@ -108,12 +109,12 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size)
 		goto exit_free;
 
 	header = (void *)db;
-	printf("NFP HWINFO header: %#08x\n", *(uint32_t *)header);
+	PMD_DRV_LOG(DEBUG, "NFP HWINFO header: %#08x", *(uint32_t *)header);
 	if (nfp_hwinfo_is_updating(header))
 		goto exit_free;
 
 	if (header->version != NFP_HWINFO_VERSION_2) {
-		printf("Unknown HWInfo version: 0x%08x\n",
+		PMD_DRV_LOG(DEBUG, "Unknown HWInfo version: 0x%08x",
 			header->version);
 		goto exit_free;
 	}
@@ -145,7 +146,7 @@ nfp_hwinfo_fetch(struct nfp_cpp *cpp, size_t *hwdb_size)
 
 		nanosleep(&wait, NULL);
 		if (count++ > 200) {
-			printf("NFP access error\n");
+			PMD_DRV_LOG(ERR, "NFP access error");
 			return NULL;
 		}
 	}
diff --git a/drivers/net/nfp/nfpcore/nfp_mip.c b/drivers/net/nfp/nfpcore/nfp_mip.c
index c86966df8b..d342bc4141 100644
--- a/drivers/net/nfp/nfpcore/nfp_mip.c
+++ b/drivers/net/nfp/nfpcore/nfp_mip.c
@@ -7,6 +7,7 @@
 #include <rte_byteorder.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_mip.h"
 #include "nfp_nffw.h"
 
@@ -43,18 +44,17 @@ nfp_mip_try_read(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr,
 
 	ret = nfp_cpp_read(cpp, cpp_id, addr, mip, sizeof(*mip));
 	if (ret != sizeof(*mip)) {
-		printf("Failed to read MIP data (%d, %zu)\n",
-			ret, sizeof(*mip));
+		PMD_DRV_LOG(ERR, "Failed to read MIP data (%d, %zu)", ret, sizeof(*mip));
 		return -EIO;
 	}
 	if (mip->signature != NFP_MIP_SIGNATURE) {
-		printf("Incorrect MIP signature (0x%08x)\n",
-			 rte_le_to_cpu_32(mip->signature));
+		PMD_DRV_LOG(ERR, "Incorrect MIP signature (0x%08x)",
+			    rte_le_to_cpu_32(mip->signature));
 		return -EINVAL;
 	}
 	if (mip->mip_version != NFP_MIP_VERSION) {
-		printf("Unsupported MIP version (%d)\n",
-			 rte_le_to_cpu_32(mip->mip_version));
+		PMD_DRV_LOG(ERR, "Unsupported MIP version (%d)",
+			    rte_le_to_cpu_32(mip->mip_version));
 		return -EINVAL;
 	}
 
diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c
index 318c5800d7..de9049c6a0 100644
--- a/drivers/net/nfp/nfpcore/nfp_mutex.c
+++ b/drivers/net/nfp/nfpcore/nfp_mutex.c
@@ -10,6 +10,7 @@
 #include <sched.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp6000/nfp6000.h"
 
 #define MUTEX_LOCKED(interface)  ((((uint32_t)(interface)) << 16) | 0x000f)
@@ -265,12 +266,9 @@ nfp_cpp_mutex_lock(struct nfp_cpp_mutex *mutex)
 		if (err < 0 && errno != EBUSY)
 			return err;
 		if (time(NULL) >= warn_at) {
-			printf("Warning: waiting for NFP mutex\n");
-			printf("\tusage:%u\n", mutex->usage);
-			printf("\tdepth:%hd]\n", mutex->depth);
-			printf("\ttarget:%d\n", mutex->target);
-			printf("\taddr:%llx\n", mutex->address);
-			printf("\tkey:%08x]\n", mutex->key);
+			PMD_DRV_LOG(ERR, "Warning: waiting for NFP mutex usage:%u depth:%hd] target:%d addr:%llx key:%08x]",
+				    mutex->usage, mutex->depth, mutex->target,
+				    mutex->address, mutex->key);
 			warn_at = time(NULL) + 60;
 		}
 		sched_yield();
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 876a4017c9..22fb3407c6 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -11,6 +11,7 @@
 #include <rte_common.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_nsp.h"
 #include "nfp_resource.h"
 
@@ -62,7 +63,7 @@ nfp_nsp_print_extended_error(uint32_t ret_val)
 
 	for (i = 0; i < (int)ARRAY_SIZE(nsp_errors); i++)
 		if (ret_val == (uint32_t)nsp_errors[i].code)
-			printf("err msg: %s\n", nsp_errors[i].msg);
+			PMD_DRV_LOG(ERR, "err msg: %s", nsp_errors[i].msg);
 }
 
 static int
@@ -81,7 +82,7 @@ nfp_nsp_check(struct nfp_nsp *state)
 		return err;
 
 	if (FIELD_GET(NSP_STATUS_MAGIC, reg) != NSP_MAGIC) {
-		printf("Cannot detect NFP Service Processor\n");
+		PMD_DRV_LOG(ERR, "Cannot detect NFP Service Processor");
 		return -ENODEV;
 	}
 
@@ -89,13 +90,13 @@ nfp_nsp_check(struct nfp_nsp *state)
 	state->ver.minor = FIELD_GET(NSP_STATUS_MINOR, reg);
 
 	if (state->ver.major != NSP_MAJOR || state->ver.minor < NSP_MINOR) {
-		printf("Unsupported ABI %hu.%hu\n", state->ver.major,
+		PMD_DRV_LOG(ERR, "Unsupported ABI %hu.%hu", state->ver.major,
 						    state->ver.minor);
 		return -EINVAL;
 	}
 
 	if (reg & NSP_STATUS_BUSY) {
-		printf("Service processor busy!\n");
+		PMD_DRV_LOG(ERR, "Service processor busy!");
 		return -EBUSY;
 	}
 
@@ -223,7 +224,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option,
 
 	if (!FIELD_FIT(NSP_BUFFER_CPP, buff_cpp >> 8) ||
 	    !FIELD_FIT(NSP_BUFFER_ADDRESS, buff_addr)) {
-		printf("Host buffer out of reach %08x %" PRIx64 "\n",
+		PMD_DRV_LOG(ERR, "Host buffer out of reach %08x %" PRIx64,
 			buff_cpp, buff_addr);
 		return -EINVAL;
 	}
@@ -245,7 +246,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option,
 	err = nfp_nsp_wait_reg(cpp, &reg, nsp_cpp, nsp_command,
 			       NSP_COMMAND_START, 0);
 	if (err) {
-		printf("Error %d waiting for code 0x%04x to start\n",
+		PMD_DRV_LOG(ERR, "Error %d waiting for code 0x%04x to start",
 			err, code);
 		return err;
 	}
@@ -254,7 +255,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option,
 	err = nfp_nsp_wait_reg(cpp, &reg, nsp_cpp, nsp_status, NSP_STATUS_BUSY,
 			       0);
 	if (err) {
-		printf("Error %d waiting for code 0x%04x to complete\n",
+		PMD_DRV_LOG(ERR, "Error %d waiting for code 0x%04x to start",
 			err, code);
 		return err;
 	}
@@ -266,7 +267,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option,
 
 	err = FIELD_GET(NSP_STATUS_RESULT, reg);
 	if (err) {
-		printf("Result (error) code set: %d (%d) command: %d\n",
+		PMD_DRV_LOG(ERR, "Result (error) code set: %d (%d) command: %d",
 			 -err, (int)ret_val, code);
 		nfp_nsp_print_extended_error(ret_val);
 		return -err;
@@ -289,8 +290,8 @@ nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option,
 	uint32_t cpp_id;
 
 	if (nsp->ver.minor < 13) {
-		printf("NSP: Code 0x%04x with buffer not supported\n", code);
-		printf("\t(ABI %hu.%hu)\n", nsp->ver.major, nsp->ver.minor);
+		PMD_DRV_LOG(ERR, "NSP: Code 0x%04x with buffer not supported ABI %hu.%hu)",
+			    code, nsp->ver.major, nsp->ver.minor);
 		return -EOPNOTSUPP;
 	}
 
@@ -303,11 +304,8 @@ nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option,
 
 	max_size = RTE_MAX(in_size, out_size);
 	if (FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M < max_size) {
-		printf("NSP: default buffer too small for command 0x%04x\n",
-		       code);
-		printf("\t(%llu < %u)\n",
-		       FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M,
-		       max_size);
+		PMD_DRV_LOG(ERR, "NSP: default buffer too small for command 0x%04x (%llu < %u)",
+			    code, FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M, max_size);
 		return -EINVAL;
 	}
 
@@ -372,7 +370,7 @@ nfp_nsp_wait(struct nfp_nsp *state)
 		}
 	}
 	if (err)
-		printf("NSP failed to respond %d\n", err);
+		PMD_DRV_LOG(ERR, "NSP failed to respond %d", err);
 
 	return err;
 }
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
index bfd1eddb3e..1de3d1b00f 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <rte_byteorder.h>
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_nsp.h"
 #include "nfp_nffw.h"
 
@@ -39,8 +40,7 @@ __nfp_nsp_identify(struct nfp_nsp *nsp)
 	memset(ni, 0, sizeof(*ni));
 	ret = nfp_nsp_read_identify(nsp, ni, sizeof(*ni));
 	if (ret < 0) {
-		printf("reading bsp version failed %d\n",
-			ret);
+		PMD_DRV_LOG(ERR, "reading bsp version failed %d", ret);
 		goto exit_free;
 	}
 
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index f8f3c372ac..eb532e5f3a 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -7,6 +7,7 @@
 #include <rte_common.h>
 #include <rte_byteorder.h>
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_nsp.h"
 #include "nfp6000/nfp6000.h"
 
@@ -236,7 +237,7 @@ nfp_eth_calc_port_geometry(struct nfp_eth_table *table)
 				continue;
 			if (table->ports[i].label_subport ==
 			    table->ports[j].label_subport)
-				printf("Port %d subport %d is a duplicate\n",
+				PMD_DRV_LOG(DEBUG, "Port %d subport %d is a duplicate",
 					 table->ports[i].label_port,
 					 table->ports[i].label_subport);
 
@@ -275,7 +276,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	memset(entries, 0, NSP_ETH_TABLE_SIZE);
 	ret = nfp_nsp_read_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE);
 	if (ret < 0) {
-		printf("reading port table failed %d\n", ret);
+		PMD_DRV_LOG(ERR, "reading port table failed %d", ret);
 		goto err;
 	}
 
@@ -294,7 +295,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	 * above.
 	 */
 	if (ret && ret != cnt) {
-		printf("table entry count (%d) unmatch entries present (%d)\n",
+		PMD_DRV_LOG(ERR, "table entry count (%d) unmatch entries present (%d)",
 		       ret, cnt);
 		goto err;
 	}
@@ -372,12 +373,12 @@ nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx)
 
 	ret = nfp_nsp_read_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE);
 	if (ret < 0) {
-		printf("reading port table failed %d\n", ret);
+		PMD_DRV_LOG(ERR, "reading port table failed %d", ret);
 		goto err;
 	}
 
 	if (!(entries[idx].port & NSP_ETH_PORT_LANES_MASK)) {
-		printf("trying to set port state on disabled port %d\n", idx);
+		PMD_DRV_LOG(ERR, "trying to set port state on disabled port %d", idx);
 		goto err;
 	}
 
@@ -535,7 +536,7 @@ nfp_eth_set_bit_config(struct nfp_nsp *nsp, unsigned int raw_idx,
 	 *	 codes were initially not populated correctly.
 	 */
 	if (nfp_nsp_get_abi_ver_minor(nsp) < 17) {
-		printf("set operations not supported, please update flash\n");
+		PMD_DRV_LOG(ERR, "set operations not supported, please update flash");
 		return -EOPNOTSUPP;
 	}
 
@@ -647,8 +648,7 @@ __nfp_eth_set_speed(struct nfp_nsp *nsp, unsigned int speed)
 
 	rate = nfp_eth_speed2rate(speed);
 	if (rate == RATE_INVALID) {
-		printf("could not find matching lane rate for speed %u\n",
-			 speed);
+		PMD_DRV_LOG(ERR, "could not find matching lane rate for speed %u", speed);
 		return -EINVAL;
 	}
 
diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c
index 7b5630fd86..6a10c9b0a7 100644
--- a/drivers/net/nfp/nfpcore/nfp_resource.c
+++ b/drivers/net/nfp/nfpcore/nfp_resource.c
@@ -10,6 +10,7 @@
 #include <rte_string_fns.h>
 
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp6000/nfp6000.h"
 #include "nfp_resource.h"
 #include "nfp_crc.h"
@@ -79,7 +80,7 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res)
 
 	/* Search for a matching entry */
 	if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) {
-		printf("Grabbing device lock not supported\n");
+		PMD_DRV_LOG(ERR, "Grabbing device lock not supported");
 		return -EOPNOTSUPP;
 	}
 	key = nfp_crc32_posix(name_pad, NFP_RESOURCE_ENTRY_NAME_SZ);
@@ -185,7 +186,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 			goto err_free;
 
 		if (count++ > 1000) {
-			printf("Error: resource %s timed out\n", name);
+			PMD_DRV_LOG(ERR, "Error: resource %s timed out", name);
 			err = -EBUSY;
 			goto err_free;
 		}
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 56bbf05cd8..288a37da60 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <rte_byteorder.h>
 #include "nfp_cpp.h"
+#include "nfp_logs.h"
 #include "nfp_mip.h"
 #include "nfp_rtsym.h"
 #include "nfp6000/nfp6000.h"
@@ -56,11 +57,8 @@ nfp_rtsym_sw_entry_init(struct nfp_rtsym_table *cache, uint32_t strtab_size,
 	sw->size = ((uint64_t)fw->size_hi << 32) |
 		   rte_le_to_cpu_32(fw->size_lo);
 
-#ifdef DEBUG
-	printf("rtsym_entry_init\n");
-	printf("\tname=%s, addr=%" PRIx64 ", size=%" PRIu64 ",target=%d\n",
-		sw->name, sw->addr, sw->size, sw->target);
-#endif
+	PMD_INIT_LOG(DEBUG, "rtsym_entry_init name=%s, addr=%" PRIx64 ", size=%" PRIu64 ", target=%d",
+		     sw->name, sw->addr, sw->size, sw->target);
 	switch (fw->target) {
 	case SYM_TGT_LMEM:
 		sw->target = NFP_RTSYM_TARGET_LMEM;
@@ -241,10 +239,8 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error)
 
 	id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, sym->domain);
 
-#ifdef DEBUG
-	printf("Reading symbol %s with size %" PRIu64 " at %" PRIx64 "\n",
+	PMD_DRV_LOG(DEBUG, "Reading symbol %s with size %" PRIu64 " at %" PRIx64 "",
 		name, sym->size, sym->addr);
-#endif
 	switch (sym->size) {
 	case 4:
 		err = nfp_cpp_readl(rtbl->cpp, id, sym->addr, &val32);
@@ -254,7 +250,7 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error)
 		err = nfp_cpp_readq(rtbl->cpp, id, sym->addr, &val);
 		break;
 	default:
-		printf("rtsym '%s' unsupported size: %" PRId64 "\n",
+		PMD_DRV_LOG(ERR, "rtsym '%s' unsupported size: %" PRId64,
 			name, sym->size);
 		err = -EINVAL;
 		break;
@@ -279,17 +275,15 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 	const struct nfp_rtsym *sym;
 	uint8_t *mem;
 
-#ifdef DEBUG
-	printf("mapping symbol %s\n", name);
-#endif
+	PMD_DRV_LOG(DEBUG, "mapping symbol %s", name);
 	sym = nfp_rtsym_lookup(rtbl, name);
 	if (!sym) {
-		printf("symbol lookup fails for %s\n", name);
+		PMD_DRV_LOG(ERR, "symbol lookup fails for %s", name);
 		return NULL;
 	}
 
 	if (sym->size < min_size) {
-		printf("Symbol %s too small (%" PRIu64 " < %u)\n", name,
+		PMD_DRV_LOG(ERR, "Symbol %s too small (%" PRIu64 " < %u)", name,
 			sym->size, min_size);
 		return NULL;
 	}
@@ -297,12 +291,10 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 	mem = nfp_cpp_map_area(rtbl->cpp, sym->domain, sym->target, sym->addr,
 			       sym->size, area);
 	if (!mem) {
-		printf("Failed to map symbol %s\n", name);
+		PMD_DRV_LOG(ERR, "Failed to map symbol %s", name);
 		return NULL;
 	}
-#ifdef DEBUG
-	printf("symbol %s with address %p\n", name, mem);
-#endif
+	PMD_DRV_LOG(DEBUG, "symbol %s with address %p", name, mem);
 
 	return mem;
 }
-- 
2.29.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] net/nfp: remove unnecessary include
  2023-02-06  7:05 [PATCH 0/3] cleanup the PMD Chaoyong He
  2023-02-06  7:05 ` [PATCH 1/3] net/nfp: remove usage of print statements Chaoyong He
@ 2023-02-06  7:05 ` Chaoyong He
  2023-02-06  7:05 ` [PATCH 3/3] net/nfp: explicitly compare to null and 0 Chaoyong He
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Chaoyong He @ 2023-02-06  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, James Hershaw, Chaoyong He

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

Remove inclusion of rte_string_fns.h as the utility functions provided
are no longer used in the PMD.

Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_common.c               | 1 -
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 1 -
 drivers/net/nfp/nfpcore/nfp_resource.c     | 2 --
 3 files changed, 4 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 7a60add3a6..f97264e9f0 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -25,7 +25,6 @@
 #include <rte_memzone.h>
 #include <rte_mempool.h>
 #include <rte_version.h>
-#include <rte_string_fns.h>
 #include <rte_alarm.h>
 #include <rte_spinlock.h>
 #include <rte_service_component.h>
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index 8d7eb96da1..e818fcc8e8 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -31,7 +31,6 @@
 #include <sys/stat.h>
 
 #include <ethdev_pci.h>
-#include <rte_string_fns.h>
 
 #include "nfp_cpp.h"
 #include "nfp_logs.h"
diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c
index 6a10c9b0a7..fda03a6576 100644
--- a/drivers/net/nfp/nfpcore/nfp_resource.c
+++ b/drivers/net/nfp/nfpcore/nfp_resource.c
@@ -7,8 +7,6 @@
 #include <time.h>
 #include <endian.h>
 
-#include <rte_string_fns.h>
-
 #include "nfp_cpp.h"
 #include "nfp_logs.h"
 #include "nfp6000/nfp6000.h"
-- 
2.29.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] net/nfp: explicitly compare to null and 0
  2023-02-06  7:05 [PATCH 0/3] cleanup the PMD Chaoyong He
  2023-02-06  7:05 ` [PATCH 1/3] net/nfp: remove usage of print statements Chaoyong He
  2023-02-06  7:05 ` [PATCH 2/3] net/nfp: remove unnecessary include Chaoyong He
@ 2023-02-06  7:05 ` Chaoyong He
  2023-02-06 16:28 ` [PATCH 0/3] cleanup the PMD Stephen Hemminger
  2023-02-08  1:55 ` Ferruh Yigit
  4 siblings, 0 replies; 8+ messages in thread
From: Chaoyong He @ 2023-02-06  7:05 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, James Hershaw, Chaoyong He

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

Removal of the '!' character when comparing variables in favour of
explicitly comparing the variable to either 'NULL' or '0', in
compliance with the standard.

Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_common.c               | 24 +++++++++----------
 drivers/net/nfp/nfp_cpp_bridge.c           |  4 ++--
 drivers/net/nfp/nfp_ethdev.c               |  2 +-
 drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
 drivers/net/nfp/nfp_rxtx.c                 | 14 +++++------
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 16 ++++++-------
 drivers/net/nfp/nfpcore/nfp_cppcore.c      | 28 +++++++++++-----------
 drivers/net/nfp/nfpcore/nfp_hwinfo.c       |  6 ++---
 drivers/net/nfp/nfpcore/nfp_mip.c          |  4 ++--
 drivers/net/nfp/nfpcore/nfp_mutex.c        |  4 ++--
 drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 ++++----
 drivers/net/nfp/nfpcore/nfp_nsp.c          |  6 ++---
 drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     |  6 ++---
 drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 22 ++++++++---------
 drivers/net/nfp/nfpcore/nfp_resource.c     |  8 +++----
 drivers/net/nfp/nfpcore/nfp_rtsym.c        | 24 +++++++++----------
 drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
 17 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index f97264e9f0..c9401055d4 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -470,7 +470,7 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 		hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	}
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) {
+	if ((hw->cap & NFP_NET_CFG_CTRL_PROMISC) == 0) {
 		PMD_INIT_LOG(INFO, "Promiscuous mode not supported");
 		return -ENOTSUP;
 	}
@@ -1088,7 +1088,7 @@ nfp_net_dev_interrupt_handler(void *param)
 	nfp_net_link_update(dev, 0);
 
 	/* likely to up */
-	if (!link.link_status) {
+	if (link.link_status == 0) {
 		/* handle it 1 sec later, wait it being stable */
 		timeout = NFP_NET_LINK_UP_CHECK_TIMEOUT;
 		/* likely to down */
@@ -1173,7 +1173,7 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 	update = NFP_NET_CFG_UPDATE_GEN;
 
 	ret = nfp_net_reconfig(hw, new_ctrl, update);
-	if (!ret)
+	if (ret == 0)
 		hw->ctrl = new_ctrl;
 
 	return ret;
@@ -1207,7 +1207,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 		shift = i % RTE_ETH_RETA_GROUP_SIZE;
 		mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF);
 
-		if (!mask)
+		if (mask == 0)
 			continue;
 
 		reta = 0;
@@ -1216,7 +1216,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 			reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + i);
 
 		for (j = 0; j < 4; j++) {
-			if (!(mask & (0x1 << j)))
+			if ((mask & (0x1 << j)) == 0)
 				continue;
 			if (mask != 0xF)
 				/* Clearing the entry bits */
@@ -1240,7 +1240,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,
 	uint32_t update;
 	int ret;
 
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
 		return -EINVAL;
 
 	ret = nfp_net_rss_reta_write(dev, reta_conf, reta_size);
@@ -1268,7 +1268,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev,
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
 		return -EINVAL;
 
 	if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) {
@@ -1288,13 +1288,13 @@ nfp_net_reta_query(struct rte_eth_dev *dev,
 		shift = i % RTE_ETH_RETA_GROUP_SIZE;
 		mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF);
 
-		if (!mask)
+		if (mask == 0)
 			continue;
 
 		reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + (idx * 64) +
 				    shift);
 		for (j = 0; j < 4; j++) {
-			if (!(mask & (0x1 << j)))
+			if ((mask & (0x1 << j)) == 0)
 				continue;
 			reta_conf[idx].reta[shift + j] =
 				(uint8_t)((reta >> (8 * j)) & 0xF);
@@ -1366,7 +1366,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev,
 	rss_hf = rss_conf->rss_hf;
 
 	/* Checking if RSS is enabled */
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) {
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) {
 		if (rss_hf != 0) { /* Enable RSS? */
 			PMD_DRV_LOG(ERR, "RSS unsupported");
 			return -EINVAL;
@@ -1401,7 +1401,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
+	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
 		return -EINVAL;
 
 	rss_hf = rss_conf->rss_hf;
@@ -1469,7 +1469,7 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev)
 		return ret;
 
 	dev_conf = &dev->data->dev_conf;
-	if (!dev_conf) {
+	if (dev_conf == NULL) {
 		PMD_DRV_LOG(INFO, "wrong rss conf");
 		return -EINVAL;
 	}
diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c
index e650fe9930..4aa36eb581 100644
--- a/drivers/net/nfp/nfp_cpp_bridge.c
+++ b/drivers/net/nfp/nfp_cpp_bridge.c
@@ -161,7 +161,7 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
 		/* configure a CPP PCIe2CPP BAR for mapping the CPP target */
 		area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
 						    nfp_offset, curlen);
-		if (!area) {
+		if (area == NULL) {
 			RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__);
 			return -EIO;
 		}
@@ -261,7 +261,7 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 	while (count > 0) {
 		area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
 						    nfp_offset, curlen);
-		if (!area) {
+		if (area == NULL) {
 			RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__);
 			return -EIO;
 		}
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 31201c0197..f05c50ac88 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -652,7 +652,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,
 			&eth_dev->data->mac_addrs[0]);
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))
+	if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0)
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
 
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 4eea197f85..07a2e17ef8 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -417,7 +417,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,
 			&eth_dev->data->mac_addrs[0]);
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))
+	if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0)
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;
 
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index a5907cc428..79a66b6e44 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -186,7 +186,7 @@ nfp_net_parse_meta_hash(const struct nfp_meta_parsed *meta,
 		hash = meta->hash;
 		hash_type = meta->hash_type;
 	} else {
-		if (!(rxd->rxd.flags & PCIE_DESC_RX_RSS))
+		if ((rxd->rxd.flags & PCIE_DESC_RX_RSS) == 0)
 			return;
 
 		hash = rte_be_to_cpu_32(*(uint32_t *)NFP_HASH_OFFSET);
@@ -1045,7 +1045,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 			 * Making the EOP, packets with just one segment
 			 * the priority
 			 */
-			if (likely(!pkt_size))
+			if (likely(pkt_size == 0))
 				txds->offset_eop = PCIE_DESC_TX_EOP;
 			else
 				txds->offset_eop = 0;
@@ -1360,7 +1360,7 @@ nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
 	uint64_t ol_flags;
 	struct nfp_net_hw *hw = txq->hw;
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
+	if ((hw->cap & NFP_NET_CFG_CTRL_TXCSUM) == 0)
 		return flags;
 
 	ol_flags = mb->ol_flags;
@@ -1382,12 +1382,12 @@ nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
 	struct nfp_net_nfdk_tx_desc txd;
 	struct nfp_net_hw *hw = txq->hw;
 
-	if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY))
+	if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0)
 		goto clean_txd;
 
 	ol_flags = mb->ol_flags;
 
-	if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG))
+	if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0)
 		goto clean_txd;
 
 	txd.l3_offset = mb->l2_len;
@@ -1476,7 +1476,7 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 		if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
 				(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
 			type = NFDK_DESC_TX_TYPE_TSO;
-		} else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+		} else if (pkt->next == NULL && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
 			type = NFDK_DESC_TX_TYPE_SIMPLE;
 		} else {
 			type = NFDK_DESC_TX_TYPE_GATHER;
@@ -1532,7 +1532,7 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 				dma_addr += dlen_type + 1;
 			}
 
-			if (!pkt->next)
+			if (pkt->next == NULL)
 				break;
 
 			pkt = pkt->next;
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index e818fcc8e8..d8d1293166 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -242,7 +242,7 @@ nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar,
 	base = bar->index >> 3;
 	slot = bar->index & 7;
 
-	if (!nfp->cfg)
+	if (nfp->cfg == NULL)
 		return (-ENOMEM);
 
 	bar->csr = nfp->cfg +
@@ -342,7 +342,7 @@ nfp_alloc_bar(struct nfp_pcie_user *nfp)
 	}
 	for (x = start; x > end; x--) {
 		bar = &nfp->bar[x - 1];
-		if (!bar->lock) {
+		if (bar->lock == 0) {
 			bar->lock = 1;
 			return bar;
 		}
@@ -459,7 +459,7 @@ nfp6000_area_acquire(struct nfp_cpp_area *area)
 	}
 
 	/* Must have been too big. Sub-allocate. */
-	if (!priv->bar->iomem)
+	if (priv->bar->iomem == NULL)
 		return (-ENOMEM);
 
 	priv->iomem = priv->bar->iomem + priv->bar_offset;
@@ -472,7 +472,7 @@ nfp6000_area_mapped(struct nfp_cpp_area *area)
 {
 	struct nfp6000_area_priv *area_priv = nfp_cpp_area_priv(area);
 
-	if (!area_priv->iomem)
+	if (area_priv->iomem == NULL)
 		return NULL;
 
 	return area_priv->iomem;
@@ -543,7 +543,7 @@ nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr,
 			return -EINVAL;
 	}
 
-	if (!priv->bar)
+	if (priv->bar == NULL)
 		return -EFAULT;
 
 	if (is_64)
@@ -608,7 +608,7 @@ nfp6000_area_write(struct nfp_cpp_area *area, const void *kernel_vaddr,
 			return -EINVAL;
 	}
 
-	if (!priv->bar)
+	if (priv->bar == NULL)
 		return -EFAULT;
 
 	if (is_64)
@@ -680,7 +680,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
 	lockfile = calloc(strlen(home_path) + strlen(lockname) + 1,
 			  sizeof(char));
 
-	if (!lockfile)
+	if (lockfile == NULL)
 		return -ENOMEM;
 
 	strcat(lockfile, home_path);
@@ -805,7 +805,7 @@ nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev)
 	struct nfp_pcie_user *desc;
 
 	desc = malloc(sizeof(*desc));
-	if (!desc)
+	if (desc == NULL)
 		return -1;
 
 
diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c
index e1e0a143f9..72f50ace38 100644
--- a/drivers/net/nfp/nfpcore/nfp_cppcore.c
+++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c
@@ -51,7 +51,7 @@ nfp_cpp_model(struct nfp_cpp *cpp)
 	int err;
 	uint32_t model;
 
-	if (!cpp)
+	if (cpp == NULL)
 		return NFP_CPP_MODEL_INVALID;
 
 	err = __nfp_cpp_model_autodetect(cpp, &model);
@@ -83,7 +83,7 @@ nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial,
 		free(cpp->serial);
 
 	cpp->serial = malloc(serial_len);
-	if (!cpp->serial)
+	if (cpp->serial == NULL)
 		return -1;
 
 	memcpy(cpp->serial, serial, serial_len);
@@ -95,7 +95,7 @@ nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial,
 uint16_t
 nfp_cpp_interface(struct nfp_cpp *cpp)
 {
-	if (!cpp)
+	if (cpp == NULL)
 		return NFP_CPP_INTERFACE(NFP_CPP_INTERFACE_TYPE_INVALID, 0, 0);
 
 	return cpp->interface;
@@ -140,7 +140,7 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest,
 	uint64_t tmp64 = (uint64_t)address;
 	int tmp, err;
 
-	if (!cpp)
+	if (cpp == NULL)
 		return NULL;
 
 	/* CPP bus uses only a 40-bit address */
@@ -154,12 +154,12 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest,
 
 	address = (unsigned long long)tmp64;
 
-	if (!name)
+	if (name == NULL)
 		name = "";
 
 	area = calloc(1, sizeof(*area) + cpp->op->area_priv_size +
 		      strlen(name) + 1);
-	if (!area)
+	if (area == NULL)
 		return NULL;
 
 	area->cpp = cpp;
@@ -217,7 +217,7 @@ nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, uint32_t destination,
 	struct nfp_cpp_area *area;
 
 	area = nfp_cpp_area_alloc(cpp, destination, address, size);
-	if (!area)
+	if (area == NULL)
 		return NULL;
 
 	if (nfp_cpp_area_acquire(area)) {
@@ -404,7 +404,7 @@ nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr)
 	 */
 	island = ((*xpb_addr) >> 24) & 0x3f;
 
-	if (!island)
+	if (island == 0)
 		return xpb;
 
 	if (island == 1) {
@@ -555,11 +555,11 @@ nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed)
 
 	ops = nfp_cpp_transport_operations();
 
-	if (!ops || !ops->init)
+	if (ops == NULL || ops->init == NULL)
 		return NFP_ERRPTR(EINVAL);
 
 	cpp = calloc(1, sizeof(*cpp));
-	if (!cpp)
+	if (cpp == NULL)
 		return NULL;
 
 	cpp->op = ops;
@@ -701,7 +701,7 @@ nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination,
 	int err;
 
 	area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length);
-	if (!area) {
+	if (area == NULL) {
 		PMD_DRV_LOG(ERR, "Area allocation/acquire failed");
 		return -1;
 	}
@@ -729,7 +729,7 @@ nfp_cpp_write(struct nfp_cpp *cpp, uint32_t destination,
 	int err;
 
 	area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length);
-	if (!area)
+	if (area == NULL)
 		return -1;
 
 	err = nfp_cpp_area_write(area, 0, kernel_vaddr, length);
@@ -841,11 +841,11 @@ nfp_cpp_map_area(struct nfp_cpp *cpp, int domain, int target, uint64_t addr,
 	dest = NFP_CPP_ISLAND_ID(target, NFP_CPP_ACTION_RW, 0, domain);
 
 	*area = nfp_cpp_area_alloc_acquire(cpp, dest, addr, size);
-	if (!*area)
+	if (*area == NULL)
 		goto err_eio;
 
 	res = nfp_cpp_area_iomem(*area);
-	if (!res)
+	if (res == NULL)
 		goto err_release_free;
 
 	return res;
diff --git a/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/drivers/net/nfp/nfpcore/nfp_hwinfo.c
index 9b66569953..9054bb0315 100644
--- a/drivers/net/nfp/nfpcore/nfp_hwinfo.c
+++ b/drivers/net/nfp/nfpcore/nfp_hwinfo.c
@@ -101,7 +101,7 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size)
 	}
 
 	db = malloc(*cpp_size + 1);
-	if (!db)
+	if (db == NULL)
 		return NULL;
 
 	err = nfp_cpp_read(cpp, cpp_id, cpp_addr, db, *cpp_size);
@@ -160,7 +160,7 @@ nfp_hwinfo_read(struct nfp_cpp *cpp)
 	int err;
 
 	db = nfp_hwinfo_fetch(cpp, &hwdb_size);
-	if (!db)
+	if (db == NULL)
 		return NULL;
 
 	err = nfp_hwinfo_db_validate(db, hwdb_size);
@@ -183,7 +183,7 @@ nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup)
 {
 	const char *key, *val, *end;
 
-	if (!hwinfo || !lookup)
+	if (hwinfo == NULL || lookup == NULL)
 		return NULL;
 
 	end = hwinfo->data + hwinfo->size - sizeof(uint32_t);
diff --git a/drivers/net/nfp/nfpcore/nfp_mip.c b/drivers/net/nfp/nfpcore/nfp_mip.c
index d342bc4141..6b392ad5eb 100644
--- a/drivers/net/nfp/nfpcore/nfp_mip.c
+++ b/drivers/net/nfp/nfpcore/nfp_mip.c
@@ -71,7 +71,7 @@ nfp_mip_read_resource(struct nfp_cpp *cpp, struct nfp_mip *mip)
 	int err;
 
 	nffw_info = nfp_nffw_info_open(cpp);
-	if (!nffw_info)
+	if (nffw_info == NULL)
 		return -ENODEV;
 
 	err = nfp_nffw_info_mip_first(nffw_info, &cpp_id, &addr);
@@ -101,7 +101,7 @@ nfp_mip_open(struct nfp_cpp *cpp)
 	int err;
 
 	mip = malloc(sizeof(*mip));
-	if (!mip)
+	if (mip == NULL)
 		return NULL;
 
 	err = nfp_mip_read_resource(cpp, mip);
diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c
index de9049c6a0..8a4e6a462a 100644
--- a/drivers/net/nfp/nfpcore/nfp_mutex.c
+++ b/drivers/net/nfp/nfpcore/nfp_mutex.c
@@ -153,7 +153,7 @@ nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, int target,
 		return NFP_ERRPTR(EEXIST);
 
 	mutex = calloc(sizeof(*mutex), 1);
-	if (!mutex)
+	if (mutex == NULL)
 		return NFP_ERRPTR(ENOMEM);
 
 	mutex->cpp = cpp;
@@ -205,7 +205,7 @@ nfp_cpp_mutex_owner(struct nfp_cpp_mutex *mutex)
 	if (key != mutex->key)
 		return NFP_ERRNO(EPERM);
 
-	if (!MUTEX_IS_LOCKED(value))
+	if (MUTEX_IS_LOCKED(value) == 0)
 		return 0;
 
 	return MUTEX_INTERFACE(value);
diff --git a/drivers/net/nfp/nfpcore/nfp_nffw.c b/drivers/net/nfp/nfpcore/nfp_nffw.c
index 8bec0e3c9a..1382c4f6bf 100644
--- a/drivers/net/nfp/nfpcore/nfp_nffw.c
+++ b/drivers/net/nfp/nfpcore/nfp_nffw.c
@@ -123,13 +123,13 @@ nfp_nffw_info_open(struct nfp_cpp *cpp)
 	int err;
 
 	state = malloc(sizeof(*state));
-	if (!state)
+	if (state == NULL)
 		return NULL;
 
 	memset(state, 0, sizeof(*state));
 
 	state->res = nfp_resource_acquire(cpp, NFP_RESOURCE_NFP_NFFW);
-	if (!state->res)
+	if (state->res == NULL)
 		goto err_free;
 
 	fwinf = &state->fwinf;
@@ -143,7 +143,7 @@ nfp_nffw_info_open(struct nfp_cpp *cpp)
 	if (err < (int)sizeof(*fwinf))
 		goto err_release;
 
-	if (!nffw_res_flg_init_get(fwinf))
+	if (nffw_res_flg_init_get(fwinf) == 0)
 		goto err_release;
 
 	info_ver = nffw_res_info_version_get(fwinf);
@@ -186,7 +186,7 @@ nfp_nffw_info_fwid_first(struct nfp_nffw_info *state)
 	unsigned int cnt, i;
 
 	cnt = nffw_res_fwinfos(&state->fwinf, &fwinfo);
-	if (!cnt)
+	if (cnt == 0)
 		return NULL;
 
 	for (i = 0; i < cnt; i++)
@@ -211,7 +211,7 @@ nfp_nffw_info_mip_first(struct nfp_nffw_info *state, uint32_t *cpp_id,
 	struct nffw_fwinfo *fwinfo;
 
 	fwinfo = nfp_nffw_info_fwid_first(state);
-	if (!fwinfo)
+	if (fwinfo == NULL)
 		return -EINVAL;
 
 	*cpp_id = nffw_fwinfo_mip_cppid_get(fwinfo);
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 22fb3407c6..d8abaf1d52 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -58,7 +58,7 @@ nfp_nsp_print_extended_error(uint32_t ret_val)
 {
 	int i;
 
-	if (!ret_val)
+	if (ret_val == 0)
 		return;
 
 	for (i = 0; i < (int)ARRAY_SIZE(nsp_errors); i++)
@@ -115,11 +115,11 @@ nfp_nsp_open(struct nfp_cpp *cpp)
 	int err;
 
 	res = nfp_resource_acquire(cpp, NFP_RESOURCE_NSP);
-	if (!res)
+	if (res == NULL)
 		return NULL;
 
 	state = malloc(sizeof(*state));
-	if (!state) {
+	if (state == NULL) {
 		nfp_resource_release(res);
 		return NULL;
 	}
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
index 1de3d1b00f..15f6f7002d 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c
@@ -34,7 +34,7 @@ __nfp_nsp_identify(struct nfp_nsp *nsp)
 		return NULL;
 
 	ni = malloc(sizeof(*ni));
-	if (!ni)
+	if (ni == NULL)
 		return NULL;
 
 	memset(ni, 0, sizeof(*ni));
@@ -45,7 +45,7 @@ __nfp_nsp_identify(struct nfp_nsp *nsp)
 	}
 
 	nspi = malloc(sizeof(*nspi));
-	if (!nspi)
+	if (nspi == NULL)
 		goto exit_free;
 
 	memset(nspi, 0, sizeof(*nspi));
@@ -80,7 +80,7 @@ nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id, long *val)
 	int ret;
 
 	nsp = nfp_nsp_open(cpp);
-	if (!nsp)
+	if (nsp == NULL)
 		return -EIO;
 
 	ret = nfp_nsp_read_sensors(nsp, BIT(id), &s, sizeof(s));
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index eb532e5f3a..578120636d 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -270,7 +270,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	const struct rte_ether_addr *mac;
 
 	entries = malloc(NSP_ETH_TABLE_SIZE);
-	if (!entries)
+	if (entries == NULL)
 		return NULL;
 
 	memset(entries, 0, NSP_ETH_TABLE_SIZE);
@@ -286,7 +286,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	for (i = 0; i < NSP_ETH_MAX_COUNT; i++) {
 		mac = (const struct rte_ether_addr *)entries[i].mac_addr;
 		if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) &&
-				(!rte_is_zero_ether_addr(mac)))
+				!rte_is_zero_ether_addr(mac))
 			cnt++;
 	}
 
@@ -302,7 +302,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)
 
 	table_sz = sizeof(*table) + sizeof(struct nfp_eth_table_port) * cnt;
 	table = malloc(table_sz);
-	if (!table)
+	if (table == NULL)
 		goto err;
 
 	memset(table, 0, table_sz);
@@ -310,7 +310,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)
 	for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++) {
 		mac = (const struct rte_ether_addr *)entries[i].mac_addr;
 		if ((entries[i].port & NSP_ETH_PORT_LANES_MASK) &&
-				(!rte_is_zero_ether_addr(mac)))
+				!rte_is_zero_ether_addr(mac))
 			nfp_eth_port_translate(nsp, &entries[i], i,
 					&table->ports[j++]);
 	}
@@ -344,7 +344,7 @@ nfp_eth_read_ports(struct nfp_cpp *cpp)
 	struct nfp_nsp *nsp;
 
 	nsp = nfp_nsp_open(cpp);
-	if (!nsp)
+	if (nsp == NULL)
 		return NULL;
 
 	ret = __nfp_eth_read_ports(nsp);
@@ -361,12 +361,12 @@ nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx)
 	int ret;
 
 	entries = malloc(NSP_ETH_TABLE_SIZE);
-	if (!entries)
+	if (entries == NULL)
 		return NULL;
 
 	memset(entries, 0, NSP_ETH_TABLE_SIZE);
 	nsp = nfp_nsp_open(cpp);
-	if (!nsp) {
+	if (nsp == NULL) {
 		free(entries);
 		return nsp;
 	}
@@ -377,7 +377,7 @@ nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx)
 		goto err;
 	}
 
-	if (!(entries[idx].port & NSP_ETH_PORT_LANES_MASK)) {
+	if ((entries[idx].port & NSP_ETH_PORT_LANES_MASK) == 0) {
 		PMD_DRV_LOG(ERR, "trying to set port state on disabled port %d", idx);
 		goto err;
 	}
@@ -454,7 +454,7 @@ nfp_eth_set_mod_enable(struct nfp_cpp *cpp, unsigned int idx, int enable)
 	uint64_t reg;
 
 	nsp = nfp_eth_config_start(cpp, idx);
-	if (!nsp)
+	if (nsp == NULL)
 		return -1;
 
 	entries = nfp_nsp_config_entries(nsp);
@@ -494,7 +494,7 @@ nfp_eth_set_configured(struct nfp_cpp *cpp, unsigned int idx, int configed)
 	uint64_t reg;
 
 	nsp = nfp_eth_config_start(cpp, idx);
-	if (!nsp)
+	if (nsp == NULL)
 		return -EIO;
 
 	/*
@@ -617,7 +617,7 @@ nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode)
 	int err;
 
 	nsp = nfp_eth_config_start(cpp, idx);
-	if (!nsp)
+	if (nsp == NULL)
 		return -EIO;
 
 	err = __nfp_eth_set_fec(nsp, mode);
diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c
index fda03a6576..892ccf73c4 100644
--- a/drivers/net/nfp/nfpcore/nfp_resource.c
+++ b/drivers/net/nfp/nfpcore/nfp_resource.c
@@ -77,7 +77,7 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res)
 	strlcpy(name_pad, res->name, sizeof(name_pad));
 
 	/* Search for a matching entry */
-	if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) {
+	if (memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8) == 0) {
 		PMD_DRV_LOG(ERR, "Grabbing device lock not supported");
 		return -EOPNOTSUPP;
 	}
@@ -157,7 +157,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 	int count;
 
 	res = malloc(sizeof(*res));
-	if (!res)
+	if (res == NULL)
 		return NULL;
 
 	memset(res, 0, sizeof(*res));
@@ -167,7 +167,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 	dev_mutex = nfp_cpp_mutex_alloc(cpp, NFP_RESOURCE_TBL_TARGET,
 					NFP_RESOURCE_TBL_BASE,
 					NFP_RESOURCE_TBL_KEY);
-	if (!dev_mutex) {
+	if (dev_mutex == NULL) {
 		free(res);
 		return NULL;
 	}
@@ -178,7 +178,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name)
 
 	for (;;) {
 		err = nfp_resource_try_acquire(cpp, res, dev_mutex);
-		if (!err)
+		if (err == 0)
 			break;
 		if (err != -EBUSY)
 			goto err_free;
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 288a37da60..850667adf8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -103,13 +103,13 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 		NFP_ISL_EMEM0;
 	int err, n, size;
 
-	if (!mip)
+	if (mip == NULL)
 		return NULL;
 
 	nfp_mip_strtab(mip, &strtab_addr, &strtab_size);
 	nfp_mip_symtab(mip, &symtab_addr, &symtab_size);
 
-	if (!symtab_size || !strtab_size || symtab_size % sizeof(*rtsymtab))
+	if (symtab_size == 0 || strtab_size == 0 || symtab_size % sizeof(*rtsymtab) != 0)
 		return NULL;
 
 	/* Align to 64 bits */
@@ -117,14 +117,14 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 	strtab_size = round_up(strtab_size, 8);
 
 	rtsymtab = malloc(symtab_size);
-	if (!rtsymtab)
+	if (rtsymtab == NULL)
 		return NULL;
 
 	size = sizeof(*cache);
 	size += symtab_size / sizeof(*rtsymtab) * sizeof(struct nfp_rtsym);
 	size +=	strtab_size + 1;
 	cache = malloc(size);
-	if (!cache)
+	if (cache == NULL)
 		goto exit_free_rtsym_raw;
 
 	cache->cpp = cpp;
@@ -164,7 +164,7 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 int
 nfp_rtsym_count(struct nfp_rtsym_table *rtbl)
 {
-	if (!rtbl)
+	if (rtbl == NULL)
 		return -EINVAL;
 
 	return rtbl->num;
@@ -180,7 +180,7 @@ nfp_rtsym_count(struct nfp_rtsym_table *rtbl)
 const struct nfp_rtsym *
 nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx)
 {
-	if (!rtbl)
+	if (rtbl == NULL)
 		return NULL;
 
 	if (idx >= rtbl->num)
@@ -201,7 +201,7 @@ nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name)
 {
 	int n;
 
-	if (!rtbl)
+	if (rtbl == NULL)
 		return NULL;
 
 	for (n = 0; n < rtbl->num; n++)
@@ -232,7 +232,7 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error)
 	int err;
 
 	sym = nfp_rtsym_lookup(rtbl, name);
-	if (!sym) {
+	if (sym == NULL) {
 		err = -ENOENT;
 		goto exit;
 	}
@@ -277,8 +277,8 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 
 	PMD_DRV_LOG(DEBUG, "mapping symbol %s", name);
 	sym = nfp_rtsym_lookup(rtbl, name);
-	if (!sym) {
-		PMD_DRV_LOG(ERR, "symbol lookup fails for %s", name);
+	if (sym == NULL) {
+		PMD_INIT_LOG(ERR, "symbol lookup fails for %s", name);
 		return NULL;
 	}
 
@@ -290,8 +290,8 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 
 	mem = nfp_cpp_map_area(rtbl->cpp, sym->domain, sym->target, sym->addr,
 			       sym->size, area);
-	if (!mem) {
-		PMD_DRV_LOG(ERR, "Failed to map symbol %s", name);
+	if (mem == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to map symbol %s", name);
 		return NULL;
 	}
 	PMD_DRV_LOG(DEBUG, "symbol %s with address %p", name, mem);
diff --git a/drivers/net/nfp/nfpcore/nfp_target.h b/drivers/net/nfp/nfpcore/nfp_target.h
index e8dcc9ad1e..d1e5a50b14 100644
--- a/drivers/net/nfp/nfpcore/nfp_target.h
+++ b/drivers/net/nfp/nfpcore/nfp_target.h
@@ -554,7 +554,7 @@ nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address,
 		return 0;
 	}
 
-	if (!imb_table) {
+	if (imb_table == NULL) {
 		/* CPP + Island only allowed on systems with IMB tables */
 		return NFP_ERRNO(EINVAL);
 	}
-- 
2.29.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] cleanup the PMD
  2023-02-06  7:05 [PATCH 0/3] cleanup the PMD Chaoyong He
                   ` (2 preceding siblings ...)
  2023-02-06  7:05 ` [PATCH 3/3] net/nfp: explicitly compare to null and 0 Chaoyong He
@ 2023-02-06 16:28 ` Stephen Hemminger
  2023-02-07  2:17   ` Chaoyong He
  2023-02-08  1:55 ` Ferruh Yigit
  4 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2023-02-06 16:28 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, niklas.soderlund

On Mon,  6 Feb 2023 15:05:46 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> This patch series aims to better align the PMD with
> the preferred DPDK coding style.
> - Remove the usage of 'printf()'
> - Remove the unneeded header file includes
> - Explicitly compare pointer with NULL
> - Explicitly compare integer with 0
> 
> James Hershaw (3):
>   net/nfp: remove usage of print statements
>   net/nfp: remove unnecessary include
>   net/nfp: explicitly compare to null and 0
> 
>  drivers/net/nfp/nfp_common.c               | 25 +++---
>  drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
>  drivers/net/nfp/nfp_ethdev.c               |  2 +-
>  drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
>  drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
>  drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
>  drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
>  drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
>  drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
>  drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
>  drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
>  drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
>  drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
>  drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
>  drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
>  drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
>  drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
>  17 files changed, 176 insertions(+), 202 deletions(-)
> 

I am working on getting rid of RTE_LOGTYPE_PMD; all driver should
be using their own log type.

Looks like this driver has a lot of places that need fixing.
$ git grep 'PMD, '
flower/nfp_flower.c:            RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
flower/nfp_flower.c:                    RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__);
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write error\n");
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__);
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read error\n");
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n", __func__, cmd);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: socket creation error. Service failed\n",
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service failed\n",
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service failed\n",
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n",
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: service failed\n", __func__);
nfp_logs.h:     RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
nfp_logs.h:     RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
nfp_rxtx.c:             RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
nfp_rxtx.c:                     RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");
nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 0/3] cleanup the PMD
  2023-02-06 16:28 ` [PATCH 0/3] cleanup the PMD Stephen Hemminger
@ 2023-02-07  2:17   ` Chaoyong He
  2023-02-08  1:56     ` Ferruh Yigit
  0 siblings, 1 reply; 8+ messages in thread
From: Chaoyong He @ 2023-02-07  2:17 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Niklas Soderlund

> On Mon,  6 Feb 2023 15:05:46 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > This patch series aims to better align the PMD with the preferred DPDK
> > coding style.
> > - Remove the usage of 'printf()'
> > - Remove the unneeded header file includes
> > - Explicitly compare pointer with NULL
> > - Explicitly compare integer with 0
> >
> > James Hershaw (3):
> >   net/nfp: remove usage of print statements
> >   net/nfp: remove unnecessary include
> >   net/nfp: explicitly compare to null and 0
> >
> >  drivers/net/nfp/nfp_common.c               | 25 +++---
> >  drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
> >  drivers/net/nfp/nfp_ethdev.c               |  2 +-
> >  drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
> >  drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
> >  drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
> >  drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
> >  drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
> >  drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
> >  drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
> >  drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
> >  drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
> >  drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
> >  drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
> >  drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
> >  drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
> >  drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
> >  17 files changed, 176 insertions(+), 202 deletions(-)
> >
> 
> I am working on getting rid of RTE_LOGTYPE_PMD; all driver should be using
> their own log type.
> 
> Looks like this driver has a lot of places that need fixing.
> $ git grep 'PMD, '
> flower/nfp_flower.c:            RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
> flower/nfp_flower.c:                    RTE_LOG_DP(ERR, PMD, "rxb does not
> exist!\n");
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n",
> __func__);
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write
> error\n");
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n",
> __func__);
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read
> error\n");
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
> socket\n", __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n",
> __func__, cmd);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
> socket\n", __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
> __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
> __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: socket creation error.
> Service failed\n",
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service
> failed\n",
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service
> failed\n",
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: accept call error
> (%d)\n",
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: service failed\n",
> __func__);
> nfp_logs.h:     RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
> nfp_logs.h:     RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
> nfp_rxtx.c:             RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
> nfp_rxtx.c:                     RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
> secondary process failed\n");
> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
> secondary process failed\n");

Thanks for your review!
This patch series just the first step to make things right, and we will send out another patch series 
to refactor the log system of nfp PMD, which will solve the problem you point out.
Do you think it's okay? 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] cleanup the PMD
  2023-02-06  7:05 [PATCH 0/3] cleanup the PMD Chaoyong He
                   ` (3 preceding siblings ...)
  2023-02-06 16:28 ` [PATCH 0/3] cleanup the PMD Stephen Hemminger
@ 2023-02-08  1:55 ` Ferruh Yigit
  4 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2023-02-08  1:55 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund

On 2/6/2023 7:05 AM, Chaoyong He wrote:
> This patch series aims to better align the PMD with
> the preferred DPDK coding style.
> - Remove the usage of 'printf()'
> - Remove the unneeded header file includes
> - Explicitly compare pointer with NULL
> - Explicitly compare integer with 0
> 
> James Hershaw (3):
>   net/nfp: remove usage of print statements
>   net/nfp: remove unnecessary include

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] cleanup the PMD
  2023-02-07  2:17   ` Chaoyong He
@ 2023-02-08  1:56     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2023-02-08  1:56 UTC (permalink / raw)
  To: Chaoyong He, Stephen Hemminger; +Cc: dev, oss-drivers, Niklas Soderlund

On 2/7/2023 2:17 AM, Chaoyong He wrote:
>> On Mon,  6 Feb 2023 15:05:46 +0800
>> Chaoyong He <chaoyong.he@corigine.com> wrote:
>>
>>> This patch series aims to better align the PMD with the preferred DPDK
>>> coding style.
>>> - Remove the usage of 'printf()'
>>> - Remove the unneeded header file includes
>>> - Explicitly compare pointer with NULL
>>> - Explicitly compare integer with 0
>>>
>>> James Hershaw (3):
>>>   net/nfp: remove usage of print statements
>>>   net/nfp: remove unnecessary include
>>>   net/nfp: explicitly compare to null and 0
>>>
>>>  drivers/net/nfp/nfp_common.c               | 25 +++---
>>>  drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
>>>  drivers/net/nfp/nfp_ethdev.c               |  2 +-
>>>  drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
>>>  drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
>>>  drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
>>>  drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
>>>  drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
>>>  drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
>>>  drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
>>>  drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
>>>  drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
>>>  drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
>>>  drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
>>>  drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
>>>  drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
>>>  drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
>>>  17 files changed, 176 insertions(+), 202 deletions(-)
>>>
>>
>> I am working on getting rid of RTE_LOGTYPE_PMD; all driver should be using
>> their own log type.
>>
>> Looks like this driver has a lot of places that need fixing.
>> $ git grep 'PMD, '
>> flower/nfp_flower.c:            RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
>> flower/nfp_flower.c:                    RTE_LOG_DP(ERR, PMD, "rxb does not
>> exist!\n");
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n",
>> __func__);
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
>> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write
>> error\n");
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n",
>> __func__);
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
>> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read
>> error\n");
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
>> socket\n", __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n",
>> __func__, cmd);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
>> socket\n", __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
>> __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
>> __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: socket creation error.
>> Service failed\n",
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service
>> failed\n",
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service
>> failed\n",
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: accept call error
>> (%d)\n",
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: service failed\n",
>> __func__);
>> nfp_logs.h:     RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
>> nfp_logs.h:     RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
>> nfp_rxtx.c:             RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
>> nfp_rxtx.c:                     RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
>> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
>> secondary process failed\n");
>> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
>> secondary process failed\n");
> 
> Thanks for your review!
> This patch series just the first step to make things right, and we will send out another patch series 
> to refactor the log system of nfp PMD, which will solve the problem you point out.
> Do you think it's okay? 

Thanks Chaoyong,

I am merging this set as it is, remaining cleanups can be merged as they
received.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-02-08  1:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06  7:05 [PATCH 0/3] cleanup the PMD Chaoyong He
2023-02-06  7:05 ` [PATCH 1/3] net/nfp: remove usage of print statements Chaoyong He
2023-02-06  7:05 ` [PATCH 2/3] net/nfp: remove unnecessary include Chaoyong He
2023-02-06  7:05 ` [PATCH 3/3] net/nfp: explicitly compare to null and 0 Chaoyong He
2023-02-06 16:28 ` [PATCH 0/3] cleanup the PMD Stephen Hemminger
2023-02-07  2:17   ` Chaoyong He
2023-02-08  1:56     ` Ferruh Yigit
2023-02-08  1:55 ` Ferruh Yigit

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).