aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-03-09 13:05:53 -0800
committerDave Barach <openvpp@barachs.net>2018-03-15 15:04:11 +0000
commit58d36f02b45c5af38b7df81fb7976129cad3e05b (patch)
tree84875ce654928ae2224b8c3a6a4d354f3fd13f7a /src/svm
parent46c1c11ba08512a5e37392de1ddb306b139a5bcf (diff)
tls: add openssl engine
Change-Id: I6c215858d2c9c620787632b570950b15274c0df2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm')
-rw-r--r--src/svm/svm_fifo.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 0d859513853..d06d77a42f7 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -167,6 +167,49 @@ svm_fifo_newest_ooo_segment_reset (svm_fifo_t * f)
f->ooos_newest = OOO_SEGMENT_INVALID_INDEX;
}
+/**
+ * Max contiguous chunk of data that can be read
+ */
+always_inline u32
+svm_fifo_max_read_chunk (svm_fifo_t * f)
+{
+ return ((f->tail > f->head) ? (f->tail - f->head) : (f->nitems - f->head));
+}
+
+/**
+ * Max contiguous chunk of data that can be written
+ */
+always_inline u32
+svm_fifo_max_write_chunk (svm_fifo_t * f)
+{
+ return ((f->tail >= f->head) ? (f->nitems - f->tail) : (f->head - f->tail));
+}
+
+/**
+ * Advance tail pointer
+ *
+ * Useful for moving tail pointer after external enqueue.
+ */
+always_inline void
+svm_fifo_enqueue_nocopy (svm_fifo_t * f, u32 bytes)
+{
+ ASSERT (bytes <= svm_fifo_max_enqueue (f));
+ f->tail = (f->tail + bytes) % f->nitems;
+ f->cursize += bytes;
+}
+
+always_inline u8 *
+svm_fifo_head (svm_fifo_t * f)
+{
+ return (f->data + f->head);
+}
+
+always_inline u8 *
+svm_fifo_tail (svm_fifo_t * f)
+{
+ return (f->data + f->tail);
+}
+
always_inline u32
ooo_segment_distance_from_tail (svm_fifo_t * f, u32 pos)
{