Skip to contentSkip to conversation

net/intel: clean up base code build

PATCH Superseded Bruce Richardson 4 participants 55 messages Mar 26, 2025 – Mar 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover net/intel: clean up base code build

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

#1 lore raw

PATCH 1/7 net/iavf/base: remove unused meson.build file

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")
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build
drivers/net/intel/iavf/base/meson.build deleted +0 -10
deleted file mode 100644
index 273e88e921..0000000000
@@ -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
Signature · 1 line
2.45.2
#2 lore raw

PATCH 2/7 net/ixgbe/base: correct definition of macro

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_common.c +2 -2
index d6425c5b78..fbc9605e4d 100644
@@ -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:
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +1 -1
index cffc6a4ce8..6e5f7b4ae8 100644
@@ -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)
drivers/net/intel/ixgbe/base/meson.build +1 -1
index 7e4fbdfa0f..f8b2ee6341 100644
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
Signature · 1 line
2.45.2
#3 lore raw

PATCH 3/7 net/ixgbe/base: fix compilation warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_e610.c +2 -0
index 5474c3012a..7420c78d07 100644
@@ -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);
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +11 -8
index 6e5f7b4ae8..398c38bffd 100644
@@ -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)
 
drivers/net/intel/ixgbe/base/meson.build +0 -11
index f8b2ee6341..64e0bfd7be 100644
@@ -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)
Signature · 1 line
2.45.2
#4 lore raw

PATCH 4/7 net/i40e/base: fix unused value warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
index 3e16a0d997..56dc4d9279 100644
@@ -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;
drivers/net/intel/i40e/base/i40e_osdep.h +2 -2
index c04f94732a..197f4678bf 100644
@@ -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 {
drivers/net/intel/i40e/base/i40e_type.h +9 -5
index 7cc746f82f..968e1982a6 100644
@@ -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))
drivers/net/intel/i40e/base/meson.build +0 -3
index a0912b1788..2648e5d0c4 100644
@@ -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
drivers/net/intel/i40e/i40e_ethdev.c +1 -0
index 1c5ab35a8b..90eba3419f 100644
@@ -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)
 {
Signature · 1 line
2.45.2
#5 lore raw

PATCH 5/7 net/i40e/base: fix compiler warnings

In reply to Bruce Richardson

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")
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/net/intel/i40e/base/i40e_diag.c +1 -1
index 4ca102cdd5..71b2e53e85 100644
@@ -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++) {
drivers/net/intel/i40e/base/meson.build +1 -12
index 2648e5d0c4..766383101b 100644
@@ -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)
Signature · 1 line
2.45.2
#6 lore raw

PATCH 6/7 net/ice/base: reduce warnings for unused variables

In reply to 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.

---
 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(-)
drivers/net/intel/ice/base/ice_osdep.h +3 -3
index 7b96fcde03..ad6cde9896 100644
@@ -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))
drivers/net/intel/ice/base/ice_switch.c +0 -2
index a3786961e6..468a9f055d 100644
@@ -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);
drivers/net/intel/ice/base/ice_type.h +1 -1
index 35f832eb9f..297a5ea890 100644
@@ -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]))) && \
drivers/net/intel/ice/base/meson.build +0 -1
index 38d092c370..e7ba9c34bc 100644
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
drivers/net/intel/ice/ice_fdir_filter.c +1 -1
index 940fe171b6..2ff0090aca 100644
@@ -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;
Signature · 1 line
2.45.2
#7 lore raw

PATCH 7/7 net/intel: simplify base code builds

In reply to 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.

---
 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(-)
drivers/net/intel/e1000/base/meson.build +2 -7
index 8cbd9f62e6..4fe86dc6df 100644
@@ -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)
+)
drivers/net/intel/e1000/meson.build +2 -2
index cd42c0042a..b52a843228 100644
@@ -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',
drivers/net/intel/fm10k/base/meson.build +2 -7
index a2640d1ee8..c45b31d6b2 100644
@@ -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)
+)
drivers/net/intel/fm10k/meson.build +2 -2
index 69566add96..e08a00cb49 100644
@@ -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',
 )
