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 93E4DA04FD; Thu, 10 Nov 2022 12:26:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 310C140150; Thu, 10 Nov 2022 12:26:06 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 64E8F400EF for ; Thu, 10 Nov 2022 12:26:04 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id A58F174; Thu, 10 Nov 2022 14:26:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru A58F174 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1668079563; bh=yflp2EXy9JRvhxVUxwQF2i2zgrh+XOKy3cHLj+UKRa8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=VqH9LVvmWxq31+046FpgoKsaTIlm9omwe65U11PeQJYgTY5GgY5JDPvKoqjcHVBJw Z8KNhiebG2S0bnwZhsPRy1UydRMdOwpm+3ZgdcZAAo29IK35Y6a8IXx3LRjRz7+SAM m7bmptKIlCq2l3K+OUZrB2QWm50LEVxQoOv/Bs4c= Message-ID: <123027d7-fa4b-9000-fbcd-ba530e2e1b9a@oktetlabs.ru> Date: Thu, 10 Nov 2022 14:26:03 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: Is it correct to report checksum good when there is no checksum? Content-Language: en-US To: Bruce Richardson , =?UTF-8?Q?Morten_Br=c3=b8rup?= Cc: dev@dpdk.org, Olivier Matz , Konstantin Ananyev , Stephen Hemminger , Jerin Jacob Kollanukkaran , Ferruh Yigit , Thomas Monjalon , David Marchand References: <8bea1ef1-1977-f24f-f549-0c2126c23e3c@oktetlabs.ru> <98CBD80474FA8B44BF855DF32C47DC35D874AA@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35D874AC@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35D874AD@smartserver.smartshare.dk> From: Andrew Rybchenko Organization: OKTET Labs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 11/10/22 14:11, Bruce Richardson wrote: > On Thu, Nov 10, 2022 at 12:02:48PM +0100, Morten Brørup wrote: >>> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru] >>> Sent: Thursday, 10 November 2022 11.34 >>> >>> On 11/10/22 13:29, Morten Brørup wrote: >>>>> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru] >>>>> Sent: Thursday, 10 November 2022 11.09 >>>>> >>>>> On 11/10/22 12:55, Morten Brørup wrote: >>>>>>> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru] >>>>>>> Sent: Thursday, 10 November 2022 10.26 >>>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> some drivers report RTE_MBUF_F_RX_IP_CKSUM_GOOD for IPv6 packets. >>>>>>> For me it looks strange, but I see some technical reasons behind. >>>>>> >>>>>> Please note: IPv6 packets by definition have no IP checksum. >>>>>> >>>>>>> Documentation in lib/mbuf/rte_mbuf_core.h is a bit vague. >>>>>>> Should UNKNOWN or NONE be used instead? >>>>>> >>>>>> Certainly not NONE. Its description says: "the IP checksum is *not* >>>>> correct in the packet [...]". But there is no incorrect IP checksum >>> in >>>>> the packet. >>>>>> >>>>> >>>>> Thanks, I should read the definition of none more careful. >>>>> >>>>>> I will argue against UNKNOWN. Its description says: "no information >>>>> about the RX IP checksum". But we do have information about it! We >>> know >>>>> that the IP checksum is not there (the value is "NULL"), and that it >>> is >>>>> not supposed to be there (the value is supposed to be "NULL"). >>>>>> >>>>> >>>>> I thought that "no checksum" => "no information" => UNKNOWN >>>> >>>> That was my initial interpretation too, and it stuck with me for a >>> while. >>>> >>>> But then I tried hard to read it differently, tweaking it to support >>> the conclusion I was looking for. >>>> >>>>> >>>>>> So I consider GOOD the correct response here. >>>>>> >>>>>> GOOD also means that the application can proceed processing the >>>>> packet normally without further IP header checksum checking, so it's >>>>> good for performance. >>>>>> >>>>> >>>>> It is very important point and would be nice to have in GOOD >>>>> case definition (both IP and L4 cases). It is the right >>>>> motivation why GOOD makes sense for IPv6. >>>>> >>>>>> It should be added to the description of >>> RTE_MBUF_F_RX_IP_CKSUM_GOOD >>>>> that IPv6 packets always return this value, because IPv6 packets >>> have >>>>> no IP header checksum, and that is what is expected of them. >>>>>> >>>>> >>>>> Could you make a patch? >>>> >>>> Too busy right now, but I'll put it on my todo list. :-) >>>> >>>>> >>>>> Bonus question is UDP checksum 0 case. GOOD as well? >>>>> (just want to clarify the documentation while we're on it). >>>> >>>> No. The UDP checksum is not optional in IPv6. >>>> >>>> RFC 2460 section 8.1 bullet 4 says: "Unlike IPv4, when UDP packets >>> are originated by an IPv6 node, the UDP checksum is not optional. [...] >>> IPv6 receivers must discard UDP packets containing a zero checksum, and >>> should log the error." >>>> >>> >>> Yes I know, but I'm asking about IPv4 case with UDP checksum 0. >> >> It cannot be UNKNOWN, because we do have information: The checksum was intentionally omitted. >> >> I would prefer GOOD, using the same logic as for the IPv6 header checksum. >> >> Trying very hard to tweak the meaning of NONE's description ("the L4 checksum is not correct in the packet data, but the integrity of the L4 data is verified."), we could argue that "not correct" != "intentionally omitted" (and an intentional omission is absolutely correct), and conclude that it cannot be NONE. A seasoned politician would say this without blinking, but it is up to individual interpretation. >> >> We should settle on either GOOD or NONE, and write it in the documentation. >> >> In a perfect world, the PMD DPDK compliance tests should also check things like this. >> > > I would think that for cases where the checksum is intentionally omitted we > either add a new flag for "not applicable" or else just go with "good" as > you suggest. I think for simplicity to go with the latter. > > Can we redefine "GOOD" to just mean "does not need to be checked by > software", rather than trying to define it in terms of what was done by > hardware? Yes, it is very good idea since we are providing the information to application and make it clear what the application should do.