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 28BE9B367 for ; Wed, 30 Jul 2014 16:48:23 +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 1XCVCk-0006oD-47; Wed, 30 Jul 2014 10:50:16 -0400 From: Neil Horman To: dev@dpdk.org Date: Wed, 30 Jul 2014 10:49:29 -0400 Message-Id: <1406731769-18523-3-git-send-email-nhorman@tuxdriver.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1406731769-18523-1-git-send-email-nhorman@tuxdriver.com> References: <1406665466-29654-1-git-send-email-nhorman@tuxdriver.com> <1406731769-18523-1-git-send-email-nhorman@tuxdriver.com> X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: [dpdk-dev] [PATCH v2 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: Wed, 30 Jul 2014 14:48:23 -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 | 6 ++++++ 2 files changed, 7 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..37a590b 100644 --- a/lib/librte_acl/rte_acl.c +++ b/lib/librte_acl/rte_acl.c @@ -112,6 +112,12 @@ 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)]; + + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2)) { + RTE_LOG(ERR, ACL, "librte_acl requires sse4.2 instructions!\n"); + 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