[dpdk-dev] [PATCH] drivers/net: do not redefine bool

Ferruh Yigit ferruh.yigit at intel.com
Fri Sep 21 15:47:12 CEST 2018


On 9/20/2018 1:18 AM, Thomas Monjalon wrote:
> When trying to include stdbool.h in DPDK base headers, there are a lot
> of conflicts with drivers which redefine bool/true/false
> in their compatibility layer.
> 
> It is fixed by including stdbool.h in these drivers.
> Some errors with usage of bool type are also fixed in some drivers.
> 
> Note: the driver qede has a surprising mix of bool and int:
> 	(~p_iov->b_pre_fp_hsi & ETH_HSI_VER_MINOR)
> where the first variable is boolean and the version is a number.
> It is replaced by
> 	!p_iov->b_pre_fp_hsi
> 
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> ---
>  drivers/net/cxgbe/cxgbe_compat.h         |  2 +-
>  drivers/net/e1000/base/e1000_osdep.h     |  5 +----
>  drivers/net/fm10k/base/fm10k_osdep.h     |  8 +-------
>  drivers/net/fm10k/fm10k_ethdev.c         |  4 ++--
>  drivers/net/ixgbe/base/ixgbe_osdep.h     |  6 +-----
>  drivers/net/ixgbe/ixgbe_ethdev.c         | 16 +++++++++-------
>  drivers/net/ixgbe/ixgbe_rxtx.c           |  2 +-
>  drivers/net/qede/base/bcm_osal.h         |  6 ++----
>  drivers/net/qede/base/ecore_vf.c         |  3 +--
>  drivers/net/qede/qede_ethdev.c           |  2 +-
>  drivers/net/vmxnet3/base/vmxnet3_osdep.h |  3 ++-
>  11 files changed, 22 insertions(+), 35 deletions(-)

<...>

> @@ -35,6 +35,7 @@
>  #ifndef _E1000_OSDEP_H_
>  #define _E1000_OSDEP_H_
>  
> +#include <stdbool.h>
>  #include <stdint.h>
>  #include <stdio.h>
>  #include <stdarg.h>
> @@ -87,7 +88,6 @@ typedef int64_t		s64;
>  typedef int32_t		s32;
>  typedef int16_t		s16;
>  typedef int8_t		s8;
> -typedef int		bool;
>  
>  #define __le16		u16
>  #define __le32		u32
> @@ -192,7 +192,4 @@ static inline uint16_t e1000_read_addr16(volatile void *addr)
>  #define ETH_ADDR_LEN                  6
>  #endif
>  
> -#define false                         FALSE
> -#define true                          TRUE
> -

It is too much hassle to update Intel base driver code. What would happen if not
include stdbool and keep define for base code updates? Will it break build for
applications?


More information about the dev mailing list