[dpdk-dev] [PATCH] bugfix: rte_raw_checksum
Morten Brørup
mb at smartsharesystems.com
Wed May 27 16:58:32 CEST 2020
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of guohongzhi
> Sent: Wednesday, May 27, 2020 3:40 PM
>
> From: Hongzhi Guo <guohongzhi1 at huawei.com>
>
> __rte_raw_cksum should consider Big Endian.
>
> Signed-off-by: Hongzhi Guo <guohongzhi1 at 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 <mb at smartsharesystems.com>
More information about the dev
mailing list