* [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' @ 2019-10-03 22:44 Dharmik Thakkar 2019-10-16 6:23 ` Ye Xiaolong 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar 0 siblings, 2 replies; 24+ messages in thread From: Dharmik Thakkar @ 2019-10-03 22:44 UTC (permalink / raw) To: Wenzhuo Lu, Konstantin Ananyev Cc: dev, stephen, honnappa.nagarahalli, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> --- 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <rte_common.h> #include <rte_debug.h> #include <rte_cycles.h> @@ -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 7eb3d0567b58..2c5d2e5f9295 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2589,7 +2589,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; @@ -3958,7 +3959,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); @@ -4089,7 +4090,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; -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' 2019-10-03 22:44 [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar @ 2019-10-16 6:23 ` Ye Xiaolong 2019-10-16 16:22 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar 1 sibling, 1 reply; 24+ messages in thread From: Ye Xiaolong @ 2019-10-16 6:23 UTC (permalink / raw) To: Dharmik Thakkar Cc: Wenzhuo Lu, Konstantin Ananyev, dev, stephen, honnappa.nagarahalli Hi, On 10/03, Dharmik Thakkar wrote: >Compilation issue arises due to multiple definitions of 'bool' >in 'ixgbe_ethdev.h'. Which compiler would trigger this compilation issue? And we have several "typedef int bool" in multiple drivers, drivers/net/bnx2x/bnx2x_ethdev.h:50:typedef int bool; drivers/net/cxgbe/cxgbe_compat.h:89:typedef int bool; drivers/net/e1000/base/e1000_osdep.h:61:typedef int bool; drivers/net/fm10k/base/fm10k_osdep.h:50:typedef int bool; drivers/net/ixgbe/base/ixgbe_osdep.h:86:typedef int bool; drivers/net/qede/base/bcm_osal.h:74:typedef int bool; drivers/net/vmxnet3/base/vmxnet3_osdep.h:12:typedef int bool; Do you need to change them all? Thanks, Xiaolong > >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 <dharmik.thakkar@arm.com> >Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> >--- > 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 <stdint.h> > #include <stdio.h> > #include <stdarg.h> >+#include <stdbool.h> > #include <rte_common.h> > #include <rte_debug.h> > #include <rte_cycles.h> >@@ -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 7eb3d0567b58..2c5d2e5f9295 100644 >--- a/drivers/net/ixgbe/ixgbe_ethdev.c >+++ b/drivers/net/ixgbe/ixgbe_ethdev.c >@@ -2589,7 +2589,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; >@@ -3958,7 +3959,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); >@@ -4089,7 +4090,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; > >-- >2.17.1 > ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' 2019-10-16 6:23 ` Ye Xiaolong @ 2019-10-16 16:22 ` Dharmik Thakkar 0 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2019-10-16 16:22 UTC (permalink / raw) To: Ye Xiaolong Cc: Wenzhuo Lu, Konstantin Ananyev, dev, Stephen Hemminger, Honnappa Nagarahalli, nd Hi Ye, Thank you for the comments! > On Oct 16, 2019, at 1:23 AM, Ye Xiaolong <xiaolong.ye@intel.com> wrote: > > Hi, > > On 10/03, Dharmik Thakkar wrote: >> Compilation issue arises due to multiple definitions of 'bool' >> in 'ixgbe_ethdev.h'. > > Which compiler would trigger this compilation issue? gcc version 7.4.0 Compilation issue arises when ’stdbool.h’ gets included along with one of the header files with 'typedef int bool;’, thereby leading to multiple definitions of ‘bool’. I faced this issue while working on 'https://patches.dpdk.org/patch/58333/‘ wherein I included ‘rte_rcu_qsbr.h’ (which includes ’stdbool.h’) in ‘rte_hash.h’. Now, ‘ixgbe_ethdev.c’ includes ’stdbool.h’ (<- rte_rcu_qsbr.h <- rte_hash.h) along with ‘ixgbe_osdep.h’ (<- ixgbe_type.h <- ixgbe_api.h <- ixgbe_ethdev.h) which has 'typedef int bool;’ > And we have several "typedef int bool" in multiple drivers, > > drivers/net/bnx2x/bnx2x_ethdev.h:50:typedef int bool; > drivers/net/cxgbe/cxgbe_compat.h:89:typedef int bool; > drivers/net/e1000/base/e1000_osdep.h:61:typedef int bool; > drivers/net/fm10k/base/fm10k_osdep.h:50:typedef int bool; > drivers/net/ixgbe/base/ixgbe_osdep.h:86:typedef int bool; > drivers/net/qede/base/bcm_osal.h:74:typedef int bool; > drivers/net/vmxnet3/base/vmxnet3_osdep.h:12:typedef int bool; > > Do you need to change them all? Yes, I will fix these and submit a patch series. > > Thanks, > Xiaolong > >> >> 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 <dharmik.thakkar@arm.com> >> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> >> --- >> 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 <stdint.h> >> #include <stdio.h> >> #include <stdarg.h> >> +#include <stdbool.h> >> #include <rte_common.h> >> #include <rte_debug.h> >> #include <rte_cycles.h> >> @@ -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 7eb3d0567b58..2c5d2e5f9295 100644 >> --- a/drivers/net/ixgbe/ixgbe_ethdev.c >> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c >> @@ -2589,7 +2589,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; >> @@ -3958,7 +3959,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); >> @@ -4089,7 +4090,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; >> >> -- >> 2.17.1 >> ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' 2019-10-03 22:44 [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar 2019-10-16 6:23 ` Ye Xiaolong @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar ` (7 more replies) 1 sibling, 8 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) Cc: dev, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' Thus, avoid future compilation problems when 'stdbool.h' gets included in these files. --- v2: - Remove 'typedef int bool' from other drivers --- Dharmik Thakkar (7): net/ixgbe: avoid multpile definitions of 'bool' net/cxgbe: remove 'typedef int bool' net/vmxnet3: remove 'typedef int bool' net/bnx2x: remove 'typedef int bool' net/e1000: remove 'typedef int bool' net/fm10k: remove 'typedef int bool' net/qede: remove 'typedef int bool' drivers/net/bnx2x/bnx2x_ethdev.h | 4 +-- drivers/net/bnx2x/ecore_sp.c | 46 ++++++++++++------------ drivers/net/cxgbe/cxgbe_compat.h | 4 +-- drivers/net/cxgbe/cxgbe_main.c | 13 +++---- drivers/net/e1000/base/e1000_osdep.h | 5 +-- drivers/net/fm10k/base/fm10k_osdep.h | 8 +---- drivers/net/fm10k/fm10k_ethdev.c | 6 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 4 +-- drivers/net/ixgbe/ixgbe_ethdev.c | 7 ++-- drivers/net/qede/base/bcm_osal.h | 5 +-- drivers/net/qede/base/ecore_vf.c | 2 +- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_defs.h | 6 ++-- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 4 +-- 14 files changed, 50 insertions(+), 66 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-10 9:22 ` Ferruh Yigit 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar ` (6 subsequent siblings) 7 siblings, 1 reply; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Wenzhuo Lu, Konstantin Ananyev; +Cc: dev, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Gavin Hu <gavin.hu@arm.com> --- 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <rte_common.h> #include <rte_debug.h> #include <rte_cycles.h> @@ -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; -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar @ 2020-01-10 9:22 ` Ferruh Yigit 2020-01-10 20:55 ` Dharmik Thakkar 0 siblings, 1 reply; 24+ messages in thread From: Ferruh Yigit @ 2020-01-10 9:22 UTC (permalink / raw) To: Dharmik Thakkar, Wenzhuo Lu, Konstantin Ananyev Cc: dev, Aaron Conole, Ali Alnubani, Chen, Zhaoyan, Jeremy Plsek On 1/2/2020 5:48 PM, Dharmik Thakkar wrote: > 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 <dharmik.thakkar@arm.com> > Reviewed-by: Phil Yang <phil.yang@arm.com> > Reviewed-by: Gavin Hu <gavin.hu@arm.com> > --- > 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 <stdint.h> > #include <stdio.h> > #include <stdarg.h> > +#include <stdbool.h> > #include <rte_common.h> > #include <rte_debug.h> > #include <rte_cycles.h> > @@ -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; > Can you please rebase the patchset on of next-net, getting following build error [1] because of a commit in next-net [2], the fix should be trivial [3]. CI seems not able to catch this, Cc'ed Aaron, Ali & Zhaoyan & Jeremy if they want to investigate the issue. [1] .../drivers/net/ixgbe/ixgbe_ethdev.c:4137:38: error: incompatible pointer types passing 'int *' to parameter of type 'bool *' [-Werror,-Wincompatible-pointer-types] err = ixgbe_check_link(hw, &speed, &link_up, 0); ^~~~~~~~ .../drivers/net/ixgbe/base/ixgbe_api.h:62:14: note: passing argument to parameter 'link_up' here bool *link_up, bool link_up_wait_to_complete); ^ [2] commit 2f2639c872c8 ("net/ixgbe: fix port can not link up in FreeBSD") [3] diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 414b73c97..4f1704e79 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4130,7 +4130,8 @@ ixgbe_wait_for_link_up(struct ixgbe_hw *hw) #else const int nb_iter = 0; #endif - int err, i, link_up = 0; + int err, i = 0; + bool link_up = false; uint32_t speed = 0; for (i = 0; i < nb_iter; i++) { ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' 2020-01-10 9:22 ` Ferruh Yigit @ 2020-01-10 20:55 ` Dharmik Thakkar 0 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:55 UTC (permalink / raw) To: Ferruh Yigit Cc: Wenzhuo Lu, Konstantin Ananyev, dev, Aaron Conole, Ali Alnubani, Chen, Zhaoyan, Jeremy Plsek, nd Hi Ferruh, Thank you for the comments! I have rebased the patches on dpdk-next-net and fixed the issue. I have put out the patch. > On Jan 10, 2020, at 3:22 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote: > > On 1/2/2020 5:48 PM, Dharmik Thakkar wrote: >> 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 <dharmik.thakkar@arm.com> >> Reviewed-by: Phil Yang <phil.yang@arm.com> >> Reviewed-by: Gavin Hu <gavin.hu@arm.com> >> --- >> 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 <stdint.h> >> #include <stdio.h> >> #include <stdarg.h> >> +#include <stdbool.h> >> #include <rte_common.h> >> #include <rte_debug.h> >> #include <rte_cycles.h> >> @@ -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; >> > > Can you please rebase the patchset on of next-net, getting following build error > [1] because of a commit in next-net [2], the fix should be trivial [3]. > > CI seems not able to catch this, Cc'ed Aaron, Ali & Zhaoyan & Jeremy if they > want to investigate the issue. > > > > [1] > .../drivers/net/ixgbe/ixgbe_ethdev.c:4137:38: error: incompatible pointer types > passing 'int *' to parameter of type 'bool *' [-Werror,-Wincompatible-pointer-types] > err = ixgbe_check_link(hw, &speed, &link_up, 0); > ^~~~~~~~ > .../drivers/net/ixgbe/base/ixgbe_api.h:62:14: note: passing argument to > parameter 'link_up' here > bool *link_up, bool link_up_wait_to_complete); > ^ > > [2] > commit 2f2639c872c8 ("net/ixgbe: fix port can not link up in FreeBSD") > > > [3] > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 414b73c97..4f1704e79 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -4130,7 +4130,8 @@ ixgbe_wait_for_link_up(struct ixgbe_hw *hw) > #else > const int nb_iter = 0; > #endif > - int err, i, link_up = 0; > + int err, i = 0; > + bool link_up = false; > uint32_t speed = 0; > > for (i = 0; i < nb_iter; i++) { ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 2/7] net/cxgbe: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: " Dharmik Thakkar ` (5 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Rahul Lakkireddy; +Cc: dev, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <rte_common.h> #include <rte_memcpy.h> @@ -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) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-02 19:53 ` Yong Wang 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 4/7] net/bnx2x: " Dharmik Thakkar ` (4 subsequent siblings) 7 siblings, 1 reply; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Yong Wang; +Cc: dev, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <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 #define UNLIKELY(x) __builtin_expect((x),0) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: " Dharmik Thakkar @ 2020-01-02 19:53 ` Yong Wang 0 siblings, 0 replies; 24+ messages in thread From: Yong Wang @ 2020-01-02 19:53 UTC (permalink / raw) To: Dharmik Thakkar; +Cc: dev -----Original Message----- From: Dharmik Thakkar <dharmik.thakkar@arm.com> Date: Thursday, January 2, 2020 at 9:49 AM To: Yong Wang <yongwang@vmware.com> Cc: "dev@dpdk.org" <dev@dpdk.org>, Dharmik Thakkar <dharmik.thakkar@arm.com> Subject: [PATCH v2 3/7] net/vmxnet3: remove 'typedef int bool' 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- Acked-by: Yong Wang <yongwang@vmware.com> 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 <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 #define UNLIKELY(x) __builtin_expect((x),0) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 4/7] net/bnx2x: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar ` (2 preceding siblings ...) 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: " Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 5/7] net/e1000: " Dharmik Thakkar ` (3 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Rasesh Mody, Shahed Shaikh; +Cc: dev, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <errno.h> #include <stdint.h> #include <string.h> @@ -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 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 5/7] net/e1000: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar ` (3 preceding siblings ...) 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 4/7] net/bnx2x: " Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 6/7] net/fm10k: " Dharmik Thakkar ` (2 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> --- 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <rte_common.h> #include <rte_cycles.h> @@ -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_ */ -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 6/7] net/fm10k: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar ` (4 preceding siblings ...) 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 5/7] net/e1000: " Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-03 1:34 ` Wang, Xiao W 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 7/7] net/qede: " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar 7 siblings, 1 reply; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Qi Zhang, Xiao Wang; +Cc: dev, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdint.h> +#include <stdbool.h> #include <string.h> #include <rte_atomic.h> #include <rte_byteorder.h> @@ -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; } -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 6/7] net/fm10k: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 6/7] net/fm10k: " Dharmik Thakkar @ 2020-01-03 1:34 ` Wang, Xiao W 0 siblings, 0 replies; 24+ messages in thread From: Wang, Xiao W @ 2020-01-03 1:34 UTC (permalink / raw) To: Dharmik Thakkar, Zhang, Qi Z; +Cc: dev Hi, > -----Original Message----- > From: Dharmik Thakkar <dharmik.thakkar@arm.com> > Sent: Friday, January 3, 2020 1:49 AM > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W > <xiao.w.wang@intel.com> > Cc: dev@dpdk.org; Dharmik Thakkar <dharmik.thakkar@arm.com> > Subject: [PATCH v2 6/7] net/fm10k: remove 'typedef int bool' > > Replace 'typedef int bool' with 'stdbool.h' to avoid possible > multiple definitions of 'bool'. > > Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> > Reviewed-by: Phil Yang <phil.yang@arm.com> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> > --- > 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 <stdint.h> > +#include <stdbool.h> > #include <string.h> > #include <rte_atomic.h> > #include <rte_byteorder.h> > @@ -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; > } > -- > 2.17.1 Acked-by: Xiao Wang <xiao.w.wang@intel.com> BRs, Xiao ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 7/7] net/qede: remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar ` (5 preceding siblings ...) 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 6/7] net/fm10k: " Dharmik Thakkar @ 2020-01-02 17:48 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-02 17:48 UTC (permalink / raw) To: Rasesh Mody, Shahed Shaikh; +Cc: dev, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdbool.h> #include <rte_byteorder.h> #include <rte_spinlock.h> #include <rte_malloc.h> @@ -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; } -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 0/7] remove 'typedef int bool' 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar ` (6 preceding siblings ...) 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 7/7] net/qede: " Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar ` (7 more replies) 7 siblings, 8 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) Cc: dev, nd, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' Thus, avoid future compilation problems when 'stdbool.h' gets included in these files. --- v3: - Rebase on dpdk-next-net - Fix build issue in net/ixgbe --- v2: - Remove 'typedef int bool' from other drivers --- Dharmik Thakkar (7): net/ixgbe: avoid multpile definitions of 'bool' net/cxgbe: remove 'typedef int bool' net/vmxnet3: remove 'typedef int bool' net/bnx2x: remove 'typedef int bool' net/e1000: remove 'typedef int bool' net/fm10k: remove 'typedef int bool' net/qede: remove 'typedef int bool' drivers/net/bnx2x/bnx2x_ethdev.h | 4 +-- drivers/net/bnx2x/ecore_sp.c | 46 ++++++++++++------------ drivers/net/cxgbe/cxgbe_compat.h | 4 +-- drivers/net/cxgbe/cxgbe_main.c | 13 +++---- drivers/net/e1000/base/e1000_osdep.h | 5 +-- drivers/net/fm10k/base/fm10k_osdep.h | 8 +---- drivers/net/fm10k/fm10k_ethdev.c | 6 ++-- drivers/net/ixgbe/base/ixgbe_osdep.h | 4 +-- drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++--- drivers/net/qede/base/bcm_osal.h | 5 +-- drivers/net/qede/base/ecore_vf.c | 2 +- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/vmxnet3/base/vmxnet3_defs.h | 6 ++-- drivers/net/vmxnet3/base/vmxnet3_osdep.h | 4 +-- 14 files changed, 52 insertions(+), 67 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 1/7] net/ixgbe: avoid multpile definitions of 'bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar ` (6 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Wenzhuo Lu, Konstantin Ananyev; +Cc: dev, nd, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Gavin Hu <gavin.hu@arm.com> --- drivers/net/ixgbe/base/ixgbe_osdep.h | 4 +--- drivers/net/ixgbe/ixgbe_ethdev.c | 10 ++++++---- 2 files changed, 7 insertions(+), 7 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <rte_common.h> #include <rte_debug.h> #include <rte_cycles.h> @@ -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 b2f723f0b628..e335187bc8f1 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2545,7 +2545,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 = false, negotiate = 0; uint32_t speed = 0; uint32_t allowed_speeds = 0; int mask = 0; @@ -3992,7 +3993,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); @@ -4129,7 +4130,8 @@ ixgbe_wait_for_link_up(struct ixgbe_hw *hw) #else const int nb_iter = 0; #endif - int err, i, link_up = 0; + int err, i; + bool link_up = false; uint32_t speed = 0; for (i = 0; i < nb_iter; i++) { @@ -4153,7 +4155,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; -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 2/7] net/cxgbe: remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 3/7] net/vmxnet3: " Dharmik Thakkar ` (5 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Rahul Lakkireddy; +Cc: dev, nd, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <rte_common.h> #include <rte_memcpy.h> @@ -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) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 3/7] net/vmxnet3: remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 4/7] net/bnx2x: " Dharmik Thakkar ` (4 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Yong Wang; +Cc: dev, nd, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> Acked-by: Yong Wang <yongwang@vmware.com> --- 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 <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 #define UNLIKELY(x) __builtin_expect((x),0) -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 4/7] net/bnx2x: remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar ` (2 preceding siblings ...) 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 3/7] net/vmxnet3: " Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 5/7] net/e1000: " Dharmik Thakkar ` (3 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Rasesh Mody, Shahed Shaikh; +Cc: dev, nd, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <errno.h> #include <stdint.h> #include <string.h> @@ -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 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 5/7] net/e1000: remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar ` (3 preceding siblings ...) 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 4/7] net/bnx2x: " Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 6/7] net/fm10k: " Dharmik Thakkar ` (2 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev, nd, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> --- 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 <stdint.h> #include <stdio.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <rte_common.h> #include <rte_cycles.h> @@ -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_ */ -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 6/7] net/fm10k: remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar ` (4 preceding siblings ...) 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 5/7] net/e1000: " Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 7/7] net/qede: " Dharmik Thakkar 2020-01-13 11:14 ` [dpdk-dev] [PATCH v3 0/7] " Ferruh Yigit 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Qi Zhang, Xiao Wang; +Cc: dev, nd, Dharmik Thakkar Replace 'typedef int bool' with 'stdbool.h' to avoid possible multiple definitions of 'bool'. Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> Acked-by: Xiao Wang <xiao.w.wang@intel.com> --- 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 <stdint.h> +#include <stdbool.h> #include <string.h> #include <rte_atomic.h> #include <rte_byteorder.h> @@ -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; } -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 7/7] net/qede: remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar ` (5 preceding siblings ...) 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 6/7] net/fm10k: " Dharmik Thakkar @ 2020-01-10 20:51 ` Dharmik Thakkar 2020-01-13 11:14 ` [dpdk-dev] [PATCH v3 0/7] " Ferruh Yigit 7 siblings, 0 replies; 24+ messages in thread From: Dharmik Thakkar @ 2020-01-10 20:51 UTC (permalink / raw) To: Rasesh Mody, Shahed Shaikh; +Cc: dev, nd, Dharmik Thakkar 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 <dharmik.thakkar@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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 <stdbool.h> #include <rte_byteorder.h> #include <rte_spinlock.h> #include <rte_malloc.h> @@ -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; } -- 2.17.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/7] remove 'typedef int bool' 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar ` (6 preceding siblings ...) 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 7/7] net/qede: " Dharmik Thakkar @ 2020-01-13 11:14 ` Ferruh Yigit 7 siblings, 0 replies; 24+ messages in thread From: Ferruh Yigit @ 2020-01-13 11:14 UTC (permalink / raw) To: Dharmik Thakkar; +Cc: dev, nd On 1/10/2020 8:51 PM, Dharmik Thakkar wrote: > Replace 'typedef int bool' with 'stdbool.h' > Thus, avoid future compilation problems when 'stdbool.h' > gets included in these files. > > --- > v3: > - Rebase on dpdk-next-net > - Fix build issue in net/ixgbe > --- > v2: > - Remove 'typedef int bool' from other drivers > --- > > Dharmik Thakkar (7): > net/ixgbe: avoid multpile definitions of 'bool' > net/cxgbe: remove 'typedef int bool' > net/vmxnet3: remove 'typedef int bool' > net/bnx2x: remove 'typedef int bool' > net/e1000: remove 'typedef int bool' > net/fm10k: remove 'typedef int bool' > net/qede: remove 'typedef int bool' For series, Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> Series applied to dpdk-next-net/master, thanks. ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2020-01-13 11:14 UTC | newest] Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-03 22:44 [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar 2019-10-16 6:23 ` Ye Xiaolong 2019-10-16 16:22 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar 2020-01-10 9:22 ` Ferruh Yigit 2020-01-10 20:55 ` Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: " Dharmik Thakkar 2020-01-02 19:53 ` Yong Wang 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 4/7] net/bnx2x: " Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 5/7] net/e1000: " Dharmik Thakkar 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 6/7] net/fm10k: " Dharmik Thakkar 2020-01-03 1:34 ` Wang, Xiao W 2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 7/7] net/qede: " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 3/7] net/vmxnet3: " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 4/7] net/bnx2x: " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 5/7] net/e1000: " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 6/7] net/fm10k: " Dharmik Thakkar 2020-01-10 20:51 ` [dpdk-dev] [PATCH v3 7/7] net/qede: " Dharmik Thakkar 2020-01-13 11:14 ` [dpdk-dev] [PATCH v3 0/7] " Ferruh Yigit
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).