From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id E57EE1B476 for ; Wed, 20 Jun 2018 09:43:18 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 4DD39BC005E; Wed, 20 Jun 2018 07:43:15 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Wed, 20 Jun 2018 08:42:54 +0100 To: Ferruh Yigit , Neil Horman , John McNamara , "Marko Kovacevic" , "John W. Linville" , Allain Legacy , "Matt Peters" , Ravi Kumar , "Ajit Khaparde" , Somnath Kotur , Rahul Lakkireddy , Wenzhuo Lu , Qi Zhang , Xiao Wang , Beilei Xing , Konstantin Ananyev , Adrien Mazarguil , Nelio Laranjeiro , Yongseok Koh , "Tomasz Duszynski" , Dmitri Epshtein , "Natalie Samsonov" , Jianbo Liu , "Alejandro Lucero" , Tetsuya Mukawa , Santosh Shukla , Jerin Jacob , Rasesh Mody , Harish Patil , "Shahed Shaikh" , Bruce Richardson , Andrew Rybchenko , Jasvinder Singh , Cristian Dumitrescu , Matej Vido , Maciej Czekaj , Maxime Coquelin , Tiwei Bie , Zhihong Wang , Yong Wang , Thomas Monjalon CC: References: <20180608225709.19473-1-ferruh.yigit@intel.com> <20180619180230.72585-1-ferruh.yigit@intel.com> From: Andrew Rybchenko Message-ID: <9390200c-b113-5f22-99d4-21c42b5f56f3@solarflare.com> Date: Wed, 20 Jun 2018 10:42:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180619180230.72585-1-ferruh.yigit@intel.com> Content-Language: en-GB X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23918.003 X-TM-AS-Result: No--7.601700-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1529480598-zJN52uvdgnrE Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] ethdev: add new offload flag to keep CRC X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2018 07:43:19 -0000 On 06/19/2018 09:02 PM, Ferruh Yigit wrote: > DEV_RX_OFFLOAD_KEEP_CRC offload flag added. PMDs that supports keeping > CRC should advertise this offload capability. > > DEV_RX_OFFLOAD_CRC_STRIP flag will remain one more release > default behavior in PMDs are to keep the CRC until this flag removed > > Until DEV_RX_OFFLOAD_CRC_STRIP flag is removed: > - Setting both KEEP_CRC & CRC_STRIP is INVALID > - Setting only CRC_STRIP PMD should strip the CRC > - Setting only KEEP_CRC PMD should keep the CRC > - Not setting both PMD should keep the CRC > > A helper function rte_eth_dev_is_keep_crc() has been added to be able to > change the no flag behavior with minimal changes in PMDs. > > The PMDs that doesn't report the DEV_RX_OFFLOAD_KEEP_CRC offload can > remove rte_eth_dev_is_keep_crc() checks next release, related code > commented to help the maintenance task. > > And DEV_RX_OFFLOAD_CRC_STRIP has been added to virtual drivers since > they don't use CRC at all, when an application requires this offload > virtual PMDs should not return error. > > Signed-off-by: Ferruh Yigit > --- <...> > diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h > index c9c825e3f..09a42f8c2 100644 > --- a/lib/librte_ethdev/rte_ethdev_driver.h > +++ b/lib/librte_ethdev/rte_ethdev_driver.h > @@ -325,6 +325,26 @@ typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev); > int __rte_experimental > rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit); > > +/** > + * PMD helper function to check if keeping CRC is requested > + * > + * @param rx_offloads > + * offloads variable > + * > + * @return > + * Return positive if keeping CRC is requested, > + * zero if stripping CRC is requested > + */ > +static inline int > +rte_eth_dev_is_keep_crc(uint64_t rx_offloads) > +{ > + if (rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP) > + return 0; > + > + /* no KEEP_CRC or CRC_STRIP offload flags means keep CRC */ > + return 1; > +} > + > #ifdef __cplusplus > } > #endif A couple of control questions about the function:  - shouldn't __rte_experimental be used?  - if the function remains in the future, it will be a bit asymmetric vs other    offload flags. Right now it is clear why the function is introduced, but    it is the question if the function should remain or go away in the future    (as far as I know no other offload flag has similar function to check). above things are really minor, ethdev and net/sfc Acked-by: Andrew Rybchenko