summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-06-27 19:45:59 -0700
committerFlorin Coras <fcoras@cisco.com>2023-06-27 20:34:21 -0700
commitc8767c42aadb5bd63206e117673991ef799e2d18 (patch)
treebcf39620e408a8580aa11b4b38f80d1fd1aea4db /src/vnet/session/session.h
parent31eaea9eef0594117e83733aa01f8bbda940e4da (diff)
session udp: add len check for tx dgrams
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I35391fb8c39defbe0e57a241a357c3c98e8cef54
Diffstat (limited to 'src/vnet/session/session.h')
-rw-r--r--src/vnet/session/session.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index e92b1f079d6..10bae273d85 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -582,6 +582,19 @@ transport_rx_fifo_has_ooo_data (transport_connection_t * tc)
return svm_fifo_has_ooo_data (s->rx_fifo);
}
+always_inline u32
+transport_tx_fifo_has_dgram (transport_connection_t *tc)
+{
+ session_t *s = session_get (tc->s_index, tc->thread_index);
+ u32 max_deq = svm_fifo_max_dequeue_cons (s->tx_fifo);
+ session_dgram_pre_hdr_t phdr;
+
+ if (max_deq <= sizeof (session_dgram_hdr_t))
+ return 0;
+ svm_fifo_peek (s->tx_fifo, 0, sizeof (phdr), (u8 *) &phdr);
+ return max_deq >= phdr.data_length + sizeof (session_dgram_hdr_t);
+}
+
always_inline void
transport_rx_fifo_req_deq_ntf (transport_connection_t *tc)
{