summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application_interface.h13
-rw-r--r--src/vnet/session/application_local.c4
-rw-r--r--src/vnet/session/application_worker.c8
-rw-r--r--src/vnet/session/segment_manager.c46
-rw-r--r--src/vnet/session/session.c12
-rw-r--r--src/vnet/session/session_api.c26
-rw-r--r--src/vnet/session/session_cli.c4
-rw-r--r--src/vnet/session/session_debug.c2
8 files changed, 59 insertions, 56 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 79c6f288e93..096af1efa15 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -343,9 +343,7 @@ typedef struct session_bound_msg_
uword rx_fifo;
uword tx_fifo;
uword vpp_evt_q;
- u32 segment_size;
- u8 segment_name_length;
- u8 segment_name[128];
+ u64 segment_handle;
} __clib_packed session_bound_msg_t;
typedef struct session_unlisten_msg_
@@ -519,6 +517,7 @@ typedef struct session_migrate_msg_
uword vpp_evt_q;
session_handle_t handle;
session_handle_t new_handle;
+ u64 segment_handle;
u32 vpp_thread_index;
} __clib_packed session_migrated_msg_t;
@@ -640,8 +639,8 @@ app_send_dgram_raw (svm_fifo_t * f, app_session_transport_t * at,
if (do_evt)
{
if (svm_fifo_set_event (f))
- app_send_io_evt_to_vpp (vpp_evt_q, f->master_session_index, evt_type,
- noblock);
+ app_send_io_evt_to_vpp (vpp_evt_q, f->shr->master_session_index,
+ evt_type, noblock);
}
return len;
}
@@ -664,8 +663,8 @@ app_send_stream_raw (svm_fifo_t * f, svm_msg_q_t * vpp_evt_q, u8 * data,
if (do_evt)
{
if (rv > 0 && svm_fifo_set_event (f))
- app_send_io_evt_to_vpp (vpp_evt_q, f->master_session_index, evt_type,
- noblock);
+ app_send_io_evt_to_vpp (vpp_evt_q, f->shr->master_session_index,
+ evt_type, noblock);
}
return rv;
}
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 6e0aee2aae3..18e26f2c1cc 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -208,8 +208,8 @@ ct_init_accepted_session (app_worker_t * server_wrk,
}
sm_index = segment_manager_index (sm);
- ls->rx_fifo->master_session_index = ls->session_index;
- ls->tx_fifo->master_session_index = ls->session_index;
+ ls->rx_fifo->shr->master_session_index = ls->session_index;
+ ls->tx_fifo->shr->master_session_index = ls->session_index;
ls->rx_fifo->master_thread_index = ls->thread_index;
ls->tx_fifo->master_thread_index = ls->thread_index;
ls->rx_fifo->segment_manager = sm_index;
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index dd159c6693c..d44f52c5340 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -200,10 +200,10 @@ app_worker_alloc_session_fifos (segment_manager_t * sm, session_t * s)
&rx_fifo, &tx_fifo)))
return rv;
- rx_fifo->master_session_index = s->session_index;
+ rx_fifo->shr->master_session_index = s->session_index;
rx_fifo->master_thread_index = s->thread_index;
- tx_fifo->master_session_index = s->session_index;
+ tx_fifo->shr->master_session_index = s->session_index;
tx_fifo->master_thread_index = s->thread_index;
s->rx_fifo = rx_fifo;
@@ -711,7 +711,7 @@ app_send_io_evt_rx (app_worker_t * app_wrk, session_t * s)
msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
- evt->session_index = s->rx_fifo->client_session_index;
+ evt->session_index = s->rx_fifo->shr->client_session_index;
evt->event_type = SESSION_IO_EVT_RX;
(void) svm_fifo_set_event (s->rx_fifo);
@@ -750,7 +750,7 @@ app_send_io_evt_tx (app_worker_t * app_wrk, session_t * s)
msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
evt->event_type = SESSION_IO_EVT_TX;
- evt->session_index = s->tx_fifo->client_session_index;
+ evt->session_index = s->tx_fifo->shr->client_session_index;
svm_msg_q_add_and_unlock (mq, &msg);
return 0;
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index bb3d7adc379..7683760fde9 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -211,6 +211,7 @@ segment_manager_del_segment (segment_manager_t * sm, fifo_segment_t * fs)
}
}
+ fifo_segment_cleanup (fs);
ssvm_delete (&fs->ssvm);
if (CLIB_DEBUG)
@@ -612,12 +613,12 @@ segment_manager_del_sessions (segment_manager_t * sm)
*/
while (f)
{
- session = session_get_if_valid (f->master_session_index,
- f->master_thread_index);
- if (session)
- vec_add1 (handles, session_handle (session));
- f = f->next;
- }
+ session = session_get_if_valid (f->shr->master_session_index,
+ f->master_thread_index);
+ if (session)
+ vec_add1 (handles, session_handle (session));
+ f = f->next;
+ }
}
/* Instead of removing the segment, test when cleaning up disconnected
@@ -841,7 +842,7 @@ segment_manager_attach_fifo (segment_manager_t * sm, svm_fifo_t * f,
fifo_segment_attach_fifo (fs, f, s->thread_index);
segment_manager_segment_reader_unlock (sm);
- f->master_session_index = s->session_index;
+ f->shr->master_session_index = s->session_index;
f->master_thread_index = s->thread_index;
}
@@ -1059,25 +1060,26 @@ segment_manager_format_sessions (segment_manager_t * sm, int verbose)
u32 session_index, thread_index;
session_t *session;
- session_index = f->master_session_index;
- thread_index = f->master_thread_index;
+ session_index = f->shr->master_session_index;
+ thread_index = f->master_thread_index;
- session = session_get (session_index, thread_index);
- str = format (0, "%U", format_session, session, verbose);
+ session = session_get (session_index, thread_index);
+ str = format (0, "%U", format_session, session, verbose);
- if (verbose)
- s = format (s, "%-40v%-20v%-15u%-10u", str, app_name,
- app_wrk->api_client_index, app_wrk->connects_seg_manager);
- else
- s = format (s, "%-40v%-20v", str, app_name);
+ if (verbose)
+ s = format (s, "%-40v%-20v%-15u%-10u", str, app_name,
+ app_wrk->api_client_index,
+ app_wrk->connects_seg_manager);
+ else
+ s = format (s, "%-40v%-20v", str, app_name);
- vlib_cli_output (vm, "%v", s);
- vec_reset_length (s);
- vec_free (str);
+ vlib_cli_output (vm, "%v", s);
+ vec_reset_length (s);
+ vec_free (str);
- f = f->next;
- }
- vec_free (s);
+ f = f->next;
+ }
+ vec_free (s);
}
}
/* *INDENT-ON* */
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index b0a17bbb214..962df556de9 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -78,7 +78,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
int
session_send_io_evt_to_thread (svm_fifo_t * f, session_evt_type_t evt_type)
{
- return session_send_evt_to_thread (&f->master_session_index, 0,
+ return session_send_evt_to_thread (&f->shr->master_session_index, 0,
f->master_thread_index, evt_type);
}
@@ -436,8 +436,8 @@ session_fifo_tuning (session_t * s, svm_fifo_t * f,
{
segment_manager_t *sm;
sm = segment_manager_get (f->segment_manager);
- ASSERT (f->size >= 4096);
- ASSERT (f->size <= sm->max_fifo_size);
+ ASSERT (f->shr->size >= 4096);
+ ASSERT (f->shr->size <= sm->max_fifo_size);
}
}
}
@@ -611,9 +611,9 @@ session_notify_subscribers (u32 app_index, session_t * s,
if (!app)
return -1;
- for (i = 0; i < f->n_subscribers; i++)
+ for (i = 0; i < f->shr->n_subscribers; i++)
{
- app_wrk = application_get_worker (app, f->subscribers[i]);
+ app_wrk = application_get_worker (app, f->shr->subscribers[i]);
if (!app_wrk)
continue;
if (app_worker_lock_and_send_event (app_wrk, s, evt_type))
@@ -723,7 +723,7 @@ session_dequeue_notify (session_t * s)
SESSION_IO_EVT_TX)))
return -1;
- if (PREDICT_FALSE (s->tx_fifo->n_subscribers))
+ if (PREDICT_FALSE (s->tx_fifo->shr->n_subscribers))
return session_notify_subscribers (app_wrk->app_index, s,
s->tx_fifo, SESSION_IO_EVT_TX);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index d080ae44925..a8f92c3cc00 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -147,8 +147,8 @@ mq_send_session_accepted_cb (session_t * s)
mp = (session_accepted_msg_t *) evt->data;
clib_memset (mp, 0, sizeof (*mp));
mp->context = app->app_index;
- mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo->shr);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo->shr);
mp->segment_handle = session_segment_handle (s);
mp->flags = s->flags;
@@ -221,9 +221,9 @@ mq_notify_close_subscribers (u32 app_index, session_handle_t sh,
if (!app)
return;
- for (i = 0; i < f->n_subscribers; i++)
+ for (i = 0; i < f->shr->n_subscribers; i++)
{
- if (!(app_wrk = application_get_worker (app, f->subscribers[i])))
+ if (!(app_wrk = application_get_worker (app, f->shr->subscribers[i])))
continue;
mq_send_session_close_evt (app_wrk, sh, SESSION_CTRL_EVT_DISCONNECTED);
}
@@ -305,8 +305,8 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
session_get_endpoint (s, &mp->lcl, 1 /* is_lcl */ );
- mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo->shr);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo->shr);
mp->segment_handle = session_segment_handle (s);
}
else
@@ -320,12 +320,12 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
mp->lcl.is_ip4 = cct->c_is_ip4;
vpp_mq = session_main_get_vpp_event_queue (s->thread_index);
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
- mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
+ mp->server_rx_fifo = pointer_to_uword (s->rx_fifo->shr);
+ mp->server_tx_fifo = pointer_to_uword (s->tx_fifo->shr);
mp->segment_handle = session_segment_handle (s);
ss = ct_session_get_peer (s);
- mp->ct_rx_fifo = pointer_to_uword (ss->tx_fifo);
- mp->ct_tx_fifo = pointer_to_uword (ss->rx_fifo);
+ mp->ct_rx_fifo = pointer_to_uword (ss->tx_fifo->shr);
+ mp->ct_tx_fifo = pointer_to_uword (ss->rx_fifo->shr);
mp->ct_segment_handle = session_segment_handle (ss);
}
@@ -386,8 +386,9 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
if (session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
{
- mp->rx_fifo = pointer_to_uword (ls->rx_fifo);
- mp->tx_fifo = pointer_to_uword (ls->tx_fifo);
+ mp->rx_fifo = pointer_to_uword (ls->rx_fifo->shr);
+ mp->tx_fifo = pointer_to_uword (ls->tx_fifo->shr);
+ mp->segment_handle = session_segment_handle (ls);
}
done:
@@ -443,6 +444,7 @@ mq_send_session_migrate_cb (session_t * s, session_handle_t new_sh)
mp->vpp_thread_index = session_thread_from_handle (new_sh);
vpp_evt_q = session_main_get_vpp_event_queue (mp->vpp_thread_index);
mp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
+ mp->segment_handle = session_segment_handle (s);
svm_msg_q_add_and_unlock (app_mq, msg);
}
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index a9197547501..0d541748d9e 100644
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -27,14 +27,14 @@ format_session_fifos (u8 * s, va_list * args)
return s;
s = format (s, " Rx fifo: %U", format_svm_fifo, ss->rx_fifo, verbose);
- if (verbose > 2 && ss->rx_fifo->has_event)
+ if (verbose > 2 && ss->rx_fifo->shr->has_event)
{
found = session_node_lookup_fifo_event (ss->rx_fifo, e);
s = format (s, " session node event: %s\n",
found ? "found" : "not found");
}
s = format (s, " Tx fifo: %U", format_svm_fifo, ss->tx_fifo, verbose);
- if (verbose > 2 && ss->tx_fifo->has_event)
+ if (verbose > 2 && ss->tx_fifo->shr->has_event)
{
found = session_node_lookup_fifo_event (ss->tx_fifo, e);
s = format (s, " session node event: %s\n",
diff --git a/src/vnet/session/session_debug.c b/src/vnet/session/session_debug.c
index 33d1dc57196..c2718f3bfc2 100644
--- a/src/vnet/session/session_debug.c
+++ b/src/vnet/session/session_debug.c
@@ -187,7 +187,7 @@ session_node_cmp_event (session_event_t * e, svm_fifo_t * f)
case SESSION_IO_EVT_BUILTIN_RX:
case SESSION_IO_EVT_BUILTIN_TX:
case SESSION_IO_EVT_TX_FLUSH:
- if (e->session_index == f->master_session_index)
+ if (e->session_index == f->shr->master_session_index)
return 1;
break;
case SESSION_CTRL_EVT_CLOSE: