summaryrefslogtreecommitdiff
path: root/lib/graph/rte_graph_worker.c
blob: 7e2a918fae33e91ce07c0758e0fc12153ab7e439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(C) 2023 Intel Corporation
 */

#include "rte_graph_worker_common.h"
#include "graph_private.h"

bool
rte_graph_model_is_valid(uint8_t model)
{
	if (model > RTE_GRAPH_MODEL_MCORE_DISPATCH)
		return false;

	return true;
}

int
rte_graph_worker_model_set(uint8_t model)
{
	struct graph_head *graph_head = graph_list_head_get();
	struct graph *graph;

	if (!rte_graph_model_is_valid(model))
		return -EINVAL;

	STAILQ_FOREACH(graph, graph_head, next)
			graph->graph->model = model;

	return 0;
}

uint8_t
rte_graph_worker_model_get(struct rte_graph *graph)
{
	if (!rte_graph_model_is_valid(graph->model))
		return -EINVAL;

	return graph->model;
}