From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: 蔡慧超 <chcchc88@163.com>
Cc: "caihc1@chinatelecom.cn" <caihc1@chinatelecom.cn>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ip_frag: modify the fragment offset and mf
Date: Fri, 8 Oct 2021 08:33:49 +0000 [thread overview]
Message-ID: <DM6PR11MB44918DA49F0CE84746BEE1A19AB29@DM6PR11MB4491.namprd11.prod.outlook.com> (raw)
In-Reply-To: <6d170a12.3a8e.17c5eef9a20.Coremail.chcchc88@163.com>
Hi Kevin,
I thought about something like that
(feel free to update it if you feel I missed something):
ip_frag: fix fragmenting IPv4 fragment
Current implementation of rte_ipv4_fragment_packet() doesn’t take
into account offset and flag values of the given packet, but blindly assumes
they are always zero (original packet is not fragmented).
According to RFC791, fragment and flag values for new fragment should
take into account values provided in the original IPv4 packet.
Fixes: 4c38e5532a07 ("ip_frag: refactor IPv4 fragmentation into a proper library")
Cc: mailto:stable@dpdk.org
Signed-off-by: ...
> I searched for the frag keyword and found no bugs related to this patch.
I think there is none, but you can create one if you'd like.
Then, in the commit body, straight before "Fixes: ..." line, don’t forget to add:
Bugzilla ID: <your defect id>
Hope that helps
Konstantin
From: 蔡慧超 <chcchc88@163.com>
Sent: Friday, October 8, 2021 9:06 AM
To: Ananyev, Konstantin <konstantin.ananyev@intel.com>
Cc: caihc1@chinatelecom.cn; dev@dpdk.org
Subject: Re:RE: [PATCH] ip_frag: modify the fragment offset and mf
Hi,Ananyev, Konstantin
Thank you for your reply.I'm sorry for my poor English.This is the first time I've submitted a patch to the DPDK, and some of the processes are not familiar.I am happy to contribute to the DPDK.
As described in your message:
>As I understand what that patch does - fixes the case when we have
>to fragment already fragmented ip datagram, correct?
--Yes,you are right.
>Can I ask you to do few things:
>1. Reword commit message, it is really misleading right now.
--Ok, I'll modify the commit message.But I'd like to confirm with you in advance how to describe it, because you understand what the patch means.I intend to use your explanation as commit information:“Fix the case when we have to fragment already fragmented ip datagram.”Is that okay?
> Also if is a fix, then you need to follow:
> https://doc.dpdk.org/guides/contributing/patches.html#patch-fix-related-issues
--https://scan.coverity.com/projects/dpdk-data-plane-development-kit
--I ran into a problem when I clicked the button “View Defects” :
401: Unauthorized
Sorry, your credentials are not valid for this resource.
--But now I don't know how to apply for permission, and I'm asking mailto:support@synopsys.com for help.I don't think this patch should be in Coverity.
--Bugzilla
--I searched for the frag keyword and found no bugs related to this patch.
>2. Add new test-case for it into app/test/test_ipfrag.c
--Okay, I'll try to add it.
Best regards.
huichao cai(Kevin).
At 2021-10-08 01:26:17, "Ananyev, Konstantin" <mailto:konstantin.ananyev@intel.com> wrote:
>
>
>> From: huichao cai <mailto:chcchc88@163.com>
>>
>> According to RFC791,the fragment offset value should be
>> calculated based on the long datagram,the more fragments flag
>> for the last fragment carries the same value as the long datagram.
>
>Have to admit, that commit log is really cryptic.
>I couldn't figure out what it is about till I read the actual code.
>As I understand what that patch does - fixes the case when we have
>to fragment already fragmented ip datagram, correct?
>The code changes itself look ok to me.
>Can I ask you to do few things:
>1. Reword commit message, it is really misleading right now.
> Also if is a fix, then you need to follow:
> https://doc.dpdk.org/guides/contributing/patches.html#patch-fix-related-issues
>2. Add new test-case for it into app/test/test_ipfrag.c
>
>Thanks
>
>>
>> Signed-off-by: huichao cai <mailto:chcchc88@163.com>
>> ---
>> lib/ip_frag/rte_ipv4_fragmentation.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/ip_frag/rte_ipv4_fragmentation.c b/lib/ip_frag/rte_ipv4_fragmentation.c
>> index 2e7739d..fead5a9 100644
>> --- a/lib/ip_frag/rte_ipv4_fragmentation.c
>> +++ b/lib/ip_frag/rte_ipv4_fragmentation.c
>> @@ -75,7 +75,7 @@ static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
>> uint32_t out_pkt_pos, in_seg_data_pos;
>> uint32_t more_in_segs;
>> uint16_t fragment_offset, flag_offset, frag_size, header_len;
>> - uint16_t frag_bytes_remaining;
>> + uint16_t frag_bytes_remaining, not_last_frag;
>>
>> /*
>> * Formal parameter checking.
>> @@ -116,7 +116,9 @@ static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
>> in_seg = pkt_in;
>> in_seg_data_pos = header_len;
>> out_pkt_pos = 0;
>> - fragment_offset = 0;
>> + fragment_offset = (uint16_t)((flag_offset &
>> + RTE_IPV4_HDR_OFFSET_MASK) << RTE_IPV4_HDR_FO_SHIFT);
>> + not_last_frag = (uint16_t)(flag_offset & IPV4_HDR_MF_MASK);
>>
>> more_in_segs = 1;
>> while (likely(more_in_segs)) {
>> @@ -186,7 +188,8 @@ static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
>>
>> __fill_ipv4hdr_frag(out_hdr, in_hdr, header_len,
>> (uint16_t)out_pkt->pkt_len,
>> - flag_offset, fragment_offset, more_in_segs);
>> + flag_offset, fragment_offset,
>> + not_last_frag || more_in_segs);
>>
>> fragment_offset = (uint16_t)(fragment_offset +
>> out_pkt->pkt_len - header_len);
>> --
>> 1.8.3.1
next prev parent reply other threads:[~2021-10-08 8:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 10:06 huichao cai
2021-10-07 17:26 ` Ananyev, Konstantin
2021-10-08 8:05 ` 蔡慧超
2021-10-08 8:33 ` Ananyev, Konstantin [this message]
2021-10-08 9:37 ` 蔡慧超
2021-10-08 10:24 ` Ananyev, Konstantin
2021-10-09 7:27 ` [dpdk-dev] [PATCH v2] ip_frag: fix fragmenting IPv4 fragment huichao cai
2021-10-12 10:16 ` Ananyev, Konstantin
2021-10-13 6:53 ` 蔡慧超
2021-10-13 9:12 ` Ananyev, Konstantin
2021-10-13 9:50 ` 蔡慧超
2021-10-14 6:51 ` Thomas Monjalon
2021-10-13 21:11 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2021-10-14 3:30 ` 蔡慧超
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=DM6PR11MB44918DA49F0CE84746BEE1A19AB29@DM6PR11MB4491.namprd11.prod.outlook.com \
--to=konstantin.ananyev@intel.com \
--cc=caihc1@chinatelecom.cn \
--cc=chcchc88@163.com \
--cc=dev@dpdk.org \
/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).