2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-dpdk: Use multiple core for dpdk IO.

DPDK need to set _lcore_id for using multiple core.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
This commit is contained in:
Pravin
2014-03-20 22:07:44 -07:00
committed by Pravin B Shelar
parent 8a9562d21a
commit 8617affff4
3 changed files with 22 additions and 0 deletions

View File

@@ -1196,3 +1196,21 @@ netdev_dpdk_register(void)
{
netdev_register_provider(&netdev_dpdk_class);
}
int
pmd_thread_setaffinity_cpu(int 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;
}
RTE_PER_LCORE(_lcore_id) = cpu;
return 0;
}