From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B326C5A17 for ; Tue, 31 May 2016 04:43:32 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 30 May 2016 19:43:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,393,1459839600"; d="scan'208,217";a="711333723" Received: from shwdeisgchi083.ccr.corp.intel.com (HELO [10.239.67.193]) ([10.239.67.193]) by FMSMGA003.fm.intel.com with ESMTP; 30 May 2016 19:43:30 -0700 To: Olivier Matz , "dev@dpdk.org" References: <574C5B9D.4080006@6wind.com> Cc: "Ananyev, Konstantin" , Yuanhan Liu , "Richardson, Bruce" , Adrien Mazarguil From: "Tan, Jianfeng" Message-ID: Date: Tue, 31 May 2016 10:43:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <574C5B9D.4080006@6wind.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] about rx checksum flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2016 02:43:33 -0000 Hi Oliver, On 5/30/2016 11:26 PM, Olivier Matz wrote: > Hi, > > I'm planning to add the support for offloads in virtio-net pmd. > It appears that the current rx flags in mbuf are not sufficient to > describe the state of a packet received from a virtual driver. > I think we need a way to say "the checksum in the packet data is > not calculated, but the integrity of the data is verified". I also met this problem :-). Glad to see you raise it up in the mail list. > > Currently, we have one flag for L4 (same for IP): > > PKT_RX_L4_CKSUM_BAD: L4 cksum of RX pkt. is not OK. > > This has also another problem that has already been discussed [1]: > if no flag is set, it is expected that the checksum is verified by > hw, but there is no way to say "the hw does not know if the cksum > is correct". > > I would like to extend this flag to a 4-state value (2 bits): > > PKT_RX_L4_CKSUM_UNKNOWN: no information about the RX L4 checksum > -> the application should verify the checksum by sw > > PKT_RX_L4_CKSUM_BAD: the L4 checksum in the packet is wrong > -> the application can drop the packet without additional check > > PKT_RX_L4_CKSUM_GOOD: the L4 checksum in the packet is valid > -> the application can accept the packet without verifying the > checksum by sw > > PKT_RX_L4_CKSUM_NONE: the L4 checksum is not correct in the packet > data, but the integrity of the L4 header is verified. > -> the application can process the packet but must not verify the > checksum by sw. It has to take care to recalculate the cksum > if the packet is transmitted (either by sw or using tx offload) > > To keep the compatibility with application, the old flag is kept at the > same value, and a new flag is added. It is assumed that the behavior > of applications was: > > PKT_RX_L4_CKSUM_BAD = 0 -> packet is accepted > PKT_RX_L4_CKSUM_BAD = 1 -> packet is dropped > > The new checksum states for L4 (same for IP) would be: > > old flag new flag meaning > 0 0 PKT_RX_L4_CKSUM_UNKNOWN > 1 0 PKT_RX_L4_CKSUM_BAD > 0 1 PKT_RX_L4_CKSUM_GOOD > 1 1 PKT_RX_L4_CKSUM_NONE > > With this, an old application that only checks the old flag, and > running using a dpdk having this modification would accept GOOD and > UNKNOWN packets (like today), drop BAD packets (like today) and > drop NONE packets (this is a new feature that has to be explicitly > enabled by the application). > > > Any comment? Why not take care of PKT_RX_IP_CKSUM_BAD? Is it too easy for sw to handle? For virtio, there's only one bit, VIRTIO_NET_HDR_F_DATA_VALID, to indicate that checksum is valid. Shall we differentiate L3 checksum and L4 checksum in rte_mbuf.ol_flags? Thanks, Jianfeng > > Olivier > > > [1] http://dpdk.org/ml/archives/dev/2015-January/011550.html