Jerin Jacob d6bba625cd graph: populate fastpath memory for graph reel
Adding support to create and populate the memory for graph reel.
This includes reserving the memory in the memzone, populating the nodes,
Allocating memory for node-specific streams to hold objects.

Once it is populated the reel memory contains the following sections.

+---------------------+
|   Graph Header      |
+---------------------+
|   Fence             |
+---------------------+
|   Circular buffer   |
+---------------------+
|   Fence             |
+---------------------+
|   Node Object 0     |
+------------------- -+
|   Node Object 1     |
+------------------- -+
|   Node Object 2     |
+------------------- -+
|   Node Object n     |
+------------------- -+

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:28:24 +02:00

39 lines
873 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(C) 2020 Marvell International Ltd.
*/
#include <rte_malloc.h>
#include <rte_spinlock.h>
#include "graph_private.h"
static rte_spinlock_t graph_lock = RTE_SPINLOCK_INITIALIZER;
int rte_graph_logtype;
void
graph_spinlock_lock(void)
{
rte_spinlock_lock(&graph_lock);
}
void
graph_spinlock_unlock(void)
{
rte_spinlock_unlock(&graph_lock);
}
void __rte_noinline
__rte_node_stream_alloc(struct rte_graph *graph, struct rte_node *node)
{
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, 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++;
}