]> git.droids-corp.org - dpdk.git/commitdiff
net/ionic: use standard boolean type
authorSunil Kumar Kori <skori@marvell.com>
Mon, 9 Mar 2020 09:09:27 +0000 (14:39 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 18 Mar 2020 09:21:42 +0000 (10:21 +0100)
Any DPDK public header file which includes stdbool.h may conflict with
local definition of bool, if any, which further results in compilation
error. To avoid, used standard stdbool.h instead of defining bool
internally.

I observed this issue during a development where I included rte_uuid.h
into rte_ethdev.h. As rte_ethdev.h is included to PMD driver, it started
throwing error as given below:

  CC ionic_rxtx.o
In file included from .../dpdk/build/include/rte_uuid.h:17:0,
                 from .../dpdk/build/include/rte_ethdev.h:161,
                 from .../dpdk/build/include/rte_ethdev_driver.h:18,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:17:
    error: two or more data types in declaration specifiers
typedef uint8_t bool;
                 ^
In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
                 from .../dpdk/drivers/net/ionic/ionic.h:13,
                 from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:1:
    warning: useless type name in empty declaration
typedef uint8_t bool;
^~~~~~~
cc1: warning: unrecognized command line option
‘-Wno-address-of-packed-member’
.../dpdk/mk/internal/rte.compile-pre.mk:114:
recipe for target 'ionic_rxtx.o' failed

Fixes: 5ef518098ec6 ("net/ionic: register and initialize adapter")
Cc: stable@dpdk.org
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Alfredo Cardigliano <cardigliano@ntop.org>
drivers/net/ionic/ionic_dev.c
drivers/net/ionic/ionic_dev.h
drivers/net/ionic/ionic_mac_api.c
drivers/net/ionic/ionic_main.c
drivers/net/ionic/ionic_osdep.h
drivers/net/ionic/ionic_rx_filter.c

index aba388115ddd01470d00c3964958773f6c934cfe..5c2820b7a14d6245812f18359c5082c52cc73149 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
 
+#include <stdbool.h>
+
 #include <rte_malloc.h>
 
 #include "ionic_dev.h"
index 8c1ec13a68e4f3e8baf20f66d61e789719499457..532255a6034ccd7e8a95204d23222073efb63fa6 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef _IONIC_DEV_H_
 #define _IONIC_DEV_H_
 
+#include <stdbool.h>
+
 #include "ionic_osdep.h"
 #include "ionic_if.h"
 #include "ionic_regs.h"
index 189b8b81a421153180f851b3320219f2cfe46a1b..c0ea042bc5d015b24a1ee8f94a8d87380458d84c 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
 
+#include <stdbool.h>
+
 #include "ionic_mac_api.h"
 
 int32_t
index b828d230d3e00034bdba30f816d0d653f8a9c7c1..2ade213d2d9ae400aefac6545469305ccdf9d8a5 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
 
+#include <stdbool.h>
+
 #include <rte_memzone.h>
 
 #include "ionic.h"
index ecdbc24e6342ff6c88ae5e81e905bda491aa2268..e04bb8f6588a72f39e47f54660d9bbca98dd93f4 100644 (file)
@@ -44,12 +44,6 @@ typedef uint16_t __le16;
 typedef uint32_t __le32;
 typedef uint64_t __le64;
 
-#ifndef __cplusplus
-typedef uint8_t bool;
-#define false   0
-#define true    1
-#endif
-
 static inline uint32_t div_round_up(uint32_t n, uint32_t d)
 {
        return (n + d - 1) / d;
index f75b81a27caed2be6e3c930bcb6fb6f53ccbe24e..fe624538df63875b35b0f9b7c0f191c228660e8b 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <errno.h>
+#include <stdbool.h>
 
 #include <rte_malloc.h>