From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3C29D46087;
	Tue, 14 Jan 2025 12:24:48 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0F2424025F;
	Tue, 14 Jan 2025 12:24:47 +0100 (CET)
Received: from fout-b8-smtp.messagingengine.com
 (fout-b8-smtp.messagingengine.com [202.12.124.151])
 by mails.dpdk.org (Postfix) with ESMTP id 27C73400EF
 for <dev@dpdk.org>; Tue, 14 Jan 2025 12:24:45 +0100 (CET)
Received: from phl-compute-12.internal (phl-compute-12.phl.internal
 [10.202.2.52])
 by mailfout.stl.internal (Postfix) with ESMTP id 310BD11400D4;
 Tue, 14 Jan 2025 06:24:44 -0500 (EST)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-12.internal (MEProxy); Tue, 14 Jan 2025 06:24:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm2; t=1736853884;
 x=1736940284; bh=Dd2gEnOIlhmCnwvM/XKpYvRQ4WaQCiV2Uwm9l26nWWI=; b=
 bCKmjdVe58ouU0f7koEBdvVceCdAnqdqyk4THxSINtWcUb7qiwwkmhh0ljiOVIc9
 6QUB9PUPjBIa2ec+ldiCPLl13ZXPmKwfG3p0roXGEiyw6LZWED7b2UZPpu1L4AHL
 2yUoNWFNPRny5Q00z1mYBztbcSVKiuyHTaZqHnUt31jY2Dtx+ttNl/+7V1L7PSR4
 b98qFBRKlu3iuO1+K8C+lNjSoc6SmAW8Z0QleBObImwedm8tRToGvWbCFVRPJeTB
 loksG1ipZ4KwTyuj8wT/Hp6E4qHYLf9N/R3upWUbdRkl87cm50tgblYV6xKTJy9D
 2C5Ca945Y7+Ol5af0gN5cw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736853884; x=
 1736940284; bh=Dd2gEnOIlhmCnwvM/XKpYvRQ4WaQCiV2Uwm9l26nWWI=; b=h
 MI+d0KW2E0u/K625Mm4yjyVtgVYcjZTiI7ZL9vFnr9u7fJe25StIXaB3a7cmvZ6L
 Xj8HKKMKFBJvwL20MZkbKM55zjW1Sg9xY2WC7eyrbGaFwKot4Uph3VAxBKcC0xxv
 S758OJ+ZUxkZgWMaJXkgq+/TNIGmA0kGaVhTwPv0esyBALRhHJNajzCxwFge2gsu
 F7/k97r8+B+73k8S15kFLJO9OH0Er/eLYhb0pvNSErsxwhXBiIGCGBXb1ys5qz13
 a+uxuENJlYz+geLgZ8yX/vvQ/Kz2VHRvA6bfnqHE/gLE7ZYJTUueVPgbwwOYDlMg
 fd8BnoH046W4ooYbg/7vQ==
X-ME-Sender: <xms:e0mGZ5GrNI62aZlw_uoKYR93LAnATUTj6G-w1hLrQznIMwdG8JwrIg>
 <xme:e0mGZ-VuMw4xdhBbjiFy_zwr5Ouqevpk__8PptSUuYXgWct6u8AiOn5657EeOG0hm
 JdLu2P3SGPKGgwMjw>
X-ME-Received: <xmr:e0mGZ7JNBAq8lmtumSQxxwoLcIJSDOxqZVKadW88vPo2HecoFMITXTdK4yA8fkloFQd01rgdAJW0nsT1n7GFGjb3Bw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgvdejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
 rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
 htshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeen
 ucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrg
 hlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpeejudevheeiveduuddtveffgfdtgeek
 ueevjeffjeegtdeggeekgfdvuefgfeekjeenucevlhhushhtvghrufhiiigvpedtnecurf
 grrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtpdhn
 sggprhgtphhtthhopeekpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehsthgvph
 hhvghnsehnvghtfihorhhkphhluhhmsggvrhdrohhrghdprhgtphhtthhopehhrghijhhi
 vgdusehhuhgrfigvihdrtghomhdprhgtphhtthhopeguvghvseguphgukhdrohhrghdprh
 gtphhtthhopehfvghrrhhuhhdrhihighhithesrghmugdrtghomhdprhgtphhtthhopegr
 mhgrnhdruggvvghprdhsihhnghhhsehinhhtvghlrdgtohhmpdhrtghpthhtoheplhhihh
 huihhsohhngheshhhurgifvghirdgtohhmpdhrtghpthhtohepfhgvnhhgtggvnhhgfigv
 nheshhhurgifvghirdgtohhmpdhrtghpthhtohephhhurghnghguvghnghguuhhisehhuh
 grfigvihdrtghomh
