summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-gpe/decap.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-04-05 19:18:20 +0200
committerDave Barach <openvpp@barachs.net>2017-04-06 11:31:39 +0000
commit586afd762bfa149f5ca167bd5fd5a0cd59ce94fe (patch)
tree808b57c61e0fe1a181871bb1ad94398c5ba42671 /src/vnet/lisp-gpe/decap.c
parentbc799c92d761a2d45105aa6a1685b3663687d2a4 (diff)
Use thread local storage for thread index
This patch deprecates stack-based thread identification, Also removes requirement that thread stacks are adjacent. Finally, possibly annoying for some folks, it renames all occurences of cpu_index and cpu_number with thread index. Using word "cpu" is misleading here as thread can be migrated ti different CPU, and also it is not related to linux cpu index. Change-Id: I68cdaf661e701d2336fc953dcb9978d10a70f7c1 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/lisp-gpe/decap.c')
-rw-r--r--src/vnet/lisp-gpe/decap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vnet/lisp-gpe/decap.c b/src/vnet/lisp-gpe/decap.c
index d887a95f16c..687697105a4 100644
--- a/src/vnet/lisp-gpe/decap.c
+++ b/src/vnet/lisp-gpe/decap.c
@@ -103,7 +103,7 @@ next_index_to_iface (lisp_gpe_main_t * lgm, u32 next_index)
}
static_always_inline void
-incr_decap_stats (vnet_main_t * vnm, u32 cpu_index, u32 length,
+incr_decap_stats (vnet_main_t * vnm, u32 thread_index, u32 length,
u32 sw_if_index, u32 * last_sw_if_index, u32 * n_packets,
u32 * n_bytes)
{
@@ -122,7 +122,7 @@ incr_decap_stats (vnet_main_t * vnm, u32 cpu_index, u32 length,
vlib_increment_combined_counter (im->combined_sw_if_counters +
VNET_INTERFACE_COUNTER_RX,
- cpu_index, *last_sw_if_index,
+ thread_index, *last_sw_if_index,
*n_packets, *n_bytes);
}
*last_sw_if_index = sw_if_index;
@@ -150,11 +150,11 @@ static uword
lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * from_frame, u8 is_v4)
{
- u32 n_left_from, next_index, *from, *to_next, cpu_index;
+ u32 n_left_from, next_index, *from, *to_next, thread_index;
u32 n_bytes = 0, n_packets = 0, last_sw_if_index = ~0, drops = 0;
lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
- cpu_index = os_get_cpu_number ();
+ thread_index = vlib_get_thread_index ();
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
@@ -267,7 +267,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (si0)
{
- incr_decap_stats (lgm->vnet_main, cpu_index,
+ incr_decap_stats (lgm->vnet_main, thread_index,
vlib_buffer_length_in_chain (vm, b0), si0[0],
&last_sw_if_index, &n_packets, &n_bytes);
vnet_buffer (b0)->sw_if_index[VLIB_RX] = si0[0];
@@ -282,7 +282,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (si1)
{
- incr_decap_stats (lgm->vnet_main, cpu_index,
+ incr_decap_stats (lgm->vnet_main, thread_index,
vlib_buffer_length_in_chain (vm, b1), si1[0],
&last_sw_if_index, &n_packets, &n_bytes);
vnet_buffer (b1)->sw_if_index[VLIB_RX] = si1[0];
@@ -397,7 +397,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (si0)
{
- incr_decap_stats (lgm->vnet_main, cpu_index,
+ incr_decap_stats (lgm->vnet_main, thread_index,
vlib_buffer_length_in_chain (vm, b0), si0[0],
&last_sw_if_index, &n_packets, &n_bytes);
vnet_buffer (b0)->sw_if_index[VLIB_RX] = si0[0];
@@ -430,7 +430,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* flush iface stats */
- incr_decap_stats (lgm->vnet_main, cpu_index, 0, ~0, &last_sw_if_index,
+ incr_decap_stats (lgm->vnet_main, thread_index, 0, ~0, &last_sw_if_index,
&n_packets, &n_bytes);
vlib_node_increment_counter (vm, lisp_gpe_ip4_input_node.index,
LISP_GPE_ERROR_NO_TUNNEL, drops);