<html><head></head><body><div id="editor_version_7.48.0_nDeKuLrb" style="word-break:break-word"><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">Hi Marat Khalili,</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">Thanks for your comments.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">We found small TCP checksum errors pkts online, then were traced to issues within the rte_raw_cksum_mbuf function.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">This error can be reproduced as follows:</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">1. In the client ECS with an MTU of 1500, initiate traffic using the command "iperf3 -c {dst ip} -b 1m -M 125 -t 8000". </div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">2. In the destination ECS, the InCsumErrors statistic can be viewed using the command "netstat -st | grep -i csum". The erroneous packets can also be confirmed via the tcpdump command.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">The following is a detailed description of a captured erroneous packet. The hex stream of the packet is as follows:</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">00163e0b6bd2eeffffffffff0800450000a50d7a40004006b94bc0a8f91dc0a8f91ed5d2145146f9d990e10d6a2d8010020040a200000101080a95ac86ba091145d3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">This is a packet in the format of eth + ipv4 + tcp + payload.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">The process leading to the error is as follows:</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">1. Due to the small MSS, TSO fragmentation was triggered, generating 3 mbufs.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">2. The data_len of the first mbuf is 66 bytes, containing the Ethernet header, IPv4 header, and TCP header.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">3. The data_len of the second mbuf is 61 bytes.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">4. The data_len of the third mbuf is 52 bytes.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">5. When calculating the checksum of the TCP header for such an mbuf chain using the rte_raw_cksum_mbuf function, the tmp value obtained during the calculation of the third mbuf is 0x19FFE6.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">6. After applying rte_bswap16, tmp becomes 0xE6FF, with 0x19 discarded. This results in an incorrect final checksum.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px">Meanwhile, we have also found that when enable jumbo frame, the payload becomes longer. In the process of rte_raw_cksum_mbuf handling an mbuf chain,due to the relatively large value of tmp, overflow will occur in the accumulated sum.</div></div><div style="margin-top:4px;margin-bottom:4px;line-height:1.6"><div dir="auto" style="font-size:14px"><br></div></div></div><div class="history-quote-wrapper" id="lark-mail-quote-175396149"><div><div id="lark-mail-quote-175396132" class="history-quote-wrapper"><div class="adit-html-block adit-html-block--collapsed" style="border-left:none;padding-left:0px"><div><div style="padding:12px;background:rgb(245,246,247);color:rgb(31,35,41);border-radius:4px;margin-top:24px;margin-bottom:12px" id="lark-mail-meta-sxFgpl8f3" class="adit-html-block__attr history-quote-meta-wrapper history-quote-gap-tag"><div id="lark-mail-quote-c30bb8b0ac376c844ff90352a50e58a0"><div style="word-break:break-word"><div class="lme-line-signal" style=""><span>From: </span> <span>"Marat Khalili"<<a href="mailto:marat.khalili@huawei.com" style="white-space:pre-wrap;word-break:break-word;text-decoration:none;color:inherit" class="quote-head-meta-mailto">marat.khalili@huawei.com</a>></span></div><div class="lme-line-signal" style=""><span>Date: </span> Thu, Jul 31, 2025, 19:04</div><div class="lme-line-signal" style=""><span>Subject: </span> [External] RE: [PATCH] net/cksum: compute raw cksum for several segments</div><div class="lme-line-signal" style=""><span>To: </span> <span>"苏赛"<<a href="mailto:susai.ss@bytedance.com" style="white-space:pre-wrap;word-break:break-word;text-decoration:none;color:inherit" class="quote-head-meta-mailto">susai.ss@bytedance.com</a>></span>, <span><span>"<a href="mailto:jasvinder.singh@intel.com" target="_blank">jasvinder.singh@intel.com</a>"<</span><a href="mailto:jasvinder.singh@intel.com" style="white-space:pre-wrap;word-break:break-word;text-decoration:none;color:inherit" class="quote-head-meta-mailto">jasvinder.singh@intel.com</a>></span></div><div class="lme-line-signal" style=""><span>Cc: </span> <span><span>"<a href="mailto:dev@dpdk.org" target="_blank">dev@dpdk.org</a>"<</span><a href="mailto:dev@dpdk.org" style="white-space:pre-wrap;word-break:break-word;text-decoration:none;color:inherit" class="quote-head-meta-mailto">dev@dpdk.org</a>></span></div></div></div></div><div><div class="msg-t6C4UMzUURoWpfR lme-line-signal">
<style>.msg-t6C4UMzUURoWpfR p.MsoNormal,.msg-t6C4UMzUURoWpfR li.MsoNormal,.msg-t6C4UMzUURoWpfR div.MsoNormal{margin:0cm;font-size:11.0pt;font-family:"Calibri",sans-serif}.msg-t6C4UMzUURoWpfR p.MsoPlainText,.msg-t6C4UMzUURoWpfR li.MsoPlainText,.msg-t6C4UMzUURoWpfR div.MsoPlainText{margin:0cm;font-size:11.0pt;font-family:"Calibri",sans-serif}.msg-t6C4UMzUURoWpfR span.PlainTextChar{font-family:"Calibri",sans-serif}.msg-t6C4UMzUURoWpfR span.EmailStyle21{font-family:"Calibri",sans-serif;color:windowtext}.msg-t6C4UMzUURoWpfR .MsoChpDefault{font-size:10.0pt}.msg-t6C4UMzUURoWpfR div.WordSection1{}</style>
<div class="lme-line-signal" lang="EN-US" style="word-wrap:break-word">
<div class="WordSection1 lme-line-signal">
<p class="MsoPlainText lme-line-signal">Sorry, sent the previous email too quickly.</p>
<p class="MsoPlainText lme-line-signal"> </p>
<p class="MsoPlainText lme-line-signal">> -----Original Message-----</p>
<div class="lme-line-signal" id="lark-mail-quote-b4c4f28bc71eb618fde98c2e56287d02"><p class="MsoNormal lme-line-signal">> From: Marat Khalili </p>
<p class="MsoNormal lme-line-signal">> Sent: Thursday 31 July 2025 11:52</p>
<p class="MsoNormal lme-line-signal">> To: '<span lang="ZH-CN" style="font-family:DengXian">苏赛</span><span>' <<a href="mailto:susai.ss@bytedance.com" rel="nofollow noopener noreferrer">susai.ss@bytedance.com</a>>; <a href="mailto:jasvinder.singh@intel.com" rel="nofollow noopener noreferrer">jasvinder.singh@intel.com</a></span></p>
<p class="MsoNormal lme-line-signal"><span>> Cc: <a href="mailto:dev@dpdk.org" rel="nofollow noopener noreferrer">dev@dpdk.org</a></span></p>
<p class="MsoNormal lme-line-signal">> Subject: RE: [PATCH] net/cksum: compute raw cksum for several segments</p>
<p class="MsoNormal lme-line-signal"> </p>
<p class="MsoNormal lme-line-signal">> > +static inline uint16_t</p>
<p class="MsoNormal lme-line-signal">> > +__rte_raw_cksum_reduce_u64(uint64_t sum)</p>
<p class="MsoNormal lme-line-signal">> > +{</p>
<p class="MsoNormal lme-line-signal">> > + uint32_t tmp;</p>
<p class="MsoNormal lme-line-signal">> > +</p>
<p class="MsoNormal lme-line-signal">> > + tmp = __rte_raw_cksum_reduce((uint32_t)sum);</p>
<p class="MsoNormal lme-line-signal">> > + tmp += __rte_raw_cksum_reduce((uint32_t)(sum >> 32));</p>
<p class="MsoNormal lme-line-signal">> </p>
<p class="MsoNormal lme-line-signal">> What if this addition overflows?</p>
<p class="MsoNormal lme-line-signal"> </p>
<p class="MsoNormal lme-line-signal">Realized it cannot actually overflow, my bad (maybe still needs a comment). Now this function looks good to me as well.</p>
<p class="MsoNormal lme-line-signal"> </p>
<p class="MsoNormal lme-line-signal">> > + return __rte_raw_cksum_reduce(tmp);</p>
<p class="MsoNormal lme-line-signal">> > +}</p>
</div></div>
</div></div></div></div></div></div></div></div></body></html>