summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-06 15:32:14 -0700
committerDamjan Marion <dmarion@me.com>2021-05-07 10:46:20 +0000
commit94a6df005d9e94f3b836ad3c93d1464b4a840499 (patch)
treec55259ac6ce0e373abf7633353c29ad74e305b26 /src/plugins
parentbd376a8ce8425f45b23074398949e8055de29280 (diff)
session: connects seg manager is always first
By convention, connects segment manager will be first. Therefore it will be the one with the first segment wherein lies the app's message queue. Saves us the trouble of allocating it on first connect, if app started by listening, and we no longer need to track if it's assignable to a listener or if it can be removed. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iba9a8ffaab618eeb41ec2144dcfee62d006dc7a2
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/hs_apps/http_server.c4
-rw-r--r--src/plugins/hs_apps/proxy.c3
-rw-r--r--src/plugins/http_static/static_server.c4
-rw-r--r--src/plugins/quic/quic.c3
-rw-r--r--src/plugins/unittest/session_test.c5
5 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/hs_apps/http_server.c b/src/plugins/hs_apps/http_server.c
index 34892b6bd4d..a46e0a4ae13 100644
--- a/src/plugins/hs_apps/http_server.c
+++ b/src/plugins/hs_apps/http_server.c
@@ -671,8 +671,7 @@ http_server_session_connected_callback (u32 app_index, u32 api_context,
static int
http_server_add_segment_callback (u32 client_index, u64 segment_handle)
{
- clib_warning ("called...");
- return -1;
+ return 0;
}
static void
@@ -732,6 +731,7 @@ http_server_attach ()
a->session_cb_vft = &http_server_session_cb_vft;
a->options = options;
a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
+ a->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = segment_size;
a->options[APP_OPTIONS_RX_FIFO_SIZE] =
hsm->fifo_size ? hsm->fifo_size : 8 << 10;
a->options[APP_OPTIONS_TX_FIFO_SIZE] =
diff --git a/src/plugins/hs_apps/proxy.c b/src/plugins/hs_apps/proxy.c
index 1a49a0f1f3a..18d6edd6be2 100644
--- a/src/plugins/hs_apps/proxy.c
+++ b/src/plugins/hs_apps/proxy.c
@@ -282,8 +282,7 @@ proxy_connected_callback (u32 app_index, u32 api_context,
static int
proxy_add_segment_callback (u32 client_index, u64 segment_handle)
{
- clib_warning ("called...");
- return -1;
+ return 0;
}
static int
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index 23860b083d8..c715dfa6fb8 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -1095,8 +1095,7 @@ http_static_server_session_connected_callback (u32 app_index, u32 api_context,
static int
http_static_server_add_segment_callback (u32 client_index, u64 segment_handle)
{
- clib_warning ("called...");
- return -1;
+ return 0;
}
static void
@@ -1157,6 +1156,7 @@ http_static_server_attach ()
a->session_cb_vft = &http_static_server_session_cb_vft;
a->options = options;
a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
+ a->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = segment_size;
a->options[APP_OPTIONS_RX_FIFO_SIZE] =
hsm->fifo_size ? hsm->fifo_size : 8 << 10;
a->options[APP_OPTIONS_TX_FIFO_SIZE] =
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 11c3ac2d718..5a57947325a 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1451,9 +1451,6 @@ quic_start_listen (u32 quic_listen_session_index, transport_endpoint_t * tep)
ccfg = &sep->ext_cfg->crypto;
app_wrk = app_worker_get (sep->app_wrk_index);
- /* We need to call this because we call app_worker_init_connected in
- * quic_accept_stream, which assumes the connect segment manager exists */
- app_worker_alloc_connects_segment_manager (app_wrk);
app = application_get (app_wrk->app_index);
QUIC_DBG (2, "Called quic_start_listen for app %d", app_wrk->app_index);
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index cd99b0c5416..ad9c976f49e 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -337,6 +337,9 @@ session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input)
attach_args.name = format (0, "session_test_server");
attach_args.namespace_id = appns_id;
+ /* Allow server to allocate another segment for listens. Needed
+ * because by default we do not allow segment additions */
+ attach_args.options[APP_OPTIONS_ADD_SEGMENT_SIZE] = 32 << 20;
attach_args.options[APP_OPTIONS_NAMESPACE_SECRET] = placeholder_secret;
error = vnet_application_attach (&attach_args);
SESSION_TEST ((error == 0), "server app attached: %U", format_clib_error,
@@ -1839,7 +1842,7 @@ session_test_mq_speed (vlib_main_t * vm, unformat_input_t * input)
SESSION_TEST (prod_fd != -1, "mq producer eventd valid %u", prod_fd);
}
- sm = app_worker_get_or_alloc_connect_segment_manager (app_wrk);
+ sm = app_worker_get_connect_segment_manager (app_wrk);
segment_manager_alloc_session_fifos (sm, 0, &rx_fifo, &tx_fifo);
s.rx_fifo = rx_fifo;
s.tx_fifo = tx_fifo;