On Wed, 8 Jan 2025 10:46:32 +0800 Jie Hai <haij...@huawei.com> wrote:
> From: Jie Hai <haij...@huawei.com> > To: <dev@dpdk.org>, <tho...@monjalon.net>, <ferruh.yi...@amd.com>, Aman Singh > <aman.deep.si...@intel.com> > CC: <lihuis...@huawei.com>, <fengceng...@huawei.com>, <haij...@huawei.com>, > <huangdeng...@huawei.com> > Subject: [PATCH] app/testpmd: add ipv6 extension header parse > Date: Wed, 8 Jan 2025 10:46:32 +0800 > X-Mailer: git-send-email 2.22.0 > > This patch support parse ipv6 extension header, and > support TSO for ipv6tcp packets with extension header. > > Signed-off-by: Jie Hai <haij...@huawei.com> > --- > app/test-pmd/csumonly.c | 47 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) > > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c > index 2246c22e8e56..a7b11490fe27 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -124,14 +124,59 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct > testpmd_offload_info *info) > info->l4_len = 0; > } > > +static uint16_t > +parse_ipv6_ext(struct rte_ipv6_hdr *ipv6_hdr, uint32_t *off) > +{ > + struct ext_hdr { > + uint8_t next_hdr; > + uint8_t len; > + }; > + struct ext_hdr *xh; > + uint16_t proto; > + char *xh_fst; > + uint16_t i; > + > + proto = ipv6_hdr->proto; > + xh_fst = (char *)ipv6_hdr + sizeof(*ipv6_hdr); > +#define MAX_EXT_HDRS 9 > + for (i = 0; i < MAX_EXT_HDRS; i++) { > + switch (proto) { > + case IPPROTO_HOPOPTS: > + case IPPROTO_ROUTING: > + case IPPROTO_DSTOPTS: > + xh = (struct ext_hdr *)(xh_fst + *off); > + *off += (xh->len + 1) * 8; > + proto = xh->next_hdr; > + break; > + case IPPROTO_AH: > + xh = (struct ext_hdr *)(xh_fst + *off); > + *off += (xh->len + 2) * 4; > + proto = xh->next_hdr; > + break; > + case IPPROTO_FRAGMENT: > + xh = (struct ext_hdr *)(xh_fst + *off); > + *off += 8; > + proto = xh->next_hdr; > + return proto; /* this is always the last ext hdr */ > + case IPPROTO_NONE: > + return proto; > + default: > + return proto; > + } > + } > + return proto; > +} > + Why copy/paste of rte_net_skip_ip6_ext, why not use that? Having two copies of same codes means that bugs need to be fixed in two places later.