drivers/net: do not redefine bool
Subsystems (2)
PATCH 1/1 drivers/net: do not redefine bool
When trying to include stdbool.h in DPDK base headers, there are a lot of conflicts with drivers which redefine bool/true/false
in their compatibility layer.
It is fixed by including stdbool.h in these drivers. Some errors with usage of bool type are also fixed in some drivers.
Note: the driver qede has a surprising mix of bool and int:
(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR) where the first variable is boolean and the version is a number. It is replaced by !p_iov->b_pre_fp_hsi
--- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/e1000/base/e1000_osdep.h | 5 +---- drivers/net/fm10k/base/fm10k_osdep.h | 8 +------- drivers/net/fm10k/fm10k_ethdev.c | 4 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 6 +----- drivers/net/ixgbe/ixgbe_ethdev.c | 16 +++++++++------- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/net/qede/base/ecore_vf.c | 3 +-- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 3 ++- 11 files changed, 22 insertions(+), 35 deletions(-)
drivers/net/cxgbe/cxgbe_compat.h +1 -1
@@ -7,6 +7,7 @@#define _CXGBE_COMPAT_H_#include <string.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h>
@@ -106,7 +107,6 @@ typedef uint16_t u16;typedef uint32_t u32 ;typedef int32_t s32 ;typedef uint64_t u64 ; -typedef int bool ;typedef uint64_t dma_addr_t ;#ifndef __le16
drivers/net/e1000/base/e1000_osdep.h +1 -4
@@ -35,6 +35,7 @@#ifndef _E1000_OSDEP_H_#define _E1000_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h>
@@ -87,7 +88,6 @@ typedef int64_t s64;typedef int32_t s32 ;typedef int16_t s16 ;typedef int8_t s8 ; -typedef int bool ;#define __le16 u16#define __le32 u32
@@ -192,7 +192,4 @@ static inline uint16_t e1000_read_addr16(volatile void *addr)#define ETH_ADDR_LEN 6#endif -#define false FALSE -#define true TRUE -#endif /* _E1000_OSDEP_H_ */
drivers/net/fm10k/base/fm10k_osdep.h +1 -7
@@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.#ifndef _FM10K_OSDEP_H_#define _FM10K_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <string.h> #include <rte_atomic.h>
@@ -61,12 +62,6 @@ POSSIBILITY OF SUCH DAMAGE.#define FALSE 0#define TRUE 1 -#ifndef false -#define false FALSE -#endif -#ifndef true -#define true TRUE -#endif typedef uint8_t u8 ;typedef int8_t s8 ;
@@ -76,7 +71,6 @@ typedef uint32_t u32;typedef int32_t s32 ;typedef int64_t s64 ;typedef uint64_t u64 ; -typedef int bool ;#ifndef __le16#define __le16 u16
drivers/net/fm10k/fm10k_ethdev.c +2 -2
@@ -3132,7 +3132,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)/* Make sure Switch Manager is ready before going forward. */ if (hw->mac.type == fm10k_mac_pf) { -int switch_ready =0 ; +bool switch_ready = false;for (i =0 ; i <MAX_QUERY_SWITCH_STATE_TIMES ; i++) {fm10k_mbx_lock (hw);
@@ -3144,7 +3144,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)rte_delay_us (WAIT_SWITCH_MSG_US ); } -if (switch_ready ==0 ) { +if (!switch_ready) {PMD_INIT_LOG (ERR ,"switch is not ready" );return -1 ; }
drivers/net/ixgbe/base/ixgbe_osdep.h +1 -5
@@ -36,6 +36,7 @@#define _IXGBE_OS_H_#include <string.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h>
@@ -70,8 +71,6 @@#define FALSE 0#define TRUE 1 -#define false 0 -#define true 1#define min (a,b) RTE_MIN(a,b) #define EWARN(hw, S, args...) DEBUGOUT1(S, ##args)
@@ -112,9 +111,6 @@ typedef int16_t s16;typedef uint32_t u32 ;typedef int32_t s32 ;typedef uint64_t u64 ; -#ifndef __cplusplus -typedef int bool ; -#endif #define mb () rte_mb()#define wmb () rte_wmb()
drivers/net/ixgbe/ixgbe_ethdev.c +9 -7
@@ -2527,7 +2527,9 @@ ixgbe_dev_start(struct rte_eth_dev *dev)struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev);struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;uint32_t intr_vector =0 ; -int err, link_up =0 , negotiate =0 ; +int err; +bool negotiate = false; +bool link_up = false;uint32_t speed =0 ;uint32_t allowed_speeds =0 ;int mask =0 ;
@@ -2669,7 +2671,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_enable_tx_laser (hw); } - err =ixgbe_check_link (hw, &speed, &link_up,0 ); + err =ixgbe_check_link (hw, &speed, &link_up, false);if (err) goto error; dev->data->dev_link.link_status = link_up;
@@ -3870,7 +3872,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,static int ixgbevf_check_link (struct ixgbe_hw *hw,ixgbe_link_speed *speed, -int *link_up,int wait_to_complete) +bool *link_up,int wait_to_complete) {/** * for a quick link status checking, wait_to_compelet == 0,
@@ -3984,10 +3986,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,ixgbe_link_speed link_speed =IXGBE_LINK_SPEED_UNKNOWN ;struct ixgbe_interrupt *intr =IXGBE_DEV_PRIVATE_TO_INTR (dev->data->dev_private); -int link_up; +bool link_up;int diag;u32 speed =0 ; -int wait =1 ; +bool wait = true;bool autoneg = false;memset (&link,0 ,sizeof (link));
@@ -4008,7 +4010,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,/* check if it needs to wait to complete, if lsc interrupt is enabled */ if (wait_to_complete ==0 || dev->data->dev_conf.intr_conf.lsc !=0 ) - wait =0 ; + wait = false;if (vf) diag =ixgbevf_check_link (hw, &link_speed, &link_up, wait);
@@ -4021,7 +4023,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,return rte_eth_linkstatus_set (dev, &link); } -if (link_up ==0 ) { +if (!link_up) { intr->flags |=IXGBE_FLAG_NEED_LINK_CONFIG ;return rte_eth_linkstatus_set (dev, &link); }
drivers/net/ixgbe/ixgbe_rxtx.c +1 -1
@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;union ixgbe_adv_rx_desc rxd;uint16_t data_len;uint16_t next_id;
drivers/net/qede/base/bcm_osal.h +2 -4
@@ -7,6 +7,8 @@#ifndef __BCM_OSAL_H#define __BCM_OSAL_H +#include <stdbool.h> +#include <rte_byteorder.h> #include <rte_spinlock.h> #include <rte_malloc.h>
@@ -71,10 +73,6 @@ typedef size_t osal_size_t;typedef intptr_t osal_int_ptr_t ; -typedef int bool ; -#define true 1 -#define false 0 -#define nothing do {} while (0)/* Delays */
drivers/net/qede/base/ecore_vf.c +1 -2
@@ -445,8 +445,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) }/* @DPDK */ -if ((~p_iov->b_pre_fp_hsi & -ETH_HSI_VER_MINOR ) && +if (!p_iov->b_pre_fp_hsi && (resp->pfdev_info.minor_fp_hsi <ETH_HSI_VER_MINOR ))DP_INFO (p_hwfn, "PF is using older fastpath HSI;"
drivers/net/qede/qede_ethdev.c +1 -1
@@ -534,7 +534,7 @@ int qede_activate_vport(struct rte_eth_dev *eth_dev, bool flg) params.update_vport_active_tx_flg =1 ; params.vport_active_rx_flg = flg; params.vport_active_tx_flg = flg; -if (~qdev->enable_tx_switching & flg) { +if (!qdev->enable_tx_switching && flg) { params.update_tx_switching_flg =1 ; params.tx_switching_flg = !flg; }
drivers/net/vmxnet3/base/vmxnet3_osdep.h +2 -1
@@ -5,11 +5,12 @@#ifndef _VMXNET3_OSDEP_H#define _VMXNET3_OSDEP_H +#include <stdbool.h> +typedef uint64_t uint64 ;typedef uint32_t uint32 ;typedef uint16_t uint16 ;typedef uint8_t uint8 ; -typedef int bool ;typedef char Bool ;#ifndef UNLIKELY
Signature · 1 line
2.19.0
Quoted 42 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, September 20, 2018 5:49 AM
To: Ferruh Yigit <[email protected]>; Rahul Lakkireddy <[email protected]>; Wenzhuo Lu <[email protected]>; Qi Zhang <[email protected]>; Xiao Wang <[email protected]>; Konstantin Ananyev <[email protected]>; Mody, Rasesh <[email protected]>; Patil, Harish <[email protected]>; Shaikh, Shahed <[email protected]>; Yong Wang <[email protected]>
Cc: [email protected]
Subject: [PATCH]drivers/net: do not redefine boolExternal Email
When trying to include
stdbool.hin DPDK base headers, there are a lot of conflicts with drivers which redefine bool/true/false
in their compatibility layer.It is fixed by including
stdbool.hin these drivers. Some errors with usage of bool type are also fixed in some drivers.Note: the driver qede has a surprising mix of bool and int:
(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR) where the first variable is boolean and the version is a number. It is replaced by !p_iov->b_pre_fp_hsiSigned-off-by Thomas Monjalon <[email protected]>--- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/e1000/base/e1000_osdep.h | 5 +---- drivers/net/fm10k/base/fm10k_osdep.h | 8 +------- drivers/net/fm10k/fm10k_ethdev.c | 4 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 6 +----- drivers/net/ixgbe/ixgbe_ethdev.c | 16 +++++++++------- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/net/qede/base/ecore_vf.c | 3 +-- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 3 ++- 11 files changed, 22 insertions(+), 35 deletions(-)
...
Quoted 31 lines
/* Delays */
drivers/net/qede/base/ecore_vf.c +1
-2@@ -445,8 +445,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) }/* @DPDK */ -if ((~p_iov->b_pre_fp_hsi & -ETH_HSI_VER_MINOR ) && +if (!p_iov->b_pre_fp_hsi && (resp->pfdev_info.minor_fp_hsi <ETH_HSI_VER_MINOR )) DP_INFO(p_hwfn,"PF is using older fastpath HSI;"
drivers/net/qede/qede_ethdev.c +1
-1@@ -534,7 +534,7 @@ int qede_activate_vport(struct rte_eth_dev *eth_dev, bool flg) params.update_vport_active_tx_flg = 1; params.vport_active_rx_flg = flg; params.vport_active_tx_flg = flg; -if (~qdev->enable_tx_switching & flg) { +if (!qdev->enable_tx_switching && flg) { params.update_tx_switching_flg =1 ; params.tx_switching_flg = !flg;
Quoted 1 line
}
For qede changes -
Quoted 27 lines · Thomas Monjalon
When trying to include
stdbool.hin DPDK base headers, there are a lot of conflicts with drivers which redefine bool/true/false
in their compatibility layer.It is fixed by including
stdbool.hin these drivers. Some errors with usage of bool type are also fixed in some drivers.Note: the driver qede has a surprising mix of bool and int:
(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR) where the first variable is boolean and the version is a number. It is replaced by !p_iov->b_pre_fp_hsiSigned-off-by Thomas Monjalon <[email protected]>--- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/e1000/base/e1000_osdep.h | 5 +---- drivers/net/fm10k/base/fm10k_osdep.h | 8 +------- drivers/net/fm10k/fm10k_ethdev.c | 4 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 6 +----- drivers/net/ixgbe/ixgbe_ethdev.c | 16 +++++++++------- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/net/qede/base/ecore_vf.c | 3 +-- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 3 ++- 11 files changed, 22 insertions(+), 35 deletions(-)
<...>
Quoted 17 lines
drivers/net/e1000/base/e1000_osdep.h +1
-1@@ -35,6 +35,7 @@#ifndef _E1000_OSDEP_H_#define _E1000_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h> @@ -87,7 +88,6 @@ typedef int64_t s64;typedef int32_t s32 ;typedef int16_t s16 ;typedef int8_t s8 ; -typedef int bool ;#define __le16 u16#define __le32 u32
drivers/net/e1000/base/e1000_osdep.h static inline uint16_t e1000_read_addr16(volatile void *addr) · line 197
Quoted 6 lines
drivers/net/e1000/base/e1000_osdep.h +0
-3@@ -192,7 +192,4 @@ static inline uint16_t e1000_read_addr16(volatile void *addr)#define ETH_ADDR_LEN 6#endif -#define false FALSE -#define true TRUE -
It is too much hassle to update Intel base driver code. What would happen if not include stdbool and keep define for base code updates? Will it break build for applications?
21/09/2018 15:47, Ferruh Yigit:
Quoted 51 lines · Thomas Monjalon
Quoted 27 lines
When trying to include
stdbool.hin DPDK base headers, there are a lot of conflicts with drivers which redefine bool/true/false
in their compatibility layer.It is fixed by including
stdbool.hin these drivers. Some errors with usage of bool type are also fixed in some drivers.Note: the driver qede has a surprising mix of bool and int:
(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR) where the first variable is boolean and the version is a number. It is replaced by !p_iov->b_pre_fp_hsiSigned-off-by Thomas Monjalon <[email protected]>--- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/e1000/base/e1000_osdep.h | 5 +---- drivers/net/fm10k/base/fm10k_osdep.h | 8 +------- drivers/net/fm10k/fm10k_ethdev.c | 4 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 6 +----- drivers/net/ixgbe/ixgbe_ethdev.c | 16 +++++++++------- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/net/qede/base/ecore_vf.c | 3 +-- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 3 ++- 11 files changed, 22 insertions(+), 35 deletions(-)<...>
Quoted 20 lines
drivers/net/e1000/base/e1000_osdep.h +1
-1@@ -35,6 +35,7 @@#ifndef _E1000_OSDEP_H_#define _E1000_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h> @@ -87,7 +88,6 @@ typedef int64_t s64;typedef int32_t s32 ;typedef int16_t s16 ;typedef int8_t s8 ; -typedef int bool ;#define __le16 u16#define __le32 u32@@ -192,7 +192,4 @@ static inline uint16_t e1000_read_addr16(volatile void *addr)#define ETH_ADDR_LEN 6#endif
Quoted 5 lines
drivers/net/e1000/base/e1000_osdep.h static inline uint16_t e1000_read_addr16(volatile void *addr) · line 197
Quoted 3 lines
drivers/net/e1000/base/e1000_osdep.h +0
-3-#define false FALSE -#define true TRUE -It is too much hassle to update Intel base driver code.
It is not really base driver code.
It was agreed that *_osdep.h can be modified:
http://git.dpdk.org/dpdk/tree/drivers/net/ixgbe/base/README#n56
Quoted 3 lines
What would happen if not
include stdbool and keep define for base code updates? Will it break build for applications?
The problem is not applications, but using stdbool in DPDK headers.
Quoted 58 lines · Thomas Monjalon
21/09/2018 15:47, Ferruh Yigit:
Quoted 51 lines · Thomas Monjalon
Quoted 27 lines
When trying to include
stdbool.hin DPDK base headers, there are a lot of conflicts with drivers which redefine bool/true/false
in their compatibility layer.It is fixed by including
stdbool.hin these drivers. Some errors with usage of bool type are also fixed in some drivers.Note: the driver qede has a surprising mix of bool and int:
(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR) where the first variable is boolean and the version is a number. It is replaced by !p_iov->b_pre_fp_hsiSigned-off-by Thomas Monjalon <[email protected]>--- drivers/net/cxgbe/cxgbe_compat.h | 2 +- drivers/net/e1000/base/e1000_osdep.h | 5 +---- drivers/net/fm10k/base/fm10k_osdep.h | 8 +------- drivers/net/fm10k/fm10k_ethdev.c | 4 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 6 +----- drivers/net/ixgbe/ixgbe_ethdev.c | 16 +++++++++------- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/qede/base/bcm_osal.h | 6 ++---- drivers/net/qede/base/ecore_vf.c | 3 +-- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 3 ++- 11 files changed, 22 insertions(+), 35 deletions(-)<...>
Quoted 20 lines
drivers/net/e1000/base/e1000_osdep.h +1
-1@@ -35,6 +35,7 @@#ifndef _E1000_OSDEP_H_#define _E1000_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h> @@ -87,7 +88,6 @@ typedef int64_t s64;typedef int32_t s32 ;typedef int16_t s16 ;typedef int8_t s8 ; -typedef int bool ;#define __le16 u16#define __le32 u32@@ -192,7 +192,4 @@ static inline uint16_t e1000_read_addr16(volatile void *addr)#define ETH_ADDR_LEN 6#endif Quoted 5 lines
drivers/net/e1000/base/e1000_osdep.h static inline uint16_t e1000_read_addr16(volatile void *addr) · line 197
Quoted 3 lines
drivers/net/e1000/base/e1000_osdep.h +0
-3-#define false FALSE -#define true TRUE -It is too much hassle to update Intel base driver code.
Quoted 3 lines
It is not really base driver code.
It was agreed that *_osdep.h can be modified:
http://git.dpdk.org/dpdk/tree/drivers/net/ixgbe/base/README#n56
Right.
Quoted 6 lines
Quoted 4 lines
What would happen if not
include stdbool and keep define for base code updates? Will it break build for applications?The problem is not applications, but using stdbool in DPDK headers.
I see.
Quoted 14 lines · Thomas Monjalon
When trying to include
stdbool.hin DPDK base headers, there are a lot of conflicts with drivers which redefine bool/true/false
in their compatibility layer.It is fixed by including
stdbool.hin these drivers. Some errors with usage of bool type are also fixed in some drivers.Note: the driver qede has a surprising mix of bool and int:
(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR) where the first variable is boolean and the version is a number. It is replaced by !p_iov->b_pre_fp_hsiSigned-off-by Thomas Monjalon <[email protected]>
<...>
Quoted 21 lines
drivers/net/e1000/base/e1000_osdep.h +1
-1@@ -35,6 +35,7 @@#ifndef _E1000_OSDEP_H_#define _E1000_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h> @@ -87,7 +88,6 @@ typedef int64_t s64;typedef int32_t s32 ;typedef int16_t s16 ;typedef int8_t s8 ; -typedef int bool ;#define __le16 u16#define __le32 u32
drivers/net/e1000/base/e1000_osdep.h static inline uint16_t e1000_read_addr16(volatile void *addr) · line 196
Quoted 5 lines
drivers/net/e1000/base/e1000_osdep.h +0
-2@@ -192,7 +192,4 @@ static inline uint16_t e1000_read_addr16(volatile void *addr)#define ETH_ADDR_LEN 6#endif -#define false FALSE -#define true TRUE
TRUE and FALSE also defined in this patch, can we remove them too?
Quoted 15 lines
drivers/net/e1000/base/e1000_osdep.h +0
-1-#endif /* _E1000_OSDEP_H_ */ drivers/net/fm10k/base/fm10k_osdep.h +1
-0@@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.#ifndef _FM10K_OSDEP_H_#define _FM10K_OSDEP_H_ +#include <stdbool.h> #include <stdint.h> #include <string.h> #include <rte_atomic.h>
drivers/net/fm10k/base/fm10k_osdep.h POSSIBILITY OF SUCH DAMAGE. · line 69
Quoted 9 lines
drivers/net/fm10k/base/fm10k_osdep.h +0
-6@@ -61,12 +62,6 @@ POSSIBILITY OF SUCH DAMAGE.#define FALSE 0#define TRUE 1 -#ifndef false -#define false FALSE -#endif -#ifndef true -#define true TRUE -#endif
Same here, TRUE and FALSE defined in this header and used in .c files one or two places, what about remove them and convert usage to "true" and "false"
<...>
Quoted 13 lines
drivers/net/ixgbe/base/ixgbe_osdep.h +1
-0@@ -36,6 +36,7 @@#define _IXGBE_OS_H_#include <string.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h>
drivers/net/ixgbe/base/ixgbe_osdep.h line 72
Quoted 2 lines
drivers/net/ixgbe/base/ixgbe_osdep.h +0
-0@@ -70,8 +71,6 @@#define FALSE 0#define TRUE 1
Same again, can we remove TRUE and FALSE
<...>
drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_start(struct rte_eth_dev *dev) · line 2532
Quoted 12 lines
drivers/net/ixgbe/ixgbe_ethdev.c +3
-1@@ -2527,7 +2527,9 @@ ixgbe_dev_start(struct rte_eth_dev *dev)struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev);struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;uint32_t intr_vector =0 ; -int err, link_up =0 , negotiate =0 ; +int err; +bool negotiate = false; +bool link_up = false;
"link_up" is used in assignment to a single bit in uint16_t:dev->data->dev_link.link_status = link_up;
When "link_up" is bool, should we change that line to:
if (link_up)
dev->data->dev_link.link_status = 1; else dev->data->dev_link.link_status = 0;
<...>
drivers/net/ixgbe/ixgbe_ethdev.c ixgbevf_dev_info_get(struct rte_eth_dev *dev, · line 3875
Quoted 6 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1
-1@@ -3870,7 +3872,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,static int ixgbevf_check_link (struct ixgbe_hw *hw,ixgbe_link_speed *speed, -int *link_up,int wait_to_complete) +bool *link_up,int wait_to_complete)
Also need to change "wait_to_complete" to bool because below changes start sending bool type to this function.
<...>
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, · line 2028
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;
This change is unrelated. Can we separate this one?
24/09/2018 17:06, Ferruh Yigit:
Quoted 5 lines · Thomas Monjalon
Review
Quoted 2 lines
(quoted diff) +0
-2-#define false FALSE -#define true TRUETRUE and FALSE also defined in this patch, can we remove them too?
I don't see the need to remove TRUE and FALSE.
The base drivers use them on other platforms, and it is convenient to not change the base drivers.
[...]
Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c ixgbevf_dev_info_get(struct rte_eth_dev *dev, · line 3875
Quoted 4 lines
static int
ixgbevf_check_link(structixgbe_hw*hw,ixgbe_link_speed*speed,drivers/net/ixgbe/ixgbe_ethdev.c +1
-1- int *link_up, int wait_to_complete) + bool *link_up, int wait_to_complete)Also need to change "
wait_to_complete" to bool because below changes start sending bool type to this function.
[...]
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, · line 2028
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;This change is unrelated. Can we separate this one?
Yes it looks unrelated but it becomes necessary when including stdbool.h. I don't know the root cause, but yes, it may deserve a separate commit. Maybe an ixgbe maintainer can take care of it?
Quoted 10 lines · Thomas Monjalon
24/09/2018 17:06, Ferruh Yigit:
Quoted 5 lines · Thomas Monjalon
Review
Quoted 2 lines
(quoted diff) +0
-2-#define false FALSE -#define true TRUETRUE and FALSE also defined in this patch, can we remove them too?
I don't see the need to remove TRUE and FALSE.
The base drivers use them on other platforms, and it is convenient to not change the base drivers.
Not needed, but previously it was only TRUE & FALSE, and true & false was define to them.
Now there are TRUE & FALSE from header files and true & false from stdbool and these pairs used interchangeably, I thought it can better to unify the usage to stdbool ones.
Quoted 22 lines
[...]
Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c ixgbevf_dev_info_get(struct rte_eth_dev *dev, · line 3875
Quoted 4 lines
static int
ixgbevf_check_link(structixgbe_hw*hw,ixgbe_link_speed*speed,drivers/net/ixgbe/ixgbe_ethdev.c +1
-1- int *link_up, int wait_to_complete) + bool *link_up, int wait_to_complete)Also need to change "
wait_to_complete" to bool because below changes start sending bool type to this function.[...]
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, · line 2028
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;This change is unrelated. Can we separate this one?
Quoted 3 lines
Yes it looks unrelated but it becomes necessary when including
stdbool.h. I don't know the root cause, but yes, it may deserve a separate commit. Maybe an ixgbe maintainer can take care of it?
Why becomes necessary? Does it give a build warning etc?
My concern is this is in data path, one extra assignment, it would be better to confirm it is really needed.
25/09/2018 10:03, Ferruh Yigit:
Quoted 12 lines · Thomas Monjalon
Quoted 11 lines
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, · line 2028
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;This change is unrelated. Can we separate this one?
Quoted 7 lines
Quoted 3 lines
Yes it looks unrelated but it becomes necessary when including
stdbool.h. I don't know the root cause, but yes, it may deserve a separate commit. Maybe an ixgbe maintainer can take care of it?Why becomes necessary? Does it give a build warning etc?
My concern is this is in data path, one extra assignment, it would be better to confirm it is really needed.
Yes I had a compilation error.
If you cannot reproduce it, I will try to re-run my compilation tests.
Quoted 17 lines · Thomas Monjalon
25/09/2018 10:03, Ferruh Yigit:
Quoted 16 lines · Thomas Monjalon
Quoted 14 lines
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, · line 2028
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;This change is unrelated. Can we separate this one?
Yes it looks unrelated but it becomes necessary when including
stdbool.h. I don't know the root cause, but yes, it may deserve a separate commit. Maybe an ixgbe maintainer can take care of it?
Quoted 6 lines
Quoted 3 lines
Why becomes necessary? Does it give a build warning etc?
My concern is this is in data path, one extra assignment, it would be better to confirm it is really needed.Yes I had a compilation error.
If you cannot reproduce it, I will try to re-run my compilation tests.
I got the error with gcc [1] but it seems false positive and only generated when <stdbool.h> included in ixgbe_rxtx.c, so this is an odd one, I am not able to find root cause.
But since it is false positive, what do you think adding compiler option to disable this warning for this file?
[1].../drivers/net/ixgbe/ixgbe_rxtx.c:2139:14: error: ‘nmb’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
rxe->mbuf = nmb;
~~~~~~~~~~^~~~~$ gcc --version gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5)
03/10/2018 16:11, Ferruh Yigit:
Quoted 25 lines · Thomas Monjalon
Quoted 17 lines
25/09/2018 10:03, Ferruh Yigit:
Quoted 16 lines · Thomas Monjalon
Quoted 14 lines
Quoted 10 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, · line 2028
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2025,7 +2025,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;This change is unrelated. Can we separate this one?
Yes it looks unrelated but it becomes necessary when including
stdbool.h. I don't know the root cause, but yes, it may deserve a separate commit. Maybe an ixgbe maintainer can take care of it?Quoted 6 lines
Quoted 3 lines
Why becomes necessary? Does it give a build warning etc?
My concern is this is in data path, one extra assignment, it would be better to confirm it is really needed.Yes I had a compilation error.
If you cannot reproduce it, I will try to re-run my compilation tests.
Quoted 6 lines
I got the error with gcc [1] but it seems false positive and only generated when <
stdbool.h> included inixgbe_rxtx.c, so this is an odd one, I am not able to find root cause.But since it is false positive, what do you think adding compiler option to disable this warning for this file?
I don't like disabling warnings on files.
We can take time to work on this patch. It is not required for 18.11.
Quoted 8 lines
[1]
.../drivers/net/ixgbe/ixgbe_rxtx.c:2139:14: error: ‘nmb’ may be used uninitialized in this function [-Werror=maybe-uninitialized]rxe->mbuf = nmb; ~~~~~~~~~~^~~~~$ gcc --version gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5)