> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of guohongzhi
> Sent: Wednesday, May 27, 2020 3:40 PM
> 
> From: Hongzhi Guo <guohongz...@huawei.com>
> 
> __rte_raw_cksum should consider Big Endian.
> 
> Signed-off-by: Hongzhi Guo <guohongz...@huawei.com>
> ---
>  lib/librte_net/rte_ip.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
> index 1ceb7b7..eb863d4 100644
> --- a/lib/librte_net/rte_ip.h
> +++ b/lib/librte_net/rte_ip.h
> @@ -140,7 +140,11 @@ __rte_raw_cksum(const void *buf, size_t len,
> uint32_t sum)
> 
>       /* if length is in odd bytes */
>       if (len == 1)
> +#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN)
> +             sum += *((const uint8_t *)u16_buf) << 8;
> +#else
>               sum += *((const uint8_t *)u16_buf);
> +#endif
> 
>       return sum;
>  }
> --
> 2.21.0.windows.1
> 
> 

Acked-by: Morten Brørup <m...@smartsharesystems.com>

Reply via email to