X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_graph%2Fgraph.c;h=7224b00a7d7f695931d106e502bf2f41b3d32c70;hb=35a7fe80c29446eab49ffd7e81a4f610fd1f98ce;hp=e811a7b38db51f55f09c4ee77a11379c3abb87b2;hpb=85c0b5285f0d976c116e9532f6b3238b514bbf71;p=dpdk.git diff --git a/lib/librte_graph/graph.c b/lib/librte_graph/graph.c index e811a7b38d..7224b00a7d 100644 --- a/lib/librte_graph/graph.c +++ b/lib/librte_graph/graph.c @@ -18,7 +18,6 @@ static struct graph_head graph_list = STAILQ_HEAD_INITIALIZER(graph_list); static rte_spinlock_t graph_lock = RTE_SPINLOCK_INITIALIZER; static rte_graph_t graph_id; -int rte_graph_logtype; #define GRAPH_ID_CHECK(id) ID_CHECK(id, graph_id) @@ -473,6 +472,22 @@ __rte_node_stream_alloc(struct rte_graph *graph, struct rte_node *node) node->realloc_count++; } +void __rte_noinline +__rte_node_stream_alloc_size(struct rte_graph *graph, struct rte_node *node, + uint16_t req_size) +{ + uint16_t size = node->size; + + RTE_VERIFY(size != UINT16_MAX); + /* Allocate double amount of size to avoid immediate realloc */ + size = RTE_MIN(UINT16_MAX, RTE_MAX(RTE_GRAPH_BURST_SIZE, req_size * 2)); + node->objs = rte_realloc_socket(node->objs, size * sizeof(void *), + RTE_CACHE_LINE_SIZE, graph->socket); + RTE_VERIFY(node->objs); + node->size = size; + node->realloc_count++; +} + static int graph_to_dot(FILE *f, struct graph *graph) { @@ -563,9 +578,4 @@ rte_graph_max_count(void) return graph_id; } -RTE_INIT(rte_graph_init_log) -{ - rte_graph_logtype = rte_log_register("lib.graph"); - if (rte_graph_logtype >= 0) - rte_log_set_level(rte_graph_logtype, RTE_LOG_INFO); -} +RTE_LOG_REGISTER(rte_graph_logtype, lib.graph, INFO);