drivers/net/intel/i40e/base/meson.build +2 -7
index 766383101b..7b4882ad1d 100644
@@ -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)
+)
drivers/net/intel/i40e/meson.build +2 -2
index 15993393fb..17b6715cd9 100644
@@ -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',
drivers/net/intel/idpf/base/meson.build +1 -1
index 7316e0a805..78782e463e 100644
@@ -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',
 )
drivers/net/intel/idpf/meson.build +4 -3
index 4b272d02b1..a8690da87b 100644
@@ -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')
drivers/net/intel/ixgbe/base/meson.build +2 -7
index 64e0bfd7be..df42a34369 100644
@@ -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)
+)
drivers/net/intel/ixgbe/meson.build +2 -2
index 0bee736a2c..23f5a6cb3e 100644
@@ -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',
Signature · 1 line
2.45.2
#8 lore raw

v2 cover net/intel: clean up base code build

In reply to 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

#9 lore raw

PATCH v2 1/8 net/fm10k/base: fix compilation warnings

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")
---
 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(-)
drivers/net/intel/fm10k/base/fm10k_mbx.c +1 -1
index 2bb0d82efe..9028403757 100644
@@ -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;
 	}
drivers/net/intel/fm10k/base/fm10k_osdep.h +1 -1
index a727a57481..5f8ff10474 100644
@@ -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)
drivers/net/intel/fm10k/base/fm10k_pf.c +4 -4
index 439dd224de..b54116a4b5 100644
@@ -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;
 	}
drivers/net/intel/fm10k/base/fm10k_type.h +3 -3
index 84781ba9b2..437fb1c55e 100644
@@ -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
drivers/net/intel/fm10k/base/meson.build +1 -13
index f24e453fd0..a2640d1ee8 100644
@@ -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)
Signature · 1 line
2.45.2
#10 lore raw

PATCH v2 2/8 net/iavf/base: remove unused meson.build file

In reply to 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")
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build
drivers/net/intel/iavf/base/meson.build deleted +0 -10
deleted file mode 100644
index 273e88e921..0000000000
@@ -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
Signature · 1 line
2.45.2
#11 lore raw

PATCH v2 3/8 net/ixgbe/base: correct definition of macro

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_common.c +2 -2
index d6425c5b78..fbc9605e4d 100644
@@ -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:
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +1 -1
index cffc6a4ce8..6e5f7b4ae8 100644
@@ -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)
drivers/net/intel/ixgbe/base/meson.build +1 -1
index 7e4fbdfa0f..f8b2ee6341 100644
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
Signature · 1 line
2.45.2
#12 lore raw

PATCH v2 4/8 net/ixgbe/base: fix compilation warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_e610.c +2 -0
index 5474c3012a..7420c78d07 100644
@@ -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);
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +11 -8
index 6e5f7b4ae8..398c38bffd 100644
@@ -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)
 
drivers/net/intel/ixgbe/base/meson.build +0 -11
index f8b2ee6341..64e0bfd7be 100644
@@ -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)
Signature · 1 line
2.45.2
#13 lore raw

PATCH v2 5/8 net/i40e/base: fix unused value warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
index 3e16a0d997..56dc4d9279 100644
@@ -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;
drivers/net/intel/i40e/base/i40e_osdep.h +2 -2
index c04f94732a..197f4678bf 100644
@@ -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 {
drivers/net/intel/i40e/base/i40e_type.h +9 -5
index 7cc746f82f..968e1982a6 100644
@@ -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))
drivers/net/intel/i40e/base/meson.build +0 -3
index a0912b1788..2648e5d0c4 100644
@@ -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
drivers/net/intel/i40e/i40e_ethdev.c +1 -0
index 1c5ab35a8b..90eba3419f 100644
@@ -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)
 {
Signature · 1 line
2.45.2
#14 lore raw

PATCH v2 6/8 net/i40e/base: fix compiler warnings

In reply to Bruce Richardson

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")
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/net/intel/i40e/base/i40e_diag.c +1 -1
index 4ca102cdd5..71b2e53e85 100644
@@ -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++) {
drivers/net/intel/i40e/base/meson.build +1 -12
index 2648e5d0c4..766383101b 100644
@@ -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)
Signature · 1 line
2.45.2
#15 lore raw

