patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>, dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'examples/performance-thread: fix build on FreeBSD' has been queued to LTS release 16.11.2
Date: Tue,  2 May 2017 17:32:28 +0800	[thread overview]
Message-ID: <1493717548-12434-27-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1493717548-12434-1-git-send-email-yuanhan.liu@linux.intel.com>

Hi,

FYI, your patch has been queued to LTS release 16.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 05/07/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From 963719060979ddcd067d7aabaf532577ea8199f1 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson@intel.com>
Date: Fri, 21 Apr 2017 14:50:23 +0100
Subject: [PATCH] examples/performance-thread: fix build on FreeBSD

[ backported from upstream commit 4cde45f36fb4e46139400a7a00c923656c99a3d8 ]

This set of sample apps did not compile on FreeBSD due to use of a number
of Linux/glibc-specific APIs, or APIs which existed in different headers
on FreeBSD. Specifically, the following APIs has problems:
  * sched_getcpu() is a glibc extension, so use rte_lcore_id() on BSD
  * pthread_yield() returns int on Linux, but void on FreeBSD, so
    we have to create two slightly different copies of the function.
  * the type for managing cpu sets is cpuset_t on FreeBSD rather than
    cpu_set_t as on Linux, so use rte_cpuset_t from rte_lcore.h.
  * APIs for managing cpu affinity are in pthread_np.h on FreeBSD, rather
    than in pthread.h, also fixed by including rte_lcore.h

Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim app")
Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/performance-thread/l3fwd-thread/main.c    |  4 ++++
 examples/performance-thread/pthread_shim/main.c    |  8 ++++++--
 .../performance-thread/pthread_shim/pthread_shim.c | 23 ++++++++++++++++------
 .../performance-thread/pthread_shim/pthread_shim.h |  3 ++-
 4 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index fdc90b2..c275649 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -90,6 +90,10 @@
 #define APP_LOOKUP_METHOD             APP_LOOKUP_LPM
 #endif
 
+#ifndef __GLIBC__ /* sched_getcpu() is glibc specific */
+#define sched_getcpu() rte_lcore_id()
+#endif
+
 /*
  *  When set to zero, simple forwaring path is eanbled.
  *  When set to one, optimized forwarding path is enabled.
diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index f035721..850b009 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -59,6 +59,10 @@
 #define DEBUG_APP 0
 #define HELLOW_WORLD_MAX_LTHREADS 10
 
+#ifndef __GLIBC__ /* sched_getcpu() is glibc-specific */
+#define sched_getcpu() rte_lcore_id()
+#endif
+
 __thread int print_count;
 __thread pthread_mutex_t print_lock;
 
@@ -175,12 +179,12 @@ static void initial_lthread(void *args __attribute__((unused)))
 		 * use an attribute to pass the desired lcore
 		 */
 		pthread_attr_t attr;
-		cpu_set_t cpuset;
+		rte_cpuset_t cpuset;
 
 		CPU_ZERO(&cpuset);
 		CPU_SET(lcore, &cpuset);
 		pthread_attr_init(&attr);
-		pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset);
+		pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t), &cpuset);
 
 		/* create the thread */
 		pthread_create(&tid[i], &attr, helloworld_pthread, (void *) i);
diff --git a/examples/performance-thread/pthread_shim/pthread_shim.c b/examples/performance-thread/pthread_shim/pthread_shim.c
index e8e5ec5..113bafa 100644
--- a/examples/performance-thread/pthread_shim/pthread_shim.c
+++ b/examples/performance-thread/pthread_shim/pthread_shim.c
@@ -174,7 +174,7 @@ int (*f_pthread_setschedparam)
 int (*f_pthread_yield)
 	(void);
 int (*f_pthread_setaffinity_np)
