DPDK patches and discussions
 help / color / mirror / Atom feed
From: Joshua Washington <joshwash@google.com>
To: Jeroen de Borst <jeroendb@google.com>,
	Rushil Gupta <rushilg@google.com>,
	 Joshua Washington <joshwash@google.com>,
	Junfeng Guo <junfeng.guo@intel.com>,
	 Xiaoyun Li <xiaoyun.li@intel.com>,
	Haiyue Wang <haiyue.wang@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org,
	Ferruh Yigit <ferruh.yigit@amd.com>,
	 David Marchand <david.marchand@redhat.com>
Subject: [PATCH] net/gve: replace typedefs with macros in gve osdep
Date: Thu, 17 Oct 2024 16:42:33 -0700	[thread overview]
Message-ID: <20241017234233.3456943-1-joshwash@google.com> (raw)

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


             reply	other threads:[~2024-10-17 23:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 23:42 Joshua Washington [this message]
2024-10-18  0:11 ` Ferruh Yigit
2024-10-18  7:00 ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241017234233.3456943-1-joshwash@google.com \
    --to=joshwash@google.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=haiyue.wang@intel.com \
    --cc=jeroendb@google.com \
    --cc=junfeng.guo@intel.com \
    --cc=rushilg@google.com \
    --cc=stable@dpdk.org \
    --cc=xiaoyun.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).