From patchwork Thu Jan 2 17:48:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64168 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9370A04F3; Thu, 2 Jan 2020 18:49:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A11121C199; Thu, 2 Jan 2020 18:49:19 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id A1A7F1C193 for ; Thu, 2 Jan 2020 18:49:16 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 080DEDA7; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EDA773F703; Thu, 2 Jan 2020 09:49:15 -0800 (PST) From: Dharmik Thakkar To: Wenzhuo Lu , Konstantin Ananyev Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:32 +0000 Message-Id: <20200102174838.12908-2-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of '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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Compilation issue arises due to multiple definitions of 'bool' in 'ixgbe_ethdev.h'. Error: '/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c: In function ‘ixgbe_dev_setup_link_alarm_handler’: /dpdk/drivers/net/ixgbe/ixgbe_ethdev.c:4075:43: error: passing argument 3 of ‘ixgbe_get_link_capabilities’ from incompatible pointer type [-Werror=incompatible-pointer-types] ixgbe_get_link_capabilities(hw, &speed, &autoneg); ^ In file included from /dpdk/drivers/net/ixgbe/ixgbe_ethdev.c:41:0: /dpdk/drivers/net/ixgbe/base/ixgbe_api.h:63:5: note: expected ‘bool * {aka int *}’ but argument is of type ‘_Bool *’' Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang Reviewed-by: Gavin Hu --- drivers/net/ixgbe/base/ixgbe_osdep.h | 4 +--- drivers/net/ixgbe/ixgbe_ethdev.c | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index ea8dc1cbe570..844d1701f595 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -82,9 +83,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 2c6fd0f13128..6cbd783e3a21 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2544,7 +2544,8 @@ 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 link_up = 0, negotiate = 0; uint32_t speed = 0; uint32_t allowed_speeds = 0; int mask = 0; @@ -3993,7 +3994,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) { struct ixgbe_adapter *adapter = container_of(hw, struct ixgbe_adapter, hw); @@ -4124,7 +4125,7 @@ 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; int wait = 1; u32 esdp_reg; From patchwork Thu Jan 2 17:48:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64170 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6FDC6A04F3; Thu, 2 Jan 2020 18:49:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 282311C1AA; Thu, 2 Jan 2020 18:49:23 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id C55E21C195 for ; Thu, 2 Jan 2020 18:49:16 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 253D91007; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 176863F703; Thu, 2 Jan 2020 09:49:16 -0800 (PST) From: Dharmik Thakkar To: Rahul Lakkireddy Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:33 +0000 Message-Id: <20200102174838.12908-3-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 2/7] net/cxgbe: remove 'typedef int 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang Reviewed-by: Ruifeng Wang --- drivers/net/cxgbe/cxgbe_compat.h | 4 +--- drivers/net/cxgbe/cxgbe_main.c | 13 +++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index 20e4f8af20ee..83ae1c2e5a83 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -86,7 +87,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 @@ -122,8 +122,6 @@ typedef uint64_t dma_addr_t; #define FALSE 0 #define TRUE 1 -#define false 0 -#define true 1 #ifndef min #define min(a, b) RTE_MIN(a, b) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index cc5f4df3acbf..0d0827c0e159 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -709,11 +709,12 @@ static int cxgbe_get_devargs(struct rte_devargs *devargs, const char *key, return ret; } -static void cxgbe_get_devargs_int(struct adapter *adap, int *dst, - const char *key, int default_value) +static void cxgbe_get_devargs_int(struct adapter *adap, bool *dst, + const char *key, bool default_value) { struct rte_pci_device *pdev = adap->pdev; - int ret, devarg_value = default_value; + int ret; + bool devarg_value = default_value; *dst = default_value; if (!pdev) @@ -729,11 +730,11 @@ static void cxgbe_get_devargs_int(struct adapter *adap, int *dst, void cxgbe_process_devargs(struct adapter *adap) { cxgbe_get_devargs_int(adap, &adap->devargs.keep_ovlan, - CXGBE_DEVARG_CMN_KEEP_OVLAN, 0); + CXGBE_DEVARG_CMN_KEEP_OVLAN, false); cxgbe_get_devargs_int(adap, &adap->devargs.tx_mode_latency, - CXGBE_DEVARG_CMN_TX_MODE_LATENCY, 0); + CXGBE_DEVARG_CMN_TX_MODE_LATENCY, false); cxgbe_get_devargs_int(adap, &adap->devargs.force_link_up, - CXGBE_DEVARG_VF_FORCE_LINK_UP, 0); + CXGBE_DEVARG_VF_FORCE_LINK_UP, false); } static void configure_vlan_types(struct adapter *adapter) From patchwork Thu Jan 2 17:48:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64169 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C367DA04F3; Thu, 2 Jan 2020 18:49:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5054F1C1A2; Thu, 2 Jan 2020 18:49:21 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id B38EF1C194 for ; Thu, 2 Jan 2020 18:49:16 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 390D61063; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3490F3F703; Thu, 2 Jan 2020 09:49:16 -0800 (PST) From: Dharmik Thakkar To: Yong Wang Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:34 +0000 Message-Id: <20200102174838.12908-4-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: remove 'typedef int 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Remove 'typedef char Bool' and use 'bool' instead. Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang Reviewed-by: Ruifeng Wang Acked-by: Yong Wang --- drivers/net/vmxnet3/base/vmxnet3_defs.h | 6 +++--- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/vmxnet3/base/vmxnet3_defs.h b/drivers/net/vmxnet3/base/vmxnet3_defs.h index 296d7e54c330..8d62b3e116e6 100644 --- a/drivers/net/vmxnet3/base/vmxnet3_defs.h +++ b/drivers/net/vmxnet3/base/vmxnet3_defs.h @@ -577,7 +577,7 @@ enum vmxnet3_intr_type { typedef #include "vmware_pack_begin.h" struct Vmxnet3_IntrConf { - Bool autoMask; + bool autoMask; uint8 numIntrs; /* # of interrupts */ uint8 eventIntrIdx; uint8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for each intr */ @@ -593,7 +593,7 @@ Vmxnet3_IntrConf; typedef #include "vmware_pack_begin.h" struct Vmxnet3_QueueStatus { - Bool stopped; + bool stopped; uint8 _pad[3]; __le32 error; } @@ -613,7 +613,7 @@ Vmxnet3_TxQueueCtrl; typedef #include "vmware_pack_begin.h" struct Vmxnet3_RxQueueCtrl { - Bool updateRxProd; + bool updateRxProd; uint8 _pad[7]; __le64 reserved; } diff --git a/drivers/net/vmxnet3/base/vmxnet3_osdep.h b/drivers/net/vmxnet3/base/vmxnet3_osdep.h index c9b92b049fe7..381a68db6957 100644 --- a/drivers/net/vmxnet3/base/vmxnet3_osdep.h +++ b/drivers/net/vmxnet3/base/vmxnet3_osdep.h @@ -5,12 +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 #define UNLIKELY(x) __builtin_expect((x),0) From patchwork Thu Jan 2 17:48:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64173 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A5F46A04F3; Thu, 2 Jan 2020 18:50:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD9621C1BD; Thu, 2 Jan 2020 18:49:27 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 0EBC11C192 for ; Thu, 2 Jan 2020 18:49:17 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4E2E111B3; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 487603F703; Thu, 2 Jan 2020 09:49:16 -0800 (PST) From: Dharmik Thakkar To: Rasesh Mody , Shahed Shaikh Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:35 +0000 Message-Id: <20200102174838.12908-5-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 4/7] net/bnx2x: remove 'typedef int 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang Reviewed-by: Ruifeng Wang --- drivers/net/bnx2x/bnx2x_ethdev.h | 4 +-- drivers/net/bnx2x/ecore_sp.c | 46 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h index bd3ef143b63d..f712bb3e84c6 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.h +++ b/drivers/net/bnx2x/bnx2x_ethdev.h @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -47,9 +48,6 @@ #define FALSE 0 #define TRUE 1 -typedef int bool; -#define false 0 -#define true 1 #define min(a,b) RTE_MIN(a,b) #define mb() rte_mb() diff --git a/drivers/net/bnx2x/ecore_sp.c b/drivers/net/bnx2x/ecore_sp.c index b9bca9115e60..00c33a317512 100644 --- a/drivers/net/bnx2x/ecore_sp.c +++ b/drivers/net/bnx2x/ecore_sp.c @@ -245,7 +245,7 @@ static struct ecore_exeq_elem *ecore_exe_queue_alloc_elem(struct } /************************ raw_obj functions ***********************************/ -static int ecore_raw_check_pending(struct ecore_raw_obj *o) +static bool ecore_raw_check_pending(struct ecore_raw_obj *o) { /* * !! converts the value returned by ECORE_TEST_BIT such that it @@ -328,7 +328,7 @@ static int ecore_raw_wait(struct bnx2x_softc *sc, struct ecore_raw_obj *raw) /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/ /* credit handling callbacks */ -static int ecore_get_cam_offset_mac(struct ecore_vlan_mac_obj *o, int *offset) +static bool ecore_get_cam_offset_mac(struct ecore_vlan_mac_obj *o, int *offset) { struct ecore_credit_pool_obj *mp = o->macs_pool; @@ -337,7 +337,7 @@ static int ecore_get_cam_offset_mac(struct ecore_vlan_mac_obj *o, int *offset) return mp->get_entry(mp, offset); } -static int ecore_get_credit_mac(struct ecore_vlan_mac_obj *o) +static bool ecore_get_credit_mac(struct ecore_vlan_mac_obj *o) { struct ecore_credit_pool_obj *mp = o->macs_pool; @@ -346,14 +346,14 @@ static int ecore_get_credit_mac(struct ecore_vlan_mac_obj *o) return mp->get(mp, 1); } -static int ecore_put_cam_offset_mac(struct ecore_vlan_mac_obj *o, int offset) +static bool ecore_put_cam_offset_mac(struct ecore_vlan_mac_obj *o, int offset) { struct ecore_credit_pool_obj *mp = o->macs_pool; return mp->put_entry(mp, offset); } -static int ecore_put_credit_mac(struct ecore_vlan_mac_obj *o) +static bool ecore_put_credit_mac(struct ecore_vlan_mac_obj *o) { struct ecore_credit_pool_obj *mp = o->macs_pool; @@ -661,7 +661,7 @@ static struct ecore_vlan_mac_registry_elem *ecore_check_mac_del(struct bnx2x_sof } /* check_move() callback */ -static int ecore_check_move(struct bnx2x_softc *sc, +static bool ecore_check_move(struct bnx2x_softc *sc, struct ecore_vlan_mac_obj *src_o, struct ecore_vlan_mac_obj *dst_o, union ecore_classification_ramrod_data *data) @@ -686,7 +686,7 @@ static int ecore_check_move(struct bnx2x_softc *sc, return TRUE; } -static int ecore_check_move_always_err(__rte_unused struct bnx2x_softc *sc, +static bool ecore_check_move_always_err(__rte_unused struct bnx2x_softc *sc, __rte_unused struct ecore_vlan_mac_obj *src_o, __rte_unused struct ecore_vlan_mac_obj *dst_o, __rte_unused union @@ -713,7 +713,7 @@ static uint8_t ecore_vlan_mac_get_rx_tx_flag(struct ecore_vlan_mac_obj } void ecore_set_mac_in_nig(struct bnx2x_softc *sc, - int add, unsigned char *dev_addr, int index) + bool add, unsigned char *dev_addr, int index) { uint32_t wb_data[2]; uint32_t reg_offset = ECORE_PORT_ID(sc) ? NIG_REG_LLH1_FUNC_MEM : @@ -754,7 +754,7 @@ void ecore_set_mac_in_nig(struct bnx2x_softc *sc, * */ static void ecore_vlan_mac_set_cmd_hdr_e2(struct ecore_vlan_mac_obj *o, - int add, int opcode, + bool add, int opcode, struct eth_classify_cmd_header *hdr) { @@ -803,7 +803,7 @@ static void ecore_set_one_mac_e2(struct bnx2x_softc *sc, (struct eth_classify_rules_ramrod_data *)(raw->rdata); int rule_cnt = rule_idx + 1, cmd = elem->cmd_data.vlan_mac.cmd; union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; - int add = (cmd == ECORE_VLAN_MAC_ADD) ? TRUE : FALSE; + bool add = (cmd == ECORE_VLAN_MAC_ADD) ? TRUE : FALSE; unsigned long *vlan_mac_flags = &elem->cmd_data.vlan_mac.vlan_mac_flags; uint8_t *mac = elem->cmd_data.vlan_mac.u.mac.mac; @@ -3117,12 +3117,12 @@ static void ecore_mcast_set_sched(struct ecore_mcast_obj *o) ECORE_SMP_MB_AFTER_CLEAR_BIT(); } -static int ecore_mcast_check_sched(struct ecore_mcast_obj *o) +static bool ecore_mcast_check_sched(struct ecore_mcast_obj *o) { return ! !ECORE_TEST_BIT(o->sched_state, o->raw.pstate); } -static int ecore_mcast_check_pending(struct ecore_mcast_obj *o) +static bool ecore_mcast_check_pending(struct ecore_mcast_obj *o) { return o->raw.check_pending(&o->raw) || o->check_sched(o); } @@ -3195,7 +3195,7 @@ void ecore_init_mcast_obj(struct bnx2x_softc *sc, * returns TRUE if (v + a) was less than u, and FALSE otherwise. * */ -static int __atomic_add_ifless(ecore_atomic_t * v, int a, int u) +static bool __atomic_add_ifless(ecore_atomic_t *v, int a, int u) { int c, old; @@ -3223,7 +3223,7 @@ static int __atomic_add_ifless(ecore_atomic_t * v, int a, int u) * returns TRUE if (v - a) was more or equal than u, and FALSE * otherwise. */ -static int __atomic_dec_ifmoe(ecore_atomic_t * v, int a, int u) +static bool __atomic_dec_ifmoe(ecore_atomic_t *v, int a, int u) { int c, old; @@ -3241,9 +3241,9 @@ static int __atomic_dec_ifmoe(ecore_atomic_t * v, int a, int u) return TRUE; } -static int ecore_credit_pool_get(struct ecore_credit_pool_obj *o, int cnt) +static bool ecore_credit_pool_get(struct ecore_credit_pool_obj *o, int cnt) { - int rc; + bool rc; ECORE_SMP_MB(); rc = __atomic_dec_ifmoe(&o->credit, cnt, 0); @@ -3252,9 +3252,9 @@ static int ecore_credit_pool_get(struct ecore_credit_pool_obj *o, int cnt) return rc; } -static int ecore_credit_pool_put(struct ecore_credit_pool_obj *o, int cnt) +static bool ecore_credit_pool_put(struct ecore_credit_pool_obj *o, int cnt) { - int rc; + bool rc; ECORE_SMP_MB(); @@ -3276,14 +3276,14 @@ static int ecore_credit_pool_check(struct ecore_credit_pool_obj *o) return cur_credit; } -static int ecore_credit_pool_always_TRUE(__rte_unused struct +static bool ecore_credit_pool_always_TRUE(__rte_unused struct ecore_credit_pool_obj *o, __rte_unused int cnt) { return TRUE; } -static int ecore_credit_pool_get_entry(struct ecore_credit_pool_obj *o, +static bool ecore_credit_pool_get_entry(struct ecore_credit_pool_obj *o, int *offset) { int idx, vec, i; @@ -3312,7 +3312,7 @@ static int ecore_credit_pool_get_entry(struct ecore_credit_pool_obj *o, return FALSE; } -static int ecore_credit_pool_put_entry(struct ecore_credit_pool_obj *o, +static bool ecore_credit_pool_put_entry(struct ecore_credit_pool_obj *o, int offset) { if (offset < o->base_pool_offset) @@ -3329,14 +3329,14 @@ static int ecore_credit_pool_put_entry(struct ecore_credit_pool_obj *o, return TRUE; } -static int ecore_credit_pool_put_entry_always_TRUE(__rte_unused struct +static bool ecore_credit_pool_put_entry_always_TRUE(__rte_unused struct ecore_credit_pool_obj *o, __rte_unused int offset) { return TRUE; } -static int ecore_credit_pool_get_entry_always_TRUE(__rte_unused struct +static bool ecore_credit_pool_get_entry_always_TRUE(__rte_unused struct ecore_credit_pool_obj *o, __rte_unused int *offset) { From patchwork Thu Jan 2 17:48:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64172 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F35F6A04F3; Thu, 2 Jan 2020 18:49:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF6951C1B7; Thu, 2 Jan 2020 18:49:26 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 19D821C193 for ; Thu, 2 Jan 2020 18:49:17 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 609C611D4; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C1CE3F703; Thu, 2 Jan 2020 09:49:16 -0800 (PST) From: Dharmik Thakkar To: Wenzhuo Lu Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:36 +0000 Message-Id: <20200102174838.12908-6-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 5/7] net/e1000: remove 'typedef int 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang --- drivers/net/e1000/base/e1000_osdep.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/e1000/base/e1000_osdep.h b/drivers/net/e1000/base/e1000_osdep.h index fd22c7e41fcf..94a49f340446 100644 --- a/drivers/net/e1000/base/e1000_osdep.h +++ b/drivers/net/e1000/base/e1000_osdep.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,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 @@ -163,7 +163,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_ */ From patchwork Thu Jan 2 17:48:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64171 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F33F5A04F3; Thu, 2 Jan 2020 18:49:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F07DC1C1B1; Thu, 2 Jan 2020 18:49:24 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 25A4B1C194 for ; Thu, 2 Jan 2020 18:49:17 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 74F2911FB; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6FF7C3F703; Thu, 2 Jan 2020 09:49:16 -0800 (PST) From: Dharmik Thakkar To: Qi Zhang , Xiao Wang Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:37 +0000 Message-Id: <20200102174838.12908-7-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 6/7] net/fm10k: remove 'typedef int 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang Reviewed-by: Ruifeng Wang Acked-by: Xiao Wang --- drivers/net/fm10k/base/fm10k_osdep.h | 8 +------- drivers/net/fm10k/fm10k_ethdev.c | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h index 3b6298010da5..019fba5e2534 100644 --- a/drivers/net/fm10k/base/fm10k_osdep.h +++ b/drivers/net/fm10k/base/fm10k_osdep.h @@ -6,6 +6,7 @@ #define _FM10K_OSDEP_H_ #include +#include #include #include #include @@ -32,12 +33,6 @@ #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; @@ -47,7 +42,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 407baa16c364..581c690b1842 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3210,19 +3210,19 @@ 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); hw->mac.ops.get_host_state(hw, &switch_ready); fm10k_mbx_unlock(hw); - if (switch_ready) + if (switch_ready == true) break; /* Delay some time to acquire async LPORT_MAP info. */ rte_delay_us(WAIT_SWITCH_MSG_US); } - if (switch_ready == 0) { + if (switch_ready == false) { PMD_INIT_LOG(ERR, "switch is not ready"); return -1; } From patchwork Thu Jan 2 17:48:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharmik Thakkar X-Patchwork-Id: 64174 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2852BA04F3; Thu, 2 Jan 2020 18:50:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC1D81C1C5; Thu, 2 Jan 2020 18:49:29 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 470091C195 for ; Thu, 2 Jan 2020 18:49:17 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A2FF1396; Thu, 2 Jan 2020 09:49:16 -0800 (PST) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 856C13F703; Thu, 2 Jan 2020 09:49:16 -0800 (PST) From: Dharmik Thakkar To: Rasesh Mody , Shahed Shaikh Cc: dev@dpdk.org, Dharmik Thakkar Date: Thu, 2 Jan 2020 17:48:38 +0000 Message-Id: <20200102174838.12908-8-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102174838.12908-1-dharmik.thakkar@arm.com> References: <20191003224419.23968-1-dharmik.thakkar@arm.com> <20200102174838.12908-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 7/7] net/qede: remove 'typedef int 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. (Not sure if the previous code is checking for true/false condition. Recommend careful review on this patch.) Signed-off-by: Dharmik Thakkar Reviewed-by: Phil Yang Reviewed-by: Ruifeng Wang --- drivers/net/qede/base/bcm_osal.h | 5 +---- drivers/net/qede/base/ecore_vf.c | 2 +- drivers/net/qede/qede_ethdev.c | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 0f09557cf06c..513f6a8b429f 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -7,6 +7,7 @@ #ifndef __BCM_OSAL_H #define __BCM_OSAL_H +#include #include #include #include @@ -71,10 +72,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 24846cfb51da..c5c081426281 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -446,7 +446,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) } /* @DPDK */ - if ((~p_iov->b_pre_fp_hsi & + if (((p_iov->b_pre_fp_hsi == true) & ETH_HSI_VER_MINOR) && (resp->pfdev_info.minor_fp_hsi < ETH_HSI_VER_MINOR)) DP_INFO(p_hwfn, diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 19d2e961913d..af99ce9c65e6 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -450,7 +450,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 == false) && (flg == true)) { params.update_tx_switching_flg = 1; params.tx_switching_flg = !flg; }