From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 90526B399 for ; Thu, 11 Sep 2014 16:18:03 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 11 Sep 2014 07:17:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,506,1406617200"; d="scan'208";a="571778894" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 11 Sep 2014 07:23:08 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s8BEN7Rc013314; Thu, 11 Sep 2014 15:23:08 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s8BEN740004903; Thu, 11 Sep 2014 15:23:07 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s8BEN7dM004899; Thu, 11 Sep 2014 15:23:07 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Thu, 11 Sep 2014 15:23:06 +0100 Message-Id: <1410445387-4849-3-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1410445387-4849-1-git-send-email-bruce.richardson@intel.com> References: <1410445387-4849-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 2/3] eal: increase scope of eal_thread_set_affinity 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: Thu, 11 Sep 2014 14:18:04 -0000 This patch changes eal_thread_set_affinity to the EAL-local function rte_eal_thread_set_affinity. This will allow us to use the function anywhere else in the EAL, while not having it part of the official APIs Signed-off-by: Bruce Richardson --- lib/librte_eal/bsdapp/eal/eal_thread.c | 8 ++++---- lib/librte_eal/common/include/eal_private.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/eal_thread.c | 8 ++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c index 18df2a3..66191bb 100644 --- a/lib/librte_eal/bsdapp/eal/eal_thread.c +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c @@ -95,8 +95,8 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) } /* set affinity for current thread */ -static int -eal_thread_set_affinity(unsigned lcore_id) +int +rte_eal_thread_set_affinity(unsigned lcore_id) { int s; pthread_t thread; @@ -158,7 +158,7 @@ void eal_thread_init_master(unsigned lcore_id) RTE_PER_LCORE(_lcore_id) = lcore_id; /* set CPU affinity */ - if (eal_thread_set_affinity(lcore_id) < 0) + if (rte_eal_thread_set_affinity(lcore_id) < 0) rte_panic("cannot set affinity\n"); } @@ -192,7 +192,7 @@ eal_thread_loop(__attribute__((unused)) void *arg) RTE_PER_LCORE(_lcore_id) = lcore_id; /* set CPU affinity */ - if (eal_thread_set_affinity(lcore_id) < 0) + if (rte_eal_thread_set_affinity(lcore_id) < 0) rte_panic("cannot set affinity\n"); /* read on our pipe to get commands */ diff --git a/lib/librte_eal/common/include/eal_private.h b/lib/librte_eal/common/include/eal_private.h index b440ffb..0f01f81 100644 --- a/lib/librte_eal/common/include/eal_private.h +++ b/lib/librte_eal/common/include/eal_private.h @@ -196,4 +196,14 @@ int rte_eal_intr_init(void); */ int rte_eal_alarm_init(void); +/** + * Set the affinity of the current thread to a given core + * + * This function is private to EAL. + * + * @return + * 0 on success, negative on error + */ +int rte_eal_thread_set_affinity(unsigned lcore_id); + #endif /* _EAL_PRIVATE_H_ */ diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c index 9dc3f98..cf5e75c 100644 --- a/lib/librte_eal/linuxapp/eal/eal_thread.c +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c @@ -95,8 +95,8 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) } /* set affinity for current thread */ -static int -eal_thread_set_affinity(unsigned lcore_id) +int +rte_eal_thread_set_affinity(unsigned lcore_id) { int s; pthread_t thread; @@ -158,7 +158,7 @@ void eal_thread_init_master(unsigned lcore_id) RTE_PER_LCORE(_lcore_id) = lcore_id; /* set CPU affinity */ - if (eal_thread_set_affinity(lcore_id) < 0) + if (rte_eal_thread_set_affinity(lcore_id) < 0) rte_panic("cannot set affinity\n"); } @@ -192,7 +192,7 @@ eal_thread_loop(__attribute__((unused)) void *arg) RTE_PER_LCORE(_lcore_id) = lcore_id; /* set CPU affinity */ - if (eal_thread_set_affinity(lcore_id) < 0) + if (rte_eal_thread_set_affinity(lcore_id) < 0) rte_panic("cannot set affinity\n"); /* read on our pipe to get commands */ -- 1.9.3