From: Andre Muezerie <andremue@linux.microsoft.com>
To: andremue@linux.microsoft.com
Cc: dev@dpdk.org
Subject: [PATCH v4 2/3] drivers/net: remove use of non-standard array range initialization
Date: Mon, 21 Jul 2025 08:24:43 -0700 [thread overview]
Message-ID: <1753111484-27021-3-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1753111484-27021-1-git-send-email-andremue@linux.microsoft.com>
Array range initialization is non-standard and is not provided by
all compilers. MSVC does not implement it and ends up emitting
errors like the one below:
drivers/net/r8169/r8169_phy.c(380):
error C2143: syntax error: missing ':' before '...'
case CFG_METHOD_48 ... CFG_METHOD_57:
The fix is to explicitly initialize each element in the range.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
Acked-by: Howard Wang <howard_wang@realsil.com.cn>
---
drivers/common/mlx5/mlx5_malloc.h | 4 ++--
drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
drivers/net/mlx5/mlx5_rx.c | 4 ++--
drivers/net/mlx5/mlx5_utils.c | 4 ++--
drivers/net/octeon_ep/otx_ep_mbox.c | 24 ++++++++++++++++++++----
5 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/drivers/common/mlx5/mlx5_malloc.h b/drivers/common/mlx5/mlx5_malloc.h
index 6e5cc3d851..27d3e5bdf2 100644
--- a/drivers/common/mlx5/mlx5_malloc.h
+++ b/drivers/common/mlx5/mlx5_malloc.h
@@ -118,8 +118,8 @@ void mlx5_free(void *addr);
mem; \
}))
#else
-#define mlx5_malloc_numa_tolerant(flags, size, align, socket)
- (mlx5_malloc((flags) | MLX5_NUMA_TOLERANT, (size), (align), (socket)));
+#define mlx5_malloc_numa_tolerant(flags, size, align, socket) \
+ (mlx5_malloc((flags) | MLX5_NUMA_TOLERANT, (size), (align), (socket)))
#endif
#ifdef __cplusplus
}
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7b9e5018b8..54e1d0490a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -19652,7 +19652,10 @@ mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev)
.size = sizeof(value.buf),
};
struct mlx5dv_flow_matcher_attr dv_attr = {
- .type = IBV_FLOW_ATTR_NORMAL | IBV_FLOW_ATTR_FLAGS_EGRESS,
+ /* Cast below is needed to avoid warning until bug
+ * (https://bugs.dpdk.org/show_bug.cgi?id=1758) is fixed.
+ */
+ .type = IBV_FLOW_ATTR_NORMAL | (enum ibv_flow_attr_type)IBV_FLOW_ATTR_FLAGS_EGRESS,
.priority = 0,
.match_criteria_enable = 0,
.match_mask = (void *)&mask,
diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
index 5e8c312d00..1385b23d94 100644
--- a/drivers/net/mlx5/mlx5_rx.c
+++ b/drivers/net/mlx5/mlx5_rx.c
@@ -1093,7 +1093,7 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
break;
}
pkt = seg;
- MLX5_ASSERT(len >= (rxq->crc_present << 2));
+ MLX5_ASSERT(len >= (int)(rxq->crc_present << 2));
pkt->ol_flags &= RTE_MBUF_F_EXTERNAL;
if (rxq->cqe_comp_layout && mcqe)
cqe = &rxq->title_cqe;
@@ -1273,7 +1273,7 @@ mlx5_rx_burst_out_of_order(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts
}
if (!pkt) {
pkt = seg;
- MLX5_ASSERT(len >= (rxq->crc_present << 2));
+ MLX5_ASSERT(len >= (int)(rxq->crc_present << 2));
pkt->ol_flags &= RTE_MBUF_F_EXTERNAL;
if (rxq->cqe_comp_layout && mcqe)
cqe = &rxq->title_cqe;
diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c
index f31b1652bc..c95e69b40f 100644
--- a/drivers/net/mlx5/mlx5_utils.c
+++ b/drivers/net/mlx5/mlx5_utils.c
@@ -29,8 +29,8 @@
mem; \
}))
#else
-#define pool_malloc(pool, flags, size, align, socket)
- (pool)->cfg.malloc((uint32_t)(flags) | NUMA_TOLERANT, (size), (align), (socket));
+#define pool_malloc(pool, flags, size, align, socket) \
+ (((pool)->cfg.malloc(((uint32_t)(flags) | MLX5_NUMA_TOLERANT), (size), (align), (socket))))
#endif
int mlx5_logtype_ipool;
diff --git a/drivers/net/octeon_ep/otx_ep_mbox.c b/drivers/net/octeon_ep/otx_ep_mbox.c
index 1d7e08d2cc..e0fb6842e0 100644
--- a/drivers/net/octeon_ep/otx_ep_mbox.c
+++ b/drivers/net/octeon_ep/otx_ep_mbox.c
@@ -17,10 +17,26 @@
* with new command and it's version info.
*/
static uint32_t otx_ep_cmd_versions[OTX_EP_MBOX_CMD_MAX] = {
- [0 ... OTX_EP_MBOX_CMD_DEV_REMOVE] = OTX_EP_MBOX_VERSION_V1,
- [OTX_EP_MBOX_CMD_GET_FW_INFO ... OTX_EP_MBOX_NOTIF_LINK_STATUS] = OTX_EP_MBOX_VERSION_V2,
- [OTX_EP_MBOX_NOTIF_PF_FLR] = OTX_EP_MBOX_VERSION_V3
-
+ /* [0 ... OTX_EP_MBOX_CMD_DEV_REMOVE] = OTX_EP_MBOX_VERSION_V1, */
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ OTX_EP_MBOX_VERSION_V1,
+ /* [OTX_EP_MBOX_CMD_GET_FW_INFO ... OTX_EP_MBOX_NOTIF_LINK_STATUS] =
+ * OTX_EP_MBOX_VERSION_V2,
+ */
+ OTX_EP_MBOX_VERSION_V2,
+ OTX_EP_MBOX_VERSION_V2,
+ OTX_EP_MBOX_VERSION_V2,
+ /* [OTX_EP_MBOX_NOTIF_PF_FLR] = OTX_EP_MBOX_VERSION_V3 */
+ OTX_EP_MBOX_VERSION_V3,
};
static int
--
2.50.1.vfs.0.0
next prev parent reply other threads:[~2025-07-21 15:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 20:11 [PATCH 0/2] " Andre Muezerie
2024-12-26 20:11 ` [PATCH 1/2] app/test: " Andre Muezerie
2024-12-26 20:11 ` [PATCH 2/2] drivers/net: " Andre Muezerie
2025-03-05 16:06 ` [PATCH v2 0/2] " Andre Muezerie
2025-03-05 16:06 ` [PATCH v2 1/2] app/test: " Andre Muezerie
2025-03-05 16:06 ` [PATCH v2 2/2] drivers/net: " Andre Muezerie
2025-03-06 3:00 ` Patrick Robb
2025-03-07 8:07 ` Howard Wang
2025-06-12 14:17 ` [PATCH v3 0/3] enable drivers to be compiled with MSVC Andre Muezerie
2025-06-12 14:17 ` [PATCH v3 1/3] app/test: remove use of non-standard array range initialization Andre Muezerie
2025-06-12 15:03 ` Bruce Richardson
2025-06-16 7:23 ` David Marchand
2025-06-12 14:17 ` [PATCH v3 2/3] drivers/net: " Andre Muezerie
2025-06-16 7:37 ` David Marchand
2025-06-18 9:25 ` Thomas Monjalon
2025-06-18 9:37 ` 答复: " 王颢
2025-06-18 10:04 ` Thomas Monjalon
2025-06-12 14:17 ` [PATCH v3 3/3] drivers: enable drivers to be compiled with MSVC Andre Muezerie
2025-06-13 18:55 ` Patrick Robb
2025-06-23 14:02 ` [PATCH v3 0/3] " David Marchand
2025-07-21 15:24 ` [PATCH v4 " Andre Muezerie
2025-07-21 15:24 ` [PATCH v4 1/3] app/test: remove use of non-standard array range initialization Andre Muezerie
2025-07-21 15:24 ` Andre Muezerie [this message]
2025-07-21 15:24 ` [PATCH v4 3/3] drivers: enable drivers to be compiled with MSVC Andre Muezerie
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=1753111484-27021-3-git-send-email-andremue@linux.microsoft.com \
--to=andremue@linux.microsoft.com \
--cc=dev@dpdk.org \
/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).