svm: store normalized head/tail for fifo 09/19309/4
authorFlorin Coras <fcoras@cisco.com>
Thu, 2 May 2019 19:52:19 +0000 (12:52 -0700)
committerDave Barach <openvpp@barachs.net>
Fri, 3 May 2019 14:34:46 +0000 (14:34 +0000)
commit29a59c3ae18573043d9f9baa2796ab0b841bf6aa
treee14b3f88d6ec06d9d6c54ca740fe81a9a99ef703
parent14e2e2a5715ddf938db5b3884e268ec09e112935
svm: store normalized head/tail for fifo

If head/tail are stored as "absolute" values that are normalized to [0,
fifo_size] interval, when fifo is shrunk/grown the consumer and producer
have to independently update to the new fifo size and fix head and tail,
respectively.

If the head and tail are stored as normalized values, under the right
conditions, they don't need to be fixed when fifo size changes.

This reverts one of the changes in gerrit 18223.

Change-Id: I55a908828afe90925cf7c20186a940b25e5805f9
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/plugins/unittest/svm_fifo_test.c
src/svm/svm_fifo.c
src/svm/svm_fifo.h