[dpdk-dev] [dpdk-stable] [PATCH] bugfix: rte_raw_checksum

Thomas Monjalon thomas at monjalon.net
Wed Jun 24 14:21:59 CEST 2020


27/05/2020 15:40, guohongzhi:
> From: Hongzhi Guo <guohongzhi1 at huawei.com>
> 
> __rte_raw_cksum should consider Big Endian.

We need to explain the logic in the commit log.

> Signed-off-by: Hongzhi Guo <guohongzhi1 at huawei.com>
> ---
> +#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN)
> +		sum += *((const uint8_t *)u16_buf) << 8;
> +#else
>  		sum += *((const uint8_t *)u16_buf);
> +#endif

*((const uint8_t *)u16_buf) should be an uint8_t.
What is the expected behaviour of shifting 8 bits of a byte?




More information about the dev mailing list