X-ME-Proxy: <xmx:e0mGZ_FsnmINRXr4qXgpkHdkfIZU-WrR4HU8eNHM8ELBkCOJbxelUA>
 <xmx:e0mGZ_WsxPv-bUAsMdfY6hjIyUBwCrc3LzPNEF2XkI4H5BIF_CsU7A>
 <xmx:e0mGZ6Ne5E5parmogHflttkPD7tKKTwbHI47UvqzzkPuWOCLu-336w>
 <xmx:e0mGZ-1OJM-5scJ5NWdAi7f73QPuPICTr2_ZDH5fT_ZsEncXCPFBGw>
 <xmx:fEmGZ7oGCsCBS8XIqGzWcqP0ffH_igTBSXTRvQE4DqYRQsrueneJI91_>
Feedback-ID: i47234305:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 14 Jan 2025 06:24:41 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>,
 Jie Hai <haijie1@huawei.com>
Cc: dev@dpdk.org, ferruh.yigit@amd.com,
 Aman Singh <aman.deep.singh@intel.com>, lihuisong@huawei.com,
 fengcengwen@huawei.com, huangdengdui@huawei.com
Subject: Re: [PATCH] app/testpmd: add ipv6 extension header parse
Date: Tue, 14 Jan 2025 12:24:40 +0100
Message-ID: <2000275.yKVeVyVuyW@thomas>
In-Reply-To: <227b1333-a027-5e08-ef87-40a87e9c291f@huawei.com>
References: <20250108024632.12152-1-haijie1@huawei.com>
 <20250108090200.763c1c75@pi5>
 <227b1333-a027-5e08-ef87-40a87e9c291f@huawei.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

14/01/2025 03:05, Jie Hai:
> Hi, Stephen Hemminger,
> 
> On 2025/1/9 1:02, Stephen Hemminger wrote:
> > On Wed, 8 Jan 2025 10:46:32 +0800
> > Jie Hai <haijie1@huawei.com> wrote:
> > 
> >> From: Jie Hai <haijie1@huawei.com>
> >> To: <dev@dpdk.org>, <thomas@monjalon.net>, <ferruh.yigit@amd.com>, Aman Singh  <aman.deep.singh@intel.com>
> >> CC: <lihuisong@huawei.com>, <fengcengwen@huawei.com>, <haijie1@huawei.com>,  <huangdengdui@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 <haijie1@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.
> > .
> Thanks for your review.
> 
> rte_net_skip_ip6_ext uses mbuf as a parameter, but its upper-layer
> function does not pass this parameter, and it is difficult to deduce the
> mbuf address. It would also be strange to pass only the mbuf address and
> not use it.
> 
> My idea is to replace the packet identification in csum fwd with
> 'rte_net_get_ptype()'. In this case, 'rte_net_get_ptype' needs to be 
> updated to adapt to the packet types supported by csum fwd. This may
> affect the ptype of packets identified by the current software.
> I'm not sure how big the impact is, which is why I didn't use it.
> 
> Maybe I can send it out later for review.

The only thing I'm sure is that testpmd is a test application,
so it should reuse the functions from the libs.
It should not reinvent new functions for network parsing.

If you need to add a new function to the library, please do it.
You can probably move the content of rte_net_skip_ip6_ext()
in a new function in the file lib/net/rte_ip6.h.
Something similar to rte_ipv6_get_next_ext().