summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2022-12-22 15:01:32 +0100
committerFlorin Coras <florin.coras@gmail.com>2022-12-23 17:18:53 +0000
commitc5b0fcd159d471f0422b303a2efa5ba6e8ddfcd6 (patch)
treedf43592fa4aec20ddf0eaaf7db229e78042e5968 /src/vnet
parentb89db0cf75a5fe2768b7ef53fac2efb8c4b84ca0 (diff)
hsa: fix echo client workers initialization
We were creating an additional worker not backed by any VPP threads, leading off-by-1 access in the session main workers vector. Also uses vec_elt_at_index() when accessing session main workers vector elements to catch those errors more easily. Type: fix Change-Id: I6059116b7b64ae6b26ad83c1fcf55df8522868ad Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/session.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index b8cc1c383c9..ab92295ea42 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -709,7 +709,7 @@ vnet_get_session_main ()
always_inline session_worker_t *
session_main_get_worker (u32 thread_index)
{
- return &session_main.wrk[thread_index];
+ return vec_elt_at_index (session_main.wrk, thread_index);
}
static inline session_worker_t *
@@ -717,13 +717,13 @@ session_main_get_worker_if_valid (u32 thread_index)
{
if (thread_index > vec_len (session_main.wrk))
return 0;
- return &session_main.wrk[thread_index];
+ return session_main_get_worker (thread_index);
}
always_inline svm_msg_q_t *
session_main_get_vpp_event_queue (u32 thread_index)
{
- return session_main.wrk[thread_index].vpp_event_queue;
+ return session_main_get_worker (thread_index)->vpp_event_queue;
}
always_inline u8