[v9,09/30] drivers/compress: replace packed attributes

Message ID 1736383715-31703-10-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series fix packing of structs when building with MSVC |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andre Muezerie Jan. 9, 2025, 12:48 a.m. UTC
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@linux.microsoft.com>
Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/compress/qat/qat_comp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/compress/qat/qat_comp.h b/drivers/compress/qat/qat_comp.h
index 1da4770b1c..18d5fd4b02 100644
--- a/drivers/compress/qat/qat_comp.h
+++ b/drivers/compress/qat/qat_comp.h
@@ -50,10 +50,10 @@  struct array_of_ptrs {
 	phys_addr_t pointer[0];
 };
 
-struct __rte_cache_aligned qat_inter_sgl {
+struct __rte_cache_aligned __rte_packed_begin qat_inter_sgl {
 	qat_sgl_hdr;
 	struct qat_flat_buf buffers[QAT_NUM_BUFS_IN_IM_SGL];
-} __rte_packed;
+} __rte_packed_end;
 
 
 struct qat_comp_op_cookie {