DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: remove non constant size from type cast
@ 2023-11-13 17:20 Tyler Retzlaff
  2024-02-12 18:03 ` Tyler Retzlaff
  2024-02-25 14:42 ` Raslan Darawsheh
  0 siblings, 2 replies; 4+ messages in thread
From: Tyler Retzlaff @ 2023-11-13 17:20 UTC (permalink / raw)
  To: dev
  Cc: Matan Azrad, Ori Kam, Suanming Mou, Viacheslav Ovsiienko, Tyler Retzlaff

Placing a non-constant size in the subscript [size] of a type cast is
causing unnecessary generation of a VLA. Remove size and just provide []
indicating the type is an array of unspecified size.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 5 ++---
 drivers/net/mlx5/mlx5_txq.c | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 88b2dc5..f0ab77d 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1951,9 +1951,8 @@ struct mlx5_rxq_ctrl *
 	tmpl->rxq.mp = rx_seg[0].mp;
 	tmpl->rxq.elts_n = log2above(desc);
 	tmpl->rxq.rq_repl_thresh = MLX5_VPMD_RXQ_RPLNSH_THRESH(desc_n);
-	tmpl->rxq.elts = (struct rte_mbuf *(*)[desc_n])(tmpl + 1);
-	tmpl->rxq.mprq_bufs =
-		(struct mlx5_mprq_buf *(*)[desc])(*tmpl->rxq.elts + desc_n);
+	tmpl->rxq.elts = (struct rte_mbuf *(*)[])(tmpl + 1);
+	tmpl->rxq.mprq_bufs = (struct mlx5_mprq_buf *(*)[])(*tmpl->rxq.elts + desc_n);
 	tmpl->rxq.idx = idx;
 	if (conf->share_group > 0) {
 		tmpl->rxq.shared = 1;
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index b584055..3d219c4 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -64,7 +64,7 @@
 	const uint16_t elts_m = elts_n - 1;
 	uint16_t elts_head = txq_ctrl->txq.elts_head;
 	uint16_t elts_tail = txq_ctrl->txq.elts_tail;
-	struct rte_mbuf *(*elts)[elts_n] = &txq_ctrl->txq.elts;
+	struct rte_mbuf *(*elts)[] = &txq_ctrl->txq.elts;
 
 	DRV_LOG(DEBUG, "port %u Tx queue %u freeing WRs",
 		PORT_ID(txq_ctrl->priv), txq_ctrl->txq.idx);
-- 
1.8.3.1


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

end of thread, other threads:[~2024-02-25 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 17:20 [PATCH] net/mlx5: remove non constant size from type cast Tyler Retzlaff
2024-02-12 18:03 ` Tyler Retzlaff
2024-02-13 11:56   ` Slava Ovsiienko
2024-02-25 14:42 ` Raslan Darawsheh

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