2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

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>
This commit is contained in:
Alex Wang
2015-02-03 17:08:13 -08:00
parent 9f33d4428c
commit abb5943dbb
4 changed files with 12 additions and 8 deletions

View File

@@ -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;
}