vppinfra: unify thread_index handling 41/42841/4
authorDamjan Marion <[email protected]>
Sat, 19 Apr 2025 16:51:06 +0000 (18:51 +0200)
committerMohammed HAWARI <[email protected]>
Thu, 24 Apr 2025 13:27:22 +0000 (13:27 +0000)
use typedef for thread_index instead  if u16, u32, uword....

Type: improvement
Change-Id: Ib31a0f918035e07d8f53c46a3d80b9ad8b3df129
Signed-off-by: Damjan Marion <[email protected]>
208 files changed:
src/examples/srv6-sample-localsid/node.c
src/plugins/acl/elog_acl_trace.h
src/plugins/acl/fa_node.h
src/plugins/acl/public_inlines.h
src/plugins/acl/sess_mgmt_node.c
src/plugins/acl/session_inlines.h
src/plugins/adl/ip4_allowlist.c
src/plugins/adl/ip6_allowlist.c
src/plugins/af_packet/node.c
src/plugins/cnat/cnat_types.h
src/plugins/crypto_sw_scheduler/main.c
src/plugins/ct6/ct6.h
src/plugins/dev_armada/pp2/rx.c
src/plugins/dev_octeon/crypto.c
src/plugins/dev_octeon/crypto.h
src/plugins/dpdk/cryptodev/cryptodev.c
src/plugins/dpdk/cryptodev/cryptodev_op_data_path.c
src/plugins/dpdk/cryptodev/cryptodev_raw_data_path.c
src/plugins/dpdk/device/device.c
src/plugins/dpdk/device/dpdk_priv.h
src/plugins/dpdk/device/node.c
src/plugins/geneve/decap.c
src/plugins/geneve/encap.c
src/plugins/gtpu/gtpu_decap.c
src/plugins/gtpu/gtpu_encap.c
src/plugins/hs_apps/echo_client.c
src/plugins/hs_apps/echo_client.h
src/plugins/hs_apps/echo_server.c
src/plugins/hs_apps/http_cli.c
src/plugins/hs_apps/http_client.c
src/plugins/hs_apps/http_client_cli.c
src/plugins/hs_apps/http_tps.c
src/plugins/hs_apps/proxy.c
src/plugins/hs_apps/proxy.h
src/plugins/http/http.c
src/plugins/http/http1.c
src/plugins/http/http2/http2.c
src/plugins/http/http_private.h
src/plugins/http_static/http_static.h
src/plugins/http_static/static_server.c
src/plugins/ikev2/ikev2.c
src/plugins/ikev2/ikev2_priv.h
src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c
src/plugins/l2tp/l2tp.c
src/plugins/lb/lb.c
src/plugins/lb/node.c
src/plugins/lisp/lisp-gpe/decap.c
src/plugins/lisp/lisp-gpe/interface.c
src/plugins/mactime/node.c
src/plugins/map/ip4_map.c
src/plugins/map/ip4_map_t.c
src/plugins/map/ip6_map.c
src/plugins/map/ip6_map_t.c
src/plugins/memif/node.c
src/plugins/netmap/node.c
src/plugins/pppoe/pppoe_cp_node.c
src/plugins/pppoe/pppoe_decap.c
src/plugins/pvti/input.c
src/plugins/pvti/output.c
src/plugins/pvti/pvti.h
src/plugins/quic/quic.c
src/plugins/quic/quic.h
src/plugins/sflow/sflow.c
src/plugins/snort/enqueue.c
src/plugins/srtp/srtp.c
src/plugins/srv6-ad-flow/node.c
src/plugins/srv6-am/node.c
src/plugins/srv6-mobile/node.c
src/plugins/tlsmbedtls/tls_mbedtls.c
src/plugins/tlsopenssl/tls_async.c
src/plugins/tlsopenssl/tls_openssl.c
src/plugins/unittest/tcp_test.c
src/plugins/vhost/vhost_user.c
src/plugins/vhost/vhost_user.h
src/plugins/vhost/vhost_user_output.c
src/plugins/vmxnet3/input.c
src/plugins/vmxnet3/vmxnet3.h
src/plugins/vxlan-gpe/decap.c
src/plugins/vxlan-gpe/encap.c
src/plugins/vxlan/decap.c
src/plugins/vxlan/encap.c
src/plugins/wireguard/wireguard_input.c
src/plugins/wireguard/wireguard_output_tun.c
src/vlib/buffer_funcs.c
src/vlib/counter.h
src/vlib/format.c
src/vlib/global_funcs.h
src/vlib/log.h
src/vlib/main.h
src/vlib/punt_node.c
src/vlib/threads.c
src/vlib/threads.h
src/vlib/unix/input.c
src/vnet/adj/adj_l2.c
src/vnet/adj/adj_nsh.c
src/vnet/bier/bier_lookup.c
src/vnet/bier/bier_output.c
src/vnet/bonding/cli.c
src/vnet/bonding/device.c
src/vnet/bonding/node.c
src/vnet/buffer.h
src/vnet/classify/vnet_classify.c
src/vnet/crypto/crypto.h
src/vnet/crypto/node.c
src/vnet/dev/bus/pci.c
src/vnet/dev/dev.h
src/vnet/dev/runtime.c
src/vnet/devices/devices.h
src/vnet/devices/virtio/node.c
src/vnet/dpo/interface_rx_dpo.c
src/vnet/dpo/lookup_dpo.c
src/vnet/dpo/replicate_dpo.c
src/vnet/ethernet/interface.c
src/vnet/ethernet/node.c
src/vnet/ethernet/p2p_ethernet_input.c
src/vnet/gso/node.c
src/vnet/interface.h
src/vnet/interface/rx_queue.c
src/vnet/interface/rx_queue_funcs.h
src/vnet/interface/tx_queue.c
src/vnet/interface/tx_queue_funcs.h
src/vnet/interface_api.c
src/vnet/interface_cli.c
src/vnet/interface_funcs.h
src/vnet/interface_test.c
src/vnet/ip-neighbor/ip4_neighbor.c
src/vnet/ip-neighbor/ip4_neighbor.h
src/vnet/ip-neighbor/ip6_neighbor.c
src/vnet/ip-neighbor/ip6_neighbor.h
src/vnet/ip-neighbor/ip_neighbor.c
src/vnet/ip-neighbor/ip_neighbor.h
src/vnet/ip/icmp4.c
src/vnet/ip/icmp6.c
src/vnet/ip/ip4_forward.c
src/vnet/ip/ip4_forward.h
src/vnet/ip/ip4_input.c
src/vnet/ip/ip6_forward.c
src/vnet/ip/ip6_forward.h
src/vnet/ip/ip6_input.c
src/vnet/ip/punt_node.c
src/vnet/ip/reass/ip4_full_reass.c
src/vnet/ip/reass/ip4_sv_reass.c
src/vnet/ip/reass/ip6_sv_reass.c
src/vnet/ipfix-export/flow_report.c
src/vnet/ipfix-export/flow_report.h
src/vnet/ipip/node.c
src/vnet/ipsec/ah.h
src/vnet/ipsec/ah_decrypt.c
src/vnet/ipsec/esp.h
src/vnet/ipsec/esp_decrypt.c
src/vnet/ipsec/esp_encrypt.c
src/vnet/ipsec/ipsec.h
src/vnet/ipsec/ipsec_api.c
src/vnet/ipsec/ipsec_input.c
src/vnet/ipsec/ipsec_sa.c
src/vnet/ipsec/ipsec_sa.h
src/vnet/ipsec/ipsec_tun_in.c
src/vnet/l2/l2_flood.c
src/vnet/mpls/mpls_input.c
src/vnet/mpls/mpls_lookup.c
src/vnet/policer/police.h
src/vnet/policer/police_inlines.h
src/vnet/session/application.c
src/vnet/session/application.h
src/vnet/session/application_local.c
src/vnet/session/application_worker.c
src/vnet/session/segment_manager.c
src/vnet/session/segment_manager.h
src/vnet/session/session.c
src/vnet/session/session.h
src/vnet/session/session_api.c
src/vnet/session/session_cli.c
src/vnet/session/session_input.c
src/vnet/session/session_lookup.c
src/vnet/session/session_lookup.h
src/vnet/session/session_node.c
src/vnet/session/session_types.h
src/vnet/session/transport.c
src/vnet/session/transport.h
src/vnet/session/transport_types.h
src/vnet/srv6/sr_localsid.c
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp.h
src/vnet/tcp/tcp_cubic.c
src/vnet/tcp/tcp_inlines.h
src/vnet/tcp/tcp_input.c
src/vnet/tcp/tcp_output.c
src/vnet/tls/tls.c
src/vnet/tls/tls.h
src/vnet/tls/tls_inlines.h
src/vnet/udp/udp.c
src/vnet/udp/udp.h
src/vnet/udp/udp_encap_node.c
src/vnet/udp/udp_input.c
src/vnet/udp/udp_output.c
src/vnet/unix/tuntap.c
src/vnet/util/refcount.c
src/vnet/util/refcount.h
src/vnet/util/throttle.h
src/vppinfra/CMakeLists.txt
src/vppinfra/bihash_template.c
src/vppinfra/bitmap.h
src/vppinfra/file.h
src/vppinfra/os.h
src/vppinfra/smp.h [deleted file]
src/vppinfra/socket.c
src/vppinfra/types.h
src/vppinfra/unix-misc.c

index e3a3259..4d72749 100644 (file)
@@ -173,7 +173,7 @@ srv6_localsid_sample_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_fram
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
   next_index = node->cached_next_index;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   while (n_left_from > 0)
   {
index 0c4f68f..ae2ef85 100644 (file)
 
 /* use like: elog_acl_cond_trace_X1(am, (x < 0), "foobar: %d", "i4", int32_value); */
 
-#define elog_acl_cond_trace_X1(am, trace_cond, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1)              \
-do {                                                                                                                     \
-  if (trace_cond) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1)]; } *static_check);                               \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_cond_trace_X1(am, trace_cond, acl_elog_trace_format_label,   \
+                              acl_elog_trace_format_args, acl_elog_val1)     \
+  do                                                                          \
+    {                                                                         \
+      if (trace_cond)                                                         \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1)];                  \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 /* use like: elog_acl_cond_trace_X2(am, (x<0), "foobar: %d some u64: %lu", "i4i8", int32_value, int64_value); */
 
-#define elog_acl_cond_trace_X2(am, trace_cond, acl_elog_trace_format_label, acl_elog_trace_format_args,                             \
-                                                                                           acl_elog_val1, acl_elog_val2) \
-do {                                                                                                                     \
-  if (trace_cond) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1) - sizeof(acl_elog_val2)]; } *static_check);       \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-        typeof(acl_elog_val2) val2;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-    ed->val2 = acl_elog_val2;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_cond_trace_X2(am, trace_cond, acl_elog_trace_format_label,   \
+                              acl_elog_trace_format_args, acl_elog_val1,     \
+                              acl_elog_val2)                                 \
+  do                                                                          \
+    {                                                                         \
+      if (trace_cond)                                                         \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1) -                  \
+                              sizeof (acl_elog_val2)];                       \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+           typeof (acl_elog_val2) val2;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+         ed->val2 = acl_elog_val2;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 /* use like: elog_acl_cond_trace_X3(am, (x<0), "foobar: %d some u64 %lu baz: %d", "i4i8i4", int32_value, u64_value, int_value); */
 
-#define elog_acl_cond_trace_X3(am, trace_cond, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1,              \
-                                                                                           acl_elog_val2, acl_elog_val3) \
-do {                                                                                                                     \
-  if (trace_cond) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1) - sizeof(acl_elog_val2)                           \
-                                               - sizeof(acl_elog_val3)]; } *static_check);                               \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-        typeof(acl_elog_val2) val2;                                                                                      \
-        typeof(acl_elog_val3) val3;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-    ed->val2 = acl_elog_val2;                                                                                            \
-    ed->val3 = acl_elog_val3;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_cond_trace_X3(am, trace_cond, acl_elog_trace_format_label,   \
+                              acl_elog_trace_format_args, acl_elog_val1,     \
+                              acl_elog_val2, acl_elog_val3)                  \
+  do                                                                          \
+    {                                                                         \
+      if (trace_cond)                                                         \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1) -                  \
+                              sizeof (acl_elog_val2) -                       \
+                              sizeof (acl_elog_val3)];                       \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+           typeof (acl_elog_val2) val2;                                      \
+           typeof (acl_elog_val3) val3;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+         ed->val2 = acl_elog_val2;                                           \
+         ed->val3 = acl_elog_val3;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 /* use like: elog_acl_cond_trace_X4(am, (x<0), "foobar: %d some int %d baz: %d bar: %d", "i4i4i4i4", int32_value, int32_value2, int_value, int_value); */
 
-#define elog_acl_cond_trace_X4(am, trace_cond, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1,              \
-                                                                            acl_elog_val2, acl_elog_val3, acl_elog_val4) \
-do {                                                                                                                     \
-  if (trace_cond) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1) - sizeof(acl_elog_val2)                           \
-                                               - sizeof(acl_elog_val3) -sizeof(acl_elog_val4)]; } *static_check);        \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-        typeof(acl_elog_val2) val2;                                                                                      \
-        typeof(acl_elog_val3) val3;                                                                                      \
-        typeof(acl_elog_val4) val4;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-    ed->val2 = acl_elog_val2;                                                                                            \
-    ed->val3 = acl_elog_val3;                                                                                            \
-    ed->val4 = acl_elog_val4;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_cond_trace_X4(am, trace_cond, acl_elog_trace_format_label,   \
+                              acl_elog_trace_format_args, acl_elog_val1,     \
+                              acl_elog_val2, acl_elog_val3, acl_elog_val4)   \
+  do                                                                          \
+    {                                                                         \
+      if (trace_cond)                                                         \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1) -                  \
+                              sizeof (acl_elog_val2) -                       \
+                              sizeof (acl_elog_val3) -                       \
+                              sizeof (acl_elog_val4)];                       \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+           typeof (acl_elog_val2) val2;                                      \
+           typeof (acl_elog_val3) val3;                                      \
+           typeof (acl_elog_val4) val4;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+         ed->val2 = acl_elog_val2;                                           \
+         ed->val3 = acl_elog_val3;                                           \
+         ed->val4 = acl_elog_val4;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 #endif
index c4a971a..f1ea8df 100644 (file)
@@ -110,7 +110,7 @@ typedef struct {
     u8 as_u8[2];
     u16 as_u16;
   } tcp_flags_seen; ;     /* +2 bytes = 62 */
-  u16 thread_index;          /* +2 bytes = 64 */
+  clib_thread_index_t thread_index; /* +2 bytes = 64 */
   u64 link_enqueue_time;  /* 8 byte = 8 */
   u32 link_prev_idx;      /* +4 bytes = 12 */
   u32 link_next_idx;      /* +4 bytes = 16 */
@@ -133,7 +133,7 @@ typedef struct {
     u64 as_u64;
     struct {
       u32 session_index;
-      u16 thread_index;
+      clib_thread_index_t thread_index;
       u16 intf_policy_epoch;
     };
   };
@@ -255,119 +255,143 @@ u8 *format_acl_plugin_5tuple (u8 * s, va_list * args);
 
 /* use like: elog_acl_maybe_trace_X1(am, "foobar: %d", "i4", int32_value); */
 
-#define elog_acl_maybe_trace_X1(am, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1)              \
-do {                                                                                                                     \
-  if (am->trace_sessions) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1)]; } *static_check);                               \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_maybe_trace_X1(am, acl_elog_trace_format_label,              \
+                               acl_elog_trace_format_args, acl_elog_val1)    \
+  do                                                                          \
+    {                                                                         \
+      if (am->trace_sessions)                                                 \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1)];                  \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 /* use like: elog_acl_maybe_trace_X2(am, "foobar: %d some u64: %lu", "i4i8", int32_value, int64_value); */
 
-#define elog_acl_maybe_trace_X2(am, acl_elog_trace_format_label, acl_elog_trace_format_args,                             \
-                                                                                           acl_elog_val1, acl_elog_val2) \
-do {                                                                                                                     \
-  if (am->trace_sessions) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1) - sizeof(acl_elog_val2)]; } *static_check);       \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-        typeof(acl_elog_val2) val2;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-    ed->val2 = acl_elog_val2;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_maybe_trace_X2(am, acl_elog_trace_format_label,              \
+                               acl_elog_trace_format_args, acl_elog_val1,    \
+                               acl_elog_val2)                                \
+  do                                                                          \
+    {                                                                         \
+      if (am->trace_sessions)                                                 \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1) -                  \
+                              sizeof (acl_elog_val2)];                       \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+           typeof (acl_elog_val2) val2;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+         ed->val2 = acl_elog_val2;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 /* use like: elog_acl_maybe_trace_X3(am, "foobar: %d some u64 %lu baz: %d", "i4i8i4", int32_value, u64_value, int_value); */
 
-#define elog_acl_maybe_trace_X3(am, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1,              \
-                                                                                           acl_elog_val2, acl_elog_val3) \
-do {                                                                                                                     \
-  if (am->trace_sessions) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1) - sizeof(acl_elog_val2)                           \
-                                               - sizeof(acl_elog_val3)]; } *static_check);                               \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-        typeof(acl_elog_val2) val2;                                                                                      \
-        typeof(acl_elog_val3) val3;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-    ed->val2 = acl_elog_val2;                                                                                            \
-    ed->val3 = acl_elog_val3;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_maybe_trace_X3(am, acl_elog_trace_format_label,              \
+                               acl_elog_trace_format_args, acl_elog_val1,    \
+                               acl_elog_val2, acl_elog_val3)                 \
+  do                                                                          \
+    {                                                                         \
+      if (am->trace_sessions)                                                 \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1) -                  \
+                              sizeof (acl_elog_val2) -                       \
+                              sizeof (acl_elog_val3)];                       \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+           typeof (acl_elog_val2) val2;                                      \
+           typeof (acl_elog_val3) val3;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+         ed->val2 = acl_elog_val2;                                           \
+         ed->val3 = acl_elog_val3;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 /* use like: elog_acl_maybe_trace_X4(am, "foobar: %d some int %d baz: %d bar: %d", "i4i4i4i4", int32_value, int32_value2, int_value, int_value); */
 
-#define elog_acl_maybe_trace_X4(am, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1,              \
-                                                                            acl_elog_val2, acl_elog_val3, acl_elog_val4) \
-do {                                                                                                                     \
-  if (am->trace_sessions) {                                                                                              \
-    CLIB_UNUSED(struct { u8 available_space[18 - sizeof(acl_elog_val1) - sizeof(acl_elog_val2)                           \
-                                               - sizeof(acl_elog_val3) -sizeof(acl_elog_val4)]; } *static_check);        \
-    u16 thread_index = os_get_thread_index ();                                                                           \
-    vlib_worker_thread_t * w = vlib_worker_threads + thread_index;                                                       \
-    ELOG_TYPE_DECLARE (e) =                                                                                              \
-      {                                                                                                                  \
-        .format = "(%02d) " acl_elog_trace_format_label,                                                                 \
-        .format_args = "i2" acl_elog_trace_format_args,                                                                  \
-      };                                                                                                                 \
-    CLIB_PACKED(struct                                                                                                   \
-      {                                                                                                                  \
-        u16 thread;                                                                                                      \
-        typeof(acl_elog_val1) val1;                                                                                      \
-        typeof(acl_elog_val2) val2;                                                                                      \
-        typeof(acl_elog_val3) val3;                                                                                      \
-        typeof(acl_elog_val4) val4;                                                                                      \
-      }) *ed;                                                                                                            \
-    ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);                                                \
-    ed->thread = thread_index;                                                                                           \
-    ed->val1 = acl_elog_val1;                                                                                            \
-    ed->val2 = acl_elog_val2;                                                                                            \
-    ed->val3 = acl_elog_val3;                                                                                            \
-    ed->val4 = acl_elog_val4;                                                                                            \
-  }                                                                                                                      \
-} while (0)
-
+#define elog_acl_maybe_trace_X4(am, acl_elog_trace_format_label,              \
+                               acl_elog_trace_format_args, acl_elog_val1,    \
+                               acl_elog_val2, acl_elog_val3, acl_elog_val4)  \
+  do                                                                          \
+    {                                                                         \
+      if (am->trace_sessions)                                                 \
+       {                                                                     \
+         CLIB_UNUSED (struct {                                               \
+           u8 available_space[18 - sizeof (acl_elog_val1) -                  \
+                              sizeof (acl_elog_val2) -                       \
+                              sizeof (acl_elog_val3) -                       \
+                              sizeof (acl_elog_val4)];                       \
+         } * static_check);                                                  \
+         clib_thread_index_t thread_index = os_get_thread_index ();          \
+         vlib_worker_thread_t *w = vlib_worker_threads + thread_index;       \
+         ELOG_TYPE_DECLARE (e) = {                                           \
+           .format = "(%02d) " acl_elog_trace_format_label,                  \
+           .format_args = "i2" acl_elog_trace_format_args,                   \
+         };                                                                  \
+         CLIB_PACKED (struct {                                               \
+           u16 thread;                                                       \
+           typeof (acl_elog_val1) val1;                                      \
+           typeof (acl_elog_val2) val2;                                      \
+           typeof (acl_elog_val3) val3;                                      \
+           typeof (acl_elog_val4) val4;                                      \
+         }) *                                                                \
+           ed;                                                               \
+         ed =                                                                \
+           ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);  \
+         ed->thread = thread_index;                                          \
+         ed->val1 = acl_elog_val1;                                           \
+         ed->val2 = acl_elog_val2;                                           \
+         ed->val3 = acl_elog_val3;                                           \
+         ed->val4 = acl_elog_val4;                                           \
+       }                                                                     \
+    }                                                                         \
+  while (0)
 
 #endif
index 80edfd6..f392853 100644 (file)
@@ -715,8 +715,10 @@ acl_plugin_match_5tuple_inline_and_count (void *p_acl_main, u32 lc_index,
                                  r_acl_pos_p, r_acl_match_p, r_rule_match_p, trace_bitmap);
   }
   if (PREDICT_TRUE(ret)) {
-         u16 thread_index = os_get_thread_index ();
-         vlib_increment_combined_counter(am->combined_acl_counters + *r_acl_match_p, thread_index, *r_rule_match_p, 1, packet_size);
+    clib_thread_index_t thread_index = os_get_thread_index ();
+    vlib_increment_combined_counter (
+      am->combined_acl_counters + *r_acl_match_p, thread_index,
+      *r_rule_match_p, 1, packet_size);
   }
   return ret;
 }
index 418baef..10f0e92 100644 (file)
@@ -136,16 +136,17 @@ fa_session_get_list_timeout (acl_main_t * am, fa_session_t * sess)
 }
 
 static u64
-acl_fa_get_list_head_expiry_time (acl_main_t * am,
-                                 acl_fa_per_worker_data_t * pw, u64 now,
-                                 u16 thread_index, int timeout_type)
+acl_fa_get_list_head_expiry_time (acl_main_t *am, acl_fa_per_worker_data_t *pw,
+                                 u64 now, clib_thread_index_t thread_index,
+                                 int timeout_type)
 {
   return pw->fa_conn_list_head_expiry_time[timeout_type];
 }
 
 static int
