]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright(c) 2016 Cavium, Inc | |
7c673cae FG |
3 | */ |
4 | ||
5 | #include <assert.h> | |
6 | #include <stddef.h> | |
7 | ||
8 | #include <rte_debug.h> | |
9 | #include <rte_malloc.h> | |
10 | ||
11 | #include "base/nicvf_bsvf.h" | |
12 | ||
13 | #include "nicvf_svf.h" | |
14 | ||
15 | void | |
16 | nicvf_svf_push(struct nicvf *vf) | |
17 | { | |
18 | struct svf_entry *entry = NULL; | |
19 | ||
20 | assert(vf != NULL); | |
21 | ||
22 | entry = rte_zmalloc("nicvf", sizeof(*entry), RTE_CACHE_LINE_SIZE); | |
23 | if (entry == NULL) | |
24 | rte_panic("Cannoc allocate memory for svf_entry\n"); | |
25 | ||
26 | entry->vf = vf; | |
27 | ||
28 | nicvf_bsvf_push(entry); | |
29 | } | |
30 | ||
31 | struct nicvf * | |
32 | nicvf_svf_pop(void) | |
33 | { | |
34 | struct nicvf *vf; | |
35 | struct svf_entry *entry; | |
36 | ||
37 | entry = nicvf_bsvf_pop(); | |
38 | ||
39 | vf = entry->vf; | |
40 | ||
41 | rte_free(entry); | |
42 | ||
43 | return vf; | |
44 | } | |
45 | ||
46 | int | |
47 | nicvf_svf_empty(void) | |
48 | { | |
49 | return nicvf_bsvf_empty(); | |
50 | } |