diff options
author | Florin Coras <fcoras@cisco.com> | 2018-03-09 13:05:53 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-03-15 15:04:11 +0000 |
commit | 58d36f02b45c5af38b7df81fb7976129cad3e05b (patch) | |
tree | 84875ce654928ae2224b8c3a6a4d354f3fd13f7a /src/svm/svm_fifo.h | |
parent | 46c1c11ba08512a5e37392de1ddb306b139a5bcf (diff) |
tls: add openssl engine
Change-Id: I6c215858d2c9c620787632b570950b15274c0df2
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm/svm_fifo.h')
-rw-r--r-- | src/svm/svm_fifo.h | 43 |
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) { |