[PATCH] net/mlx5: remove non constant size from type cast
Tyler Retzlaff
roretzla at linux.microsoft.com
Mon Feb 12 19:03:17 CET 2024
ping
this one seems pretty obvious, maintainers could you please take a look?
thanks
On Mon, Nov 13, 2023 at 09:20:38AM -0800, Tyler Retzlaff wrote:
> 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 at 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
More information about the dev
mailing list