mirror of
https://github.com/openvswitch/ovs
synced 2025-09-05 08:45:23 +00:00
ovs-numa: Introduce function to set current thread affinity.
This commit moves the code that sets the pmd threads affinity from netdev-dpdk to ovs-numa. There's one small part left in netdev-dpdk, to set the lcore_id. Now dpif-netdev will call both modules (ovs-numa and netdev-dpdk) when starting a pmd thread. This change will allow having a dummy implementation of the set affinity call, for testing purposes. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ilya Maximets <i.maximets@samsung.com>
This commit is contained in:
@@ -3502,24 +3502,12 @@ netdev_dpdk_register(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
pmd_thread_setaffinity_cpu(unsigned cpu)
|
||||
void
|
||||
dpdk_set_lcore_id(unsigned cpu)
|
||||
{
|
||||
cpu_set_t cpuset;
|
||||
int err;
|
||||
|
||||
CPU_ZERO(&cpuset);
|
||||
CPU_SET(cpu, &cpuset);
|
||||
err = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (err) {
|
||||
VLOG_ERR("Thread affinity error %d",err);
|
||||
return err;
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
Reference in New Issue
Block a user