f-stack/dpdk/drivers/net/thunderx/nicvf_svf.c

51 lines
729 B
C
Raw Normal View History

2019-06-25 11:12:58 +00:00
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2016 Cavium, Inc
*/
2017-04-21 10:43:26 +00:00
#include <assert.h>
#include <stddef.h>
2017-04-21 10:43:26 +00:00
#include <rte_debug.h>
#include <rte_malloc.h>
2017-04-21 10:43:26 +00:00
#include "base/nicvf_bsvf.h"
2017-04-21 10:43:26 +00:00
#include "nicvf_svf.h"
2017-04-21 10:43:26 +00:00
void
nicvf_svf_push(struct nicvf *vf)
2017-04-21 10:43:26 +00:00
{
struct svf_entry *entry = NULL;
assert(vf != NULL);
entry = rte_zmalloc("nicvf", sizeof(*entry), RTE_CACHE_LINE_SIZE);
if (entry == NULL)
rte_panic("Cannoc allocate memory for svf_entry\n");
entry->vf = vf;
nicvf_bsvf_push(entry);
2017-04-21 10:43:26 +00:00
}
struct nicvf *
nicvf_svf_pop(void)
2017-04-21 10:43:26 +00:00
{
struct nicvf *vf;
struct svf_entry *entry;
entry = nicvf_bsvf_pop();
2017-04-21 10:43:26 +00:00
vf = entry->vf;
2017-04-21 10:43:26 +00:00
rte_free(entry);
return vf;
2017-04-21 10:43:26 +00:00
}
int
nicvf_svf_empty(void)
{
return nicvf_bsvf_empty();
}