From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52746A04B1; Mon, 23 Nov 2020 03:27:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BA74A37AF; Mon, 23 Nov 2020 03:27:50 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id D795323D for ; Mon, 23 Nov 2020 03:27:48 +0100 (CET) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CfWJg5t7Qzhg36 for ; Mon, 23 Nov 2020 10:27:31 +0800 (CST) Received: from localhost (10.174.243.72) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 23 Nov 2020 10:27:38 +0800 From: Yicai Lu To: CC: , , , , , , , Yicai Lu , Date: Mon, 23 Nov 2020 10:27:15 +0800 Message-ID: <1606098435-15804-1-git-send-email-luyicai@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1605706193-17192-1-git-send-email-luyicai@huawei.com> References: <1605706193-17192-1-git-send-email-luyicai@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.243.72] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2] ip_frag: recalculate data length of fragment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In some situations, we would get several ip fragments, which total data length is less than minimum frame(64) and padding with zeros. Examples: Second Fragment "a0a1 a2a3 a4a5 a6a7 0000 0000 ..." and Third Fragment "a8a9 aaab acad aeaf b0b1 b2b3 ...". Finally, we would reassemble Second and Third Fragment like this "a0a1 a2a3 a4a5 a6a7 0000 0000 ... a8a9 aaab acad aeaf b0b1 ...", which is not correct! So, we need recalculate data length of fragment to remove padings! Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library") Cc: anatoly.burakov@intel.com Signed-off-by: Yicai Lu --- v1 -> v2: Adjust commit info style --- lib/librte_ip_frag/ip_frag_internal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ip_frag/ip_frag_internal.c b/lib/librte_ip_frag/ip_frag_internal.c index b436a4c..7bdd980 100644 --- a/lib/librte_ip_frag/ip_frag_internal.c +++ b/lib/librte_ip_frag/ip_frag_internal.c @@ -155,6 +155,7 @@ struct rte_mbuf * fp->frags[idx].ofs = ofs; fp->frags[idx].len = len; + mb->data_len = mb->l2_len + mb->l3_len + len; fp->frags[idx].mb = mb; mb = NULL; -- 1.9.5.msysgit.1