laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27848 )
Change subject: octoi: Fix frame_rifo_depth() function ......................................................................
octoi: Fix frame_rifo_depth() function
Both in the situation with zero and with one frame in the RIFO, last_fn_in == last_fn_out. We must differentiate based on whether or not the bucket_bit for last_fn_out is still set or not.
Change-Id: I088f181e74358eb2c96a7aab7a7c875b9276d980 --- M src/octoi/frame_rifo.c M src/octoi/frame_rifo.h 2 files changed, 11 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/48/27848/1
diff --git a/src/octoi/frame_rifo.c b/src/octoi/frame_rifo.c index 94758e9..852987e 100644 --- a/src/octoi/frame_rifo.c +++ b/src/octoi/frame_rifo.c @@ -84,6 +84,16 @@ return rifo->bitvec[byte] & (1 << bit); }
+unsigned int frame_rifo_depth(struct frame_rifo *rifo) +{ + uint32_t depth = rifo->last_in_fn - rifo->next_out_fn; + uint32_t bucket_nr = bucket_for_fn(rifo, rifo->last_in_fn); + if (bucket_bit_get(rifo, bucket_nr)) + depth += 1; + + return depth; +} + void rifo_dump(struct frame_rifo *rifo) { printf("buf=%p, size=%zu, next_out=%lu, next_out_fn=%u\n", rifo->buf, sizeof(rifo->buf), diff --git a/src/octoi/frame_rifo.h b/src/octoi/frame_rifo.h index 401e873..2b0ad21 100644 --- a/src/octoi/frame_rifo.h +++ b/src/octoi/frame_rifo.h @@ -22,10 +22,7 @@ }
/* current depth of RIFO */ -static inline unsigned int frame_rifo_depth(struct frame_rifo *rifo) -{ - return rifo->last_in_fn - rifo->next_out_fn; -} +unsigned int frame_rifo_depth(struct frame_rifo *rifo);
void frame_rifo_init(struct frame_rifo *rifo);