PATCH v2 7/8 net/ice/base: reduce warnings for unused variables

In reply to 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.

---
 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(-)
drivers/net/intel/ice/base/ice_osdep.h +3 -3
index 7b96fcde03..ad6cde9896 100644
@@ -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))
drivers/net/intel/ice/base/ice_switch.c +0 -2
index a3786961e6..468a9f055d 100644
@@ -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);
drivers/net/intel/ice/base/ice_type.h +1 -1
index 35f832eb9f..297a5ea890 100644
@@ -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]))) && \
drivers/net/intel/ice/base/meson.build +0 -1
index 38d092c370..e7ba9c34bc 100644
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
drivers/net/intel/ice/ice_fdir_filter.c +1 -1
index 940fe171b6..2ff0090aca 100644
@@ -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;
Signature · 1 line
2.45.2
#16 lore raw

PATCH v2 8/8 net/intel: simplify base code builds

In reply to 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.

---
 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(-)
drivers/net/intel/e1000/base/meson.build +2 -7
index 8cbd9f62e6..4fe86dc6df 100644
@@ -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)
+)
drivers/net/intel/e1000/meson.build +2 -2
index cd42c0042a..b52a843228 100644
@@ -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',
drivers/net/intel/fm10k/base/meson.build +2 -7
index a2640d1ee8..c45b31d6b2 100644
@@ -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)
+)
drivers/net/intel/fm10k/meson.build +2 -2
index 69566add96..e08a00cb49 100644
@@ -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',
 )
drivers/net/intel/i40e/base/meson.build +2 -7
index 766383101b..7b4882ad1d 100644
@@ -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)
+)
drivers/net/intel/i40e/meson.build +2 -2
index 15993393fb..17b6715cd9 100644
@@ -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',
drivers/net/intel/idpf/base/meson.build +1 -1
index 7316e0a805..78782e463e 100644
@@ -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',
 )
drivers/net/intel/idpf/meson.build +4 -3
index 4b272d02b1..a8690da87b 100644
@@ -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')
drivers/net/intel/ixgbe/base/meson.build +2 -7
index 64e0bfd7be..df42a34369 100644
@@ -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)
+)
drivers/net/intel/ixgbe/meson.build +2 -2
index 0bee736a2c..23f5a6cb3e 100644
@@ -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',
Signature · 1 line
2.45.2
#17 lore raw

v3 cover net/intel: clean up base code build

In reply to 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

#18 lore raw

PATCH v3 1/9 net/fm10k/base: fix compilation warnings

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")
---
 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(-)
drivers/net/intel/fm10k/base/fm10k_mbx.c +1 -1
index 2bb0d82efe..9028403757 100644
@@ -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;
 	}
drivers/net/intel/fm10k/base/fm10k_osdep.h +1 -1
index a727a57481..5f8ff10474 100644
@@ -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)
drivers/net/intel/fm10k/base/fm10k_pf.c +4 -4
index 439dd224de..b54116a4b5 100644
@@ -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;
 	}
drivers/net/intel/fm10k/base/fm10k_type.h +3 -3
index 84781ba9b2..437fb1c55e 100644
@@ -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
drivers/net/intel/fm10k/base/meson.build +1 -13
index f24e453fd0..a2640d1ee8 100644
@@ -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)
Signature · 1 line
2.45.2
#19 lore raw

PATCH v3 2/9 net/iavf/base: remove unused meson.build file

In reply to 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")
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build
drivers/net/intel/iavf/base/meson.build deleted +0 -10
deleted file mode 100644
index 273e88e921..0000000000
@@ -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
Signature · 1 line
2.45.2
#20 lore raw

PATCH v3 3/9 net/ixgbe/base: correct definition of macro

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_common.c +2 -2
index d6425c5b78..fbc9605e4d 100644
@@ -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:
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +1 -1
index cffc6a4ce8..6e5f7b4ae8 100644
@@ -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)
drivers/net/intel/ixgbe/base/meson.build +1 -1
index 7e4fbdfa0f..f8b2ee6341 100644
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
Signature · 1 line
2.45.2
#21 lore raw

