Skip to content

Commit

Permalink
graph: implement fastpath routines
Browse files Browse the repository at this point in the history
Adding implementation for rte_graph_walk() API. This will perform a walk
on the circular buffer and call the process function of each node
and collect the stats if stats collection is enabled.

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>
  • Loading branch information
jerinjacobk authored and tmonjalo committed May 5, 2020
1 parent af1ae8b commit 40d4f51
Show file tree
Hide file tree
Showing 4 changed files with 431 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/api/doxy-api-index.md
Expand Up @@ -160,6 +160,7 @@ The public API headers are grouped by topics:
[port_in_action] (@ref rte_port_in_action.h)
[table_action] (@ref rte_table_action.h)
* [graph] (@ref rte_graph.h):
[graph_worker] (@ref rte_graph_worker.h)

- **basic**:
[approx fraction] (@ref rte_approx.h),
Expand Down
16 changes: 16 additions & 0 deletions lib/librte_graph/graph.c
Expand Up @@ -473,6 +473,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)
{
Expand Down
10 changes: 10 additions & 0 deletions lib/librte_graph/rte_graph_version.map
Expand Up @@ -3,6 +3,7 @@ EXPERIMENTAL {

__rte_node_register;
__rte_node_stream_alloc;
__rte_node_stream_alloc_size;

rte_graph_create;
rte_graph_destroy;
Expand All @@ -16,6 +17,7 @@ EXPERIMENTAL {
rte_graph_node_get;
rte_graph_node_get_by_name;
rte_graph_obj_dump;
rte_graph_walk;

rte_graph_cluster_stats_create;
rte_graph_cluster_stats_destroy;
Expand All @@ -28,10 +30,18 @@ EXPERIMENTAL {
rte_node_edge_get;
rte_node_edge_shrink;
rte_node_edge_update;
rte_node_enqueue;
rte_node_enqueue_x1;
rte_node_enqueue_x2;
rte_node_enqueue_x4;
rte_node_enqueue_next;
rte_node_from_name;
rte_node_id_to_name;
rte_node_list_dump;
rte_node_max_count;
rte_node_next_stream_get;
rte_node_next_stream_put;
rte_node_next_stream_move;

local: *;
};

0 comments on commit 40d4f51

Please sign in to comment.