patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/gve: replace typedefs with macros in gve osdep
@ 2024-10-17 23:42 Joshua Washington
  2024-10-18  0:11 ` Ferruh Yigit
  2024-10-18  7:00 ` David Marchand
  0 siblings, 2 replies; 3+ messages in thread
From: Joshua Washington @ 2024-10-17 23:42 UTC (permalink / raw)
  To: Jeroen de Borst, Rushil Gupta, Joshua Washington, Junfeng Guo,
	Xiaoyun Li, Haiyue Wang
  Cc: dev, stable, Ferruh Yigit, David Marchand

Currently, a number of integer types are typedef'd to their
corresponding upserspace or RTE values. This can be problematic if these
types are already defined somewhere else, as it would cause type
collisions. This patch changes the typedefs to #define macros which are
only defined if the types are not defined already.

Fixes: c9ba2caf6302 ("net/gve/base: add OS-specific implementation")
Fixes: abf1242fbb84 ("net/gve: add struct members and typedefs for DQO")
Cc: junfeng.guo@intel.com
Cc: stable@dpdk.org

Signed-off-by: Joshua Washington <joshwash@google.com>
Suggested-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/gve/base/gve_osdep.h | 48 ++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/drivers/net/gve/base/gve_osdep.h b/drivers/net/gve/base/gve_osdep.h
index c0ee0d567c..64181cebd6 100644
--- a/drivers/net/gve/base/gve_osdep.h
+++ b/drivers/net/gve/base/gve_osdep.h
@@ -29,22 +29,46 @@
 #include <sys/utsname.h>
 #endif
 
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
+#ifndef u8
+#define u8 uint8_t
+#endif
+#ifndef u16
+#define u16 uint16_t
+#endif
+#ifndef u32
+#define u32 uint32_t
+#endif
+#ifndef u64
+#define u64 uint64_t
+#endif
 
-typedef rte_be16_t __sum16;
+#ifndef __sum16
+#define __sum16 rte_be16_t
+#endif
 
-typedef rte_be16_t __be16;
-typedef rte_be32_t __be32;
-typedef rte_be64_t __be64;
+#ifndef __be16
+#define __be16 rte_be16_t
+#endif
+#ifndef __be32
+#define __be32 rte_be32_t
+#endif
+#ifndef __be64
+#define __be64 rte_be64_t
+#endif
 
-typedef rte_le16_t __le16;
-typedef rte_le32_t __le32;
-typedef rte_le64_t __le64;
+#ifndef __le16
+#define __le16 rte_le16_t
+#endif
+#ifndef __le32
+#define __le32 rte_le32_t
+#endif
+#ifndef __le64
+#define __le64 rte_le64_t
+#endif
 
-typedef rte_iova_t dma_addr_t;
+#ifndef dma_addr_t
+#define dma_addr_t rte_iova_t
+#endif
 
 #define ETH_MIN_MTU	RTE_ETHER_MIN_MTU
 #define ETH_ALEN	RTE_ETHER_ADDR_LEN
-- 
2.47.0.rc1.288.g06298d1525-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-18  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-17 23:42 [PATCH] net/gve: replace typedefs with macros in gve osdep Joshua Washington
2024-10-18  0:11 ` Ferruh Yigit
2024-10-18  7:00 ` David Marchand

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