PATCH v3 4/9 net/ixgbe/base: fix compilation warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_e610.c +2 -0
index 5474c3012a..7420c78d07 100644
@@ -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);
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +11 -8
index 6e5f7b4ae8..398c38bffd 100644
@@ -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)
 
drivers/net/intel/ixgbe/base/meson.build +0 -11
index f8b2ee6341..64e0bfd7be 100644
@@ -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)
Signature · 1 line
2.45.2
#22 lore raw

PATCH v3 5/9 net/ixgbe/base: fix lock checker errors

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_osdep.c +0 -20
index d3d7e8e116..778f74e644 100644
@@ -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);
-}
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +4 -4
index 398c38bffd..6e35991f49 100644
@@ -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_ */
Signature · 1 line
2.45.2
#23 lore raw

Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors

Quoted 8 lines · Bruce Richardson

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 | }

      | ^
Quoted 8 lines

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

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.

Signature · 1 line
David Marchand
#24 lore raw

Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors

Quoted 17 lines · David Marchand
Quoted 15 lines · Bruce Richardson

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")
Quoted 9 lines
Quoted 1 line

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

#25 lore raw

Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors

Quoted 32 lines · Bruce Richardson
Quoted 17 lines · David Marchand
Quoted 15 lines · Bruce Richardson

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")
Quoted 9 lines
Quoted 1 line

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.

Quoted 9 lines

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

#26 lore raw

Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors

In reply to Bruce Richardson
Quoted 33 lines · Bruce Richardson
Quoted 17 lines · David Marchand
Quoted 15 lines · Bruce Richardson

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")
Quoted 9 lines
Quoted 1 line

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.

Quoted 8 lines

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.

Signature · 1 line
David Marchand
#27 lore raw

PATCH v3 6/9 net/i40e/base: fix unused value warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
index 3e16a0d997..56dc4d9279 100644
@@ -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;
drivers/net/intel/i40e/base/i40e_osdep.h +2 -2
index c04f94732a..197f4678bf 100644
@@ -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 {
drivers/net/intel/i40e/base/i40e_type.h +9 -5
index 7cc746f82f..968e1982a6 100644
@@ -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))
drivers/net/intel/i40e/base/meson.build +0 -3
index a0912b1788..2648e5d0c4 100644
@@ -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
drivers/net/intel/i40e/i40e_ethdev.c +1 -0
index 1c5ab35a8b..90eba3419f 100644
@@ -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)
 {
Signature · 1 line
2.45.2
#28 lore raw

PATCH v3 7/9 net/i40e/base: fix compiler warnings

In reply to Bruce Richardson

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")
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/net/intel/i40e/base/i40e_diag.c +1 -1
index 4ca102cdd5..71b2e53e85 100644
@@ -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++) {
drivers/net/intel/i40e/base/meson.build +1 -12
index 2648e5d0c4..766383101b 100644
@@ -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)
Signature · 1 line
2.45.2
#29 lore raw

PATCH v3 8/9 net/ice/base: reduce warnings for unused variables

In reply to 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.

---
 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(-)
drivers/net/intel/ice/base/ice_osdep.h +3 -3
index 7b96fcde03..ad6cde9896 100644
@@ -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))
drivers/net/intel/ice/base/ice_switch.c +0 -2
index a3786961e6..468a9f055d 100644
@@ -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);
drivers/net/intel/ice/base/ice_type.h +1 -1
index 35f832eb9f..297a5ea890 100644
@@ -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]))) && \
drivers/net/intel/ice/base/meson.build +0 -1
index 38d092c370..e7ba9c34bc 100644
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
drivers/net/intel/ice/ice_fdir_filter.c +1 -1
index 940fe171b6..2ff0090aca 100644
@@ -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;
Signature · 1 line
2.45.2
#30 lore raw

PATCH v3 9/9 net/intel: simplify base code builds

In reply to 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.

---
 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(-)
