-----Original Message----- From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim Uvarov Sent: Wednesday, September 23, 2015 8:37 PM To: lng-odp@lists.linaro.org Subject: Re: [lng-odp] [PATCH] validation:pktio : Fix UDP checksum computation
On 09/21/15 08:57, ion.grig...@freescale.com wrote: > From: Grigore Ion <ion.grig...@freescale.com> > > The UDP checksum is computed in the CPU endianess. The returned result > must be converted to the BE ordering when it is used to update the UDP > checksum in a packet. > > Signed-off-by: Grigore Ion <ion.grig...@freescale.com> > --- > test/validation/pktio/pktio.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/test/validation/pktio/pktio.c > b/test/validation/pktio/pktio.c index d62f18d..604ac89 100644 > --- a/test/validation/pktio/pktio.c > +++ b/test/validation/pktio/pktio.c > @@ -195,7 +195,7 @@ static int pktio_fixup_checksums(odp_packet_t pkt) > ip->chksum = 0; > odph_ipv4_csum_update(pkt); > udp->chksum = 0; > - udp->chksum = odph_ipv4_udp_chksum(pkt); > + udp->chksum = odp_cpu_to_be_16(odph_ipv4_udp_chksum(pkt)); > odph_ipv4_udp_chksum() should return checksum in right bite order. Converting it each time like that complicates code. Maxim. The chksum field is declared as uint16be_t. In my opinion, applications updating the xxxbe_t fields should call the odp_cpu_to_be_xx function to update such fields (mapped on data in a BE packet). From this point of view, odph_ipv4_udp_chksum() returns the checksum in the CPU byte order. The same is done in the function odph_ipv4_csum_update(). Grig > return 0; > } _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp