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 DE130A00BE for ; Sun, 3 Apr 2022 13:50:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1283E4114E; Sun, 3 Apr 2022 13:50:48 +0200 (CEST) Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mails.dpdk.org (Postfix) with ESMTP id 0984F40041; Sun, 3 Apr 2022 13:50:45 +0200 (CEST) Received: by mail-pf1-f179.google.com with SMTP id x31so6455775pfh.9; Sun, 03 Apr 2022 04:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xNeqOrk+IjkuKlQPnbhIN7uYDMBF+iw8Kza2/ae7Wu0=; b=TSKxX1ExikZj9aO4hjF/N9ob4nSDHhjm+KZKTgUOYsEjd/IdI/JTJiaz3Y+sWRVehF F1oMuSf1TVMyRnEXu6nTbYJsSr6rGgNAQ541W0Su1LAZglAz4isSZu49Bz7rVSOss9k/ mN+Osf6h7fpxJIZmp2rTndX127iSgPKpzMv1FiAcv6LxwnPFFh83HrTeXm8zRF0zoJck +7E0lC8zSrU1vcQal/LfGoaHM1OZIjIWF7veX3/M8zKbTrar3WIOQJ+9NgIC3hcC7LCw 5YM06+KJpM0PM3AicnJPRyR8X5nimT6//2QJSZynwFDWY7w2NaP7KHLdlcu2OD2jFzMt 9+nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xNeqOrk+IjkuKlQPnbhIN7uYDMBF+iw8Kza2/ae7Wu0=; b=EbawJczpPVseSAvnu6gk0PiibmwTDfj4+XuI1rMTA7VUyzBUB4UiC5s7CO2gUC9Ixn uEmHSrt3JkHnU59TN5JPvCQbTUQI/VktruW4cBkieFloODSw9oDH7CGsmyX4a7gd/0MA XMhw/nwWTRhzTmzVmFRohcX1d1BWKKw3KKnAn8CQySqFqtuavDLbYM4Vr5IqujGXW/rb mdPfkOTWu1qxSJZOnuhOPjBbMWRlsgcmJ63j1nCR6CSGGOZudSWMJrd4xG/ibcQznrhK nBla00RFGiiFcNAd5AhCTqsjJGJs+betfMJCt6Pgun/MNMlaOsSb1llGfjr9v/6Ddm3L PWPA== X-Gm-Message-State: AOAM531NSxhVPvhDaBEFkog/n52FvSpm4NWpURwA20QeLf6yZ3IwBpH3 mGqMuuYTMu+4RnqUk8VNkxE= X-Google-Smtp-Source: ABdhPJxz7FDqFdqchYUOP92v7NwTl90Fd61ZTIlbPpohbIFEEswroWnr1hVRhZf5ocWJTKQ+Vp8QyA== X-Received: by 2002:a63:eb4a:0:b0:382:8e7:9023 with SMTP id b10-20020a63eb4a000000b0038208e79023mr21698791pgk.308.1648986645069; Sun, 03 Apr 2022 04:50:45 -0700 (PDT) Received: from kparameshwa-a02.vmware.com.com ([49.206.14.100]) by smtp.gmail.com with ESMTPSA id y16-20020a17090a6c9000b001c993d935e7sm7649937pjj.56.2022.04.03.04.50.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 03 Apr 2022 04:50:44 -0700 (PDT) From: Kumara Parameshwaran To: jiayu.hu@intel.com Cc: dev@dpdk.org, Kumara Parameshwaran , stable@dpdk.org, Kumara Parameshwaran Subject: [PATCH v1] gro: bug fix in identifying 0 length tcp packets Date: Sun, 3 Apr 2022 17:20:31 +0530 Message-Id: <20220403115031.59632-1-kumaraparamesh92@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org As the minimum Ethernet frame size is 64 bytes, a 0 length tcp payload without tcp options would be 54 bytes and hence there would be padding. So it would be incorrect to use the packet length to determine the tcp data length. Fixes: 1e4cf4d6d4fb ("gro: cleanup") Cc: stable@dpdk.org Signed-off-by: Kumara Parameshwaran --- v1: Do not use packet length to determine the tcp data length as the packet length could have padded bytes. This would lead to addition of 0 length tcp packets into the GRO layer when there ethernet fram is padded. lib/gro/gro_tcp4.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 7498c66..45e3f48 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, frag_off; uint8_t is_atomic; struct tcp4_flow_key key; @@ -217,7 +217,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); - hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, ECE @@ -229,7 +228,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * Don't process the packet whose payload length is less than or * equal to 0. */ - tcp_dl = pkt->pkt_len - hdr_len; + tcp_dl = rte_be_to_cpu_16(ipv4_hdr->total_length) - (pkt->l3_len + pkt->l4_len); if (tcp_dl <= 0) return -1; -- 2.7.4