summaryrefslogtreecommitdiffstats
path: root/src/svm/fifo_segment.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-09 04:46:14 +0000
committerDave Barach <openvpp@barachs.net>2020-04-09 14:26:13 +0000
commit7a90e500ba431575bf6771f88ad43380f9483061 (patch)
tree2eb4eefe13e575314b2398b22aaea74cd96706ff /src/svm/fifo_segment.c
parent9cbfb4c5136614fc498b9b82d99203f8a5f7cc2e (diff)
svm: use active fifo count in fifo test
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id6c9dbf65523274768173e288431d7dbac55676d
Diffstat (limited to 'src/svm/fifo_segment.c')
-rw-r--r--src/svm/fifo_segment.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 15a5323454c..eb240b0ada1 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -90,6 +90,12 @@ fsh_active_fifos_update (fifo_segment_header_t * fsh, int inc)
clib_atomic_fetch_add_rel (&fsh->n_active_fifos, inc);
}
+static inline u32
+fsh_n_active_fifos (fifo_segment_header_t * fsh)
+{
+ return clib_atomic_load_relax_n (&fsh->n_active_fifos);
+}
+
static inline uword
fsh_virtual_mem (fifo_segment_header_t * fsh)
{
@@ -1057,7 +1063,7 @@ fifo_segment_preallocate_fifo_pairs (fifo_segment_t * fs,
u32
fifo_segment_num_fifos (fifo_segment_t * fs)
{
- return clib_atomic_load_relax_n (&fs->h->n_active_fifos);
+ return fsh_n_active_fifos (fs->h);
}
static u32
@@ -1215,17 +1221,7 @@ fifo_segment_fl_chunk_bytes (fifo_segment_t * fs)
u8
fifo_segment_has_fifos (fifo_segment_t * fs)
{
- fifo_segment_header_t *fsh = fs->h;
- fifo_segment_slice_t *fss;
- int slice_index;
-
- for (slice_index = 0; slice_index < fs->n_slices; slice_index++)
- {
- fss = fsh_slice_get (fsh, slice_index);
- if (fss->fifos)
- return 1;
- }
- return 0;
+ return (fsh_n_active_fifos (fs->h) != 0);
}
svm_fifo_t *