summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-11-08 16:50:39 -0800
committerDave Barach <openvpp@barachs.net>2020-11-09 21:09:05 +0000
commit6c10ab22e9ae1b5b2e086d74a5267f0bc33a0c57 (patch)
treef554cd3726675de9ea3799857aafc5cfe9338c75 /src
parent85866e782c0e8d49b2fbc5f8fdf77065f1efae14 (diff)
session: remove support for shm bapi attachment
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I21bda0c46406aff54ad8fe5e44491e8e332de170
Diffstat (limited to 'src')
-rw-r--r--src/plugins/unittest/session_test.c2
-rw-r--r--src/vnet/session/application.c17
-rw-r--r--src/vnet/session/session.c58
-rw-r--r--src/vnet/session/session.h3
-rw-r--r--src/vnet/session/session_api.c7
5 files changed, 30 insertions, 57 deletions
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index c152a8ac9da..d3a4e091647 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -1821,8 +1821,6 @@ session_test_mq_speed (vlib_main_t * vm, unformat_input_t * input)
/* Shut up coverity */
if (reg == 0)
abort ();
- if (!session_main.evt_qs_use_memfd_seg)
- reg->clib_file_index = VL_API_INVALID_FI;
vnet_app_attach_args_t attach_args = {
.api_client_index = api_index,
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index c62496e1d5f..975239e563d 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -484,7 +484,6 @@ application_alloc_and_init (app_init_args_t * a)
{
ssvm_segment_type_t seg_type = SSVM_SEGMENT_MEMFD;
segment_manager_props_t *props;
- vl_api_registration_t *reg;
application_t *app;
u64 *options;
@@ -494,17 +493,7 @@ application_alloc_and_init (app_init_args_t * a)
* Make sure we support the requested configuration
*/
if (options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_IS_BUILTIN)
- {
- seg_type = SSVM_SEGMENT_PRIVATE;
- }
- else if (!a->use_sock_api)
- {
- reg = vl_api_client_index_to_registration (a->api_client_index);
- if (!reg)
- return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
- if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
- seg_type = SSVM_SEGMENT_SHM;
- }
+ seg_type = SSVM_SEGMENT_PRIVATE;
if ((options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD)
&& seg_type != SSVM_SEGMENT_MEMFD)
@@ -855,8 +844,8 @@ vnet_application_attach (vnet_app_attach_args_t * a)
}
secret = a->options[APP_OPTIONS_NAMESPACE_SECRET];
- if ((rv =
- app_validate_namespace (a->namespace_id, secret, &app_ns_index)))
+ if ((rv = app_validate_namespace (a->namespace_id, secret,
+ &app_ns_index)))
return rv;
a->options[APP_OPTIONS_NAMESPACE] = app_ns_index;
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 0b489882766..9429ddb3c8a 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1469,11 +1469,8 @@ session_transport_cleanup (session_t * s)
/**
* Allocate event queues in the shared-memory segment
*
- * That can either be a newly created memfd segment, that will need to be
- * mapped by all stack users, or the binary api's svm region. The latter is
- * assumed to be already mapped. NOTE that this assumption DOES NOT hold if
- * api clients bootstrap shm api over sockets (i.e. use memfd segments) and
- * vpp uses api svm region for event queues.
+ * That can only be a newly created memfd segment, that must be
+ * mapped by all apps/stack users.
*/
void
session_vpp_event_queues_allocate (session_main_t * smm)
@@ -1488,28 +1485,22 @@ session_vpp_event_queues_allocate (session_main_t * smm)
if (smm->configured_event_queue_length)
evt_q_length = smm->configured_event_queue_length;
- if (smm->evt_qs_use_memfd_seg)
- {
- if (smm->evt_qs_segment_size)
- eqs_size = smm->evt_qs_segment_size;
+ if (smm->evt_qs_segment_size)
+ eqs_size = smm->evt_qs_segment_size;
- eqs->ssvm_size = eqs_size;
- eqs->my_pid = vpp_pid;
- eqs->name = format (0, "%s%c", "session: evt-qs-segment", 0);
- /* clib_mem_vm_map_shared consumes first page before requested_va */
- eqs->requested_va = smm->session_baseva + clib_mem_get_page_size ();
+ eqs->ssvm_size = eqs_size;
+ eqs->my_pid = vpp_pid;
+ eqs->name = format (0, "%s%c", "session: evt-qs-segment", 0);
+ /* clib_mem_vm_map_shared consumes first page before requested_va */
+ eqs->requested_va = smm->session_baseva + clib_mem_get_page_size ();
- if (ssvm_server_init (eqs, SSVM_SEGMENT_MEMFD))
- {
- clib_warning ("failed to initialize queue segment");
- return;
- }
+ if (ssvm_server_init (eqs, SSVM_SEGMENT_MEMFD))
+ {
+ clib_warning ("failed to initialize queue segment");
+ return;
}
- if (smm->evt_qs_use_memfd_seg)
- oldheap = ssvm_push_heap (eqs->sh);
- else
- oldheap = vl_msg_push_heap ();
+ oldheap = ssvm_push_heap (eqs->sh);
for (i = 0; i < vec_len (smm->wrk); i++)
{
@@ -1524,26 +1515,17 @@ session_vpp_event_queues_allocate (session_main_t * smm)
cfg->q_nitems = evt_q_length;
cfg->ring_cfgs = rc;
smm->wrk[i].vpp_event_queue = svm_msg_q_alloc (cfg);
- if (smm->evt_qs_use_memfd_seg)
- {
- if (svm_msg_q_alloc_consumer_eventfd (smm->wrk[i].vpp_event_queue))
- clib_warning ("eventfd returned");
- }
+ if (svm_msg_q_alloc_consumer_eventfd (smm->wrk[i].vpp_event_queue))
+ clib_warning ("eventfd returned");
}
- if (smm->evt_qs_use_memfd_seg)
- ssvm_pop_heap (oldheap);
- else
- vl_msg_pop_heap (oldheap);
+ ssvm_pop_heap (oldheap);
}
ssvm_private_t *
session_main_get_evt_q_segment (void)
{
- session_main_t *smm = &session_main;
- if (smm->evt_qs_use_memfd_seg)
- return &smm->evt_qs_segment;
- return 0;
+ return &session_main.evt_qs_segment;
}
u64
@@ -1818,7 +1800,6 @@ session_main_init (vlib_main_t * vm)
#endif
smm->last_transport_proto_type = TRANSPORT_PROTO_QUIC;
- smm->evt_qs_use_memfd_seg = 1;
return 0;
}
@@ -1913,8 +1894,9 @@ session_config_fn (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "local-endpoints-table-buckets %d",
&smm->local_endpoints_table_buckets))
;
+ /* Deprecated but maintained for compatibility */
else if (unformat (input, "evt_qs_memfd_seg"))
- smm->evt_qs_use_memfd_seg = 1;
+ ;
else if (unformat (input, "evt_qs_seg_size %U", unformat_memory_size,
&smm->evt_qs_segment_size))
;
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 2de22bd2650..f6997fb18f6 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -142,7 +142,7 @@ typedef struct session_main_
/** Worker contexts */
session_worker_t *wrk;
- /** Event queues memfd segment initialized only if so configured */
+ /** Event queues memfd segment */
ssvm_private_t evt_qs_segment;
/** Unique segment name counter */
@@ -178,7 +178,6 @@ typedef struct session_main_
uword session_baseva;
uword session_va_space_size;
uword evt_qs_segment_size;
- u8 evt_qs_use_memfd_seg;
/** Session table size parameters */
u32 configured_v4_session_table_buckets;
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 6a609eb92fa..90c0772493a 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -614,6 +614,12 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
rv = VNET_API_ERROR_FEATURE_DISABLED;
goto done;
}
+ /* Only support binary api with socket transport */
+ if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
+ {
+ rv = VNET_API_ERROR_APP_UNSUPPORTED_CFG;
+ goto done;
+ }
STATIC_ASSERT (sizeof (u64) * APP_OPTIONS_N_OPTIONS <=
sizeof (mp->options),
@@ -623,7 +629,6 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
a->api_client_index = mp->client_index;
a->options = mp->options;
a->session_cb_vft = &session_mq_cb_vft;
-
a->namespace_id = vl_api_from_api_to_new_vec (mp, &mp->namespace_id);
if ((rv = vnet_application_attach (a)))