From: "Huichao Cai" <chcchc88@163.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re:RE: [PATCH v3] ip_frag: add IPv4 options fragment and test data
Date: Mon, 28 Feb 2022 20:39:23 +0800 (CST) [thread overview]
Message-ID: <20c4978.4cc1.17f4057b457.Coremail.chcchc88@163.com> (raw)
In-Reply-To: <DM6PR11MB4491C19AE9D76201E765A08C9A3E9@DM6PR11MB4491.namprd11.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2939 bytes --]
Hi Konstantin,
> These macros are dups for what we have in rte_ipv4_fragmentation.c
> Would probably make sense to name them RTE_IPV4_IPOPT_... and put them
> in some public .h to avoid duplication.
I named them RTE_IPV4_IPOPT_xxx and put them in "rte_ip_frag.h".
> Could you clarify what this macro does?
> BTW, I assume it is a local one?
> If so, no need for RTE_ prefix.
Yes,it is a local macro.I will cancel the RTE_ prefix.It is a toggle switch used as a different way to assemble frag test data.It is convenient for users to use different ways to assemble test data.
> Instead of returning void and having out parameter (ipopt_len),
> why just not make it a return value?
> static inline uint16_t
> __create_ipopt_frag_hdr(const uint8_t *iph, uint8_t * ipopt_frag_hdr, uint16_t len)
> {
> ....
> return ipopt_len;
> }
> We probably can update ihl once at the very end of this function.
Ok,I will modify it this way,Thank you for your advice.
> Can we probably do that before the loop (as we have to do it only once anyway?
> Something like:
> ....
> ipopt_len = header_len - sizeof(struct rte_ipv4_hdr);
> if (ipopt_len > RTE_IPOPT_MAX_LEN)
> return -EINVAL;
> if (ipopt_len != 0)
> ipopt_len = __create_ipopt_frag_hdr((in_hdr, ipopt_frag_hdr, ipopt_len);
> ....
> And then:
> while (likely(more_in_segs)) {
> ...
> if (ipopt_len ! = 0)
> in_hdr = (struct rte_ipv4_hdr *)ipopt_frag_hdr;
> }
The modified code is as follows:
ipopt_len = header_len - sizeof(struct rte_ipv4_hdr); if (unlikely(ipopt_len > RTE_IPV4_IPOPT_MAX_LEN)) return -EINVAL; else if (ipopt_len == 0) /* Used to mark without processing frag. */ ipopt_len = RTE_IPV4_IPOPT_MAX_LEN + 1; /* The first frag. */ else if ((flag_offset & RTE_IPV4_HDR_OFFSET_MASK) == 0) /* Create a separate IP header to handle frag options. */ ipopt_len = __create_ipopt_frag_hdr((uint8_t *)in_hdr, ipopt_len, ipopt_frag_hdr);
while (likely(more_in_segs)) {
...
if (unlikely((fragment_offset == 0) &&
(ipopt_len <= RTE_IPV4_IPOPT_MAX_LEN) &&
((flag_offset & RTE_IPV4_HDR_OFFSET_MASK) == 0))) {
fragment_offset = (uint16_t)(fragment_offset +
out_pkt->pkt_len - header_len);
out_pkt->l3_len = header_len;
header_len = sizeof(struct rte_ipv4_hdr) + ipopt_len;
in_hdr = (struct rte_ipv4_hdr *)ipopt_frag_hdr;
} else {
fragment_offset = (uint16_t)(fragment_offset +
out_pkt->pkt_len - header_len);
out_pkt->l3_len = header_len;
}
}
These two pieces of code were previously merged together.It doesn't look as brief as before.I would like to hear from you.
Some minor issues:
1. There are some RTE_ prefixes in the rte_ipv4_fragmentation.c.Do I need to move to a public header file?
/* Fragment Offset */
#define RTE_IPV4_HDR_DF_SHIFT 14 #define RTE_IPV4_HDR_MF_SHIFT 13 #define RTE_IPV4_HDR_FO_SHIFT 3
2. Some comments are in the following format:/**< xxx */,What does this symbol(**<) mean?
Huichao,Cai
[-- Attachment #2: Type: text/html, Size: 9808 bytes --]
next prev parent reply other threads:[~2022-02-28 12:40 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 8:47 [PATCH] ip_frag: add IPv4 options fragment and unit " Huichao Cai
2021-12-01 11:49 ` Dariusz Sosnowski
2021-12-02 2:24 ` Huichao Cai
2022-02-15 8:50 ` [PATCH v2] ip_frag: add IPv4 options fragment and " Huichao Cai
2022-02-18 19:04 ` Ananyev, Konstantin
2022-02-21 2:34 ` Huichao Cai
2022-02-21 3:17 ` [PATCH v3] " Huichao Cai
2022-02-25 14:33 ` Ananyev, Konstantin
2022-02-28 12:39 ` Huichao Cai [this message]
2022-03-15 7:22 ` [PATCH v4] " Huichao Cai
2022-03-21 14:24 ` Ananyev, Konstantin
2022-03-22 1:25 ` Huichao Cai
2022-03-22 3:09 ` [PATCH v5] " Huichao Cai
2022-03-23 12:52 ` Ananyev, Konstantin
2022-04-06 1:22 ` Huichao Cai
2022-04-06 16:47 ` Ananyev, Konstantin
2022-04-07 14:08 ` Aaron Conole
2022-04-13 2:49 ` Huichao Cai
2022-04-11 3:55 ` [PATCH v6] " Huichao Cai
2022-04-14 13:14 ` Thomas Monjalon
2022-04-14 13:26 ` Thomas Monjalon
2022-04-15 1:52 ` Huichao Cai
2022-04-15 3:26 ` [PATCH v7] " Huichao Cai
2022-04-15 8:29 ` Ananyev, Konstantin
2022-05-29 8:50 ` Huichao Cai
2022-05-29 8:57 ` Huichao Cai
2022-05-29 10:38 ` Konstantin Ananyev
2022-05-31 21:23 ` Thomas Monjalon
2022-06-16 15:10 ` David Marchand
2022-06-16 16:31 ` Stephen Hemminger
2022-06-17 3:52 ` Huichao Cai
2022-06-17 16:31 ` Stephen Hemminger
2022-06-18 11:01 ` Huichao Cai
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=20c4978.4cc1.17f4057b457.Coremail.chcchc88@163.com \
--to=chcchc88@163.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.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).