DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/7] net/intel: clean up base code build
@ 2025-03-26 15:52 Bruce Richardson
  2025-03-26 15:52 ` [PATCH 1/7] net/iavf/base: remove unused meson.build file Bruce Richardson
                   ` (9 more replies)
  0 siblings, 10 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Simplify the build of the various intel base code directories, by
clearing compiler warnings so the files can be compiled directly along
with the regular driver files.

Bruce Richardson (7):
  net/iavf/base: remove unused meson.build file
  net/ixgbe/base: correct definition of macro
  net/ixgbe/base: fix compilation warnings
  net/i40e/base: fix unused value warnings
  net/i40e/base: fix compiler warnings
  net/ice/base: reduce warnings for unused variables
  net/intel: simplify base code builds

 drivers/net/intel/e1000/base/meson.build    |  9 ++------
 drivers/net/intel/e1000/meson.build         |  4 ++--
 drivers/net/intel/fm10k/base/meson.build    |  9 ++------
 drivers/net/intel/fm10k/meson.build         |  4 ++--
 drivers/net/intel/i40e/base/i40e_diag.c     |  2 +-
 drivers/net/intel/i40e/base/i40e_nvm.c      |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h    |  4 ++--
 drivers/net/intel/i40e/base/i40e_type.h     | 14 ++++++++-----
 drivers/net/intel/i40e/base/meson.build     | 23 ++-------------------
 drivers/net/intel/i40e/i40e_ethdev.c        |  1 +
 drivers/net/intel/i40e/meson.build          |  4 ++--
 drivers/net/intel/iavf/base/meson.build     | 10 ---------
 drivers/net/intel/ice/base/ice_osdep.h      |  6 +++---
 drivers/net/intel/ice/base/ice_switch.c     |  2 --
 drivers/net/intel/ice/base/ice_type.h       |  2 +-
 drivers/net/intel/ice/base/meson.build      |  1 -
 drivers/net/intel/ice/ice_fdir_filter.c     |  2 +-
 drivers/net/intel/idpf/base/meson.build     |  2 +-
 drivers/net/intel/idpf/meson.build          |  7 ++++---
 drivers/net/intel/ixgbe/base/ixgbe_common.c |  4 ++--
 drivers/net/intel/ixgbe/base/ixgbe_e610.c   |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 21 +++++++++++--------
 drivers/net/intel/ixgbe/base/meson.build    | 20 ++----------------
 drivers/net/intel/ixgbe/meson.build         |  4 ++--
 24 files changed, 56 insertions(+), 103 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

--
2.45.2


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

* [PATCH 1/7] net/iavf/base: remove unused meson.build file
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 15:52 ` [PATCH 2/7] net/ixgbe/base: correct definition of macro Bruce Richardson
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Vladimir Medvedkin, Ian Stokes

The meson.build file in the base folder was never used, as the base
files were just included in the main sources list for iavf.

Fixes: f1fdc9ddba5e ("drivers: move iavf common folder to iavf net")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

diff --git a/drivers/net/intel/iavf/base/meson.build b/drivers/net/intel/iavf/base/meson.build
deleted file mode 100644
index 273e88e921..0000000000
--- a/drivers/net/intel/iavf/base/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019-2021 Intel Corporation
-
-sources = files('iavf_adminq.c', 'iavf_common.c', 'iavf_impl.c')
-
-if cc.has_argument('-Wno-pointer-to-int-cast')
-        cflags += '-Wno-pointer-to-int-cast'
-endif
-
-require_iova_in_mbuf = false
-- 
2.45.2


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

* [PATCH 2/7] net/ixgbe/base: correct definition of macro
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
  2025-03-26 15:52 ` [PATCH 1/7] net/iavf/base: remove unused meson.build file Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 15:52 ` [PATCH 3/7] net/ixgbe/base: fix compilation warnings Bruce Richardson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin

The definition of IXGBE_LE32_TO_CPUS macro is meant to modify the value
in place - similar to the le32_to_cpus() macro in kernel. Fixing the
definition allows us to remove some warning flags, and removes the need
for the uintptr_t typecasts.

Fixes: aa4fc14d2cee ("ixgbe: update base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_common.c | 4 ++--
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 2 +-
 drivers/net/intel/ixgbe/base/meson.build    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_common.c b/drivers/net/intel/ixgbe/base/ixgbe_common.c
index d6425c5b78..fbc9605e4d 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_common.c
@@ -4610,7 +4610,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* first pull in the header so we know the buffer length */
 	for (bi = 0; bi < dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 	/*
@@ -4646,7 +4646,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* Pull in the rest of the buffer (bi is where we left off) */
 	for (; bi <= dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 rel_out:
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index cffc6a4ce8..6e5f7b4ae8 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -83,7 +83,7 @@ enum {
 #define IXGBE_LE16_TO_CPU(_i)  rte_le_to_cpu_16(_i)
 #define IXGBE_LE32_TO_CPU(_i)  rte_le_to_cpu_32(_i)
 #define IXGBE_LE64_TO_CPU(_i)  rte_le_to_cpu_64(_i)
-#define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
+#define IXGBE_LE32_TO_CPUS(_i) do { *_i = rte_le_to_cpu_32(*_i); } while(0)
 #define IXGBE_CPU_TO_BE16(_i)  rte_cpu_to_be_16(_i)
 #define IXGBE_CPU_TO_BE32(_i)  rte_cpu_to_be_32(_i)
 #define IXGBE_BE32_TO_CPU(_i)  rte_be_to_cpu_32(_i)
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 7e4fbdfa0f..f8b2ee6341 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
-- 
2.45.2


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

* [PATCH 3/7] net/ixgbe/base: fix compilation warnings
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
  2025-03-26 15:52 ` [PATCH 1/7] net/iavf/base: remove unused meson.build file Bruce Richardson
  2025-03-26 15:52 ` [PATCH 2/7] net/ixgbe/base: correct definition of macro Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 15:52 ` [PATCH 4/7] net/i40e/base: fix unused value warnings Bruce Richardson
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin,
	Jedrzej Jagielski, Stefan Wegrzyn, Piotr Kwapulinski

We can remove almost all of the "unused parameter" and "unused variable"
warnings by just improving the macro definitions in the osdep.h header.
Remaining two instances can be fixed by just one-line additions to the
code, so add those to give us a clean build with the warnings enabled.

Fixes: af75078fece3 ("first public release")
Fixes: c6cb313da739 ("net/ixgbe/base: add link management for E610")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_e610.c  |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h | 19 +++++++++++--------
 drivers/net/intel/ixgbe/base/meson.build   | 11 -----------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_e610.c b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
index 5474c3012a..7420c78d07 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_e610.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
@@ -1054,6 +1054,7 @@ static void ixgbe_parse_vsi_func_caps(struct ixgbe_hw *hw,
 				      struct ixgbe_hw_func_caps *func_p,
 				      struct ixgbe_aci_cmd_list_caps_elem *cap)
 {
+	UNREFERENCED_PARAMETER(cap);
 	func_p->guar_num_vsi = ixgbe_get_num_per_func(hw, IXGBE_MAX_VSI);
 }
 
@@ -1770,6 +1771,7 @@ s32 ixgbe_aci_set_event_mask(struct ixgbe_hw *hw, u8 port_num, u16 mask)
 	struct ixgbe_aci_cmd_set_event_mask *cmd;
 	struct ixgbe_aci_desc desc;
 
+	UNREFERENCED_PARAMETER(port_num);
 	cmd = &desc.params.set_event_mask;
 
 	ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_event_mask);
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 6e5f7b4ae8..398c38bffd 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -57,13 +57,16 @@
 
 /* Bunch of defines for shared code bogosity */
 #ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(_p)  
+#define UNREFERENCED_PARAMETER(_p) (void)(_p)
 #endif
