aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-11-22 21:19:01 -0800
committerDave Barach <openvpp@barachs.net>2021-12-16 20:53:53 +0000
commit20c242316cbbfa353d4f338ebee7ac715956b6aa (patch)
tree4eb3688d5a66cd9a675404915e55b7d56d765a48 /src/vnet/session/application.h
parent3c9dee27ca33ab88080a03db75d83f09fcc5c589 (diff)
session: app mq congestion detection
Detect mq congestion and handle it by queueing messages in a fifo and postponing handling via rpcs. App workers with congested mqs cannot accept nor connect additional sessions. Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I401d971a1a53896758b88fc60f158cbc31e0c7cb
Diffstat (limited to 'src/vnet/session/application.h')
-rw-r--r--src/vnet/session/application.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index b3201b9833e..54a616a99b1 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -29,6 +29,16 @@
#define APP_DBG(_fmt, _args...)
#endif
+typedef struct app_wrk_postponed_msg_
+{
+ u32 len;
+ u8 event_type;
+ u8 ring;
+ u8 is_sapi;
+ int fd;
+ u8 data[SESSION_CTRL_MSG_MAX_SIZE];
+} app_wrk_postponed_msg_t;
+
typedef struct app_worker_
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
@@ -59,6 +69,9 @@ typedef struct app_worker_
/** API index for the worker. Needed for multi-process apps */
u32 api_client_index;
+ /** Set if mq is congested */
+ u8 mq_congested;
+
u8 app_is_builtin;
/** Pool of half-open session handles. Tracked in case worker detaches */
@@ -69,6 +82,12 @@ typedef struct app_worker_
/** Vector of detached listener segment managers */
u32 *detached_seg_managers;
+
+ /** Fifo of messages postponed because of mq congestion */
+ app_wrk_postponed_msg_t *postponed_mq_msgs;
+
+ /** Lock to add/sub message from ref @postponed_mq_msgs */
+ clib_spinlock_t postponed_mq_msgs_lock;
} app_worker_t;
typedef struct app_worker_map_
@@ -339,6 +358,10 @@ int app_worker_del_segment_notify (app_worker_t * app_wrk,
u32 app_worker_n_listeners (app_worker_t * app);
session_t *app_worker_first_listener (app_worker_t * app,
u8 fib_proto, u8 transport_proto);
+void app_wrk_send_ctrl_evt_fd (app_worker_t *app_wrk, u8 evt_type, void *msg,
+ u32 msg_len, int fd);
+void app_wrk_send_ctrl_evt (app_worker_t *app_wrk, u8 evt_type, void *msg,
+ u32 msg_len);
int app_worker_send_event (app_worker_t * app, session_t * s, u8 evt);
int app_worker_lock_and_send_event (app_worker_t * app, session_t * s,
u8 evt_type);