From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id CE6BC5B2E for ; Thu, 20 Sep 2018 02:20:51 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6560F21B7C; Wed, 19 Sep 2018 20:20:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 19 Sep 2018 20:20:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=qTk bIZ9CGFoW3rJF7WR69Z/zSfuVp+xNTXTJOaZ8CEw=; b=UUQ2+vRUUUeF8mwyG8J jnic+q+iqwh6x6c5gpeiydRGTGuv5u7g3Ukx06t1kmgwndN4jvKBaGeb8rELeNrK i0Fn+OROE7FtWJBZohTt6lhK6g7ffsAqeyRQv5Myx07Bxcb0tlGTj9M9GEhqmbjn Wv9EAdEL4IQYRaTDFyprDuJA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=qTkbIZ9CGFoW3rJF7WR69Z/zSfuVp+xNTXTJOaZ8C Ew=; b=EVG9+m4x80X8KcXCSUFhZlheobjkLBTIQhKEAKrmWEkm/mJbFqmCS+W04 JTLKJe57lvdIKWhEPUoJNZQn6/cWbiKO4hUAHEvK83GSLN2AKxw0dUQjSIff+OdR tAM4ao2IFJqw2pPSEyrvIa7MRE/a2DnpAEO6HeigdbOd3Dng2v6L7/RAFagyUbO0 lH/thw8ypzOg5uf0GgKCASBgahaD95DscoVY3ywe3p60UlyXs4PDWASj5fkEiqyb 9Vx+hY2AQW3bKHzpzfzrMu2bzBcCykDw47Xxjoq+eadRFPcLtHqH/Ot5L3WwBzlb HJfhHjrPyUx2gfT9N0G9NkNgdqldw== X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id DAE87E4680; Wed, 19 Sep 2018 20:20:48 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit , Rahul Lakkireddy , Wenzhuo Lu , Qi Zhang , Xiao Wang , Konstantin Ananyev , Rasesh Mody , Harish Patil , Shahed Shaikh , Yong Wang Cc: dev@dpdk.org Date: Thu, 20 Sep 2018 02:18:53 +0200 Message-Id: <20180920001853.23454-1-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] drivers/net: do not redefine bool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2018 00:20:52 -0000 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 Signed-off-by: Thomas Monjalon --- 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(-) diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index 5d47c5f3d..2650ffcab 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -7,6 +7,7 @@ #define _CXGBE_COMPAT_H_ #include +#include #include #include #include @@ -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 diff --git a/drivers/net/e1000/base/e1000_osdep.h b/drivers/net/e1000/base/e1000_osdep.h index b8868049f..556ed1742 100644 --- a/drivers/net/e1000/base/e1000_osdep.h +++ b/drivers/net/e1000/base/e1000_osdep.h @@ -35,6 +35,7 @@ #ifndef _E1000_OSDEP_H_ #define _E1000_OSDEP_H_ +#include #include #include #include @@ -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_ */ diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h index 199ebd8ea..9665239fd 100644 --- a/drivers/net/fm10k/base/fm10k_osdep.h +++ b/drivers/net/fm10k/base/fm10k_osdep.h @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef _FM10K_OSDEP_H_ #define _FM10K_OSDEP_H_ +#include #include #include #include @@ -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 diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 3359df3c8..243066e08 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -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; } diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index bb5dfd2af..39e9118aa 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -36,6 +36,7 @@ #define _IXGBE_OS_H_ #include +#include #include #include #include @@ -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() diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index cee886754..c272a4112 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -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); } diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index ae21f04a1..2dc14c47f 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -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; diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 630867fad..060ef8e1d 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -7,6 +7,8 @@ #ifndef __BCM_OSAL_H #define __BCM_OSAL_H +#include + #include #include #include @@ -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 */ diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index d2213f793..f5deb2916 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -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;" diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 7bb52b157..53a767b3e 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -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; } diff --git a/drivers/net/vmxnet3/base/vmxnet3_osdep.h b/drivers/net/vmxnet3/base/vmxnet3_osdep.h index c9b92b049..12b390acb 100644 --- a/drivers/net/vmxnet3/base/vmxnet3_osdep.h +++ b/drivers/net/vmxnet3/base/vmxnet3_osdep.h @@ -5,11 +5,12 @@ #ifndef _VMXNET3_OSDEP_H #define _VMXNET3_OSDEP_H +#include + typedef uint64_t uint64; typedef uint32_t uint32; typedef uint16_t uint16; typedef uint8_t uint8; -typedef int bool; typedef char Bool; #ifndef UNLIKELY -- 2.19.0