On Tue, Nov 05, 2024 at 09:59:11AM +0100, David Marchand wrote:
> The new function breaks compilation with -Wcast-align.
>
> In file included from /home/runner/work/ovs/ovs/dpdk-dir/include/rte_ip.h:9:
> /home/runner/work/ovs/ovs/dpdk-dir/include/rte_ip4.h:191:10:
> error: cast from 'const uint8_t *' (aka 'const unsigned char *')
> to 'const unaligned_uint16_t *' (aka 'const unsigned short *')
> increases required alignment from 1 to 2 [-Werror,-Wcast-align]
> v16_h = (const unaligned_uint16_t *)&ipv4_hdr->version_ihl;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix this by aligning rte_ipv4_hdr to two bytes, and point at the start
> of the structure rather than the first field (which happens to be 1 byte
> large).
>
> Fixes: f9e1d67f237a ("net: add IPv4 cksum function for simple cases")
>
> Signed-off-by: David Marchand <david.march...@redhat.com>
> ---
> doc/guides/rel_notes/release_24_11.rst | 2 ++
> lib/net/rte_ip4.h | 4 ++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
Acked-by: Bruce Richardson <bruce.richard...@intel.com>