From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BD52D46079; Tue, 14 Jan 2025 03:05:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84D7E402A0; Tue, 14 Jan 2025 03:05:21 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D87A04025A for ; Tue, 14 Jan 2025 03:05:19 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YXC7D0gkFz11Rk2; Tue, 14 Jan 2025 10:02:16 +0800 (CST) Received: from kwepemf500004.china.huawei.com (unknown [7.202.181.242]) by mail.maildlp.com (Postfix) with ESMTPS id 00B461802E1; Tue, 14 Jan 2025 10:05:17 +0800 (CST) Received: from [10.67.121.175] (10.67.121.175) by kwepemf500004.china.huawei.com (7.202.181.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Jan 2025 10:05:15 +0800 Message-ID: <227b1333-a027-5e08-ef87-40a87e9c291f@huawei.com> Date: Tue, 14 Jan 2025 10:05:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] app/testpmd: add ipv6 extension header parse To: Stephen Hemminger CC: , , , Aman Singh , , , References: <20250108024632.12152-1-haijie1@huawei.com> <20250108090200.763c1c75@pi5> From: Jie Hai In-Reply-To: <20250108090200.763c1c75@pi5> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.175] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemf500004.china.huawei.com (7.202.181.242) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, Stephen Hemminger, On 2025/1/9 1:02, Stephen Hemminger wrote: > On Wed, 8 Jan 2025 10:46:32 +0800 > Jie Hai wrote: > >> From: Jie Hai >> To: , , , Aman Singh >> CC: , , , >> 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 >> --- >> 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. Thanks, Jie Hai