On Wed, Mar 20, 2024 at 02:06:11PM -0700, Tyler Retzlaff wrote: > Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing > when building with MSVC. > > Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com> > --- > examples/common/neon/port_group.h | 1 + > examples/ip_pipeline/cli.c | 5 +++++ > examples/ipsec-secgw/ipsec.h | 1 + > examples/l3fwd-power/main.c | 2 ++ > examples/ptpclient/ptpclient.c | 8 ++++++++ > 5 files changed, 17 insertions(+) > > diff --git a/examples/common/neon/port_group.h > b/examples/common/neon/port_group.h > index 421e2e8..bd40590 100644 > --- a/examples/common/neon/port_group.h > +++ b/examples/common/neon/port_group.h > @@ -21,6 +21,7 @@ > port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, > uint16x8_t dp2) > { > + __rte_msvc_pack > union { > uint16_t u16[FWDSTEP + 1]; > uint64_t u64; > diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c > index e8269ea..cae5c1f 100644 > --- a/examples/ip_pipeline/cli.c > +++ b/examples/ip_pipeline/cli.c > @@ -2566,6 +2566,7 @@ > * | lpm > * ipv4 | ipv6 <addr> <depth> > */ > +__rte_msvc_pack > struct pkt_key_qinq { > uint16_t ethertype_svlan; > uint16_t svlan; > @@ -2573,6 +2574,7 @@ struct pkt_key_qinq { > uint16_t cvlan; > } __rte_packed; > > +__rte_msvc_pack > struct pkt_key_ipv4_5tuple { > uint8_t time_to_live; > uint8_t proto; > @@ -2583,6 +2585,7 @@ struct pkt_key_ipv4_5tuple { > uint16_t dp; > } __rte_packed; > > +__rte_msvc_pack > struct pkt_key_ipv6_5tuple { > uint16_t payload_length; > uint8_t proto; > @@ -2593,10 +2596,12 @@ struct pkt_key_ipv6_5tuple { > uint16_t dp; > } __rte_packed; > > +__rte_msvc_pack > struct pkt_key_ipv4_addr { > uint32_t addr; > } __rte_packed; > > +__rte_msvc_pack > struct pkt_key_ipv6_addr { > uint8_t addr[16]; > } __rte_packed;
These structs don't look to me like they need packing. No padding should appear between elements of the structs. The last struct definitely doesn't need it, as it's a uint8_t array. /Bruce