1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2020 Marvell International Ltd.
5 #include <rte_malloc.h>
6 #include <rte_spinlock.h>
8 #include "graph_private.h"
10 static rte_spinlock_t graph_lock = RTE_SPINLOCK_INITIALIZER;
11 int rte_graph_logtype;
14 graph_spinlock_lock(void)
16 rte_spinlock_lock(&graph_lock);
20 graph_spinlock_unlock(void)
22 rte_spinlock_unlock(&graph_lock);
26 __rte_node_stream_alloc(struct rte_graph *graph, struct rte_node *node)
28 uint16_t size = node->size;
30 RTE_VERIFY(size != UINT16_MAX);
31 /* Allocate double amount of size to avoid immediate realloc */
32 size = RTE_MIN(UINT16_MAX, RTE_MAX(RTE_GRAPH_BURST_SIZE, size * 2));
33 node->objs = rte_realloc_socket(node->objs, size * sizeof(void *),
34 RTE_CACHE_LINE_SIZE, graph->socket);
35 RTE_VERIFY(node->objs);
37 node->realloc_count++;