FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
thread.c
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #include <rte_config.h>
17 
18 #include <rte_common.h>
19 #include <rte_log.h>
20 #include <rte_memory.h>
21 #include <rte_memzone.h>
22 #include <rte_tailq.h>
23 #include <rte_eal.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>
33 #include <rte_pci.h>
34 #include <rte_random.h>
35 #include <rte_debug.h>
36 #include <rte_ether.h>
37 #include <rte_ethdev.h>
38 #include <rte_ring.h>
39 #include <rte_mempool.h>
40 #include <rte_mbuf.h>
41 #include <rte_version.h>
42 
43 #include <vlib/vlib.h>
44 #include <vnet/vnet.h>
45 #include <dpdk/device/dpdk.h>
46 #include <dpdk/device/dpdk_priv.h>
47 
48 static clib_error_t *
49 dpdk_launch_thread (void *fp, vlib_worker_thread_t * w, unsigned lcore_id)
50 {
51  int r;
52  r = rte_eal_remote_launch (fp, (void *) w, lcore_id);
53  if (r)
54  return clib_error_return (0, "Failed to launch thread %u", lcore_id);
55  return 0;
56 }
57 
58 static clib_error_t *
60 {
61  return 0;
62 }
63 
66  .vlib_thread_set_lcore_cb = &dpdk_thread_set_lcore,
67 };
68 
69 static clib_error_t *
71 {
73  return 0;
74 }
75 
77 
78 /** @endcond */
79 /*
80  * fd.io coding-style-patch-verification: ON
81  *
82  * Local Variables:
83  * eval: (c-set-style "gnu")
84  * End:
85  */
vlib.h
dpdk.h
dpdk_thread_set_lcore
static clib_error_t * dpdk_thread_set_lcore(u32 thread, u16 lcore)
Definition: thread.c:59
callbacks
static vlib_thread_callbacks_t callbacks
Definition: thread.c:64
dpdk_launch_thread
static clib_error_t * dpdk_launch_thread(void *fp, vlib_worker_thread_t *w, unsigned lcore_id)
Definition: thread.c:49
vlib_thread_callbacks_t
Definition: threads.h:257
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
thread
pthread_t thread[MAX_CONNS]
Definition: main.c:142
u16
unsigned short u16
Definition: types.h:57
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
dpdk_thread_init
static clib_error_t * dpdk_thread_init(vlib_main_t *vm)
Definition: thread.c:70
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1071
vlib_thread_callbacks_t::vlib_launch_thread_cb
clib_error_t *(* vlib_launch_thread_cb)(void *fp, vlib_worker_thread_t *w, unsigned cpu_id)
Definition: threads.h:259
vlib_thread_cb_register
int vlib_thread_cb_register(struct vlib_main_t *vm, vlib_thread_callbacks_t *cb)
Definition: threads.c:1613
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
vlib_worker_thread_t
Definition: threads.h:85
vlib_main_t
Definition: main.h:102
clib_error_t
Definition: clib_error.h:21
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
vnet.h
dpdk_priv.h