<div dir="ltr">Shall I raise a PR with the change ? <br><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 12, 2022 at 7:04 AM Jun Qiu <<a href="mailto:jun.qiu@jaguarmicro.com">jun.qiu@jaguarmicro.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-7752807477528170785">





<div lang="ZH-CN">
<div class="m_-7752807477528170785WordSection1">
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:rgb(16,18,20);background:white" lang="EN-US">Yes,  It's better to do it before
</span><span lang="EN-US">the</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:rgb(16,18,20);background:white" lang="EN-US"> tcp_dl chec</span><span lang="EN-US">k.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:等线" lang="EN-US"><u></u> <u></u></span></p>
<div style="border-color:currentcolor currentcolor currentcolor rgb(108,226,108);border-style:none none none solid;border-width:medium medium medium 2.25pt;padding:0cm;background:white;margin-left:18pt;margin-right:0cm">
<ol type="1" start="1">
<li class="m_-7752807477528170785alt" style="color:rgb(92,92,92);line-height:10.5pt;background:white;border:medium none;padding:0cm">
<span class="m_-7752807477528170785comment"><span style="font-size:9pt;font-family:Consolas;color:rgb(0,130,0);border:1pt none windowtext;padding:0cm" lang="EN-US">/* trim the tail padding bytes */</span></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="MsoNormal" style="color:rgb(92,92,92);line-height:10.5pt;background:rgb(248,248,248);border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;list-style-position:outside">
<span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length);  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="m_-7752807477528170785alt" style="line-height:10.5pt;background:white;border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;color:inherit;list-style-position:outside">
<span class="m_-7752807477528170785keyword"><b><span style="font-size:9pt;font-family:Consolas;color:rgb(0,102,153);border:1pt none windowtext;padding:0cm" lang="EN-US">if</span></b></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US"> (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len))  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="MsoNormal" style="color:rgb(92,92,92);line-height:10.5pt;background:rgb(248,248,248);border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;list-style-position:outside">
<span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">    rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len);  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="m_-7752807477528170785alt" style="line-height:10.5pt;background:white;border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;color:inherit;list-style-position:outside">
<span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="MsoNormal" style="color:rgb(92,92,92);line-height:10.5pt;background:rgb(248,248,248);border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;list-style-position:outside">
<span class="m_-7752807477528170785comment"><span style="font-size:9pt;font-family:Consolas;color:rgb(0,130,0);border:1pt none windowtext;padding:0cm" lang="EN-US">/*</span></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US"> </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="m_-7752807477528170785alt" style="line-height:10.5pt;background:white;border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;color:inherit;list-style-position:outside">
<span class="m_-7752807477528170785comment"><span style="font-size:9pt;font-family:Consolas;color:rgb(0,130,0);border:1pt none windowtext;padding:0cm" lang="EN-US"> * Don't process the packet whose payload length is less than or</span></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US"> </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="MsoNormal" style="color:rgb(92,92,92);line-height:10.5pt;background:rgb(248,248,248);border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;list-style-position:outside">
<span class="m_-7752807477528170785comment"><span style="font-size:9pt;font-family:Consolas;color:rgb(0,130,0);border:1pt none windowtext;padding:0cm" lang="EN-US"> * equal to 0.</span></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US"> </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="m_-7752807477528170785alt" style="line-height:10.5pt;background:white;border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;color:inherit;list-style-position:outside">
<span class="m_-7752807477528170785comment"><span style="font-size:9pt;font-family:Consolas;color:rgb(0,130,0);border:1pt none windowtext;padding:0cm" lang="EN-US"> */</span></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="MsoNormal" style="color:rgb(92,92,92);line-height:10.5pt;background:rgb(248,248,248);border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;list-style-position:outside">
<span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">tcp_dl = pkt->pkt_len - hdr_len;  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="m_-7752807477528170785alt" style="line-height:10.5pt;background:white;border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;color:inherit;list-style-position:outside">
<span class="m_-7752807477528170785keyword"><b><span style="font-size:9pt;font-family:Consolas;color:rgb(0,102,153);border:1pt none windowtext;padding:0cm" lang="EN-US">if</span></b></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US"> (tcp_dl <= 0)  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li><li class="MsoNormal" style="color:rgb(92,92,92);line-height:10.5pt;background:rgb(248,248,248);border:medium none;padding:0cm;box-sizing:border-box;list-style-type:decimal-leading-zero;list-style-position:outside">
<span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US">    </span><span class="m_-7752807477528170785keyword"><b><span style="font-size:9pt;font-family:Consolas;color:rgb(0,102,153);border:1pt none windowtext;padding:0cm" lang="EN-US">return</span></b></span><span style="font-size:9pt;font-family:Consolas;color:black;border:1pt none windowtext;padding:0cm" lang="EN-US"> -1;  </span><span style="font-size:9pt;font-family:Consolas" lang="EN-US"><u></u><u></u></span></li></ol>
</div>
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US"> kumaraparameshwaran rathinavel <<a href="mailto:kumaraparamesh92@gmail.com" target="_blank">kumaraparamesh92@gmail.com</a>>
<br>
<b>Sent:</b> Tuesday, October 11, 2022 1:48 PM<br>
<b>To:</b> <a href="mailto:dev@dpdk.org" target="_blank">dev@dpdk.org</a>; David Marchand <<a href="mailto:david.marchand@redhat.com" target="_blank">david.marchand@redhat.com</a>>; Hu, Jiayu <<a href="mailto:jiayu.hu@intel.com" target="_blank">jiayu.hu@intel.com</a>>; Jun Qiu <<a href="mailto:jun.qiu@jaguarmicro.com" target="_blank">jun.qiu@jaguarmicro.com</a>><br>
<b>Subject:</b> Fwd: [PATCH] gro : fix pkt length when extra bytes are padded to ethernet frame<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal" style="text-align:justify"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal" style="text-align:justify"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal" style="text-align:justify"><span lang="EN-US">On Tue, Oct 11, 2022 at 1:03 AM David Marchand <<a href="mailto:david.marchand@redhat.com" target="_blank">david.marchand@redhat.com</a>> wrote:<u></u><u></u></span></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-bottom:12pt;text-align:justify">
<span lang="EN-US">On Mon, Oct 10, 2022 at 7:51 PM Kumara Parameshwaran<br>
<<a href="mailto:kumaraparamesh92@gmail.com" target="_blank">kumaraparamesh92@gmail.com</a>> wrote:<br>
><br>
> From: Kumara Parameshwaran <<a href="mailto:kumaraparamesh92@gmail.com" target="_blank">kumaraparamesh92@gmail.com</a>><br>
><br>
> When GRO packets are merged the packet length is used while<br>
> merging the adjacent packets. If the padded bytes are accounted<br>
> we would end up acking unsent TCP segments.<br>
><br>
> Signed-off-by: Kumara Parameshwaran <<a href="mailto:kumaraparamesh92@gmail.com" target="_blank">kumaraparamesh92@gmail.com</a>><br>
> v1:<br>
>         If there is padding to the ethernet frame cases where timestamp is disabled<br>
>         the packet length should be validated with the total ip length as packet length<br>
>         is used in the GRO merging logic<br>
<br>
Please, can you test with current main branch?<br>
We recently merged a fix:<br>
<a href="https://git.dpdk.org/dpdk/commit/?id=b8a55871d5af6f5b8694b1cb5eacbc629734e403" target="_blank">https://git.dpdk.org/dpdk/commit/?id=b8a55871d5af6f5b8694b1cb5eacbc629734e403</a><u></u><u></u></span></p>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="text-align:justify"><span lang="EN-US">Thanks, David. I did look at the patch. This would fix the problem, but lets say for a case of an ACK packet where TCP data length would be zero and if the packet
 contains the padded bytes, this check should be done before the follwing check and not after this.
<a href="mailto:jiayu.hu@intel.com" target="_blank">@Hu, Jiayu</a>  <a href="mailto:jun.qiu@jaguarmicro.com" target="_blank">
@Jun Qiu</a>  please let me know your thoughts.  <u></u><u></u></span></p>
</blockquote>
</blockquote>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="text-align:justify"><span lang="EN-US">/*<br>
* Don't process the packet whose payload length is less than or<br>
* equal to 0.<br>
*/<br>
tcp_dl = pkt->pkt_len - hdr_len;<br>
if (tcp_dl <= 0)<br>
return -1;  <u></u><u></u></span></p>
</blockquote>
</blockquote>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-bottom:12pt;text-align:justify">
<span lang="EN-US">-- <br>
David Marchand<u></u><u></u></span></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>

</div></blockquote></div></div>