Skip to contentSkip to conversation

net/ionic: use standard stdbool.h

PATCH Superseded Sunil Kumar Kori 4 participants 8 messages Mar 9, 2020 – Mar 10, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/ionic: use standard stdbool.h

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

---
v2:
- include stdbool.h in ionic_dev.h.

 drivers/net/ionic/ionic_dev.c       | 1 +
 drivers/net/ionic/ionic_dev.h       | 2 ++
 drivers/net/ionic/ionic_mac_api.c   | 1 +
 drivers/net/ionic/ionic_main.c      | 1 +
 drivers/net/ionic/ionic_osdep.h     | 1 -
 drivers/net/ionic/ionic_rx_filter.c | 1 +
 6 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.c +1 -0
index aba388115..fe111a515 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include <rte_malloc.h>
 
drivers/net/ionic/ionic_dev.h +2 -0
index 8c1ec13a6..532255a60 100644
@@ -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"
drivers/net/ionic/ionic_mac_api.c +1 -0
index 189b8b81a..40421fd4e 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include "ionic_mac_api.h"
 
drivers/net/ionic/ionic_main.c +1 -0
index b828d230d..9d74ec73e 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include <rte_memzone.h>
 
drivers/net/ionic/ionic_osdep.h +0 -1
index ecdbc24e6..6ca5426ec 100644
@@ -45,7 +45,6 @@ typedef uint32_t __le32;
 typedef uint64_t __le64;
 
 #ifndef __cplusplus
-typedef uint8_t bool;
 #define false   0
 #define true    1
 #endif
drivers/net/ionic/ionic_rx_filter.c +1 -0
index f75b81a27..fe624538d 100644
@@ -3,6 +3,7 @@
  */
 
 #include <errno.h>
+#include <stdbool.h>
 
 #include <rte_malloc.h>
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 37 lines · Sunil Kumar Kori

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

---

drivers/net/ionic/ionic_osdep.h +0 -0
index ecdbc24e6..6ca5426ec 100644

drivers/net/ionic/ionic_osdep.h typedef uint32_t __le32; · line 49

Quoted 6 lines
drivers/net/ionic/ionic_osdep.h +0 -1
@@ -45,7 +45,6 @@ typedef uint32_t __le32;
 typedef uint64_t __le64;
 
 #ifndef __cplusplus
-typedef uint8_t bool;
 #define false   0
 #define true    1

