From patchwork Wed Sep 28 14:10:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jiangheng (G)" X-Patchwork-Id: 117061 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1698A00C4; Wed, 28 Sep 2022 16:10:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6ACA24113C; Wed, 28 Sep 2022 16:10:58 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id EA6CF410FA for ; Wed, 28 Sep 2022 16:10:56 +0200 (CEST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4McywF1RnLzlW43 for ; Wed, 28 Sep 2022 22:06:37 +0800 (CST) Received: from kwepemm000001.china.huawei.com (7.193.23.219) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 28 Sep 2022 22:10:53 +0800 Received: from dggpeml500020.china.huawei.com (7.185.36.88) by kwepemm000001.china.huawei.com (7.193.23.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 28 Sep 2022 22:10:53 +0800 Received: from dggpeml500020.china.huawei.com ([7.185.36.88]) by dggpeml500020.china.huawei.com ([7.185.36.88]) with mapi id 15.01.2375.031; Wed, 28 Sep 2022 22:10:52 +0800 From: "jiangheng (G)" To: "dev@dpdk.org" Subject: [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function. Thread-Topic: [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function. Thread-Index: AdjTQ2Sf0om8jtYvRcSAjsOrv8mU6Q== Date: Wed, 28 Sep 2022 14:10:52 +0000 Message-ID: <1c1df455cdb640c9889d359186d38637@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.136.117.195] MIME-Version: 1.0 X-CFilter-Loop: Reflected 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 Hello: In gro_tcp4_reassemble function, tcp data len is calculated: tcp_dl = pkt->pkt_len - hdr_len; https://github.com/DPDK/dpdk/blob/v22.07/lib/gro/gro_tcp4.c#L232 if packets < 60 bytes, pkt_len will contain padding bytes, tcp_dl is incorrectly calculated. this will result the wrong data length after gro. diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 7498c66141..cbba9fed5e 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -229,7 +229,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) - hdr_len; if (tcp_dl <= 0) return -1;