On 07.12.2015 17:29, ion.grig...@freescale.com wrote:
> From: Grigore Ion <ion.grig...@freescale.com>
> 
> The UDP checksum is computed in the CPU endianness. 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>
> ---
> v1:
> Fix UDP checksum computation
> 
>  helper/test/odp_chksum.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/helper/test/odp_chksum.c b/helper/test/odp_chksum.c
> index 1d417a8..2b32111 100644
> --- a/helper/test/odp_chksum.c
> +++ b/helper/test/odp_chksum.c
> @@ -189,14 +189,14 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
>       udp->dst_port = 0;
>       udp->length = odp_cpu_to_be_16(udat_size + ODPH_UDPHDR_LEN);
>       udp->chksum = 0;
> -     udp->chksum = odph_ipv4_udp_chksum(test_packet);
> +     udp->chksum = odp_cpu_to_be_16(odph_ipv4_udp_chksum(test_packet));
>  
>       if (udp->chksum == 0)
>               return -1;
>  
>       printf("chksum = 0x%x\n", udp->chksum);
>  
> -     if (udp->chksum != 0xab2d)
> +     if (udp->chksum != odp_be_to_cpu_16(0x7e5a))

Isn't it illogical, that you're trying to compare BE integer with integer in 
CPU endianness?
I mean odp_cpu_to_be_16() != odp_be_to_cpu_16() .

Best regards, Ilya Maximets;

>               status = -1;
>  
>       odp_packet_free(test_packet);
> 
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to