From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E7DB1A00E6 for ; Mon, 8 Jul 2019 19:24:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BE5D324D; Mon, 8 Jul 2019 19:24:24 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id 6DA3F31FC for ; Mon, 8 Jul 2019 19:24:22 +0200 (CEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x68HN1Ho129143 for ; Mon, 8 Jul 2019 13:24:21 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tm7ynnb2r-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 08 Jul 2019 13:24:21 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Jul 2019 18:24:20 +0100 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 8 Jul 2019 18:24:17 +0100 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x68HOGTJ12321356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jul 2019 17:24:16 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38D57124054; Mon, 8 Jul 2019 17:24:16 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36328124052; Mon, 8 Jul 2019 17:24:15 +0000 (GMT) Received: from davids-mbp.usor.ibm.com (unknown [9.70.85.114]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 8 Jul 2019 17:24:15 +0000 (GMT) To: Thomas Monjalon , dev@dpdk.org Cc: Bruce Richardson , david.marchand@redhat.com, Jerin Jacob , Gavin Hu References: <20190529154132.49955-1-bruce.richardson@intel.com> <2785804.vqP48ztxbI@xps> <20190701204137.GB393@bricha3-MOBL.ger.corp.intel.com> <62492340.4kEa2brbSF@xps> From: David Christensen Date: Mon, 8 Jul 2019 10:24:14 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <62492340.4kEa2brbSF@xps> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19070817-2213-0000-0000-000003AB20B6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011397; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01229297; UDB=6.00647404; IPR=6.01010557; MB=3.00027635; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-08 17:24:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19070817-2214-0000-0000-00005F272625 Message-Id: <6bc0b95e-89f3-8fef-5c32-ccf634c8b31c@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-08_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=645 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907080214 Subject: Re: [dpdk-dev] [PATCH 4/4] net: replace ifdefs with runtime branches 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > 01/07/2019 22:41, Bruce Richardson: >> On Mon, Jul 01, 2019 at 09:30:02PM +0200, Thomas Monjalon wrote: >>> 29/05/2019 17:41, Bruce Richardson: >>>> Use the flag checking functions and a couple of empty stubs to remove the >>>> ifdefs from the middle of the C code, and replace them with more readable >>>> regular if statements. Other ifdefs at the top of the file are kept, but >>>> are not mixed with C code, so there is a clean separation. >>>> >>>> Signed-off-by: Bruce Richardson >>>> --- >>>> lib/librte_net/rte_net_crc.c | 38 ++++++++++++++++++++++++------------ >>>> 1 file changed, 25 insertions(+), 13 deletions(-) >>> >>> The result is more lines of code :) >>> >>>> --- a/lib/librte_net/rte_net_crc.c >>>> +++ b/lib/librte_net/rte_net_crc.c >>>> @@ -18,8 +18,17 @@ >>>> >>>> #ifdef X86_64_SSE42_PCLMULQDQ >>>> #include >>>> -#elif defined ARM64_NEON_PMULL >>>> +#else >>>> +/* define stubs for the SSE functions to avoid compiler errors */ >>>> +#define handlers_sse42 handlers_scalar >>>> +#define rte_net_crc_sse42_init() do { } while(0) >>>> +#endif >>>> + >>>> +#ifdef ARM64_NEON_PMULL >>>> #include >>>> +#else >>>> +#define handlers_neon handlers_scalar >>>> +#define rte_net_crc_neon_init() do { } while(0) >>>> #endif >>> >>> Looking at the need for stubs, I don't see the benefit. >>> >> Yes, one needs stubs, but those are placed in a single place, and the main >> C-code itself is free of ifdefs running through it. I'd view this as a good >> thing in limiting the scope of any ifdef-ery, since it annoys me looking at >> #ifdefs in the middle of functions (since it messes up the indentation flow >> of the code if nothing else!). >> >> If you don't see this as a big benefit, then there is not a lot else to >> commend this set for you, sadly. It just seemed a nice improvement to me - >> irrespective of net lines of code. > > Any other opinion? I support adding a few lines of code in the slow path to provide cleaner separation of architecture specific code, though the existing IFDEF code doesn't appear very intrusive in this case. My preference would be architecture specific header files and strong/weak linking to pull in the appropriate code. Dave