net/intel: clean up base code build
Subsystems (2)
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
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.
--- 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
@@ -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
PATCH 2/7 net/ixgbe/base: correct definition of macro
In reply to Bruce RichardsonThe 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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH 3/7 net/ixgbe/base: fix compilation warnings
In reply to Bruce RichardsonWe 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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH 4/7 net/i40e/base: fix unused value warnings
In reply to Bruce RichardsonFix 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 5/7 net/i40e/base: fix compiler warnings
In reply to Bruce RichardsonAdd 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.
--- 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
@@ -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
@@ -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
PATCH 6/7 net/ice/base: reduce warnings for unused variables
In reply to Bruce RichardsonImprove 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 7/7 net/intel: simplify base code builds
In reply to Bruce RichardsonNow 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
v2 cover net/intel: clean up base code build
In reply to Bruce RichardsonSimplify 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
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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 2/8 net/iavf/base: remove unused meson.build file
In reply to Bruce RichardsonThe meson.build file in the base folder was never used, as the base files were just included in the main sources list for iavf.
--- 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
@@ -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
PATCH v2 3/8 net/ixgbe/base: correct definition of macro
In reply to Bruce RichardsonThe 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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH v2 4/8 net/ixgbe/base: fix compilation warnings
In reply to Bruce RichardsonWe 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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH v2 5/8 net/i40e/base: fix unused value warnings
In reply to Bruce RichardsonFix 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 6/8 net/i40e/base: fix compiler warnings
In reply to Bruce RichardsonAdd 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.
--- 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
@@ -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
@@ -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
PATCH v2 7/8 net/ice/base: reduce warnings for unused variables
In reply to Bruce RichardsonImprove 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 8/8 net/intel: simplify base code builds
In reply to Bruce RichardsonNow 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
v3 cover net/intel: clean up base code build
In reply to Bruce RichardsonSimplify 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
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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v3 2/9 net/iavf/base: remove unused meson.build file
In reply to Bruce RichardsonThe meson.build file in the base folder was never used, as the base files were just included in the main sources list for iavf.
--- 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
@@ -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
PATCH v3 3/9 net/ixgbe/base: correct definition of macro
In reply to Bruce RichardsonThe 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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH v3 4/9 net/ixgbe/base: fix compilation warnings
In reply to Bruce RichardsonWe 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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH v3 5/9 net/ixgbe/base: fix lock checker errors
In reply to Bruce RichardsonWhen 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.
--- 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
@@ -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
@@ -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
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")Signed-off-by Bruce Richardson <[email protected]>
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
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
Signed-off-by Bruce Richardson <[email protected]>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.cfile. 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
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
Signed-off-by Bruce Richardson <[email protected]>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.cfile. 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
Re: [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors
In reply to Bruce RichardsonQuoted 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
Signed-off-by Bruce Richardson <[email protected]>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.cfile. 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
PATCH v3 6/9 net/i40e/base: fix unused value warnings
In reply to Bruce RichardsonFix 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v3 7/9 net/i40e/base: fix compiler warnings
In reply to Bruce RichardsonAdd 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.
--- 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
@@ -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
@@ -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
PATCH v3 8/9 net/ice/base: reduce warnings for unused variables
In reply to Bruce RichardsonImprove 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v3 9/9 net/intel: simplify base code builds
In reply to Bruce RichardsonNow 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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 fm10kBruce Richardson (9):
net/fm10k/base: fix compilation warningsnet/iavf/base: remove unused meson.build filenet/ixgbe/base: correct definition of macronet/ixgbe/base: fix compilation warningsnet/ixgbe/base: fix lock checker errorsnet/i40e/base: fix unused value warningsnet/i40e/base: fix compiler warningsnet/ice/base: reduce warnings for unused variables net/intel: simplify base code buildsdrivers/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
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 warningsnet/iavf/base: remove unused meson.build filenet/ixgbe/base: correct definition of macronet/ixgbe/base: fix compilation warningsnet/ixgbe/base: fix lock checker errorsnet/i40e/base: fix unused value warningsnet/i40e/base: fix compiler warningsnet/ice/base: reduce warnings for unused variables net/intel: simplify base code buildsdrivers/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 100644drivers/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
v4 cover net/intel: clean up base code build
In reply to Bruce RichardsonSimplify 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
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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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_PARAMETERmacros
* fix the spelling of the work "fallthrough" in comments
* provide a definition ofFM10K_READ_PCI_WORDinos_dep.hthat marks the parameters as used.
Quoted 5 lines
Fixes 7223d200c227 ("fm10k: add base driver")Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 2/9 net/iavf/base: remove unused meson.build file
In reply to Bruce RichardsonThe meson.build file in the base folder was never used, as the base files were just included in the main sources list for iavf.
--- 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
@@ -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
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")Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 3/9 net/ixgbe/base: correct definition of macro
In reply to Bruce RichardsonThe 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.
--- 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
@@ -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
@@ -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
@@ -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
Re: [PATCH v4 3/9] net/ixgbe/base: correct definition of macro
Quoted 10 lines · Bruce Richardson
The definition of
IXGBE_LE32_TO_CPUSmacro is meant to modify the value in place - similar to thele32_to_cpus()macro in kernel. Fixing the definition allows us to remove some warning flags, and removes the need for theuintptr_ttypecasts.Fixes aa4fc14d2cee ("ixgbe: update base driver")Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 4/9 net/ixgbe/base: fix compilation warnings
In reply to Bruce RichardsonWe 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.
--- 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
@@ -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
@@ -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
@@ -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
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.hheader. 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")Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 5/9 net/ixgbe/base: fix lock checker errors
In reply to Bruce RichardsonWhen 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.
--- 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
@@ -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
@@ -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
@@ -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
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.cfile entirely from the build.
Quoted 5 lines
Fixes 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 6/9 net/i40e/base: fix unused value warnings
In reply to Bruce RichardsonFix 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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")Signed-off-by Bruce Richardson <[email protected]>--- 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
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
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")Signed-off-by Bruce Richardson <[email protected]>--- 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@@ -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_unusedto base code, there's probably a macro for it in osdep? If not, maybe addUNREFERENCED_1PARAMETERin 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,
Acked-by Anatoly Burakov <[email protected]>Signature · 2 lines
Thanks, Anatoly
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")Signed-off-by Bruce Richardson <[email protected]>--- 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@@ -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_unusedto base code, there's probably a macro for it in osdep? If not, maybe addUNREFERENCED_1PARAMETERin 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
PATCH v4 7/9 net/i40e/base: fix compiler warnings
In reply to Bruce RichardsonAdd 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.
--- 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
@@ -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
@@ -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
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")Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 8/9 net/ice/base: reduce warnings for unused variables
In reply to Bruce RichardsonImprove 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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.
Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
PATCH v4 9/9 net/intel: simplify base code builds
In reply to Bruce RichardsonNow 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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.
Signed-off-by Bruce Richardson <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
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.cwith 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 warningsnet/iavf/base: remove unused meson.build filenet/ixgbe/base: correct definition of macronet/ixgbe/base: fix compilation warningsnet/ixgbe/base: fix lock checker errorsnet/i40e/base: fix unused value warningsnet/i40e/base: fix compiler warningsnet/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