You could remove the above as well(#define false and #define true)

Quoted 1 line
drivers/net/ionic/ionic_osdep.h +0 -0
 #endif
#2 lore raw
Quoted 40 lines · Jerin Jacob
Quoted 39 lines · Sunil Kumar Kori

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

---

drivers/net/ionic/ionic_osdep.h +0 -0
index ecdbc24e6..6ca5426ec 100644
@@ -45,7 +45,6 @@ typedef uint32_t __le32;
 typedef uint64_t __le64;
 
Quoted 6 lines

drivers/net/ionic/ionic_osdep.h typedef uint32_t __le32; · line 49

Quoted 4 lines
drivers/net/ionic/ionic_osdep.h +0 -1
 #ifndef __cplusplus
-typedef uint8_t bool;
 #define false   0
 #define true    1

You could remove the above as well(#define false and #define true)

+1,
I need to do same thing for ionic in other patch to be able to use bool:
https://patches.dpdk.org/patch/66225/

#3 lore raw

Updated. Sent next version(v3).

Regards
Sunil Kumar Kori

Quoted 69 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 9, 2020 2:14 PM
To: Jerin Jacob <[email protected]>; Sunil Kumar Kori <[email protected]>
Cc: Alfredo Cardigliano <[email protected]>; dpdk-dev <[email protected]>; dpdk stable <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/1] net/ionic: use standard stdbool.h

External Email

----------------------------------------------------------------------

Quoted 1 line · Jerin Jacob

On Mon, Mar 9, 2020 at 1:23 PM Sunil Kumar Kori <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines

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:

Quoted 15 lines
Quoted 12 lines

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:
Quoted 3 lines

.../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’

Quoted 13 lines
Quoted 13 lines

.../dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'ionic_rxtx.o' failed

---

(quoted diff) +0 -0

b/drivers/net/ionic/ionic_osdep.h index ecdbc24e6..6ca5426ec 100644

drivers/net/ionic/ionic_osdep.h +0 -0
@@ -45,7 +45,6 @@ typedef uint32_t __le32;  typedef uint64_t __le64;
 
Quoted 6 lines

drivers/net/ionic/ionic_osdep.h typedef uint32_t __le32; · line 49

Quoted 4 lines
drivers/net/ionic/ionic_osdep.h +0 -1
 #ifndef __cplusplus
-typedef uint8_t bool;
 #define false   0
 #define true    1

You could remove the above as well(#define false and #define true)

+1,
I need to do same thing for ionic in other patch to be able to use bool:
https://urldefense.proofpoint.com/v2/url?u=https-
3A__patches.dpdk.org_patch_66225_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7x tfQ&r=dXeXaAMkP5COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=T5C3CnQeBz RfXkKcooV3-FN- R3e5MZhMonknLFnZhyE&s=OEYWfU4EaPmiYf6FXpwxDOaWV75g1wDeaASYN wIJiJI&e=

#4 lore raw

PATCH v3 1/1 net/ionic: use standard stdbool.h

In reply to Sunil Kumar Kori

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")

---
v3:
- remove #define true and false.
- add fixes tag.
v2:
- include stdbool.h in ionic_dev.h

 drivers/net/ionic/ionic_dev.c       | 1 +
 drivers/net/ionic/ionic_dev.h       | 2 ++
 drivers/net/ionic/ionic_mac_api.c   | 1 +
 drivers/net/ionic/ionic_main.c      | 1 +
 drivers/net/ionic/ionic_osdep.h     | 6 ------
 drivers/net/ionic/ionic_rx_filter.c | 1 +
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ionic/ionic_dev.c +1 -0
index aba388115..fe111a515 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include <rte_malloc.h>
 
drivers/net/ionic/ionic_dev.h +2 -0
index 8c1ec13a6..532255a60 100644
@@ -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"
drivers/net/ionic/ionic_mac_api.c +1 -0
index 189b8b81a..40421fd4e 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include "ionic_mac_api.h"
 
drivers/net/ionic/ionic_main.c +1 -0
index b828d230d..9d74ec73e 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include <rte_memzone.h>
 
drivers/net/ionic/ionic_osdep.h +0 -6
index ecdbc24e6..e04bb8f65 100644
@@ -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;
drivers/net/ionic/ionic_rx_filter.c +1 -0
index f75b81a27..fe624538d 100644
@@ -3,6 +3,7 @@
  */
 
 #include <errno.h>
+#include <stdbool.h>
 
 #include <rte_malloc.h>
 
Signature · 1 line
2.17.1
#5 lore raw
Quoted 27 lines · Sunil Kumar Kori

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

Quoted 4 lines
Fixes 5ef518098ec6 ("net/ionic: register and initialize adapter")

Hi Alfredo,

Do you have any concern/objection on the patch? If not it will be merged soon.

Thanks,
ferruh

#6 lore raw
Quoted 35 lines · Ferruh Yigit
Quoted 30 lines · Sunil Kumar Kori

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")
Quoted 9 lines
Quoted 1 line

Hi Alfredo,

Do you have any concern/objection on the patch? If not it will be merged soon.

Thanks,
ferruh

Hi Ferruh

it looks fine, please go ahead.

Thank you
Alfredo

Acked-by Alfredo Cardigliano on v3 1/1 Applied
#7 lore raw
In reply to Sunil Kumar Kori
Quoted 27 lines · Sunil Kumar Kori

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

Quoted 4 lines
Fixes 5ef518098ec6 ("net/ionic: register and initialize adapter")

Converting Alfredo's response to explicit tag:

Applied to dpdk-next-net/master, thanks.