On Wed, Oct 30, 2024 at 12:21:00PM +0100, David Marchand wrote: > Hello Bruce, > > On Fri, Oct 25, 2024 at 6:51 PM Bruce Richardson > <bruce.richard...@intel.com> wrote: > > > > There are multiple instances in the DPDK app folder where we set up an > > IP header and then compute the checksum field by direct addition of > > nine uint16_t values in the header (20 bytes less the cksum field). > > The existing rte_ip.h checksum function is more general than necessary > > here and requires that the checksum field is already set to zero - > > rather than having it skipped. > > > > Fix the code duplication present in the apps by creating a new > > rte_ipv4_cksum_simple function - taking the code from the existing > > testpmd icmpecho.c file - and using that in app/test, testpmd and > > testeventdev. > > > > Within that new function, we can adjust slightly how the typecasting to > > uint16_t is done, and thereby ensure that the app can all be compiled > > without -Wno-address-of-packed-member compiler flag. > > > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> > > Acked-by: Stephen Hemminger <step...@networkplumber.org> > > Acked-by: Morten Brørup <m...@smartsharesystems.com> > > This added function triggers a build error with OVS because of -Wcast-align: > https://github.com/david-marchand/ovs/actions/runs/11401635820/job/32273090691#step:12:514 > > libtool: compile: env REAL_CC=gcc "CHECK=sparse -Wsparse-error -I > ./include/sparse -I ./include -m64 -I /usr/local/include -I > /usr/include/x86_64-linux-gnu " cgcc -target=x86_64 > -target=host_os_specs -D__MMX__=1 -D__MMX_WITH_SSE__=1 > -D__SSE2_MATH__=1 -D__SSE_MATH__=1 -D__SSE__=1 -D__SSE2__=1 > -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib > -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith > -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter > -Wbad-function-cast -Wcast-align -Wstrict-prototypes > -Wold-style-definition -Wmissing-prototypes > -Wmissing-field-initializers -fno-strict-aliasing -Wswitch-bool > -Wlogical-not-parentheses -Wsizeof-array-argument -Wbool-compare > -Wshift-negative-value -Wduplicated-cond -Wshadow > -Wmultistatement-macros -Wcast-align=strict -mssse3 > -I/home/runner/work/ovs/ovs/dpdk-dir/include -include rte_config.h > -mrtm -Werror -D_FILE_OFFSET_BITS=64 -g -O2 -MT lib/ofp-protocol.lo > -MD -MP -MF lib/.deps/ofp-protocol.Tpo -c lib/ofp-protocol.c -o > lib/ofp-protocol.o > In file included from /home/runner/work/ovs/ovs/dpdk-dir/include/rte_ip.h:9, > from /home/runner/work/ovs/ovs/dpdk-dir/include/rte_flow.h:25, > from lib/netdev-dpdk.h:30, > from lib/dp-packet.h:30, > from lib/ofp-print.c:34: > /home/runner/work/ovs/ovs/dpdk-dir/include/rte_ip4.h: In function > ‘rte_ipv4_cksum_simple’: > /home/runner/work/ovs/ovs/dpdk-dir/include/rte_ip4.h:191:17: error: > cast increases required alignment of target type [-Werror=cast-align] > 191 | v16_h = (const unaligned_uint16_t *)&ipv4_hdr->version_ihl; > | ^ Ok, I'll see if I can rework it to avoid issues.
/Bruce