Use thread local storage for thread index
[vpp.git] / src / plugins / dpdk / ipsec / ipsec.h
index 3465b36..f0f793c 100644 (file)
@@ -18,6 +18,7 @@
 #include <vnet/vnet.h>
 
 #undef always_inline
+#include <rte_config.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 
@@ -94,8 +95,8 @@ static_always_inline void
 crypto_alloc_cops ()
 {
   dpdk_crypto_main_t *dcm = &dpdk_crypto_main;
-  u32 cpu_index = os_get_cpu_number ();
-  crypto_worker_main_t *cwm = &dcm->workers_main[cpu_index];
+  u32 thread_index = vlib_get_thread_index ();
+  crypto_worker_main_t *cwm = &dcm->workers_main[thread_index];
   unsigned socket_id = rte_socket_id ();
   crypto_qp_data_t *qpd;