diff options
author | Aritra Basu <aritrbas@cisco.com> | 2024-09-09 21:47:26 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-09-13 21:22:10 +0000 |
commit | 6f45f5465f219cb55f0f095c420aae469e550f7f (patch) | |
tree | baaa8a167db282951f1eae9cd6bea93272ff8080 /src/plugins/http_static | |
parent | 6fbe913e45ff252f5d6497eb81cdcf139afc0d5d (diff) |
http: update body_len from u32 to u64
Type: improvement
Change-Id: I381541fb180d6d6ba42e4d231d22a73c5d33ef65
Signed-off-by: Aritra Basu <aritrbas@cisco.com>
Diffstat (limited to 'src/plugins/http_static')
-rw-r--r-- | src/plugins/http_static/http_static.h | 2 | ||||
-rw-r--r-- | src/plugins/http_static/static_server.c | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h index f9364801a71..bee79090d2b 100644 --- a/src/plugins/http_static/http_static.h +++ b/src/plugins/http_static/http_static.h @@ -47,7 +47,7 @@ typedef struct /** Data length */ u64 data_len; /** Current data send offset */ - u32 data_offset; + u64 data_offset; /** Need to free data in detach_cache_entry */ int free_data; /** File cache pool index */ diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c index 5515a98b446..9d9a68f7d02 100644 --- a/src/plugins/http_static/static_server.c +++ b/src/plugins/http_static/static_server.c @@ -87,6 +87,8 @@ start_send_data (hss_session_t *hs, http_status_code_t status) http_msg_t msg; session_t *ts; u8 *headers_buf = 0; + u32 n_enq; + u64 to_send; int rv; ts = session_get (hs->vpp_session_index, hs->thread_index); @@ -147,9 +149,12 @@ start_send_data (hss_session_t *hs, http_status_code_t status) if (!msg.data.body_len) goto done; - rv = svm_fifo_enqueue (ts->tx_fifo, hs->data_len, hs->data); + to_send = hs->data_len; + n_enq = clib_min (svm_fifo_size (ts->tx_fifo), to_send); - if (rv != hs->data_len) + rv = svm_fifo_enqueue (ts->tx_fifo, n_enq, hs->data); + + if (rv < to_send) { hs->data_offset = (rv > 0) ? rv : 0; svm_fifo_add_want_deq_ntf (ts->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF); @@ -598,7 +603,8 @@ static int hss_ts_tx_callback (session_t *ts) { hss_session_t *hs; - u32 to_send; + u32 n_enq; + u64 to_send; int rv; hs = hss_session_get (ts->thread_index, ts->opaque); @@ -606,7 +612,9 @@ hss_ts_tx_callback (session_t *ts) return 0; to_send = hs->data_len - hs->data_offset; - rv = svm_fifo_enqueue (ts->tx_fifo, to_send, hs->data + hs->data_offset); + n_enq = clib_min (svm_fifo_size (ts->tx_fifo), to_send); + + rv = svm_fifo_enqueue (ts->tx_fifo, n_enq, hs->data + hs->data_offset); if (rv <= 0) { @@ -993,7 +1001,7 @@ format_hss_session (u8 *s, va_list *args) hss_session_t *hs = va_arg (*args, hss_session_t *); int __clib_unused verbose = va_arg (*args, int); - s = format (s, "\n path %s, data length %u, data_offset %u", + s = format (s, "\n path %s, data length %llu, data_offset %llu", hs->path ? hs->path : (u8 *) "[none]", hs->data_len, hs->data_offset); return s; |