aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-02-04 14:37:04 -0800
committerDave Barach <openvpp@barachs.net>2022-02-05 21:19:53 +0000
commita3d710e2d7e509c8eff4bd9b7ea2019b5e4fcd12 (patch)
tree2b06812a2e7dd5e1329ac18eba929a859774a699
parent3e157100b57237cc694ae3d002cf736b36043c3c (diff)
http: estimate tx packets for scheduler
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ibca4bf59e6319ffdc1beaa084ca80f216e062af0
-rw-r--r--src/plugins/http/http.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c
index 574c34187cc..657a0b54755 100644
--- a/src/plugins/http/http.c
+++ b/src/plugins/http/http.c
@@ -498,6 +498,9 @@ state_wait_app (http_conn_t *hc, transport_send_params_t *sp)
/* Start sending the actual data */
hc->req_state = HTTP_REQ_STATE_SEND_MORE_DATA;
+ ASSERT (sp->max_burst_size >= offset);
+ sp->max_burst_size -= offset;
+
return 1;
error:
@@ -520,6 +523,7 @@ state_send_more_data (http_conn_t *hc, transport_send_params_t *sp)
session_t *ts;
int sent = 0;
+ max_send = clib_min (max_send, sp->max_burst_size);
ts = session_get_from_handle (hc->h_tc_session_handle);
if ((seg = http_buffer_get_segs (hb, max_send, &n_segs)))
sent = svm_fifo_enqueue_segments (ts->tx_fifo, seg, n_segs,
@@ -529,6 +533,7 @@ state_send_more_data (http_conn_t *hc, transport_send_params_t *sp)
{
/* Ask scheduler to notify app of deq event if needed */
sp->bytes_dequeued += http_buffer_drain (hb, sent);
+ sp->max_burst_size -= sent;
}
/* Not finished sending all data */
@@ -816,6 +821,7 @@ static int
http_app_tx_callback (void *session, transport_send_params_t *sp)
{
session_t *as = (session_t *) session;
+ u32 max_burst_sz, sent;
http_conn_t *hc;
hc = http_conn_get_w_thread (as->connection_index, as->thread_index);
@@ -825,6 +831,9 @@ http_app_tx_callback (void *session, transport_send_params_t *sp)
return 0;
}
+ max_burst_sz = sp->max_burst_size * TRANSPORT_PACER_MIN_MSS;
+ sp->max_burst_size = max_burst_sz;
+
http_req_run_state_machine (hc, sp);
if (hc->state == HTTP_CONN_STATE_CLOSED)
@@ -832,7 +841,10 @@ http_app_tx_callback (void *session, transport_send_params_t *sp)
if (!svm_fifo_max_dequeue_cons (as->rx_fifo))
http_disconnect_transport (hc);
}
- return 0;
+
+ sent = max_burst_sz - sp->max_burst_size;
+
+ return sent > 0 ? clib_max (sent / TRANSPORT_PACER_MIN_MSS, 1) : 0;
}
static void