#define VCL_SESS_ATTR_TEST(ATTR, VAL) \
((ATTR) & (1 << (VAL)) ? 1 : 0)
-typedef struct vcl_shared_session_
-{
- u32 ss_index;
- u32 *workers;
- u32 session_index;
-} vcl_shared_session_t;
-
typedef struct
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
u32 sndbuf_size; // VPP-TBD: Hack until support setsockopt(SO_SNDBUF)
u32 rcvbuf_size; // VPP-TBD: Hack until support setsockopt(SO_RCVBUF)
u32 user_mss; // VPP-TBD: Hack until support setsockopt(TCP_MAXSEG)
- u8 *segment_name;
- u32 sm_seg_index;
u32 client_context;
u64 vpp_handle;
u32 vpp_thread_index;
u8 is_vep_session;
u8 has_rx_evt;
u32 attr;
- u32 wait_cont_idx;
vppcom_epoll_t vep;
int libc_epfd;
svm_msg_q_t *our_evt_q;
- u64 options[16];
vcl_session_msg_t *accept_evts_fifo;
#if VCL_ELOG
elog_track_t elog_track;
/** Lock to protect worker registrations */
clib_spinlock_t workers_lock;
- /** Pool of shared sessions */
- vcl_shared_session_t *shared_sessions;
-
/** Lock to protect segment hash table */
clib_rwlock_t segment_table_lock;
vcl_session_table_add_listener (vcl_worker_t * wrk, u64 listener_handle,
u32 value)
{
- /* Session and listener handles have different formats. The latter has
- * the thread index in the upper 32 bits while the former has the session
- * type. Knowing that, for listeners we just flip the MSB to 1 */
- listener_handle |= 1ULL << 63;
hash_set (wrk->session_index_by_vpp_handles, listener_handle, value);
}
static inline void
vcl_session_table_del_listener (vcl_worker_t * wrk, u64 listener_handle)
{
- listener_handle |= 1ULL << 63;
hash_unset (wrk->session_index_by_vpp_handles, listener_handle);
}
static inline vcl_session_t *
-vcl_session_table_lookup_listener (vcl_worker_t * wrk, u64 listener_handle)
+vcl_session_table_lookup_listener (vcl_worker_t * wrk, u64 handle)
{
uword *p;
- u64 handle = listener_handle | (1ULL << 63);
vcl_session_t *session;
p = hash_get (wrk->session_index_by_vpp_handles, handle);
if (!p)
{
- clib_warning ("VCL<%d>: couldn't find listen session: unknown vpp "
- "listener handle %llx", getpid (), listener_handle);
+ VDBG (0, "could not find listen session: unknown vpp listener handle"
+ " %llx", handle);
return 0;
}
- if (pool_is_free_index (wrk->sessions, p[0]))
+ session = vcl_session_get (wrk, p[0]);
+ if (!session)
{
- VDBG (1, "VCL<%d>: invalid listen session, sid (%u)", getpid (), p[0]);
+ VDBG (1, "invalid listen session index (%u)", p[0]);
return 0;
}
- session = pool_elt_at_index (wrk->sessions, p[0]);
ASSERT (session->session_state & (STATE_LISTEN | STATE_LISTEN_NO_MQ));
return session;
}
void vcl_worker_cleanup (vcl_worker_t * wrk, u8 notify_vpp);
int vcl_worker_register_with_vpp (void);
int vcl_worker_set_bapi (void);
-void vcl_worker_share_sessions (vcl_worker_t * parent_wrk);
-int vcl_worker_unshare_session (vcl_worker_t * wrk, vcl_session_t * s);
-vcl_shared_session_t *vcl_shared_session_get (u32 ss_index);
void vcl_flush_mq_events (void);
void vcl_cleanup_bapi (void);