aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/http_static/static_server.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-12-29 15:44:48 -0800
committerFlorin Coras <fcoras@cisco.com>2021-12-30 09:11:17 -0800
commit03e40e6230bf14aebf7b8d058ca9a32fe3d4e4fc (patch)
tree4fe5f1c32fecefa74dda8ceae8e0869c45fd5ff7 /src/plugins/http_static/static_server.c
parentfe2231f01fb56af21d6b4d6f63d7e1a2c4d14848 (diff)
svm: merge want deq and leq threshold notifications
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2775af35386a4e52ba82991c68bce6c56f13410f
Diffstat (limited to 'src/plugins/http_static/static_server.c')
-rw-r--r--src/plugins/http_static/static_server.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index ba81882fca0..f2c1cfc2d66 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -31,6 +31,8 @@
*/
/*? %%clicmd:group_label Static HTTP Server %% ?*/
+#define HTTP_FIFO_THRESH (16 << 10)
+
http_static_server_main_t http_static_server_main;
/** \brief Format the called-from enum
@@ -892,8 +894,7 @@ state_send_more_data (session_t * s, http_session_t * hs,
if (hs->data_offset < vec_len (hs->data))
{
/* No: ask for a shoulder-tap when the tx fifo has space */
- svm_fifo_add_want_deq_ntf (hs->tx_fifo,
- SVM_FIFO_WANT_DEQ_NOTIF_IF_LEQ_THRESH);
+ svm_fifo_add_want_deq_ntf (hs->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
hs->session_state = HTTP_STATE_SEND_MORE_DATA;
return 0;
}
@@ -1057,14 +1058,10 @@ http_static_server_session_accept_callback (session_t * s)
* full, however avoid entering a state where the
* fifo is full all the time and small chunks of data are being enqueued
* each time. If the fifo is small (under 16K) we set
- * the threshold to 0, meaning a notification will be given when the
+ * the threshold to it's size, meaning a notification will be given when the
* fifo empties.
*/
-#define HTTP_FIFO_THRESH (16 << 10)
- thresh = (svm_fifo_size (hs->tx_fifo) < HTTP_FIFO_THRESH) ?
- 0 :
- svm_fifo_size (hs->tx_fifo) - HTTP_FIFO_THRESH;
-
+ thresh = clib_min (svm_fifo_size (hs->tx_fifo), HTTP_FIFO_THRESH);
svm_fifo_set_deq_thresh (hs->tx_fifo, thresh);
s->session_state = SESSION_STATE_READY;