X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fsvm%2Fsvm_fifo.c;h=7aecbb816190ad6a727e7c07783a816d7124981c;hb=c5df8c71c;hp=4397ef8413ed98a2596ee2887088d99e85644109;hpb=19515acddc343d1680d4a5d27f39456999498591;p=vpp.git diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c index 4397ef8413e..7aecbb81619 100644 --- a/src/svm/svm_fifo.c +++ b/src/svm/svm_fifo.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Cisco and/or its affiliates. + * Copyright (c) 2016-2019 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -218,6 +218,7 @@ svm_fifo_create (u32 data_size_in_bytes) f->nitems = data_size_in_bytes; f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX; f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX; + f->segment_index = SVM_FIFO_INVALID_INDEX; f->refcnt = 1; return (f); } @@ -844,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