drivers/net/intel/e1000/base/meson.build +2 -7
index 8cbd9f62e6..4fe86dc6df 100644
@@ -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)
+)
drivers/net/intel/e1000/meson.build +2 -2
index cd42c0042a..b52a843228 100644
@@ -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',
drivers/net/intel/fm10k/base/meson.build +2 -7
index a2640d1ee8..c45b31d6b2 100644
@@ -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)
+)
drivers/net/intel/fm10k/meson.build +2 -2
index 69566add96..e08a00cb49 100644
@@ -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',
 )
drivers/net/intel/i40e/base/meson.build +2 -7
index 766383101b..7b4882ad1d 100644
@@ -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)
+)
drivers/net/intel/i40e/meson.build +2 -2
index 15993393fb..17b6715cd9 100644
@@ -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',
drivers/net/intel/idpf/base/meson.build +1 -1
index 7316e0a805..78782e463e 100644
@@ -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',
 )
drivers/net/intel/idpf/meson.build +4 -3
index 4b272d02b1..a8690da87b 100644
@@ -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')
drivers/net/intel/ixgbe/base/meson.build +2 -7
index 64e0bfd7be..df42a34369 100644
@@ -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)
+)
drivers/net/intel/ixgbe/meson.build +2 -2
index 0bee736a2c..23f5a6cb3e 100644
@@ -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',
Signature · 1 line
2.45.2
#31 lore raw
In reply to Bruce Richardson
Quoted 42 lines · 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 ++---
Quoted 8 lines
 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?

Signature · 1 line
David Marchand
#32 lore raw
Quoted 49 lines · David Marchand
Quoted 43 lines · 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 ++------------
Quoted 3 lines

drivers/net/intel/ixgbe/meson.build | 4 +-- 29 files changed,
69 insertions(+), 148 deletions(-) delete mode 100644 drivers/net/intel/iavf/base/meson.build

Quoted 4 lines

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

#33 lore raw

v4 cover net/intel: clean up base code build

In reply to 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

#34 lore raw

PATCH v4 1/9 net/fm10k/base: fix compilation warnings

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")
---
 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(-)
drivers/net/intel/fm10k/base/fm10k_mbx.c +1 -1
index 2bb0d82efe..9028403757 100644
@@ -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;
 	}
drivers/net/intel/fm10k/base/fm10k_osdep.h +1 -1
index a727a57481..5f8ff10474 100644
@@ -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)
drivers/net/intel/fm10k/base/fm10k_pf.c +4 -4
index 439dd224de..b54116a4b5 100644
@@ -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;
 	}
drivers/net/intel/fm10k/base/fm10k_type.h +3 -3
index 84781ba9b2..437fb1c55e 100644
@@ -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
drivers/net/intel/fm10k/base/meson.build +1 -13
index f24e453fd0..a2640d1ee8 100644
@@ -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)
Signature · 1 line
2.45.2
Acked-by on v4 1/9
#35 lore raw

Re: [PATCH v4 1/9] net/fm10k/base: fix compilation warnings

Quoted 9 lines · Bruce Richardson

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.

Quoted 5 lines
Fixes 7223d200c227 ("fm10k: add base driver")

---

Signature · 2 lines
Thanks,
Anatoly
#36 lore raw

PATCH v4 2/9 net/iavf/base: remove unused meson.build file

In reply to 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")
---
 drivers/net/intel/iavf/base/meson.build | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 drivers/net/intel/iavf/base/meson.build
drivers/net/intel/iavf/base/meson.build deleted +0 -10
deleted file mode 100644
index 273e88e921..0000000000
@@ -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
Signature · 1 line
2.45.2
Acked-by on v4 2/9
#37 lore raw

Re: [PATCH v4 2/9] net/iavf/base: remove unused meson.build file

Quoted 7 lines · 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")

---

Signature · 2 lines
Thanks,
Anatoly
#38 lore raw

PATCH v4 3/9 net/ixgbe/base: correct definition of macro

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_common.c +2 -2
index d6425c5b78..fbc9605e4d 100644
@@ -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:
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +1 -1
index cffc6a4ce8..6e5f7b4ae8 100644
@@ -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)
drivers/net/intel/ixgbe/base/meson.build +1 -1
index 7e4fbdfa0f..f8b2ee6341 100644
@@ -19,7 +19,7 @@ sources = [
         'ixgbe_x550.c',
 ]
 
