From f8e1363c4fc6b6b258663eeff19ee20d2b038256 Mon Sep 17 00:00:00 2001 From: hanlin Date: Fri, 21 Aug 2020 11:05:36 +0800 Subject: vcl: fix duplicated key of session_index_to_vlsh_table in multiple threads vcl workers scenario Type: fix In multiple threads vcl workers scenario, multiple vcl workes can create sessions with same index. Because only one vls worker created, key of session_index_to_vlsh_table is duplicated. Signed-off-by: hanlin Change-Id: I7e1f5bc471adc5378194452aef85e611f5d0df1d --- src/vcl/vcl_private.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/vcl/vcl_private.h') diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index 231d7ebcbcf..c930803f760 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -403,6 +403,13 @@ vcl_session_get (vcl_worker_t * wrk, u32 session_index) return pool_elt_at_index (wrk->sessions, session_index); } +static inline vcl_session_handle_t +vcl_session_handle_from_wrk_session_index (u32 session_index, u32 wrk_index) +{ + ASSERT (session_index < 2 << 24); + return (wrk_index << 24 | session_index); +} + static inline vcl_session_handle_t vcl_session_handle_from_index (u32 session_index) { -- cgit 1.2.3-korg