-acl_fa_conn_time_to_check (acl_main_t * am, acl_fa_per_worker_data_t * pw,
-                          u64 now, u16 thread_index, u32 session_index)
+acl_fa_conn_time_to_check (acl_main_t *am, acl_fa_per_worker_data_t *pw,
+                          u64 now, clib_thread_index_t thread_index,
+                          u32 session_index)
 {
   if (session_index == FA_SESSION_BOGUS_INDEX)
     return 0;
@@ -162,7 +163,8 @@ acl_fa_conn_time_to_check (acl_main_t * am, acl_fa_per_worker_data_t * pw,
  * return the total number of sessions reclaimed.
  */
 static int
-acl_fa_check_idle_sessions (acl_main_t * am, u16 thread_index, u64 now)
+acl_fa_check_idle_sessions (acl_main_t *am, clib_thread_index_t thread_index,
+                           u64 now)
 {
   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
   fa_full_session_id_t fsid;
@@ -429,7 +431,7 @@ acl_fa_worker_conn_cleaner_process (vlib_main_t * vm,
 {
   acl_main_t *am = &acl_main;
   u64 now = clib_cpu_time_now ();
-  u16 thread_index = os_get_thread_index ();
+  clib_thread_index_t thread_index = os_get_thread_index ();
   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
   int num_expired;
   elog_acl_maybe_trace_X1 (am,
index edc8a70..c981940 100644 (file)
@@ -115,16 +115,16 @@ fa_session_get_timeout (acl_main_t * am, fa_session_t * sess)
 }
 
 always_inline fa_session_t *
-get_session_ptr_no_check (acl_main_t * am, u16 thread_index,
+get_session_ptr_no_check (acl_main_t *am, clib_thread_index_t thread_index,
                          u32 session_index)
 {
   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
   return pool_elt_at_index (pw->fa_sessions_pool, session_index);
 }
 
-
 always_inline fa_session_t *
-get_session_ptr (acl_main_t * am, u16 thread_index, u32 session_index)
+get_session_ptr (acl_main_t *am, clib_thread_index_t thread_index,
+                u32 session_index)
 {
   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
 
@@ -135,7 +135,8 @@ get_session_ptr (acl_main_t * am, u16 thread_index, u32 session_index)
 }
 
 always_inline int
-is_valid_session_ptr (acl_main_t * am, u16 thread_index, fa_session_t * sess)
+is_valid_session_ptr (acl_main_t *am, clib_thread_index_t thread_index,
+                     fa_session_t *sess)
 {
   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
   return ((sess != 0)
@@ -470,10 +471,10 @@ acl_fa_can_add_session (acl_main_t * am, int is_input, u32 sw_if_index)
          am->fa_conn_table_max_entries);
 }
 
-
 always_inline void
-acl_fa_try_recycle_session (acl_main_t * am, int is_input, u16 thread_index,
-                           u32 sw_if_index, u64 now)
+acl_fa_try_recycle_session (acl_main_t *am, int is_input,
+                           clib_thread_index_t thread_index, u32 sw_if_index,
+                           u64 now)
 {
   /* try to recycle a TCP transient session */
   acl_fa_per_worker_data_t *pw = &am->per_worker_data[thread_index];
index 4c75572..a44cb51 100644 (file)
@@ -58,7 +58,7 @@ VLIB_NODE_FN (ip4_adl_allowlist_node) (vlib_main_t * vm,
   adl_feature_type_t next_index;
   adl_main_t *cm = &adl_main;
   vlib_combined_counter_main_t * vcm = &load_balance_main.lbm_via_counters;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 allowed_packets;
 
   from = vlib_frame_vector_args (frame);
index 5f38484..f9d9646 100644 (file)
@@ -58,7 +58,7 @@ VLIB_NODE_FN (ip6_adl_allowlist_node) (vlib_main_t * vm,
   adl_feature_type_t next_index;
   adl_main_t *cm = &adl_main;
   vlib_combined_counter_main_t * vcm = &load_balance_main.lbm_via_counters;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 allowed_packets;
 
   from = vlib_frame_vector_args (frame);
index 279f11c..e60a037 100644 (file)
@@ -269,7 +269,7 @@ af_packet_v3_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
   u32 block_nr = rx_queue->rx_req->req3.tp_block_nr;
   u8 *block_start = 0;
   uword n_trace = vlib_get_trace_count (vm, node);
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 n_buffer_bytes = vlib_buffer_get_default_data_size (vm);
   u32 min_bufs = rx_queue->rx_req->req3.tp_frame_size / n_buffer_bytes;
   u32 num_pkts = 0;
@@ -571,7 +571,7 @@ af_packet_v2_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
   u32 frame_num = rx_queue->rx_req->req.tp_frame_nr;
   u8 *block_start = rx_queue->rx_ring[block];
   uword n_trace = vlib_get_trace_count (vm, node);
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 n_buffer_bytes = vlib_buffer_get_default_data_size (vm);
   u32 min_bufs = rx_queue->rx_req->req.tp_frame_size / n_buffer_bytes;
   u32 sw_if_index = apif->sw_if_index;
index d229d21..37eb62e 100644 (file)
@@ -192,7 +192,7 @@ typedef struct cnat_timestamp_mpool_t_
 typedef struct cnat_node_ctx_
 {
   f64 now;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   ip_address_family_t af;
   u8 do_trace;
 } cnat_node_ctx_t;
index dc97ce9..bb1505a 100644 (file)
@@ -446,7 +446,7 @@ convert_async_crypto_id (vnet_crypto_op_id_t async_op_id, u32 *crypto_op,
 
 static_always_inline vnet_crypto_async_frame_t *
 crypto_sw_scheduler_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
-                            u32 *enqueue_thread_idx)
+                            clib_thread_index_t *enqueue_thread_idx)
 {
   crypto_sw_scheduler_main_t *cm = &crypto_sw_scheduler_main;
   crypto_sw_scheduler_per_thread_data_t *ptd =
index 0b7deb0..a691917 100644 (file)
@@ -46,7 +46,7 @@ typedef CLIB_PACKED (struct
 typedef struct
 {
   ct6_session_key_t key;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 next_index;
   u32 prev_index;
   u32 hits;
@@ -95,7 +95,7 @@ static inline void
 ct6_lru_remove (ct6_main_t * cmp, ct6_session_t * s0)
 {
   ct6_session_t *next_sess, *prev_sess;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 s0_index;
 
   thread_index = s0->thread_index;
@@ -128,7 +128,7 @@ static inline void
 ct6_lru_add (ct6_main_t * cmp, ct6_session_t * s0, f64 now)
 {
   ct6_session_t *next_sess;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 s0_index;
 
   s0->hits++;
index 4e73882..8eff72d 100644 (file)
@@ -208,7 +208,7 @@ mrvl_pp2_rx_refill (vlib_main_t *vm, vlib_node_runtime_t *node,
   vnet_dev_port_t *port = rxq->port;
   vnet_dev_t *dev = port->dev;
   mvpp2_device_t *md = vnet_dev_get_data (dev);
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   struct pp2_hif *hif = md->hif[thread_index];
   struct pp2_bpool *bpool = md->thread[thread_index].bpool;
   struct buff_release_entry *bre = md->thread[thread_index].bre;
index 52c7960..49b6f61 100644 (file)
@@ -1827,7 +1827,7 @@ oct_crypto_enqueue_aead_aad_0_dec (vlib_main_t *vm,
 
 vnet_crypto_async_frame_t *
 oct_crypto_frame_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
-                         u32 *enqueue_thread_idx)
+                         clib_thread_index_t *enqueue_thread_idx)
 {
   oct_crypto_main_t *ocm = &oct_crypto_main;
   u32 deq_head, status = VNET_CRYPTO_OP_STATUS_COMPLETED;
index 4d8c56a..a99ee12 100644 (file)
@@ -211,9 +211,9 @@ int oct_crypto_enqueue_aead_aad_12_dec (vlib_main_t *vm,
                                        vnet_crypto_async_frame_t *frame);
 int oct_crypto_enqueue_aead_aad_0_dec (vlib_main_t *vm,
                                       vnet_crypto_async_frame_t *frame);
-vnet_crypto_async_frame_t *oct_crypto_frame_dequeue (vlib_main_t *vm,
-                                                    u32 *nb_elts_processed,
-                                                    u32 *enqueue_thread_idx);
+vnet_crypto_async_frame_t *
+oct_crypto_frame_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
+                         clib_thread_index_t *enqueue_thread_idx);
 int oct_init_crypto_engine_handlers (vlib_main_t *vm, vnet_dev_t *dev);
 int oct_conf_sw_queue (vlib_main_t *vm, vnet_dev_t *dev,
                       oct_crypto_dev_t *ocd);
index a8817a1..af69558 100644 (file)
@@ -608,7 +608,7 @@ format_cryptodev_inst (u8 * s, va_list * args)
   cryptodev_main_t *cmt = &cryptodev_main;
   u32 inst = va_arg (*args, u32);
   cryptodev_inst_t *cit = cmt->cryptodev_inst + inst;
-  u32 thread_index = 0;
+  clib_thread_index_t thread_index = 0;
   struct rte_cryptodev_info info;
 
   rte_cryptodev_info_get (cit->dev_id, &info);
@@ -670,7 +670,7 @@ cryptodev_show_cache_rings_fn (vlib_main_t *vm, unformat_input_t *input,
                               vlib_cli_command_t *cmd)
 {
   cryptodev_main_t *cmt = &cryptodev_main;
-  u32 thread_index = 0;
+  clib_thread_index_t thread_index = 0;
   u16 i;
   vec_foreach_index (thread_index, cmt->per_thread_data)
     {
@@ -756,7 +756,7 @@ cryptodev_set_assignment_fn (vlib_main_t * vm, unformat_input_t * input,
   cryptodev_main_t *cmt = &cryptodev_main;
   cryptodev_engine_thread_t *cet;
   unformat_input_t _line_input, *line_input = &_line_input;
-  u32 thread_index, inst_index;
+  clib_thread_index_t thread_index, inst_index;
   u32 thread_present = 0, inst_present = 0;
   clib_error_t *error = 0;
   int ret;
index 8d55e4f..2282ffa 100644 (file)
@@ -461,7 +461,8 @@ error_exit:
 }
 
 static_always_inline u8
-cryptodev_frame_dequeue_internal (vlib_main_t *vm, u32 *enqueue_thread_idx)
+cryptodev_frame_dequeue_internal (vlib_main_t *vm,
+                                 clib_thread_index_t *enqueue_thread_idx)
 {
   cryptodev_main_t *cmt = &cryptodev_main;
   cryptodev_engine_thread_t *cet = cmt->per_thread_data + vm->thread_index;
@@ -563,7 +564,7 @@ cryptodev_enqueue_frame (vlib_main_t *vm, cryptodev_cache_ring_elt_t *ring_elt)
 
 static_always_inline vnet_crypto_async_frame_t *
 cryptodev_frame_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
-                        u32 *enqueue_thread_idx)
+                        clib_thread_index_t *enqueue_thread_idx)
 {
   cryptodev_main_t *cmt = &cryptodev_main;
   vnet_crypto_main_t *cm = &crypto_main;
@@ -670,7 +671,7 @@ cryptodev_register_cop_hdl (vlib_main_t *vm, u32 eidx)
 
   vec_foreach (cet, cmt->per_thread_data)
     {
-      u32 thread_index = cet - cmt->per_thread_data;
+      clib_thread_index_t thread_index = cet - cmt->per_thread_data;
       u32 numa = vlib_get_main_by_index (thread_index)->numa_node;
       name = format (0, "vpp_cop_pool_%u_%u", numa, thread_index);
       cet->cop_pool = rte_mempool_create (
index 67ab9c8..40d0a42 100644 (file)
@@ -463,7 +463,8 @@ cryptodev_post_dequeue (void *frame, u32 index, u8 is_op_success)
 }
 
 static_always_inline u8
-cryptodev_raw_dequeue_internal (vlib_main_t *vm, u32 *enqueue_thread_idx)
+cryptodev_raw_dequeue_internal (vlib_main_t *vm,
+                               clib_thread_index_t *enqueue_thread_idx)
 {
   cryptodev_main_t *cmt = &cryptodev_main;
   cryptodev_engine_thread_t *cet = cmt->per_thread_data + vm->thread_index;
@@ -537,7 +538,7 @@ cryptodev_enqueue_frame_to_qat (vlib_main_t *vm,
 
 static_always_inline vnet_crypto_async_frame_t *
 cryptodev_raw_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
-                      u32 *enqueue_thread_idx)
+                      clib_thread_index_t *enqueue_thread_idx)
 {
   cryptodev_main_t *cmt = &cryptodev_main;
   vnet_crypto_main_t *cm = &crypto_main;
index 842c838..5fd936d 100644 (file)
@@ -280,7 +280,7 @@ VNET_DEVICE_CLASS_TX_FN (dpdk_device_class) (vlib_main_t * vm,
   u32 n_packets = f->n_vectors;
   u32 n_left;
   u32 n_prep;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   int queue_id = tf->queue_id;
   u8 is_shared = tf->shared_queue;
   u8 offload_enabled = 0;
index 794953d..2067b11 100644 (file)
@@ -50,7 +50,7 @@ dpdk_device_flag_set (dpdk_device_t *xd, __typeof__ (xd->flags) flag, int val)
 void dpdk_counters_xstats_init (dpdk_device_t *xd);
 
 static inline void
-dpdk_get_xstats (dpdk_device_t *xd, u32 thread_index)
+dpdk_get_xstats (dpdk_device_t *xd, clib_thread_index_t thread_index)
 {
   int ret;
   int i;
@@ -101,7 +101,7 @@ static inline void
 dpdk_update_counters (dpdk_device_t * xd, f64 now)
 {
   vnet_main_t *vnm = vnet_get_main ();
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
   clib_memcpy_fast (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
index ca1690b..2f4c10e 100644 (file)
@@ -340,8 +340,9 @@ dpdk_process_lro_offload (dpdk_device_t *xd, dpdk_per_thread_data_t *ptd,
 }
 
 static_always_inline u32
-dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
-                  vlib_node_runtime_t * node, u32 thread_index, u16 queue_id)
+dpdk_device_input (vlib_main_t *vm, dpdk_main_t *dm, dpdk_device_t *xd,
+                  vlib_node_runtime_t *node, clib_thread_index_t thread_index,
+                  u16 queue_id)
 {
   uword n_rx_packets = 0, n_rx_bytes;
   dpdk_rx_queue_t *rxq = vec_elt_at_index (xd->rx_queues, queue_id);
@@ -543,7 +544,7 @@ VLIB_NODE_FN (dpdk_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
   dpdk_device_t *xd;
   uword n_rx_packets = 0;
   vnet_hw_if_rxq_poll_vector_t *pv;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   /*
    * Poll all devices on this cpu for input/interrupts.
index c64121e..3a1de2a 100644 (file)
@@ -79,7 +79,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
 
index 609da22..581c479 100644 (file)
@@ -60,7 +60,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 = vm->thread_index;
+  clib_thread_index_t 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;
index 093d85e..4e0f8bf 100644 (file)
@@ -85,7 +85,7 @@ gtpu_input (vlib_main_t * vm,
   gtpu4_tunnel_key_t last_key4;
   gtpu6_tunnel_key_t last_key6;
   u32 pkts_decapsulated = 0;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
 
   if (is_ip4)
@@ -1838,7 +1838,7 @@ gtpu_flow_input (vlib_main_t * vm,
   vnet_main_t * vnm = gtm->vnet_main;
   vnet_interface_main_t * im = &vnm->interface_main;
   u32 pkts_decapsulated = 0;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
   u8 ip_err0, ip_err1, udp_err0, udp_err1, csum_err0, csum_err1;
 
index 2c3c46a..1caca1d 100644 (file)
@@ -67,7 +67,7 @@ gtpu_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, old_l2 = 0, old_l3 = 0;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
   u32 sw_if_index0 = 0, sw_if_index1 = 0, sw_if_index2 = 0, sw_if_index3 = 0;
   u32 next0 = 0, next1 = 0, next2 = 0, next3 = 0;
index f57fd74..1731244 100644 (file)
@@ -53,7 +53,7 @@ signal_evt_to_cli (int code)
 }
 
 static inline ec_worker_t *
-ec_worker_get (u32 thread_index)
+ec_worker_get (clib_thread_index_t thread_index)
 {
   return vec_elt_at_index (ec_main.wrk, thread_index);
 }
@@ -575,7 +575,7 @@ quic_ec_session_connected_callback (u32 app_index, u32 api_context,
   ec_main_t *ecm = &ec_main;
   ec_session_t *es;
   ec_worker_t *wrk;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   if (PREDICT_FALSE (api_context == HS_CTRL_HANDLE))
     return ec_ctrl_session_connected_callback (s);
@@ -632,7 +632,7 @@ ec_session_connected_callback (u32 app_index, u32 api_context, session_t *s,
 {
   ec_main_t *ecm = &ec_main;
   ec_session_t *es;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   ec_worker_t *wrk;
 
   if (PREDICT_FALSE (ecm->run_test != EC_STARTING))
index d06f237..b8744fe 100644 (file)
@@ -29,7 +29,7 @@ typedef struct ec_session_
   foreach_app_session_field
 #undef _
     u32 vpp_session_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u64 bytes_to_send;
   u64 bytes_sent;
   u64 bytes_to_receive;
@@ -45,7 +45,7 @@ typedef struct ec_worker_
   u32 *conn_indices;           /**< sessions handled by worker */
   u32 *conns_this_batch;       /**< sessions handled in batch */
   svm_msg_q_t *vpp_event_queue; /**< session layer worker mq */
-  u32 thread_index;            /**< thread index for worker */
+  clib_thread_index_t thread_index; /**< thread index for worker */
 } ec_worker_t;
 
 typedef struct
index dc303e2..61b8676 100644 (file)
@@ -40,7 +40,7 @@ typedef struct
   es_session_t *sessions;
   u8 *rx_buf; /**< Per-thread RX buffer */
   svm_msg_q_t *vpp_event_queue;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } es_worker_t;
 
 typedef struct
@@ -87,7 +87,7 @@ echo_server_main_t echo_server_main;
 #define es_cli(_fmt, _args...) vlib_cli_output (vm, _fmt, ##_args)
 
 static inline es_worker_t *
-es_worker_get (u32 thread_index)
+es_worker_get (clib_thread_index_t thread_index)
 {
   return vec_elt_at_index (echo_server_main.wrk, thread_index);
 }
@@ -277,7 +277,7 @@ es_wrk_cleanup_sessions (void *args)
 {
   echo_server_main_t *esm = &echo_server_main;
   vnet_disconnect_args_t _a = {}, *a = &_a;
-  u32 thread_index = pointer_to_uword (args);
+  clib_thread_index_t thread_index = pointer_to_uword (args);
   es_session_t *es;
   es_worker_t *wrk;
 
@@ -373,7 +373,7 @@ echo_server_rx_callback (session_t * s)
   int actual_transfer;
   svm_fifo_t *tx_fifo, *rx_fifo;
   echo_server_main_t *esm = &echo_server_main;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   es_worker_t *wrk;
   es_session_t *es;
 
index 531e275..40acf6a 100644 (file)
@@ -37,7 +37,7 @@ typedef struct
 typedef struct
 {
   u32 hs_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u64 node_index;
   u8 plain_text;
   u8 *buf;
@@ -47,7 +47,7 @@ typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
   u32 session_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u8 *tx_buf;
   u32 tx_offset;
   u32 vpp_session_index;
@@ -85,7 +85,7 @@ typedef struct
 static hcs_main_t hcs_main;
 
 static hcs_session_t *
-hcs_session_alloc (u32 thread_index)
+hcs_session_alloc (clib_thread_index_t thread_index)
 {
   hcs_main_t *hcm = &hcs_main;
   hcs_session_t *hs;
@@ -98,7 +98,7 @@ hcs_session_alloc (u32 thread_index)
 }
 
 static hcs_session_t *
-hcs_session_get (u32 thread_index, u32 hs_index)
+hcs_session_get (clib_thread_index_t thread_index, u32 hs_index)
 {
   hcs_main_t *hcm = &hcs_main;
   if (pool_is_free_index (hcm->sessions[thread_index], hs_index))
index 1cf96cf..578d211 100644 (file)
@@ -22,7 +22,7 @@ typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
   u32 session_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u64 to_recv;
   u8 is_closed;
   hc_stats_t stats;
@@ -35,7 +35,7 @@ typedef struct
 typedef struct
 {
   hc_session_t *sessions;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   vlib_main_t *vlib_main;
   u8 *headers_buf;
   http_headers_ctx_t req_headers;
@@ -98,13 +98,13 @@ static hc_main_t hc_main;
 static hc_stats_t hc_stats;
 
 static inline hc_worker_t *
-hc_worker_get (u32 thread_index)
+hc_worker_get (clib_thread_index_t thread_index)
 {
   return &hc_main.wrk[thread_index];
 }
 
 static inline hc_session_t *
-hc_session_get (u32 session_index, u32 thread_index)
+hc_session_get (u32 session_index, clib_thread_index_t thread_index)
 {
   hc_worker_t *wrk = hc_worker_get (thread_index);
   wrk->vlib_main = vlib_get_main_by_index (thread_index);
index 8df5bfd..b72d4df 100644 (file)
@@ -31,7 +31,7 @@ typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
   u32 session_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 rx_offset;
   u32 vpp_session_index;
   u64 to_recv;
@@ -41,7 +41,7 @@ typedef struct
 typedef struct
 {
   hcc_session_t *sessions;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } hcc_worker_t;
 
 typedef struct
@@ -76,7 +76,7 @@ typedef enum
 static hcc_main_t hcc_main;
 
 static hcc_worker_t *
-hcc_worker_get (u32 thread_index)
+hcc_worker_get (clib_thread_index_t thread_index)
 {
   return vec_elt_at_index (hcc_main.wrk, thread_index);
 }
@@ -92,7 +92,7 @@ hcc_session_alloc (hcc_worker_t *wrk)
 }
 
 static hcc_session_t *
-hcc_session_get (u32 hs_index, u32 thread_index)
+hcc_session_get (u32 hs_index, clib_thread_index_t thread_index)
 {
   hcc_worker_t *wrk = hcc_worker_get (thread_index);
   return pool_elt_at_index (wrk->sessions, hs_index);
index 59a0309..ac6b6c7 100644 (file)
@@ -25,7 +25,7 @@ typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
   u32 session_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u64 data_len;
   u64 data_offset;
   u32 vpp_session_index;
@@ -78,7 +78,7 @@ typedef struct hs_main_
 static hts_main_t hts_main;
 
 static hts_session_t *
-hts_session_alloc (u32 thread_index)
+hts_session_alloc (clib_thread_index_t thread_index)
 {
   hts_main_t *htm = &hts_main;
   hts_session_t *hs;
@@ -92,7 +92,7 @@ hts_session_alloc (u32 thread_index)
 }
 
 static hts_session_t *
-hts_session_get (u32 thread_index, u32 hts_index)
+hts_session_get (clib_thread_index_t thread_index, u32 hts_index)
 {
   hts_main_t *htm = &hts_main;
 
@@ -620,7 +620,7 @@ hts_start_listen (hts_main_t *htm, session_endpoint_cfg_t *sep, u8 *uri,
   u8 need_crypto;
   hts_session_t *hls;
   session_t *ls;
-  u32 thread_index = 0;
+  clib_thread_index_t thread_index = 0;
   int rv;
 
   clib_memset (a, 0, sizeof (*a));
index ca088f4..140183d 100644 (file)
@@ -112,7 +112,8 @@ proxy_do_connect (vnet_connect_args_t *a)
 static void
 proxy_handle_connects_rpc (void *args)
 {
-  u32 thread_index = pointer_to_uword (args), n_connects = 0, n_pending;
+  clib_thread_index_t thread_index = pointer_to_uword (args), n_connects = 0,
+                     n_pending;
   proxy_worker_t *wrk;
   u32 max_connects;
 
index f26f4bf..88b7cdf 100644 (file)
@@ -117,7 +117,7 @@ typedef struct
 extern proxy_main_t proxy_main;
 
 static inline proxy_worker_t *
-proxy_worker_get (u32 thread_index)
+proxy_worker_get (clib_thread_index_t thread_index)
 {
   proxy_main_t *pm = &proxy_main;
   return vec_elt_at_index (pm->workers, thread_index);
index ff32a1f..c7eefcd 100644 (file)
@@ -113,13 +113,13 @@ format_http_time_now (u8 *s, va_list *args)
 }
 
 static inline http_worker_t *
-http_worker_get (u32 thread_index)
+http_worker_get (clib_thread_index_t thread_index)
 {
   return &http_main.wrk[thread_index];
 }
 
 static inline u32
-http_conn_alloc_w_thread (u32 thread_index)
+http_conn_alloc_w_thread (clib_thread_index_t thread_index)
 {
   http_worker_t *wrk = http_worker_get (thread_index);
   http_conn_t *hc;
@@ -129,14 +129,15 @@ http_conn_alloc_w_thread (u32 thread_index)
 }
 
 static inline http_conn_t *
-http_conn_get_w_thread (u32 hc_index, u32 thread_index)
+http_conn_get_w_thread (u32 hc_index, clib_thread_index_t thread_index)
 {
   http_worker_t *wrk = http_worker_get (thread_index);
   return pool_elt_at_index (wrk->conn_pool, hc_index);
 }
 
 static inline http_conn_t *
-http_conn_get_w_thread_if_valid (u32 hc_index, u32 thread_index)
+http_conn_get_w_thread_if_valid (u32 hc_index,
+                                clib_thread_index_t thread_index)
 {
   http_worker_t *wrk = http_worker_get (thread_index);
   if (pool_is_free_index (wrk->conn_pool, hc_index))
@@ -983,7 +984,7 @@ http_stop_listen (u32 listener_index)
 }
 
 static void
-http_transport_close (u32 rh, u32 thread_index)
+http_transport_close (u32 rh, clib_thread_index_t thread_index)
 {
   http_conn_t *hc;
   u32 hc_index;
@@ -1014,7 +1015,7 @@ http_transport_close (u32 rh, u32 thread_index)
 }
 
 static void
-http_transport_reset (u32 rh, u32 thread_index)
+http_transport_reset (u32 rh, clib_thread_index_t thread_index)
 {
   http_conn_t *hc;
   u32 hc_index;
@@ -1037,7 +1038,7 @@ http_transport_reset (u32 rh, u32 thread_index)
 }
 
 static transport_connection_t *
-http_transport_get_connection (u32 rh, u32 thread_index)
+http_transport_get_connection (u32 rh, clib_thread_index_t thread_index)
 {
   http_req_handle_t hr_handle;
 
@@ -1107,7 +1108,7 @@ http_app_rx_evt_cb (transport_connection_t *tc)
 }
 
 static void
-http_transport_get_endpoint (u32 rh, u32 thread_index,
+http_transport_get_endpoint (u32 rh, clib_thread_index_t thread_index,
                             transport_endpoint_t *tep, u8 is_lcl)
 {
   http_conn_t *hc;
@@ -1144,7 +1145,7 @@ static u8 *
 format_http_transport_connection (u8 *s, va_list *args)
 {
   http_req_handle_t rh = va_arg (*args, http_req_handle_t);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   u32 hc_index;
   http_conn_t *hc;
index fbd0d32..5ecc1f5 100644 (file)
@@ -80,7 +80,7 @@ http1_conn_alloc_req (http_conn_t *hc)
 }
 
 always_inline http_req_t *
-http1_req_get (u32 req_index, u32 thread_index)
+http1_req_get (u32 req_index, clib_thread_index_t thread_index)
 {
   http1_main_t *h1m = &http1_main;
 
@@ -88,7 +88,7 @@ http1_req_get (u32 req_index, u32 thread_index)
 }
 
 always_inline http_req_t *
-http1_req_get_if_valid (u32 req_index, u32 thread_index)
+http1_req_get_if_valid (u32 req_index, clib_thread_index_t thread_index)
 {
   http1_main_t *h1m = &http1_main;
 
@@ -1669,7 +1669,8 @@ http1_req_run_state_machine (http_conn_t *hc, http_req_t *req,
 /*****************/
 
 static u32
-http1_hc_index_get_by_req_index (u32 req_index, u32 thread_index)
+http1_hc_index_get_by_req_index (u32 req_index,
+                                clib_thread_index_t thread_index)
 {
   http_req_t *req;
 
@@ -1678,7 +1679,7 @@ http1_hc_index_get_by_req_index (u32 req_index, u32 thread_index)
 }
 
 static transport_connection_t *
-http1_req_get_connection (u32 req_index, u32 thread_index)
+http1_req_get_connection (u32 req_index, clib_thread_index_t thread_index)
 {
   http_req_t *req;
   req = http1_req_get (req_index, thread_index);
@@ -1704,7 +1705,7 @@ static u8 *
 http1_format_req (u8 *s, va_list *args)
 {
   u32 req_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   http_conn_t *hc = va_arg (*args, http_conn_t *);
   u32 verbose = va_arg (*args, u32);
   http_req_t *req;
@@ -1758,7 +1759,8 @@ http1_app_tx_callback (http_conn_t *hc, u32 req_index,
 }
 
 static void
-http1_app_rx_evt_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
+http1_app_rx_evt_callback (http_conn_t *hc, u32 req_index,
+                          clib_thread_index_t thread_index)
 {
   http_req_t *req;
 
@@ -1769,7 +1771,8 @@ http1_app_rx_evt_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
 }
 
 static void
-http1_app_close_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
+http1_app_close_callback (http_conn_t *hc, u32 req_index,
+                         clib_thread_index_t thread_index)
 {
   http_req_t *req;
 
@@ -1794,7 +1797,8 @@ http1_app_close_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
 }
 
 static void
-http1_app_reset_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
+http1_app_reset_callback (http_conn_t *hc, u32 req_index,
+                         clib_thread_index_t thread_index)
 {
   http_req_t *req;
   req = http1_req_get (req_index, thread_index);
index a447dc4..67db185 100644 (file)
@@ -163,7 +163,8 @@ http2_conn_alloc_req (http_conn_t *hc, u32 stream_id)
 }
 
 static inline void
-http2_conn_free_req (http2_conn_ctx_t *h2c, http2_req_t *req, u32 thread_index)
+http2_conn_free_req (http2_conn_ctx_t *h2c, http2_req_t *req,
+                    clib_thread_index_t thread_index)
 {
   http2_main_t *h2m = &http2_main;
 
@@ -202,7 +203,7 @@ http2_conn_get_req (http_conn_t *hc, u32 stream_id)
 }
 
 always_inline http2_req_t *
-http2_req_get (u32 req_index, u32 thread_index)
+http2_req_get (u32 req_index, clib_thread_index_t thread_index)
 {
   http2_main_t *h2m = &http2_main;
 
@@ -990,7 +991,8 @@ http2_expect_preface (http_conn_t *hc, http2_conn_ctx_t *h2c)
 /*****************/
 
 static u32
-http2_hc_index_get_by_req_index (u32 req_index, u32 thread_index)
+http2_hc_index_get_by_req_index (u32 req_index,
+                                clib_thread_index_t thread_index)
 {
   http2_req_t *req;
 
@@ -999,7 +1001,7 @@ http2_hc_index_get_by_req_index (u32 req_index, u32 thread_index)
 }
 
 static transport_connection_t *
-http2_req_get_connection (u32 req_index, u32 thread_index)
+http2_req_get_connection (u32 req_index, clib_thread_index_t thread_index)
 {
   http2_req_t *req;
   req = http2_req_get (req_index, thread_index);
@@ -1026,7 +1028,7 @@ static u8 *
 http2_format_req (u8 *s, va_list *args)
 {
   u32 req_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   http_conn_t *hc = va_arg (*args, http_conn_t *);
   u32 verbose = va_arg (*args, u32);
   http2_req_t *req;
@@ -1097,13 +1099,15 @@ http2_app_tx_callback (http_conn_t *hc, u32 req_index,
 }
 
 static void
-http2_app_rx_evt_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
+http2_app_rx_evt_callback (http_conn_t *hc, u32 req_index,
+                          clib_thread_index_t thread_index)
 {
   /* TODO: continue tunnel RX */
 }
 
 static void
-http2_app_close_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
+http2_app_close_callback (http_conn_t *hc, u32 req_index,
+                         clib_thread_index_t thread_index)
 {
   http2_req_t *req;
 
@@ -1130,7 +1134,8 @@ http2_app_close_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
 }
 
 static void
-http2_app_reset_callback (http_conn_t *hc, u32 req_index, u32 thread_index)
+http2_app_reset_callback (http_conn_t *hc, u32 req_index,
+                         clib_thread_index_t thread_index)
 {
   http2_req_t *req;
 
index 45faece..1f9812d 100644 (file)
@@ -264,18 +264,19 @@ typedef struct http_main_
 typedef struct http_engine_vft_
 {
   const char *name;
-  u32 (*hc_index_get_by_req_index) (u32 req_index, u32 thread_index);
-  transport_connection_t *(*req_get_connection) (u32 req_index,
-                                                u32 thread_index);
+  u32 (*hc_index_get_by_req_index) (u32 req_index,
+                                   clib_thread_index_t thread_index);
+  transport_connection_t *(*req_get_connection) (
+    u32 req_index, clib_thread_index_t thread_index);
   u8 *(*format_req) (u8 *s, va_list *args);
   void (*app_tx_callback) (http_conn_t *hc, u32 req_index,
                           transport_send_params_t *sp);
   void (*app_rx_evt_callback) (http_conn_t *hc, u32 req_index,
-                              u32 thread_index);
+                              clib_thread_index_t thread_index);
   void (*app_close_callback) (http_conn_t *hc, u32 req_index,
-                             u32 thread_index);
+                             clib_thread_index_t thread_index);
   void (*app_reset_callback) (http_conn_t *hc, u32 req_index,
-                             u32 thread_index);
+                             clib_thread_index_t thread_index);
   int (*transport_connected_callback) (http_conn_t *hc);
   void (*transport_rx_callback) (http_conn_t *hc);
   void (*transport_close_callback) (http_conn_t *hc);
index 678fb63..2b5c065 100644 (file)
@@ -39,7 +39,7 @@ typedef struct hss_session_
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
   u32 session_index;
   /** rx thread index */
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   /** vpp session index, handle */
   u32 vpp_session_index;
   session_handle_t vpp_session_handle;
@@ -82,7 +82,7 @@ typedef struct hss_session_handle_
     struct
     {
       u32 session_index;
-      u32 thread_index;
+      clib_thread_index_t thread_index;
     };
     u64 as_u64;
   };
@@ -226,7 +226,8 @@ void hss_register_url_handler (hss_url_handler_fn fp, const char *url,
                               http_req_method_t type);
 void hss_session_send_data (hss_url_handler_args_t *args);
 void hss_builtinurl_json_handlers_init (void);
-hss_session_t *hss_session_get (u32 thread_index, u32 hs_index);
+hss_session_t *hss_session_get (clib_thread_index_t thread_index,
+                               u32 hs_index);
 
 #endif /* __included_http_static_h__ */
 
index 9c5dfba..c62fe46 100644 (file)
@@ -81,7 +81,7 @@ hss_confirm_data_read (hss_session_t *hs, u32 n_last_deq)
 }
 
 static hss_session_t *
-hss_session_alloc (u32 thread_index)
+hss_session_alloc (clib_thread_index_t thread_index)
 {
   hss_main_t *hsm = &hss_main;
   hss_session_t *hs;
@@ -96,7 +96,7 @@ hss_session_alloc (u32 thread_index)
 }
 
 __clib_export hss_session_t *
-hss_session_get (u32 thread_index, u32 hs_index)
+hss_session_get (clib_thread_index_t thread_index, u32 hs_index)
 {
   hss_main_t *hsm = &hss_main;
   if (pool_is_free_index (hsm->sessions[thread_index], hs_index))
index 94de4f8..c8183fe 100644 (file)
@@ -2223,7 +2223,7 @@ ikev2_create_tunnel_interface (vlib_main_t *vm, ikev2_sa_t *sa,
                               ikev2_child_sa_t *child, u32 sa_index,
                               u32 child_index, u8 is_rekey, u8 kex)
 {
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   ikev2_main_t *km = &ikev2_main;
   ipsec_crypto_alg_t encr_type;
   ipsec_integ_alg_t integ_type;
@@ -3190,7 +3190,7 @@ ikev2_node_internal (vlib_main_t *vm, vlib_node_runtime_t *node,
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
   u16 nexts[VLIB_FRAME_SIZE], *next = nexts;
   ikev2_main_per_thread_data_t *ptd = ikev2_get_per_thread_data ();
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   ikev2_stats_t _stats, *stats = &_stats;
   int res;
 
index 2751657..58da36d 100644 (file)
@@ -661,7 +661,7 @@ clib_error_t *ikev2_profile_natt_disable (u8 * name);
 static_always_inline ikev2_main_per_thread_data_t *
 ikev2_get_per_thread_data ()
 {
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   return vec_elt_at_index (ikev2_main.per_thread_data, thread_index);
 }
 #endif /* __included_ikev2_priv_h__ */
index 61476eb..a4deae2 100644 (file)
@@ -646,7 +646,7 @@ vlib_node_registration_t ioam_cache_ts_timer_tick_node;
 
 typedef struct
 {
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } ioam_cache_ts_timer_tick_trace_t;
 
 /* packet trace format function */
@@ -696,7 +696,7 @@ expired_cache_ts_timer_callback (u32 * expired_timers)
   ioam_cache_main_t *cm = &ioam_cache_main;
   int i;
   u32 pool_index;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 count = 0;
 
   for (i = 0; i < vec_len (expired_timers); i++)
index 907468b..cada9dc 100644 (file)
@@ -151,7 +151,7 @@ test_counters_command_fn (vlib_main_t * vm,
   u32 session_index;
   u32 counter_index;
   u32 nincr = 0;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   pool_foreach (session, lm->sessions)
    {
index 7ae1884..0c4f21a 100644 (file)
@@ -108,7 +108,7 @@ u8 *format_lb_main (u8 * s, va_list * args)
   s = format(s, " #vips: %u\n", pool_elts(lbm->vips));
   s = format(s, " #ass: %u\n", pool_elts(lbm->ass) - 1);
 
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   for(thread_index = 0; thread_index < tm->n_vlib_mains; thread_index++ ) {
     lb_hash_t *h = lbm->per_cpu[thread_index].sticky_ht;
     if (h) {
@@ -764,7 +764,7 @@ next:
 int
 lb_flush_vip_as (u32 vip_index, u32 as_index)
 {
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   vlib_thread_main_t *tm = vlib_get_thread_main();
   lb_main_t *lbm = &lb_main;
 
index a37fe11..1ddc556 100644 (file)
@@ -124,7 +124,7 @@ format_lb_nat_trace (u8 * s, va_list * args)
 }
 
 lb_hash_t *
-lb_get_sticky_table (u32 thread_index)
+lb_get_sticky_table (clib_thread_index_t thread_index)
 {
   lb_main_t *lbm = &lb_main;
   lb_hash_t *sticky_ht = lbm->per_cpu[thread_index].sticky_ht;
@@ -282,7 +282,7 @@ lb_node_fn (vlib_main_t * vm,
 {
   lb_main_t *lbm = &lb_main;
   u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 lb_time = lb_hash_time_now (vm);
 
   lb_hash_t *sticky_ht = lb_get_sticky_table (thread_index);
index 18e3267..b568fef 100644 (file)
@@ -102,9 +102,9 @@ next_index_to_iface (lisp_gpe_main_t * lgm, u32 next_index)
 }
 
 static_always_inline void
-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)
+incr_decap_stats (vnet_main_t *vnm, clib_thread_index_t thread_index,
+                 u32 length, u32 sw_if_index, u32 *last_sw_if_index,
+                 u32 *n_packets, u32 *n_bytes)
 {
   vnet_interface_main_t *im;
 
index ed2b08f..5d3ad94 100644 (file)
@@ -233,7 +233,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vlib_combined_counter_main_t *cm = &load_balance_main.lbm_to_counters;
 
   from = vlib_frame_vector_args (from_frame);
index fad487e..dfe7a26 100644 (file)
@@ -87,7 +87,7 @@ mactime_node_inline (vlib_main_t * vm,
   clib_bihash_8_8_t *lut = &mm->lookup_table;
   u32 packets_ok = 0;
   f64 now;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vnet_main_t *vnm = vnet_get_main ();
   vnet_interface_main_t *im = &vnm->interface_main;
   u8 arc = im->output_feature_arc_index;
index 652808e..1ff585c 100644 (file)
@@ -154,7 +154,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 *buffer0 = 0;
 
   while (n_left_from > 0)
index fe29af4..ec89056 100644 (file)
@@ -117,7 +117,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
@@ -549,7 +549,7 @@ ip4_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
   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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
index 3d9b21d..33d5a0e 100644 (file)
@@ -166,7 +166,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
@@ -559,7 +559,7 @@ ip6_map_post_ip4_reass (vlib_main_t * vm,
     vlib_node_get_runtime (vm, ip6_map_post_ip4_reass_node.index);
   map_main_t *mm = &map_main;
   vlib_combined_counter_main_t *cm = mm->domain_counters;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
@@ -651,7 +651,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u16 *fragment_ids, *fid;
 
   from = vlib_frame_vector_args (frame);
index f8d894a..854410e 100644 (file)
@@ -118,7 +118,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
@@ -494,7 +494,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index d483f92..08b248d 100644 (file)
@@ -504,7 +504,7 @@ memif_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   u32 n_left_to_next;
   u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
   vlib_buffer_t *buffer_ptrs[MEMIF_RX_VECTOR_SZ];
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   memif_per_thread_data_t *ptd =
     vec_elt_at_index (mm->per_thread_data, thread_index);
   u16 cur_slot, ring_size, n_slots, mask;
@@ -763,7 +763,7 @@ memif_device_input_zc_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   u16 slot, s0;
   memif_desc_t *d0;
   vlib_buffer_t *b0, *b1, *b2, *b3;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t 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;
@@ -1061,7 +1061,7 @@ CLIB_MARCH_FN (memif_dma_completion_cb, void, vlib_main_t *vm,
 {
   memif_main_t *mm = &memif_main;
   memif_if_t *mif = vec_elt_at_index (mm->interfaces, b->cookie >> 16);
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 n_left_to_next = 0;
   u16 nexts[MEMIF_RX_VECTOR_SZ], *next;
   u32 _to_next_bufs[MEMIF_RX_VECTOR_SZ], *to_next_bufs = _to_next_bufs, *bi;
index 6169847..85e7db5 100644 (file)
@@ -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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 n_buffer_bytes = vlib_buffer_get_default_data_size (vm);
 
   if (nif->per_interface_next_index != ~0)
@@ -255,7 +255,7 @@ VLIB_NODE_FN (netmap_input_node) (vlib_main_t * vm,
 {
   int i;
   u32 n_rx_packets = 0;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   netmap_main_t *nm = &netmap_main;
   netmap_if_t *nmi;
 
index c965596..efafc44 100644 (file)
@@ -73,7 +73,7 @@ VLIB_NODE_FN (pppoe_cp_dispatch_node) (vlib_main_t * vm,
   vnet_main_t * vnm = pem->vnet_main;
   vnet_interface_main_t * im = &vnm->interface_main;
   u32 pkts_decapsulated = 0;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
   pppoe_entry_key_t cached_key;
   pppoe_entry_result_t cached_result;
index 854364b..17fbeaa 100644 (file)
@@ -54,7 +54,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm,
   vnet_main_t * vnm = pem->vnet_main;
   vnet_interface_main_t * im = &vnm->interface_main;
   u32 pkts_decapsulated = 0;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
   pppoe_entry_key_t cached_key;
   pppoe_entry_result_t cached_result;
index 6a8806e..d772715 100644 (file)
@@ -124,7 +124,7 @@ pvti_input_node_common (vlib_main_t *vm, vlib_node_runtime_t *node,
 
   pvti_main_t *pvm = &pvti_main;
 
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   pvti_per_thread_data_t *ptd =
     vec_elt_at_index (pvm->per_thread_data[is_ip6], thread_index);
 
index 1939c6f..5fb6263 100644 (file)
@@ -340,7 +340,7 @@ pvti_output_node_common (vlib_main_t *vm, vlib_node_runtime_t *node,
 
   u8 stream_index = pvti_get_stream_index (is_ip6);
 
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   pvti_per_thread_data_t *ptd =
     vec_elt_at_index (pvm->per_thread_data[is_ip6], thread_index);
 
index ac097c5..6086103 100644 (file)
@@ -223,7 +223,7 @@ extern vlib_node_registration_t pvti_periodic_node;
 always_inline u8
 pvti_get_stream_index (int is_ip6)
 {
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   ASSERT ((thread_index & 0xffffff80) == 0);
 
index 10651f1..77d3563 100644 (file)
@@ -51,7 +51,8 @@ static void quic_update_timer (quic_ctx_t * ctx);
 static void quic_check_quic_session_connected (quic_ctx_t * ctx);
 static int quic_reset_connection (u64 udp_session_handle,
                                  quic_rx_packet_ctx_t * pctx);
-static void quic_proto_on_close (u32 ctx_index, u32 thread_index);
+static void quic_proto_on_close (u32 ctx_index,
+                                clib_thread_index_t thread_index);
 
 static quicly_stream_open_t on_stream_open;
 static quicly_closed_by_remote_t on_closed_by_remote;
@@ -133,7 +134,7 @@ quic_crypto_context_alloc (u8 thread_index)
 }
 
 static crypto_context_t *
-quic_crypto_context_get (u32 cr_index, u32 thread_index)
+quic_crypto_context_get (u32 cr_index, clib_thread_index_t thread_index)
 {
   quic_main_t *qm = &quic_main;
   ASSERT (cr_index >> 24 == thread_index);
@@ -381,7 +382,7 @@ error:
 /*  Helper functions */
 
 static u32
-quic_ctx_alloc (u32 thread_index)
+quic_ctx_alloc (clib_thread_index_t thread_index)
 {
   quic_main_t *qm = &quic_main;
   quic_ctx_t *ctx;
@@ -401,7 +402,7 @@ static void
 quic_ctx_free (quic_ctx_t * ctx)
 {
   QUIC_DBG (2, "Free ctx %u %x", ctx->c_thread_index, ctx->c_c_index);
-  u32 thread_index = ctx->c_thread_index;
+  clib_thread_index_t thread_index = ctx->c_thread_index;
   QUIC_ASSERT (ctx->timer_handle == QUIC_TIMER_HANDLE_INVALID);
   if (CLIB_DEBUG)
     clib_memset (ctx, 0xfb, sizeof (*ctx));
@@ -409,13 +410,13 @@ quic_ctx_free (quic_ctx_t * ctx)
 }
 
 static quic_ctx_t *
-quic_ctx_get (u32 ctx_index, u32 thread_index)
+quic_ctx_get (u32 ctx_index, clib_thread_index_t thread_index)
 {
   return pool_elt_at_index (quic_main.ctx_pool[thread_index], ctx_index);
 }
 
 static quic_ctx_t *
-quic_ctx_get_if_valid (u32 ctx_index, u32 thread_index)
+quic_ctx_get_if_valid (u32 ctx_index, clib_thread_index_t thread_index)
 {
   if (pool_is_free_index (quic_main.ctx_pool[thread_index], ctx_index))
     return 0;
@@ -1100,7 +1101,7 @@ quic_get_time (quicly_now_t * self)
 }
 
 static u32
-quic_set_time_now (u32 thread_index)
+quic_set_time_now (clib_thread_index_t thread_index)
 {
   vlib_main_t *vlib_main = vlib_get_main ();
   f64 time = vlib_time_now (vlib_main);
@@ -1396,7 +1397,7 @@ quic_connect (transport_endpoint_cfg_t * tep)
 }
 
 static void
-quic_proto_on_close (u32 ctx_index, u32 thread_index)
+quic_proto_on_close (u32 ctx_index, clib_thread_index_t thread_index)
 {
   int err;
   quic_ctx_t *ctx = quic_ctx_get_if_valid (ctx_index, thread_index);
@@ -1548,7 +1549,7 @@ quic_stop_listen (u32 lctx_index)
 }
 
 static transport_connection_t *
-quic_connection_get (u32 ctx_index, u32 thread_index)
+quic_connection_get (u32 ctx_index, clib_thread_index_t thread_index)
 {
   quic_ctx_t *ctx;
   ctx = quic_ctx_get (ctx_index, thread_index);
@@ -1600,7 +1601,7 @@ static u8 *
 format_quic_connection (u8 * s, va_list * args)
 {
   u32 qc_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   quic_ctx_t *ctx = quic_ctx_get (qc_index, thread_index);
   s = format (s, "%U", format_quic_ctx, ctx, verbose);
@@ -1611,7 +1612,7 @@ static u8 *
 format_quic_half_open (u8 * s, va_list * args)
 {
   u32 qc_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   quic_ctx_t *ctx = quic_ctx_get (qc_index, thread_index);
   s = format (s, "[#%d][Q] half-open app %u", thread_index,
              ctx->parent_app_id);
@@ -1623,7 +1624,7 @@ static u8 *
 format_quic_listener (u8 * s, va_list * args)
 {
   u32 tci = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   quic_ctx_t *ctx = quic_ctx_get (tci, thread_index);
   s = format (s, "%U", format_quic_ctx, ctx, verbose);
@@ -1660,7 +1661,7 @@ quic_on_quic_session_connected (quic_ctx_t * ctx)
   session_t *quic_session;
   app_worker_t *app_wrk;
   u32 ctx_id = ctx->c_c_index;
-  u32 thread_index = ctx->c_thread_index;
+  clib_thread_index_t thread_index = ctx->c_thread_index;
   int rv;
 
   quic_session = session_alloc (thread_index);
@@ -1775,7 +1776,7 @@ static void
 quic_transfer_connection (u32 ctx_index, u32 dest_thread)
 {
   quic_ctx_t *ctx, *temp_ctx;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   QUIC_DBG (2, "Transferring conn %u to thread %u", ctx_index, dest_thread);
 
@@ -1811,7 +1812,7 @@ quic_udp_session_connected_callback (u32 quic_app_index, u32 ctx_index,
   app_worker_t *app_wrk;
   quicly_conn_t *conn;
   quic_ctx_t *ctx;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   int ret;
   quicly_context_t *quicly_ctx;
 
@@ -1918,7 +1919,7 @@ quic_udp_session_accepted_callback (session_t * udp_session)
   u32 ctx_index;
   quic_ctx_t *ctx, *lctx;
   session_t *udp_listen_session;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   udp_listen_session =
     listen_session_get_from_handle (udp_session->listener_handle);
@@ -2199,7 +2200,7 @@ quic_process_one_rx_packet (u64 udp_session_handle, svm_fifo_t * f,
 {
   size_t plen;
   u32 full_len, ret;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 cur_deq = svm_fifo_max_dequeue (f) - fifo_offset;
   quicly_context_t *quicly_ctx;
   session_t *udp_session;
@@ -2281,7 +2282,7 @@ quic_udp_session_rx_callback (session_t * udp_session)
   u32 max_deq;
   u64 udp_session_handle = session_handle (udp_session);
   int rv = 0;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 cur_deq, fifo_offset, max_packets, i;
 
   quic_rx_packet_ctx_t packets_ctx[QUIC_RCV_MAX_PACKETS];
@@ -2306,7 +2307,7 @@ rx_start:
 #endif
   for (i = 0; i < max_packets; i++)
     {
-      packets_ctx[i].thread_index = UINT32_MAX;
+      packets_ctx[i].thread_index = CLIB_INVALID_THREAD_INDEX;
       packets_ctx[i].ctx_index = UINT32_MAX;
       packets_ctx[i].ptype = QUIC_PACKET_TYPE_DROP;
 
@@ -2421,8 +2422,8 @@ quic_get_transport_listener_endpoint (u32 listener_index,
 }
 
 static void
-quic_get_transport_endpoint (u32 ctx_index, u32 thread_index,
-                            transport_endpoint_t * tep, u8 is_lcl)
+quic_get_transport_endpoint (u32 ctx_index, clib_thread_index_t thread_index,
+                            transport_endpoint_t *tep, u8 is_lcl)
 {
   quic_ctx_t *ctx;
   ctx = quic_ctx_get (ctx_index, thread_index);
index 081bcb1..4474aa1 100644 (file)
@@ -205,7 +205,7 @@ typedef struct quic_session_cache_
 typedef struct quic_stream_data_
 {
   u32 ctx_id;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 app_rx_data_len;         /**< bytes received, to be read by external app */
   u32 app_tx_data_len;         /**< bytes sent */
 } quic_stream_data_t;
@@ -232,7 +232,7 @@ typedef struct quic_rx_packet_ctx_
   quicly_decoded_packet_t packet;
   u8 data[QUIC_MAX_PACKET_SIZE];
   u32 ctx_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   union
   {
     struct sockaddr sa;
index 02a74d2..14d07d6 100644 (file)
@@ -246,7 +246,8 @@ total_drops (sflow_main_t *smp)
 {
   // sum sendmsg and worker-fifo drops
   u32 all_drops = smp->psample_send_drops;
-  for (u32 thread_index = 0; thread_index < smp->total_threads; thread_index++)
+  for (clib_thread_index_t thread_index = 0; thread_index < smp->total_threads;
+       thread_index++)
     {
       sflow_per_thread_data_t *sfwk =
        vec_elt_at_index (smp->per_thread_data, thread_index);
@@ -321,8 +322,8 @@ read_worker_fifos (sflow_main_t *smp)
   for (; batch < SFLOW_READ_BATCH; batch++)
     {
       u32 psample_send = 0, psample_send_fail = 0;
-      for (u32 thread_index = 0; thread_index < smp->total_threads;
-          thread_index++)
+      for (clib_thread_index_t thread_index = 0;
+          thread_index < smp->total_threads; thread_index++)
        {
          sflow_per_thread_data_t *sfwk =
            vec_elt_at_index (smp->per_thread_data, thread_index);
@@ -388,7 +389,8 @@ read_node_counters (sflow_main_t *smp, sflow_err_ctrs_t *ctrs)
 {
   for (u32 ec = 0; ec < SFLOW_N_ERROR; ec++)
     ctrs->counters[ec] = 0;
-  for (u32 thread_index = 0; thread_index < smp->total_threads; thread_index++)
+  for (clib_thread_index_t thread_index = 0; thread_index < smp->total_threads;
+       thread_index++)
     {
       sflow_per_thread_data_t *sfwk =
        vec_elt_at_index (smp->per_thread_data, thread_index);
@@ -487,7 +489,8 @@ sflow_set_worker_sampling_state (sflow_main_t *smp)
   vlib_thread_main_t *tm = &vlib_thread_main;
   smp->total_threads = 1 + tm->n_threads;
   vec_validate (smp->per_thread_data, smp->total_threads);
-  for (u32 thread_index = 0; thread_index < smp->total_threads; thread_index++)
+  for (clib_thread_index_t thread_index = 0; thread_index < smp->total_threads;
+       thread_index++)
     {
       sflow_per_thread_data_t *sfwk =
        vec_elt_at_index (smp->per_thread_data, thread_index);
index 84efb4d..ae04c58 100644 (file)
@@ -93,7 +93,7 @@ snort_enq_node_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   snort_main_t *sm = &snort_main;
   snort_instance_t *si = 0;
   snort_qpair_t *qp = 0;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 n_left = frame->n_vectors;
   u32 n_trace = 0;
   u32 total_enq = 0, n_unprocessed = 0;
index 5426b7a..f86b7be 100644 (file)
 
 static srtp_main_t srtp_main;
 
-static void srtp_disconnect (u32 ctx_handle, u32 thread_index);
+static void srtp_disconnect (u32 ctx_handle, clib_thread_index_t thread_index);
 static void srtp_disconnect_transport (srtp_tc_t *ctx);
 
 static inline u32
-srtp_ctx_alloc_w_thread (u32 thread_index)
+srtp_ctx_alloc_w_thread (clib_thread_index_t thread_index)
 {
   srtp_tc_t *ctx;
   pool_get_aligned_safe (srtp_main.ctx_pool[thread_index], ctx,
@@ -36,7 +36,7 @@ srtp_ctx_alloc_w_thread (u32 thread_index)
 }
 
 static inline srtp_tc_t *
-srtp_ctx_get_w_thread (u32 ctx_index, u32 thread_index)
+srtp_ctx_get_w_thread (u32 ctx_index, clib_thread_index_t thread_index)
 {
   return pool_elt_at_index (srtp_main.ctx_pool[thread_index], ctx_index);
 }
@@ -82,7 +82,7 @@ srtp_ctx_free (srtp_tc_t *ctx)
 }
 
 static inline u32
-srtp_ctx_attach (u32 thread_index, void *ctx_ptr)
+srtp_ctx_attach (clib_thread_index_t thread_index, void *ctx_ptr)
 {
   srtp_tc_t *ctx;
 
@@ -688,7 +688,7 @@ srtp_disconnect_transport (srtp_tc_t *ctx)
 }
 
 static void
-srtp_disconnect (u32 ctx_handle, u32 thread_index)
+srtp_disconnect (u32 ctx_handle, clib_thread_index_t thread_index)
 {
   session_t *app_session;
   srtp_tc_t *ctx;
@@ -801,7 +801,7 @@ srtp_stop_listen (u32 lctx_index)
 }
 
 transport_connection_t *
-srtp_connection_get (u32 ctx_index, u32 thread_index)
+srtp_connection_get (u32 ctx_index, clib_thread_index_t thread_index)
 {
   srtp_tc_t *ctx;
   ctx = srtp_ctx_get_w_thread (ctx_index, thread_index);
@@ -895,7 +895,7 @@ u8 *
 format_srtp_connection (u8 *s, va_list *args)
 {
   u32 ctx_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   srtp_tc_t *ctx;
 
@@ -935,7 +935,7 @@ format_srtp_half_open (u8 *s, va_list *args)
 }
 
 static void
-srtp_transport_endpoint_get (u32 ctx_handle, u32 thread_index,
+srtp_transport_endpoint_get (u32 ctx_handle, clib_thread_index_t thread_index,
                             transport_endpoint_t *tep, u8 is_lcl)
 {
   srtp_tc_t *ctx = srtp_ctx_get_w_thread (ctx_handle, thread_index);
index 66be2dc..28fbc10 100644 (file)
@@ -583,7 +583,7 @@ srv6_ad_flow_localsid_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
   ip6_sr_main_t *srm = &sr_main;
   f64 now = vlib_time_now (vm);
   u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index beef6a3..012afda 100644 (file)
@@ -147,7 +147,7 @@ srv6_am_localsid_fn (vlib_main_t * vm,
   n_left_from = frame->n_vectors;
   next_index = node->cached_next_index;
 
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
index ed0697a..c8f619c 100644 (file)
@@ -325,7 +325,7 @@ VLIB_NODE_FN (srv6_end_m_gtp4_e)
   srv6_end_main_v4_t *sm = &srv6_end_main_v4;
   ip6_sr_main_t *sm2 = &sr_main;
   u32 n_left_from, next_index, *from, *to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   u32 good_n = 0, bad_n = 0;
 
@@ -1327,7 +1327,7 @@ VLIB_NODE_FN (srv6_end_m_gtp6_e)
   srv6_end_main_v6_t *sm = &srv6_end_main_v6;
   ip6_sr_main_t *sm2 = &sr_main;
   u32 n_left_from, next_index, *from, *to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   u32 good_n = 0, bad_n = 0;
 
@@ -2088,7 +2088,7 @@ VLIB_NODE_FN (srv6_end_m_gtp6_d)
   srv6_end_main_v6_decap_t *sm = &srv6_end_main_v6_decap;
   ip6_sr_main_t *sm2 = &sr_main;
   u32 n_left_from, next_index, *from, *to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   ip6_sr_localsid_t *ls0;
   srv6_end_gtp6_d_param_t *ls_param;
 
@@ -2238,7 +2238,7 @@ VLIB_NODE_FN (srv6_end_m_gtp6_d_di)
   srv6_end_main_v6_decap_di_t *sm = &srv6_end_main_v6_decap_di;
   ip6_sr_main_t *sm2 = &sr_main;
   u32 n_left_from, next_index, *from, *to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   srv6_end_gtp6_d_param_t *ls_param;
 
   u32 good_n = 0, bad_n = 0;
@@ -2686,7 +2686,7 @@ VLIB_NODE_FN (srv6_end_m_gtp6_dt)
   srv6_end_main_v6_dt_t *sm = &srv6_end_main_v6_dt;
   ip6_sr_main_t *sm2 = &sr_main;
   u32 n_left_from, next_index, *from, *to_next;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   u32 good_n = 0, bad_n = 0;
 
index 2f4757e..44d48b1 100644 (file)
@@ -127,7 +127,7 @@ mbedtls_ctx_get_w_thread (u32 ctx_index, u8 thread_index)
 static int
 tls_init_ctr_seed_drbgs (void)
 {
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   mbedtls_main_t *tm = &mbedtls_main;
   u8 *pers;
   int rv;
index cd08da5..e28d730 100644 (file)
@@ -114,8 +114,8 @@ openssl_async_t openssl_async_main;
 static vlib_node_registration_t tls_async_process_node;
 
 /* to avoid build warning */
-void session_send_rpc_evt_to_thread (u32 thread_index, void *fp,
-                                    void *rpc_args);
+void session_send_rpc_evt_to_thread (clib_thread_index_t thread_index,
+                                    void *fp, void *rpc_args);
 
 void
 evt_pool_init (vlib_main_t * vm)
@@ -528,7 +528,7 @@ openssl_async_node_enable_disable (u8 is_en)
 }
 
 int
-tls_async_do_job (int eidx, u32 thread_index)
+tls_async_do_job (int eidx, clib_thread_index_t thread_index)
 {
   tls_ctx_t *ctx;
   openssl_evt_t *event;
index f0be025..5b57e70 100644 (file)
@@ -35,7 +35,7 @@
 openssl_main_t openssl_main;
 
 static u32
-openssl_ctx_alloc_w_thread (u32 thread_index)
+openssl_ctx_alloc_w_thread (clib_thread_index_t thread_index)
 {
   openssl_main_t *om = &openssl_main;
   openssl_ctx_t **ctx;
@@ -102,7 +102,7 @@ openssl_ctx_detach (tls_ctx_t *ctx)
 }
 
 static u32
-openssl_ctx_attach (u32 thread_index, void *ctx_ptr)
+openssl_ctx_attach (clib_thread_index_t thread_index, void *ctx_ptr)
 {
   openssl_main_t *om = &openssl_main;
   session_handle_t sh;
index 33c5387..6236ccd 100644 (file)
@@ -1002,7 +1002,7 @@ tbt_seq_lt (u32 a, u32 b)
 }
 
 static void
-tcp_test_set_time (u32 thread_index, u32 val)
+tcp_test_set_time (clib_thread_index_t thread_index, u32 val)
 {
   session_main.wrk[thread_index].last_vlib_time = val;
   tcp_set_time_now (&tcp_main.wrk[thread_index], val);
@@ -1011,7 +1011,7 @@ tcp_test_set_time (u32 thread_index, u32 val)
 static int
 tcp_test_delivery (vlib_main_t * vm, unformat_input_t * input)
 {
-  u32 thread_index = 0, snd_una, *min_seqs = 0;
+  clib_thread_index_t thread_index = 0, snd_una, *min_seqs = 0;
   tcp_rate_sample_t _rs = { 0 }, *rs = &_rs;
   tcp_connection_t _tc, *tc = &_tc;
   sack_scoreboard_t *sb = &tc->sack_sb;
@@ -1337,7 +1337,7 @@ tcp_test_delivery (vlib_main_t * vm, unformat_input_t * input)
 static int
 tcp_test_bt (vlib_main_t * vm, unformat_input_t * input)
 {
-  u32 thread_index = 0;
+  clib_thread_index_t thread_index = 0;
   tcp_rate_sample_t _rs = { 0 }, *rs = &_rs;
   tcp_connection_t _tc, *tc = &_tc;
   int __clib_unused verbose = 0, i;
index 35aca37..592a126 100644 (file)
@@ -347,7 +347,7 @@ vhost_user_vring_close (vhost_user_intf_t * vui, u32 qid)
   u16 q = vui->vrings[qid].qid;
   u32 queue_index = vui->vrings[qid].queue_index;
   u32 mode = vui->vrings[qid].mode;
-  u32 thread_index = vui->vrings[qid].thread_index;
+  clib_thread_index_t thread_index = vui->vrings[qid].thread_index;
   vhost_user_vring_init (vui, qid);
   vui->vrings[qid].qid = q;
   vui->vrings[qid].queue_index = queue_index;
@@ -1441,7 +1441,7 @@ vhost_user_delete_if (vnet_main_t * vnm, vlib_main_t * vm, u32 sw_if_index)
     vhost_user_vring_t *txvq = &vui->vrings[qid];
 
     if ((txvq->mode == VNET_HW_IF_RX_MODE_POLLING) &&
-       (txvq->thread_index != ~0))
+       (txvq->thread_index != CLIB_INVALID_THREAD_INDEX))
       {
        vhost_cpu_t *cpu = vec_elt_at_index (vum->cpus, txvq->thread_index);
        ASSERT (cpu->polling_q_count != 0);
index fe2ee21..9e46197 100644 (file)
@@ -231,7 +231,7 @@ typedef struct
   u16 last_kick;
   u8 first_kick;
   u32 queue_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } vhost_user_vring_t;
 
 #define VHOST_USER_EVENT_START_TIMER 1
index 2ae5c56..3052ae3 100644 (file)
@@ -382,7 +382,7 @@ vhost_user_device_class_packed (vlib_main_t *vm, vlib_node_runtime_t *node,
   vhost_user_main_t *vum = &vhost_user_main;
   u32 qid = rxvq->qid;
   u8 error;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vhost_cpu_t *cpu = &vum->cpus[thread_index];
   u32 map_hint = 0;
   u8 retry = 8;
@@ -698,7 +698,7 @@ VNET_DEVICE_CLASS_TX_FN (vhost_user_device_class) (vlib_main_t * vm,
   u32 qid;
   vhost_user_vring_t *rxvq;
   u8 error;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vhost_cpu_t *cpu = &vum->cpus[thread_index];
   u32 map_hint = 0;
   u8 retry = 8;
@@ -1051,7 +1051,7 @@ vhost_user_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index,
       return clib_error_return (0, "unsupported");
     }
 
-  if (txvq->thread_index == ~0)
+  if (txvq->thread_index == CLIB_INVALID_THREAD_INDEX)
     return clib_error_return (0, "Queue initialization is not finished yet");
 
   cpu = vec_elt_at_index (vum->cpus, txvq->thread_index);
index 2563254..55fb418 100644 (file)
@@ -203,7 +203,7 @@ vmxnet3_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
   vmxnet3_rx_comp *rx_comp;
   u32 desc_idx;
   vmxnet3_rxq_t *rxq;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 buffer_indices[VLIB_FRAME_SIZE], *bi;
   u16 nexts[VLIB_FRAME_SIZE], *next;
   vmxnet3_rx_ring *ring;
index 89602f8..8de992e 100644 (file)
@@ -523,7 +523,7 @@ typedef struct
   u32 mode;
   u8 buffer_pool_index;
   u32 queue_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   vmxnet3_rx_ring rx_ring[VMXNET3_RX_RING_SIZE];
   vmxnet3_rx_desc *rx_desc[VMXNET3_RX_RING_SIZE];
   vmxnet3_rx_comp *rx_comp;
index 29f03e3..80f2fac 100644 (file)
@@ -210,7 +210,7 @@ vxlan_gpe_input (vlib_main_t * vm,
   vxlan4_gpe_tunnel_cache_t last4;
   vxlan6_gpe_tunnel_cache_t last6;
   u32 pkts_decapsulated = 0;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
 
   if (is_ip4)
index d8bab92..701c3af 100644 (file)
@@ -156,7 +156,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
 
index 5f28c5e..4ad35bc 100644 (file)
@@ -193,7 +193,7 @@ vxlan_input (vlib_main_t * vm,
   last_tunnel_cache4 last4;
   last_tunnel_cache6 last6;
   u32 pkts_dropped = 0;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   if (is_ip4)
     clib_memset (&last4, 0xff, sizeof last4);
@@ -1039,7 +1039,7 @@ VLIB_NODE_FN (vxlan4_flow_input_node) (vlib_main_t * vm,
     [VXLAN_FLOW_NEXT_L2_INPUT] =
       im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_RX,
   };
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   u32 *from = vlib_frame_vector_args (f);
   u32 n_left_from = f->n_vectors;
index 98464d8..60181bf 100644 (file)
@@ -78,7 +78,7 @@ vxlan_encap_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   vlib_combined_counter_main_t *tx_counter =
     im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX;
   u32 pkts_encapsulated = 0;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 sw_if_index0 = 0, sw_if_index1 = 0;
   u32 next0 = 0, next1 = 0;
   vxlan_tunnel_t *t0 = NULL, *t1 = NULL;
index 1eb7fbf..0ae0480 100644 (file)
@@ -698,7 +698,7 @@ wg_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
 
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
   vlib_buffer_t *lb;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vnet_crypto_op_t **crypto_ops;
   const u16 drop_next = WG_INPUT_NEXT_PUNT;
   message_type_t header_type;
index c9411f6..7bbec11 100644 (file)
@@ -436,7 +436,7 @@ wg_output_tun_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   vnet_crypto_op_t **crypto_ops;
   u16 nexts[VLIB_FRAME_SIZE], *next = nexts;
   vlib_buffer_t *sync_bufs[VLIB_FRAME_SIZE];
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u16 n_sync = 0;
   const u16 drop_next = WG_OUTPUT_NEXT_ERROR;
   const u8 is_async = wg_op_mode_is_set_ASYNC ();
index d910b25..ce09a51 100644 (file)
@@ -297,7 +297,7 @@ vlib_buffer_enqueue_to_thread_inline (vlib_main_t *vm,
   u32 drop_list[VLIB_FRAME_SIZE], n_drop = 0;
   vlib_frame_bitmap_t mask, used_elts = {};
   vlib_frame_queue_elt_t *hf = 0;
-  u16 thread_index;
+  clib_thread_index_t thread_index;
   u32 n_comp, off = 0, n_left = n_packets;
 
   thread_index = thread_indices[0];
index f9da576..a9c2617 100644 (file)
@@ -68,7 +68,7 @@ u32 vlib_simple_counter_n_counters (const vlib_simple_counter_main_t * cm);
 /** Pre-fetch a per-thread simple counter for the given object index */
 always_inline void
 vlib_prefetch_simple_counter (const vlib_simple_counter_main_t *cm,
-                             u32 thread_index, u32 index)
+                             clib_thread_index_t thread_index, u32 index)
 {
   counter_t *my_counters;
 
@@ -86,8 +86,9 @@ vlib_prefetch_simple_counter (const vlib_simple_counter_main_t *cm,
     @param increment - (u64) quantitiy to add to the counter
 */
 always_inline void
-vlib_increment_simple_counter (vlib_simple_counter_main_t * cm,
-                              u32 thread_index, u32 index, u64 increment)
+vlib_increment_simple_counter (vlib_simple_counter_main_t *cm,
+                              clib_thread_index_t thread_index, u32 index,
+                              u64 increment)
 {
   counter_t *my_counters;
 
@@ -102,8 +103,9 @@ vlib_increment_simple_counter (vlib_simple_counter_main_t * cm,
     @param increment - (u64) quantitiy remove from the counter value
 */
 always_inline void
-vlib_decrement_simple_counter (vlib_simple_counter_main_t * cm,
-                              u32 thread_index, u32 index, u64 decrement)
+vlib_decrement_simple_counter (vlib_simple_counter_main_t *cm,
+                              clib_thread_index_t thread_index, u32 index,
+                              u64 decrement)
 {
   counter_t *my_counters;
 
@@ -121,8 +123,9 @@ vlib_decrement_simple_counter (vlib_simple_counter_main_t * cm,
     @param value - (u64) quantitiy to set to the counter
 */
 always_inline void
-vlib_set_simple_counter (vlib_simple_counter_main_t * cm,
-                        u32 thread_index, u32 index, u64 value)
+vlib_set_simple_counter (vlib_simple_counter_main_t *cm,
+                        clib_thread_index_t thread_index, u32 index,
+                        u64 value)
 {
   counter_t *my_counters;
 
@@ -246,9 +249,9 @@ void vlib_clear_combined_counters (vlib_combined_counter_main_t * cm);
 */
 
 always_inline void
-vlib_increment_combined_counter (vlib_combined_counter_main_t * cm,
-                                u32 thread_index,
-                                u32 index, u64 n_packets, u64 n_bytes)
+vlib_increment_combined_counter (vlib_combined_counter_main_t *cm,
+                                clib_thread_index_t thread_index, u32 index,
+                                u64 n_packets, u64 n_bytes)
 {
   vlib_counter_t *my_counters;
 
@@ -261,8 +264,8 @@ vlib_increment_combined_counter (vlib_combined_counter_main_t * cm,
 
 /** Pre-fetch a per-thread combined counter for the given object index */
 always_inline void
-vlib_prefetch_combined_counter (const vlib_combined_counter_main_t * cm,
-                               u32 thread_index, u32 index)
+vlib_prefetch_combined_counter (const vlib_combined_counter_main_t *cm,
+                               clib_thread_index_t thread_index, u32 index)
 {
   vlib_counter_t *cpu_counters;
 
index 9801062..8ed2535 100644 (file)
@@ -213,7 +213,7 @@ unformat_vlib_tmpfile (unformat_input_t * input, va_list * args)
 u8 *
 format_vlib_thread_name (u8 * s, va_list * args)
 {
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
 
   if (thread_index == 0)
     return format (s, "main");
@@ -226,7 +226,7 @@ format_vlib_thread_name (u8 * s, va_list * args)
 u8 *
 format_vlib_thread_name_and_index (u8 * s, va_list * args)
 {
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
 
   return format (s, "%U (%u)", format_vlib_thread_name, thread_index,
                 thread_index);
index 3c0fdb7..2558e61 100644 (file)
@@ -26,7 +26,7 @@ vlib_get_n_threads ()
 }
 
 always_inline vlib_main_t *
-vlib_get_main_by_index (u32 thread_index)
+vlib_get_main_by_index (clib_thread_index_t thread_index)
 {
   vlib_main_t *vm;
   vm = vlib_global_main.vlib_mains[thread_index];
index a4f5a4b..5bacd7f 100644 (file)
@@ -41,7 +41,7 @@ typedef enum
 
 typedef struct
 {
-  u16 thread_index;
+  clib_thread_index_t thread_index;
   u8 level; /* vlib_log_level_t */
   vlib_log_class_t class;
   f64 timestamp;
index aa7e1db..270b203 100644 (file)
@@ -204,7 +204,7 @@ typedef struct vlib_main_t
   clib_random_buffer_t random_buffer;
 
   /* thread, cpu and numa_node indices */
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 numa_node;
 
   /* control-plane API queue signal pending, length indication */
@@ -325,13 +325,10 @@ extern vlib_global_main_t vlib_global_main;
 always_inline f64
 vlib_time_now (vlib_main_t * vm)
 {
-#if CLIB_DEBUG > 0
-  extern __thread uword __os_thread_index;
-#endif
   /*
    * Make sure folks don't pass &vlib_global_main from a worker thread.
    */
-  ASSERT (vm->thread_index == __os_thread_index);
+  ASSERT (vm->thread_index == os_get_thread_index ());
   return clib_time_now (&vm->clib_time) + vm->time_offset;
 }
 
index 4b81a61..800d520 100644 (file)
@@ -68,14 +68,10 @@ format_punt_trace (u8 * s, va_list * args)
 }
 
 always_inline u32
-punt_replicate (vlib_main_t * vm,
-               vlib_node_runtime_t * node,
-               u32 thread_index,
-               vlib_buffer_t * b0,
-               u32 bi0,
-               vlib_punt_reason_t pr0,
-               u32 * next_index,
-               u32 * n_left_to_next, u32 ** to_next, u32 * n_dispatched)
+punt_replicate (vlib_main_t *vm, vlib_node_runtime_t *node,
+               clib_thread_index_t thread_index, vlib_buffer_t *b0, u32 bi0,
+               vlib_punt_reason_t pr0, u32 *next_index, u32 *n_left_to_next,
+               u32 **to_next, u32 *n_dispatched)
 {
   /* multiple clients => replicate a copy to each */
   u16 n_clones0, n_cloned0, clone0;
@@ -134,13 +130,10 @@ punt_replicate (vlib_main_t * vm,
 }
 
 always_inline u32
-punt_dispatch_one (vlib_main_t * vm,
-                  vlib_node_runtime_t * node,
-                  vlib_combined_counter_main_t * cm,
-                  u32 thread_index,
-                  u32 bi0,
-                  u32 * next_index,
-                  u32 * n_left_to_next, u32 ** to_next, u32 * n_dispatched)
+punt_dispatch_one (vlib_main_t *vm, vlib_node_runtime_t *node,
+                  vlib_combined_counter_main_t *cm,
+                  clib_thread_index_t thread_index, u32 bi0, u32 *next_index,
+                  u32 *n_left_to_next, u32 **to_next, u32 *n_dispatched)
 {
   vlib_punt_reason_t pr0;
   vlib_buffer_t *b0;
index bf5031b..949ec9c 100644 (file)
@@ -1549,7 +1549,7 @@ vlib_workers_sync (void)
   if (!(*vlib_worker_threads->wait_at_barrier) &&
       !clib_atomic_swap_rel_n (&vlib_worker_threads->wait_before_barrier, 1))
     {
-      u32 thread_index = vlib_get_thread_index ();
+      clib_thread_index_t thread_index = vlib_get_thread_index ();
       vlib_rpc_call_main_thread (vlib_worker_sync_rpc, (u8 *) &thread_index,
                                 sizeof (thread_index));
       vlib_worker_flush_pending_rpc_requests (vlib_get_main ());
index 8c5d560..94bb335 100644 (file)
@@ -186,7 +186,7 @@ void vlib_worker_wait_one_loop (void);
  */
 void vlib_worker_flush_pending_rpc_requests (vlib_main_t *vm);
 
-static_always_inline uword
+static_always_inline clib_thread_index_t
 vlib_get_thread_index (void)
 {
   return __os_thread_index;
@@ -343,7 +343,7 @@ vlib_get_worker_thread_index (u32 worker_index)
 }
 
 always_inline u32
-vlib_get_worker_index (u32 thread_index)
+vlib_get_worker_index (clib_thread_index_t thread_index)
 {
   return thread_index - 1;
 }
@@ -361,7 +361,7 @@ vlib_worker_thread_barrier_check (void)
     {
       vlib_global_main_t *vgm = vlib_get_global_main ();
       vlib_main_t *vm = vlib_get_main ();
-      u32 thread_index = vm->thread_index;
+      clib_thread_index_t thread_index = vm->thread_index;
       f64 t = vlib_time_now (vm);
 
       if (PREDICT_FALSE (vec_len (vm->barrier_perf_callbacks) != 0))
@@ -378,7 +378,7 @@ vlib_worker_thread_barrier_check (void)
 
          struct
          {
-           u32 thread_index;
+           clib_thread_index_t thread_index;
          } __clib_packed *ed;
 
          ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);
@@ -425,7 +425,7 @@ vlib_worker_thread_barrier_check (void)
 
              struct
              {
-               u32 thread_index;
+               clib_thread_index_t thread_index;
              } __clib_packed *ed;
 
              ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e,
@@ -450,7 +450,7 @@ vlib_worker_thread_barrier_check (void)
 
          struct
          {
-           u32 thread_index;
+           clib_thread_index_t thread_index;
            u32 duration;
          } __clib_packed *ed;
 
index 33c778e..dcc76fc 100644 (file)
@@ -142,8 +142,9 @@ is_int_pending (vlib_node_main_t *nm)
 }
 
 static_always_inline uword
-linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
-                         vlib_frame_t * frame, u32 thread_index)
+linux_epoll_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
+                         vlib_frame_t *frame,
+                         clib_thread_index_t thread_index)
 {
   unix_main_t *um = &unix_main;
   clib_file_main_t *fm = &file_main;
@@ -363,7 +364,7 @@ static uword
 linux_epoll_input (vlib_main_t * vm,
                   vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   if (thread_index == 0)
     return linux_epoll_input_inline (vm, node, frame, 0);
index 5413eca..8bf9b82 100644 (file)
@@ -53,7 +53,7 @@ adj_l2_rewrite_inline (vlib_main_t * vm,
 {
     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();
+    clib_thread_index_t thread_index = vlib_get_thread_index();
     ethernet_main_t * em = &ethernet_main;
 
     n_left_from = frame->n_vectors;
index 1b4fa6c..9c59d70 100644 (file)
@@ -55,7 +55,7 @@ adj_nsh_rewrite_inline (vlib_main_t * vm,
 {
     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();
+    clib_thread_index_t thread_index = vlib_get_thread_index();
 
     n_left_from = frame->n_vectors;
     next_index = node->cached_next_index;
index f7a21a1..50e07d1 100644 (file)
@@ -83,7 +83,7 @@ bier_lookup (vlib_main_t * vm,
 {
     u32 n_left_from, next_index, * from, * to_next;
     bier_lookup_main_t *blm = &bier_lookup_main;
-    u32 thread_index = vlib_get_thread_index();
+    clib_thread_index_t thread_index = vlib_get_thread_index ();
     bier_bit_mask_bucket_t buckets_copy[BIER_HDR_BUCKETS_4096];
 
     from = vlib_frame_vector_args (from_frame);
@@ -347,7 +347,7 @@ clib_error_t *
 bier_lookup_module_init (vlib_main_t * vm)
 {
     bier_lookup_main_t *blm = &bier_lookup_main;
-    u32 thread_index;
+    clib_thread_index_t thread_index;
 
     vec_validate (blm->blm_clones, vlib_num_workers());
     vec_validate (blm->blm_fmasks, vlib_num_workers());
index 5c19103..99fccf0 100644 (file)
@@ -68,7 +68,7 @@ bier_output (vlib_main_t * vm,
 {
   vlib_combined_counter_main_t *cm = &bier_fmask_counters;
     u32 n_left_from, next_index, * from, * to_next;
-    u32 thread_index;
+    clib_thread_index_t thread_index;
 
     thread_index = vm->thread_index;
     from = vlib_frame_vector_args (from_frame);
index cdc935f..33a313b 100644 (file)
@@ -609,7 +609,7 @@ bond_add_member (vlib_main_t * vm, bond_add_member_args_t * args)
   vnet_interface_main_t *im = &vnm->interface_main;
   vnet_hw_interface_t *bif_hw, *mif_hw;
   vnet_sw_interface_t *sw;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 mif_if_index;
 
   bif = bond_get_bond_if_by_sw_if_index (args->group);
index 81661c1..5081ddf 100644 (file)
@@ -186,7 +186,7 @@ bond_lb_broadcast (vlib_main_t *vm, bond_if_t *bif, vlib_buffer_t *b0,
   vlib_buffer_t *c0;
   int port;
   u32 sw_if_index;
-  u16 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   bond_per_thread_data_t *ptd = vec_elt_at_index (bm->per_thread_data,
                                                  thread_index);
 
@@ -461,7 +461,7 @@ VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
 {
   vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
   bond_main_t *bm = &bond_main;
-  u16 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   bond_if_t *bif = pool_elt_at_index (bm->interfaces, rund->dev_instance);
   uword n_members;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE];
index 66de1e4..347aa56 100644 (file)
@@ -197,7 +197,7 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
                                vlib_node_runtime_t * node,
                                vlib_frame_t * frame)
 {
-  u16 thread_index = vm->thread_index;
+  clib_thread_index_t 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;
index 247af56..276cb11 100644 (file)
@@ -340,7 +340,7 @@ typedef struct
       u32 __pad[3];
       u32 sad_index;
       u32 protect_index;
-      u16 thread_index;
+      clib_thread_index_t thread_index;
     } ipsec;
 
     /* MAP */
@@ -502,7 +502,7 @@ typedef struct
      */
     struct
     {
-      u32 thread_index;
+      clib_thread_index_t thread_index;
       u32 pool_index;
       u32 id;
     } reass;
index 77c1c81..998615e 100644 (file)
@@ -232,7 +232,7 @@ static inline void make_working_copy
   vnet_classify_bucket_t working_bucket __attribute__ ((aligned (8)));
   void *oldheap;
   vnet_classify_entry_t *working_copy;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   int working_copy_length, required_length;
 
   if (thread_index >= vec_len (t->working_copies))
@@ -427,7 +427,7 @@ vnet_classify_add_del (vnet_classify_table_t *t, vnet_classify_entry_t *add_v,
   u32 hash, new_hash;
   u32 limit;
   u32 old_log2_pages, new_log2_pages;
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u8 *key_minus_skip;
   int resplit_once = 0;
   int mark_bucket_linear;
index c80987e..a56f4c4 100644 (file)
@@ -326,7 +326,7 @@ typedef struct
   vnet_crypto_async_frame_elt_t elts[VNET_CRYPTO_FRAME_SIZE];
   u32 buffer_indices[VNET_CRYPTO_FRAME_SIZE];
   u16 next_node_index[VNET_CRYPTO_FRAME_SIZE];
-  u32 enqueue_thread_index;
+  clib_thread_index_t enqueue_thread_index;
 } vnet_crypto_async_frame_t;
 
 typedef struct
@@ -353,9 +353,9 @@ typedef void (vnet_crypto_key_fn_t) (vnet_crypto_key_op_t kop,
 /** async crypto function handlers **/
 typedef int (vnet_crypto_frame_enq_fn_t) (vlib_main_t *vm,
                                          vnet_crypto_async_frame_t *frame);
-typedef vnet_crypto_async_frame_t *
-  (vnet_crypto_frame_dequeue_t) (vlib_main_t * vm, u32 * nb_elts_processed,
-                                u32 * enqueue_thread_idx);
+typedef vnet_crypto_async_frame_t *(
+  vnet_crypto_frame_dequeue_t) (vlib_main_t *vm, u32 *nb_elts_processed,
+                               clib_thread_index_t *enqueue_thread_idx);
 
 u32
 vnet_crypto_register_engine (vlib_main_t * vm, char *name, int prio,
index 7d023f3..c0d258a 100644 (file)
@@ -78,7 +78,7 @@ crypto_dequeue_frame (vlib_main_t * vm, vlib_node_runtime_t * node,
 {
   vnet_crypto_main_t *cm = &crypto_main;
   u32 n_elts = 0;
-  u32 enqueue_thread_idx = ~0;
+  clib_thread_index_t enqueue_thread_idx = CLIB_INVALID_THREAD_INDEX;
   vnet_crypto_async_frame_t *cf = (hdl) (vm, &n_elts, &enqueue_thread_idx);
   *n_total += n_elts;
 
index a571334..a8d374f 100644 (file)
@@ -318,7 +318,8 @@ vnet_dev_pci_msix_add_handler (vlib_main_t *vm, vnet_dev_t *dev,
 
 void
 vnet_dev_pci_msix_set_polling_thread (vlib_main_t *vm, vnet_dev_t *dev,
-                                     u16 line, u16 thread_index)
+                                     u16 line,
+                                     clib_thread_index_t thread_index)
 {
   vlib_pci_dev_handle_t h = vnet_dev_get_pci_handle (dev);
   u32 index;
index f3f7563..ad2e793 100644 (file)
@@ -711,7 +711,7 @@ void vnet_dev_poll_port_remove (vlib_main_t *, vnet_dev_port_t *,
 
 typedef struct
 {
-  u16 thread_index;
+  clib_thread_index_t thread_index;
   u8 completed;
   u8 in_order;
   vnet_dev_port_t *port;
index 944c3ef..7a6f39a 100644 (file)
@@ -55,7 +55,7 @@ static uword
 vnet_dev_rt_mgmt_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
                          vlib_frame_t *frame)
 {
-  u16 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vnet_dev_rt_op_t *op, *ops = __atomic_load_n (&rt_ops, __ATOMIC_ACQUIRE);
   u32 n_pending = 0;
   uword rv = 0;
index cadf1f8..5c904df 100644 (file)
@@ -81,7 +81,7 @@ vnet_get_aggregate_rx_packets (void)
 }
 
 static inline void
-vnet_device_increment_rx_packets (u32 thread_index, u64 count)
+vnet_device_increment_rx_packets (clib_thread_index_t thread_index, u64 count)
 {
   vnet_device_main_t *vdm = &vnet_device_main;
   vnet_device_per_worker_data_t *pwd;
index 027e1ed..730c1ff 100644 (file)
@@ -262,7 +262,7 @@ virtio_device_input_gso_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
                                int checksum_offload_enabled, int packed)
 {
   vnet_main_t *vnm = vnet_get_main ();
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   uword n_trace = vlib_get_trace_count (vm, node);
   u32 next_index;
   const int hdr_sz = vif->virtio_net_hdr_sz;
index 5a519d3..9f5cb6b 100644 (file)
@@ -242,7 +242,7 @@ interface_rx_dpo_inline (vlib_main_t * vm,
                         u8 is_l2)
 {
     u32 n_left_from, next_index, * from, * to_next;
-    u32 thread_index = vm->thread_index;
+    clib_thread_index_t thread_index = vm->thread_index;
     vnet_interface_main_t *im;
 
     im = &vnet_get_main ()->interface_main;
index 9ce94ee..265f3d9 100644 (file)
@@ -290,7 +290,7 @@ lookup_dpo_ip4_inline (vlib_main_t * vm,
                        int table_from_interface)
 {
     u32 n_left_from, next_index, * from, * to_next;
-    u32 thread_index = vlib_get_thread_index();
+    clib_thread_index_t thread_index = vlib_get_thread_index ();
     vlib_combined_counter_main_t * cm = &load_balance_main.lbm_to_counters;
 
     from = vlib_frame_vector_args (from_frame);
@@ -647,7 +647,7 @@ lookup_dpo_ip6_inline (vlib_main_t * vm,
 {
     vlib_combined_counter_main_t * cm = &load_balance_main.lbm_to_counters;
     u32 n_left_from, next_index, * from, * to_next;
-    u32 thread_index = vlib_get_thread_index();
+    clib_thread_index_t thread_index = vlib_get_thread_index ();
 
     from = vlib_frame_vector_args (from_frame);
     n_left_from = from_frame->n_vectors;
@@ -989,7 +989,7 @@ lookup_dpo_mpls_inline (vlib_main_t * vm,
                        int table_from_interface)
 {
     u32 n_left_from, next_index, * from, * to_next;
-    u32 thread_index = vlib_get_thread_index();
+    clib_thread_index_t thread_index = vlib_get_thread_index ();
     vlib_combined_counter_main_t * cm = &load_balance_main.lbm_to_counters;
 
     from = vlib_frame_vector_args (from_frame);
index 0474fd8..07254f5 100644 (file)
@@ -742,7 +742,7 @@ replicate_inline (vlib_main_t * vm,
     vlib_combined_counter_main_t * cm = &replicate_main.repm_counters;
     replicate_main_t * rm = &replicate_main;
     u32 n_left_from, * from, * to_next, next_index;
-    u32 thread_index = vlib_get_thread_index();
+    clib_thread_index_t thread_index = vlib_get_thread_index ();
 
     from = vlib_frame_vector_args (frame);
     n_left_from = frame->n_vectors;
index f1bb6b8..39073d7 100644 (file)
@@ -507,7 +507,7 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
   u32 n_left_from, *from;
   u32 next_index = 0;
   u32 n_bytes;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vnet_main_t *vnm = vnet_get_main ();
   vnet_interface_main_t *im = &vnm->interface_main;
   l2_input_config_t *config;
index 03cbdde..2d7f091 100644 (file)
@@ -1218,7 +1218,7 @@ ethernet_input_inline (vlib_main_t * vm,
   vlib_node_runtime_t *error_node;
   u32 n_left_from, next_index, *to_next;
   u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t 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 */
index 3d81e99..140a3fd 100644 (file)
@@ -63,7 +63,7 @@ VLIB_NODE_FN (p2p_ethernet_input_node) (vlib_main_t * vm,
                                        vlib_node_runtime_t * node,
                                        vlib_frame_t * frame)
 {
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 n_trace = vlib_get_trace_count (vm, node);
   u32 n_left_from, *from, *to_next;
   u32 next_index;
index c1d4459..c4f4b74 100644 (file)
@@ -471,7 +471,7 @@ drop_one_buffer_and_count (vlib_main_t * vm, vnet_main_t * vnm,
                           vlib_node_runtime_t * node, u32 * pbi0,
                           u32 sw_if_index, u32 drop_error_code)
 {
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   vlib_simple_counter_main_t *cm;
   cm =
@@ -498,7 +498,7 @@ vnet_gso_node_inline (vlib_main_t * vm,
   u32 *from = vlib_frame_vector_args (frame);
   u32 n_left_from = frame->n_vectors;
   u32 *from_end = from + n_left_from;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vnet_interface_main_t *im = &vnm->interface_main;
   vnet_interface_per_thread_data_t *ptd =
     vec_elt_at_index (im->per_thread_data, thread_index);
index eb557fd..81d7729 100644 (file)
@@ -615,7 +615,7 @@ typedef struct
   u32 dev_instance;
 
   /* index of thread pollling this queue */
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   /* file index of queue interrupt line */
   u32 file_index;
index 0020130..84068a0 100644 (file)
@@ -27,7 +27,7 @@ VLIB_REGISTER_LOG_CLASS (if_rxq_log, static) = {
 #define log_err(fmt, ...)   vlib_log_err (if_rxq_log.class, fmt, __VA_ARGS__)
 
 static u32
-next_thread_index (vnet_main_t *vnm, u32 thread_index)
+next_thread_index (vnet_main_t *vnm, clib_thread_index_t thread_index)
 {
   vnet_device_main_t *vdm = &vnet_device_main;
   if (vdm->first_worker_thread_index == 0)
@@ -62,7 +62,7 @@ vnet_hw_if_get_rx_queue_index_by_id (vnet_main_t *vnm, u32 hw_if_index,
 
 u32
 vnet_hw_if_register_rx_queue (vnet_main_t *vnm, u32 hw_if_index, u32 queue_id,
-                             u32 thread_index)
+                             clib_thread_index_t thread_index)
 {
   vnet_interface_main_t *im = &vnm->interface_main;
   vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
@@ -225,7 +225,7 @@ vnet_hw_if_get_rx_queue_mode (vnet_main_t *vnm, u32 queue_index)
 
 void
 vnet_hw_if_set_rx_queue_thread_index (vnet_main_t *vnm, u32 queue_index,
-                                     u32 thread_index)
+                                     clib_thread_index_t thread_index)
 {
   vnet_hw_if_rx_queue_t *rxq = vnet_hw_if_get_rx_queue (vnm, queue_index);
   vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, rxq->hw_if_index);
index 906d711..4295463 100644 (file)
@@ -20,7 +20,8 @@
 u32 vnet_hw_if_get_rx_queue_index_by_id (vnet_main_t *vnm, u32 hw_if_index,
                                         u32 queue_id);
 u32 vnet_hw_if_register_rx_queue (vnet_main_t *vnm, u32 hw_if_index,
-                                 u32 queue_id, u32 thread_idnex);
+                                 u32 queue_id,
+                                 clib_thread_index_t thread_index);
 void vnet_hw_if_unregister_rx_queue (vnet_main_t *vnm, u32 queue_index);
 void vnet_hw_if_unregister_all_rx_queues (vnet_main_t *vnm, u32 hw_if_index);
 void vnet_hw_if_set_rx_queue_file_index (vnet_main_t *vnm, u32 queue_index,
@@ -32,7 +33,7 @@ int vnet_hw_if_set_rx_queue_mode (vnet_main_t *vnm, u32 queue_index,
 vnet_hw_if_rx_mode vnet_hw_if_get_rx_queue_mode (vnet_main_t *vnm,
                                                 u32 queue_index);
 void vnet_hw_if_set_rx_queue_thread_index (vnet_main_t *vnm, u32 queue_index,
-                                          u32 thread_index);
+                                          clib_thread_index_t thread_index);
 vnet_hw_if_rxq_poll_vector_t *
 vnet_hw_if_generate_rxq_int_poll_vector (vlib_main_t *vm,
                                         vlib_node_runtime_t *node);
index 8a6cd9d..6c7c938 100644 (file)
@@ -107,7 +107,7 @@ vnet_hw_if_unregister_all_tx_queues (vnet_main_t *vnm, u32 hw_if_index)
 
 void
 vnet_hw_if_tx_queue_assign_thread (vnet_main_t *vnm, u32 queue_index,
-                                  u32 thread_index)
+                                  clib_thread_index_t thread_index)
 {
   vnet_hw_if_tx_queue_t *txq = vnet_hw_if_get_tx_queue (vnm, queue_index);
   vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, txq->hw_if_index);
@@ -122,7 +122,7 @@ vnet_hw_if_tx_queue_assign_thread (vnet_main_t *vnm, u32 queue_index,
 
 void
 vnet_hw_if_tx_queue_unassign_thread (vnet_main_t *vnm, u32 queue_index,
-                                    u32 thread_index)
+                                    clib_thread_index_t thread_index)
 {
   vnet_hw_if_tx_queue_t *txq = vnet_hw_if_get_tx_queue (vnm, queue_index);
   vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, txq->hw_if_index);
index 8fcf7c3..14792e0 100644 (file)
@@ -13,9 +13,9 @@ u32 vnet_hw_if_register_tx_queue (vnet_main_t *vnm, u32 hw_if_index,
 void vnet_hw_if_unregister_tx_queue (vnet_main_t *vnm, u32 queue_index);
 void vnet_hw_if_unregister_all_tx_queues (vnet_main_t *vnm, u32 hw_if_index);
 void vnet_hw_if_tx_queue_assign_thread (vnet_main_t *vnm, u32 queue_index,
-                                       u32 thread_index);
+                                       clib_thread_index_t thread_index);
 void vnet_hw_if_tx_queue_unassign_thread (vnet_main_t *vnm, u32 queue_index,
-                                         u32 thread_index);
+                                         clib_thread_index_t thread_index);
 
 /* inline functions */
 
index 65f3a02..d835a36 100644 (file)
@@ -1330,7 +1330,7 @@ vl_api_sw_interface_set_tx_placement_t_handler (
   size = mp->array_size;
   for (u32 i = 0; i < size; i++)
     {
-      u32 thread_index = mp->threads[i];
+      clib_thread_index_t thread_index = mp->threads[i];
       bitmap = clib_bitmap_set (bitmap, thread_index, 1);
     }
 
index cc214c1..4d3c98f 100644 (file)
@@ -1694,7 +1694,7 @@ VLIB_CLI_COMMAND (show_interface_rx_placement, static) = {
 };
 clib_error_t *
 set_hw_interface_rx_placement (u32 hw_if_index, u32 queue_id,
-                              u32 thread_index, u8 is_main)
+                              clib_thread_index_t thread_index, u8 is_main)
 {
   vnet_main_t *vnm = vnet_get_main ();
   vnet_device_main_t *vdm = &vnet_device_main;
@@ -1731,7 +1731,7 @@ set_interface_rx_placement (vlib_main_t *vm, unformat_input_t *input,
   vnet_main_t *vnm = vnet_get_main ();
   u32 hw_if_index = (u32) ~ 0;
   u32 queue_id = (u32) 0;
-  u32 thread_index = (u32) ~ 0;
+  clib_thread_index_t thread_index = CLIB_INVALID_THREAD_INDEX;
   u8 is_main = 0;
 
   if (!unformat_user (input, unformat_line_input, line_input))
@@ -1831,11 +1831,12 @@ set_hw_interface_tx_queue (u32 hw_if_index, u32 queue_id, uword *bitmap)
   vlib_thread_main_t *vtm = vlib_get_thread_main ();
   vnet_hw_if_tx_queue_t *txq;
   u32 queue_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   /* highest set bit in bitmap should not exceed last worker thread index */
   thread_index = clib_bitmap_last_set (bitmap);
-  if ((thread_index != ~0) && (thread_index >= vtm->n_vlib_mains))
+  if ((thread_index != CLIB_INVALID_THREAD_INDEX) &&
+      (thread_index >= vtm->n_vlib_mains))
     return VNET_API_ERROR_INVALID_VALUE;
 
   queue_index =
index 511df49..54e7896 100644 (file)
@@ -426,7 +426,8 @@ clib_error_t *set_hw_interface_change_rx_mode (vnet_main_t * vnm,
 
 /* Set rx-placement on the interface */
 clib_error_t *set_hw_interface_rx_placement (u32 hw_if_index, u32 queue_id,
-                                            u32 thread_index, u8 is_main);
+                                            clib_thread_index_t thread_index,
+                                            u8 is_main);
 /* Set tx-queue placement on the interface */
 int set_hw_interface_tx_queue (u32 hw_if_index, u32 queue_id, uword *bitmap);
 
index 2d0c0ee..f2889fd 100644 (file)
@@ -911,7 +911,7 @@ vl_api_sw_interface_tx_placement_details_t_handler (
 
   for (u32 i = 0; i < size; i++)
     {
-      u32 thread_index = ntohl (mp->threads[i]);
+      clib_thread_index_t thread_index = ntohl (mp->threads[i]);
       bitmap = clib_bitmap_set (bitmap, thread_index, 1);
     }
 
index 61b9e76..1d8d39d 100644 (file)
@@ -56,7 +56,7 @@ VLIB_REGISTER_LOG_CLASS (ip4_neighbor_log, static) = {
   vlib_log_debug (ip4_neighbor_log.class, fmt, __VA_ARGS__)
 
 void
-ip4_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
+ip4_neighbor_probe_dst (u32 sw_if_index, clib_thread_index_t thread_index,
                        const ip4_address_t *dst)
 {
   ip4_address_t src;
@@ -74,7 +74,8 @@ ip4_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
 
 void
 ip4_neighbor_advertise (vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index,
-                       u32 thread_index, const ip4_address_t *addr)
+                       clib_thread_index_t thread_index,
+                       const ip4_address_t *addr)
 {
   vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
   ip4_main_t *i4m = &ip4_main;
@@ -142,7 +143,7 @@ ip4_arp_inline (vlib_main_t * vm,
   vnet_main_t *vnm = vnet_get_main ();
   u32 *from, *to_next_drop;
   uword n_left_from, n_left_to_next_drop, next_index;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u64 seed;
 
   if (node->flags & VLIB_NODE_FLAG_TRACE)
index 7941ebd..3327c52 100644 (file)
 #include <vnet/ethernet/arp_packet.h>
 #include <vnet/ip-neighbor/ip_neighbor_types.h>
 
-extern void ip4_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
+extern void ip4_neighbor_probe_dst (u32 sw_if_index,
+                                   clib_thread_index_t thread_index,
                                    const ip4_address_t *dst);
 extern void ip4_neighbor_advertise (vlib_main_t *vm, vnet_main_t *vnm,
-                                   u32 sw_if_index, u32 thread_index,
+                                   u32 sw_if_index,
+                                   clib_thread_index_t thread_index,
                                    const ip4_address_t *addr);
 
 always_inline vlib_buffer_t *
index ca8aed3..79a4a30 100644 (file)
@@ -32,7 +32,7 @@ VLIB_REGISTER_LOG_CLASS (ip6_neighbor_log, static) = {
 #define log_debug(fmt, ...)                                                   \
   vlib_log_debug (ip6_neighbor_log.class, fmt, __VA_ARGS__)
 void
-ip6_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
+ip6_neighbor_probe_dst (u32 sw_if_index, clib_thread_index_t thread_index,
                        const ip6_address_t *dst)
 {
   ip6_address_t src;
@@ -45,7 +45,8 @@ ip6_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
 
 void
 ip6_neighbor_advertise (vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index,
-                       u32 thread_index, const ip6_address_t *addr)
+                       clib_thread_index_t thread_index,
+                       const ip6_address_t *addr)
 {
   vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
   ip6_main_t *i6m = &ip6_main;
@@ -129,7 +130,7 @@ ip6_discover_neighbor_inline (vlib_main_t * vm,
   u32 *from, *to_next_drop;
   uword n_left_from, n_left_to_next_drop;
   u64 seed;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   if (node->flags & VLIB_NODE_FLAG_TRACE)
     ip6_forward_next_trace (vm, node, frame, VLIB_TX);
index c6e718d..31dc1ea 100644 (file)
 extern vlib_packet_template_t ip6_neighbor_packet_template;
 
 extern void ip6_neighbor_advertise (vlib_main_t *vm, vnet_main_t *vnm,
-                                   u32 sw_if_index, u32 thread_index,
+                                   u32 sw_if_index,
+                                   clib_thread_index_t thread_index,
                                    const ip6_address_t *addr);
 
-extern void ip6_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
+extern void ip6_neighbor_probe_dst (u32 sw_if_index,
+                                   clib_thread_index_t thread_index,
                                    const ip6_address_t *dst);
 
 always_inline vlib_buffer_t *
 ip6_neighbor_probe (vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index,
-                   u32 thread_index, const ip6_address_t *src,
+                   clib_thread_index_t thread_index, const ip6_address_t *src,
                    const ip6_address_t *dst)
 {
   icmp6_neighbor_solicitation_header_t *h0;
index 614b784..73fa0b3 100644 (file)
@@ -1092,7 +1092,7 @@ ip_neighbor_register (ip_address_family_t af, const ip_neighbor_vft_t * vft)
 }
 
 void
-ip_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
+ip_neighbor_probe_dst (u32 sw_if_index, clib_thread_index_t thread_index,
                       ip_address_family_t af, const ip46_address_t *dst)
 {
   if (!vnet_sw_interface_is_admin_up (vnet_get_main (), sw_if_index))
index cc888ba..813c2bb 100644 (file)
@@ -56,7 +56,8 @@ extern void ip_neighbor_learn (const ip_neighbor_learn_t * l);
 extern void ip_neighbor_update (vnet_main_t * vnm, adj_index_t ai);
 
 extern void ip_neighbor_probe (const ip_adjacency_t * adj);
-extern void ip_neighbor_probe_dst (u32 sw_if_index, u32 thread_index,
+extern void ip_neighbor_probe_dst (u32 sw_if_index,
+                                  clib_thread_index_t thread_index,
                                   ip_address_family_t af,
                                   const ip46_address_t *ip);
 
index fa4a0e1..acbe06b 100644 (file)
@@ -251,7 +251,7 @@ ip4_icmp_error (vlib_main_t * vm,
   u32 *from, *to_next;
   uword n_left_from, n_left_to_next;
   ip4_icmp_error_next_t next_index;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index f93ebce..b37554c 100644 (file)
@@ -292,7 +292,7 @@ ip6_icmp_error (vlib_main_t * vm,
   u32 *from, *to_next;
   uword n_left_from, n_left_to_next;
   ip6_icmp_error_next_t next_index;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index 81d6cd1..cabefd8 100644 (file)
@@ -117,7 +117,7 @@ VLIB_NODE_FN (ip4_load_balance_node) (vlib_main_t * vm,
 {
   vlib_combined_counter_main_t *cm = &load_balance_main.lbm_via_counters;
   u32 n_left, *from;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
   u16 nexts[VLIB_FRAME_SIZE], *next;
 
@@ -2113,7 +2113,7 @@ ip4_rewrite_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
     vlib_node_get_runtime (vm, ip4_input_node.index);
 
   n_left_from = frame->n_vectors;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   vlib_get_buffers (vm, from, bufs, n_left_from);
   clib_memset_u16 (nexts, IP4_REWRITE_NEXT_DROP, n_left_from);
index 54150d4..8122d57 100644 (file)
@@ -59,7 +59,7 @@ ip4_lookup_inline (vlib_main_t * vm,
   ip4_main_t *im = &ip4_main;
   vlib_combined_counter_main_t *cm = &load_balance_main.lbm_to_counters;
   u32 n_left, *from;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE];
   vlib_buffer_t **b = bufs;
   u16 nexts[VLIB_FRAME_SIZE], *next;
index af2b89a..28b9fb8 100644 (file)
@@ -96,7 +96,7 @@ ip4_input_check_sw_if_index (vlib_main_t * vm,
 {
   ip4_main_t *im = &ip4_main;
   ip_lookup_main_t *lm = &im->lookup_main;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   if (*last_sw_if_index == sw_if_index)
     {
       (*cnt)++;
@@ -125,7 +125,7 @@ ip4_input_inline (vlib_main_t * vm,
 {
   vnet_main_t *vnm = vnet_get_main ();
   u32 n_left_from, *from;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t 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;
index 31adc90..3c1f40b 100644 (file)
@@ -750,7 +750,7 @@ VLIB_NODE_FN (ip6_load_balance_node) (vlib_main_t * vm,
 {
   vlib_combined_counter_main_t *cm = &load_balance_main.lbm_via_counters;
   u32 n_left, *from;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   ip6_main_t *im = &ip6_main;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
   u16 nexts[VLIB_FRAME_SIZE], *next;
@@ -1781,7 +1781,7 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm,
 
   n_left_from = frame->n_vectors;
   next_index = node->cached_next_index;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
index 8e5dd25..71b6cc9 100644 (file)
@@ -60,7 +60,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index ae59b76..a79a17c 100644 (file)
@@ -73,7 +73,7 @@ VLIB_NODE_FN (ip6_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
   vlib_node_runtime_t *error_node =
     vlib_node_get_runtime (vm, ip6_input_node.index);
   vlib_simple_counter_main_t *cm;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index 6400e49..9898a66 100644 (file)
@@ -247,7 +247,7 @@ punt_socket_inline2 (vlib_main_t *vm, vlib_node_runtime_t *node,
                     ip_address_family_t af, ip_protocol_t protocol)
 {
   u32 *buffers = vlib_frame_vector_args (frame);
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   uword n_packets = frame->n_vectors;
   punt_main_t *pm = &punt_main;
   int i;
index bab7d47..808acb0 100644 (file)
@@ -91,7 +91,7 @@ typedef union
   struct
   {
     u32 reass_index;
-    u32 memory_owner_thread_index;
+    clib_thread_index_t memory_owner_thread_index;
   };
   u64 as_u64;
 } ip4_full_reass_val_t;
@@ -147,10 +147,10 @@ typedef struct
   // number of fragments in this reassembly
   u32 fragments_n;
   // thread owning memory for this context (whose pool contains this ctx)
-  u32 memory_owner_thread_index;
+  clib_thread_index_t memory_owner_thread_index;
   // thread which received fragment with offset 0 and which sends out the
   // completed reassembly
-  u32 sendout_thread_index;
+  clib_thread_index_t sendout_thread_index;
 } ip4_full_reass_t;
 
 typedef struct
@@ -246,8 +246,8 @@ typedef struct
   ip4_full_reass_range_trace_t trace_range;
   u32 size_diff;
   u32 op_id;
-  u32 thread_id;
-  u32 thread_id_to;
+  clib_thread_index_t thread_id;
+  clib_thread_index_t thread_id_to;
   u32 fragment_first;
   u32 fragment_last;
   u32 total_data_len;
@@ -345,10 +345,10 @@ format_ip4_full_reass_trace (u8 * s, va_list * args)
 }
 
 static void
-ip4_full_reass_add_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
-                         ip4_full_reass_t * reass, u32 bi,
+ip4_full_reass_add_trace (vlib_main_t *vm, vlib_node_runtime_t *node,
+                         ip4_full_reass_t *reass, u32 bi,
                          ip4_full_reass_trace_operation_e action,
-                         u32 size_diff, u32 thread_id_to)
+                         u32 size_diff, clib_thread_index_t thread_id_to)
 {
   vlib_buffer_t *b = vlib_get_buffer (vm, bi);
   vnet_buffer_opaque_t *vnb = vnet_buffer (b);
@@ -917,11 +917,12 @@ ip4_full_reass_remove_range_from_chain (vlib_main_t * vm,
 }
 
 always_inline ip4_full_reass_rc_t
-ip4_full_reass_update (vlib_main_t * vm, vlib_node_runtime_t * node,
-                      ip4_full_reass_main_t * rm,
-                      ip4_full_reass_per_thread_t * rt,
-                      ip4_full_reass_t * reass, u32 * bi0, u32 * next0,
-                      u32 * error0, bool is_custom, u32 * handoff_thread_idx)
+ip4_full_reass_update (vlib_main_t *vm, vlib_node_runtime_t *node,
+                      ip4_full_reass_main_t *rm,
+                      ip4_full_reass_per_thread_t *rt,
+                      ip4_full_reass_t *reass, u32 *bi0, u32 *next0,
+                      u32 *error0, bool is_custom,
+                      clib_thread_index_t *handoff_thread_idx)
 {
   vlib_buffer_t *fb = vlib_get_buffer (vm, *bi0);
   vnet_buffer_opaque_t *fvnb = vnet_buffer (fb);
@@ -1256,7 +1257,7 @@ ip4_full_reass_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
        }
       else if (reass)
        {
-         u32 handoff_thread_idx;
+         clib_thread_index_t handoff_thread_idx;
          u32 counter = ~0;
          switch (ip4_full_reass_update (vm, node, rm, rt, reass, &bi0, &next0,
                                         &error0, CUSTOM == type,
index 50b4b22..6d14526 100644 (file)
@@ -65,7 +65,7 @@ typedef union
   struct
   {
     u32 reass_index;
-    u32 thread_index;
+    clib_thread_index_t thread_index;
   };
   u64 as_u64;
 } ip4_sv_reass_val_t;
@@ -1684,7 +1684,7 @@ static char *ip4_sv_reass_handoff_error_strings[] = {
 
 typedef struct
 {
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } ip4_sv_reass_handoff_trace_t;
 
 static u8 *
index 69b27c5..b2934d9 100644 (file)
@@ -67,7 +67,7 @@ typedef union
   struct
   {
     u32 reass_index;
-    u32 thread_index;
+    clib_thread_index_t thread_index;
   };
   u64 as_u64;
 } ip6_sv_reass_val_t;
@@ -1399,7 +1399,7 @@ static char *ip6_sv_reassembly_handoff_error_strings[] = {
 
 typedef struct
 {
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } ip6_sv_reassembly_handoff_trace_t;
 
 static u8 *
index 4eb9352..7d94b4a 100644 (file)
@@ -312,7 +312,7 @@ vnet_flow_rewrite_generic_callback (ipfix_exporter_t *exp, flow_report_t *fr,
 
 vlib_buffer_t *
 vnet_ipfix_exp_get_buffer (vlib_main_t *vm, ipfix_exporter_t *exp,
-                          flow_report_t *fr, u32 thread_index)
+                          flow_report_t *fr, clib_thread_index_t thread_index)
 {
   u32 bi0;
   vlib_buffer_t *b0;
@@ -343,7 +343,8 @@ vnet_ipfix_exp_get_buffer (vlib_main_t *vm, ipfix_exporter_t *exp,
 void
 vnet_ipfix_exp_send_buffer (vlib_main_t *vm, ipfix_exporter_t *exp,
                            flow_report_t *fr, flow_report_stream_t *stream,
-                           u32 thread_index, vlib_buffer_t *b0)
+                           clib_thread_index_t thread_index,
+                           vlib_buffer_t *b0)
 {
   flow_report_main_t *frm = &flow_report_main;
   vlib_frame_t *f;
index cd0cafb..1a94ce9 100644 (file)
@@ -255,7 +255,8 @@ vnet_ipfix_exporter_lookup (const ip_address_t *ipfix_collector);
  */
 vlib_buffer_t *vnet_ipfix_exp_get_buffer (vlib_main_t *vm,
                                          ipfix_exporter_t *exp,
-                                         flow_report_t *fr, u32 thread_index);
+                                         flow_report_t *fr,
+                                         clib_thread_index_t thread_index);
 
 /*
  * Send the provided buffer. At this stage the buffer should be populated
@@ -265,7 +266,8 @@ vlib_buffer_t *vnet_ipfix_exp_get_buffer (vlib_main_t *vm,
 void vnet_ipfix_exp_send_buffer (vlib_main_t *vm, ipfix_exporter_t *exp,
                                 flow_report_t *fr,
                                 flow_report_stream_t *stream,
-                                u32 thread_index, vlib_buffer_t *b0);
+                                clib_thread_index_t thread_index,
+                                vlib_buffer_t *b0);
 
 #endif /* __included_vnet_flow_report_h__ */
 
index a289cc8..ae9317f 100644 (file)
@@ -66,7 +66,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 len;
   vnet_interface_main_t *im = &gm->vnet_main->interface_main;
 
index 450c9cf..0884270 100644 (file)
@@ -74,8 +74,8 @@ ah_decrypt_err_to_sa_err (u32 err)
 
 always_inline void
 ah_encrypt_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
-                          u32 thread_index, u32 err, u16 index, u16 *nexts,
-                          u16 drop_next, u32 sa_index)
+                          clib_thread_index_t thread_index, u32 err,
+                          u16 index, u16 *nexts, u16 drop_next, u32 sa_index)
 {
   ipsec_set_next_index (b, node, thread_index, err,
                        ah_encrypt_err_to_sa_err (err), index, nexts,
@@ -84,8 +84,8 @@ ah_encrypt_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
 
 always_inline void
 ah_decrypt_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
-                          u32 thread_index, u32 err, u16 index, u16 *nexts,
-                          u16 drop_next, u32 sa_index)
+                          clib_thread_index_t thread_index, u32 err,
+                          u16 index, u16 *nexts, u16 drop_next, u32 sa_index)
 {
   ipsec_set_next_index (b, node, thread_index, err,
                        ah_decrypt_err_to_sa_err (err), index, nexts,
index 30ea442..e95cc9e 100644 (file)
@@ -118,7 +118,7 @@ ah_decrypt_inline (vlib_main_t * vm,
                   int is_ip6)
 {
   u32 n_left, *from;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u16 buffer_data_size = vlib_buffer_get_default_data_size (vm);
   ah_decrypt_packet_data_t pkt_data[VLIB_FRAME_SIZE], *pd = pkt_data;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
index a31e314..c855843 100644 (file)
@@ -169,8 +169,8 @@ esp_decrypt_err_to_sa_err (u32 err)
 
 always_inline void
 esp_encrypt_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
-                           u32 thread_index, u32 err, u16 index, u16 *nexts,
-                           u16 drop_next, u32 sa_index)
+                           clib_thread_index_t thread_index, u32 err,
+                           u16 index, u16 *nexts, u16 drop_next, u32 sa_index)
 {
   ipsec_set_next_index (b, node, thread_index, err,
                        esp_encrypt_err_to_sa_err (err), index, nexts,
@@ -179,8 +179,8 @@ esp_encrypt_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
 
 always_inline void
 esp_decrypt_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
-                           u32 thread_index, u32 err, u16 index, u16 *nexts,
-                           u16 drop_next, u32 sa_index)
+                           clib_thread_index_t thread_index, u32 err,
+                           u16 index, u16 *nexts, u16 drop_next, u32 sa_index)
 {
   ipsec_set_next_index (b, node, thread_index, err,
                        esp_decrypt_err_to_sa_err (err), index, nexts,
index 928f1b0..7f7cd57 100644 (file)
@@ -1068,7 +1068,7 @@ esp_decrypt_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
 {
   ipsec_main_t *im = &ipsec_main;
   const u16 *next_by_next_header = im->next_header_registrations;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u16 len;
   ipsec_per_thread_data_t *ptd = vec_elt_at_index (im->ptd, thread_index);
   u32 *from = vlib_frame_vector_args (from_frame);
index 8916eb1..1f2cc24 100644 (file)
@@ -607,7 +607,7 @@ esp_encrypt_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   u32 *from = vlib_frame_vector_args (frame);
   u32 n_left = frame->n_vectors;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u16 buffer_data_size = vlib_buffer_get_default_data_size (vm);
   u32 current_sa_index = ~0, current_sa_packets = 0;
   u32 current_sa_bytes = 0, spi = 0;
index c4977dd..bdc4ee4 100644 (file)
@@ -361,8 +361,9 @@ ipsec_spinlock_unlock (i32 *lock)
  */
 always_inline void
 ipsec_set_next_index (vlib_buffer_t *b, vlib_node_runtime_t *node,
-                     u32 thread_index, u32 err, u32 ipsec_sa_err, u16 index,
-                     u16 *nexts, u16 drop_next, u32 sa_index)
+                     clib_thread_index_t thread_index, u32 err,
+                     u32 ipsec_sa_err, u16 index, u16 *nexts, u16 drop_next,
+                     u32 sa_index)
 {
   nexts[index] = drop_next;
   b->error = node->errors[err];
index d27e982..e5b3899 100644 (file)
@@ -1222,7 +1222,7 @@ send_ipsec_sa_v4_details (ipsec_sa_t *sa, void *arg)
   ipsec_sa_outb_rt_t *ort = ipsec_sa_get_outb_rt (sa);
   ipsec_dump_walk_ctx_t *ctx = arg;
   vl_api_ipsec_sa_v4_details_t *mp;
-  u32 thread_index = 0;
+  clib_thread_index_t thread_index = 0;
 
   mp = vl_msg_api_alloc (sizeof (*mp));
   clib_memset (mp, 0, sizeof (*mp));
@@ -1309,7 +1309,7 @@ send_ipsec_sa_v5_details (ipsec_sa_t *sa, void *arg)
   ipsec_sa_outb_rt_t *ort = ipsec_sa_get_outb_rt (sa);
   ipsec_dump_walk_ctx_t *ctx = arg;
   vl_api_ipsec_sa_v5_details_t *mp;
-  u32 thread_index = 0;
+  clib_thread_index_t thread_index = 0;
 
   mp = vl_msg_api_alloc (sizeof (*mp));
   clib_memset (mp, 0, sizeof (*mp));
index a7c7482..d649c70 100644 (file)
@@ -318,10 +318,11 @@ ipsec_collect_ah_trace (vlib_buffer_t **b, vlib_node_runtime_t *node,
 
 always_inline void
 ipsec_ah_packet_process (vlib_main_t *vm, ipsec_main_t *im, ip4_header_t *ip0,
-                        ah_header_t *ah0, u32 thread_index, ipsec_spd_t *spd0,
-                        vlib_buffer_t **b, vlib_node_runtime_t *node,
-                        u64 *ipsec_bypassed, u64 *ipsec_dropped,
-                        u64 *ipsec_matched, u64 *ipsec_unprocessed, u16 *next)
+                        ah_header_t *ah0, clib_thread_index_t thread_index,
+                        ipsec_spd_t *spd0, vlib_buffer_t **b,
+                        vlib_node_runtime_t *node, u64 *ipsec_bypassed,
+                        u64 *ipsec_dropped, u64 *ipsec_matched,
+                        u64 *ipsec_unprocessed, u16 *next)
 
 {
   ipsec_policy_t *p0 = NULL;
@@ -452,7 +453,7 @@ ipsec_ah_packet_process (vlib_main_t *vm, ipsec_main_t *im, ip4_header_t *ip0,
 always_inline void
 ipsec_esp_packet_process (vlib_main_t *vm, ipsec_main_t *im, ip4_header_t *ip0,
                          udp_header_t *udp0, esp_header_t *esp0,
-                         u32 thread_index, ipsec_spd_t *spd0,
+                         clib_thread_index_t thread_index, ipsec_spd_t *spd0,
                          vlib_buffer_t **b, vlib_node_runtime_t *node,
                          u64 *ipsec_bypassed, u64 *ipsec_dropped,
                          u64 *ipsec_matched, u64 *ipsec_unprocessed,
@@ -834,7 +835,7 @@ extern vlib_node_registration_t ipsec6_input_node;
 always_inline void
 ipsec6_esp_packet_process (vlib_main_t *vm, ipsec_main_t *im,
                           ip6_header_t *ip0, esp_header_t *esp0,
-                          u32 thread_index, ipsec_spd_t *spd0,
+                          clib_thread_index_t thread_index, ipsec_spd_t *spd0,
                           vlib_buffer_t **b, vlib_node_runtime_t *node,
                           u64 *ipsec_bypassed, u64 *ipsec_dropped,
                           u64 *ipsec_matched, u64 *ipsec_unprocessed,
index ec281cd..2347a00 100644 (file)
@@ -426,7 +426,7 @@ ipsec_sa_add_and_lock (u32 id, u32 spi, ipsec_protocol_t proto,
   clib_error_t *err;
   ipsec_sa_t *sa;
   u32 sa_index, irt_sz;
-  u16 thread_index = (vlib_num_workers ()) ? ~0 : 0;
+  clib_thread_index_t thread_index = (vlib_num_workers ()) ? ~0 : 0;
   u64 rand[2];
   uword *p;
   int rv;
@@ -670,7 +670,7 @@ ipsec_sa_bind (u32 id, u32 worker, bool bind)
   ipsec_sa_t *sa;
   ipsec_sa_inb_rt_t *irt;
   ipsec_sa_outb_rt_t *ort;
-  u16 thread_index;
+  clib_thread_index_t thread_index;
 
   p = hash_get (im->sa_index_by_sa_id, id);
   if (!p)
index 9d8c90b..3300438 100644 (file)
@@ -157,7 +157,7 @@ typedef struct
   u8 cipher_iv_size;
   u8 integ_icv_size;
   u8 udp_sz;
-  u16 thread_index;
+  clib_thread_index_t thread_index;
   u32 salt;
   u64 seq64;
   u16 async_op_id;
@@ -187,7 +187,7 @@ typedef struct
   u8 integ_icv_size;
   ip_dscp_t t_dscp;
   tunnel_encap_decap_flags_t tunnel_flags;
-  u16 thread_index;
+  clib_thread_index_t thread_index;
   u16 async_op_id;
   u32 salt;
   u32 spi_be;
@@ -687,8 +687,9 @@ ipsec_sa_anti_replay_window_shift (ipsec_sa_inb_rt_t *irt, u32 window_size,
  * the branch cost.
  */
 always_inline u64
-ipsec_sa_anti_replay_advance (ipsec_sa_inb_rt_t *irt, u32 thread_index,
-                             u32 seq, u32 hi_seq)
+ipsec_sa_anti_replay_advance (ipsec_sa_inb_rt_t *irt,
+                             clib_thread_index_t thread_index, u32 seq,
+                             u32 hi_seq)
 {
   u64 n_lost = 0;
   u32 window_size = irt->anti_replay_window_size;
index 3dde084..38f6baf 100644 (file)
@@ -114,7 +114,7 @@ ipsec_tun_protect_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
   vnet_interface_main_t *vim = &vnm->interface_main;
 
   int is_trace = node->flags & VLIB_NODE_FLAG_TRACE;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   u32 n_left_from, *from;
   u16 nexts[VLIB_FRAME_SIZE], *next;
index f8cb3cb..c06bf5c 100644 (file)
@@ -141,7 +141,7 @@ VLIB_NODE_FN (l2flood_node) (vlib_main_t * vm,
   u32 n_left_from, *from, *to_next;
   l2flood_next_t next_index;
   l2flood_main_t *msm = &l2flood_main;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   from = vlib_frame_vector_args (frame);
   n_left_from = frame->n_vectors;
index 0505d9a..79da5e5 100644 (file)
@@ -75,7 +75,7 @@ mpls_input_inline (vlib_main_t * vm,
 {
   u32 n_left_from, next_index, * from, * to_next;
   mpls_main_t * mm = &mpls_main;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   vlib_simple_counter_main_t * cm;
   vnet_main_t * vnm = vnet_get_main();
 
index a5ac565..5b0e941 100644 (file)
@@ -61,7 +61,7 @@ VLIB_NODE_FN (mpls_lookup_node) (vlib_main_t * vm,
   vlib_combined_counter_main_t * cm = &load_balance_main.lbm_to_counters;
   u32 n_left_from, next_index, * from, * to_next;
   mpls_main_t * mm = &mpls_main;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
 
   from = vlib_frame_vector_args (from_frame);
   n_left_from = from_frame->n_vectors;
@@ -493,7 +493,7 @@ VLIB_NODE_FN (mpls_load_balance_node) (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;
-  u32 thread_index = vlib_get_thread_index();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   u32 next;
 
   from = vlib_frame_vector_args (frame);
index 8f126e2..c1b8096 100644 (file)
@@ -91,7 +91,8 @@ typedef struct
   u32 current_bucket;          // MOD
   u32 extended_limit;
   u32 extended_bucket;         // MOD
-  u32 thread_index;            // Tie policer to a thread, rather than lock
+  clib_thread_index_t
+    thread_index;              // Tie policer to a thread, rather than lock
   u64 last_update_time;                // MOD
   u8 *name;
 } policer_t;
index 08000b9..7b7e191 100644 (file)
@@ -74,7 +74,7 @@ vnet_policer_police (vlib_main_t *vm, vlib_buffer_t *b, u32 policer_index,
 
   if (handoff)
     {
-      if (PREDICT_FALSE (pol->thread_index == ~0))
+      if (PREDICT_FALSE (pol->thread_index == CLIB_INVALID_THREAD_INDEX))
        /*
         * This is the first packet to use this policer. Set the
         * thread index in the policer to this thread and any
index eacc1ad..1a2509e 100644 (file)
@@ -490,7 +490,7 @@ vlib_node_registration_t appsl_rx_mqs_input_node;
 VLIB_NODE_FN (appsl_rx_mqs_input_node)
 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 {
-  u32 thread_index = vm->thread_index, n_msgs = 0;
+  clib_thread_index_t thread_index = vm->thread_index, n_msgs = 0;
   app_rx_mq_elt_t *elt, *next;
   app_main_t *am = &app_main;
   session_worker_t *wrk;
@@ -581,7 +581,7 @@ app_rx_mqs_epoll_add (application_t *app, app_rx_mq_elt_t *mqe)
 {
   clib_file_t template = { 0 };
   app_rx_mq_handle_t handle;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   int fd;
 
   thread_index = mqe - app->rx_mqs;
@@ -603,7 +603,7 @@ app_rx_mqs_epoll_add (application_t *app, app_rx_mq_elt_t *mqe)
 static void
 app_rx_mqs_epoll_del (application_t *app, app_rx_mq_elt_t *mqe)
 {
-  u32 thread_index = mqe - app->rx_mqs;
+  clib_thread_index_t thread_index = mqe - app->rx_mqs;
   app_main_t *am = &app_main;
   appsl_wrk_t *aw;
 
index c68a911..d748eae 100644 (file)
@@ -175,7 +175,7 @@ typedef struct app_rx_mq_handle_
     struct
     {
       u32 app_index;
-      u32 thread_index;
+      clib_thread_index_t thread_index;
     };
     u64 as_u64;
   };
@@ -368,9 +368,11 @@ int app_worker_session_fifo_tuning (app_worker_t * app_wrk, session_t * s,
                                    session_ft_action_t act, u32 len);
 void app_worker_add_event (app_worker_t *app_wrk, session_t *s,
                           session_evt_type_t evt_type);
-void app_worker_add_event_custom (app_worker_t *app_wrk, u32 thread_index,
+void app_worker_add_event_custom (app_worker_t *app_wrk,
+                                 clib_thread_index_t thread_index,
                                  session_event_t *evt);
-int app_wrk_flush_wrk_events (app_worker_t *app_wrk, u32 thread_index);
+int app_wrk_flush_wrk_events (app_worker_t *app_wrk,
+                             clib_thread_index_t thread_index);
 void app_worker_del_all_events (app_worker_t *app_wrk);
 segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
                                                          session_t *);
@@ -386,10 +388,12 @@ void app_wrk_send_ctrl_evt_fd (app_worker_t *app_wrk, u8 evt_type, void *msg,
                               u32 msg_len, int fd);
 void app_wrk_send_ctrl_evt (app_worker_t *app_wrk, u8 evt_type, void *msg,
                            u32 msg_len);
-u8 app_worker_mq_wrk_is_congested (app_worker_t *app_wrk, u32 thread_index);
-void app_worker_set_mq_wrk_congested (app_worker_t *app_wrk, u32 thread_index);
+u8 app_worker_mq_wrk_is_congested (app_worker_t *app_wrk,
+                                  clib_thread_index_t thread_index);
+void app_worker_set_mq_wrk_congested (app_worker_t *app_wrk,
+                                     clib_thread_index_t thread_index);
 void app_worker_unset_wrk_mq_congested (app_worker_t *app_wrk,
-                                       u32 thread_index);
+                                       clib_thread_index_t thread_index);
 session_t *app_worker_proxy_listener (app_worker_t * app, u8 fib_proto,
                                      u8 transport_proto);
 void app_worker_del_detached_sm (app_worker_t * app_wrk, u32 sm_index);
index 18ea77d..f22e364 100644 (file)
@@ -76,13 +76,13 @@ typedef struct ct_main_
 static ct_main_t ct_main;
 
 static inline ct_worker_t *
-ct_worker_get (u32 thread_index)
+ct_worker_get (clib_thread_index_t thread_index)
 {
   return &ct_main.wrk[thread_index];
 }
 
 static ct_connection_t *
-ct_connection_alloc (u32 thread_index)
+ct_connection_alloc (clib_thread_index_t thread_index)
 {
   ct_worker_t *wrk = ct_worker_get (thread_index);
   ct_connection_t *ct;
@@ -99,7 +99,7 @@ ct_connection_alloc (u32 thread_index)
 }
 
 static ct_connection_t *
-ct_connection_get (u32 ct_index, u32 thread_index)
+ct_connection_get (u32 ct_index, clib_thread_index_t thread_index)
 {
   ct_worker_t *wrk = ct_worker_get (thread_index);
 
@@ -659,7 +659,7 @@ ct_init_accepted_session (app_worker_t *server_wrk, ct_connection_t *ct,
 }
 
 static void
-ct_accept_one (u32 thread_index, u32 ho_index)
+ct_accept_one (clib_thread_index_t thread_index, u32 ho_index)
 {
   ct_connection_t *sct, *cct, *ho;
   transport_connection_t *ll_ct;
@@ -768,7 +768,7 @@ ct_accept_one (u32 thread_index, u32 ho_index)
 static void
 ct_accept_rpc_wrk_handler (void *rpc_args)
 {
-  u32 thread_index, n_connects, i, n_pending;
+  clib_thread_index_t thread_index, n_connects, i, n_pending;
   const u32 max_connects = 32;
   ct_worker_t *wrk;
   u8 need_rpc = 0;
@@ -805,7 +805,7 @@ ct_accept_rpc_wrk_handler (void *rpc_args)
 static void
 ct_fwrk_flush_connects (void *rpc_args)
 {
-  u32 thread_index, fwrk_index, n_workers;
+  clib_thread_index_t thread_index, fwrk_index, n_workers;
   ct_main_t *cm = &ct_main;
   ct_worker_t *wrk;
   u8 need_rpc;
@@ -851,7 +851,7 @@ static void
 ct_program_connect_to_wrk (u32 ho_index)
 {
   ct_main_t *cm = &ct_main;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   /* Simple round-robin policy for spreading sessions over workers. We skip
    * thread index 0, i.e., offset the index by 1, when we have workers as it
@@ -946,7 +946,7 @@ ct_session_half_open_get (u32 ct_index)
 }
 
 static void
-ct_session_cleanup (u32 conn_index, u32 thread_index)
+ct_session_cleanup (u32 conn_index, clib_thread_index_t thread_index)
 {
   ct_connection_t *ct, *peer_ct;
 
@@ -1173,7 +1173,7 @@ ct_program_cleanup (ct_connection_t *ct)
 }
 
 static void
-ct_session_close (u32 ct_index, u32 thread_index)
+ct_session_close (u32 ct_index, clib_thread_index_t thread_index)
 {
   ct_connection_t *ct, *peer_ct;
   session_t *s;
@@ -1204,7 +1204,7 @@ ct_session_close (u32 ct_index, u32 thread_index)
 }
 
 static void
-ct_session_reset (u32 ct_index, u32 thread_index)
+ct_session_reset (u32 ct_index, clib_thread_index_t thread_index)
 {
   ct_connection_t *ct;
   ct = ct_connection_get (ct_index, thread_index);
@@ -1213,7 +1213,7 @@ ct_session_reset (u32 ct_index, u32 thread_index)
 }
 
 static transport_connection_t *
-ct_session_get (u32 ct_index, u32 thread_index)
+ct_session_get (u32 ct_index, clib_thread_index_t thread_index)
 {
   return (transport_connection_t *) ct_connection_get (ct_index,
                                                       thread_index);
@@ -1331,7 +1331,7 @@ static u8 *
 format_ct_session (u8 * s, va_list * args)
 {
   u32 ct_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   ct_connection_t *ct;
 
index ad0b18e..a5b1e1f 100644 (file)
@@ -471,7 +471,8 @@ app_worker_connect_notify (app_worker_t * app_wrk, session_t * s,
   session_event_t evt = { .event_type = SESSION_CTRL_EVT_CONNECTED,
                          .as_u64[0] = s ? s->session_index : ~0,
                          .as_u64[1] = (u64) opaque << 32 | (u32) err };
-  u32 thread_index = s ? s->thread_index : vlib_get_thread_index ();
+  clib_thread_index_t thread_index =
+    s ? s->thread_index : vlib_get_thread_index ();
 
   app_worker_add_event_custom (app_wrk, thread_index, &evt);
   return 0;
@@ -782,7 +783,8 @@ app_worker_add_event (app_worker_t *app_wrk, session_t *s,
 }
 
 void
-app_worker_add_event_custom (app_worker_t *app_wrk, u32 thread_index,
+app_worker_add_event_custom (app_worker_t *app_wrk,
+                            clib_thread_index_t thread_index,
                             session_event_t *evt)
 {
   clib_fifo_add1 (app_wrk->wrk_evts[thread_index], *evt);
@@ -832,13 +834,15 @@ app_wrk_send_ctrl_evt (app_worker_t *app_wrk, u8 evt_type, void *msg,
 }
 
 u8
-app_worker_mq_wrk_is_congested (app_worker_t *app_wrk, u32 thread_index)
+app_worker_mq_wrk_is_congested (app_worker_t *app_wrk,
+                               clib_thread_index_t thread_index)
 {
   return app_wrk->wrk_mq_congested[thread_index] > 0;
 }
 
 void
-app_worker_set_mq_wrk_congested (app_worker_t *app_wrk, u32 thread_index)
+app_worker_set_mq_wrk_congested (app_worker_t *app_wrk,
+                                clib_thread_index_t thread_index)
 {
   ASSERT (thread_index == vlib_get_thread_index ());
   if (!app_wrk->wrk_mq_congested[thread_index])
@@ -849,7 +853,8 @@ app_worker_set_mq_wrk_congested (app_worker_t *app_wrk, u32 thread_index)
 }
 
 void
-app_worker_unset_wrk_mq_congested (app_worker_t *app_wrk, u32 thread_index)
+app_worker_unset_wrk_mq_congested (app_worker_t *app_wrk,
+                                  clib_thread_index_t thread_index)
 {
   clib_atomic_fetch_sub_relax (&app_wrk->mq_congested, 1);
   ASSERT (thread_index == vlib_get_thread_index ());
index 8c8b904..341b700 100644 (file)
@@ -702,7 +702,8 @@ segment_manager_del_sessions_filter (segment_manager_t *sm,
 }
 
 int
-segment_manager_try_alloc_fifos (fifo_segment_t *fs, u32 thread_index,
+segment_manager_try_alloc_fifos (fifo_segment_t *fs,
+                                clib_thread_index_t thread_index,
                                 u32 rx_fifo_size, u32 tx_fifo_size,
                                 svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
 {
@@ -740,8 +741,8 @@ segment_manager_try_alloc_fifos (fifo_segment_t *fs, u32 thread_index,
 static inline int
 sm_lookup_segment_and_alloc_fifos (segment_manager_t *sm,
                                   segment_manager_props_t *props,
-                                  u32 thread_index, svm_fifo_t **rx_fifo,
-                                  svm_fifo_t **tx_fifo)
+                                  clib_thread_index_t thread_index,
+                                  svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
 {
   uword free_bytes, max_free_bytes;
   fifo_segment_t *cur, *fs = 0;
@@ -771,7 +772,8 @@ sm_lookup_segment_and_alloc_fifos (segment_manager_t *sm,
 static int
 sm_lock_and_alloc_segment_and_fifos (segment_manager_t *sm,
                                     segment_manager_props_t *props,
-                                    u32 thread_index, svm_fifo_t **rx_fifo,
+                                    clib_thread_index_t thread_index,
+                                    svm_fifo_t **rx_fifo,
                                     svm_fifo_t **tx_fifo)
 {
   int new_fs_index, rv;
@@ -814,10 +816,10 @@ done:
 }
 
 int
-segment_manager_alloc_session_fifos (segment_manager_t * sm,
-                                    u32 thread_index,
-                                    svm_fifo_t ** rx_fifo,
-                                    svm_fifo_t ** tx_fifo)
+segment_manager_alloc_session_fifos (segment_manager_t *sm,
+                                    clib_thread_index_t thread_index,
+                                    svm_fifo_t **rx_fifo,
+                                    svm_fifo_t **tx_fifo)
 {
   segment_manager_props_t *props;
   int rv;
index 86ca23b..0fb957a 100644 (file)
@@ -146,15 +146,15 @@ u64 segment_manager_segment_handle (segment_manager_t * sm,
                                    fifo_segment_t * segment);
 void segment_manager_segment_reader_unlock (segment_manager_t * sm);
 
-int segment_manager_alloc_session_fifos (segment_manager_t * sm,
-                                        u32 thread_index,
-                                        svm_fifo_t ** rx_fifo,
-                                        svm_fifo_t ** tx_fifo);
-int segment_manager_try_alloc_fifos (fifo_segment_t * fs,
-                                    u32 thread_index,
+int segment_manager_alloc_session_fifos (segment_manager_t *sm,
+                                        clib_thread_index_t thread_index,
+                                        svm_fifo_t **rx_fifo,
+                                        svm_fifo_t **tx_fifo);
+int segment_manager_try_alloc_fifos (fifo_segment_t *fs,
+                                    clib_thread_index_t thread_index,
                                     u32 rx_fifo_size, u32 tx_fifo_size,
-                                    svm_fifo_t ** rx_fifo,
-                                    svm_fifo_t ** tx_fifo);
+                                    svm_fifo_t **rx_fifo,
+                                    svm_fifo_t **tx_fifo);
 void segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo,
                                    svm_fifo_t * tx_fifo);
 void segment_manager_detach_fifo (segment_manager_t *sm, svm_fifo_t **f);
index d65371e..7eb6181 100644 (file)
@@ -36,7 +36,8 @@ typedef enum
 } session_evt_family_t;
 
 static inline int
-session_send_evt_to_thread (void *data, void *args, u32 thread_index,
+session_send_evt_to_thread (void *data, void *args,
+                           clib_thread_index_t thread_index,
                            session_evt_type_t evt_type,
                            session_evt_family_t family)
 {
@@ -105,7 +106,8 @@ session_send_io_evt_to_thread (svm_fifo_t * f, session_evt_type_t evt_type)
 
 /* Deprecated, use session_program_* functions */
 int
-session_send_io_evt_to_thread_custom (void *data, u32 thread_index,
+session_send_io_evt_to_thread_custom (void *data,
+                                     clib_thread_index_t thread_index,
                                      session_evt_type_t evt_type)
 {
   return session_send_evt_to_thread (data, 0, thread_index, evt_type,
@@ -154,15 +156,16 @@ session_send_ctrl_evt_to_thread (session_t * s, session_evt_type_t evt_type)
 }
 
 void
-session_send_rpc_evt_to_thread_force (u32 thread_index, void *fp,
-                                     void *rpc_args)
+session_send_rpc_evt_to_thread_force (clib_thread_index_t thread_index,
+                                     void *fp, void *rpc_args)
 {
   session_send_evt_to_thread (fp, rpc_args, thread_index, SESSION_CTRL_EVT_RPC,
                              SESSION_EVT_RPC);
 }
 
 void
-session_send_rpc_evt_to_thread (u32 thread_index, void *fp, void *rpc_args)
+session_send_rpc_evt_to_thread (clib_thread_index_t thread_index, void *fp,
+                               void *rpc_args)
 {
   if (thread_index != vlib_get_thread_index ())
     session_send_rpc_evt_to_thread_force (thread_index, fp, rpc_args);
@@ -225,7 +228,7 @@ sesssion_reschedule_tx (transport_connection_t * tc)
 static void
 session_program_transport_ctrl_evt (session_t * s, session_evt_type_t evt)
 {
-  u32 thread_index = vlib_get_thread_index ();
+  clib_thread_index_t thread_index = vlib_get_thread_index ();
   session_evt_elt_t *elt;
   session_worker_t *wrk;
 
@@ -247,7 +250,7 @@ session_program_transport_ctrl_evt (session_t * s, session_evt_type_t evt)
 }
 
 session_t *
-session_alloc (u32 thread_index)
+session_alloc (clib_thread_index_t thread_index)
 {
   session_worker_t *wrk = &session_main.wrk[thread_index];
   session_t *s;
@@ -466,7 +469,7 @@ session_t *
 session_alloc_for_connection (transport_connection_t * tc)
 {
   session_t *s;
-  u32 thread_index = tc->thread_index;
+  clib_thread_index_t thread_index = tc->thread_index;
 
   ASSERT (thread_index == vlib_get_thread_index ()
          || transport_protocol_is_cl (tc->proto));
@@ -638,7 +641,7 @@ session_dequeue_notify (session_t *s)
  */
 void
 session_main_flush_enqueue_events (transport_proto_t transport_proto,
-                                  u32 thread_index)
+                                  clib_thread_index_t thread_index)
 {
   session_worker_t *wrk = session_main_get_worker (thread_index);
   session_handle_t *handles;
@@ -772,7 +775,7 @@ session_switch_pool_closed_rpc (void *arg)
 typedef struct _session_switch_pool_args
 {
   u32 session_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 new_thread_index;
   u32 new_session_index;
 } session_switch_pool_args_t;
@@ -1064,8 +1067,8 @@ session_stream_accept_notify (transport_connection_t * tc)
  * Accept a stream session. Optionally ping the server by callback.
  */
 int
-session_stream_accept (transport_connection_t * tc, u32 listener_index,
-                      u32 thread_index, u8 notify)
+session_stream_accept (transport_connection_t *tc, u32 listener_index,
+                      clib_thread_index_t thread_index, u8 notify)
 {
   session_t *s;
   int rv;
@@ -1099,8 +1102,8 @@ session_stream_accept (transport_connection_t * tc, u32 listener_index,
 }
 
 int
-session_dgram_accept (transport_connection_t * tc, u32 listener_index,
-                     u32 thread_index)
+session_dgram_accept (transport_connection_t *tc, u32 listener_index,
+                     clib_thread_index_t thread_index)
 {
   app_worker_t *app_wrk;
   session_t *s;
index d6c5cbc..d5402b3 100644 (file)
@@ -336,13 +336,13 @@ vnet_get_session_main ()
 }
 
 always_inline session_worker_t *
-session_main_get_worker (u32 thread_index)
+session_main_get_worker (clib_thread_index_t thread_index)
 {
   return vec_elt_at_index (session_main.wrk, thread_index);
 }
 
 static inline session_worker_t *
-session_main_get_worker_if_valid (u32 thread_index)
+session_main_get_worker_if_valid (clib_thread_index_t thread_index)
 {
   if (thread_index > vec_len (session_main.wrk))
     return 0;
@@ -350,7 +350,7 @@ session_main_get_worker_if_valid (u32 thread_index)
 }
 
 always_inline svm_msg_q_t *
-session_main_get_vpp_event_queue (u32 thread_index)
+session_main_get_vpp_event_queue (clib_thread_index_t thread_index)
 {
   return session_main_get_worker (thread_index)->vpp_event_queue;
 }
@@ -455,7 +455,7 @@ session_evt_alloc_old (session_worker_t * wrk)
 
 int session_wrk_handle_mq (session_worker_t *wrk, svm_msg_q_t *mq);
 
-session_t *session_alloc (u32 thread_index);
+session_t *session_alloc (clib_thread_index_t thread_index);
 void session_free (session_t * s);
 void session_cleanup (session_t *s);
 void session_program_cleanup (session_t *s);
@@ -463,14 +463,14 @@ void session_cleanup_half_open (session_handle_t ho_handle);
 u8 session_is_valid (u32 si, u8 thread_index);
 
 always_inline session_t *
-session_get (u32 si, u32 thread_index)
+session_get (u32 si, clib_thread_index_t thread_index)
 {
   ASSERT (session_is_valid (si, thread_index));
   return pool_elt_at_index (session_main.wrk[thread_index].sessions, si);
 }
 
 always_inline session_t *
-session_get_if_valid (u64 si, u32 thread_index)
+session_get_if_valid (u64 si, clib_thread_index_t thread_index)
 {
   if (thread_index >= vec_len (session_main.wrk))
     return 0;
@@ -518,7 +518,7 @@ session_get_from_handle_safe (session_handle_tu_t handle)
 }
 
 always_inline session_t *
-session_clone_safe (u32 session_index, u32 thread_index)
+session_clone_safe (u32 session_index, clib_thread_index_t thread_index)
 {
   u32 current_thread_index = vlib_get_thread_index (), new_index;
   session_t *old_s, *new_s;
@@ -550,17 +550,18 @@ int session_enqueue_notify_cl (session_t *s);
 /* Deprecated, use session_program_* functions */
 int session_send_io_evt_to_thread (svm_fifo_t *f, session_evt_type_t evt_type);
 /* Deprecated, use session_program_* functions */
-int session_send_io_evt_to_thread_custom (void *data, u32 thread_index,
+int session_send_io_evt_to_thread_custom (void *data,
+                                         clib_thread_index_t thread_index,
                                          session_evt_type_t evt_type);
 int session_program_tx_io_evt (session_handle_tu_t sh,
                               session_evt_type_t evt_type);
 int session_program_rx_io_evt (session_handle_tu_t sh);
 int session_program_transport_io_evt (session_handle_tu_t sh,
                                      session_evt_type_t evt_type);
-void session_send_rpc_evt_to_thread (u32 thread_index, void *fp,
-                                    void *rpc_args);
-void session_send_rpc_evt_to_thread_force (u32 thread_index, void *fp,
-                                          void *rpc_args);
+void session_send_rpc_evt_to_thread (clib_thread_index_t thread_index,
+                                    void *fp, void *rpc_args);
+void session_send_rpc_evt_to_thread_force (clib_thread_index_t thread_index,
+                                          void *fp, void *rpc_args);
 void session_add_self_custom_tx_evt (transport_connection_t * tc,
                                     u8 has_prio);
 void sesssion_reschedule_tx (transport_connection_t * tc);
@@ -593,10 +594,10 @@ void session_half_open_migrate_notify (transport_connection_t *tc);
 int session_half_open_migrated_notify (transport_connection_t *tc);
 void session_transport_closed_notify (transport_connection_t * tc);
 void session_transport_reset_notify (transport_connection_t * tc);
-int session_stream_accept (transport_connection_t * tc, u32 listener_index,
-                          u32 thread_index, u8 notify);
-int session_dgram_accept (transport_connection_t * tc, u32 listener_index,
-                         u32 thread_index);
+int session_stream_accept (transport_connection_t *tc, u32 listener_index,
+                          clib_thread_index_t thread_index, u8 notify);
+int session_dgram_accept (transport_connection_t *tc, u32 listener_index,
+                         clib_thread_index_t thread_index);
 
 /**
  * Initialize session layer for given transport proto and ip version
@@ -616,7 +617,7 @@ void session_register_transport (transport_proto_t transport_proto,
 transport_proto_t session_add_transport_proto (void);
 void session_register_update_time_fn (session_update_time_fn fn, u8 is_add);
 void session_main_flush_enqueue_events (transport_proto_t transport_proto,
-                                       u32 thread_index);
+                                       clib_thread_index_t thread_index);
 void session_queue_run_on_main_thread (vlib_main_t *vm);
 int session_tx_fifo_peek_bytes (transport_connection_t * tc, u8 * buffer,
                                u32 offset, u32 max_bytes);
@@ -860,7 +861,7 @@ session_enqueue_dgram_connection_inline (session_t *s,
        * flushed by calling @ref session_main_flush_enqueue_events () */
       if (!(s->flags & SESSION_F_RX_EVT))
        {
-         u32 thread_index =
+         clib_thread_index_t thread_index =
            is_cl ? vlib_get_thread_index () : s->thread_index;
          session_worker_t *wrk = session_main_get_worker (thread_index);
          ASSERT (s->thread_index == vlib_get_thread_index () || is_cl);
@@ -959,19 +960,19 @@ transport_rx_fifo_req_deq_ntf (transport_connection_t *tc)
 }
 
 always_inline clib_time_type_t
-transport_time_now (u32 thread_index)
+transport_time_now (clib_thread_index_t thread_index)
 {
   return session_main.wrk[thread_index].last_vlib_time;
 }
 
 always_inline clib_us_time_t
-transport_us_time_now (u32 thread_index)
+transport_us_time_now (clib_thread_index_t thread_index)
 {
   return session_main.wrk[thread_index].last_vlib_us_time;
 }
 
 always_inline clib_time_type_t
-transport_seconds_per_loop (u32 thread_index)
+transport_seconds_per_loop (clib_thread_index_t thread_index)
 {
   return session_main.wrk[thread_index].vm->seconds_per_loop;
 }
@@ -1081,7 +1082,8 @@ transport_connection_t *listen_session_get_transport (session_t * s);
  *                     must exist
  */
 always_inline void
-session_add_pending_tx_buffer (u32 thread_index, u32 bi, u32 next_node)
+session_add_pending_tx_buffer (clib_thread_index_t thread_index, u32 bi,
+                              u32 next_node)
 {
   session_worker_t *wrk = session_main_get_worker (thread_index);
   vec_add1 (wrk->pending_tx_buffers, bi);
index 5ac21c4..8192194 100644 (file)
@@ -517,7 +517,7 @@ mq_send_session_migrate_cb (session_t * s, session_handle_t new_sh)
   fifo_segment_t *eq_seg;
   app_worker_t *app_wrk;
   application_t *app;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   thread_index = session_thread_from_handle (new_sh);
   app_wrk = app_worker_get (s->app_wrk_index);
index aff102a..b223eff 100644 (file)
@@ -404,7 +404,7 @@ typedef struct session_cli_filter_
   session_cli_endpt_flags_t endpt_flags;
   session_state_t *states;
   transport_proto_t transport_proto;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u32 verbose;
 } session_cli_filter_t;
 
@@ -521,7 +521,8 @@ session_cli_show_session_filter (vlib_main_t *vm, session_cli_filter_t *sf)
 }
 
 void
-session_cli_show_events_thread (vlib_main_t * vm, u32 thread_index)
+session_cli_show_events_thread (vlib_main_t *vm,
+                               clib_thread_index_t thread_index)
 {
   session_worker_t *wrk;
 
@@ -540,7 +541,7 @@ session_cli_show_events_thread (vlib_main_t * vm, u32 thread_index)
 }
 
 static void
-session_cli_show_events (vlib_main_t * vm, u32 thread_index)
+session_cli_show_events (vlib_main_t *vm, clib_thread_index_t thread_index)
 {
   session_main_t *smm = &session_main;
   if (!thread_index)
@@ -824,7 +825,7 @@ clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
                          vlib_cli_command_t * cmd)
 {
   session_main_t *smm = &session_main;
-  u32 thread_index = 0, clear_all = 0;
+  clib_thread_index_t thread_index = 0, clear_all = 0;
   session_worker_t *wrk;
   u32 session_index = ~0;
   session_t *session;
index 23a5182..dd3bde7 100644 (file)
@@ -35,7 +35,7 @@ app_worker_del_all_events (app_worker_t *app_wrk)
 {
   session_worker_t *wrk;
   session_event_t *evt;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   session_t *s;
 
   for (thread_index = 0; thread_index < vec_len (app_wrk->wrk_evts);
@@ -73,7 +73,8 @@ app_worker_del_all_events (app_worker_t *app_wrk)
 }
 
 always_inline int
-app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
+app_worker_flush_events_inline (app_worker_t *app_wrk,
+                               clib_thread_index_t thread_index,
                                u8 is_builtin)
 {
   application_t *app = application_get (app_wrk->app_index);
@@ -285,7 +286,8 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
 }
 
 int
-app_wrk_flush_wrk_events (app_worker_t *app_wrk, u32 thread_index)
+app_wrk_flush_wrk_events (app_worker_t *app_wrk,
+                         clib_thread_index_t thread_index)
 {
   if (app_worker_application_is_builtin (app_wrk))
     return app_worker_flush_events_inline (app_wrk, thread_index,
@@ -300,7 +302,7 @@ session_wrk_flush_events (session_worker_t *wrk)
 {
   app_worker_t *app_wrk;
   uword app_wrk_index;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   thread_index = wrk->vm->thread_index;
   app_wrk_index = clib_bitmap_first_set (wrk->app_wrks_pending_ntf);
@@ -328,7 +330,7 @@ session_wrk_flush_events (session_worker_t *wrk)
 VLIB_NODE_FN (session_input_node)
 (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 {
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   session_worker_t *wrk;
 
   wrk = session_main_get_worker (thread_index);
index 7678b0e..42b48a0 100644 (file)
@@ -954,10 +954,10 @@ session_lookup_half_open_connection (u64 handle, u8 proto, u8 is_ip4)
  * @return pointer to transport connection, if one is found, 0 otherwise
  */
 transport_connection_t *
-session_lookup_connection_wt4 (u32 fib_index, ip4_address_t * lcl,
-                              ip4_address_t * rmt, u16 lcl_port,
-                              u16 rmt_port, u8 proto, u32 thread_index,
-                              u8 * result)
+session_lookup_connection_wt4 (u32 fib_index, ip4_address_t *lcl,
+                              ip4_address_t *rmt, u16 lcl_port, u16 rmt_port,
+                              u8 proto, clib_thread_index_t thread_index,
+                              u8 *result)
 {
   session_table_t *st;
   session_kv4_t kv4;
@@ -1185,10 +1185,10 @@ session_lookup_safe4 (u32 fib_index, ip4_address_t * lcl, ip4_address_t * rmt,
  * @return pointer to transport connection, if one is found, 0 otherwise
  */
 transport_connection_t *
-session_lookup_connection_wt6 (u32 fib_index, ip6_address_t * lcl,
-                              ip6_address_t * rmt, u16 lcl_port,
-                              u16 rmt_port, u8 proto, u32 thread_index,
-                              u8 * result)
+session_lookup_connection_wt6 (u32 fib_index, ip6_address_t *lcl,
+                              ip6_address_t *rmt, u16 lcl_port, u16 rmt_port,
+                              u8 proto, clib_thread_index_t thread_index,
+                              u8 *result)
 {
   session_table_t *st;
   session_t *s;
index 8f9ff7e..6401663 100644 (file)
@@ -43,25 +43,17 @@ session_t *session_lookup_safe4 (u32 fib_index, ip4_address_t * lcl,
 session_t *session_lookup_safe6 (u32 fib_index, ip6_address_t * lcl,
                                 ip6_address_t * rmt, u16 lcl_port,
                                 u16 rmt_port, u8 proto);
-transport_connection_t *session_lookup_connection_wt4 (u32 fib_index,
-                                                      ip4_address_t * lcl,
-                                                      ip4_address_t * rmt,
-                                                      u16 lcl_port,
-                                                      u16 rmt_port, u8 proto,
-                                                      u32 thread_index,
-                                                      u8 * is_filtered);
+transport_connection_t *session_lookup_connection_wt4 (
+  u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port,
+  u16 rmt_port, u8 proto, clib_thread_index_t thread_index, u8 *is_filtered);
 transport_connection_t *session_lookup_connection4 (u32 fib_index,
                                                    ip4_address_t * lcl,
                                                    ip4_address_t * rmt,
                                                    u16 lcl_port,
                                                    u16 rmt_port, u8 proto);
-transport_connection_t *session_lookup_connection_wt6 (u32 fib_index,
-                                                      ip6_address_t * lcl,
-                                                      ip6_address_t * rmt,
-                                                      u16 lcl_port,
-                                                      u16 rmt_port, u8 proto,
-                                                      u32 thread_index,
-                                                      u8 * is_filtered);
+transport_connection_t *session_lookup_connection_wt6 (
+  u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port,
+  u16 rmt_port, u8 proto, clib_thread_index_t thread_index, u8 *is_filtered);
 transport_connection_t *session_lookup_connection6 (u32 fib_index,
                                                    ip6_address_t * lcl,
                                                    ip6_address_t * rmt,
index 655f7ad..fb4c625 100644 (file)
@@ -64,7 +64,8 @@ session_wrk_timerfd_update (session_worker_t *wrk, u64 time_ns)
 }
 
 always_inline u64
-session_wrk_tfd_timeout (session_wrk_state_t state, u32 thread_index)
+session_wrk_tfd_timeout (session_wrk_state_t state,
+                        clib_thread_index_t thread_index)
 {
   if (state == SESSION_WRK_INTERRUPT)
     return thread_index ? 1e6 : vlib_num_workers () ? 5e8 : 1e6;
@@ -282,7 +283,7 @@ session_mq_handle_connects_rpc (void *arg)
 static void
 session_mq_connect_handler (session_worker_t *wrk, session_evt_elt_t *elt)
 {
-  u32 thread_index = wrk - session_main.wrk;
+  clib_thread_index_t thread_index = wrk - session_main.wrk;
   session_evt_elt_t *he;
 
   if (PREDICT_FALSE (thread_index > transport_cl_thread ()))
@@ -778,7 +779,7 @@ session_wrk_handle_evts_main_rpc (void *args)
   clib_llist_index_t ei, next_ei;
   session_evt_elt_t *he, *elt;
   session_worker_t *fwrk;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   vlib_worker_thread_barrier_sync (vm);
 
@@ -836,7 +837,7 @@ vlib_node_registration_t session_queue_node;
 
 typedef struct
 {
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } session_queue_trace_t;
 
 /* packet trace format function */
@@ -1845,7 +1846,7 @@ static const u32 session_evt_msg_sizes[] = {
 
 always_inline void
 session_update_time_subscribers (session_main_t *smm, clib_time_type_t now,
-                                u32 thread_index)
+                                clib_thread_index_t thread_index)
 {
   session_update_time_fn *fn;
 
@@ -1953,7 +1954,7 @@ static uword
 session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
                       vlib_frame_t * frame)
 {
-  u32 thread_index = vm->thread_index, __clib_unused n_evts;
+  clib_thread_index_t thread_index = vm->thread_index, __clib_unused n_evts;
   session_evt_elt_t *elt, *ctrl_he, *new_he, *old_he;
   session_main_t *smm = vnet_get_session_main ();
   session_worker_t *wrk = &smm->wrk[thread_index];
@@ -2119,7 +2120,7 @@ session_wrk_tfd_write_ready (clib_file_t *cf)
 void
 session_wrk_enable_adaptive_mode (session_worker_t *wrk)
 {
-  u32 thread_index = wrk->vm->thread_index;
+  clib_thread_index_t thread_index = wrk->vm->thread_index;
   clib_file_t template = { 0 };
 
   if ((wrk->timerfd = timerfd_create (CLOCK_MONOTONIC, TFD_NONBLOCK)) < 0)
index 0c5afd4..47a7744 100644 (file)
@@ -34,7 +34,7 @@ typedef union session_handle_tu_
   struct
   {
     u32 session_index;
-    u32 thread_index;
+    clib_thread_index_t thread_index;
   };
 } __attribute__ ((__transparent_union__)) session_handle_tu_t;
 
@@ -220,7 +220,7 @@ typedef struct session_
       u32 session_index;
 
       /** Index of the thread that allocated the session */
-      u32 thread_index;
+      clib_thread_index_t thread_index;
     };
   };
 
index 3bd12d8..edec182 100644 (file)
@@ -106,7 +106,7 @@ format_transport_connection (u8 * s, va_list * args)
 {
   u32 transport_proto = va_arg (*args, u32);
   u32 conn_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   transport_proto_vft_t *tp_vft;
   transport_connection_t *tc;
@@ -431,8 +431,8 @@ default_get_transport_endpoint (transport_connection_t * tc,
 
 void
 transport_get_endpoint (transport_proto_t tp, u32 conn_index,
-                       u32 thread_index, transport_endpoint_t * tep,
-                       u8 is_lcl)
+                       clib_thread_index_t thread_index,
+                       transport_endpoint_t *tep, u8 is_lcl)
 {
   if (tp_vfts[tp].get_transport_endpoint)
     tp_vfts[tp].get_transport_endpoint (conn_index, thread_index, tep,
@@ -830,7 +830,7 @@ u8 *
 format_transport_pacer (u8 * s, va_list * args)
 {
   spacer_t *pacer = va_arg (*args, spacer_t *);
-  u32 thread_index = va_arg (*args, int);
+  clib_thread_index_t thread_index = va_arg (*args, int);
   clib_us_time_t now, diff;
 
   now = transport_us_time_now (thread_index);
@@ -966,7 +966,8 @@ transport_connection_tx_pacer_update_bytes (transport_connection_t * tc,
 }
 
 void
-transport_update_pacer_time (u32 thread_index, clib_time_type_t now)
+transport_update_pacer_time (clib_thread_index_t thread_index,
+                            clib_time_type_t now)
 {
   session_wrk_update_time (session_main_get_worker (thread_index), now);
 }
index de2a6be..31ad36b 100644 (file)
@@ -74,10 +74,10 @@ typedef struct _transport_proto_vft
   u32 (*start_listen) (u32 session_index, transport_endpoint_cfg_t *lcl);
   u32 (*stop_listen) (u32 conn_index);
   int (*connect) (transport_endpoint_cfg_t * rmt);
-  void (*half_close) (u32 conn_index, u32 thread_index);
-  void (*close) (u32 conn_index, u32 thread_index);
-  void (*reset) (u32 conn_index, u32 thread_index);
-  void (*cleanup) (u32 conn_index, u32 thread_index);
+  void (*half_close) (u32 conn_index, clib_thread_index_t thread_index);
+  void (*close) (u32 conn_index, clib_thread_index_t thread_index);
+  void (*reset) (u32 conn_index, clib_thread_index_t thread_index);
+  void (*cleanup) (u32 conn_index, clib_thread_index_t thread_index);
   void (*cleanup_ho) (u32 conn_index);
   clib_error_t *(*enable) (vlib_main_t * vm, u8 is_en);
 
@@ -97,7 +97,8 @@ typedef struct _transport_proto_vft
   /*
    * Connection retrieval
    */
-  transport_connection_t *(*get_connection) (u32 conn_idx, u32 thread_idx);
+  transport_connection_t *(*get_connection) (u32 conn_idx,
+                                            clib_thread_index_t thread_idx);
   transport_connection_t *(*get_listener) (u32 conn_index);
   transport_connection_t *(*get_half_open) (u32 conn_index);
 
@@ -111,13 +112,14 @@ typedef struct _transport_proto_vft
   /*
    *  Properties retrieval/setting
    */
-  void (*get_transport_endpoint) (u32 conn_index, u32 thread_index,
+  void (*get_transport_endpoint) (u32 conn_index,
+                                 clib_thread_index_t thread_index,
                                  transport_endpoint_t *tep, u8 is_lcl);
   void (*get_transport_listener_endpoint) (u32 conn_index,
                                           transport_endpoint_t *tep,
                                           u8 is_lcl);
-  int (*attribute) (u32 conn_index, u32 thread_index, u8 is_get,
-                   transport_endpt_attr_t *attr);
+  int (*attribute) (u32 conn_index, clib_thread_index_t thread_index,
+                   u8 is_get, transport_endpt_attr_t *attr);
 
   /*
    * Properties
@@ -144,8 +146,8 @@ void transport_cleanup (transport_proto_t tp, u32 conn_index,
                        u8 thread_index);
 void transport_cleanup_half_open (transport_proto_t tp, u32 conn_index);
 void transport_get_endpoint (transport_proto_t tp, u32 conn_index,
-                            u32 thread_index, transport_endpoint_t * tep,
-                            u8 is_lcl);
+                            clib_thread_index_t thread_index,
+                            transport_endpoint_t *tep, u8 is_lcl);
 void transport_get_listener_endpoint (transport_proto_t tp, u32 conn_index,
                                      transport_endpoint_t * tep, u8 is_lcl);
 int transport_connection_attribute (transport_proto_t tp, u32 conn_index,
@@ -179,7 +181,8 @@ transport_custom_tx (transport_proto_t tp, void *s,
 }
 
 static inline int
-transport_app_rx_evt (transport_proto_t tp, u32 conn_index, u32 thread_index)
+transport_app_rx_evt (transport_proto_t tp, u32 conn_index,
+                     clib_thread_index_t thread_index)
 {
   transport_connection_t *tc;
   if (!tp_vfts[tp].app_rx_evt)
@@ -368,7 +371,8 @@ transport_connection_tx_pacer_update_bytes (transport_connection_t * tc,
  * @param thread_index thread for which time is updated
  * @param now          time now
  */
-void transport_update_pacer_time (u32 thread_index, clib_time_type_t now);
+void transport_update_pacer_time (clib_thread_index_t thread_index,
+                                 clib_time_type_t now);
 
 #endif /* SRC_VNET_SESSION_TRANSPORT_H_ */
 
index 4a2f861..55cb120 100644 (file)
@@ -113,7 +113,7 @@ typedef struct _transport_connection
 
   u32 s_index;                 /**< Parent session index */
   u32 c_index;                 /**< Connection index in transport pool */
-  u32 thread_index;            /**< Worker-thread index */
+  clib_thread_index_t thread_index; /**< Worker-thread index */
   u8 flags;                    /**< Transport specific flags */
   u8 dscp;                     /**< Differentiated Services Code Point */
 
index 47082e9..8bf0996 100644 (file)
@@ -1196,7 +1196,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
@@ -1500,7 +1500,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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
@@ -1809,7 +1809,7 @@ sr_localsid_un_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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
@@ -2116,7 +2116,7 @@ sr_localsid_un_perf_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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   while (n_left_from > 0)
     {
index 02239d9..ed8c514 100644 (file)
@@ -432,7 +432,7 @@ tcp_connection_close (tcp_connection_t * tc)
 }
 
 static void
-tcp_session_half_close (u32 conn_index, u32 thread_index)
+tcp_session_half_close (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_worker_ctx_t *wrk;
   tcp_connection_t *tc;
@@ -456,7 +456,7 @@ tcp_session_half_close (u32 conn_index, u32 thread_index)
 }
 
 static void
-tcp_session_close (u32 conn_index, u32 thread_index)
+tcp_session_close (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_connection_t *tc;
   tc = tcp_connection_get (conn_index, thread_index);
@@ -464,7 +464,7 @@ tcp_session_close (u32 conn_index, u32 thread_index)
 }
 
 static void
-tcp_session_cleanup (u32 conn_index, u32 thread_index)
+tcp_session_cleanup (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_connection_t *tc;
   tc = tcp_connection_get (conn_index, thread_index);
@@ -487,7 +487,7 @@ tcp_session_cleanup_ho (u32 conn_index)
 }
 
 static void
-tcp_session_reset (u32 conn_index, u32 thread_index)
+tcp_session_reset (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_connection_t *tc;
   tc = tcp_connection_get (conn_index, thread_index);
@@ -856,7 +856,7 @@ static u8 *
 format_tcp_session (u8 * s, va_list * args)
 {
   u32 tci = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   tcp_connection_t *tc;
 
@@ -906,7 +906,7 @@ format_tcp_half_open_session (u8 * s, va_list * args)
 }
 
 static transport_connection_t *
-tcp_session_get_transport (u32 conn_index, u32 thread_index)
+tcp_session_get_transport (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_connection_t *tc = tcp_connection_get (conn_index, thread_index);
   if (PREDICT_FALSE (!tc))
@@ -1016,8 +1016,8 @@ tcp_get_attribute (tcp_connection_t *tc, transport_endpt_attr_t *attr)
 }
 
 static int
-tcp_session_attribute (u32 conn_index, u32 thread_index, u8 is_get,
-                      transport_endpt_attr_t *attr)
+tcp_session_attribute (u32 conn_index, clib_thread_index_t thread_index,
+                      u8 is_get, transport_endpt_attr_t *attr)
 {
   tcp_connection_t *tc = tcp_connection_get (conn_index, thread_index);
 
@@ -1279,7 +1279,7 @@ tcp_dispatch_pending_timers (tcp_worker_ctx_t * wrk)
 static void
 tcp_handle_cleanups (tcp_worker_ctx_t * wrk, clib_time_type_t now)
 {
-  u32 thread_index = wrk->vm->thread_index;
+  clib_thread_index_t thread_index = wrk->vm->thread_index;
   tcp_cleanup_req_t *req;
   tcp_connection_t *tc;
 
@@ -1404,7 +1404,8 @@ tcp_reschedule (tcp_connection_t * tc)
 static void
 tcp_expired_timers_dispatch (u32 * expired_timers)
 {
-  u32 thread_index = vlib_get_thread_index (), n_left, max_per_loop;
+  clib_thread_index_t thread_index = vlib_get_thread_index (), n_left,
+                     max_per_loop;
   u32 connection_index, timer_id, n_expired, max_loops;
   tcp_worker_ctx_t *wrk;
   tcp_connection_t *tc;
index 830b81d..67dc740 100644 (file)
@@ -299,7 +299,7 @@ vnet_get_tcp_main ()
 }
 
 always_inline tcp_worker_ctx_t *
-tcp_get_worker (u32 thread_index)
+tcp_get_worker (clib_thread_index_t thread_index)
 {
   ASSERT (thread_index < vec_len (tcp_main.wrk));
   return &tcp_main.wrk[thread_index];
@@ -314,8 +314,8 @@ void tcp_connection_cleanup (tcp_connection_t * tc);
 void tcp_connection_del (tcp_connection_t * tc);
 int tcp_half_open_connection_cleanup (tcp_connection_t * tc);
 
-void tcp_send_reset_w_pkt (tcp_connection_t * tc, vlib_buffer_t * pkt,
-                          u32 thread_index, u8 is_ip4);
+void tcp_send_reset_w_pkt (tcp_connection_t *tc, vlib_buffer_t *pkt,
+                          clib_thread_index_t thread_index, u8 is_ip4);
 void tcp_send_reset (tcp_connection_t * tc);
 void tcp_send_syn (tcp_connection_t * tc);
 void tcp_send_synack (tcp_connection_t * tc);
index cf2b9a1..63abcd1 100644 (file)
@@ -49,7 +49,7 @@ typedef struct cubic_data_
 STATIC_ASSERT (sizeof (cubic_data_t) <= TCP_CC_DATA_SZ, "cubic data len");
 
 static inline f64
-cubic_time (u32 thread_index)
+cubic_time (clib_thread_index_t thread_index)
 {
   return tcp_time_now_us (thread_index);
 }
index 4c48f9e..6ab467d 100644 (file)
@@ -56,7 +56,7 @@ tcp_buffer_hdr (vlib_buffer_t * b)
 }
 
 always_inline tcp_connection_t *
-tcp_connection_get (u32 conn_index, u32 thread_index)
+tcp_connection_get (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index);
   if (PREDICT_FALSE (pool_is_free_index (wrk->connections, conn_index)))
@@ -65,7 +65,7 @@ tcp_connection_get (u32 conn_index, u32 thread_index)
 }
 
 always_inline tcp_connection_t *
-tcp_connection_get_if_valid (u32 conn_index, u32 thread_index)
+tcp_connection_get_if_valid (u32 conn_index, clib_thread_index_t thread_index)
 {
   tcp_worker_ctx_t *wrk;
   if (thread_index >= vec_len (tcp_main.wrk))
@@ -215,7 +215,7 @@ tcp_is_lost_fin (tcp_connection_t * tc)
  * Time used to generate timestamps, not the timestamp
  */
 always_inline u32
-tcp_time_tstamp (u32 thread_index)
+tcp_time_tstamp (clib_thread_index_t thread_index)
 {
   return tcp_main.wrk[thread_index].time_tstamp;
 }
@@ -230,7 +230,7 @@ tcp_tstamp (tcp_connection_t * tc)
 }
 
 always_inline f64
-tcp_time_now_us (u32 thread_index)
+tcp_time_now_us (clib_thread_index_t thread_index)
 {
   return tcp_main.wrk[thread_index].time_us;
 }
index 7977a6c..47ae851 100644 (file)
@@ -498,7 +498,7 @@ tcp_estimate_initial_rtt (tcp_connection_t * tc)
 static void
 tcp_handle_postponed_dequeues (tcp_worker_ctx_t * wrk)
 {
-  u32 thread_index = wrk->vm->thread_index;
+  clib_thread_index_t thread_index = wrk->vm->thread_index;
   u32 *pending_deq_acked;
   tcp_connection_t *tc;
   int i;
@@ -1011,7 +1011,8 @@ tcp_program_disconnect (tcp_worker_ctx_t * wrk, tcp_connection_t * tc)
 static void
 tcp_handle_disconnects (tcp_worker_ctx_t * wrk)
 {
-  u32 thread_index, *pending_disconnects, *pending_resets;
+  clib_thread_index_t thread_index;
+  u32 *pending_disconnects, *pending_resets;
   tcp_connection_t *tc;
   int i;
 
@@ -1397,7 +1398,8 @@ always_inline uword
 tcp46_established_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
                          vlib_frame_t * frame, int is_ip4)
 {
-  u32 thread_index = vm->thread_index, n_left_from, *from;
+  clib_thread_index_t thread_index = vm->thread_index;
+  u32 n_left_from, *from;
   tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index);
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
   u16 err_counters[TCP_N_ERROR] = { 0 };
@@ -2025,7 +2027,7 @@ static void
 tcp46_rcv_process_trace_frame (vlib_main_t *vm, vlib_node_runtime_t *node,
                               u32 *from, u32 n_bufs)
 {
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   tcp_connection_t *tc = 0;
   tcp_rx_trace_t *t;
   vlib_buffer_t *b;
@@ -2051,7 +2053,8 @@ always_inline uword
 tcp46_rcv_process_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
                          vlib_frame_t *frame, int is_ip4)
 {
-  u32 thread_index = vm->thread_index, n_left_from, *from, max_deq;
+  clib_thread_index_t thread_index = vm->thread_index;
+  u32 n_left_from, *from, max_deq;
   tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index);
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
 
@@ -2544,7 +2547,7 @@ tcp46_listen_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
 {
   u32 n_left_from, *from, n_syns = 0;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
-  u32 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
   u32 tw_iss = 0;
 
   from = vlib_frame_vector_args (frame);
index 2e8a108..120ad6c 100644 (file)
@@ -646,8 +646,8 @@ tcp_buffer_make_reset (vlib_main_t *vm, vlib_buffer_t *b, u8 is_ip4)
  *  It extracts connection info out of original packet
  */
 void
-tcp_send_reset_w_pkt (tcp_connection_t * tc, vlib_buffer_t * pkt,
-                     u32 thread_index, u8 is_ip4)
+tcp_send_reset_w_pkt (tcp_connection_t *tc, vlib_buffer_t *pkt,
+                     clib_thread_index_t thread_index, u8 is_ip4)
 {
   tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index);
   vlib_main_t *vm = wrk->vm;
index 08809f7..d409ee5 100644 (file)
@@ -21,7 +21,7 @@
 static tls_main_t tls_main;
 tls_engine_vft_t *tls_vfts;
 
-void tls_disconnect (u32 ctx_handle, u32 thread_index);
+void tls_disconnect (u32 ctx_handle, clib_thread_index_t thread_index);
 
 void
 tls_disconnect_transport (tls_ctx_t * ctx)
@@ -684,7 +684,7 @@ tls_connect (transport_endpoint_cfg_t * tep)
 }
 
 void
-tls_disconnect (u32 ctx_handle, u32 thread_index)
+tls_disconnect (u32 ctx_handle, clib_thread_index_t thread_index)
 {
   tls_ctx_t *ctx;
 
@@ -820,7 +820,7 @@ tls_stop_listen (u32 lctx_index)
 }
 
 transport_connection_t *
-tls_connection_get (u32 ctx_index, u32 thread_index)
+tls_connection_get (u32 ctx_index, clib_thread_index_t thread_index)
 {
   tls_ctx_t *ctx;
   ctx = tls_ctx_get_w_thread (ctx_index, thread_index);
@@ -959,7 +959,7 @@ u8 *
 format_tls_connection (u8 * s, va_list * args)
 {
   u32 ctx_index = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   tls_ctx_t *ctx;
 
@@ -1013,8 +1013,8 @@ format_tls_half_open (u8 * s, va_list * args)
 }
 
 static void
-tls_transport_endpoint_get (u32 ctx_handle, u32 thread_index,
-                           transport_endpoint_t * tep, u8 is_lcl)
+tls_transport_endpoint_get (u32 ctx_handle, clib_thread_index_t thread_index,
+                           transport_endpoint_t *tep, u8 is_lcl)
 {
   tls_ctx_t *ctx = tls_ctx_get_w_thread (ctx_handle, thread_index);
   session_t *ts;
@@ -1179,7 +1179,7 @@ dtls_half_open_get (u32 ho_index)
 }
 
 static void
-dtls_cleanup_callback (u32 ctx_index, u32 thread_index)
+dtls_cleanup_callback (u32 ctx_index, clib_thread_index_t thread_index)
 {
   /* No op */
 }
index 244e204..7e69432 100644 (file)
@@ -146,10 +146,10 @@ typedef struct tls_main_
 typedef struct tls_engine_vft_
 {
   u32 (*ctx_alloc) (void);
-  u32 (*ctx_alloc_w_thread) (u32 thread_index);
+  u32 (*ctx_alloc_w_thread) (clib_thread_index_t thread_index);
   void (*ctx_free) (tls_ctx_t * ctx);
   void *(*ctx_detach) (tls_ctx_t *ctx);
-  u32 (*ctx_attach) (u32 thread_index, void *ctx);
+  u32 (*ctx_attach) (clib_thread_index_t thread_index, void *ctx);
   tls_ctx_t *(*ctx_get) (u32 ctx_index);
   tls_ctx_t *(*ctx_get_w_thread) (u32 ctx_index, u8 thread_index);
   int (*ctx_init_client) (tls_ctx_t * ctx);
index 3e3f59f..2f12a77 100644 (file)
@@ -23,7 +23,8 @@ tls_ctx_alloc (crypto_engine_type_t engine_type)
 }
 
 static inline u32
-tls_ctx_alloc_w_thread (crypto_engine_type_t engine_type, u32 thread_index)
+tls_ctx_alloc_w_thread (crypto_engine_type_t engine_type,
+                       clib_thread_index_t thread_index)
 {
   u32 ctx_index;
   ctx_index = tls_vfts[engine_type].ctx_alloc_w_thread (thread_index);
@@ -65,7 +66,8 @@ tls_ctx_init_client (tls_ctx_t *ctx)
 }
 
 static inline u32
-tls_ctx_attach (crypto_engine_type_t engine_type, u32 thread_index, void *ctx)
+tls_ctx_attach (crypto_engine_type_t engine_type,
+               clib_thread_index_t thread_index, void *ctx)
 {
   u32 ctx_index;
   ctx_index = tls_vfts[engine_type].ctx_attach (thread_index, ctx);
index d997da2..2c2b744 100644 (file)
@@ -71,7 +71,7 @@ udp_connection_unregister_port (u16 lcl_port, u8 is_ip4)
 }
 
 udp_connection_t *
-udp_connection_alloc (u32 thread_index)
+udp_connection_alloc (clib_thread_index_t thread_index)
 {
   udp_worker_t *wrk = udp_worker_get (thread_index);
   udp_connection_t *uc;
@@ -115,7 +115,7 @@ udp_connection_delete (udp_connection_t * uc)
 static void
 udp_handle_cleanups (void *args)
 {
-  u32 thread_index = (u32) pointer_to_uword (args);
+  clib_thread_index_t thread_index = (u32) pointer_to_uword (args);
   udp_connection_t *uc;
   udp_worker_t *wrk;
   u32 *uc_index;
@@ -361,7 +361,7 @@ udp_push_header (transport_connection_t *tc, vlib_buffer_t **bs, u32 n_bufs)
 }
 
 static transport_connection_t *
-udp_session_get (u32 connection_index, u32 thread_index)
+udp_session_get (u32 connection_index, clib_thread_index_t thread_index)
 {
   udp_connection_t *uc;
   uc = udp_connection_get (connection_index, thread_index);
@@ -371,7 +371,7 @@ udp_session_get (u32 connection_index, u32 thread_index)
 }
 
 static void
-udp_session_close (u32 connection_index, u32 thread_index)
+udp_session_close (u32 connection_index, clib_thread_index_t thread_index)
 {
   udp_connection_t *uc;
 
@@ -386,7 +386,7 @@ udp_session_close (u32 connection_index, u32 thread_index)
 }
 
 static void
-udp_session_cleanup (u32 connection_index, u32 thread_index)
+udp_session_cleanup (u32 connection_index, clib_thread_index_t thread_index)
 {
   udp_connection_t *uc;
   uc = udp_connection_get (connection_index, thread_index);
@@ -421,7 +421,7 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
   udp_main_t *um = &udp_main;
   ip46_address_t lcl_addr;
   udp_connection_t *uc;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   u16 lcl_port;
   int rv;
 
@@ -484,7 +484,7 @@ static transport_connection_t *
 udp_session_get_half_open (u32 conn_index)
 {
   udp_connection_t *uc;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 
   /* We don't poll main thread if we have workers */
   thread_index = transport_cl_thread ();
@@ -498,7 +498,7 @@ static u8 *
 format_udp_session (u8 * s, va_list * args)
 {
   u32 uci = va_arg (*args, u32);
-  u32 thread_index = va_arg (*args, u32);
+  clib_thread_index_t thread_index = va_arg (*args, u32);
   u32 verbose = va_arg (*args, u32);
   udp_connection_t *uc;
 
index 2e280f7..57a0fe9 100644 (file)
@@ -176,13 +176,13 @@ void udp_add_dst_port (udp_main_t * um, udp_dst_port_t dst_port,
                       char *dst_port_name, u8 is_ip4);
 
 always_inline udp_worker_t *
-udp_worker_get (u32 thread_index)
+udp_worker_get (clib_thread_index_t thread_index)
 {
   return vec_elt_at_index (udp_main.wrk, thread_index);
 }
 
 always_inline udp_connection_t *
-udp_connection_get (u32 conn_index, u32 thread_index)
+udp_connection_get (u32 conn_index, clib_thread_index_t thread_index)
 {
   udp_worker_t *wrk = udp_worker_get (thread_index);
 
@@ -210,11 +210,12 @@ udp_connection_from_transport (transport_connection_t * tc)
 }
 
 void udp_connection_free (udp_connection_t * uc);
-udp_connection_t *udp_connection_alloc (u32 thread_index);
+udp_connection_t *udp_connection_alloc (clib_thread_index_t thread_index);
 void udp_connection_share_port (u16 lcl_port, u8 is_ip4);
 
 always_inline udp_connection_t *
-udp_connection_clone_safe (u32 connection_index, u32 thread_index)
+udp_connection_clone_safe (u32 connection_index,
+                          clib_thread_index_t thread_index)
 {
   u32 current_thread_index = vlib_get_thread_index (), new_index;
   udp_connection_t *old_c, *new_c;
index a86614f..99658ef 100644 (file)
@@ -78,7 +78,7 @@ udp_encap_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
   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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   n_left_from = frame->n_vectors;
   next_index = node->cached_next_index;
index 19cc04c..e4aaa0c 100644 (file)
@@ -36,7 +36,7 @@ typedef struct
 {
   u32 connection;
   u32 disposition;
-  u32 thread_index;
+  clib_thread_index_t thread_index;
 } udp_input_trace_t;
 
 /* packet trace format function */
@@ -101,8 +101,8 @@ udp_trace_buffer (vlib_main_t * vm, vlib_node_runtime_t * node,
 }
 
 static udp_connection_t *
-udp_connection_accept (udp_connection_t * listener, session_dgram_hdr_t * hdr,
-                      u32 thread_index)
+udp_connection_accept (udp_connection_t *listener, session_dgram_hdr_t *hdr,
+                      clib_thread_index_t thread_index)
 {
   udp_connection_t *uc;
 
@@ -129,9 +129,10 @@ udp_connection_accept (udp_connection_t * listener, session_dgram_hdr_t * hdr,
 }
 
 static void
-udp_connection_enqueue (udp_connection_t * uc0, session_t * s0,
-                       session_dgram_hdr_t * hdr0, u32 thread_index,
-                       vlib_buffer_t * b, u8 queue_event, u32 * error0)
+udp_connection_enqueue (udp_connection_t *uc0, session_t *s0,
+                       session_dgram_hdr_t *hdr0,
+                       clib_thread_index_t thread_index, vlib_buffer_t *b,
+                       u8 queue_event, u32 *error0)
 {
   int wrote0;
 
@@ -258,7 +259,8 @@ always_inline uword
 udp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
                    vlib_frame_t * frame, u8 is_ip4)
 {
-  u32 thread_index = vm->thread_index, n_left_from, *from, *first_buffer;
+  clib_thread_index_t thread_index = vm->thread_index;
+  u32 n_left_from, *from, *first_buffer;
   vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
   u16 err_counters[UDP_N_ERROR] = { 0 };
 
index 22b9414..87bb150 100644 (file)
@@ -52,7 +52,7 @@ format_udp_tx_trace (u8 *s, va_list *args)
 }
 
 always_inline udp_connection_t *
-udp_output_get_connection (vlib_buffer_t *b, u32 thread_index)
+udp_output_get_connection (vlib_buffer_t *b, clib_thread_index_t thread_index)
 {
   if (PREDICT_FALSE (vnet_buffer (b)->tcp.flags & UDP_CONN_F_LISTEN))
     return udp_listener_get (vnet_buffer (b)->tcp.connection_index);
index eca846d..9013f4b 100644 (file)
@@ -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 = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   for (i = 0; i < n_packets; i++)
     {
@@ -242,7 +242,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_get_default_data_size (vm);
-  u16 thread_index = vm->thread_index;
+  clib_thread_index_t thread_index = vm->thread_index;
 
   /** Make sure we have some RX buffers. */
   {
index a7b525d..dcb2984 100644 (file)
@@ -32,7 +32,7 @@ u64 vlib_refcount_get(vlib_refcount_t *r, u32 index)
 {
   u64 count = 0;
   vlib_thread_main_t *tm = vlib_get_thread_main ();
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   for (thread_index = 0; thread_index < tm->n_vlib_mains; thread_index++) {
     vlib_refcount_lock(r->per_cpu[thread_index].counter_lock);
     if (index < vec_len(r->per_cpu[thread_index].counters))
index 4c7d7bd..63bc80d 100644 (file)
@@ -64,8 +64,9 @@ void vlib_refcount_unlock (clib_spinlock_t counter_lock)
 
 void __vlib_refcount_resize(vlib_refcount_per_cpu_t *per_cpu, u32 size);
 
-static_always_inline
-void vlib_refcount_add(vlib_refcount_t *r, u32 thread_index, u32 counter_index, i32 v)
+static_always_inline void
+vlib_refcount_add (vlib_refcount_t *r, clib_thread_index_t thread_index,
+                  u32 counter_index, i32 v)
 {
   vlib_refcount_per_cpu_t *per_cpu = &r->per_cpu[thread_index];
   if (PREDICT_FALSE(counter_index >= vec_len(per_cpu->counters)))
@@ -80,7 +81,7 @@ static_always_inline
 void vlib_refcount_init(vlib_refcount_t *r)
 {
   vlib_thread_main_t *tm = vlib_get_thread_main ();
-  u32 thread_index;
+  clib_thread_index_t thread_index;
   r->per_cpu = 0;
   vec_validate (r->per_cpu, tm->n_vlib_mains - 1);
 
index 53435c4..4fd1619 100644 (file)
@@ -40,7 +40,7 @@ extern void throttle_init (throttle_t *t, u32 n_threads, u32 buckets,
                           f64 time);
 
 always_inline u64
-throttle_seed (throttle_t * t, u32 thread_index, f64 time_now)
+throttle_seed (throttle_t *t, clib_thread_index_t thread_index, f64 time_now)
 {
   if (time_now - t->last_seed_change_time[thread_index] > t->time)
     {
@@ -53,7 +53,8 @@ throttle_seed (throttle_t * t, u32 thread_index, f64 time_now)
 }
 
 always_inline int
-throttle_check (throttle_t * t, u32 thread_index, u64 hash, u64 seed)
+throttle_check (throttle_t *t, clib_thread_index_t thread_index, u64 hash,
+               u64 seed)
 {
   ASSERT (is_pow2 (t->buckets));
 
index 83a8b2a..08a5fa2 100644 (file)
@@ -194,7 +194,6 @@ set(VPPINFRA_HEADERS
   random_isaac.h
   rbtree.h
   serialize.h
-  smp.h
   socket.h
   sparse_vec.h
   stack.h
index d488b1a..975607d 100644 (file)
@@ -544,7 +544,7 @@ BV (make_working_copy) (BVT (clib_bihash) * h, BVT (clib_bihash_bucket) * b)
   BVT (clib_bihash_value) * v;
   BVT (clib_bihash_bucket) working_bucket __attribute__ ((aligned (8)));
   BVT (clib_bihash_value) * working_copy;
-  u32 thread_index = os_get_thread_index ();
+  clib_thread_index_t thread_index = os_get_thread_index ();
   int log2_working_copy_length;
 
   ASSERT (h->alloc_lock[0]);
@@ -696,7 +696,7 @@ static_always_inline int BV (clib_bihash_add_del_inline_with_hash) (
   int i, limit;
   u64 new_hash;
   u32 new_log2_pages, old_log2_pages;
-  u32 thread_index = os_get_thread_index ();
+  clib_thread_index_t thread_index = os_get_thread_index ();
   int mark_bucket_linear;
   int resplit_once;
 
index 4ab7bcf..e4badb7 100644 (file)
@@ -381,11 +381,12 @@ clib_bitmap_set_region (uword * bitmap, uword i, uword value, uword n_bits)
     @param ai - the bitmap
     @param body - the expression to evaluate for each set bit
 */
-#define clib_bitmap_foreach(i,ai)                                      \
-  if (ai)                                                              \
-    for (i = clib_bitmap_first_set (ai);                               \
-        i != ~0;                                                       \
-        i = clib_bitmap_next_set (ai, i + 1))
+#define clib_bitmap_foreach(i, ai)                                            \
+  if (ai)                                                                     \
+    for (uword __index = clib_bitmap_first_set (ai),                          \
+              __clib_unused __dummy = (i) = __index;                         \
+        __index != ~0;                                                       \
+        __index = clib_bitmap_next_set (ai, __index + 1), (i) = __index)
 
 /** Return the lowest numbered set bit in a bitmap
     @param ai - pointer to the bitmap
index 22d6fee..99a1e97 100644 (file)
@@ -155,7 +155,7 @@ clib_file_del_by_index (clib_file_main_t *fm, uword index)
 }
 
 always_inline void
-clib_file_free_deleted (clib_file_main_t *fm, u32 thread_index)
+clib_file_free_deleted (clib_file_main_t *fm, clib_thread_index_t thread_index)
 {
   u32 n_keep = 0;
 
@@ -179,7 +179,7 @@ clib_file_free_deleted (clib_file_main_t *fm, u32 thread_index)
 
 always_inline void
 clib_file_set_polling_thread (clib_file_main_t *fm, uword index,
-                             u32 thread_index)
+                             clib_thread_index_t thread_index)
 {
   clib_file_t *f = clib_file_get (fm, index);
   fm->file_update (f, UNIX_FILE_UPDATE_DELETE);
index cd3b428..229ed37 100644 (file)
@@ -56,29 +56,29 @@ void os_out_of_memory (void);
 /* Estimate, measure or divine CPU timestamp clock frequency. */
 f64 os_cpu_clock_frequency (void);
 
-extern __thread uword __os_thread_index;
-extern __thread uword __os_numa_index;
+extern __thread clib_thread_index_t __os_thread_index;
+extern __thread clib_numa_node_index_t __os_numa_index;
 
-static_always_inline uword
+static_always_inline clib_thread_index_t
 os_get_thread_index (void)
 {
   return __os_thread_index;
 }
 
 static_always_inline void
-os_set_thread_index (uword thread_index)
+os_set_thread_index (clib_thread_index_t thread_index)
 {
   __os_thread_index = thread_index;
 }
 
-static_always_inline uword
+static_always_inline clib_numa_node_index_t
 os_get_numa_index (void)
 {
   return __os_numa_index;
 }
 
 static_always_inline void
-os_set_numa_index (uword numa_index)
+os_set_numa_index (clib_numa_node_index_t numa_index)
 {
   __os_numa_index = numa_index;
 }
@@ -94,14 +94,6 @@ os_get_cpu_number (void)
 
 uword os_get_nthreads (void);
 
-#include <vppinfra/smp.h>
+#include <vppinfra/cache.h>
 
 #endif /* included_os_h */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vppinfra/smp.h b/src/vppinfra/smp.h
deleted file mode 100644 (file)
index 2b3ed54..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
-  Copyright (c) 2001-2005 Eliot Dresselhaus
-
-  Permission is hereby granted, free of charge, to any person obtaining
-  a copy of this software and associated documentation files (the
-  "Software"), to deal in the Software without restriction, including
-  without limitation the rights to use, copy, modify, merge, publish,
-  distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so, subject to
-  the following conditions:
-
-  The above copyright notice and this permission notice shall be
-  included in all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef included_clib_smp_h
-#define included_clib_smp_h
-
-#include <vppinfra/cache.h>
-#include <vppinfra/os.h>       /* for os_panic */
-
-#if defined (i386) || defined (__x86_64__)
-#define clib_smp_pause() do { asm volatile ("pause"); } while (0)
-#elif defined (__aarch64__) || defined (__arm__)
-#define clib_smp_pause() do { asm volatile ("isb" ::: "memory"); } while (0)
-#endif
-
-#ifndef clib_smp_pause
-#define clib_smp_pause() do { } while (0)
-#endif
-
-#ifdef CLIB_UNIX
-#include <sched.h>
-
-always_inline void
-os_sched_yield (void)
-{
-  sched_yield ();
-}
-#else
-always_inline void
-os_sched_yield (void)
-{
-  clib_smp_pause ();
-}
-#endif
-
-
-#endif /* included_clib_smp_h */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
index 2abf2b2..f4dad84 100644 (file)
@@ -48,6 +48,7 @@
 #include <netdb.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <sched.h>
 
 #include <vppinfra/mem.h>
 #include <vppinfra/vec.h>
index ad85af3..9ed1754 100644 (file)
@@ -211,6 +211,10 @@ typedef uword uwordu __attribute__ ((aligned (1), __may_alias__));
        __ptr_ptr - (ARRAY_LEN (__ptr_array) - 1) < __ptr_array;               \
        __var = *++__ptr_ptr)
 
+typedef u16 clib_thread_index_t;
+typedef u8 clib_numa_node_index_t;
+#define CLIB_INVALID_THREAD_INDEX CLIB_U16_MAX
+
 #endif /* included_clib_types_h */
 
 /*
index c0cf507..2255cc7 100644 (file)
@@ -64,8 +64,8 @@
 #include <stdio.h>             /* for sprintf */
 #include <limits.h>
 
-__clib_export __thread uword __os_thread_index = 0;
-__clib_export __thread uword __os_numa_index = 0;
+__clib_export __thread clib_thread_index_t __os_thread_index = 0;
+__clib_export __thread clib_numa_node_index_t __os_numa_index = 0;
 __clib_export cpu_set_t __os_affinity_cpu_set;
 __clib_export clib_bitmap_t *os_get_cpu_affinity_bitmap ();