-error_cflags = ['-Wno-unused-value',
+error_cflags = [
         '-Wno-unused-but-set-variable',
         '-Wno-unused-parameter',
         ]
Signature · 1 line
2.45.2
Reviewed-by on v4 3/9
#39 lore raw

Re: [PATCH v4 3/9] net/ixgbe/base: correct definition of macro

Quoted 10 lines · Bruce Richardson

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

---

Signature · 2 lines
Thanks,
Anatoly
#40 lore raw

PATCH v4 4/9 net/ixgbe/base: fix compilation warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/ixgbe/base/ixgbe_e610.c +2 -0
index 5474c3012a..7420c78d07 100644
@@ -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);
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +11 -8
index 6e5f7b4ae8..398c38bffd 100644
@@ -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)
 
drivers/net/intel/ixgbe/base/meson.build +0 -11
index f8b2ee6341..64e0bfd7be 100644
@@ -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)
Signature · 1 line
2.45.2
Acked-by on v4 4/9
#41 lore raw

Re: [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings

Quoted 11 lines · Bruce Richardson

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

---

Signature · 2 lines
Thanks,
Anatoly
#42 lore raw

PATCH v4 5/9 net/ixgbe/base: fix lock checker errors

In reply to Bruce Richardson

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")
---
 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
drivers/net/intel/ixgbe/base/ixgbe_osdep.c deleted +0 -47
deleted file mode 100644
index d3d7e8e116..0000000000
@@ -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);
-}
drivers/net/intel/ixgbe/base/ixgbe_osdep.h +10 -8
index 398c38bffd..53d0422193 100644
@@ -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_ */
drivers/net/intel/ixgbe/base/meson.build +0 -1
index 64e0bfd7be..2af8a55e92 100644
@@ -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',
Signature · 1 line
2.45.2
Reviewed-by on v4 5/9
#43 lore raw

Re: [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors

Quoted 13 lines · Bruce Richardson

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.

Quoted 5 lines
Fixes 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")

---

Signature · 2 lines
Thanks,
Anatoly
#44 lore raw

PATCH v4 6/9 net/i40e/base: fix unused value warnings

In reply to Bruce Richardson

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")
---
 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(-)
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
index 3e16a0d997..56dc4d9279 100644
@@ -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;
drivers/net/intel/i40e/base/i40e_osdep.h +2 -2
index c04f94732a..197f4678bf 100644
@@ -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 {
drivers/net/intel/i40e/base/i40e_type.h +9 -5
index 7cc746f82f..968e1982a6 100644
@@ -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))
drivers/net/intel/i40e/base/meson.build +0 -3
index a0912b1788..2648e5d0c4 100644
@@ -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
drivers/net/intel/i40e/i40e_ethdev.c +1 -0
index 1c5ab35a8b..90eba3419f 100644
@@ -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)
 {
Signature · 1 line
2.45.2
Acked-by on v4 6/9
#45 lore raw

Re: [PATCH v4 6/9] net/i40e/base: fix unused value warnings

Quoted 22 lines · Bruce Richardson

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")
---
  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(-)
drivers/net/intel/i40e/base/i40e_nvm.c +0 -0
index 3e16a0d997..56dc4d9279 100644

drivers/net/intel/i40e/base/i40e_nvm.c STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw, · line 1746

Quoted 5 lines
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
@@ -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,

Signature · 2 lines
Thanks,
Anatoly
#46 lore raw

Re: [PATCH v4 6/9] net/i40e/base: fix unused value warnings

Quoted 18 lines · Anatoly
Quoted 17 lines · Bruce Richardson

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")
---
 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(-)
Quoted 14 lines

drivers/net/intel/i40e/base/i40e_nvm.c STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw, · line 1746

Quoted 10 lines
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
index 3e16a0d997..56dc4d9279 100644
@@ -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.

Quoted 8 lines

For other parts,

Signature · 2 lines
Thanks,
Anatoly
#47 lore raw

Re: [PATCH v4 6/9] net/i40e/base: fix unused value warnings

Quoted 34 lines · Andre Muezerie
Quoted 18 lines · Anatoly
Quoted 17 lines · Bruce Richardson

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")
---
 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(-)
Quoted 14 lines

drivers/net/intel/i40e/base/i40e_nvm.c STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw, · line 1746

Quoted 10 lines
drivers/net/intel/i40e/base/i40e_nvm.c +1 -1
index 3e16a0d997..56dc4d9279 100644
@@ -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?

Quoted 3 lines

+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

#48 lore raw

PATCH v4 7/9 net/i40e/base: fix compiler warnings

In reply to Bruce Richardson

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")
---
 drivers/net/intel/i40e/base/i40e_diag.c |  2 +-
 drivers/net/intel/i40e/base/meson.build | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/net/intel/i40e/base/i40e_diag.c +1 -1
index 4ca102cdd5..71b2e53e85 100644
@@ -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++) {
drivers/net/intel/i40e/base/meson.build +1 -12
index 2648e5d0c4..766383101b 100644
@@ -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)
Signature · 1 line
2.45.2
Acked-by on v4 7/9
#49 lore raw

