diff options
author | Florin Coras <fcoras@cisco.com> | 2019-01-14 17:23:11 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-01-17 20:31:39 +0000 |
commit | 72b04288d9a670829050a6ca5d931ae5b55b33ed (patch) | |
tree | 5f56a66b186c98347e1849531b1b19ee45a3c0e9 /src/svm/svm_fifo.c | |
parent | 4fbc41af4ebbb793da537e90a03affc5b59f492c (diff) |
vcl/session: replicate events for shared sessions
Change-Id: I7fb5402d4a530b5f2ffd9bb5787632099f4b4189
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm/svm_fifo.c')
-rw-r--r-- | src/svm/svm_fifo.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c index e7a1188d591..b53a2e294f7 100644 --- a/src/svm/svm_fifo.c +++ b/src/svm/svm_fifo.c @@ -845,6 +845,29 @@ svm_fifo_init_pointers (svm_fifo_t * f, u32 pointer) f->head = f->tail = pointer % f->nitems; } +void +svm_fifo_add_subscriber (svm_fifo_t * f, u8 subscriber) +{ + if (f->n_subscribers >= SVM_FIFO_MAX_EVT_SUBSCRIBERS) + return; + f->subscribers[f->n_subscribers++] = subscriber; +} + +void +svm_fifo_del_subscriber (svm_fifo_t * f, u8 subscriber) +{ + int i; + + for (i = 0; i < f->n_subscribers; i++) + { + if (f->subscribers[i] != subscriber) + continue; + f->subscribers[i] = f->subscribers[f->n_subscribers - 1]; + f->n_subscribers--; + break; + } +} + #endif /* * fd.io coding-style-patch-verification: ON |