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>
Subject: [dpdk-dev] [PATCH] ip_frag: recalculate data length of fragment
Date: Wed, 18 Nov 2020 21:29:53 +0800	[thread overview]
Message-ID: <1605706193-17192-1-git-send-email-luyicai@huawei.com> (raw)

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 is "a0a1 a2a3 a4a5 a6a7 0000 0000 ..."
and Third Fragment is "a8a9 aaab acad aeaf b0b1 b2b3 ...".
And then, 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 the data length 
of fragment to remove invalid padings(zero)!

Signed-off-by: Yicai Lu <luyicai@huawei.com>
---
 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 b436a4c93..7bdd98090 100644
--- a/lib/librte_ip_frag/ip_frag_internal.c
+++ b/lib/librte_ip_frag/ip_frag_internal.c
@@ -155,6 +155,7 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
 
 	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;
-- 
2.28.0.windows.1


             reply	other threads:[~2020-11-18 13:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 13:29 Yicai Lu [this message]
2020-11-22 11:22 ` Thomas Monjalon
2020-11-23  2:27 ` [dpdk-dev] [PATCH v2] " Yicai Lu
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=1605706193-17192-1-git-send-email-luyicai@huawei.com \
    --to=luyicai@huawei.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).