Re: [PATCH v4 7/9] net/i40e/base: fix compiler warnings

Quoted 9 lines · Bruce Richardson

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

---

Signature · 2 lines
Thanks,
Anatoly
#50 lore raw

PATCH v4 8/9 net/ice/base: reduce warnings for unused variables

In reply to 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.

---
 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(-)
drivers/net/intel/ice/base/ice_osdep.h +3 -3
index 7b96fcde03..ad6cde9896 100644
@@ -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))
drivers/net/intel/ice/base/ice_switch.c +0 -2
index a3786961e6..468a9f055d 100644
@@ -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);
drivers/net/intel/ice/base/ice_type.h +1 -1
index 35f832eb9f..297a5ea890 100644
@@ -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]))) && \
drivers/net/intel/ice/base/meson.build +0 -1
index 38d092c370..e7ba9c34bc 100644
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
drivers/net/intel/ice/ice_fdir_filter.c +1 -1
index 940fe171b6..2ff0090aca 100644
@@ -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;
Signature · 1 line
2.45.2
Acked-by on v4 8/9
#51 lore raw

Re: [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables

Quoted 6 lines · 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.

---

Signature · 2 lines
Thanks,
Anatoly
#52 lore raw

PATCH v4 9/9 net/intel: simplify base code builds

In reply to 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.

---
 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(-)
drivers/net/intel/e1000/base/meson.build +2 -7
index 8cbd9f62e6..4fe86dc6df 100644
@@ -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)
+)
drivers/net/intel/e1000/meson.build +2 -2
index cd42c0042a..b52a843228 100644
@@ -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',
drivers/net/intel/fm10k/base/meson.build +2 -7
index a2640d1ee8..c45b31d6b2 100644
@@ -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)
+)
drivers/net/intel/fm10k/meson.build +2 -2
index 69566add96..e08a00cb49 100644
@@ -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',
 )
drivers/net/intel/i40e/base/meson.build +2 -7
index 766383101b..7b4882ad1d 100644
@@ -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)
+)
drivers/net/intel/i40e/meson.build +2 -2
index 15993393fb..17b6715cd9 100644
@@ -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',
drivers/net/intel/idpf/base/meson.build +1 -1
index 7316e0a805..78782e463e 100644
@@ -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',
 )
drivers/net/intel/idpf/meson.build +4 -3
index 4b272d02b1..a8690da87b 100644
@@ -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')
drivers/net/intel/ixgbe/base/meson.build +2 -7
index 2af8a55e92..c0b14a1db3 100644
@@ -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)
+)
drivers/net/intel/ixgbe/meson.build +2 -2
index 0bee736a2c..23f5a6cb3e 100644
@@ -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',
Signature · 1 line
2.45.2
Acked-by on v4 9/9
#53 lore raw

Re: [PATCH v4 9/9] net/intel: simplify base code builds

Quoted 7 lines · 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.

---

Signature · 2 lines
Thanks,
Anatoly
#54 lore raw
In reply to Bruce Richardson
Quoted 8 lines · 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

Quoted 11 lines

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