common/idpf: remove unnecessary compile option
PATCH 1/1 common/idpf: remove unnecessary compile option
Remove compile option "__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> in idpf_osdep.h.
--- drivers/common/idpf/base/idpf_controlq.c | 5 ----- drivers/common/idpf/base/idpf_controlq.h | 8 -------- drivers/common/idpf/base/idpf_controlq_api.h | 6 ------ drivers/common/idpf/base/idpf_lan_txrx.h | 3 +-- drivers/common/idpf/base/idpf_osdep.h | 1 + 5 files changed, 2 insertions(+), 21 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +0 -5
@@ -162,11 +162,6 @@ int idpf_ctlq_add(struct idpf_hw *hw,switch (qinfo->type) {case IDPF_CTLQ_TYPE_MAILBOX_RX : is_rxq = true; -#ifdef __KERNEL__ - fallthrough; -#else -/* fallthrough */ -#endif /* __KERNEL__ */ case IDPF_CTLQ_TYPE_MAILBOX_TX : status =idpf_ctlq_alloc_ring_res (hw, *cq_out);break ;
drivers/common/idpf/base/idpf_controlq.h +0 -8
@@ -5,14 +5,8 @@#ifndef _IDPF_CONTROLQ_H_#define _IDPF_CONTROLQ_H_ -#ifdef __KERNEL__ -#include <linux/slab.h> -#endif - -#ifndef __KERNEL__#include "idpf_osdep.h" #include "idpf_alloc.h" -#endif #include "idpf_controlq_api.h" /* Maximum buffer lengths for all control queue types */
@@ -26,14 +20,12 @@ ((u16)((((R )->next_to_clean > (R )->next_to_use) ?0 : (R )->ring_size) + \ (R )->next_to_clean - (R )->next_to_use -1 )) -#ifndef __KERNEL__ /* Data type manipulation macros. */#define IDPF_HI_DWORD (x) ((u32)((((x) >> 16) >> 16) & 0xFFFFFFFF))#define IDPF_LO_DWORD (x) ((u32)((x) & 0xFFFFFFFF))#define IDPF_HI_WORD (x) ((u16)(((x) >> 16) & 0xFFFF))#define IDPF_LO_WORD (x) ((u16)((x) & 0xFFFF)) -#endif /* Control Queue default settings */ #define IDPF_CTRL_SQ_CMD_TIMEOUT 250/* msecs */
drivers/common/idpf/base/idpf_controlq_api.h +0 -6
@@ -5,14 +5,8 @@#ifndef _IDPF_CONTROLQ_API_H_#define _IDPF_CONTROLQ_API_H_ -#ifdef __KERNEL__ -#include "idpf_mem.h" -#else /* !__KERNEL__ */ #include "idpf_osdep.h" -#include <rte_compat.h> -#endif /* !__KERNEL__ */ -struct idpf_hw ;/* Used for queue init, response and events */
drivers/common/idpf/base/idpf_lan_txrx.h +1 -2
@@ -4,9 +4,8 @@#ifndef _IDPF_LAN_TXRX_H_#define _IDPF_LAN_TXRX_H_ -#ifndef __KERNEL__ +#include "idpf_osdep.h" -#endif enum idpf_rss_hash {/* Values 0 - 28 are reserved for future use */
drivers/common/idpf/base/idpf_osdep.h +1 -0
@@ -23,6 +23,7 @@#include <rte_log.h> #include <rte_random.h> #include <rte_io.h> +#include <rte_compat.h> #define INLINE inline#define STATIC static
Signature · 1 line
2.31.1
Quoted 4 lines · On Mon, 24 Apr 2023 18:47:00 -0400 Qi Zhang <[email protected]> wrote:
Remove compile option "
__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> inidpf_osdep.h.Signed-off-by Qi Zhang <[email protected]>
This will cause some warnings in DPDK build depending on compiler version and flags. You need to leave the fallthrough comment or use one of the other fallthrough annotations.
Quoted 11 lines · Stephen Hemminger
Quoted 4 lines · On Mon, 24 Apr 2023 18:47:00 -0400 Qi Zhang <[email protected]> wrote:
Remove compile option "
__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> inidpf_osdep.h.Signed-off-by Qi Zhang <[email protected]>This will cause some warnings in DPDK build depending on compiler version and flags. You need to leave the fallthrough comment or use one of the other fallthrough annotations.
if there are variations of annotating fallthrough i would not object to a macro for it being exposed from rte_common.h
full disclosure it would let me use the equivalent that are provided with windows and windows toolchains.
Quoted 13 lines · On Mon, 24 Apr 2023 10:29:19 -0700 Tyler Retzlaff…
Quoted 11 lines · Stephen Hemminger
Quoted 4 lines · On Mon, 24 Apr 2023 18:47:00 -0400 Qi Zhang <[email protected]> wrote:
Remove compile option "
__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> inidpf_osdep.h.Signed-off-by Qi Zhang <[email protected]>This will cause some warnings in DPDK build depending on compiler version and flags. You need to leave the fallthrough comment or use one of the other fallthrough annotations.
Quoted 5 lines
if there are variations of annotating fallthrough i would not object to a macro for it being exposed from
rte_common.hfull disclosure it would let me use the equivalent that are provided with windows and windows toolchains.
Yes having something like __rte_fallthrough would help.
Wouldn't help code that is trying to always work in kernel, DPDK or other places.
Both Gcc and clang use statement attributes and C++ has [[fallthrough]]
https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
https://clang.llvm.org/docs/AttributeReference.html#fallthrough
Quoted 12 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, April 25, 2023 12:24 AM
To: Zhang, Qi Z <[email protected]>
Cc: Xing, Beilei <[email protected]>; [email protected]
Subject: Re: [PATCH] common/idpf: remove unnecessary compile optionOn Mon, 24 Apr 2023 18:47:00 -0400
Qi Zhang <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Remove compile option "
__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> inidpf_osdep.h.Signed-off-by Qi Zhang <[email protected]>This will cause some warnings in DPDK build depending on compiler version and flags. You need to leave the fallthrough comment or use one of the other fallthrough annotations.
no intention of removing that comment, as it serves to assist the reader.
It's good to learn that it has also helped to resolve the compiler warning - thank you for bringing this to my attention.
PATCH v2 1/1 common/idpf: remove unnecessary compile option
In reply to Qi ZhangRemove compile option "__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> in idpf_osdep.h.
---
v2:
- add fallthrough comment back
drivers/common/idpf/base/idpf_controlq.c | 4 ---- drivers/common/idpf/base/idpf_controlq.h | 8 -------- drivers/common/idpf/base/idpf_controlq_api.h | 6 ------ drivers/common/idpf/base/idpf_lan_txrx.h | 3 +-- drivers/common/idpf/base/idpf_osdep.h | 1 + 5 files changed, 2 insertions(+), 20 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +0 -4
@@ -162,11 +162,7 @@ int idpf_ctlq_add(struct idpf_hw *hw,switch (qinfo->type) {case IDPF_CTLQ_TYPE_MAILBOX_RX : is_rxq = true; -#ifdef __KERNEL__ - fallthrough; -#else /* fallthrough */ -#endif /* __KERNEL__ */ case IDPF_CTLQ_TYPE_MAILBOX_TX : status =idpf_ctlq_alloc_ring_res (hw, *cq_out);break ;
drivers/common/idpf/base/idpf_controlq.h +0 -8
@@ -5,14 +5,8 @@#ifndef _IDPF_CONTROLQ_H_#define _IDPF_CONTROLQ_H_ -#ifdef __KERNEL__ -#include <linux/slab.h> -#endif - -#ifndef __KERNEL__#include "idpf_osdep.h" #include "idpf_alloc.h" -#endif #include "idpf_controlq_api.h" /* Maximum buffer lengths for all control queue types */
@@ -26,14 +20,12 @@ ((u16)((((R )->next_to_clean > (R )->next_to_use) ?0 : (R )->ring_size) + \ (R )->next_to_clean - (R )->next_to_use -1 )) -#ifndef __KERNEL__ /* Data type manipulation macros. */#define IDPF_HI_DWORD (x) ((u32)((((x) >> 16) >> 16) & 0xFFFFFFFF))#define IDPF_LO_DWORD (x) ((u32)((x) & 0xFFFFFFFF))#define IDPF_HI_WORD (x) ((u16)(((x) >> 16) & 0xFFFF))#define IDPF_LO_WORD (x) ((u16)((x) & 0xFFFF)) -#endif /* Control Queue default settings */ #define IDPF_CTRL_SQ_CMD_TIMEOUT 250/* msecs */
drivers/common/idpf/base/idpf_controlq_api.h +0 -6
@@ -5,14 +5,8 @@#ifndef _IDPF_CONTROLQ_API_H_#define _IDPF_CONTROLQ_API_H_ -#ifdef __KERNEL__ -#include "idpf_mem.h" -#else /* !__KERNEL__ */ #include "idpf_osdep.h" -#include <rte_compat.h> -#endif /* !__KERNEL__ */ -struct idpf_hw ;/* Used for queue init, response and events */
drivers/common/idpf/base/idpf_lan_txrx.h +1 -2
@@ -4,9 +4,8 @@#ifndef _IDPF_LAN_TXRX_H_#define _IDPF_LAN_TXRX_H_ -#ifndef __KERNEL__ +#include "idpf_osdep.h" -#endif enum idpf_rss_hash {/* Values 0 - 28 are reserved for future use */
drivers/common/idpf/base/idpf_osdep.h +1 -0
@@ -23,6 +23,7 @@#include <rte_log.h> #include <rte_random.h> #include <rte_io.h> +#include <rte_compat.h> #define INLINE inline#define STATIC static
Signature · 1 line
2.31.1
Quoted 9 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, April 26, 2023 11:39 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH v2] common/idpf: remove unnecessary compile option
Quoted 4 lines
Remove compile option "
__KERNEL" which should not be considered in DPDK. Also only #include <rte_xxx> inidpf_osdep.h.Signed-off-by Qi Zhang <[email protected]>
Zhang, Qi Z
AppliedQuoted 18 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Thursday, April 27, 2023 5:36 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v2] common/idpf: remove unnecessary compile optionQuoted 7 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, April 26, 2023 11:39 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH v2] common/idpf: remove unnecessary compile option
Quoted 7 lines
Quoted 1 line
Remove compile option "
__KERNEL" which should not be considered inDPDK.
Quoted 3 lines
Also only #include <
rte_xxx> inidpf_osdep.h.Signed-off-by Qi Zhang <[email protected]>Acked-by Beilei Xing <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi