common/mlx5: fix compilation for zero-length array
PATCH 1/1 common/mlx5: fix compilation for zero-length array
The structure of the striding RQ(MPRQ) buffer includes an array size defined by the RTE_PKTMBUF_HEADROOM macro added in [1].
When RTE_PKTMBUF_HEADROOM is set to 0 in the compilation config file the the compilation with debug type failed:
"In file included from ../drivers/common/mlx5/mlx5_common.h:25,
from ../drivers/common/mlx5/linux/mlx5_nl.h:12,
from ../drivers/common/mlx5/linux/mlx5_nl.c:22:../drivers/common/mlx5/mlx5_common_mr.h:96:10: error: ISO C forbids
zero-size array 'pad' [-Werror=pedantic]"
Actually, the array for the first stride headroom is not needed:
Each stride in the striding RQ buffer includes the headroom of the next stride, so the headroom of the first stride should be allocated before the starting point of the buffer posted to the HW(HW buffer).
The striding RQ buffer is used as an attached buffer to mbuf and have shared information per stride.
The LRO support moved all the strides shared information to the top of the buffer before the first stride headroom but didn't remove the old memory of this headroom from the buffer.
Remove the old headroom memory from the striding RQ buffer.
[1] commit 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support")
--- drivers/common/mlx5/mlx5_common_mr.h | 1 - 1 file changed, 1 deletion(-)
drivers/common/mlx5/mlx5_common_mr.h +0 -1
@@ -93,7 +93,6 @@ struct mlx5_mr_share_cache {struct mlx5_mprq_buf {struct rte_mempool *mp;uint16_t refcnt;/* Atomically accessed refcnt. */ -uint8_t pad[RTE_PKTMBUF_HEADROOM ];/* Headroom for the first packet. */ struct rte_mbuf_ext_shared_info shinfos[];/* * Shared information per stride.
Signature · 1 line
2.25.1
Hi,
Quoted 36 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Matan Azrad
Sent: Monday, November 8, 2021 2:22 PM
To: Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH] common/mlx5: fix compilation for zero-length arrayThe structure of the striding RQ(MPRQ) buffer includes an array size defined by the
RTE_PKTMBUF_HEADROOMmacro added in [1].When
RTE_PKTMBUF_HEADROOMis set to 0 in the compilation config file the
the compilation with debug type failed:"In file included from
../drivers/common/mlx5/mlx5_common.h:25,from ../drivers/common/mlx5/linux/mlx5_nl.h:12, from ../drivers/common/mlx5/linux/mlx5_nl.c:22:
../drivers/common/mlx5/mlx5_common_mr.h:96:10: error: ISO C forbids
zero-size array 'pad' [-Werror=pedantic]"Actually, the array for the first stride headroom is not needed:
Each stride in the striding RQ buffer includes the headroom of the next stride, so the headroom of the first stride should be allocated before the starting point of the buffer posted to the HW(HW buffer).
The striding RQ buffer is used as an attached buffer to mbuf and have shared information per stride.
The LRO support moved all the strides shared information to the top of the buffer before the first stride headroom but didn't remove the old memory of this headroom from the buffer.
Remove the old headroom memory from the striding RQ buffer.
Quoted 7 lines
Fixes 3a22f3877c9d ("net/mlx5: replace external mbuf shared memory")[1] commit
7d6bf6b866b8("net/mlx5: add Multi-Packet Rx support")Signed-off-by Matan Azrad <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh