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 7AD57A04FD; Thu, 10 Nov 2022 12:23:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2BC4F40150; Thu, 10 Nov 2022 12:23:29 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 88A7C400EF for ; Thu, 10 Nov 2022 12:23:27 +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) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id DBD6474; Thu, 10 Nov 2022 14:23:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru DBD6474 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1668079406; bh=u48SZv8jEyRlPlih0WC10HuNDH4ErusSddWtrekd/2I=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=AJGpAH0OpXc2JoxIJTObHkcEt9T3nqdJtITaLktfsxqgnt7fmydAMAcsksa66t8Kx WR0163xIR3rQ3dSw3rIcngjBMZkcyWXpg/VaMucwtKwCDrmY8n9HF5tfKngJF7BU0h 1MAHfXuwdmVHfvs4bQHh6SQJNwZmhSlGiEdyZt1A= Message-ID: <8261089b-26bc-4990-c8b1-dabaaa136044@oktetlabs.ru> Date: Thu, 10 Nov 2022 14:23:26 +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: =?UTF-8?Q?Morten_Br=c3=b8rup?= , dev@dpdk.org Cc: 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: <98CBD80474FA8B44BF855DF32C47DC35D874AD@smartserver.smartshare.dk> 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:02, 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 think that UNKNOWN definition should be updated to say that it means that checksum is present and could be verified, but NIC has not done it and application should do it itself. > I would prefer GOOD, using the same logic as for the IPv6 header checksum. > Yes, since it correct checksum from UDP over IPv4 protocol definition. Application simply has no information to verify checksum, so it cannot be UNKNOWN. Since application gets entry packet in DPDK case, in GOOD case it could check if checksum is 0 or not itself and do extra checks in 0 case if it is possible (higher layer checksums etc) and required. > 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. > NONE requires "but the integrity of the L4 data is verified". Who said that NIC has verified L4 data integrity? > In a perfect world, the PMD DPDK compliance tests should also check things like this. > JFYI The initial IPv6 question comes from my attempt to classify [1]. Now I understand that the test should be fixed to expect GOOD in IPv6 case, not UNKNOWN. [1] https://ts-factory.io/bublik/v2/log/163204?focusId=164090&mode=treeAndinfoAndlog