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 E80AFA0C41 for ; Tue, 8 Jun 2021 14:49:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9EBC410EF; Tue, 8 Jun 2021 14:49:29 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id C925840689 for ; Tue, 8 Jun 2021 14:49:27 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id 3-20020a05600c0243b029019f2f9b2b8aso1781737wmj.2 for ; Tue, 08 Jun 2021 05:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Pi4HK7VdKdEnf7jzXwO4vTnbfEzvrahFu0bwA/YfvaM=; b=V/1gemMZVae4NkgH1ScHKvdVsibvAMThb8zdKwVt8sbPEZklZr8iejnxjHxzuFiKPi Ezq+1C1It8LKXGg3Wj1ErYHWcORfk0h7+H8OwLBVVw1wqNJdIXMperi6UEpxNcBq2X0S c+XCzAV1Dt1q/MJXmIiNo1X6mvFHJ3quoSHf5OFUFi8lofPkrTYsw0TA3vp2OLZmcL9O yHkMtnlckmnvGhkTiiV9wU0sFhEW6loywOqSpnX6jI+gaJeqgfO2giEYPqESsII/MQxm RNAyJLs4EFvozc75BLCk46Zj1BXLBAsxdq8hOy6AGEgDeLEgx1/sEzAWiZ5qgSOtPQGi MHAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Pi4HK7VdKdEnf7jzXwO4vTnbfEzvrahFu0bwA/YfvaM=; b=iHYqGYglQL4exUEpdIT/psdWwLBT2rnGftrDgUlp7yAYq+j7JJvcFuSFKwLhMoOuG5 JpDzvE0s6fUB1dyajnP649SYNks/rfKsdXz1GYFwJbssdOXSpTbtP7eeP6cjebENbXZV uqlGRyDuylilY69w1tEUXZqZqq/v478FXSw3UikdmeKuto7sTa7T5M2jjxIXtG7cGezY QZtD88bFSS7Je2XcwJdVwRlxpHW5QnipJrvHXZLQrPmV8cY6VRaGI0ZJBTGUZARBoyzG lPb6TW4pzjitGQ5d73qrC17MbT0kEg8Of6KisLqWDuEohQXje1I87gl6D8LYwjD86mTd hhHg== X-Gm-Message-State: AOAM5322ZtkWU00An0+irhF18VL2mVJkmmese41tb3e+hn2o7iJrRsuW AdPHSl8Fv4PRK9kFoJKk61sUUg== X-Google-Smtp-Source: ABdhPJw5omQJTFDuWnHKse82HpqjisenYjeV8i4qntcDINKKB+RE/m2YVteEd+qSkruDxK8Et+alwQ== X-Received: by 2002:a7b:cd06:: with SMTP id f6mr21984947wmj.125.1623156567478; Tue, 08 Jun 2021 05:49:27 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id e27sm20118446wra.50.2021.06.08.05.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 05:49:26 -0700 (PDT) Date: Tue, 8 Jun 2021 14:49:26 +0200 From: Olivier Matz To: Andrew Rybchenko Cc: Ferruh Yigit , dev@dpdk.org, Keith Wiles , Hongzhi Guo , Morten =?iso-8859-1?Q?Br=F8rup?= , Thomas Monjalon , stable@dpdk.org Message-ID: References: <20210427135755.927-1-olivier.matz@6wind.com> <20210427135755.927-2-olivier.matz@6wind.com> <5fa9bc52-0862-983e-3e38-33a937872571@intel.com> <39a8a8bb-d246-3377-607c-3c2387b73fe0@oktetlabs.ru> <359f754b-6ee3-d3e4-5cfc-06f399db9617@oktetlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <359f754b-6ee3-d3e4-5cfc-06f399db9617@oktetlabs.ru> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 1/4] net/tap: fix Rx cksum flags on IP options packets X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Jun 08, 2021 at 03:34:36PM +0300, Andrew Rybchenko wrote: > On 6/8/21 3:29 PM, Olivier Matz wrote: > > Hi Ferruh, Andrew, > > > > On Tue, Jun 08, 2021 at 01:13:59PM +0300, Andrew Rybchenko wrote: > >> On 4/30/21 5:48 PM, Ferruh Yigit wrote: > >>> On 4/27/2021 2:57 PM, Olivier Matz wrote: > >>>> When packet type is IPV4_EXT, the checksum is always marked as good in > >>>> the mbuf offload flags. > >>>> > >>>> Since we know the header lengths, we can easily call > >>>> rte_ipv4_udptcp_cksum() in this case too. > >>>> > >>>> Fixes: 8ae3023387e9 ("net/tap: add Rx/Tx checksum offload support") > >>>> Cc: stable@dpdk.org > >>>> > >>>> Signed-off-by: Olivier Matz > >>>> --- > >>>> drivers/net/tap/rte_eth_tap.c | 4 ++-- > >>>> 1 file changed, 2 insertions(+), 2 deletions(-) > >>>> > >>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > >>>> index 68baa18523..e7b185a4b5 100644 > >>>> --- a/drivers/net/tap/rte_eth_tap.c > >>>> +++ b/drivers/net/tap/rte_eth_tap.c > >>>> @@ -350,7 +350,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) > >>>> /* Don't verify checksum for multi-segment packets. */ > >>>> if (mbuf->nb_segs > 1) > >>>> return; > >>>> - if (l3 == RTE_PTYPE_L3_IPV4) { > >>>> + if (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) { > >>> > >>> Should we take 'RTE_PTYPE_L3_IPV4_EXT_UNKNOWN' into account? > >> > >> I think we should. > > > > I think 'RTE_PTYPE_L3_IPV4_EXT_UNKNOWN' cannot happen here: > > > > - mbuf->packet_type is generated by > > (), which cannot > > return 'RTE_PTYPE_L3_IPV4_EXT_UNKNOWN' > > My question if it is guaranteed and the only possible branch. > Can application set packet_type itself and do not call > rte_net_get_ptype(). Yes, typically application knows > if it has IPv4 options in the header or not, but theoretically > could be unaware as well. This function is called on the Rx path from pmd_rx_burst(), so the application does not have access to the mbuf. The software parser that sets the packet type returns either RTE_PTYPE_L3_IPV4 if there is no option, or RTE_PTYPE_L3_IPV4_EXT else. The value RTE_PTYPE_L3_IPV4_EXT_UNKNOWN is used by PMDs that don't know if there are options. > > - right above this code, we already returned if l3 is not in > > (RTE_PTYPE_L3_IPV4, RTE_PTYPE_L3_IPV4_EXT, RTE_PTYPE_L3_IPV6) > > If so, it sounds like it should be allowed above as well. > > > > >>> > >>>> if (l4 == RTE_PTYPE_L4_UDP) { > >>>> udp_hdr = (struct rte_udp_hdr *)l4_hdr; > >>>> if (udp_hdr->dgram_cksum == 0) { > >>>> @@ -364,7 +364,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) > >>>> } > >>>> } > >>>> cksum = ~rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr); > >>>> - } else if (l3 == RTE_PTYPE_L3_IPV6) { > >>>> + } else { /* l3 == RTE_PTYPE_L3_IPV6, checked above */ > >>>> cksum = ~rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr); > >>>> } > >>>> mbuf->ol_flags |= cksum ? > >>>> > >> >