X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fsvm%2Fsvm_fifo.h;h=aed8770b4588eea3724bec7d1a1cce85dd87d3ef;hb=refs%2Fchanges%2F15%2F34015%2F3;hp=5845d7042af8e6f88bc9f8d4986cf8ef33fadee5;hpb=c547e91df7083007c87615ac1e37b6f223e575e9;p=vpp.git diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h index 5845d7042af..aed8770b458 100644 --- a/src/svm/svm_fifo.h +++ b/src/svm/svm_fifo.h @@ -171,6 +171,48 @@ f_chunk_includes_pos (svm_fifo_chunk_t * c, u32 pos) && f_pos_lt (pos, c->start_byte + c->length)); } +always_inline svm_fifo_chunk_t * +f_start_cptr (svm_fifo_t *f) +{ + return fs_chunk_ptr (f->fs_hdr, f->shr->start_chunk); +} + +always_inline svm_fifo_chunk_t * +f_end_cptr (svm_fifo_t *f) +{ + return fs_chunk_ptr (f->fs_hdr, f->shr->end_chunk); +} + +always_inline svm_fifo_chunk_t * +f_head_cptr (svm_fifo_t *f) +{ + return fs_chunk_ptr (f->fs_hdr, f->shr->head_chunk); +} + +always_inline svm_fifo_chunk_t * +f_tail_cptr (svm_fifo_t *f) +{ + return fs_chunk_ptr (f->fs_hdr, f->shr->tail_chunk); +} + +always_inline svm_fifo_chunk_t * +f_cptr (svm_fifo_t *f, fs_sptr_t cp) +{ + return fs_chunk_ptr (f->fs_hdr, cp); +} + +always_inline fs_sptr_t +f_csptr (svm_fifo_t *f, svm_fifo_chunk_t *c) +{ + return fs_chunk_sptr (f->fs_hdr, c); +} + +always_inline void +f_csptr_link (svm_fifo_t *f, fs_sptr_t cp, svm_fifo_chunk_t *c) +{ + fs_chunk_ptr (f->fs_hdr, cp)->next = fs_chunk_sptr (f->fs_hdr, c); +} + /** * Create fifo of requested size * @@ -597,60 +639,6 @@ u32 svm_fifo_max_read_chunk (svm_fifo_t * f); */ u32 svm_fifo_max_write_chunk (svm_fifo_t * f); -/** - * Fifo head chunk getter - * - * @param f fifo - * @return head chunk pointer - */ -static inline svm_fifo_chunk_t * -svm_fifo_head_chunk (svm_fifo_t * f) -{ - return f->shr->head_chunk; -} - -/** - * Fifo head pointer getter - * - * @param f fifo - * @return head pointer - */ -static inline u8 * -svm_fifo_head (svm_fifo_t * f) -{ - if (!f->shr->head_chunk) - return 0; - /* load-relaxed: consumer owned index */ - return (f->shr->head_chunk->data + - (f->shr->head - f->shr->head_chunk->start_byte)); -} - -/** - * Fifo tail chunk getter - * - * @param f fifo - * @return tail chunk pointer - */ -static inline svm_fifo_chunk_t * -svm_fifo_tail_chunk (svm_fifo_t * f) -{ - return f->shr->tail_chunk; -} - -/** - * Fifo tail pointer getter - * - * @param f fifo - * @return tail pointer - */ -static inline u8 * -svm_fifo_tail (svm_fifo_t * f) -{ - /* load-relaxed: producer owned index */ - return (f->shr->tail_chunk->data + - (f->shr->tail - f->shr->tail_chunk->start_byte)); -} - /** * Fifo number of subscribers getter *