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 0BF68A0487 for ; Mon, 1 Jul 2019 21:30:12 +0200 (CEST) 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_?