DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yicai Lu <luyicai@huawei.com>
To: <dev@dpdk.org>
Cc: <konstantin.ananyev@intel.com>, <zhoujingbin@huawei.com>,
	<chenchanghu@huawei.com>, <jerry.lilijun@huawei.com>,
	<haifeng.lin@huawei.com>, <guohongzhi1@huawei.com>,
	<wangyunjian@huawei.com>,  Yicai Lu <luyicai@huawei.com>,
	<anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH v2] ip_frag: recalculate data length of fragment
Date: Mon, 23 Nov 2020 10:27:15 +0800	[thread overview]
Message-ID: <1606098435-15804-1-git-send-email-luyicai@huawei.com> (raw)
In-Reply-To: <1605706193-17192-1-git-send-email-luyicai@huawei.com>

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 <luyicai@huawei.com>
---
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


  parent reply	other threads:[~2020-11-23  2:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 13:29 [dpdk-dev] [PATCH] " Yicai Lu
2020-11-22 11:22 ` Thomas Monjalon
2020-11-23  2:27 ` Yicai Lu [this message]
2020-12-12 11:05 ` [dpdk-dev] [PATCH v5] ip_frag: remove padding " Yicai Lu
2020-12-14 14:44   ` Ananyev, Konstantin
2020-12-15  3:18     ` luyicai
2020-12-16 10:44       ` Ananyev, Konstantin
2020-12-16 10:54         ` luyicai
2020-12-16 13:36 ` [dpdk-dev] [PATCH v6] " Yicai Lu
2020-12-18 11:41   ` Ananyev, Konstantin
2021-01-15 10:29     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1606098435-15804-1-git-send-email-luyicai@huawei.com \
    --to=luyicai@huawei.com \
    --cc=anatoly.burakov@intel.com \
    --cc=chenchanghu@huawei.com \
    --cc=dev@dpdk.org \
    --cc=guohongzhi1@huawei.com \
    --cc=haifeng.lin@huawei.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=wangyunjian@huawei.com \
    --cc=zhoujingbin@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).