-#define UNREFERENCED_1PARAMETER(_p) 
-#define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) 
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) 
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) do { (void)(_p); (void)(_q); } while(0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while(0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while(0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while(0)
 
 /* Shared code error reporting */
 enum {
@@ -130,8 +133,8 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
 	IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
 
 /* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0	
-#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
+#define IXGBE_READ_PCIE_WORD(hw, reg)  ((void)hw, (void)(reg), 0)
+#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { (void)hw; (void)reg; (void)value; } while(0)
 
 #define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
 
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index f8b2ee6341..64e0bfd7be 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,17 +19,6 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
-        ]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('ixgbe_base', sources,
     dependencies: [static_rte_eal, static_rte_net],
     c_args: c_args)
-- 
2.45.2


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

* [PATCH 4/7] net/i40e/base: fix unused value warnings
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (2 preceding siblings ...)
  2025-03-26 15:52 ` [PATCH 3/7] net/ixgbe/base: fix compilation warnings Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 15:52 ` [PATCH 5/7] net/i40e/base: fix compiler warnings Bruce Richardson
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Ian Stokes, Helin Zhang, Jijiang Liu,
	Jingjing Wu, Jing Chen, Heqing Zhu

Fix warnings about unused values - parameters, variables, etc., and
remove the warning disable flags for them. Although modifying the
base-code files is not ideal, the changes required are minor, and only
affect two files from the imported base code.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
 drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
 drivers/net/intel/i40e/base/meson.build  |  3 ---
 drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
index 3e16a0d997..56dc4d9279 100644
--- a/drivers/net/intel/i40e/base/i40e_nvm.c
+++ b/drivers/net/intel/i40e/base/i40e_nvm.c
@@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
  **/
 STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
 						    struct i40e_nvm_access *cmd,
-						    u8 *bytes, int *perrno)
+						    u8 *bytes, __rte_unused int *perrno)
 {
 	u32 aq_total_len;
 	u32 aq_desc_len;
diff --git a/drivers/net/intel/i40e/base/i40e_osdep.h b/drivers/net/intel/i40e/base/i40e_osdep.h
index c04f94732a..197f4678bf 100644
--- a/drivers/net/intel/i40e/base/i40e_osdep.h
+++ b/drivers/net/intel/i40e/base/i40e_osdep.h
@@ -184,8 +184,8 @@ struct __rte_packed_begin i40e_dma_mem {
 	const void *zone;
 } __rte_packed_end;
 
-#define i40e_allocate_dma_mem(h, m, unused, s, a) \
-			i40e_allocate_dma_mem_d(h, m, s, a)
+#define i40e_allocate_dma_mem(h, m, mt, s, a) \
+			i40e_allocate_dma_mem_d(h, m, mt, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
 struct __rte_packed_begin i40e_virt_mem {
diff --git a/drivers/net/intel/i40e/base/i40e_type.h b/drivers/net/intel/i40e/base/i40e_type.h
index 7cc746f82f..968e1982a6 100644
--- a/drivers/net/intel/i40e/base/i40e_type.h
+++ b/drivers/net/intel/i40e/base/i40e_type.h
@@ -14,11 +14,15 @@
 #include "i40e_devids.h"
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p);
-#define UNREFERENCED_2PARAMETER(_p, _q) (_p); (_q);
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) (_p); (_q); (_r);
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (_p); (_q); (_r); (_s);
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (_p); (_q); (_r); (_s); (_t);
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) \
+	do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while (0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while (0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while (0)
 
 #define BIT(a) (1UL << (a))
 #define BIT_ULL(a) (1ULL << (a))
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index a0912b1788..2648e5d0c4 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -13,10 +13,7 @@ sources = [
 
 error_cflags = [
         '-Wno-sign-compare',
-        '-Wno-unused-value',
         '-Wno-strict-aliasing',
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
 ]
 c_args = cflags
 foreach flag: error_cflags
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 1c5ab35a8b..90eba3419f 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -4694,6 +4694,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
 enum i40e_status_code
 i40e_allocate_dma_mem_d(__rte_unused struct i40e_hw *hw,
 			struct i40e_dma_mem *mem,
+			__rte_unused enum i40e_memory_type mtype,
 			u64 size,
 			u32 alignment)
 {
-- 
2.45.2


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

* [PATCH 5/7] net/i40e/base: fix compiler warnings
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (3 preceding siblings ...)
  2025-03-26 15:52 ` [PATCH 4/7] net/i40e/base: fix unused value warnings Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 15:52 ` [PATCH 6/7] net/ice/base: reduce warnings for unused variables Bruce Richardson
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Ian Stokes, Jijiang Liu, Cunming Liang,
	Jing Chen, Jingjing Wu, Heqing Zhu

Add a single-line fix to the base code, and then the remaining two
compiler warning disable flags can be removed from the driver base code
build file.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_diag.c b/drivers/net/intel/i40e/base/i40e_diag.c
index 4ca102cdd5..71b2e53e85 100644
--- a/drivers/net/intel/i40e/base/i40e_diag.c
+++ b/drivers/net/intel/i40e/base/i40e_diag.c
@@ -34,7 +34,7 @@ static enum i40e_status_code i40e_diag_reg_pattern_test(struct i40e_hw *hw,
 {
 	const u32 patterns[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
 	u32 pat, val, orig_val;
-	int i;
+	unsigned int i;
 
 	orig_val = rd32(hw, reg);
 	for (i = 0; i < ARRAY_SIZE(patterns); i++) {
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 2648e5d0c4..766383101b 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -11,18 +11,7 @@ sources = [
         'i40e_nvm.c',
 ]
 
-error_cflags = [
-        '-Wno-sign-compare',
-        '-Wno-strict-aliasing',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('i40e_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH 6/7] net/ice/base: reduce warnings for unused variables
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (4 preceding siblings ...)
  2025-03-26 15:52 ` [PATCH 5/7] net/i40e/base: fix compiler warnings Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 15:52 ` [PATCH 7/7] net/intel: simplify base code builds Bruce Richardson
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Anatoly Burakov

Improve base code macros to reduce the number of issues with unused
variables in the code. Issues still remain with unused-but-set
variables, but completely unused variable warnings are eliminated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ice/base/ice_osdep.h  | 6 +++---
 drivers/net/intel/ice/base/ice_switch.c | 2 --
 drivers/net/intel/ice/base/ice_type.h   | 2 +-
 drivers/net/intel/ice/base/meson.build  | 1 -
 drivers/net/intel/ice/ice_fdir_filter.c | 2 +-
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 7b96fcde03..ad6cde9896 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -196,9 +196,9 @@ struct __rte_packed_begin ice_virt_mem {
 	u32 size;
 } __rte_packed_end;
 
-#define ice_malloc(h, s)    rte_zmalloc(NULL, s, 0)
-#define ice_calloc(h, c, s) rte_calloc(NULL, c, s, 0)
-#define ice_free(h, m)         rte_free(m)
+#define ice_malloc(h, s)    ((void)h, rte_zmalloc(NULL, s, 0))
+#define ice_calloc(h, c, s) ((void)h, rte_calloc(NULL, c, s, 0))
+#define ice_free(h, m)      ((void)h, rte_free(m))
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
diff --git a/drivers/net/intel/ice/base/ice_switch.c b/drivers/net/intel/ice/base/ice_switch.c
index a3786961e6..468a9f055d 100644
--- a/drivers/net/intel/ice/base/ice_switch.c
+++ b/drivers/net/intel/ice/base/ice_switch.c
@@ -8190,7 +8190,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_sw_recipe *rm;
 	u8 i;
 	int status = ICE_SUCCESS;
-	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
@@ -9795,7 +9794,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	bool remove_rule = false;
 	struct ice_lock *rule_lock; /* Lock to protect filter rule list */
 	u16 i, rid, vsi_handle;
-	bool is_add = false;
 	int status = ICE_SUCCESS;
 
 	ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
diff --git a/drivers/net/intel/ice/base/ice_type.h b/drivers/net/intel/ice/base/ice_type.h
index 35f832eb9f..297a5ea890 100644
--- a/drivers/net/intel/ice/base/ice_type.h
+++ b/drivers/net/intel/ice/base/ice_type.h
@@ -153,7 +153,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#define __ALWAYS_UNUSED
+#define __ALWAYS_UNUSED __rte_unused
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
diff --git a/drivers/net/intel/ice/base/meson.build b/drivers/net/intel/ice/base/meson.build
index 38d092c370..e7ba9c34bc 100644
--- a/drivers/net/intel/ice/base/meson.build
+++ b/drivers/net/intel/ice/base/meson.build
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 940fe171b6..2ff0090aca 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1090,7 +1090,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 		return -EINVAL;
 
 	seg_tun = (struct ice_flow_seg_info *)
-		ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
+		ice_malloc(pf->adapter->hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
 	if (!seg_tun) {
 		PMD_DRV_LOG(ERR, "No memory can be allocated");
 		return -ENOMEM;
-- 
2.45.2


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

* [PATCH 7/7] net/intel: simplify base code builds
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (5 preceding siblings ...)
  2025-03-26 15:52 ` [PATCH 6/7] net/ice/base: reduce warnings for unused variables Bruce Richardson
@ 2025-03-26 15:52 ` Bruce Richardson
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 15:52 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Ian Stokes, Jingjing Wu, Praveen Shetty,
	Anatoly Burakov, Vladimir Medvedkin

Now that base-code warning flags have been removed from a number of
drivers, we can simplify their build configuration by just including the
base code files in the regular list of driver files passed back. There
is no need to use pre-compiled objects.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/e1000/base/meson.build | 9 ++-------
 drivers/net/intel/e1000/meson.build      | 4 ++--
 drivers/net/intel/fm10k/base/meson.build | 9 ++-------
 drivers/net/intel/fm10k/meson.build      | 4 ++--
 drivers/net/intel/i40e/base/meson.build  | 9 ++-------
 drivers/net/intel/i40e/meson.build       | 4 ++--
 drivers/net/intel/idpf/base/meson.build  | 2 +-
 drivers/net/intel/idpf/meson.build       | 7 ++++---
 drivers/net/intel/ixgbe/base/meson.build | 9 ++-------
 drivers/net/intel/ixgbe/meson.build      | 4 ++--
 10 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/drivers/net/intel/e1000/base/meson.build b/drivers/net/intel/e1000/base/meson.build
index 8cbd9f62e6..4fe86dc6df 100644
--- a/drivers/net/intel/e1000/base/meson.build
+++ b/drivers/net/intel/e1000/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'e1000_base.c',
         'e1000_80003es2lan.c',
         'e1000_82540.c',
@@ -21,9 +21,4 @@ sources = [
         'e1000_osdep.c',
         'e1000_phy.c',
         'e1000_vf.c',
-]
-
-base_lib = static_library('e1000_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/e1000/meson.build b/drivers/net/intel/e1000/meson.build
index cd42c0042a..b52a843228 100644
--- a/drivers/net/intel/e1000/meson.build
+++ b/drivers/net/intel/e1000/meson.build
@@ -2,9 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'e1000_logs.c',
         'em_ethdev.c',
         'em_rxtx.c',
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index a2640d1ee8..c45b31d6b2 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -1,16 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'fm10k_api.c',
         'fm10k_common.c',
         'fm10k_mbx.c',
         'fm10k_pf.c',
         'fm10k_tlv.c',
         'fm10k_vf.c',
-]
-
-base_lib = static_library('fm10k_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/fm10k/meson.build b/drivers/net/intel/fm10k/meson.build
index 69566add96..e08a00cb49 100644
--- a/drivers/net/intel/fm10k/meson.build
+++ b/drivers/net/intel/fm10k/meson.build
@@ -8,9 +8,9 @@ if is_windows
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'fm10k_ethdev.c',
         'fm10k_rxtx.c',
 )
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 766383101b..7b4882ad1d 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2020 Intel Corporation
 
-sources = [
+base_sources = files(
         'i40e_adminq.c',
         'i40e_common.c',
         'i40e_dcb.c',
@@ -9,9 +9,4 @@ sources = [
         'i40e_hmc.c',
         'i40e_lan_hmc.c',
         'i40e_nvm.c',
-]
-
-base_lib = static_library('i40e_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build
index 15993393fb..17b6715cd9 100644
--- a/drivers/net/intel/i40e/meson.build
+++ b/drivers/net/intel/i40e/meson.build
@@ -18,9 +18,9 @@ if dpdk_conf.get('RTE_IOVA_IN_MBUF') == 0
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'i40e_ethdev.c',
         'i40e_rxtx.c',
         'i40e_pf.c',
diff --git a/drivers/net/intel/idpf/base/meson.build b/drivers/net/intel/idpf/base/meson.build
index 7316e0a805..78782e463e 100644
--- a/drivers/net/intel/idpf/base/meson.build
+++ b/drivers/net/intel/idpf/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 Intel Corporation
 
-sources += files(
+base_sources = files(
         'idpf_controlq.c',
         'idpf_controlq_setup.c',
 )
diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build
index 4b272d02b1..a8690da87b 100644
--- a/drivers/net/intel/idpf/meson.build
+++ b/drivers/net/intel/idpf/meson.build
@@ -7,9 +7,12 @@ if is_windows
     subdir_done()
 endif
 
+subdir('base')
+
 includes += include_directories('../iavf/base')
 
-sources = files(
+sources += base_sources
+sources += files(
         'idpf_common_device.c',
         'idpf_common_rxtx.c',
         'idpf_common_virtchnl.c',
@@ -43,5 +46,3 @@ if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1
         objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c')
     endif
 endif
-
-subdir('base')
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 64e0bfd7be..df42a34369 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2024 Intel Corporation
 
-sources = [
+base_sources = files(
         'ixgbe_82598.c',
         'ixgbe_82599.c',
         'ixgbe_api.c',
@@ -17,9 +17,4 @@ sources = [
         'ixgbe_vf.c',
         'ixgbe_x540.c',
         'ixgbe_x550.c',
-]
-
-base_lib = static_library('ixgbe_base', sources,
-    dependencies: [static_rte_eal, static_rte_net],
-    c_args: c_args)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/ixgbe/meson.build b/drivers/net/intel/ixgbe/meson.build
index 0bee736a2c..23f5a6cb3e 100644
--- a/drivers/net/intel/ixgbe/meson.build
+++ b/drivers/net/intel/ixgbe/meson.build
@@ -4,9 +4,9 @@
 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'ixgbe_82599_bypass.c',
         'ixgbe_bypass.c',
         'ixgbe_ethdev.c',
-- 
2.45.2


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

* [PATCH v2 0/8] net/intel: clean up base code build
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (6 preceding siblings ...)
  2025-03-26 15:52 ` [PATCH 7/7] net/intel: simplify base code builds Bruce Richardson
@ 2025-03-26 16:05 ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 1/8] net/fm10k/base: fix compilation warnings Bruce Richardson
                     ` (7 more replies)
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
  9 siblings, 8 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Simplify the build of the various intel base code directories, by
clearing compiler warnings so the files can be compiled directly along
with the regular driver files.

v2: added missing patch for fm10k

Bruce Richardson (8):
  net/fm10k/base: fix compilation warnings
  net/iavf/base: remove unused meson.build file
  net/ixgbe/base: correct definition of macro
  net/ixgbe/base: fix compilation warnings
  net/i40e/base: fix unused value warnings
  net/i40e/base: fix compiler warnings
  net/ice/base: reduce warnings for unused variables
  net/intel: simplify base code builds

 drivers/net/intel/e1000/base/meson.build    |  9 ++------
 drivers/net/intel/e1000/meson.build         |  4 ++--
 drivers/net/intel/fm10k/base/fm10k_mbx.c    |  2 +-
 drivers/net/intel/fm10k/base/fm10k_osdep.h  |  2 +-
 drivers/net/intel/fm10k/base/fm10k_pf.c     |  8 +++----
 drivers/net/intel/fm10k/base/fm10k_type.h   |  6 +++---
 drivers/net/intel/fm10k/base/meson.build    | 21 ++-----------------
 drivers/net/intel/fm10k/meson.build         |  4 ++--
 drivers/net/intel/i40e/base/i40e_diag.c     |  2 +-
 drivers/net/intel/i40e/base/i40e_nvm.c      |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h    |  4 ++--
 drivers/net/intel/i40e/base/i40e_type.h     | 14 ++++++++-----
 drivers/net/intel/i40e/base/meson.build     | 23 ++-------------------
 drivers/net/intel/i40e/i40e_ethdev.c        |  1 +
 drivers/net/intel/i40e/meson.build          |  4 ++--
 drivers/net/intel/iavf/base/meson.build     | 10 ---------
 drivers/net/intel/ice/base/ice_osdep.h      |  6 +++---
 drivers/net/intel/ice/base/ice_switch.c     |  2 --
 drivers/net/intel/ice/base/ice_type.h       |  2 +-
 drivers/net/intel/ice/base/meson.build      |  1 -
 drivers/net/intel/ice/ice_fdir_filter.c     |  2 +-
 drivers/net/intel/idpf/base/meson.build     |  2 +-
 drivers/net/intel/idpf/meson.build          |  7 ++++---
 drivers/net/intel/ixgbe/base/ixgbe_common.c |  4 ++--
 drivers/net/intel/ixgbe/base/ixgbe_e610.c   |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 21 +++++++++++--------
 drivers/net/intel/ixgbe/base/meson.build    | 20 ++----------------
 drivers/net/intel/ixgbe/meson.build         |  4 ++--
 28 files changed, 65 insertions(+), 124 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

--
2.45.2


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

* [PATCH v2 1/8] net/fm10k/base: fix compilation warnings
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 2/8] net/iavf/base: remove unused meson.build file Bruce Richardson
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, stable, Jing Chen

The fixes required to re-enable warnings in the fm10k base code are
trivial, so let's make the changes and get a clean compile without any
warning disable flags.

* provide definitions for the UNREFERENCED_PARAMETER macros
* fix the spelling of the work "fallthrough" in comments
* provide a definition of FM10K_READ_PCI_WORD in os_dep.h that marks the
  parameters as used.

Fixes: 7223d200c227 ("fm10k: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/fm10k/base/fm10k_mbx.c   |  2 +-
 drivers/net/intel/fm10k/base/fm10k_osdep.h |  2 +-
 drivers/net/intel/fm10k/base/fm10k_pf.c    |  8 ++++----
 drivers/net/intel/fm10k/base/fm10k_type.h  |  6 +++---
 drivers/net/intel/fm10k/base/meson.build   | 14 +-------------
 5 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/net/intel/fm10k/base/fm10k_mbx.c b/drivers/net/intel/fm10k/base/fm10k_mbx.c
index 2bb0d82efe..9028403757 100644
--- a/drivers/net/intel/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/intel/fm10k/base/fm10k_mbx.c
@@ -1602,7 +1602,7 @@ s32 fm10k_pfvf_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
 			mbx->mbmem_reg = FM10K_MBMEM_VF(id, 0);
 			break;
 		}
-		/* fallthough */
+		/* fallthrough */
 	default:
 		return FM10K_MBX_ERR_NO_MBX;
 	}
diff --git a/drivers/net/intel/fm10k/base/fm10k_osdep.h b/drivers/net/intel/fm10k/base/fm10k_osdep.h
index a727a57481..5f8ff10474 100644
--- a/drivers/net/intel/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/intel/fm10k/base/fm10k_osdep.h
@@ -67,7 +67,7 @@ typedef uint64_t   u64;
 #define FM10K_PCI_REG_WRITE(reg, value) rte_write32((value), (reg))
 
 /* not implemented */
-#define FM10K_READ_PCI_WORD(hw, reg)     0
+#define FM10K_READ_PCI_WORD(hw, reg)     ((void)hw, (void)reg, 0)
 
 #define FM10K_WRITE_MBX(hw, reg, value) FM10K_WRITE_REG(hw, reg, value)
 #define FM10K_READ_MBX(hw, reg) FM10K_READ_REG(hw, reg)
diff --git a/drivers/net/intel/fm10k/base/fm10k_pf.c b/drivers/net/intel/fm10k/base/fm10k_pf.c
index 439dd224de..b54116a4b5 100644
--- a/drivers/net/intel/fm10k/base/fm10k_pf.c
+++ b/drivers/net/intel/fm10k/base/fm10k_pf.c
@@ -1362,19 +1362,19 @@ STATIC u8 fm10k_iov_supported_xcast_mode_pf(struct fm10k_vf_info *vf_info,
 	case FM10K_XCAST_MODE_PROMISC:
 		if (vf_flags & FM10K_VF_FLAG_PROMISC_CAPABLE)
 			return FM10K_XCAST_MODE_PROMISC;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_ALLMULTI:
 		if (vf_flags & FM10K_VF_FLAG_ALLMULTI_CAPABLE)
 			return FM10K_XCAST_MODE_ALLMULTI;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_MULTI:
 		if (vf_flags & FM10K_VF_FLAG_MULTI_CAPABLE)
 			return FM10K_XCAST_MODE_MULTI;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_NONE:
 		if (vf_flags & FM10K_VF_FLAG_NONE_CAPABLE)
 			return FM10K_XCAST_MODE_NONE;
-		/* fallthough */
+		/* fallthrough */
 	default:
 		break;
 	}
diff --git a/drivers/net/intel/fm10k/base/fm10k_type.h b/drivers/net/intel/fm10k/base/fm10k_type.h
index 84781ba9b2..437fb1c55e 100644
--- a/drivers/net/intel/fm10k/base/fm10k_type.h
+++ b/drivers/net/intel/fm10k/base/fm10k_type.h
@@ -83,9 +83,9 @@ struct fm10k_hw;
 #define FM10K_NOT_IMPLEMENTED			0x7FFFFFFF
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p)
-#define UNREFERENCED_2PARAMETER(_p, _q)	    do { (_p); (_q); } while (0)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) do { (_p); (_q); (_r); } while (0)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q)	    do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) do { (void)(_p); (void)(_q); (void)(_r); } while (0)
 
 /* Start of PF registers */
 #define FM10K_CTRL		0x0000
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index f24e453fd0..a2640d1ee8 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -10,19 +10,7 @@ sources = [
         'fm10k_vf.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-parameter',
-        '-Wno-unused-value',
-        '-Wno-implicit-fallthrough',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('fm10k_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH v2 2/8] net/iavf/base: remove unused meson.build file
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 1/8] net/fm10k/base: fix compilation warnings Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 3/8] net/ixgbe/base: correct definition of macro Bruce Richardson
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Vladimir Medvedkin, Ian Stokes

The meson.build file in the base folder was never used, as the base
files were just included in the main sources list for iavf.

Fixes: f1fdc9ddba5e ("drivers: move iavf common folder to iavf net")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

diff --git a/drivers/net/intel/iavf/base/meson.build b/drivers/net/intel/iavf/base/meson.build
deleted file mode 100644
index 273e88e921..0000000000
--- a/drivers/net/intel/iavf/base/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019-2021 Intel Corporation
-
-sources = files('iavf_adminq.c', 'iavf_common.c', 'iavf_impl.c')
-
-if cc.has_argument('-Wno-pointer-to-int-cast')
-        cflags += '-Wno-pointer-to-int-cast'
-endif
-
-require_iova_in_mbuf = false
-- 
2.45.2


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

* [PATCH v2 3/8] net/ixgbe/base: correct definition of macro
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 1/8] net/fm10k/base: fix compilation warnings Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 2/8] net/iavf/base: remove unused meson.build file Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 4/8] net/ixgbe/base: fix compilation warnings Bruce Richardson
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin

The definition of IXGBE_LE32_TO_CPUS macro is meant to modify the value
in place - similar to the le32_to_cpus() macro in kernel. Fixing the
definition allows us to remove some warning flags, and removes the need
for the uintptr_t typecasts.

Fixes: aa4fc14d2cee ("ixgbe: update base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_common.c | 4 ++--
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 2 +-
 drivers/net/intel/ixgbe/base/meson.build    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_common.c b/drivers/net/intel/ixgbe/base/ixgbe_common.c
index d6425c5b78..fbc9605e4d 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_common.c
@@ -4610,7 +4610,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* first pull in the header so we know the buffer length */
 	for (bi = 0; bi < dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 	/*
@@ -4646,7 +4646,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* Pull in the rest of the buffer (bi is where we left off) */
 	for (; bi <= dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 rel_out:
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index cffc6a4ce8..6e5f7b4ae8 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -83,7 +83,7 @@ enum {
 #define IXGBE_LE16_TO_CPU(_i)  rte_le_to_cpu_16(_i)
 #define IXGBE_LE32_TO_CPU(_i)  rte_le_to_cpu_32(_i)
 #define IXGBE_LE64_TO_CPU(_i)  rte_le_to_cpu_64(_i)
-#define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
+#define IXGBE_LE32_TO_CPUS(_i) do { *_i = rte_le_to_cpu_32(*_i); } while(0)
 #define IXGBE_CPU_TO_BE16(_i)  rte_cpu_to_be_16(_i)
 #define IXGBE_CPU_TO_BE32(_i)  rte_cpu_to_be_32(_i)
 #define IXGBE_BE32_TO_CPU(_i)  rte_be_to_cpu_32(_i)
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 7e4fbdfa0f..f8b2ee6341 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
-- 
2.45.2


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

* [PATCH v2 4/8] net/ixgbe/base: fix compilation warnings
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
                     ` (2 preceding siblings ...)
  2025-03-26 16:05   ` [PATCH v2 3/8] net/ixgbe/base: correct definition of macro Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 5/8] net/i40e/base: fix unused value warnings Bruce Richardson
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin,
	Piotr Kwapulinski, Jedrzej Jagielski, Stefan Wegrzyn

We can remove almost all of the "unused parameter" and "unused variable"
warnings by just improving the macro definitions in the osdep.h header.
Remaining two instances can be fixed by just one-line additions to the
code, so add those to give us a clean build with the warnings enabled.

Fixes: af75078fece3 ("first public release")
Fixes: c6cb313da739 ("net/ixgbe/base: add link management for E610")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_e610.c  |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h | 19 +++++++++++--------
 drivers/net/intel/ixgbe/base/meson.build   | 11 -----------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_e610.c b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
index 5474c3012a..7420c78d07 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_e610.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
@@ -1054,6 +1054,7 @@ static void ixgbe_parse_vsi_func_caps(struct ixgbe_hw *hw,
 				      struct ixgbe_hw_func_caps *func_p,
 				      struct ixgbe_aci_cmd_list_caps_elem *cap)
 {
+	UNREFERENCED_PARAMETER(cap);
 	func_p->guar_num_vsi = ixgbe_get_num_per_func(hw, IXGBE_MAX_VSI);
 }
 
@@ -1770,6 +1771,7 @@ s32 ixgbe_aci_set_event_mask(struct ixgbe_hw *hw, u8 port_num, u16 mask)
 	struct ixgbe_aci_cmd_set_event_mask *cmd;
 	struct ixgbe_aci_desc desc;
 
+	UNREFERENCED_PARAMETER(port_num);
 	cmd = &desc.params.set_event_mask;
 
 	ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_event_mask);
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 6e5f7b4ae8..398c38bffd 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -57,13 +57,16 @@
 
 /* Bunch of defines for shared code bogosity */
 #ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(_p)  
+#define UNREFERENCED_PARAMETER(_p) (void)(_p)
 #endif
-#define UNREFERENCED_1PARAMETER(_p) 
-#define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) 
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) 
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) do { (void)(_p); (void)(_q); } while(0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while(0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while(0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while(0)
 
 /* Shared code error reporting */
 enum {
@@ -130,8 +133,8 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
 	IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
 
 /* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0	
-#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
+#define IXGBE_READ_PCIE_WORD(hw, reg)  ((void)hw, (void)(reg), 0)
+#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { (void)hw; (void)reg; (void)value; } while(0)
 
 #define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
 
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index f8b2ee6341..64e0bfd7be 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,17 +19,6 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
-        ]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('ixgbe_base', sources,
     dependencies: [static_rte_eal, static_rte_net],
     c_args: c_args)
-- 
2.45.2


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

* [PATCH v2 5/8] net/i40e/base: fix unused value warnings
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
                     ` (3 preceding siblings ...)
  2025-03-26 16:05   ` [PATCH v2 4/8] net/ixgbe/base: fix compilation warnings Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 6/8] net/i40e/base: fix compiler warnings Bruce Richardson
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Ian Stokes, Jijiang Liu, Cunming Liang,
	Heqing Zhu, Jing Chen, Jingjing Wu

Fix warnings about unused values - parameters, variables, etc., and
remove the warning disable flags for them. Although modifying the
base-code files is not ideal, the changes required are minor, and only
affect two files from the imported base code.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
 drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
 drivers/net/intel/i40e/base/meson.build  |  3 ---
 drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
index 3e16a0d997..56dc4d9279 100644
--- a/drivers/net/intel/i40e/base/i40e_nvm.c
+++ b/drivers/net/intel/i40e/base/i40e_nvm.c
@@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
  **/
 STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
 						    struct i40e_nvm_access *cmd,
-						    u8 *bytes, int *perrno)
+						    u8 *bytes, __rte_unused int *perrno)
 {
 	u32 aq_total_len;
 	u32 aq_desc_len;
diff --git a/drivers/net/intel/i40e/base/i40e_osdep.h b/drivers/net/intel/i40e/base/i40e_osdep.h
index c04f94732a..197f4678bf 100644
--- a/drivers/net/intel/i40e/base/i40e_osdep.h
+++ b/drivers/net/intel/i40e/base/i40e_osdep.h
@@ -184,8 +184,8 @@ struct __rte_packed_begin i40e_dma_mem {
 	const void *zone;
 } __rte_packed_end;
 
-#define i40e_allocate_dma_mem(h, m, unused, s, a) \
-			i40e_allocate_dma_mem_d(h, m, s, a)
+#define i40e_allocate_dma_mem(h, m, mt, s, a) \
+			i40e_allocate_dma_mem_d(h, m, mt, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
 struct __rte_packed_begin i40e_virt_mem {
diff --git a/drivers/net/intel/i40e/base/i40e_type.h b/drivers/net/intel/i40e/base/i40e_type.h
index 7cc746f82f..968e1982a6 100644
--- a/drivers/net/intel/i40e/base/i40e_type.h
+++ b/drivers/net/intel/i40e/base/i40e_type.h
@@ -14,11 +14,15 @@
 #include "i40e_devids.h"
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p);
-#define UNREFERENCED_2PARAMETER(_p, _q) (_p); (_q);
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) (_p); (_q); (_r);
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (_p); (_q); (_r); (_s);
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (_p); (_q); (_r); (_s); (_t);
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) \
+	do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while (0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while (0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while (0)
 
 #define BIT(a) (1UL << (a))
 #define BIT_ULL(a) (1ULL << (a))
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index a0912b1788..2648e5d0c4 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -13,10 +13,7 @@ sources = [
 
 error_cflags = [
         '-Wno-sign-compare',
-        '-Wno-unused-value',
         '-Wno-strict-aliasing',
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
 ]
 c_args = cflags
 foreach flag: error_cflags
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 1c5ab35a8b..90eba3419f 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -4694,6 +4694,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
 enum i40e_status_code
 i40e_allocate_dma_mem_d(__rte_unused struct i40e_hw *hw,
 			struct i40e_dma_mem *mem,
+			__rte_unused enum i40e_memory_type mtype,
 			u64 size,
 			u32 alignment)
 {
-- 
2.45.2


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

* [PATCH v2 6/8] net/i40e/base: fix compiler warnings
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
                     ` (4 preceding siblings ...)
  2025-03-26 16:05   ` [PATCH v2 5/8] net/i40e/base: fix unused value warnings Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 7/8] net/ice/base: reduce warnings for unused variables Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 8/8] net/intel: simplify base code builds Bruce Richardson
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Ian Stokes, Jingjing Wu, Heqing Zhu,
	Jijiang Liu, Jing Chen, Cunming Liang

Add a single-line fix to the base code, and then the remaining two
compiler warning disable flags can be removed from the driver base code
build file.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_diag.c b/drivers/net/intel/i40e/base/i40e_diag.c
index 4ca102cdd5..71b2e53e85 100644
--- a/drivers/net/intel/i40e/base/i40e_diag.c
+++ b/drivers/net/intel/i40e/base/i40e_diag.c
@@ -34,7 +34,7 @@ static enum i40e_status_code i40e_diag_reg_pattern_test(struct i40e_hw *hw,
 {
 	const u32 patterns[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
 	u32 pat, val, orig_val;
-	int i;
+	unsigned int i;
 
 	orig_val = rd32(hw, reg);
 	for (i = 0; i < ARRAY_SIZE(patterns); i++) {
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 2648e5d0c4..766383101b 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -11,18 +11,7 @@ sources = [
         'i40e_nvm.c',
 ]
 
-error_cflags = [
-        '-Wno-sign-compare',
-        '-Wno-strict-aliasing',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('i40e_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH v2 7/8] net/ice/base: reduce warnings for unused variables
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
                     ` (5 preceding siblings ...)
  2025-03-26 16:05   ` [PATCH v2 6/8] net/i40e/base: fix compiler warnings Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  2025-03-26 16:05   ` [PATCH v2 8/8] net/intel: simplify base code builds Bruce Richardson
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Anatoly Burakov

Improve base code macros to reduce the number of issues with unused
variables in the code. Issues still remain with unused-but-set
variables, but completely unused variable warnings are eliminated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ice/base/ice_osdep.h  | 6 +++---
 drivers/net/intel/ice/base/ice_switch.c | 2 --
 drivers/net/intel/ice/base/ice_type.h   | 2 +-
 drivers/net/intel/ice/base/meson.build  | 1 -
 drivers/net/intel/ice/ice_fdir_filter.c | 2 +-
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 7b96fcde03..ad6cde9896 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -196,9 +196,9 @@ struct __rte_packed_begin ice_virt_mem {
 	u32 size;
 } __rte_packed_end;
 
-#define ice_malloc(h, s)    rte_zmalloc(NULL, s, 0)
-#define ice_calloc(h, c, s) rte_calloc(NULL, c, s, 0)
-#define ice_free(h, m)         rte_free(m)
+#define ice_malloc(h, s)    ((void)h, rte_zmalloc(NULL, s, 0))
+#define ice_calloc(h, c, s) ((void)h, rte_calloc(NULL, c, s, 0))
+#define ice_free(h, m)      ((void)h, rte_free(m))
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
diff --git a/drivers/net/intel/ice/base/ice_switch.c b/drivers/net/intel/ice/base/ice_switch.c
index a3786961e6..468a9f055d 100644
--- a/drivers/net/intel/ice/base/ice_switch.c
+++ b/drivers/net/intel/ice/base/ice_switch.c
@@ -8190,7 +8190,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_sw_recipe *rm;
 	u8 i;
 	int status = ICE_SUCCESS;
-	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
@@ -9795,7 +9794,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	bool remove_rule = false;
 	struct ice_lock *rule_lock; /* Lock to protect filter rule list */
 	u16 i, rid, vsi_handle;
-	bool is_add = false;
 	int status = ICE_SUCCESS;
 
 	ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
diff --git a/drivers/net/intel/ice/base/ice_type.h b/drivers/net/intel/ice/base/ice_type.h
index 35f832eb9f..297a5ea890 100644
--- a/drivers/net/intel/ice/base/ice_type.h
+++ b/drivers/net/intel/ice/base/ice_type.h
@@ -153,7 +153,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#define __ALWAYS_UNUSED
+#define __ALWAYS_UNUSED __rte_unused
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
diff --git a/drivers/net/intel/ice/base/meson.build b/drivers/net/intel/ice/base/meson.build
index 38d092c370..e7ba9c34bc 100644
--- a/drivers/net/intel/ice/base/meson.build
+++ b/drivers/net/intel/ice/base/meson.build
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 940fe171b6..2ff0090aca 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1090,7 +1090,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 		return -EINVAL;
 
 	seg_tun = (struct ice_flow_seg_info *)
-		ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
+		ice_malloc(pf->adapter->hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
 	if (!seg_tun) {
 		PMD_DRV_LOG(ERR, "No memory can be allocated");
 		return -ENOMEM;
-- 
2.45.2


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

* [PATCH v2 8/8] net/intel: simplify base code builds
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
                     ` (6 preceding siblings ...)
  2025-03-26 16:05   ` [PATCH v2 7/8] net/ice/base: reduce warnings for unused variables Bruce Richardson
@ 2025-03-26 16:05   ` Bruce Richardson
  7 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-26 16:05 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Ian Stokes, Jingjing Wu, Praveen Shetty,
	Anatoly Burakov, Vladimir Medvedkin

Now that base-code warning flags have been removed from a number of
drivers, we can simplify their build configuration by just including the
base code files in the regular list of driver files passed back. There
is no need to use pre-compiled objects.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/e1000/base/meson.build | 9 ++-------
 drivers/net/intel/e1000/meson.build      | 4 ++--
 drivers/net/intel/fm10k/base/meson.build | 9 ++-------
 drivers/net/intel/fm10k/meson.build      | 4 ++--
 drivers/net/intel/i40e/base/meson.build  | 9 ++-------
 drivers/net/intel/i40e/meson.build       | 4 ++--
 drivers/net/intel/idpf/base/meson.build  | 2 +-
 drivers/net/intel/idpf/meson.build       | 7 ++++---
 drivers/net/intel/ixgbe/base/meson.build | 9 ++-------
 drivers/net/intel/ixgbe/meson.build      | 4 ++--
 10 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/drivers/net/intel/e1000/base/meson.build b/drivers/net/intel/e1000/base/meson.build
index 8cbd9f62e6..4fe86dc6df 100644
--- a/drivers/net/intel/e1000/base/meson.build
+++ b/drivers/net/intel/e1000/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'e1000_base.c',
         'e1000_80003es2lan.c',
         'e1000_82540.c',
@@ -21,9 +21,4 @@ sources = [
         'e1000_osdep.c',
         'e1000_phy.c',
         'e1000_vf.c',
-]
-
-base_lib = static_library('e1000_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/e1000/meson.build b/drivers/net/intel/e1000/meson.build
index cd42c0042a..b52a843228 100644
--- a/drivers/net/intel/e1000/meson.build
+++ b/drivers/net/intel/e1000/meson.build
@@ -2,9 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'e1000_logs.c',
         'em_ethdev.c',
         'em_rxtx.c',
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index a2640d1ee8..c45b31d6b2 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -1,16 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'fm10k_api.c',
         'fm10k_common.c',
         'fm10k_mbx.c',
         'fm10k_pf.c',
         'fm10k_tlv.c',
         'fm10k_vf.c',
-]
-
-base_lib = static_library('fm10k_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/fm10k/meson.build b/drivers/net/intel/fm10k/meson.build
index 69566add96..e08a00cb49 100644
--- a/drivers/net/intel/fm10k/meson.build
+++ b/drivers/net/intel/fm10k/meson.build
@@ -8,9 +8,9 @@ if is_windows
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'fm10k_ethdev.c',
         'fm10k_rxtx.c',
 )
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 766383101b..7b4882ad1d 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2020 Intel Corporation
 
-sources = [
+base_sources = files(
         'i40e_adminq.c',
         'i40e_common.c',
         'i40e_dcb.c',
@@ -9,9 +9,4 @@ sources = [
         'i40e_hmc.c',
         'i40e_lan_hmc.c',
         'i40e_nvm.c',
-]
-
-base_lib = static_library('i40e_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build
index 15993393fb..17b6715cd9 100644
--- a/drivers/net/intel/i40e/meson.build
+++ b/drivers/net/intel/i40e/meson.build
@@ -18,9 +18,9 @@ if dpdk_conf.get('RTE_IOVA_IN_MBUF') == 0
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'i40e_ethdev.c',
         'i40e_rxtx.c',
         'i40e_pf.c',
diff --git a/drivers/net/intel/idpf/base/meson.build b/drivers/net/intel/idpf/base/meson.build
index 7316e0a805..78782e463e 100644
--- a/drivers/net/intel/idpf/base/meson.build
+++ b/drivers/net/intel/idpf/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 Intel Corporation
 
-sources += files(
+base_sources = files(
         'idpf_controlq.c',
         'idpf_controlq_setup.c',
 )
diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build
index 4b272d02b1..a8690da87b 100644
--- a/drivers/net/intel/idpf/meson.build
+++ b/drivers/net/intel/idpf/meson.build
@@ -7,9 +7,12 @@ if is_windows
     subdir_done()
 endif
 
+subdir('base')
+
 includes += include_directories('../iavf/base')
 
-sources = files(
+sources += base_sources
+sources += files(
         'idpf_common_device.c',
         'idpf_common_rxtx.c',
         'idpf_common_virtchnl.c',
@@ -43,5 +46,3 @@ if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1
         objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c')
     endif
 endif
-
-subdir('base')
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 64e0bfd7be..df42a34369 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2024 Intel Corporation
 
-sources = [
+base_sources = files(
         'ixgbe_82598.c',
         'ixgbe_82599.c',
         'ixgbe_api.c',
@@ -17,9 +17,4 @@ sources = [
         'ixgbe_vf.c',
         'ixgbe_x540.c',
         'ixgbe_x550.c',
-]
-
-base_lib = static_library('ixgbe_base', sources,
-    dependencies: [static_rte_eal, static_rte_net],
-    c_args: c_args)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/ixgbe/meson.build b/drivers/net/intel/ixgbe/meson.build
index 0bee736a2c..23f5a6cb3e 100644
--- a/drivers/net/intel/ixgbe/meson.build
+++ b/drivers/net/intel/ixgbe/meson.build
@@ -4,9 +4,9 @@
 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'ixgbe_82599_bypass.c',
         'ixgbe_bypass.c',
         'ixgbe_ethdev.c',
-- 
2.45.2


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

* [PATCH v3 0/9] net/intel: clean up base code build
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (7 preceding siblings ...)
  2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
@ 2025-03-27 14:51 ` Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
                     ` (9 more replies)
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
  9 siblings, 10 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Simplify the build of the various intel base code directories, by
clearing compiler warnings so the files can be compiled directly along
with the regular driver files.

v3: add fix for lock checker issues on FreeBSD
v2: added missing patch for fm10k

Bruce Richardson (9):
  net/fm10k/base: fix compilation warnings
  net/iavf/base: remove unused meson.build file
  net/ixgbe/base: correct definition of macro
  net/ixgbe/base: fix compilation warnings
  net/ixgbe/base: fix lock checker errors
  net/i40e/base: fix unused value warnings
  net/i40e/base: fix compiler warnings
  net/ice/base: reduce warnings for unused variables
  net/intel: simplify base code builds

 drivers/net/intel/e1000/base/meson.build    |  9 ++-----
 drivers/net/intel/e1000/meson.build         |  4 +--
 drivers/net/intel/fm10k/base/fm10k_mbx.c    |  2 +-
 drivers/net/intel/fm10k/base/fm10k_osdep.h  |  2 +-
 drivers/net/intel/fm10k/base/fm10k_pf.c     |  8 +++---
 drivers/net/intel/fm10k/base/fm10k_type.h   |  6 ++---
 drivers/net/intel/fm10k/base/meson.build    | 21 ++-------------
 drivers/net/intel/fm10k/meson.build         |  4 +--
 drivers/net/intel/i40e/base/i40e_diag.c     |  2 +-
 drivers/net/intel/i40e/base/i40e_nvm.c      |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h    |  4 +--
 drivers/net/intel/i40e/base/i40e_type.h     | 14 ++++++----
 drivers/net/intel/i40e/base/meson.build     | 23 ++--------------
 drivers/net/intel/i40e/i40e_ethdev.c        |  1 +
 drivers/net/intel/i40e/meson.build          |  4 +--
 drivers/net/intel/iavf/base/meson.build     | 10 -------
 drivers/net/intel/ice/base/ice_osdep.h      |  6 ++---
 drivers/net/intel/ice/base/ice_switch.c     |  2 --
 drivers/net/intel/ice/base/ice_type.h       |  2 +-
 drivers/net/intel/ice/base/meson.build      |  1 -
 drivers/net/intel/ice/ice_fdir_filter.c     |  2 +-
 drivers/net/intel/idpf/base/meson.build     |  2 +-
 drivers/net/intel/idpf/meson.build          |  7 ++---
 drivers/net/intel/ixgbe/base/ixgbe_common.c |  4 +--
 drivers/net/intel/ixgbe/base/ixgbe_e610.c   |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.c  | 20 --------------
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 29 ++++++++++++---------
 drivers/net/intel/ixgbe/base/meson.build    | 20 ++------------
 drivers/net/intel/ixgbe/meson.build         |  4 +--
 29 files changed, 69 insertions(+), 148 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

--
2.45.2


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

* [PATCH v3 1/9] net/fm10k/base: fix compilation warnings
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, stable, Jing Chen

The fixes required to re-enable warnings in the fm10k base code are
trivial, so let's make the changes and get a clean compile without any
warning disable flags.

* provide definitions for the UNREFERENCED_PARAMETER macros
* fix the spelling of the work "fallthrough" in comments
* provide a definition of FM10K_READ_PCI_WORD in os_dep.h that marks the
  parameters as used.

Fixes: 7223d200c227 ("fm10k: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/fm10k/base/fm10k_mbx.c   |  2 +-
 drivers/net/intel/fm10k/base/fm10k_osdep.h |  2 +-
 drivers/net/intel/fm10k/base/fm10k_pf.c    |  8 ++++----
 drivers/net/intel/fm10k/base/fm10k_type.h  |  6 +++---
 drivers/net/intel/fm10k/base/meson.build   | 14 +-------------
 5 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/net/intel/fm10k/base/fm10k_mbx.c b/drivers/net/intel/fm10k/base/fm10k_mbx.c
index 2bb0d82efe..9028403757 100644
--- a/drivers/net/intel/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/intel/fm10k/base/fm10k_mbx.c
@@ -1602,7 +1602,7 @@ s32 fm10k_pfvf_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
 			mbx->mbmem_reg = FM10K_MBMEM_VF(id, 0);
 			break;
 		}
-		/* fallthough */
+		/* fallthrough */
 	default:
 		return FM10K_MBX_ERR_NO_MBX;
 	}
diff --git a/drivers/net/intel/fm10k/base/fm10k_osdep.h b/drivers/net/intel/fm10k/base/fm10k_osdep.h
index a727a57481..5f8ff10474 100644
--- a/drivers/net/intel/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/intel/fm10k/base/fm10k_osdep.h
@@ -67,7 +67,7 @@ typedef uint64_t   u64;
 #define FM10K_PCI_REG_WRITE(reg, value) rte_write32((value), (reg))
 
 /* not implemented */
-#define FM10K_READ_PCI_WORD(hw, reg)     0
+#define FM10K_READ_PCI_WORD(hw, reg)     ((void)hw, (void)reg, 0)
 
 #define FM10K_WRITE_MBX(hw, reg, value) FM10K_WRITE_REG(hw, reg, value)
 #define FM10K_READ_MBX(hw, reg) FM10K_READ_REG(hw, reg)
diff --git a/drivers/net/intel/fm10k/base/fm10k_pf.c b/drivers/net/intel/fm10k/base/fm10k_pf.c
index 439dd224de..b54116a4b5 100644
--- a/drivers/net/intel/fm10k/base/fm10k_pf.c
+++ b/drivers/net/intel/fm10k/base/fm10k_pf.c
@@ -1362,19 +1362,19 @@ STATIC u8 fm10k_iov_supported_xcast_mode_pf(struct fm10k_vf_info *vf_info,
 	case FM10K_XCAST_MODE_PROMISC:
 		if (vf_flags & FM10K_VF_FLAG_PROMISC_CAPABLE)
 			return FM10K_XCAST_MODE_PROMISC;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_ALLMULTI:
 		if (vf_flags & FM10K_VF_FLAG_ALLMULTI_CAPABLE)
 			return FM10K_XCAST_MODE_ALLMULTI;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_MULTI:
 		if (vf_flags & FM10K_VF_FLAG_MULTI_CAPABLE)
 			return FM10K_XCAST_MODE_MULTI;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_NONE:
 		if (vf_flags & FM10K_VF_FLAG_NONE_CAPABLE)
 			return FM10K_XCAST_MODE_NONE;
-		/* fallthough */
+		/* fallthrough */
 	default:
 		break;
 	}
diff --git a/drivers/net/intel/fm10k/base/fm10k_type.h b/drivers/net/intel/fm10k/base/fm10k_type.h
index 84781ba9b2..437fb1c55e 100644
--- a/drivers/net/intel/fm10k/base/fm10k_type.h
+++ b/drivers/net/intel/fm10k/base/fm10k_type.h
@@ -83,9 +83,9 @@ struct fm10k_hw;
 #define FM10K_NOT_IMPLEMENTED			0x7FFFFFFF
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p)
-#define UNREFERENCED_2PARAMETER(_p, _q)	    do { (_p); (_q); } while (0)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) do { (_p); (_q); (_r); } while (0)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q)	    do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) do { (void)(_p); (void)(_q); (void)(_r); } while (0)
 
 /* Start of PF registers */
 #define FM10K_CTRL		0x0000
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index f24e453fd0..a2640d1ee8 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -10,19 +10,7 @@ sources = [
         'fm10k_vf.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-parameter',
-        '-Wno-unused-value',
-        '-Wno-implicit-fallthrough',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('fm10k_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH v3 2/9] net/iavf/base: remove unused meson.build file
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Vladimir Medvedkin, Ian Stokes

The meson.build file in the base folder was never used, as the base
files were just included in the main sources list for iavf.

Fixes: f1fdc9ddba5e ("drivers: move iavf common folder to iavf net")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

diff --git a/drivers/net/intel/iavf/base/meson.build b/drivers/net/intel/iavf/base/meson.build
deleted file mode 100644
index 273e88e921..0000000000
--- a/drivers/net/intel/iavf/base/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019-2021 Intel Corporation
-
-sources = files('iavf_adminq.c', 'iavf_common.c', 'iavf_impl.c')
-
-if cc.has_argument('-Wno-pointer-to-int-cast')
-        cflags += '-Wno-pointer-to-int-cast'
-endif
-
-require_iova_in_mbuf = false
-- 
2.45.2


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

* [PATCH v3 3/9] net/ixgbe/base: correct definition of macro
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin

The definition of IXGBE_LE32_TO_CPUS macro is meant to modify the value
in place - similar to the le32_to_cpus() macro in kernel. Fixing the
definition allows us to remove some warning flags, and removes the need
for the uintptr_t typecasts.

Fixes: aa4fc14d2cee ("ixgbe: update base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_common.c | 4 ++--
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 2 +-
 drivers/net/intel/ixgbe/base/meson.build    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_common.c b/drivers/net/intel/ixgbe/base/ixgbe_common.c
index d6425c5b78..fbc9605e4d 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_common.c
@@ -4610,7 +4610,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* first pull in the header so we know the buffer length */
 	for (bi = 0; bi < dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 	/*
@@ -4646,7 +4646,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* Pull in the rest of the buffer (bi is where we left off) */
 	for (; bi <= dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 rel_out:
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index cffc6a4ce8..6e5f7b4ae8 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -83,7 +83,7 @@ enum {
 #define IXGBE_LE16_TO_CPU(_i)  rte_le_to_cpu_16(_i)
 #define IXGBE_LE32_TO_CPU(_i)  rte_le_to_cpu_32(_i)
 #define IXGBE_LE64_TO_CPU(_i)  rte_le_to_cpu_64(_i)
-#define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
+#define IXGBE_LE32_TO_CPUS(_i) do { *_i = rte_le_to_cpu_32(*_i); } while(0)
 #define IXGBE_CPU_TO_BE16(_i)  rte_cpu_to_be_16(_i)
 #define IXGBE_CPU_TO_BE32(_i)  rte_cpu_to_be_32(_i)
 #define IXGBE_BE32_TO_CPU(_i)  rte_be_to_cpu_32(_i)
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 7e4fbdfa0f..f8b2ee6341 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
-- 
2.45.2


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

* [PATCH v3 4/9] net/ixgbe/base: fix compilation warnings
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (2 preceding siblings ...)
  2025-03-27 14:51   ` [PATCH v3 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin,
	Piotr Kwapulinski, Jedrzej Jagielski, Stefan Wegrzyn

We can remove almost all of the "unused parameter" and "unused variable"
warnings by just improving the macro definitions in the osdep.h header.
Remaining two instances can be fixed by just one-line additions to the
code, so add those to give us a clean build with the warnings enabled.

Fixes: af75078fece3 ("first public release")
Fixes: c6cb313da739 ("net/ixgbe/base: add link management for E610")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_e610.c  |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h | 19 +++++++++++--------
 drivers/net/intel/ixgbe/base/meson.build   | 11 -----------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_e610.c b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
index 5474c3012a..7420c78d07 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_e610.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
@@ -1054,6 +1054,7 @@ static void ixgbe_parse_vsi_func_caps(struct ixgbe_hw *hw,
 				      struct ixgbe_hw_func_caps *func_p,
 				      struct ixgbe_aci_cmd_list_caps_elem *cap)
 {
+	UNREFERENCED_PARAMETER(cap);
 	func_p->guar_num_vsi = ixgbe_get_num_per_func(hw, IXGBE_MAX_VSI);
 }
 
@@ -1770,6 +1771,7 @@ s32 ixgbe_aci_set_event_mask(struct ixgbe_hw *hw, u8 port_num, u16 mask)
 	struct ixgbe_aci_cmd_set_event_mask *cmd;
 	struct ixgbe_aci_desc desc;
 
+	UNREFERENCED_PARAMETER(port_num);
 	cmd = &desc.params.set_event_mask;
 
 	ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_event_mask);
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 6e5f7b4ae8..398c38bffd 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -57,13 +57,16 @@
 
 /* Bunch of defines for shared code bogosity */
 #ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(_p)  
+#define UNREFERENCED_PARAMETER(_p) (void)(_p)
 #endif
-#define UNREFERENCED_1PARAMETER(_p) 
-#define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) 
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) 
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) do { (void)(_p); (void)(_q); } while(0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while(0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while(0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while(0)
 
 /* Shared code error reporting */
 enum {
@@ -130,8 +133,8 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
 	IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
 
 /* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0	
-#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
+#define IXGBE_READ_PCIE_WORD(hw, reg)  ((void)hw, (void)(reg), 0)
+#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { (void)hw; (void)reg; (void)value; } while(0)
 
 #define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
 
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index f8b2ee6341..64e0bfd7be 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,17 +19,6 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
-        ]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('ixgbe_base', sources,
     dependencies: [static_rte_eal, static_rte_net],
     c_args: c_args)
-- 
2.45.2


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

* [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (3 preceding siblings ...)
  2025-03-27 14:51   ` [PATCH v3 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-28  8:20     ` David Marchand
  2025-03-27 14:51   ` [PATCH v3 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Anatoly Burakov, Vladimir Medvedkin,
	Jedrzej Jagielski, Stefan Wegrzyn, Piotr Kwapulinski

When building on FreeBSD, errors are reported in the base code by the
lock checker (-Wthread-safety). For example:

../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
   42 | }
      | ^

These errors are due to the checker not recognising the lock wrapper
functions. We can avoid these errors by converting these functions into
macros.

Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_osdep.c | 20 --------------------
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h |  8 ++++----
 2 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.c b/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
index d3d7e8e116..778f74e644 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
@@ -25,23 +25,3 @@ ixgbe_free(struct ixgbe_hw __rte_unused *hw, void *addr)
 {
 	free(addr);
 }
-
-void ixgbe_init_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_init(&lock->mutex, NULL);
-}
-
-void ixgbe_destroy_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_destroy(&lock->mutex);
-}
-
-void ixgbe_acquire_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_lock(&lock->mutex);
-}
-
-void ixgbe_release_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_unlock(&lock->mutex);
-}
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 398c38bffd..6e35991f49 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -167,9 +167,9 @@ void *ixgbe_calloc(struct ixgbe_hw *hw, size_t count, size_t size);
 void *ixgbe_malloc(struct ixgbe_hw *hw, size_t size);
 void ixgbe_free(struct ixgbe_hw *hw, void *addr);
 
-void ixgbe_init_lock(struct ixgbe_lock *lock);
-void ixgbe_destroy_lock(struct ixgbe_lock *lock);
-void ixgbe_acquire_lock(struct ixgbe_lock *lock);
-void ixgbe_release_lock(struct ixgbe_lock *lock);
+#define ixgbe_init_lock(lock) pthread_mutex_init(&(lock)->mutex, NULL)
+#define ixgbe_destroy_lock(lock) pthread_mutex_destroy(&(lock)->mutex)
+#define ixgbe_acquire_lock(lock) pthread_mutex_lock(&(lock)->mutex)
+#define ixgbe_release_lock(lock)	pthread_mutex_unlock(&(lock)->mutex)
 
 #endif /* _IXGBE_OS_H_ */
-- 
2.45.2


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

* [PATCH v3 6/9] net/i40e/base: fix unused value warnings
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (4 preceding siblings ...)
  2025-03-27 14:51   ` [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-27 14:51   ` [PATCH v3 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Ian Stokes, Heqing Zhu, Jijiang Liu,
	Helin Zhang, Jing Chen, Jingjing Wu

Fix warnings about unused values - parameters, variables, etc., and
remove the warning disable flags for them. Although modifying the
base-code files is not ideal, the changes required are minor, and only
affect two files from the imported base code.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
 drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
 drivers/net/intel/i40e/base/meson.build  |  3 ---
 drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
index 3e16a0d997..56dc4d9279 100644
--- a/drivers/net/intel/i40e/base/i40e_nvm.c
+++ b/drivers/net/intel/i40e/base/i40e_nvm.c
@@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
  **/
 STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
 						    struct i40e_nvm_access *cmd,
-						    u8 *bytes, int *perrno)
+						    u8 *bytes, __rte_unused int *perrno)
 {
 	u32 aq_total_len;
 	u32 aq_desc_len;
diff --git a/drivers/net/intel/i40e/base/i40e_osdep.h b/drivers/net/intel/i40e/base/i40e_osdep.h
index c04f94732a..197f4678bf 100644
--- a/drivers/net/intel/i40e/base/i40e_osdep.h
+++ b/drivers/net/intel/i40e/base/i40e_osdep.h
@@ -184,8 +184,8 @@ struct __rte_packed_begin i40e_dma_mem {
 	const void *zone;
 } __rte_packed_end;
 
-#define i40e_allocate_dma_mem(h, m, unused, s, a) \
-			i40e_allocate_dma_mem_d(h, m, s, a)
+#define i40e_allocate_dma_mem(h, m, mt, s, a) \
+			i40e_allocate_dma_mem_d(h, m, mt, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
 struct __rte_packed_begin i40e_virt_mem {
diff --git a/drivers/net/intel/i40e/base/i40e_type.h b/drivers/net/intel/i40e/base/i40e_type.h
index 7cc746f82f..968e1982a6 100644
--- a/drivers/net/intel/i40e/base/i40e_type.h
+++ b/drivers/net/intel/i40e/base/i40e_type.h
@@ -14,11 +14,15 @@
 #include "i40e_devids.h"
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p);
-#define UNREFERENCED_2PARAMETER(_p, _q) (_p); (_q);
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) (_p); (_q); (_r);
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (_p); (_q); (_r); (_s);
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (_p); (_q); (_r); (_s); (_t);
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) \
+	do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while (0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while (0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while (0)
 
 #define BIT(a) (1UL << (a))
 #define BIT_ULL(a) (1ULL << (a))
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index a0912b1788..2648e5d0c4 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -13,10 +13,7 @@ sources = [
 
 error_cflags = [
         '-Wno-sign-compare',
-        '-Wno-unused-value',
         '-Wno-strict-aliasing',
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
 ]
 c_args = cflags
 foreach flag: error_cflags
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 1c5ab35a8b..90eba3419f 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -4694,6 +4694,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
 enum i40e_status_code
 i40e_allocate_dma_mem_d(__rte_unused struct i40e_hw *hw,
 			struct i40e_dma_mem *mem,
+			__rte_unused enum i40e_memory_type mtype,
 			u64 size,
 			u32 alignment)
 {
-- 
2.45.2


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

* [PATCH v3 7/9] net/i40e/base: fix compiler warnings
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (5 preceding siblings ...)
  2025-03-27 14:51   ` [PATCH v3 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
@ 2025-03-27 14:51   ` Bruce Richardson
  2025-03-27 14:52   ` [PATCH v3 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:51 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, stable, Ian Stokes, Cunming Liang, Jing Chen,
	Heqing Zhu, Jijiang Liu, Jingjing Wu

Add a single-line fix to the base code, and then the remaining two
compiler warning disable flags can be removed from the driver base code
build file.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_diag.c b/drivers/net/intel/i40e/base/i40e_diag.c
index 4ca102cdd5..71b2e53e85 100644
--- a/drivers/net/intel/i40e/base/i40e_diag.c
+++ b/drivers/net/intel/i40e/base/i40e_diag.c
@@ -34,7 +34,7 @@ static enum i40e_status_code i40e_diag_reg_pattern_test(struct i40e_hw *hw,
 {
 	const u32 patterns[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
 	u32 pat, val, orig_val;
-	int i;
+	unsigned int i;
 
 	orig_val = rd32(hw, reg);
 	for (i = 0; i < ARRAY_SIZE(patterns); i++) {
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 2648e5d0c4..766383101b 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -11,18 +11,7 @@ sources = [
         'i40e_nvm.c',
 ]
 
-error_cflags = [
-        '-Wno-sign-compare',
-        '-Wno-strict-aliasing',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('i40e_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH v3 8/9] net/ice/base: reduce warnings for unused variables
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (6 preceding siblings ...)
  2025-03-27 14:51   ` [PATCH v3 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
@ 2025-03-27 14:52   ` Bruce Richardson
  2025-03-27 14:52   ` [PATCH v3 9/9] net/intel: simplify base code builds Bruce Richardson
  2025-03-28  8:21   ` [PATCH v3 0/9] net/intel: clean up base code build David Marchand
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:52 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Anatoly Burakov

Improve base code macros to reduce the number of issues with unused
variables in the code. Issues still remain with unused-but-set
variables, but completely unused variable warnings are eliminated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ice/base/ice_osdep.h  | 6 +++---
 drivers/net/intel/ice/base/ice_switch.c | 2 --
 drivers/net/intel/ice/base/ice_type.h   | 2 +-
 drivers/net/intel/ice/base/meson.build  | 1 -
 drivers/net/intel/ice/ice_fdir_filter.c | 2 +-
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 7b96fcde03..ad6cde9896 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -196,9 +196,9 @@ struct __rte_packed_begin ice_virt_mem {
 	u32 size;
 } __rte_packed_end;
 
-#define ice_malloc(h, s)    rte_zmalloc(NULL, s, 0)
-#define ice_calloc(h, c, s) rte_calloc(NULL, c, s, 0)
-#define ice_free(h, m)         rte_free(m)
+#define ice_malloc(h, s)    ((void)h, rte_zmalloc(NULL, s, 0))
+#define ice_calloc(h, c, s) ((void)h, rte_calloc(NULL, c, s, 0))
+#define ice_free(h, m)      ((void)h, rte_free(m))
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
diff --git a/drivers/net/intel/ice/base/ice_switch.c b/drivers/net/intel/ice/base/ice_switch.c
index a3786961e6..468a9f055d 100644
--- a/drivers/net/intel/ice/base/ice_switch.c
+++ b/drivers/net/intel/ice/base/ice_switch.c
@@ -8190,7 +8190,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_sw_recipe *rm;
 	u8 i;
 	int status = ICE_SUCCESS;
-	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
@@ -9795,7 +9794,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	bool remove_rule = false;
 	struct ice_lock *rule_lock; /* Lock to protect filter rule list */
 	u16 i, rid, vsi_handle;
-	bool is_add = false;
 	int status = ICE_SUCCESS;
 
 	ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
diff --git a/drivers/net/intel/ice/base/ice_type.h b/drivers/net/intel/ice/base/ice_type.h
index 35f832eb9f..297a5ea890 100644
--- a/drivers/net/intel/ice/base/ice_type.h
+++ b/drivers/net/intel/ice/base/ice_type.h
@@ -153,7 +153,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#define __ALWAYS_UNUSED
+#define __ALWAYS_UNUSED __rte_unused
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
diff --git a/drivers/net/intel/ice/base/meson.build b/drivers/net/intel/ice/base/meson.build
index 38d092c370..e7ba9c34bc 100644
--- a/drivers/net/intel/ice/base/meson.build
+++ b/drivers/net/intel/ice/base/meson.build
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 940fe171b6..2ff0090aca 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1090,7 +1090,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 		return -EINVAL;
 
 	seg_tun = (struct ice_flow_seg_info *)
-		ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
+		ice_malloc(pf->adapter->hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
 	if (!seg_tun) {
 		PMD_DRV_LOG(ERR, "No memory can be allocated");
 		return -ENOMEM;
-- 
2.45.2


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

* [PATCH v3 9/9] net/intel: simplify base code builds
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (7 preceding siblings ...)
  2025-03-27 14:52   ` [PATCH v3 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
@ 2025-03-27 14:52   ` Bruce Richardson
  2025-03-28  8:21   ` [PATCH v3 0/9] net/intel: clean up base code build David Marchand
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-27 14:52 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Ian Stokes, Jingjing Wu, Praveen Shetty,
	Anatoly Burakov, Vladimir Medvedkin

Now that base-code warning flags have been removed from a number of
drivers, we can simplify their build configuration by just including the
base code files in the regular list of driver files passed back. There
is no need to use pre-compiled objects.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/e1000/base/meson.build | 9 ++-------
 drivers/net/intel/e1000/meson.build      | 4 ++--
 drivers/net/intel/fm10k/base/meson.build | 9 ++-------
 drivers/net/intel/fm10k/meson.build      | 4 ++--
 drivers/net/intel/i40e/base/meson.build  | 9 ++-------
 drivers/net/intel/i40e/meson.build       | 4 ++--
 drivers/net/intel/idpf/base/meson.build  | 2 +-
 drivers/net/intel/idpf/meson.build       | 7 ++++---
 drivers/net/intel/ixgbe/base/meson.build | 9 ++-------
 drivers/net/intel/ixgbe/meson.build      | 4 ++--
 10 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/drivers/net/intel/e1000/base/meson.build b/drivers/net/intel/e1000/base/meson.build
index 8cbd9f62e6..4fe86dc6df 100644
--- a/drivers/net/intel/e1000/base/meson.build
+++ b/drivers/net/intel/e1000/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'e1000_base.c',
         'e1000_80003es2lan.c',
         'e1000_82540.c',
@@ -21,9 +21,4 @@ sources = [
         'e1000_osdep.c',
         'e1000_phy.c',
         'e1000_vf.c',
-]
-
-base_lib = static_library('e1000_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/e1000/meson.build b/drivers/net/intel/e1000/meson.build
index cd42c0042a..b52a843228 100644
--- a/drivers/net/intel/e1000/meson.build
+++ b/drivers/net/intel/e1000/meson.build
@@ -2,9 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'e1000_logs.c',
         'em_ethdev.c',
         'em_rxtx.c',
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index a2640d1ee8..c45b31d6b2 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -1,16 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'fm10k_api.c',
         'fm10k_common.c',
         'fm10k_mbx.c',
         'fm10k_pf.c',
         'fm10k_tlv.c',
         'fm10k_vf.c',
-]
-
-base_lib = static_library('fm10k_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/fm10k/meson.build b/drivers/net/intel/fm10k/meson.build
index 69566add96..e08a00cb49 100644
--- a/drivers/net/intel/fm10k/meson.build
+++ b/drivers/net/intel/fm10k/meson.build
@@ -8,9 +8,9 @@ if is_windows
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'fm10k_ethdev.c',
         'fm10k_rxtx.c',
 )
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 766383101b..7b4882ad1d 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2020 Intel Corporation
 
-sources = [
+base_sources = files(
         'i40e_adminq.c',
         'i40e_common.c',
         'i40e_dcb.c',
@@ -9,9 +9,4 @@ sources = [
         'i40e_hmc.c',
         'i40e_lan_hmc.c',
         'i40e_nvm.c',
-]
-
-base_lib = static_library('i40e_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build
index 15993393fb..17b6715cd9 100644
--- a/drivers/net/intel/i40e/meson.build
+++ b/drivers/net/intel/i40e/meson.build
@@ -18,9 +18,9 @@ if dpdk_conf.get('RTE_IOVA_IN_MBUF') == 0
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'i40e_ethdev.c',
         'i40e_rxtx.c',
         'i40e_pf.c',
diff --git a/drivers/net/intel/idpf/base/meson.build b/drivers/net/intel/idpf/base/meson.build
index 7316e0a805..78782e463e 100644
--- a/drivers/net/intel/idpf/base/meson.build
+++ b/drivers/net/intel/idpf/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 Intel Corporation
 
-sources += files(
+base_sources = files(
         'idpf_controlq.c',
         'idpf_controlq_setup.c',
 )
diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build
index 4b272d02b1..a8690da87b 100644
--- a/drivers/net/intel/idpf/meson.build
+++ b/drivers/net/intel/idpf/meson.build
@@ -7,9 +7,12 @@ if is_windows
     subdir_done()
 endif
 
+subdir('base')
+
 includes += include_directories('../iavf/base')
 
-sources = files(
+sources += base_sources
+sources += files(
         'idpf_common_device.c',
         'idpf_common_rxtx.c',
         'idpf_common_virtchnl.c',
@@ -43,5 +46,3 @@ if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1
         objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c')
     endif
 endif
-
-subdir('base')
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 64e0bfd7be..df42a34369 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2024 Intel Corporation
 
-sources = [
+base_sources = files(
         'ixgbe_82598.c',
         'ixgbe_82599.c',
         'ixgbe_api.c',
@@ -17,9 +17,4 @@ sources = [
         'ixgbe_vf.c',
         'ixgbe_x540.c',
         'ixgbe_x550.c',
-]
-
-base_lib = static_library('ixgbe_base', sources,
-    dependencies: [static_rte_eal, static_rte_net],
-    c_args: c_args)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/ixgbe/meson.build b/drivers/net/intel/ixgbe/meson.build
index 0bee736a2c..23f5a6cb3e 100644
--- a/drivers/net/intel/ixgbe/meson.build
+++ b/drivers/net/intel/ixgbe/meson.build
@@ -4,9 +4,9 @@
 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'ixgbe_82599_bypass.c',
         'ixgbe_bypass.c',
         'ixgbe_ethdev.c',
-- 
2.45.2


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

* Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-27 14:51   ` [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
@ 2025-03-28  8:20     ` David Marchand
  2025-03-28 10:43       ` Bruce Richardson
  0 siblings, 1 reply; 55+ messages in thread
From: David Marchand @ 2025-03-28  8:20 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, stable, Anatoly Burakov, Vladimir Medvedkin,
	Jedrzej Jagielski, Stefan Wegrzyn, Piotr Kwapulinski

On Thu, Mar 27, 2025 at 3:53 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> When building on FreeBSD, errors are reported in the base code by the
> lock checker (-Wthread-safety). For example:
>
> ../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
>    42 | }
>       | ^
>
> These errors are due to the checker not recognising the lock wrapper
> functions. We can avoid these errors by converting these functions into
> macros.
>
> Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

This is the best solution, given that FreeBSD pthread is instrumented
with clang thread safety annotations.

As a sidenote, I don't see much value with the remaining
malloc/calloc/free wrappers in this osdep.c file.
I suspect this makes some other annotations non working.


-- 
David Marchand


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

* Re: [PATCH v3 0/9] net/intel: clean up base code build
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
                     ` (8 preceding siblings ...)
  2025-03-27 14:52   ` [PATCH v3 9/9] net/intel: simplify base code builds Bruce Richardson
@ 2025-03-28  8:21   ` David Marchand
  2025-03-28  9:01     ` Bruce Richardson
  9 siblings, 1 reply; 55+ messages in thread
From: David Marchand @ 2025-03-28  8:21 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Thu, Mar 27, 2025 at 3:52 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> Simplify the build of the various intel base code directories, by
> clearing compiler warnings so the files can be compiled directly along
> with the regular driver files.
>
> v3: add fix for lock checker issues on FreeBSD
> v2: added missing patch for fm10k
>
> Bruce Richardson (9):
>   net/fm10k/base: fix compilation warnings
>   net/iavf/base: remove unused meson.build file
>   net/ixgbe/base: correct definition of macro
>   net/ixgbe/base: fix compilation warnings
>   net/ixgbe/base: fix lock checker errors
>   net/i40e/base: fix unused value warnings
>   net/i40e/base: fix compiler warnings
>   net/ice/base: reduce warnings for unused variables
>   net/intel: simplify base code builds
>
>  drivers/net/intel/e1000/base/meson.build    |  9 ++-----
>  drivers/net/intel/e1000/meson.build         |  4 +--
>  drivers/net/intel/fm10k/base/fm10k_mbx.c    |  2 +-
>  drivers/net/intel/fm10k/base/fm10k_osdep.h  |  2 +-
>  drivers/net/intel/fm10k/base/fm10k_pf.c     |  8 +++---
>  drivers/net/intel/fm10k/base/fm10k_type.h   |  6 ++---
>  drivers/net/intel/fm10k/base/meson.build    | 21 ++-------------
>  drivers/net/intel/fm10k/meson.build         |  4 +--
>  drivers/net/intel/i40e/base/i40e_diag.c     |  2 +-
>  drivers/net/intel/i40e/base/i40e_nvm.c      |  2 +-
>  drivers/net/intel/i40e/base/i40e_osdep.h    |  4 +--
>  drivers/net/intel/i40e/base/i40e_type.h     | 14 ++++++----
>  drivers/net/intel/i40e/base/meson.build     | 23 ++--------------
>  drivers/net/intel/i40e/i40e_ethdev.c        |  1 +
>  drivers/net/intel/i40e/meson.build          |  4 +--
>  drivers/net/intel/iavf/base/meson.build     | 10 -------
>  drivers/net/intel/ice/base/ice_osdep.h      |  6 ++---
>  drivers/net/intel/ice/base/ice_switch.c     |  2 --
>  drivers/net/intel/ice/base/ice_type.h       |  2 +-
>  drivers/net/intel/ice/base/meson.build      |  1 -
>  drivers/net/intel/ice/ice_fdir_filter.c     |  2 +-
>  drivers/net/intel/idpf/base/meson.build     |  2 +-
>  drivers/net/intel/idpf/meson.build          |  7 ++---
>  drivers/net/intel/ixgbe/base/ixgbe_common.c |  4 +--
>  drivers/net/intel/ixgbe/base/ixgbe_e610.c   |  2 ++
>  drivers/net/intel/ixgbe/base/ixgbe_osdep.c  | 20 --------------
>  drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 29 ++++++++++++---------
>  drivers/net/intel/ixgbe/base/meson.build    | 20 ++------------
>  drivers/net/intel/ixgbe/meson.build         |  4 +--
>  29 files changed, 69 insertions(+), 148 deletions(-)
>  delete mode 100644 drivers/net/intel/iavf/base/meson.build

I see that you kept the base/meson.build in most drivers, though those
only provides a list of base sources.
Is this because you expect having to restore this special handling in
the future?

-- 
David Marchand


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

* Re: [PATCH v3 0/9] net/intel: clean up base code build
  2025-03-28  8:21   ` [PATCH v3 0/9] net/intel: clean up base code build David Marchand
@ 2025-03-28  9:01     ` Bruce Richardson
  0 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28  9:01 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Fri, Mar 28, 2025 at 09:21:03AM +0100, David Marchand wrote:
> On Thu, Mar 27, 2025 at 3:52 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > Simplify the build of the various intel base code directories, by
> > clearing compiler warnings so the files can be compiled directly along
> > with the regular driver files.
> >
> > v3: add fix for lock checker issues on FreeBSD v2: added missing patch
> > for fm10k
> >
> > Bruce Richardson (9): net/fm10k/base: fix compilation warnings
> > net/iavf/base: remove unused meson.build file net/ixgbe/base: correct
> > definition of macro net/ixgbe/base: fix compilation warnings
> > net/ixgbe/base: fix lock checker errors net/i40e/base: fix unused value
> > warnings net/i40e/base: fix compiler warnings net/ice/base: reduce
> > warnings for unused variables net/intel: simplify base code builds
> >
> >  drivers/net/intel/e1000/base/meson.build    |  9 ++-----
> >  drivers/net/intel/e1000/meson.build         |  4 +--
> >  drivers/net/intel/fm10k/base/fm10k_mbx.c    |  2 +-
> >  drivers/net/intel/fm10k/base/fm10k_osdep.h  |  2 +-
> >  drivers/net/intel/fm10k/base/fm10k_pf.c     |  8 +++---
> >  drivers/net/intel/fm10k/base/fm10k_type.h   |  6 ++---
> >  drivers/net/intel/fm10k/base/meson.build    | 21 ++-------------
> >  drivers/net/intel/fm10k/meson.build         |  4 +--
> >  drivers/net/intel/i40e/base/i40e_diag.c     |  2 +-
> >  drivers/net/intel/i40e/base/i40e_nvm.c      |  2 +-
> >  drivers/net/intel/i40e/base/i40e_osdep.h    |  4 +--
> >  drivers/net/intel/i40e/base/i40e_type.h     | 14 ++++++----
> >  drivers/net/intel/i40e/base/meson.build     | 23 ++--------------
> >  drivers/net/intel/i40e/i40e_ethdev.c        |  1 +
> >  drivers/net/intel/i40e/meson.build          |  4 +--
> >  drivers/net/intel/iavf/base/meson.build     | 10 -------
> >  drivers/net/intel/ice/base/ice_osdep.h      |  6 ++---
> >  drivers/net/intel/ice/base/ice_switch.c     |  2 --
> >  drivers/net/intel/ice/base/ice_type.h       |  2 +-
> >  drivers/net/intel/ice/base/meson.build      |  1 -
> >  drivers/net/intel/ice/ice_fdir_filter.c     |  2 +-
> >  drivers/net/intel/idpf/base/meson.build     |  2 +-
> >  drivers/net/intel/idpf/meson.build          |  7 ++---
> >  drivers/net/intel/ixgbe/base/ixgbe_common.c |  4 +--
> >  drivers/net/intel/ixgbe/base/ixgbe_e610.c   |  2 ++
> >  drivers/net/intel/ixgbe/base/ixgbe_osdep.c  | 20 --------------
> >  drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 29 ++++++++++++---------
> >  drivers/net/intel/ixgbe/base/meson.build    | 20 ++------------
> >  drivers/net/intel/ixgbe/meson.build         |  4 +-- 29 files changed,
> >  69 insertions(+), 148 deletions(-) delete mode 100644
> >  drivers/net/intel/iavf/base/meson.build
> 
> I see that you kept the base/meson.build in most drivers, though those
> only provides a list of base sources.  Is this because you expect having
> to restore this special handling in the future?
> 
Not especially, no. I would hope we wouldn't need additional warning
handling in future, though one never knows. I did consider removing them in
this set, but have decided against it (for now anyway).

I am planning on doing a follow-up set to move the handling of the base
code builds to the "drivers/meson.build" file. At that point, I'll maybe
decide to remove the files - though again I'm in two-minds about it, still.

/Bruce

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

* Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-28  8:20     ` David Marchand
@ 2025-03-28 10:43       ` Bruce Richardson
  2025-03-28 11:13         ` Bruce Richardson
  2025-03-28 11:48         ` David Marchand
  0 siblings, 2 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 10:43 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Anatoly Burakov, Vladimir Medvedkin

On Fri, Mar 28, 2025 at 09:20:16AM +0100, David Marchand wrote:
> On Thu, Mar 27, 2025 at 3:53 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > When building on FreeBSD, errors are reported in the base code by the
> > lock checker (-Wthread-safety). For example:
> >
> > ../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
> >    42 | }
> >       | ^
> >
> > These errors are due to the checker not recognising the lock wrapper
> > functions. We can avoid these errors by converting these functions into
> > macros.
> >
> > Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> This is the best solution, given that FreeBSD pthread is instrumented
> with clang thread safety annotations.
> 
> As a sidenote, I don't see much value with the remaining
> malloc/calloc/free wrappers in this osdep.c file.
> I suspect this makes some other annotations non working.
> 
Yes, I would tend to agree. Question is whether it is better to convert
them to macros or just move them to the header file as static inlines. I'd
tend towards the latter, because otherwise we'd need to use "," syntax to
avoid potentially introducing other warnings for unused "hw" variable.

Here are two option examples, WDYT of each?

static inline void *
ixgbe_malloc(struct ixgbe_hw __rte_unused *hw, size_t s) { return malloc(s); }

or

#define ixgbe_malloc(hw, s) ((void)hw, malloc(s))

/Bruce

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

* Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-28 10:43       ` Bruce Richardson
@ 2025-03-28 11:13         ` Bruce Richardson
  2025-03-28 11:48         ` David Marchand
  1 sibling, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:13 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Anatoly Burakov, Vladimir Medvedkin

On Fri, Mar 28, 2025 at 10:43:48AM +0000, Bruce Richardson wrote:
> On Fri, Mar 28, 2025 at 09:20:16AM +0100, David Marchand wrote:
> > On Thu, Mar 27, 2025 at 3:53 PM Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > >
> > > When building on FreeBSD, errors are reported in the base code by the
> > > lock checker (-Wthread-safety). For example:
> > >
> > > ../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
> > >    42 | }
> > >       | ^
> > >
> > > These errors are due to the checker not recognising the lock wrapper
> > > functions. We can avoid these errors by converting these functions into
> > > macros.
> > >
> > > Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > 
> > This is the best solution, given that FreeBSD pthread is instrumented
> > with clang thread safety annotations.
> > 
> > As a sidenote, I don't see much value with the remaining
> > malloc/calloc/free wrappers in this osdep.c file.
> > I suspect this makes some other annotations non working.
> > 
> Yes, I would tend to agree. Question is whether it is better to convert
> them to macros or just move them to the header file as static inlines. I'd
> tend towards the latter, because otherwise we'd need to use "," syntax to
> avoid potentially introducing other warnings for unused "hw" variable.
> 
> Here are two option examples, WDYT of each?
> 
> static inline void *
> ixgbe_malloc(struct ixgbe_hw __rte_unused *hw, size_t s) { return malloc(s); }
> 
> or
> 
> #define ixgbe_malloc(hw, s) ((void)hw, malloc(s))
> 

Doing a new patch revision, actually using the macro syntax, since it keeps
all the changes consistent, with all 7 functions being converted to macros,
and allowing osdep.c to be removed.

/Bruce

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

* [PATCH v4 0/9] net/intel: clean up base code build
  2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
                   ` (8 preceding siblings ...)
  2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
@ 2025-03-28 11:16 ` Bruce Richardson
  2025-03-28 11:16   ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
                     ` (9 more replies)
  9 siblings, 10 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin, Bruce Richardson

Simplify the build of the various intel base code directories, by
clearing compiler warnings so the files can be compiled directly along
with the regular driver files.

v4: replace all functions in ixgbe_osdep.c with macros, removing file.
v3: add fix for lock checker issues on FreeBSD
v2: added missing patch for fm10k

Bruce Richardson (9):
  net/fm10k/base: fix compilation warnings
  net/iavf/base: remove unused meson.build file
  net/ixgbe/base: correct definition of macro
  net/ixgbe/base: fix compilation warnings
  net/ixgbe/base: fix lock checker errors
  net/i40e/base: fix unused value warnings
  net/i40e/base: fix compiler warnings
  net/ice/base: reduce warnings for unused variables
  net/intel: simplify base code builds

 drivers/net/intel/e1000/base/meson.build    |  9 +---
 drivers/net/intel/e1000/meson.build         |  4 +-
 drivers/net/intel/fm10k/base/fm10k_mbx.c    |  2 +-
 drivers/net/intel/fm10k/base/fm10k_osdep.h  |  2 +-
 drivers/net/intel/fm10k/base/fm10k_pf.c     |  8 ++--
 drivers/net/intel/fm10k/base/fm10k_type.h   |  6 +--
 drivers/net/intel/fm10k/base/meson.build    | 21 +--------
 drivers/net/intel/fm10k/meson.build         |  4 +-
 drivers/net/intel/i40e/base/i40e_diag.c     |  2 +-
 drivers/net/intel/i40e/base/i40e_nvm.c      |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h    |  4 +-
 drivers/net/intel/i40e/base/i40e_type.h     | 14 +++---
 drivers/net/intel/i40e/base/meson.build     | 23 +---------
 drivers/net/intel/i40e/i40e_ethdev.c        |  1 +
 drivers/net/intel/i40e/meson.build          |  4 +-
 drivers/net/intel/iavf/base/meson.build     | 10 -----
 drivers/net/intel/ice/base/ice_osdep.h      |  6 +--
 drivers/net/intel/ice/base/ice_switch.c     |  2 -
 drivers/net/intel/ice/base/ice_type.h       |  2 +-
 drivers/net/intel/ice/base/meson.build      |  1 -
 drivers/net/intel/ice/ice_fdir_filter.c     |  2 +-
 drivers/net/intel/idpf/base/meson.build     |  2 +-
 drivers/net/intel/idpf/meson.build          |  7 +--
 drivers/net/intel/ixgbe/base/ixgbe_common.c |  4 +-
 drivers/net/intel/ixgbe/base/ixgbe_e610.c   |  2 +
 drivers/net/intel/ixgbe/base/ixgbe_osdep.c  | 47 ---------------------
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 39 +++++++++--------
 drivers/net/intel/ixgbe/base/meson.build    | 21 +--------
 drivers/net/intel/ixgbe/meson.build         |  4 +-
 29 files changed, 75 insertions(+), 180 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build
 delete mode 100644 drivers/net/intel/ixgbe/base/ixgbe_osdep.c

--
2.45.2


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

* [PATCH v4 1/9] net/fm10k/base: fix compilation warnings
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 12:53     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
                     ` (8 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin,
	Bruce Richardson, stable

The fixes required to re-enable warnings in the fm10k base code are
trivial, so let's make the changes and get a clean compile without any
warning disable flags.

* provide definitions for the UNREFERENCED_PARAMETER macros
* fix the spelling of the work "fallthrough" in comments
* provide a definition of FM10K_READ_PCI_WORD in os_dep.h that marks the
  parameters as used.

Fixes: 7223d200c227 ("fm10k: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/fm10k/base/fm10k_mbx.c   |  2 +-
 drivers/net/intel/fm10k/base/fm10k_osdep.h |  2 +-
 drivers/net/intel/fm10k/base/fm10k_pf.c    |  8 ++++----
 drivers/net/intel/fm10k/base/fm10k_type.h  |  6 +++---
 drivers/net/intel/fm10k/base/meson.build   | 14 +-------------
 5 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/net/intel/fm10k/base/fm10k_mbx.c b/drivers/net/intel/fm10k/base/fm10k_mbx.c
index 2bb0d82efe..9028403757 100644
--- a/drivers/net/intel/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/intel/fm10k/base/fm10k_mbx.c
@@ -1602,7 +1602,7 @@ s32 fm10k_pfvf_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
 			mbx->mbmem_reg = FM10K_MBMEM_VF(id, 0);
 			break;
 		}
-		/* fallthough */
+		/* fallthrough */
 	default:
 		return FM10K_MBX_ERR_NO_MBX;
 	}
diff --git a/drivers/net/intel/fm10k/base/fm10k_osdep.h b/drivers/net/intel/fm10k/base/fm10k_osdep.h
index a727a57481..5f8ff10474 100644
--- a/drivers/net/intel/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/intel/fm10k/base/fm10k_osdep.h
@@ -67,7 +67,7 @@ typedef uint64_t   u64;
 #define FM10K_PCI_REG_WRITE(reg, value) rte_write32((value), (reg))
 
 /* not implemented */
-#define FM10K_READ_PCI_WORD(hw, reg)     0
+#define FM10K_READ_PCI_WORD(hw, reg)     ((void)hw, (void)reg, 0)
 
 #define FM10K_WRITE_MBX(hw, reg, value) FM10K_WRITE_REG(hw, reg, value)
 #define FM10K_READ_MBX(hw, reg) FM10K_READ_REG(hw, reg)
diff --git a/drivers/net/intel/fm10k/base/fm10k_pf.c b/drivers/net/intel/fm10k/base/fm10k_pf.c
index 439dd224de..b54116a4b5 100644
--- a/drivers/net/intel/fm10k/base/fm10k_pf.c
+++ b/drivers/net/intel/fm10k/base/fm10k_pf.c
@@ -1362,19 +1362,19 @@ STATIC u8 fm10k_iov_supported_xcast_mode_pf(struct fm10k_vf_info *vf_info,
 	case FM10K_XCAST_MODE_PROMISC:
 		if (vf_flags & FM10K_VF_FLAG_PROMISC_CAPABLE)
 			return FM10K_XCAST_MODE_PROMISC;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_ALLMULTI:
 		if (vf_flags & FM10K_VF_FLAG_ALLMULTI_CAPABLE)
 			return FM10K_XCAST_MODE_ALLMULTI;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_MULTI:
 		if (vf_flags & FM10K_VF_FLAG_MULTI_CAPABLE)
 			return FM10K_XCAST_MODE_MULTI;
-		/* fallthough */
+		/* fallthrough */
 	case FM10K_XCAST_MODE_NONE:
 		if (vf_flags & FM10K_VF_FLAG_NONE_CAPABLE)
 			return FM10K_XCAST_MODE_NONE;
-		/* fallthough */
+		/* fallthrough */
 	default:
 		break;
 	}
diff --git a/drivers/net/intel/fm10k/base/fm10k_type.h b/drivers/net/intel/fm10k/base/fm10k_type.h
index 84781ba9b2..437fb1c55e 100644
--- a/drivers/net/intel/fm10k/base/fm10k_type.h
+++ b/drivers/net/intel/fm10k/base/fm10k_type.h
@@ -83,9 +83,9 @@ struct fm10k_hw;
 #define FM10K_NOT_IMPLEMENTED			0x7FFFFFFF
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p)
-#define UNREFERENCED_2PARAMETER(_p, _q)	    do { (_p); (_q); } while (0)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) do { (_p); (_q); (_r); } while (0)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q)	    do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) do { (void)(_p); (void)(_q); (void)(_r); } while (0)
 
 /* Start of PF registers */
 #define FM10K_CTRL		0x0000
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index f24e453fd0..a2640d1ee8 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -10,19 +10,7 @@ sources = [
         'fm10k_vf.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-parameter',
-        '-Wno-unused-value',
-        '-Wno-implicit-fallthrough',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('fm10k_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH v4 2/9] net/iavf/base: remove unused meson.build file
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
  2025-03-28 11:16   ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:00     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
                     ` (7 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin, Bruce Richardson

The meson.build file in the base folder was never used, as the base
files were just included in the main sources list for iavf.

Fixes: f1fdc9ddba5e ("drivers: move iavf common folder to iavf net")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build

diff --git a/drivers/net/intel/iavf/base/meson.build b/drivers/net/intel/iavf/base/meson.build
deleted file mode 100644
index 273e88e921..0000000000
--- a/drivers/net/intel/iavf/base/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019-2021 Intel Corporation
-
-sources = files('iavf_adminq.c', 'iavf_common.c', 'iavf_impl.c')
-
-if cc.has_argument('-Wno-pointer-to-int-cast')
-        cflags += '-Wno-pointer-to-int-cast'
-endif
-
-require_iova_in_mbuf = false
-- 
2.45.2


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

* [PATCH v4 3/9] net/ixgbe/base: correct definition of macro
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
  2025-03-28 11:16   ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
  2025-03-28 11:16   ` [PATCH v4 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:01     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
                     ` (6 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin,
	Bruce Richardson, stable

The definition of IXGBE_LE32_TO_CPUS macro is meant to modify the value
in place - similar to the le32_to_cpus() macro in kernel. Fixing the
definition allows us to remove some warning flags, and removes the need
for the uintptr_t typecasts.

Fixes: aa4fc14d2cee ("ixgbe: update base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_common.c | 4 ++--
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h  | 2 +-
 drivers/net/intel/ixgbe/base/meson.build    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_common.c b/drivers/net/intel/ixgbe/base/ixgbe_common.c
index d6425c5b78..fbc9605e4d 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_common.c
@@ -4610,7 +4610,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* first pull in the header so we know the buffer length */
 	for (bi = 0; bi < dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 	/*
@@ -4646,7 +4646,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	/* Pull in the rest of the buffer (bi is where we left off) */
 	for (; bi <= dword_len; bi++) {
 		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
-		IXGBE_LE32_TO_CPUS((uintptr_t)&buffer[bi]);
+		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
 rel_out:
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index cffc6a4ce8..6e5f7b4ae8 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -83,7 +83,7 @@ enum {
 #define IXGBE_LE16_TO_CPU(_i)  rte_le_to_cpu_16(_i)
 #define IXGBE_LE32_TO_CPU(_i)  rte_le_to_cpu_32(_i)
 #define IXGBE_LE64_TO_CPU(_i)  rte_le_to_cpu_64(_i)
-#define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
+#define IXGBE_LE32_TO_CPUS(_i) do { *_i = rte_le_to_cpu_32(*_i); } while(0)
 #define IXGBE_CPU_TO_BE16(_i)  rte_cpu_to_be_16(_i)
 #define IXGBE_CPU_TO_BE32(_i)  rte_cpu_to_be_32(_i)
 #define IXGBE_BE32_TO_CPU(_i)  rte_be_to_cpu_32(_i)
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 7e4fbdfa0f..f8b2ee6341 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
-- 
2.45.2


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

* [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (2 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:02     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
                     ` (5 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin,
	Bruce Richardson, stable

We can remove almost all of the "unused parameter" and "unused variable"
warnings by just improving the macro definitions in the osdep.h header.
Remaining two instances can be fixed by just one-line additions to the
code, so add those to give us a clean build with the warnings enabled.

Fixes: af75078fece3 ("first public release")
Fixes: c6cb313da739 ("net/ixgbe/base: add link management for E610")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_e610.c  |  2 ++
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h | 19 +++++++++++--------
 drivers/net/intel/ixgbe/base/meson.build   | 11 -----------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_e610.c b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
index 5474c3012a..7420c78d07 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_e610.c
+++ b/drivers/net/intel/ixgbe/base/ixgbe_e610.c
@@ -1054,6 +1054,7 @@ static void ixgbe_parse_vsi_func_caps(struct ixgbe_hw *hw,
 				      struct ixgbe_hw_func_caps *func_p,
 				      struct ixgbe_aci_cmd_list_caps_elem *cap)
 {
+	UNREFERENCED_PARAMETER(cap);
 	func_p->guar_num_vsi = ixgbe_get_num_per_func(hw, IXGBE_MAX_VSI);
 }
 
@@ -1770,6 +1771,7 @@ s32 ixgbe_aci_set_event_mask(struct ixgbe_hw *hw, u8 port_num, u16 mask)
 	struct ixgbe_aci_cmd_set_event_mask *cmd;
 	struct ixgbe_aci_desc desc;
 
+	UNREFERENCED_PARAMETER(port_num);
 	cmd = &desc.params.set_event_mask;
 
 	ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_event_mask);
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 6e5f7b4ae8..398c38bffd 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -57,13 +57,16 @@
 
 /* Bunch of defines for shared code bogosity */
 #ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(_p)  
+#define UNREFERENCED_PARAMETER(_p) (void)(_p)
 #endif
-#define UNREFERENCED_1PARAMETER(_p) 
-#define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) 
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) 
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) do { (void)(_p); (void)(_q); } while(0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while(0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while(0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while(0)
 
 /* Shared code error reporting */
 enum {
@@ -130,8 +133,8 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
 	IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
 
 /* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0	
-#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
+#define IXGBE_READ_PCIE_WORD(hw, reg)  ((void)hw, (void)(reg), 0)
+#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { (void)hw; (void)reg; (void)value; } while(0)
 
 #define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
 
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index f8b2ee6341..64e0bfd7be 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -19,17 +19,6 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
-        ]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('ixgbe_base', sources,
     dependencies: [static_rte_eal, static_rte_net],
     c_args: c_args)
-- 
2.45.2


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

* [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (3 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:05     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin,
	Bruce Richardson, stable

When building on FreeBSD, errors are reported in the base code by the
lock checker (-Wthread-safety). For example:

../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
   42 | }
      | ^

These errors are due to the checker not recognising the lock wrapper
functions. We can avoid these errors by converting these functions into
macros. While converting the lock macros, we can also convert the memory
allocation functions too, which allows us to remove the osdep.c file
entirely from the build.

Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ixgbe/base/ixgbe_osdep.c | 47 ----------------------
 drivers/net/intel/ixgbe/base/ixgbe_osdep.h | 18 +++++----
 drivers/net/intel/ixgbe/base/meson.build   |  1 -
 3 files changed, 10 insertions(+), 56 deletions(-)
 delete mode 100644 drivers/net/intel/ixgbe/base/ixgbe_osdep.c

diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.c b/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
deleted file mode 100644
index d3d7e8e116..0000000000
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2024 Intel Corporation
- */
-
-#include <stdlib.h>
-
-#include <rte_common.h>
-
-#include "ixgbe_osdep.h"
-
-void *
-ixgbe_calloc(struct ixgbe_hw __rte_unused *hw, size_t count, size_t size)
-{
-	return malloc(count * size);
-}
-
-void *
-ixgbe_malloc(struct ixgbe_hw __rte_unused *hw, size_t size)
-{
-	return malloc(size);
-}
-
-void
-ixgbe_free(struct ixgbe_hw __rte_unused *hw, void *addr)
-{
-	free(addr);
-}
-
-void ixgbe_init_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_init(&lock->mutex, NULL);
-}
-
-void ixgbe_destroy_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_destroy(&lock->mutex);
-}
-
-void ixgbe_acquire_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_lock(&lock->mutex);
-}
-
-void ixgbe_release_lock(struct ixgbe_lock *lock)
-{
-	pthread_mutex_unlock(&lock->mutex);
-}
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 398c38bffd..53d0422193 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -11,6 +11,8 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdbool.h>
+#include <malloc.h>
+
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_cycles.h>
@@ -50,7 +52,7 @@
 #define false               0
 #define true                1
 #ifndef RTE_EXEC_ENV_WINDOWS
-#define min(a,b)	RTE_MIN(a,b) 
+#define min(a,b)	RTE_MIN(a,b)
 #endif
 
 #define EWARN(hw, S, ...)         DEBUGOUT1(S, ##__VA_ARGS__)
@@ -163,13 +165,13 @@ struct ixgbe_lock {
 	pthread_mutex_t mutex;
 };
 
-void *ixgbe_calloc(struct ixgbe_hw *hw, size_t count, size_t size);
-void *ixgbe_malloc(struct ixgbe_hw *hw, size_t size);
-void ixgbe_free(struct ixgbe_hw *hw, void *addr);
+#define ixgbe_calloc(hw, c, s) ((void)hw, calloc(c, s))
+#define ixgbe_malloc(hw, s) ((void)hw, malloc(s))
+#define ixgbe_free(hw, a) ((void)hw, free(a))
 
-void ixgbe_init_lock(struct ixgbe_lock *lock);
-void ixgbe_destroy_lock(struct ixgbe_lock *lock);
-void ixgbe_acquire_lock(struct ixgbe_lock *lock);
-void ixgbe_release_lock(struct ixgbe_lock *lock);
+#define ixgbe_init_lock(lock) pthread_mutex_init(&(lock)->mutex, NULL)
+#define ixgbe_destroy_lock(lock) pthread_mutex_destroy(&(lock)->mutex)
+#define ixgbe_acquire_lock(lock) pthread_mutex_lock(&(lock)->mutex)
+#define ixgbe_release_lock(lock)	pthread_mutex_unlock(&(lock)->mutex)
 
 #endif /* _IXGBE_OS_H_ */
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 64e0bfd7be..2af8a55e92 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -12,7 +12,6 @@ sources = [
         'ixgbe_e610.c',
         'ixgbe_hv_vf.c',
         'ixgbe_mbx.c',
-        'ixgbe_osdep.c',
         'ixgbe_phy.c',
         'ixgbe_vf.c',
         'ixgbe_x540.c',
-- 
2.45.2


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

* [PATCH v4 6/9] net/i40e/base: fix unused value warnings
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (4 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:07     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin,
	Bruce Richardson, stable

Fix warnings about unused values - parameters, variables, etc., and
remove the warning disable flags for them. Although modifying the
base-code files is not ideal, the changes required are minor, and only
affect two files from the imported base code.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
 drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
 drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
 drivers/net/intel/i40e/base/meson.build  |  3 ---
 drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
index 3e16a0d997..56dc4d9279 100644
--- a/drivers/net/intel/i40e/base/i40e_nvm.c
+++ b/drivers/net/intel/i40e/base/i40e_nvm.c
@@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
  **/
 STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
 						    struct i40e_nvm_access *cmd,
-						    u8 *bytes, int *perrno)
+						    u8 *bytes, __rte_unused int *perrno)
 {
 	u32 aq_total_len;
 	u32 aq_desc_len;
diff --git a/drivers/net/intel/i40e/base/i40e_osdep.h b/drivers/net/intel/i40e/base/i40e_osdep.h
index c04f94732a..197f4678bf 100644
--- a/drivers/net/intel/i40e/base/i40e_osdep.h
+++ b/drivers/net/intel/i40e/base/i40e_osdep.h
@@ -184,8 +184,8 @@ struct __rte_packed_begin i40e_dma_mem {
 	const void *zone;
 } __rte_packed_end;
 
-#define i40e_allocate_dma_mem(h, m, unused, s, a) \
-			i40e_allocate_dma_mem_d(h, m, s, a)
+#define i40e_allocate_dma_mem(h, m, mt, s, a) \
+			i40e_allocate_dma_mem_d(h, m, mt, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
 struct __rte_packed_begin i40e_virt_mem {
diff --git a/drivers/net/intel/i40e/base/i40e_type.h b/drivers/net/intel/i40e/base/i40e_type.h
index 7cc746f82f..968e1982a6 100644
--- a/drivers/net/intel/i40e/base/i40e_type.h
+++ b/drivers/net/intel/i40e/base/i40e_type.h
@@ -14,11 +14,15 @@
 #include "i40e_devids.h"
 
 #define UNREFERENCED_XPARAMETER
-#define UNREFERENCED_1PARAMETER(_p) (_p);
-#define UNREFERENCED_2PARAMETER(_p, _q) (_p); (_q);
-#define UNREFERENCED_3PARAMETER(_p, _q, _r) (_p); (_q); (_r);
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) (_p); (_q); (_r); (_s);
-#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) (_p); (_q); (_r); (_s); (_t);
+#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
+#define UNREFERENCED_2PARAMETER(_p, _q) \
+	do { (void)(_p); (void)(_q); } while (0)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) \
+	do { (void)(_p); (void)(_q); (void)(_r); } while (0)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); } while (0)
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t) \
+	do { (void)(_p); (void)(_q); (void)(_r); (void)(_s); (void)(_t); } while (0)
 
 #define BIT(a) (1UL << (a))
 #define BIT_ULL(a) (1ULL << (a))
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index a0912b1788..2648e5d0c4 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -13,10 +13,7 @@ sources = [
 
 error_cflags = [
         '-Wno-sign-compare',
-        '-Wno-unused-value',
         '-Wno-strict-aliasing',
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-parameter',
 ]
 c_args = cflags
 foreach flag: error_cflags
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 1c5ab35a8b..90eba3419f 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -4694,6 +4694,7 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
 enum i40e_status_code
 i40e_allocate_dma_mem_d(__rte_unused struct i40e_hw *hw,
 			struct i40e_dma_mem *mem,
+			__rte_unused enum i40e_memory_type mtype,
 			u64 size,
 			u32 alignment)
 {
-- 
2.45.2


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

* [PATCH v4 7/9] net/i40e/base: fix compiler warnings
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (5 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:08     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
                     ` (2 subsequent siblings)
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin,
	Bruce Richardson, stable

Add a single-line fix to the base code, and then the remaining two
compiler warning disable flags can be removed from the driver base code
build file.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/intel/i40e/base/i40e_diag.c b/drivers/net/intel/i40e/base/i40e_diag.c
index 4ca102cdd5..71b2e53e85 100644
--- a/drivers/net/intel/i40e/base/i40e_diag.c
+++ b/drivers/net/intel/i40e/base/i40e_diag.c
@@ -34,7 +34,7 @@ static enum i40e_status_code i40e_diag_reg_pattern_test(struct i40e_hw *hw,
 {
 	const u32 patterns[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
 	u32 pat, val, orig_val;
-	int i;
+	unsigned int i;
 
 	orig_val = rd32(hw, reg);
 	for (i = 0; i < ARRAY_SIZE(patterns); i++) {
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 2648e5d0c4..766383101b 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -11,18 +11,7 @@ sources = [
         'i40e_nvm.c',
 ]
 
-error_cflags = [
-        '-Wno-sign-compare',
-        '-Wno-strict-aliasing',
-]
-c_args = cflags
-foreach flag: error_cflags
-    if cc.has_argument(flag)
-        c_args += flag
-    endif
-endforeach
-
 base_lib = static_library('i40e_base', sources,
     dependencies: static_rte_eal,
-    c_args: c_args)
+    c_args: cflags)
 base_objs = base_lib.extract_all_objects(recursive: true)
-- 
2.45.2


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

* [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (6 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:09     ` Burakov, Anatoly
  2025-03-28 11:16   ` [PATCH v4 9/9] net/intel: simplify base code builds Bruce Richardson
  2025-03-28 16:05   ` [PATCH v4 0/9] net/intel: clean up base code build Bruce Richardson
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin, Bruce Richardson

Improve base code macros to reduce the number of issues with unused
variables in the code. Issues still remain with unused-but-set
variables, but completely unused variable warnings are eliminated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ice/base/ice_osdep.h  | 6 +++---
 drivers/net/intel/ice/base/ice_switch.c | 2 --
 drivers/net/intel/ice/base/ice_type.h   | 2 +-
 drivers/net/intel/ice/base/meson.build  | 1 -
 drivers/net/intel/ice/ice_fdir_filter.c | 2 +-
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 7b96fcde03..ad6cde9896 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -196,9 +196,9 @@ struct __rte_packed_begin ice_virt_mem {
 	u32 size;
 } __rte_packed_end;
 
-#define ice_malloc(h, s)    rte_zmalloc(NULL, s, 0)
-#define ice_calloc(h, c, s) rte_calloc(NULL, c, s, 0)
-#define ice_free(h, m)         rte_free(m)
+#define ice_malloc(h, s)    ((void)h, rte_zmalloc(NULL, s, 0))
+#define ice_calloc(h, c, s) ((void)h, rte_calloc(NULL, c, s, 0))
+#define ice_free(h, m)      ((void)h, rte_free(m))
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
diff --git a/drivers/net/intel/ice/base/ice_switch.c b/drivers/net/intel/ice/base/ice_switch.c
index a3786961e6..468a9f055d 100644
--- a/drivers/net/intel/ice/base/ice_switch.c
+++ b/drivers/net/intel/ice/base/ice_switch.c
@@ -8190,7 +8190,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_sw_recipe *rm;
 	u8 i;
 	int status = ICE_SUCCESS;
-	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
@@ -9795,7 +9794,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	bool remove_rule = false;
 	struct ice_lock *rule_lock; /* Lock to protect filter rule list */
 	u16 i, rid, vsi_handle;
-	bool is_add = false;
 	int status = ICE_SUCCESS;
 
 	ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
diff --git a/drivers/net/intel/ice/base/ice_type.h b/drivers/net/intel/ice/base/ice_type.h
index 35f832eb9f..297a5ea890 100644
--- a/drivers/net/intel/ice/base/ice_type.h
+++ b/drivers/net/intel/ice/base/ice_type.h
@@ -153,7 +153,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#define __ALWAYS_UNUSED
+#define __ALWAYS_UNUSED __rte_unused
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
diff --git a/drivers/net/intel/ice/base/meson.build b/drivers/net/intel/ice/base/meson.build
index 38d092c370..e7ba9c34bc 100644
--- a/drivers/net/intel/ice/base/meson.build
+++ b/drivers/net/intel/ice/base/meson.build
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 940fe171b6..2ff0090aca 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1090,7 +1090,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 		return -EINVAL;
 
 	seg_tun = (struct ice_flow_seg_info *)
-		ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
+		ice_malloc(pf->adapter->hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
 	if (!seg_tun) {
 		PMD_DRV_LOG(ERR, "No memory can be allocated");
 		return -ENOMEM;
-- 
2.45.2


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

* [PATCH v4 9/9] net/intel: simplify base code builds
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (7 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
@ 2025-03-28 11:16   ` Bruce Richardson
  2025-03-28 13:09     ` Burakov, Anatoly
  2025-03-28 16:05   ` [PATCH v4 0/9] net/intel: clean up base code build Bruce Richardson
  9 siblings, 1 reply; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 11:16 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin, Bruce Richardson

Now that base-code warning flags have been removed from a number of
drivers, we can simplify their build configuration by just including the
base code files in the regular list of driver files passed back. There
is no need to use pre-compiled objects.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/e1000/base/meson.build | 9 ++-------
 drivers/net/intel/e1000/meson.build      | 4 ++--
 drivers/net/intel/fm10k/base/meson.build | 9 ++-------
 drivers/net/intel/fm10k/meson.build      | 4 ++--
 drivers/net/intel/i40e/base/meson.build  | 9 ++-------
 drivers/net/intel/i40e/meson.build       | 4 ++--
 drivers/net/intel/idpf/base/meson.build  | 2 +-
 drivers/net/intel/idpf/meson.build       | 7 ++++---
 drivers/net/intel/ixgbe/base/meson.build | 9 ++-------
 drivers/net/intel/ixgbe/meson.build      | 4 ++--
 10 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/drivers/net/intel/e1000/base/meson.build b/drivers/net/intel/e1000/base/meson.build
index 8cbd9f62e6..4fe86dc6df 100644
--- a/drivers/net/intel/e1000/base/meson.build
+++ b/drivers/net/intel/e1000/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'e1000_base.c',
         'e1000_80003es2lan.c',
         'e1000_82540.c',
@@ -21,9 +21,4 @@ sources = [
         'e1000_osdep.c',
         'e1000_phy.c',
         'e1000_vf.c',
-]
-
-base_lib = static_library('e1000_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/e1000/meson.build b/drivers/net/intel/e1000/meson.build
index cd42c0042a..b52a843228 100644
--- a/drivers/net/intel/e1000/meson.build
+++ b/drivers/net/intel/e1000/meson.build
@@ -2,9 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'e1000_logs.c',
         'em_ethdev.c',
         'em_rxtx.c',
diff --git a/drivers/net/intel/fm10k/base/meson.build b/drivers/net/intel/fm10k/base/meson.build
index a2640d1ee8..c45b31d6b2 100644
--- a/drivers/net/intel/fm10k/base/meson.build
+++ b/drivers/net/intel/fm10k/base/meson.build
@@ -1,16 +1,11 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-sources = [
+base_sources = files(
         'fm10k_api.c',
         'fm10k_common.c',
         'fm10k_mbx.c',
         'fm10k_pf.c',
         'fm10k_tlv.c',
         'fm10k_vf.c',
-]
-
-base_lib = static_library('fm10k_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/fm10k/meson.build b/drivers/net/intel/fm10k/meson.build
index 69566add96..e08a00cb49 100644
--- a/drivers/net/intel/fm10k/meson.build
+++ b/drivers/net/intel/fm10k/meson.build
@@ -8,9 +8,9 @@ if is_windows
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'fm10k_ethdev.c',
         'fm10k_rxtx.c',
 )
diff --git a/drivers/net/intel/i40e/base/meson.build b/drivers/net/intel/i40e/base/meson.build
index 766383101b..7b4882ad1d 100644
--- a/drivers/net/intel/i40e/base/meson.build
+++ b/drivers/net/intel/i40e/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2020 Intel Corporation
 
-sources = [
+base_sources = files(
         'i40e_adminq.c',
         'i40e_common.c',
         'i40e_dcb.c',
@@ -9,9 +9,4 @@ sources = [
         'i40e_hmc.c',
         'i40e_lan_hmc.c',
         'i40e_nvm.c',
-]
-
-base_lib = static_library('i40e_base', sources,
-    dependencies: static_rte_eal,
-    c_args: cflags)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build
index 15993393fb..17b6715cd9 100644
--- a/drivers/net/intel/i40e/meson.build
+++ b/drivers/net/intel/i40e/meson.build
@@ -18,9 +18,9 @@ if dpdk_conf.get('RTE_IOVA_IN_MBUF') == 0
 endif
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'i40e_ethdev.c',
         'i40e_rxtx.c',
         'i40e_pf.c',
diff --git a/drivers/net/intel/idpf/base/meson.build b/drivers/net/intel/idpf/base/meson.build
index 7316e0a805..78782e463e 100644
--- a/drivers/net/intel/idpf/base/meson.build
+++ b/drivers/net/intel/idpf/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 Intel Corporation
 
-sources += files(
+base_sources = files(
         'idpf_controlq.c',
         'idpf_controlq_setup.c',
 )
diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build
index 4b272d02b1..a8690da87b 100644
--- a/drivers/net/intel/idpf/meson.build
+++ b/drivers/net/intel/idpf/meson.build
@@ -7,9 +7,12 @@ if is_windows
     subdir_done()
 endif
 
+subdir('base')
+
 includes += include_directories('../iavf/base')
 
-sources = files(
+sources += base_sources
+sources += files(
         'idpf_common_device.c',
         'idpf_common_rxtx.c',
         'idpf_common_virtchnl.c',
@@ -43,5 +46,3 @@ if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1
         objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c')
     endif
 endif
-
-subdir('base')
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 2af8a55e92..c0b14a1db3 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2024 Intel Corporation
 
-sources = [
+base_sources = files(
         'ixgbe_82598.c',
         'ixgbe_82599.c',
         'ixgbe_api.c',
@@ -16,9 +16,4 @@ sources = [
         'ixgbe_vf.c',
         'ixgbe_x540.c',
         'ixgbe_x550.c',
-]
-
-base_lib = static_library('ixgbe_base', sources,
-    dependencies: [static_rte_eal, static_rte_net],
-    c_args: c_args)
-base_objs = base_lib.extract_all_objects(recursive: true)
+)
diff --git a/drivers/net/intel/ixgbe/meson.build b/drivers/net/intel/ixgbe/meson.build
index 0bee736a2c..23f5a6cb3e 100644
--- a/drivers/net/intel/ixgbe/meson.build
+++ b/drivers/net/intel/ixgbe/meson.build
@@ -4,9 +4,9 @@
 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
-objs = [base_objs]
 
-sources = files(
+sources += base_sources
+sources += files(
         'ixgbe_82599_bypass.c',
         'ixgbe_bypass.c',
         'ixgbe_ethdev.c',
-- 
2.45.2


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

* Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-28 10:43       ` Bruce Richardson
  2025-03-28 11:13         ` Bruce Richardson
@ 2025-03-28 11:48         ` David Marchand
  1 sibling, 0 replies; 55+ messages in thread
From: David Marchand @ 2025-03-28 11:48 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Anatoly Burakov, Vladimir Medvedkin

On Fri, Mar 28, 2025 at 11:44 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Fri, Mar 28, 2025 at 09:20:16AM +0100, David Marchand wrote:
> > On Thu, Mar 27, 2025 at 3:53 PM Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > >
> > > When building on FreeBSD, errors are reported in the base code by the
> > > lock checker (-Wthread-safety). For example:
> > >
> > > ../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
> > >    42 | }
> > >       | ^
> > >
> > > These errors are due to the checker not recognising the lock wrapper
> > > functions. We can avoid these errors by converting these functions into
> > > macros.
> > >
> > > Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >
> > This is the best solution, given that FreeBSD pthread is instrumented
> > with clang thread safety annotations.
> >
> > As a sidenote, I don't see much value with the remaining
> > malloc/calloc/free wrappers in this osdep.c file.
> > I suspect this makes some other annotations non working.
> >
> Yes, I would tend to agree. Question is whether it is better to convert
> them to macros or just move them to the header file as static inlines. I'd
> tend towards the latter, because otherwise we'd need to use "," syntax to
> avoid potentially introducing other warnings for unused "hw" variable.
>
> Here are two option examples, WDYT of each?
>
> static inline void *
> ixgbe_malloc(struct ixgbe_hw __rte_unused *hw, size_t s) { return malloc(s); }
>
> or
>
> #define ixgbe_malloc(hw, s) ((void)hw, malloc(s))

I think we don't have much choice but to use macros, as attributes on
a symbol won't get inherited by an inline wrapper.


-- 
David Marchand


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

* Re: [PATCH v4 1/9] net/fm10k/base: fix compilation warnings
  2025-03-28 11:16   ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
@ 2025-03-28 12:53     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 12:53 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin, stable

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> The fixes required to re-enable warnings in the fm10k base code are
> trivial, so let's make the changes and get a clean compile without any
> warning disable flags.
> 
> * provide definitions for the UNREFERENCED_PARAMETER macros
> * fix the spelling of the work "fallthrough" in comments
> * provide a definition of FM10K_READ_PCI_WORD in os_dep.h that marks the
>    parameters as used.
> 
> Fixes: 7223d200c227 ("fm10k: add base driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 2/9] net/iavf/base: remove unused meson.build file
  2025-03-28 11:16   ` [PATCH v4 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
@ 2025-03-28 13:00     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:00 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> The meson.build file in the base folder was never used, as the base
> files were just included in the main sources list for iavf.
> 
> Fixes: f1fdc9ddba5e ("drivers: move iavf common folder to iavf net")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 3/9] net/ixgbe/base: correct definition of macro
  2025-03-28 11:16   ` [PATCH v4 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
@ 2025-03-28 13:01     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:01 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin, stable

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> The definition of IXGBE_LE32_TO_CPUS macro is meant to modify the value
> in place - similar to the le32_to_cpus() macro in kernel. Fixing the
> definition allows us to remove some warning flags, and removes the need
> for the uintptr_t typecasts.
> 
> Fixes: aa4fc14d2cee ("ixgbe: update base driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings
  2025-03-28 11:16   ` [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
@ 2025-03-28 13:02     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:02 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin, stable

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> We can remove almost all of the "unused parameter" and "unused variable"
> warnings by just improving the macro definitions in the osdep.h header.
> Remaining two instances can be fixed by just one-line additions to the
> code, so add those to give us a clean build with the warnings enabled.
> 
> Fixes: af75078fece3 ("first public release")
> Fixes: c6cb313da739 ("net/ixgbe/base: add link management for E610")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors
  2025-03-28 11:16   ` [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
@ 2025-03-28 13:05     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:05 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin, stable

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> When building on FreeBSD, errors are reported in the base code by the
> lock checker (-Wthread-safety). For example:
> 
> ../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
>     42 | }
>        | ^
> 
> These errors are due to the checker not recognising the lock wrapper
> functions. We can avoid these errors by converting these functions into
> macros. While converting the lock macros, we can also convert the memory
> allocation functions too, which allows us to remove the osdep.c file
> entirely from the build.
> 
> Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 6/9] net/i40e/base: fix unused value warnings
  2025-03-28 11:16   ` [PATCH v4 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
@ 2025-03-28 13:07     ` Burakov, Anatoly
  2025-03-28 15:21       ` Andre Muezerie
  0 siblings, 1 reply; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:07 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin, stable

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> Fix warnings about unused values - parameters, variables, etc., and
> remove the warning disable flags for them. Although modifying the
> base-code files is not ideal, the changes required are minor, and only
> affect two files from the imported base code.
> 
> Fixes: 8db9e2a1b232 ("i40e: base driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
>   drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
>   drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
>   drivers/net/intel/i40e/base/meson.build  |  3 ---
>   drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
>   5 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
> index 3e16a0d997..56dc4d9279 100644
> --- a/drivers/net/intel/i40e/base/i40e_nvm.c
> +++ b/drivers/net/intel/i40e/base/i40e_nvm.c
> @@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
>    **/
>   STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
>   						    struct i40e_nvm_access *cmd,
> -						    u8 *bytes, int *perrno)
> +						    u8 *bytes, __rte_unused int *perrno)

I don't think we should be adding __rte_unused to base code, there's 
probably a macro for it in osdep? If not, maybe add 
UNREFERENCED_1PARAMETER in code?

For other parts,

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 7/9] net/i40e/base: fix compiler warnings
  2025-03-28 11:16   ` [PATCH v4 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
@ 2025-03-28 13:08     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:08 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin, stable

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> Add a single-line fix to the base code, and then the remaining two
> compiler warning disable flags can be removed from the driver base code
> build file.
> 
> Fixes: 8db9e2a1b232 ("i40e: base driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables
  2025-03-28 11:16   ` [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
@ 2025-03-28 13:09     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:09 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> Improve base code macros to reduce the number of issues with unused
> variables in the code. Issues still remain with unused-but-set
> variables, but completely unused variable warnings are eliminated.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 9/9] net/intel: simplify base code builds
  2025-03-28 11:16   ` [PATCH v4 9/9] net/intel: simplify base code builds Bruce Richardson
@ 2025-03-28 13:09     ` Burakov, Anatoly
  0 siblings, 0 replies; 55+ messages in thread
From: Burakov, Anatoly @ 2025-03-28 13:09 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: David Marchand, Vladimir Medvedkin

On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> Now that base-code warning flags have been removed from a number of
> drivers, we can simplify their build configuration by just including the
> base code files in the regular list of driver files passed back. There
> is no need to use pre-compiled objects.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [PATCH v4 6/9] net/i40e/base: fix unused value warnings
  2025-03-28 13:07     ` Burakov, Anatoly
@ 2025-03-28 15:21       ` Andre Muezerie
  2025-03-28 15:26         ` Bruce Richardson
  0 siblings, 1 reply; 55+ messages in thread
From: Andre Muezerie @ 2025-03-28 15:21 UTC (permalink / raw)
  To: Burakov, Anatoly
  Cc: Bruce Richardson, dev, David Marchand, Vladimir Medvedkin, stable

On Fri, Mar 28, 2025 at 02:07:23PM +0100, Burakov, Anatoly wrote:
> On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> >Fix warnings about unused values - parameters, variables, etc., and
> >remove the warning disable flags for them. Although modifying the
> >base-code files is not ideal, the changes required are minor, and only
> >affect two files from the imported base code.
> >
> >Fixes: 8db9e2a1b232 ("i40e: base driver")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >---
> >  drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
> >  drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
> >  drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
> >  drivers/net/intel/i40e/base/meson.build  |  3 ---
> >  drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
> >  5 files changed, 13 insertions(+), 11 deletions(-)
> >
> >diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
> >index 3e16a0d997..56dc4d9279 100644
> >--- a/drivers/net/intel/i40e/base/i40e_nvm.c
> >+++ b/drivers/net/intel/i40e/base/i40e_nvm.c
> >@@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
> >   **/
> >  STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
> >  						    struct i40e_nvm_access *cmd,
> >-						    u8 *bytes, int *perrno)
> >+						    u8 *bytes, __rte_unused int *perrno)
> 
> I don't think we should be adding __rte_unused to base code, there's
> probably a macro for it in osdep? If not, maybe add
> UNREFERENCED_1PARAMETER in code?

+1 to this. MSVC does not have a direct equivalent to __attribute__((__unused__))
so it makes sense to not expand usage of __rte_unused.

> 
> For other parts,
> 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> -- 
> Thanks,
> Anatoly

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

* Re: [PATCH v4 6/9] net/i40e/base: fix unused value warnings
  2025-03-28 15:21       ` Andre Muezerie
@ 2025-03-28 15:26         ` Bruce Richardson
  0 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 15:26 UTC (permalink / raw)
  To: Andre Muezerie
  Cc: Burakov, Anatoly, dev, David Marchand, Vladimir Medvedkin, stable

On Fri, Mar 28, 2025 at 08:21:44AM -0700, Andre Muezerie wrote:
> On Fri, Mar 28, 2025 at 02:07:23PM +0100, Burakov, Anatoly wrote:
> > On 3/28/2025 12:16 PM, Bruce Richardson wrote:
> > >Fix warnings about unused values - parameters, variables, etc., and
> > >remove the warning disable flags for them. Although modifying the
> > >base-code files is not ideal, the changes required are minor, and only
> > >affect two files from the imported base code.
> > >
> > >Fixes: 8db9e2a1b232 ("i40e: base driver")
> > >Cc: stable@dpdk.org
> > >
> > >Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > >---
> > >  drivers/net/intel/i40e/base/i40e_nvm.c   |  2 +-
> > >  drivers/net/intel/i40e/base/i40e_osdep.h |  4 ++--
> > >  drivers/net/intel/i40e/base/i40e_type.h  | 14 +++++++++-----
> > >  drivers/net/intel/i40e/base/meson.build  |  3 ---
> > >  drivers/net/intel/i40e/i40e_ethdev.c     |  1 +
> > >  5 files changed, 13 insertions(+), 11 deletions(-)
> > >
> > >diff --git a/drivers/net/intel/i40e/base/i40e_nvm.c b/drivers/net/intel/i40e/base/i40e_nvm.c
> > >index 3e16a0d997..56dc4d9279 100644
> > >--- a/drivers/net/intel/i40e/base/i40e_nvm.c
> > >+++ b/drivers/net/intel/i40e/base/i40e_nvm.c
> > >@@ -1743,7 +1743,7 @@ STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
> > >   **/
> > >  STATIC enum i40e_status_code i40e_nvmupd_get_aq_event(struct i40e_hw *hw,
> > >  						    struct i40e_nvm_access *cmd,
> > >-						    u8 *bytes, int *perrno)
> > >+						    u8 *bytes, __rte_unused int *perrno)
> > 
> > I don't think we should be adding __rte_unused to base code, there's
> > probably a macro for it in osdep? If not, maybe add
> > UNREFERENCED_1PARAMETER in code?
> 
> +1 to this. MSVC does not have a direct equivalent to __attribute__((__unused__))
> so it makes sense to not expand usage of __rte_unused.
> 

Ok. Will change on apply, rather that doing a respin for that one small
change.

/Bruce


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

* Re: [PATCH v4 0/9] net/intel: clean up base code build
  2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
                     ` (8 preceding siblings ...)
  2025-03-28 11:16   ` [PATCH v4 9/9] net/intel: simplify base code builds Bruce Richardson
@ 2025-03-28 16:05   ` Bruce Richardson
  9 siblings, 0 replies; 55+ messages in thread
From: Bruce Richardson @ 2025-03-28 16:05 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Anatoly Burakov, Vladimir Medvedkin

On Fri, Mar 28, 2025 at 11:16:12AM +0000, Bruce Richardson wrote:
> Simplify the build of the various intel base code directories, by
> clearing compiler warnings so the files can be compiled directly along
> with the regular driver files.
> 
> v4: replace all functions in ixgbe_osdep.c with macros, removing file.
> v3: add fix for lock checker issues on FreeBSD
> v2: added missing patch for fm10k
> 
> Bruce Richardson (9):
>   net/fm10k/base: fix compilation warnings
>   net/iavf/base: remove unused meson.build file
>   net/ixgbe/base: correct definition of macro
>   net/ixgbe/base: fix compilation warnings
>   net/ixgbe/base: fix lock checker errors
>   net/i40e/base: fix unused value warnings
>   net/i40e/base: fix compiler warnings
>   net/ice/base: reduce warnings for unused variables
>   net/intel: simplify base code builds
> 
Series applied to dpdk-next-net-intel, with one change as discussed on
patch 6.

Regards,
/Bruce

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

end of thread, other threads:[~2025-03-28 16:05 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
2025-03-26 15:52 ` [PATCH 1/7] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-26 15:52 ` [PATCH 2/7] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-26 15:52 ` [PATCH 3/7] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 4/7] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 5/7] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 6/7] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-26 15:52 ` [PATCH 7/7] net/intel: simplify base code builds Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 1/8] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 2/8] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 3/8] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 4/8] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 5/8] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 6/8] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 7/8] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 8/8] net/intel: simplify base code builds Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
2025-03-28  8:20     ` David Marchand
2025-03-28 10:43       ` Bruce Richardson
2025-03-28 11:13         ` Bruce Richardson
2025-03-28 11:48         ` David Marchand
2025-03-27 14:51   ` [PATCH v3 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-27 14:52   ` [PATCH v3 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-27 14:52   ` [PATCH v3 9/9] net/intel: simplify base code builds Bruce Richardson
2025-03-28  8:21   ` [PATCH v3 0/9] net/intel: clean up base code build David Marchand
2025-03-28  9:01     ` Bruce Richardson
2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
2025-03-28 11:16   ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-28 12:53     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-28 13:00     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-28 13:01     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-28 13:02     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
2025-03-28 13:05     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-28 13:07     ` Burakov, Anatoly
2025-03-28 15:21       ` Andre Muezerie
2025-03-28 15:26         ` Bruce Richardson
2025-03-28 11:16   ` [PATCH v4 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-28 13:08     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-28 13:09     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 9/9] net/intel: simplify base code builds Bruce Richardson
2025-03-28 13:09     ` Burakov, Anatoly
2025-03-28 16:05   ` [PATCH v4 0/9] net/intel: clean up base code build Bruce Richardson

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