From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id D641CB36B for ; Tue, 29 Jul 2014 22:22:58 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XCDwx-00005B-9r; Tue, 29 Jul 2014 16:24:49 -0400 From: Neil Horman To: dev@dpdk.org Date: Tue, 29 Jul 2014 16:24:26 -0400 Message-Id: <1406665466-29654-3-git-send-email-nhorman@tuxdriver.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1406665466-29654-1-git-send-email-nhorman@tuxdriver.com> References: <1406665466-29654-1-git-send-email-nhorman@tuxdriver.com> X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: [dpdk-dev] [PATCH 2/2] acl: Preform dynamic sse4.2 support check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 20:22:59 -0000 The ACL library relies on sse4.2 intrinsics to operate, but we don't have to enable sse4.2 in the entire build. Instead enable it for the ACL library alone, and use rte_acl_create as a choke point, at which we can test for sse4.2 support, and return NULL. Signed-off-by: Neil Horman CC: Thomas Monjalon --- lib/librte_acl/Makefile | 2 +- lib/librte_acl/rte_acl.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile index 4fe4593..3646439 100644 --- a/lib/librte_acl/Makefile +++ b/lib/librte_acl/Makefile @@ -35,7 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_acl.a CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) +CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -msse4.2 # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_ACL) += tb_mem.c diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c index 7c288bd..14ea7e0 100644 --- a/lib/librte_acl/rte_acl.c +++ b/lib/librte_acl/rte_acl.c @@ -112,6 +112,15 @@ rte_acl_create(const struct rte_acl_param *param) struct rte_acl_list *acl_list; struct rte_tailq_entry *te; char name[sizeof(ctx->name)]; + static int acl_supported = -1; + + if (acl_supported == -1) + acl_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2); + + if (!acl_supported) { + rte_errno = EOPNOTSUPP; + return NULL; + } /* check that we have an initialised tail queue */ acl_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_ACL, rte_acl_list); -- 1.8.3.1