[PATCH v10 13/30] drivers/mempool: replace packed attributes

Andre Muezerie andremue at linux.microsoft.com
Thu Jan 9 03:45:57 CET 2025


MSVC struct packing is not compatible with GCC. Replace macro
__rte_packed with __rte_packed_begin to push existing pack value
and set packing to 1-byte and macro __rte_packed_end to restore
the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a
MSVC compiler warning if no existing packing has been pushed allowing
easy identification of locations where the __rte_packed_begin is
missing.

Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
Reviewed-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 drivers/mempool/octeontx/octeontx_fpavf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 966fee8bfe..6cd0fc057f 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -46,20 +46,20 @@ struct octeontx_mbox_fpa_cfg {
 	uint64_t	aura_cfg;
 };
 
-struct __rte_packed gen_req {
+struct __rte_packed_begin gen_req {
 	uint32_t	value;
-};
+} __rte_packed_end;
 
-struct __rte_packed idn_req {
+struct __rte_packed_begin idn_req {
 	uint8_t	domain_id;
-};
+} __rte_packed_end;
 
-struct __rte_packed gen_resp {
+struct __rte_packed_begin gen_resp {
 	uint16_t	domain_id;
 	uint16_t	vfid;
-};
+} __rte_packed_end;
 
-struct __rte_packed dcfg_resp {
+struct __rte_packed_begin dcfg_resp {
 	uint8_t	sso_count;
 	uint8_t	ssow_count;
 	uint8_t	fpa_count;
@@ -67,7 +67,7 @@ struct __rte_packed dcfg_resp {
 	uint8_t	tim_count;
 	uint8_t	net_port_count;
 	uint8_t	virt_port_count;
-};
+} __rte_packed_end;
 
 #define FPA_MAX_POOL	32
 #define FPA_PF_PAGE_SZ	4096
-- 
2.47.0.vfs.0.3



More information about the dev mailing list