Hi Kumara, Agree. We need to trim padding bytes first, then do the length check.
Thanks, Jiayu From: Jun Qiu <[email protected]> Sent: Wednesday, October 12, 2022 9:35 AM To: kumaraparameshwaran rathinavel <[email protected]>; [email protected]; David Marchand <[email protected]>; Hu, Jiayu <[email protected]> Subject: RE: [PATCH] gro : fix pkt length when extra bytes are padded to ethernet frame Yes, It's better to do it before the tcp_dl check. 1. /* trim the tail padding bytes */ 2. ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length); 3. if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) 4. rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); 5. 6. /* 7. * Don't process the packet whose payload length is less than or 8. * equal to 0. 9. */ 10. tcp_dl = pkt->pkt_len - hdr_len; 11. if (tcp_dl <= 0) 12. return -1; From: kumaraparameshwaran rathinavel <[email protected]<mailto:[email protected]>> Sent: Tuesday, October 11, 2022 1:48 PM To: [email protected]<mailto:[email protected]>; David Marchand <[email protected]<mailto:[email protected]>>; Hu, Jiayu <[email protected]<mailto:[email protected]>>; Jun Qiu <[email protected]<mailto:[email protected]>> Subject: Fwd: [PATCH] gro : fix pkt length when extra bytes are padded to ethernet frame On Tue, Oct 11, 2022 at 1:03 AM David Marchand <[email protected]<mailto:[email protected]>> wrote: On Mon, Oct 10, 2022 at 7:51 PM Kumara Parameshwaran <[email protected]<mailto:[email protected]>> wrote: > > From: Kumara Parameshwaran > <[email protected]<mailto:[email protected]>> > > When GRO packets are merged the packet length is used while > merging the adjacent packets. If the padded bytes are accounted > we would end up acking unsent TCP segments. > > Signed-off-by: Kumara Parameshwaran > <[email protected]<mailto:[email protected]>> > v1: > If there is padding to the ethernet frame cases where timestamp is > disabled > the packet length should be validated with the total ip length as > packet length > is used in the GRO merging logic Please, can you test with current main branch? We recently merged a fix: https://git.dpdk.org/dpdk/commit/?id=b8a55871d5af6f5b8694b1cb5eacbc629734e403 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. @Hu, Jiayu<mailto:[email protected]> @Jun Qiu<mailto:[email protected]> please let me know your thoughts. /* * Don't process the packet whose payload length is less than or * equal to 0. */ tcp_dl = pkt->pkt_len - hdr_len; if (tcp_dl <= 0) return -1; -- David Marchand

