From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id E5EC51B53C for ; Wed, 20 Jun 2018 23:17:17 +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-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id AD260780078; Wed, 20 Jun 2018 21:17:14 +0000 (UTC) Received: from [192.168.1.192] (188.242.181.57) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Wed, 20 Jun 2018 22:16:55 +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 , 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> <9390200c-b113-5f22-99d4-21c42b5f56f3@solarflare.com> <271de83c-fc43-8136-a565-106c400ebb11@intel.com> <5e17f673-e9e1-4b13-5b8d-9eccc575944f@solarflare.com> From: Andrew Rybchenko Message-ID: <736e85cd-46d7-349b-7950-5922f1f980cb@solarflare.com> Date: Thu, 21 Jun 2018 00:16:42 +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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [188.242.181.57] 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--8.035300-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1529529437-rv5kTMawZinf 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 21:17:18 -0000 On 20.06.2018 21:12, Ferruh Yigit wrote: > On 6/20/2018 6:39 PM, Andrew Rybchenko wrote: >> On 06/20/2018 08:24 PM, Ferruh Yigit wrote: >>> On 6/20/2018 8:42 AM, Andrew Rybchenko wrote: >>>> 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? >>> This is an internal function, not API, so I think doesn't require to be >>> experimental. >> Just to make my thoughts clear: description does not say that it is an internal. >> So, nothing prevents external entities to use it. Changes will be API breakage. > rte_ethdev_driver.h is not public header, it is just for PMDs. I see. So, it will not be a problem to remove it. OK. >>>>  - 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). >>> No other offloads don't have similar functions, this is kind special. >>> >>> There will be more changes related CRC next release, CRC_STRIP will be removed >>> and no flag will mean strip CRC. So the conditions to is_keep_crc will be changed. >>> This function is to manage this change easier, localize the information in to >>> single function to make it easy to update later. >> It is perfectly clear why it is required right now and introduced (as I said >> from the very beginning). >> Yes, it is will be the history which explains why it is so, but if we make >> a step forward and discard the history it will look asymmetric - >> it will be a function which checks single bit. It is really minor and >> 100% up to you. > I see, right it will be just a wrapper to bit check. In this patch it helps to > revert to logic, from strip_crc to keep_crc. In next release I am OK to remove > function and return back to bit check in PMDs, will this be more reasonable? Just for consistency I'd say yes.