[PATCH v11 21/30] examples/l3fwd-power: replace packed attributes
Andre Muezerie
andremue at linux.microsoft.com
Fri Jan 10 23:16:42 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>
---
examples/l3fwd-power/main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index ae8b55924e..d279e664b3 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -282,21 +282,21 @@ static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
#define DEFAULT_HASH_FUNC rte_jhash
#endif
-struct ipv4_5tuple {
+struct __rte_packed_begin ipv4_5tuple {
uint32_t ip_dst;
uint32_t ip_src;
uint16_t port_dst;
uint16_t port_src;
uint8_t proto;
-} __rte_packed;
+} __rte_packed_end;
-struct ipv6_5tuple {
+struct __rte_packed_begin ipv6_5tuple {
uint8_t ip_dst[IPV6_ADDR_LEN];
uint8_t ip_src[IPV6_ADDR_LEN];
uint16_t port_dst;
uint16_t port_src;
uint8_t proto;
-} __rte_packed;
+} __rte_packed_end;
struct ipv4_l3fwd_route {
struct ipv4_5tuple key;
--
2.47.0.vfs.0.3
More information about the dev
mailing list