aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-07-11 12:47:43 +0200
committerFlorin Coras <florin.coras@gmail.com>2018-07-11 15:13:41 +0000
commit067cd6229a47ea3ba8b59a2a04090e80afb5bd2c (patch)
tree13d81219dbe0483dda02922ed5a6b6cb4c7632db
parentb6b04f0c2a64d6edd536add6900e9d458c2fe8d1 (diff)
avoid using thread local storage for thread index
It is cheaper to get thread index from vlib_main_t if available... Change-Id: I4582e160d06d9d7fccdc54271912f0635da79b50 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/avf/output.c2
-rw-r--r--src/plugins/lb/node.c2
-rw-r--r--src/plugins/map/ip4_map.c4
-rw-r--r--src/plugins/map/ip4_map_t.c4
-rw-r--r--src/plugins/map/ip6_map.c6
-rw-r--r--src/plugins/map/ip6_map_t.c4
-rw-r--r--src/plugins/marvell/pp2/input.c2
-rw-r--r--src/plugins/marvell/pp2/output.c2
-rw-r--r--src/plugins/memif/device.c2
-rw-r--r--src/plugins/memif/node.c4
-rw-r--r--src/plugins/nat/dslite_in2out.c2
-rw-r--r--src/plugins/nat/dslite_out2in.c2
-rwxr-xr-xsrc/plugins/nat/in2out.c10
-rw-r--r--src/plugins/nat/nat64.c4
-rw-r--r--src/plugins/nat/nat64_in2out.c6
-rw-r--r--src/plugins/nat/nat64_out2in.c6
-rw-r--r--src/plugins/nat/nat66_in2out.c2
-rw-r--r--src/plugins/nat/nat66_out2in.c2
-rwxr-xr-xsrc/plugins/nat/out2in.c10
-rw-r--r--src/plugins/srv6-ad/node.c2
-rw-r--r--src/plugins/srv6-am/node.c2
-rw-r--r--src/vnet/bier/bier_output.c2
-rw-r--r--src/vnet/bonding/device.c4
-rw-r--r--src/vnet/bonding/node.c4
-rw-r--r--src/vnet/devices/af_packet/node.c2
-rw-r--r--src/vnet/devices/netmap/node.c4
-rw-r--r--src/vnet/devices/virtio/node.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_output.c2
-rw-r--r--src/vnet/dpo/interface_rx_dpo.c2
-rwxr-xr-xsrc/vnet/ethernet/node.c2
-rw-r--r--src/vnet/ethernet/p2p_ethernet_input.c2
-rw-r--r--src/vnet/geneve/decap.c2
-rw-r--r--src/vnet/geneve/encap.c2
-rw-r--r--src/vnet/gre/node.c2
-rw-r--r--src/vnet/ip/ip4_forward.c4
-rw-r--r--src/vnet/ip/ip4_forward.h2
-rw-r--r--src/vnet/ip/ip4_input.c25
-rw-r--r--src/vnet/ip/ip6_forward.c4
-rw-r--r--src/vnet/ip/ip6_forward.h2
-rw-r--r--src/vnet/ip/ip6_input.c2
-rwxr-xr-xsrc/vnet/ip/ping.c2
-rw-r--r--src/vnet/ipip/node.c2
-rw-r--r--src/vnet/ipsec/esp_encrypt.c8
-rw-r--r--src/vnet/ipsec/ipsec.h2
-rw-r--r--src/vnet/ipsec/ipsec_if.c2
-rw-r--r--src/vnet/ipsec/ipsec_if_in.c2
-rw-r--r--src/vnet/l2tp/l2tp.c2
-rw-r--r--src/vnet/lisp-gpe/decap.c2
-rw-r--r--src/vnet/lisp-gpe/interface.c2
-rwxr-xr-xsrc/vnet/srv6/sr_localsid.c4
-rw-r--r--src/vnet/udp/udp.c2
-rw-r--r--src/vnet/udp/udp_encap_node.c2
-rw-r--r--src/vnet/unix/tapcli.c4
-rw-r--r--src/vnet/unix/tuntap.c4
-rw-r--r--src/vnet/vxlan-gpe/decap.c2
-rw-r--r--src/vnet/vxlan-gpe/encap.c2
57 files changed, 99 insertions, 98 deletions
diff --git a/src/plugins/avf/output.c b/src/plugins/avf/output.c
index 2722c99f31c..4eec79bd7a7 100644
--- a/src/plugins/avf/output.c
+++ b/src/plugins/avf/output.c
@@ -42,7 +42,7 @@ CLIB_MULTIARCH_FN (avf_interface_tx) (vlib_main_t * vm,
avf_main_t *am = &avf_main;
vnet_interface_output_runtime_t *rd = (void *) node->runtime_data;
avf_device_t *ad = pool_elt_at_index (am->devices, rd->dev_instance);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u8 qid = thread_index;
avf_txq_t *txq = vec_elt_at_index (ad->txqs, qid % ad->num_queue_pairs);
avf_tx_desc_t *d0, *d1, *d2, *d3;
diff --git a/src/plugins/lb/node.c b/src/plugins/lb/node.c
index 44c7781e977..b33ea22b5c1 100644
--- a/src/plugins/lb/node.c
+++ b/src/plugins/lb/node.c
@@ -220,7 +220,7 @@ lb_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame,
{
lb_main_t *lbm = &lb_main;
u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 lb_time = lb_hash_time_now (vm);
lb_hash_t *sticky_ht = lb_get_sticky_table (thread_index);
diff --git a/src/plugins/map/ip4_map.c b/src/plugins/map/ip4_map.c
index 1bb33b016fa..715cdef3aae 100644
--- a/src/plugins/map/ip4_map.c
+++ b/src/plugins/map/ip4_map.c
@@ -203,7 +203,7 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
next_index = node->cached_next_index;
map_main_t *mm = &map_main;
vlib_combined_counter_main_t *cm = mm->domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
@@ -519,7 +519,7 @@ ip4_map_reass (vlib_main_t * vm,
next_index = node->cached_next_index;
map_main_t *mm = &map_main;
vlib_combined_counter_main_t *cm = mm->domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 *fragments_to_drop = NULL;
u32 *fragments_to_loopback = NULL;
diff --git a/src/plugins/map/ip4_map_t.c b/src/plugins/map/ip4_map_t.c
index ab4b46c916f..0a9903a7ac4 100644
--- a/src/plugins/map/ip4_map_t.c
+++ b/src/plugins/map/ip4_map_t.c
@@ -177,7 +177,7 @@ ip4_map_t_icmp (vlib_main_t * vm,
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
vlib_combined_counter_main_t *cm = map_main.domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
@@ -541,7 +541,7 @@ ip4_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
next_index = node->cached_next_index;
map_main_t *mm = &map_main;
vlib_combined_counter_main_t *cm = map_main.domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
diff --git a/src/plugins/map/ip6_map.c b/src/plugins/map/ip6_map.c
index 5cdd9d94582..01b2d87f5dc 100644
--- a/src/plugins/map/ip6_map.c
+++ b/src/plugins/map/ip6_map.c
@@ -174,7 +174,7 @@ ip6_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vlib_node_get_runtime (vm, ip6_map_node.index);
map_main_t *mm = &map_main;
vlib_combined_counter_main_t *cm = mm->domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -825,7 +825,7 @@ ip6_map_ip4_reass (vlib_main_t * vm,
vlib_node_get_runtime (vm, ip6_map_ip4_reass_node.index);
map_main_t *mm = &map_main;
vlib_combined_counter_main_t *cm = mm->domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 *fragments_to_drop = NULL;
u32 *fragments_to_loopback = NULL;
@@ -1018,7 +1018,7 @@ ip6_map_icmp_relay (vlib_main_t * vm,
vlib_node_runtime_t *error_node =
vlib_node_get_runtime (vm, ip6_map_icmp_relay_node.index);
map_main_t *mm = &map_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u16 *fragment_ids, *fid;
from = vlib_frame_vector_args (frame);
diff --git a/src/plugins/map/ip6_map_t.c b/src/plugins/map/ip6_map_t.c
index 852b1274bc0..01ed810bb9f 100644
--- a/src/plugins/map/ip6_map_t.c
+++ b/src/plugins/map/ip6_map_t.c
@@ -204,7 +204,7 @@ ip6_map_t_icmp (vlib_main_t * vm,
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
vlib_combined_counter_main_t *cm = map_main.domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
@@ -637,7 +637,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vlib_node_get_runtime (vm, ip6_map_t_node.index);
map_main_t *mm = &map_main;
vlib_combined_counter_main_t *cm = map_main.domain_counters;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
diff --git a/src/plugins/marvell/pp2/input.c b/src/plugins/marvell/pp2/input.c
index 6329e3b2220..72c1fe02f28 100644
--- a/src/plugins/marvell/pp2/input.c
+++ b/src/plugins/marvell/pp2/input.c
@@ -162,7 +162,7 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
vnet_main_t *vnm = vnet_get_main ();
mrvl_pp2_main_t *ppm = &mrvl_pp2_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
mrvl_pp2_inq_t *inq = vec_elt_at_index (ppif->inqs, qid);
uword n_trace = vlib_get_trace_count (vm, node);
mrvl_pp2_per_thread_data_t *ptd =
diff --git a/src/plugins/marvell/pp2/output.c b/src/plugins/marvell/pp2/output.c
index 64529945f18..16efae5eecc 100644
--- a/src/plugins/marvell/pp2/output.c
+++ b/src/plugins/marvell/pp2/output.c
@@ -34,7 +34,7 @@ mrvl_pp2_interface_tx (vlib_main_t * vm,
mrvl_pp2_main_t *ppm = &mrvl_pp2_main;
vnet_interface_output_runtime_t *rd = (void *) node->runtime_data;
mrvl_pp2_if_t *ppif = pool_elt_at_index (ppm->interfaces, rd->dev_instance);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
mrvl_pp2_per_thread_data_t *ptd =
vec_elt_at_index (ppm->per_thread_data, thread_index);
u8 qid = thread_index;
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 87c9404bd8e..5c8eb3f082c 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -409,7 +409,7 @@ CLIB_MULTIARCH_FN (memif_interface_tx) (vlib_main_t * vm,
vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
memif_if_t *mif = pool_elt_at_index (nm->interfaces, rund->dev_instance);
memif_queue_t *mq;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
memif_per_thread_data_t *ptd = vec_elt_at_index (memif_main.per_thread_data,
thread_index);
u8 tx_queues = vec_len (mif->tx_queues);
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 6e2807a2054..2b8c4f2d228 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -187,7 +187,7 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left, *to_next = 0;
u32 bi0, bi1, bi2, bi3;
vlib_buffer_t *b0, *b1, *b2, *b3;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
memif_per_thread_data_t *ptd = vec_elt_at_index (mm->per_thread_data,
thread_index);
vlib_buffer_t *bt = &ptd->buffer_template;
@@ -542,7 +542,7 @@ memif_device_input_zc_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u16 s0, s1, s2, s3;
memif_desc_t *d0, *d1, *d2, *d3;
vlib_buffer_t *b0, *b1, *b2, *b3;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
memif_per_thread_data_t *ptd = vec_elt_at_index (mm->per_thread_data,
thread_index);
u16 cur_slot, last_slot, ring_size, n_slots, mask, head;
diff --git a/src/plugins/nat/dslite_in2out.c b/src/plugins/nat/dslite_in2out.c
index ab0055cfee2..991d6eda775 100644
--- a/src/plugins/nat/dslite_in2out.c
+++ b/src/plugins/nat/dslite_in2out.c
@@ -228,7 +228,7 @@ dslite_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
dslite_in2out_next_t next_index;
u32 node_index;
vlib_node_runtime_t *error_node;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
f64 now = vlib_time_now (vm);
dslite_main_t *dm = &dslite_main;
diff --git a/src/plugins/nat/dslite_out2in.c b/src/plugins/nat/dslite_out2in.c
index 6bfc6e979cd..798367db6b1 100644
--- a/src/plugins/nat/dslite_out2in.c
+++ b/src/plugins/nat/dslite_out2in.c
@@ -101,7 +101,7 @@ dslite_out2in_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left_from, *from, *to_next;
dslite_out2in_next_t next_index;
vlib_node_runtime_t *error_node;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
f64 now = vlib_time_now (vm);
dslite_main_t *dm = &dslite_main;
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index ae9c836b773..be1ddb3db7e 100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -1100,7 +1100,7 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
snat_main_t * sm = &snat_main;
f64 now = vlib_time_now (vm);
u32 stats_node_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
stats_node_index = is_slow_path ? snat_in2out_slowpath_node.index :
snat_in2out_node.index;
@@ -2066,7 +2066,7 @@ nat44_in2out_reass_node_fn (vlib_main_t * vm,
u32 pkts_processed = 0;
snat_main_t *sm = &snat_main;
f64 now = vlib_time_now (vm);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
snat_main_per_thread_data_t *per_thread_data =
&sm->per_thread_data[thread_index];
u32 *fragments_to_drop = 0;
@@ -2985,7 +2985,7 @@ nat44_ed_in2out_node_fn_inline (vlib_main_t * vm,
snat_in2out_next_t next_index;
snat_main_t *sm = &snat_main;
f64 now = vlib_time_now (vm);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
stats_node_index = is_slow_path ? nat44_ed_in2out_slowpath_node.index :
@@ -3793,7 +3793,7 @@ snat_det_in2out_node_fn (vlib_main_t * vm,
u32 pkts_processed = 0;
snat_main_t * sm = &snat_main;
u32 now = (u32) vlib_time_now (vm);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -4558,7 +4558,7 @@ snat_in2out_worker_handoff_fn_inline (vlib_main_t * vm,
u32 n_left_to_next_worker = 0, *to_next_worker = 0;
u32 next_worker_index = 0;
u32 current_worker_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 fq_index;
u32 to_node_index;
vlib_frame_t *d = 0;
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 53c2caba2fa..1ca5e369b98 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -573,7 +573,7 @@ nat64_static_bib_worker_fn (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_frame_t * f)
{
nat64_main_t *nm = &nat64_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
nat64_db_t *db = &nm->db[thread_index];
nat64_static_bib_to_update_t *static_bib;
nat64_db_bib_entry_t *bibe;
@@ -1155,7 +1155,7 @@ nat64_expire_worker_walk_fn (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_frame_t * f)
{
nat64_main_t *nm = &nat64_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
nat64_db_t *db = &nm->db[thread_index];
u32 now = (u32) vlib_time_now (vm);
diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c
index 6ff428bbb86..cdfe9b8d80c 100644
--- a/src/plugins/nat/nat64_in2out.c
+++ b/src/plugins/nat/nat64_in2out.c
@@ -922,7 +922,7 @@ nat64_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
nat64_in2out_next_t next_index;
u32 pkts_processed = 0;
u32 stats_node_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
stats_node_index =
is_slow_path ? nat64_in2out_slowpath_node.index : nat64_in2out_node.index;
@@ -1316,7 +1316,7 @@ nat64_in2out_reass_node_fn (vlib_main_t * vm,
u32 *fragments_to_drop = 0;
u32 *fragments_to_loopback = 0;
nat64_main_t *nm = &nat64_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -1644,7 +1644,7 @@ nat64_in2out_handoff_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left_to_next_worker = 0, *to_next_worker = 0;
u32 next_worker_index = 0;
u32 current_worker_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 fq_index;
u32 to_node_index;
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index f43d3e081b4..f7d4dd417f5 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -408,7 +408,7 @@ nat64_out2in_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left_from, *from, *to_next;
nat64_out2in_next_t next_index;
u32 pkts_processed = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -650,7 +650,7 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 *fragments_to_drop = 0;
u32 *fragments_to_loopback = 0;
nat64_main_t *nm = &nat64_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -930,7 +930,7 @@ nat64_out2in_handoff_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left_to_next_worker = 0, *to_next_worker = 0;
u32 next_worker_index = 0;
u32 current_worker_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 fq_index;
u32 to_node_index;
diff --git a/src/plugins/nat/nat66_in2out.c b/src/plugins/nat/nat66_in2out.c
index d606bf46260..6bcf6ec667c 100644
--- a/src/plugins/nat/nat66_in2out.c
+++ b/src/plugins/nat/nat66_in2out.c
@@ -116,7 +116,7 @@ nat66_in2out_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left_from, *from, *to_next;
nat66_in2out_next_t next_index;
u32 pkts_processed = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
nat66_main_t *nm = &nat66_main;
from = vlib_frame_vector_args (frame);
diff --git a/src/plugins/nat/nat66_out2in.c b/src/plugins/nat/nat66_out2in.c
index a28a4c3ade5..f264765448c 100644
--- a/src/plugins/nat/nat66_out2in.c
+++ b/src/plugins/nat/nat66_out2in.c
@@ -76,7 +76,7 @@ nat66_out2in_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_left_from, *from, *to_next;
nat66_out2in_next_t next_index;
u32 pkts_processed = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
nat66_main_t *nm = &nat66_main;
from = vlib_frame_vector_args (frame);
diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c
index 1a1a1f1f639..ecfabc9c07a 100755
--- a/src/plugins/nat/out2in.c
+++ b/src/plugins/nat/out2in.c
@@ -653,7 +653,7 @@ snat_out2in_node_fn (vlib_main_t * vm,
u32 pkts_processed = 0;
snat_main_t * sm = &snat_main;
f64 now = vlib_time_now (vm);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -1256,7 +1256,7 @@ nat44_out2in_reass_node_fn (vlib_main_t * vm,
u32 pkts_processed = 0;
snat_main_t *sm = &snat_main;
f64 now = vlib_time_now (vm);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
snat_main_per_thread_data_t *per_thread_data =
&sm->per_thread_data[thread_index];
u32 *fragments_to_drop = 0;
@@ -2038,7 +2038,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm,
nat44_ed_out2in_next_t next_index;
snat_main_t *sm = &snat_main;
f64 now = vlib_time_now (vm);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
stats_node_index = is_slow_path ? nat44_ed_out2in_slowpath_node.index :
@@ -2837,7 +2837,7 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
snat_out2in_next_t next_index;
u32 pkts_processed = 0;
snat_main_t * sm = &snat_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -3473,7 +3473,7 @@ snat_out2in_worker_handoff_fn (vlib_main_t * vm,
u32 n_left_to_next_worker = 0, *to_next_worker = 0;
u32 next_worker_index = 0;
u32 current_worker_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
vlib_frame_t *d = 0;
ASSERT (vec_len (sm->workers));
diff --git a/src/plugins/srv6-ad/node.c b/src/plugins/srv6-ad/node.c
index e2111d65431..29851968108 100644
--- a/src/plugins/srv6-ad/node.c
+++ b/src/plugins/srv6-ad/node.c
@@ -194,7 +194,7 @@ srv6_ad_localsid_fn (vlib_main_t * vm,
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
diff --git a/src/plugins/srv6-am/node.c b/src/plugins/srv6-am/node.c
index 8643aa42532..84014c5ee8d 100644
--- a/src/plugins/srv6-am/node.c
+++ b/src/plugins/srv6-am/node.c
@@ -148,7 +148,7 @@ srv6_am_localsid_fn (vlib_main_t * vm,
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
diff --git a/src/vnet/bier/bier_output.c b/src/vnet/bier/bier_output.c
index 7f513fc7b48..16c1d8e1543 100644
--- a/src/vnet/bier/bier_output.c
+++ b/src/vnet/bier/bier_output.c
@@ -69,7 +69,7 @@ bier_output (vlib_main_t * vm,
u32 n_left_from, next_index, * from, * to_next;
u32 thread_index;
- thread_index = vlib_get_thread_index ();
+ thread_index = vm->thread_index;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c
index 1ade1c290a1..53123dd7c4f 100644
--- a/src/vnet/bonding/device.c
+++ b/src/vnet/bonding/device.c
@@ -140,7 +140,7 @@ bond_load_balance_broadcast (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 *to_next = 0;
u32 sw_if_index;
vlib_frame_t *f;
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
for (port = 1; port < slave_count; port++)
{
@@ -403,7 +403,7 @@ bond_tx_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 sw_if_index, sw_if_index1, sw_if_index2, sw_if_index3;
bond_packet_trace_t *t0;
uword n_trace = vlib_get_trace_count (vm, node);
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
vnet_main_t *vnm = vnet_get_main ();
u32 *to_next;
u32 sif_if_index, sif_if_index1, sif_if_index2, sif_if_index3;
diff --git a/src/vnet/bonding/node.c b/src/vnet/bonding/node.c
index 5842da3f5ec..7abd7b0de32 100644
--- a/src/vnet/bonding/node.c
+++ b/src/vnet/bonding/node.c
@@ -138,7 +138,7 @@ bond_update_next (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 * bond_sw_if_index, vlib_buffer_t * b,
u32 * next_index, vlib_error_t * error)
{
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
slave_if_t *sif;
bond_if_t *bif;
@@ -176,7 +176,7 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
u32 *from, n_left;
vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
u32 sw_if_indices[VLIB_FRAME_SIZE], *sw_if_index;
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index d74e56fd0e9..8dbd8554f01 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -191,7 +191,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 frame_num = apif->rx_req->tp_frame_nr;
u8 *block_start = apif->rx_ring + block * block_size;
uword n_trace = vlib_get_trace_count (vm, node);
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 n_buffer_bytes = vlib_buffer_free_list_buffer_size (vm,
VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
u32 min_bufs = apif->rx_req->tp_frame_size / n_buffer_bytes;
diff --git a/src/vnet/devices/netmap/node.c b/src/vnet/devices/netmap/node.c
index 67ddce58440..e541700f4ea 100644
--- a/src/vnet/devices/netmap/node.c
+++ b/src/vnet/devices/netmap/node.c
@@ -98,7 +98,7 @@ netmap_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_free_bufs;
struct netmap_ring *ring;
int cur_ring;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 n_buffer_bytes = vlib_buffer_free_list_buffer_size (vm,
VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
@@ -260,7 +260,7 @@ netmap_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
int i;
u32 n_rx_packets = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
netmap_main_t *nm = &netmap_main;
netmap_if_t *nmi;
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 9477a1cfc58..339c48c93f5 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -128,7 +128,7 @@ virtio_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame, virtio_if_t * vif, u16 qid)
{
vnet_main_t *vnm = vnet_get_main ();
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
uword n_trace = vlib_get_trace_count (vm, node);
virtio_vring_t *vring = vec_elt_at_index (vif->vrings, 0);
u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 3db44731b5e..3f2b4022dee 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -256,7 +256,7 @@ vhost_user_if_input (vlib_main_t * vm,
u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
u32 n_trace = vlib_get_trace_count (vm, node);
u32 map_hint = 0;
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
u16 copy_len = 0;
{
diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c
index f400f18307a..b41583708b3 100644
--- a/src/vnet/devices/virtio/vhost_user_output.c
+++ b/src/vnet/devices/virtio/vhost_user_output.c
@@ -238,7 +238,7 @@ CLIB_MULTIARCH_FN (vhost_user_tx) (vlib_main_t * vm,
u32 qid = ~0;
vhost_user_vring_t *rxvq;
u8 error;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 map_hint = 0;
u8 retry = 8;
u16 copy_len;
diff --git a/src/vnet/dpo/interface_rx_dpo.c b/src/vnet/dpo/interface_rx_dpo.c
index 4e5b1a5eeeb..82767e73fc7 100644
--- a/src/vnet/dpo/interface_rx_dpo.c
+++ b/src/vnet/dpo/interface_rx_dpo.c
@@ -239,7 +239,7 @@ interface_rx_dpo_inline (vlib_main_t * vm,
u8 is_l2)
{
u32 n_left_from, next_index, * from, * to_next;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
vnet_interface_main_t *im;
im = &vnet_get_main ()->interface_main;
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index 86676673ed3..3b5542e2b41 100755
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -297,7 +297,7 @@ ethernet_input_inline (vlib_main_t * vm,
vlib_node_runtime_t *error_node;
u32 n_left_from, next_index, *from, *to_next;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 cached_sw_if_index = ~0;
u32 cached_is_l2 = 0; /* shut up gcc */
vnet_hw_interface_t *hi = NULL; /* used for main interface only */
diff --git a/src/vnet/ethernet/p2p_ethernet_input.c b/src/vnet/ethernet/p2p_ethernet_input.c
index eeff4f06819..74e3bb883cf 100644
--- a/src/vnet/ethernet/p2p_ethernet_input.c
+++ b/src/vnet/ethernet/p2p_ethernet_input.c
@@ -63,7 +63,7 @@ static uword
p2p_ethernet_input_node_fn (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame)
{
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 n_trace = vlib_get_trace_count (vm, node);
u32 n_left_from, *from, *to_next;
u32 next_index;
diff --git a/src/vnet/geneve/decap.c b/src/vnet/geneve/decap.c
index 2e6e9c58a0f..b17c6da07ae 100644
--- a/src/vnet/geneve/decap.c
+++ b/src/vnet/geneve/decap.c
@@ -82,7 +82,7 @@ geneve_input (vlib_main_t * vm,
geneve4_tunnel_key_t last_key4;
geneve6_tunnel_key_t last_key6;
u32 pkts_decapsulated = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
if (is_ip4)
diff --git a/src/vnet/geneve/encap.c b/src/vnet/geneve/encap.c
index e9e7e5b9faf..9774323edf6 100644
--- a/src/vnet/geneve/encap.c
+++ b/src/vnet/geneve/encap.c
@@ -79,7 +79,7 @@ geneve_encap_inline (vlib_main_t * vm,
vnet_interface_main_t *im = &vnm->interface_main;
u32 pkts_encapsulated = 0;
u16 old_l0 = 0, old_l1 = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
u32 sw_if_index0 = 0, sw_if_index1 = 0;
u32 next0 = 0, next1 = 0;
diff --git a/src/vnet/gre/node.c b/src/vnet/gre/node.c
index ee32e602ce9..056d00b23b0 100644
--- a/src/vnet/gre/node.c
+++ b/src/vnet/gre/node.c
@@ -77,7 +77,7 @@ gre_input (vlib_main_t * vm,
u32 cached_tunnel_sw_if_index = ~0, tunnel_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 len;
vnet_interface_main_t *im = &gm->vnet_main->interface_main;
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index d556f0a9310..fd8559d9986 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -121,7 +121,7 @@ ip4_load_balance (vlib_main_t * vm,
vlib_combined_counter_main_t *cm = &load_balance_main.lbm_via_counters;
u32 n_left_from, n_left_to_next, *from, *to_next;
ip_lookup_next_t next;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -2082,7 +2082,7 @@ ip4_rewrite_inline (vlib_main_t * vm,
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
diff --git a/src/vnet/ip/ip4_forward.h b/src/vnet/ip/ip4_forward.h
index 553a0536c6c..b1294fdf2c3 100644
--- a/src/vnet/ip/ip4_forward.h
+++ b/src/vnet/ip/ip4_forward.h
@@ -60,7 +60,7 @@ ip4_lookup_inline (vlib_main_t * vm,
vlib_combined_counter_main_t *cm = &load_balance_main.lbm_to_counters;
u32 n_left_from, n_left_to_next, *from, *to_next;
ip_lookup_next_t next;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
diff --git a/src/vnet/ip/ip4_input.c b/src/vnet/ip/ip4_input.c
index 1ecd43b7139..15c2ebf5609 100644
--- a/src/vnet/ip/ip4_input.c
+++ b/src/vnet/ip/ip4_input.c
@@ -90,7 +90,8 @@ ip4_input_set_next (u32 sw_if_index, vlib_buffer_t * b, int arc_enabled)
}
static_always_inline void
-ip4_input_check_sw_if_index (vlib_simple_counter_main_t * cm, u32 sw_if_index,
+ip4_input_check_sw_if_index (vlib_main_t * vm,
+ vlib_simple_counter_main_t * cm, u32 sw_if_index,
u32 * last_sw_if_index, u32 * cnt,
int *arc_enabled)
{
@@ -103,7 +104,7 @@ ip4_input_check_sw_if_index (vlib_simple_counter_main_t * cm, u32 sw_if_index,
return;
}
- thread_index = vlib_get_thread_index ();
+ thread_index = vm->thread_index;
if (*cnt)
vlib_increment_simple_counter (cm, thread_index, *last_sw_if_index, *cnt);
*cnt = 1;
@@ -125,7 +126,7 @@ ip4_input_inline (vlib_main_t * vm,
{
vnet_main_t *vnm = vnet_get_main ();
u32 n_left_from, *from;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
vlib_node_runtime_t *error_node =
vlib_node_get_runtime (vm, ip4_input_node.index);
vlib_simple_counter_main_t *cm;
@@ -206,14 +207,14 @@ ip4_input_inline (vlib_main_t * vm,
}
else
{
- ip4_input_check_sw_if_index (cm, sw_if_index[0], &last_sw_if_index,
- &cnt, &arc_enabled);
- ip4_input_check_sw_if_index (cm, sw_if_index[1], &last_sw_if_index,
- &cnt, &arc_enabled);
- ip4_input_check_sw_if_index (cm, sw_if_index[2], &last_sw_if_index,
- &cnt, &arc_enabled);
- ip4_input_check_sw_if_index (cm, sw_if_index[3], &last_sw_if_index,
- &cnt, &arc_enabled);
+ ip4_input_check_sw_if_index (vm, cm, sw_if_index[0],
+ &last_sw_if_index, &cnt, &arc_enabled);
+ ip4_input_check_sw_if_index (vm, cm, sw_if_index[1],
+ &last_sw_if_index, &cnt, &arc_enabled);
+ ip4_input_check_sw_if_index (vm, cm, sw_if_index[2],
+ &last_sw_if_index, &cnt, &arc_enabled);
+ ip4_input_check_sw_if_index (vm, cm, sw_if_index[3],
+ &last_sw_if_index, &cnt, &arc_enabled);
next[0] = ip4_input_set_next (sw_if_index[0], b[0], 1);
next[1] = ip4_input_set_next (sw_if_index[1], b[1], 1);
@@ -238,7 +239,7 @@ ip4_input_inline (vlib_main_t * vm,
u32 next0;
vnet_buffer (b[0])->ip.adj_index[VLIB_RX] = ~0;
sw_if_index[0] = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
- ip4_input_check_sw_if_index (cm, sw_if_index[0], &last_sw_if_index,
+ ip4_input_check_sw_if_index (vm, cm, sw_if_index[0], &last_sw_if_index,
&cnt, &arc_enabled);
next0 = ip4_input_set_next (sw_if_index[0], b[0], arc_enabled);
ip[0] = vlib_buffer_get_current (b[0]);
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 343d348df0c..41f5b151a09 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -529,7 +529,7 @@ ip6_load_balance (vlib_main_t * vm,
vlib_combined_counter_main_t *cm = &load_balance_main.lbm_via_counters;
u32 n_left_from, n_left_to_next, *from, *to_next;
ip_lookup_next_t next;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
ip6_main_t *im = &ip6_main;
from = vlib_frame_vector_args (frame);
@@ -1594,7 +1594,7 @@ ip6_rewrite_inline (vlib_main_t * vm,
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
diff --git a/src/vnet/ip/ip6_forward.h b/src/vnet/ip/ip6_forward.h
index fcdcabd1e00..44744c0c77b 100644
--- a/src/vnet/ip/ip6_forward.h
+++ b/src/vnet/ip/ip6_forward.h
@@ -59,7 +59,7 @@ ip6_lookup_inline (vlib_main_t * vm,
vlib_combined_counter_main_t *cm = &load_balance_main.lbm_to_counters;
u32 n_left_from, n_left_to_next, *from, *to_next;
ip_lookup_next_t next;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
diff --git a/src/vnet/ip/ip6_input.c b/src/vnet/ip/ip6_input.c
index 3b38d347e6e..6a7669db297 100644
--- a/src/vnet/ip/ip6_input.c
+++ b/src/vnet/ip/ip6_input.c
@@ -73,7 +73,7 @@ ip6_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vlib_node_runtime_t *error_node =
vlib_node_get_runtime (vm, ip6_input_node.index);
vlib_simple_counter_main_t *cm;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index a929a0cdf00..096b2ebfbda 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -577,7 +577,7 @@ run_ping_ip46_address (vlib_main_t * vm, u32 table_id, ip4_address_t * pa4,
pool_get (pm->ping_runs, pr);
ping_run_index = pr - pm->ping_runs;
pr->cli_process_id = curr_proc;
- pr->cli_thread_index = vlib_get_thread_index ();
+ pr->cli_thread_index = vm->thread_index;
pr->icmp_id = icmp_id;
hash_set (pm->ping_run_by_icmp_id, icmp_id, ping_run_index);
for (i = 1; i <= ping_repeat; i++)
diff --git a/src/vnet/ipip/node.c b/src/vnet/ipip/node.c
index f24ea97b2cd..d55b91a0b93 100644
--- a/src/vnet/ipip/node.c
+++ b/src/vnet/ipip/node.c
@@ -65,7 +65,7 @@ ipip_input (vlib_main_t * vm, vlib_node_runtime_t * node,
ipip_main_t *gm = &ipip_main;
u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
u32 tunnel_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 len;
vnet_interface_main_t *im = &gm->vnet_main->interface_main;
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index 5f633011491..4291e946b36 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -88,11 +88,11 @@ format_esp_encrypt_trace (u8 * s, va_list * args)
}
always_inline void
-esp_encrypt_cbc (ipsec_crypto_alg_t alg,
+esp_encrypt_cbc (vlib_main_t * vm, ipsec_crypto_alg_t alg,
u8 * in, u8 * out, size_t in_len, u8 * key, u8 * iv)
{
ipsec_proto_main_t *em = &ipsec_proto_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
EVP_CIPHER_CTX *ctx = em->per_thread_data[thread_index].encrypt_ctx;
#else
@@ -130,7 +130,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
ipsec_main_t *im = &ipsec_main;
ipsec_proto_main_t *em = &ipsec_proto_main;
u32 *recycle = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
ipsec_alloc_empty_buffers (vm, im);
@@ -361,7 +361,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
em->ipsec_proto_main_crypto_algs[sa0->
crypto_alg].iv_size);
- esp_encrypt_cbc (sa0->crypto_alg,
+ esp_encrypt_cbc (vm, sa0->crypto_alg,
(u8 *) vlib_buffer_get_current (i_b0),
(u8 *) vlib_buffer_get_current (o_b0) +
ip_udp_hdr_size + sizeof (esp_header_t) +
diff --git a/src/vnet/ipsec/ipsec.h b/src/vnet/ipsec/ipsec.h
index e457e33944e..d1aedb1af9d 100644
--- a/src/vnet/ipsec/ipsec.h
+++ b/src/vnet/ipsec/ipsec.h
@@ -355,7 +355,7 @@ int ipsec_set_interface_sa (vnet_main_t * vnm, u32 hw_if_index, u32 sa_id,
always_inline void
ipsec_alloc_empty_buffers (vlib_main_t * vm, ipsec_main_t * im)
{
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
uword l = vec_len (im->empty_buffers[thread_index]);
uword n_alloc = 0;
diff --git a/src/vnet/ipsec/ipsec_if.c b/src/vnet/ipsec/ipsec_if.c
index e950a5e0455..82c2394e5cc 100644
--- a/src/vnet/ipsec/ipsec_if.c
+++ b/src/vnet/ipsec/ipsec_if.c
@@ -78,7 +78,7 @@ ipsec_if_tx_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vnet_interface_main_t *vim = &vnm->interface_main;
u32 *from, *to_next = 0, next_index;
u32 n_left_from, sw_if_index0, last_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 n_bytes = 0, n_packets = 0;
from = vlib_frame_vector_args (from_frame);
diff --git a/src/vnet/ipsec/ipsec_if_in.c b/src/vnet/ipsec/ipsec_if_in.c
index 655668abc1d..bc10f7f5f6c 100644
--- a/src/vnet/ipsec/ipsec_if_in.c
+++ b/src/vnet/ipsec/ipsec_if_in.c
@@ -69,7 +69,7 @@ ipsec_if_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
ipsec_proto_main_t *em = &ipsec_proto_main;
u32 *from, *to_next = 0, next_index;
u32 n_left_from, last_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u64 n_bytes = 0, n_packets = 0;
u8 icv_len;
ipsec_tunnel_if_t *last_t = NULL;
diff --git a/src/vnet/l2tp/l2tp.c b/src/vnet/l2tp/l2tp.c
index 3dedc447152..a59c7893503 100644
--- a/src/vnet/l2tp/l2tp.c
+++ b/src/vnet/l2tp/l2tp.c
@@ -157,7 +157,7 @@ test_counters_command_fn (vlib_main_t * vm,
u32 session_index;
u32 counter_index;
u32 nincr = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
/* *INDENT-OFF* */
pool_foreach (session, lm->sessions,
diff --git a/src/vnet/lisp-gpe/decap.c b/src/vnet/lisp-gpe/decap.c
index e59a353df30..fd3f1751fe1 100644
--- a/src/vnet/lisp-gpe/decap.c
+++ b/src/vnet/lisp-gpe/decap.c
@@ -154,7 +154,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 n_bytes = 0, n_packets = 0, last_sw_if_index = ~0, drops = 0;
lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
- thread_index = vlib_get_thread_index ();
+ thread_index = vm->thread_index;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/vnet/lisp-gpe/interface.c b/src/vnet/lisp-gpe/interface.c
index 84933ec3987..127508331e0 100644
--- a/src/vnet/lisp-gpe/interface.c
+++ b/src/vnet/lisp-gpe/interface.c
@@ -239,7 +239,7 @@ l2_lisp_gpe_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
{
u32 n_left_from, next_index, *from, *to_next;
lisp_gpe_main_t *lgm = &lisp_gpe_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
vlib_combined_counter_main_t *cm = &load_balance_main.lbm_to_counters;
from = vlib_frame_vector_args (from_frame);
diff --git a/src/vnet/srv6/sr_localsid.c b/src/vnet/srv6/sr_localsid.c
index 09c336e70bd..6b1724d46c7 100755
--- a/src/vnet/srv6/sr_localsid.c
+++ b/src/vnet/srv6/sr_localsid.c
@@ -887,7 +887,7 @@ sr_localsid_d_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
next_index = node->cached_next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
@@ -1190,7 +1190,7 @@ sr_localsid_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
next_index = node->cached_next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
while (n_left_from > 0)
{
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 888a6cb844b..96189364b34 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -265,7 +265,7 @@ udp_open_connection (transport_endpoint_t * rmt)
{
udp_main_t *um = vnet_get_udp_main ();
vlib_main_t *vm = vlib_get_main ();
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
udp_connection_t *uc;
ip46_address_t lcl_addr;
u32 node_index;
diff --git a/src/vnet/udp/udp_encap_node.c b/src/vnet/udp/udp_encap_node.c
index 2d37d8b58dd..abf19faa590 100644
--- a/src/vnet/udp/udp_encap_node.c
+++ b/src/vnet/udp/udp_encap_node.c
@@ -67,7 +67,7 @@ udp_encap_inline (vlib_main_t * vm,
vlib_combined_counter_main_t *cm = &udp_encap_counters;
u32 *from = vlib_frame_vector_args (frame);
u32 n_left_from, n_left_to_next, *to_next, next_index;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index e61c91a45a2..4a5628e34fa 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -175,7 +175,7 @@ tapcli_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
tapcli_main_t *tm = &tapcli_main;
tapcli_interface_t *ti;
int i;
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
for (i = 0; i < n_packets; i++)
{
@@ -271,7 +271,7 @@ tapcli_rx_iface (vlib_main_t * vm,
const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
u32 n_trace = vlib_get_trace_count (vm, node);
u8 set_trace = 0;
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
vnet_main_t *vnm;
vnet_sw_interface_t *si;
u8 admin_down;
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 5d785ac6f1c..fc1ecb20abd 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -153,7 +153,7 @@ tuntap_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vnet_interface_main_t *im = &vnm->interface_main;
u32 n_bytes = 0;
int i;
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
for (i = 0; i < n_packets; i++)
{
@@ -243,7 +243,7 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vlib_buffer_t *b;
u32 bi;
const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
- u16 thread_index = vlib_get_thread_index ();
+ u16 thread_index = vm->thread_index;
/** Make sure we have some RX buffers. */
{
diff --git a/src/vnet/vxlan-gpe/decap.c b/src/vnet/vxlan-gpe/decap.c
index cb7c525a5dc..29a043fe9d4 100644
--- a/src/vnet/vxlan-gpe/decap.c
+++ b/src/vnet/vxlan-gpe/decap.c
@@ -117,7 +117,7 @@ vxlan_gpe_input (vlib_main_t * vm,
vxlan4_gpe_tunnel_key_t last_key4;
vxlan6_gpe_tunnel_key_t last_key6;
u32 pkts_decapsulated = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
if (is_ip4)
diff --git a/src/vnet/vxlan-gpe/encap.c b/src/vnet/vxlan-gpe/encap.c
index 71faac59941..c97972bc4e2 100644
--- a/src/vnet/vxlan-gpe/encap.c
+++ b/src/vnet/vxlan-gpe/encap.c
@@ -151,7 +151,7 @@ vxlan_gpe_encap (vlib_main_t * vm,
vnet_main_t *vnm = ngm->vnet_main;
vnet_interface_main_t *im = &vnm->interface_main;
u32 pkts_encapsulated = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
from = vlib_frame_vector_args (from_frame);