Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2016 Cavium, Inc 3 : : */ 4 : : 5 : : #include <assert.h> 6 : : #include <stddef.h> 7 : : #include <err.h> 8 : : 9 : : #include "nicvf_bsvf.h" 10 : : #include "nicvf_plat.h" 11 : : 12 : : static STAILQ_HEAD(, svf_entry) head = STAILQ_HEAD_INITIALIZER(head); 13 : : 14 : : void 15 : 0 : nicvf_bsvf_push(struct svf_entry *entry) 16 : : { 17 [ # # ]: 0 : assert(entry != NULL); 18 [ # # ]: 0 : assert(entry->vf != NULL); 19 : : 20 : 0 : STAILQ_INSERT_TAIL(&head, entry, next); 21 : 0 : } 22 : : 23 : : struct svf_entry * 24 : 0 : nicvf_bsvf_pop(void) 25 : : { 26 : : struct svf_entry *entry; 27 : : 28 [ # # ]: 0 : assert(!STAILQ_EMPTY(&head)); 29 : : 30 : : entry = STAILQ_FIRST(&head); 31 : : 32 : : assert(entry != NULL); 33 [ # # ]: 0 : assert(entry->vf != NULL); 34 : : 35 [ # # ]: 0 : STAILQ_REMOVE_HEAD(&head, next); 36 : : 37 : 0 : return entry; 38 : : } 39 : : 40 : : int 41 : 0 : nicvf_bsvf_empty(void) 42 : : { 43 : 0 : return STAILQ_EMPTY(&head); 44 : : }