diff options
author | Florin Coras <fcoras@cisco.com> | 2019-07-02 13:07:37 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-07-03 11:26:36 +0000 |
commit | eaacce4753c33342a6512039fe4153b15b476fb3 (patch) | |
tree | b7465c6da3970f28db0aca7ab92b12b3c7fbaa5d /src/svm/svm_fifo.h | |
parent | b5ef26d1ed524d1f2f59ffd5546d1c581f4c88a2 (diff) |
svm: fix multi-chunk fifo alloc and add more tests
Type: fix
- make sure that chunks and the rbtree are initialized if fifo segment
allocates multiple chunks for the fifo.
- ensure head/tail chunks are updated on all enqueue/dequeue events,
including when dropping data.
- more unit tests
Also fixes dequeue drop updates of head chunk.
Change-Id: I77f3550bc4e8b4e077f80ea87fe82b83ed013aeb
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm/svm_fifo.h')
-rw-r--r-- | src/svm/svm_fifo.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h index 9b23d7e8e6f..d5dfc9c4aa3 100644 --- a/src/svm/svm_fifo.h +++ b/src/svm/svm_fifo.h @@ -252,10 +252,17 @@ svm_fifo_t *svm_fifo_create (u32 size); /** * Initialize fifo * + * @param f fifo * @param size size for fifo */ void svm_fifo_init (svm_fifo_t * f, u32 size); /** + * Initialize fifo chunks and rbtree + * + * @param f fifo + */ +void svm_fifo_init_chunks (svm_fifo_t * f); +/** * Allocate a fifo chunk on heap * * If the chunk is allocated on a fifo segment, this should be called @@ -456,13 +463,20 @@ void svm_fifo_del_subscriber (svm_fifo_t * f, u8 subscriber); * @return number of out of order segments */ u32 svm_fifo_n_ooo_segments (svm_fifo_t * f); -/* +/** * First out-of-order segment for fifo * * @param f fifo * @return first out-of-order segment for fifo */ ooo_segment_t *svm_fifo_first_ooo_segment (svm_fifo_t * f); +/** + * Check if fifo is sane. Debug only. + * + * @param f fifo + * @return 1 if sane, 0 otherwise + */ +u8 svm_fifo_is_sane (svm_fifo_t * f); format_function_t format_svm_fifo; /** |