summaryrefslogtreecommitdiffstats
path: root/src/plugins/http/http.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-02-16 17:59:55 -0800
committerDave Barach <openvpp@barachs.net>2022-02-23 21:24:47 +0000
commitf83d6668b083ca9ce502240557d8f6abd8645922 (patch)
tree024d88482ec4e6cfc5738761ce481b1ec8617c9c /src/plugins/http/http.c
parent45207e0fb2c46e211ff2e66fb141867d81198d97 (diff)
http hsa: support multiple listeners for http tps
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie89326ed4e599231fc20de67c5dadbb428568bec
Diffstat (limited to 'src/plugins/http/http.c')
-rw-r--r--src/plugins/http/http.c45
1 files changed, 39 insertions, 6 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c
index 868d0ddf42d..f1a304829ac 100644
--- a/src/plugins/http/http.c
+++ b/src/plugins/http/http.c
@@ -76,17 +76,27 @@ static u32
http_listener_alloc (void)
{
http_main_t *hm = &http_main;
- http_conn_t *ctx;
+ http_conn_t *lhc;
- pool_get_zero (hm->listener_ctx_pool, ctx);
- ctx->c_c_index = ctx - hm->listener_ctx_pool;
- return ctx->c_c_index;
+ pool_get_zero (hm->listener_pool, lhc);
+ lhc->c_c_index = lhc - hm->listener_pool;
+ return lhc->c_c_index;
}
http_conn_t *
-http_listener_get (u32 ctx_index)
+http_listener_get (u32 lhc_index)
{
- return pool_elt_at_index (http_main.listener_ctx_pool, ctx_index);
+ return pool_elt_at_index (http_main.listener_pool, lhc_index);
+}
+
+void
+http_listener_free (http_conn_t *lhc)
+{
+ http_main_t *hm = &http_main;
+
+ if (CLIB_DEBUG)
+ memset (lhc, 0xfc, sizeof (*lhc));
+ pool_put (hm->listener_pool, lhc);
}
void
@@ -776,6 +786,28 @@ http_start_listen (u32 app_listener_index, transport_endpoint_cfg_t *tep)
return lhc_index;
}
+static u32
+http_stop_listen (u32 listener_index)
+{
+ http_conn_t *lhc;
+ int rv;
+
+ lhc = http_listener_get (listener_index);
+
+ vnet_unlisten_args_t a = {
+ .handle = lhc->h_tc_session_handle,
+ .app_index = http_main.app_index,
+ .wrk_map_index = 0 /* default wrk */
+ };
+
+ if ((rv = vnet_unlisten (&a)))
+ clib_warning ("unlisten returned %d", rv);
+
+ http_listener_free (lhc);
+
+ return 0;
+}
+
static void
http_transport_close (u32 hc_index, u32 thread_index)
{
@@ -956,6 +988,7 @@ static const transport_proto_vft_t http_proto = {
.enable = http_transport_enable,
.connect = http_transport_connect,
.start_listen = http_start_listen,
+ .stop_listen = http_stop_listen,
.close = http_transport_close,
.custom_tx = http_app_tx_callback,
.get_connection = http_transport_get_connection,