From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73CC1C0650E for ; Mon, 1 Jul 2019 19:30:12 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 0CC45206A3 for ; Mon, 1 Jul 2019 19:30:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=monjalon.net header.i=@monjalon.net header.b="IJJ5gW+k"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ggBT4RPr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CC45206A3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=monjalon.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 260821B9CC; Mon, 1 Jul 2019 21:30:11 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by dpdk.org (Postfix) with ESMTP id B39801B9C1 for ; Mon, 1 Jul 2019 21:30:09 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 543C04A3; Mon, 1 Jul 2019 15:30:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 01 Jul 2019 15:30:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=bbiqAzcR3hkC9XusNEt85pXFYtVB8lIFoV3O+Pw0tZY=; b=IJJ5gW+kgO0Q NL4vPD8PO3xCUdz8NI+8YwFmX17SKmOfmjTVJCuUe0qXK4+xD9b2mtcuG23yXmWn ApuLJO9Q0UttpWiM9VplJAVnE6X2dtl6mzcC+Hj+CvW6b4iUriI5k3DQUSE8qSRc 2zgR0HagGxsBm2PcXwJPHpC8ehIl00k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=bbiqAzcR3hkC9XusNEt85pXFYtVB8lIFoV3O+Pw0t ZY=; b=ggBT4RPrvHtvsdNJ9T6W8Jfih0FiBQANgYULaFMP3KwnyYeZ/yssS76wE LNF/H2bT2s/HJh2rWbTCDXdMMivMDlLTyHbN58ag396EdyF0lI89wphqDfAgxVMV QsRHwH9ofJ3rYUftChafcu8zqk4SDZLXN/Y//ZmuytMsE8CsYNgiNuN8dn8U/d/z IzZABl2rt7akO0MOVTXUJkBFVJp5AjHv7fa9OPo3PM3DYqoQgGGhavec72lzBkT/ eDpGUfPpbSJq2gQU30u+N9RTmWbpxeeJdbU2SzXn4ruK7jPnGvBPLqzds7sk43IS sZcy8sCr959UiiU0Rfunr5pxl1+Hg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrvdeigddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 5476F80066; Mon, 1 Jul 2019 15:30:06 -0400 (EDT) From: Thomas Monjalon To: Bruce Richardson Cc: dev@dpdk.org Date: Mon, 01 Jul 2019 21:30:02 +0200 Message-ID: <2785804.vqP48ztxbI@xps> In-Reply-To: <20190529154132.49955-5-bruce.richardson@intel.com> References: <20190529154132.49955-1-bruce.richardson@intel.com> <20190529154132.49955-5-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 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. > rte_net_crc_set_alg(enum rte_net_crc_alg alg) > { > switch (alg) { > -#ifdef X86_64_SSE42_PCLMULQDQ > case RTE_NET_CRC_SSE42: > - handlers = handlers_sse42; > - break; > -#elif defined ARM64_NEON_PMULL > + if (rte_cpu_get_flagname_enabled(rte_cpu_arch_x86, > + "RTE_CPUFLAG_SSE4_2")) { Why the CPU flags strings are prefixed with RTE_CPUFLAG_?