2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <rte_config.h>
18 #include <rte_common.h>
20 #include <rte_memory.h>
21 #include <rte_memzone.h>
22 #include <rte_tailq.h>
24 #include <rte_per_lcore.h>
25 #include <rte_launch.h>
26 #include <rte_atomic.h>
27 #include <rte_cycles.h>
28 #include <rte_prefetch.h>
29 #include <rte_lcore.h>
30 #include <rte_per_lcore.h>
31 #include <rte_branch_prediction.h>
32 #include <rte_interrupts.h>
34 #include <rte_random.h>
35 #include <rte_debug.h>
36 #include <rte_ether.h>
37 #include <rte_ethdev.h>
39 #include <rte_mempool.h>
41 #include <rte_version.h>
43 #include <vlib/vlib.h>
44 #include <vnet/vnet.h>
45 #include <vnet/devices/dpdk/dpdk.h>
46 #include <vnet/devices/dpdk/dpdk_priv.h>
49 dpdk_launch_thread (void *fp, vlib_worker_thread_t * w, unsigned lcore_id)
52 r = rte_eal_remote_launch (fp, (void *) w, lcore_id);
54 return clib_error_return (0, "Failed to launch thread %u", lcore_id);
59 dpdk_thread_set_lcore (u32 thread, u16 lcore)
64 static vlib_thread_callbacks_t callbacks = {
65 .vlib_launch_thread_cb = &dpdk_launch_thread,
66 .vlib_thread_set_lcore_cb = &dpdk_thread_set_lcore,
70 dpdk_thread_init (vlib_main_t * vm)
72 vlib_thread_cb_register (vm, &callbacks);
76 VLIB_INIT_FUNCTION (dpdk_thread_init);
80 * fd.io coding-style-patch-verification: ON
83 * eval: (c-set-style "gnu")