-	(pthread_t thread, size_t cpusetsize, const cpu_set_t *cpuset);
+	(pthread_t thread, size_t cpusetsize, const rte_cpuset_t *cpuset);
 int (*f_nanosleep)
 	(const struct timespec *req, struct timespec *rem);
 } _sys_pthread_funcs = {
@@ -405,11 +405,11 @@ pthread_create(pthread_t *__restrict tid,
 
 		if (attr != NULL) {
 			/* determine CPU being requested */
-			cpu_set_t cpuset;
+			rte_cpuset_t cpuset;
 
 			CPU_ZERO(&cpuset);
 			pthread_attr_getaffinity_np(attr,
-						sizeof(cpu_set_t),
+						sizeof(rte_cpuset_t),
 						&cpuset);
 
 			if (CPU_COUNT(&cpuset) != 1)
@@ -591,15 +591,26 @@ int pthread_rwlock_wrlock(pthread_rwlock_t *a)
 	return _sys_pthread_funcs.f_pthread_rwlock_wrlock(a);
 }
 
-int pthread_yield(void)
+#ifdef RTE_EXEC_ENV_LINUXAPP
+int
+pthread_yield(void)
 {
 	if (override) {
 		lthread_yield();
 		return 0;
 	}
 	return _sys_pthread_funcs.f_pthread_yield();
-
 }
+#else
+void
+pthread_yield(void)
+{
+	if (override)
+		lthread_yield();
+	else
+		_sys_pthread_funcs.f_pthread_yield();
+}
+#endif
 
 pthread_t pthread_self(void)
 {
@@ -701,7 +712,7 @@ int nanosleep(const struct timespec *req, struct timespec *rem)
 
 int
 pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
-		       const cpu_set_t *cpuset)
+		       const rte_cpuset_t *cpuset)
 {
 	if (override) {
 		/* we only allow affinity with a single CPU */
diff --git a/examples/performance-thread/pthread_shim/pthread_shim.h b/examples/performance-thread/pthread_shim/pthread_shim.h
index 78bbb5a..10f8789 100644
--- a/examples/performance-thread/pthread_shim/pthread_shim.h
+++ b/examples/performance-thread/pthread_shim/pthread_shim.h
@@ -33,7 +33,8 @@
 
 #ifndef _PTHREAD_SHIM_H_
 #define _PTHREAD_SHIM_H_
-#include <pthread.h>
+
+#include <rte_lcore.h>
 
 /*
  * This pthread shim is an example that demonstrates how legacy code
-- 
1.9.0

      parent reply	other threads:[~2017-05-02  9:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02  9:32 [dpdk-stable] patch 'examples: fix build clean " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/performance-thread: fix compilation on Suse 11 SP2' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'mbuf: fix missing includes in exported header' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/qede: fix default MAC address handling' " Yuanhan Liu
2017-05-06 15:07   ` Patil, Harish
2017-05-02  9:32 ` [dpdk-stable] patch 'net/qede: fix fastpath rings reset phase' " Yuanhan Liu
2017-05-06 15:06   ` Patil, Harish
2017-05-02  9:32 ` [dpdk-stable] patch 'net/qede/base: fix find zero bit macro' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/i40e: fix mbuf alloc failed counter' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/bonding: fix updating slave link status' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/virtio: fix MSI-X for modern devices' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/virtio: fix link status always down' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/virtio: fix crash when closing twice' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'crypto/openssl: fix AAD capabilities for AES-GCM' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'crypto/openssl: fix AES-GCM capability' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix packets array index' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'crypto/qat: fix dequeue statistics' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'cryptodev: fix API digest length comments' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'app/testpmd: fix crash at mbuf pool creation' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'app/testpmd: fix exit without freeing resources' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/performance-thread: fix build on FreeBSD 10.0' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/multi_process: fix timer update' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/l3fwd-power: fix handling no Rx queue' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/l3fwd-power: fix Rx descriptor size' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'examples/load_balancer: fix Tx flush' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/thunderx: fix deadlock in Rx path' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'doc: add limitation of AAD size to QAT guide' " Yuanhan Liu
2017-05-02  9:32 ` [dpdk-stable] patch 'net/qede: fix FW version string for VF' " Yuanhan Liu
2017-05-02  9:32 ` Yuanhan Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493717548-12434-27-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).