From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D082A0544; Mon, 10 Oct 2022 19:51:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8122940143; Mon, 10 Oct 2022 19:51:18 +0200 (CEST) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 33CD940041 for ; Mon, 10 Oct 2022 19:51:17 +0200 (CEST) Received: by mail-pj1-f48.google.com with SMTP id h12so4674765pjk.0 for ; Mon, 10 Oct 2022 10:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Hnvd+tzvKvNLHUBtPcSrTwpBfMbTX5L7b4D3r21Ux0U=; b=q0UEDfsVV2Q0AgLS7x4xfJ3Yd9Uuwx602O6475GoQSnHd59nrrmUfMcY48yyq3Bl2o CzPorxcHInnDWNwCwWaLQ0jGRCvcEHWs0PTYqwPJjIrhsvILj4nz1PFY0iICiR6g8n9J v1XPw+3L6Oq9VQWtuko3hBd05CKaSEceFYIuCQk6DOsrlTriQXgWYxt/Pt6B/PFvgDfW ciJDvOwj7sZM+6rtOLvkvrcSs7XrbwUMKEpUMp1SFFfLdGkCE7aXs4GdChYm9YEIBGKm ty+s7sjl4TARrs0ZQnpElQ01iFCsIPWO1EHfayplXU9BSesJO+qV6o5f3TnZcVrhBsha rgcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Hnvd+tzvKvNLHUBtPcSrTwpBfMbTX5L7b4D3r21Ux0U=; b=IjCljNEJK/7KN84Uzk37vB3rdJvdGecKdwY9GxdC12b7EwrsebGqk714mvPKYXTFXo v+hXokPSdUhvuUFwTNTiAQH5itCZkt+BWNE1s7LTK/TLpM++5wietjOMkJ2UDMnvVOSy kY7iQMB0suQwnq9nl11TxDZMO3aTIlCa20Vv4Pc7gl64RqSELmbiI8ImDm6DhJpzUM/4 +JGrEapjCxveMYgs4tQONgfnUwpfMjqMnOHswy6SHhurq7i+zaZ9cLqO7Utso3TwORUb 3xeJz91eJHCjRWdW2QNQgaBK3RAcOP46wxTd50Mo0qatwwDO371/2wKBHMII7xSjtrd3 CRwA== X-Gm-Message-State: ACrzQf1pN+obF743NLGCEw2UiFxPrpqGK4o2RzglY4Q/9hHWDvtxw7YD cNwdtoispxHCYNaIU8yMIwM= X-Google-Smtp-Source: AMsMyM55yqq3nW0RI8B/uHUu/Q7X1pVKtvCQF6o88iR+pxjkV9uK2nFRpc5piA8+HgZTYeVbte7Zeg== X-Received: by 2002:a17:90b:254c:b0:20a:8a92:ea5b with SMTP id nw12-20020a17090b254c00b0020a8a92ea5bmr21708341pjb.81.1665424276228; Mon, 10 Oct 2022 10:51:16 -0700 (PDT) Received: from kparameshwa-a02.vmware.com.com ([49.206.14.11]) by smtp.gmail.com with ESMTPSA id c2-20020a170902d48200b00182305a787fsm2861590plg.62.2022.10.10.10.51.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Oct 2022 10:51:15 -0700 (PDT) From: Kumara Parameshwaran X-Google-Original-From: Kumara Parameshwaran To: jiayu.hu@intel.com Cc: dev@dpdk.org, Kumara Parameshwaran Subject: [PATCH] gro : fix pkt length when extra bytes are padded to ethernet frame Date: Mon, 10 Oct 2022 23:21:09 +0530 Message-Id: <20221010175109.44282-1-kumaraparmesh92@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kumara Parameshwaran 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 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 --- lib/gro/gro_tcp4.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 7498c66141..ac6439bb4e 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -198,7 +198,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; - uint16_t ip_id, hdr_len, frag_off; + uint16_t ip_id, hdr_len, frag_off, ip_len; uint8_t is_atomic; struct tcp4_flow_key key; @@ -219,6 +219,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; + ip_len = rte_be_to_cpu_16(ipv4_hdr->total_length); + /* To handle padding cases in cases like where timestamps are disabled */ + if (unlikely(pkt->pkt_len > (uint32_t)(ip_len + pkt->l2_len))) { + pkt->pkt_len = ip_len + pkt->l2_len; + } + /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, ECE * or CWR set. -- 2.25.1