diff options
author | Alex Wang <alexw@nicira.com> | 2015-02-03 17:08:13 -0800 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2015-02-10 17:38:03 -0800 |
commit | abb5943dbb8005a9de59c68e4d798fbd072d33f0 (patch) | |
tree | ba009c599b4c792630ef075a4d7075eecd240ff6 | |
parent | 9f33d4428c6fe1ab5670f3116c53eb00646f0f9a (diff) | |
download | openvswitch-abb5943dbb8005a9de59c68e4d798fbd072d33f0.tar.gz |
netdev-dpdk: Allow changing NON_PMD_CORE_ID for testing purpose.
For testing purpose, developers may want to change the NON_PMD_CORE_ID
and use a different core for non-pmd threads. Since the netdev-dpdk
module is hard-coded to assert the non-pmd threads using core 0, such
change will cause abortion of OVS.
This commit fixes the assertion and allows changing NON_PMD_CORE_ID.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
-rw-r--r-- | lib/dpctl.c | 2 | ||||
-rw-r--r-- | lib/dpif-netdev.h | 1 | ||||
-rw-r--r-- | lib/netdev-dpdk.c | 12 | ||||
-rw-r--r-- | lib/netdev-dpdk.h | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/lib/dpctl.c b/lib/dpctl.c index 4c2614bfe..125023cc4 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -31,11 +31,11 @@ #include "dirs.h" #include "dpctl.h" #include "dpif.h" -#include "dpif-netdev.h" #include "dynamic-string.h" #include "flow.h" #include "match.h" #include "netdev.h" +#include "netdev-dpdk.h" #include "netlink.h" #include "odp-util.h" #include "ofp-parse.h" diff --git a/lib/dpif-netdev.h b/lib/dpif-netdev.h index d81150772..410fcfa15 100644 --- a/lib/dpif-netdev.h +++ b/lib/dpif-netdev.h @@ -42,7 +42,6 @@ static inline void dp_packet_pad(struct ofpbuf *b) #define NR_QUEUE 1 #define NR_PMD_THREADS 1 -#define NON_PMD_CORE_ID 0 #ifdef __cplusplus } diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 0ede2001d..391695fab 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1553,8 +1553,8 @@ pmd_thread_setaffinity_cpu(int cpu) VLOG_ERR("Thread affinity error %d",err); return err; } - /* lcore_id 0 is reseved for use by non pmd threads. */ - ovs_assert(cpu); + /* NON_PMD_CORE_ID is reserved for use by non pmd threads. */ + ovs_assert(cpu != NON_PMD_CORE_ID); RTE_PER_LCORE(_lcore_id) = cpu; return 0; @@ -1563,13 +1563,13 @@ pmd_thread_setaffinity_cpu(int cpu) void thread_set_nonpmd(void) { - /* We have to use 0 to allow non pmd threads to perform certain DPDK - * operations, like rte_eth_dev_configure(). */ - RTE_PER_LCORE(_lcore_id) = 0; + /* We have to use NON_PMD_CORE_ID to allow non-pmd threads to perform + * certain DPDK operations, like rte_eth_dev_configure(). */ + RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID; } static bool thread_is_pmd(void) { - return rte_lcore_id() != 0; + return rte_lcore_id() != NON_PMD_CORE_ID; } diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h index c24d6da33..694899cfe 100644 --- a/lib/netdev-dpdk.h +++ b/lib/netdev-dpdk.h @@ -5,6 +5,11 @@ struct dpif_packet; +/* Reserves cpu core 0 for all non-pmd threads. Changing the value of this + * macro will allow pmd thread to be pinned on cpu core 0. This may not be + * ideal since the core may be non-isolated. */ +#define NON_PMD_CORE_ID 0 + #ifdef DPDK_NETDEV #include <rte_config.h> |