aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
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 /src/vnet
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>
Diffstat (limited to 'src/vnet')
-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
36 files changed, 59 insertions, 58 deletions
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);