DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bugfix: rte_raw_checksum
@ 2020-05-27 13:40 guohongzhi
  2020-05-27 14:58 ` Morten Brørup
  2020-06-24 12:21 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  0 siblings, 2 replies; 8+ messages in thread
From: guohongzhi @ 2020-05-27 13:40 UTC (permalink / raw)
  To: dev
  Cc: stable, olivier.matz, mb, konstantin.ananyev, jiayu.hu,
	ferruh.yigit, nicolas.chautru, cristian.dumitrescu, zhoujingbin,
	chenchanghu, jerry.lilijun, haifeng.lin, guohongzhi1

From: Hongzhi Guo <guohongzhi1@huawei.com>

__rte_raw_cksum should consider Big Endian.

Signed-off-by: Hongzhi Guo <guohongzhi1@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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-06  7:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 13:40 [dpdk-dev] [PATCH] bugfix: rte_raw_checksum guohongzhi
2020-05-27 14:58 ` Morten Brørup
2020-06-24 12:21 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2020-06-24 13:00   ` Morten Brørup
2020-06-24 15:04     ` Thomas Monjalon
2020-06-24 15:11       ` Morten Brørup
2020-07-06  7:36         ` Olivier Matz
2020-07-06  7:46           ` Olivier Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).