From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF36AA04F9; Fri, 10 Jan 2020 21:52:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AA911EBB9; Fri, 10 Jan 2020 21:52:19 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 498671EBA1 for ; Fri, 10 Jan 2020 21:52:10 +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 A0B6D11B3; Fri, 10 Jan 2020 12:52:09 -0800 (PST) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.12.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 993123F534; Fri, 10 Jan 2020 12:52:09 -0800 (PST) From: Dharmik Thakkar To: Rasesh Mody , Shahed Shaikh Cc: dev@dpdk.org, nd@arm.com, Dharmik Thakkar Date: Fri, 10 Jan 2020 14:51:49 -0600 Message-Id: <20200110205152.30966-5-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200110205152.30966-1-dharmik.thakkar@arm.com> References: <20200102174838.12908-1-dharmik.thakkar@arm.com> <20200110205152.30966-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v3 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) { -- 2.17.1