All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: andremue@linux.microsoft.com
Cc: bingz@nvidia.com, dev@dpdk.org, dsosnowski@nvidia.com,
	matan@nvidia.com, orika@nvidia.com, suanmingm@nvidia.com,
	viacheslavo@nvidia.com, mkashani@nvidia.com
Subject: [PATCH v2] net/mlx5: declare size of rte_v128u32_t
Date: Fri, 30 May 2025 17:21:57 -0700	[thread overview]
Message-ID: <1748650917-31700-1-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1746457823-11135-1-git-send-email-andremue@linux.microsoft.com>

When compiling with MSVC the error below is hit:

drivers\net\mlx5\mlx5_tx.h(1148): error C2065: 'rte_v128u32_t':
    undeclared identifier

Turns out that with MSVC the data type rte_v128u32_t is not used, but
its size needs to be known. This patch defines a macro to store that
size and replaces instances of sizeof(rte_v128u32_t) with that macro.

A static assert is added to ensure the new macro never diverges from
sizeof(rte_v128u32_t).

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/net/mlx5/mlx5_defs.h |  2 ++
 drivers/net/mlx5/mlx5_rxtx.c | 11 ++++++++---
 drivers/net/mlx5/mlx5_tx.h   |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 9c454983be..c5e2c59309 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -196,4 +196,6 @@
 
 #define MLX5_CNT_SVC_CYCLE_TIME_DEFAULT 500
 
+#define MLX5_SIZEOF_V128U32_T 16
+
 #endif /* RTE_PMD_MLX5_DEFS_H_ */
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 9c075f6a56..3f4942e225 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -28,11 +28,16 @@
 #include "mlx5_tx.h"
 
 /* static asserts */
+#ifndef RTE_TOOLCHAIN_MSVC
+static_assert(sizeof(rte_v128u32_t) == MLX5_SIZEOF_V128U32_T,
+		"MLX5_SIZEOF_V128U32_T must hold sizeof(rte_v128u32_t)");
+#endif
+
 static_assert(MLX5_CQE_STATUS_HW_OWN < 0, "Must be negative value");
 static_assert(MLX5_CQE_STATUS_SW_OWN < 0, "Must be negative value");
 static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		(sizeof(uint16_t) +
-		 sizeof(rte_v128u32_t)),
+		MLX5_SIZEOF_V128U32_T),
 		"invalid Ethernet Segment data size");
 static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		(sizeof(uint16_t) +
@@ -41,7 +46,7 @@ static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		"invalid Ethernet Segment data size");
 static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		(sizeof(uint16_t) +
-		 sizeof(rte_v128u32_t)),
+		MLX5_SIZEOF_V128U32_T),
 		"invalid Ethernet Segment data size");
 static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		(sizeof(uint16_t) +
@@ -50,7 +55,7 @@ static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		"invalid Ethernet Segment data size");
 static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		(sizeof(uint16_t) +
-		 sizeof(rte_v128u32_t)),
+		MLX5_SIZEOF_V128U32_T),
 		"invalid Ethernet Segment data size");
 static_assert(MLX5_ESEG_MIN_INLINE_SIZE ==
 		(sizeof(uint16_t) +
diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
index 55568c41b1..5647f6a37d 100644
--- a/drivers/net/mlx5/mlx5_tx.h
+++ b/drivers/net/mlx5/mlx5_tx.h
@@ -1145,7 +1145,7 @@ mlx5_tx_eseg_data(struct mlx5_txq_data *__rte_restrict txq,
 	} else {
 		/* Fill the gap in the title WQEBB with inline data. */
 		rte_mov16(pdst, psrc);
-		psrc += sizeof(rte_v128u32_t);
+		psrc += MLX5_SIZEOF_V128U32_T;
 	}
 	pdst = (uint8_t *)(es + 2);
 	MLX5_ASSERT(inlen >= MLX5_ESEG_MIN_INLINE_SIZE);
-- 
2.49.0.vfs.0.3


  parent reply	other threads:[~2025-05-31  0:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 15:10 [PATCH] net/mlx5: declare size of rte_v128u32_t Andre Muezerie
2025-05-25  8:47 ` Maayan Kashani
2025-05-31  0:20   ` Andre Muezerie
2025-05-31  0:21 ` Andre Muezerie [this message]
2025-06-04 15:28   ` [PATCH v2] " Dariusz Sosnowski
2025-07-08 15:08     ` Andre Muezerie
2025-07-08 15:11 ` [PATCH v3] net/mlx5: remove use of sizeof(rte_v128u32_t) Andre Muezerie
2025-07-09  7:26   ` Dariusz Sosnowski
2025-07-20 21:43     ` Thomas Monjalon

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=1748650917-31700-1-git-send-email-andremue@linux.microsoft.com \
    --to=andremue@linux.microsoft.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=mkashani@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.