Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2023 Intel Corporation 3 : : */ 4 : : 5 : : #include <eal_export.h> 6 : : #include "rte_graph_worker_common.h" 7 : : #include "graph_private.h" 8 : : 9 : : RTE_EXPORT_SYMBOL(rte_graph_model_is_valid) 10 : : bool 11 : 18 : rte_graph_model_is_valid(uint8_t model) 12 : : { 13 [ - + ]: 18 : if (model > RTE_GRAPH_MODEL_MCORE_DISPATCH) 14 : 0 : return false; 15 : : 16 : : return true; 17 : : } 18 : : 19 : : RTE_EXPORT_SYMBOL(rte_graph_worker_model_set) 20 : : int 21 : 2 : rte_graph_worker_model_set(uint8_t model) 22 : : { 23 : 2 : struct graph_head *graph_head = graph_list_head_get(); 24 : : struct graph *graph; 25 : : 26 [ + - ]: 2 : if (!rte_graph_model_is_valid(model)) 27 : : return -EINVAL; 28 : : 29 [ + + ]: 6 : STAILQ_FOREACH(graph, graph_head, next) 30 : 4 : graph->graph->model = model; 31 : : 32 : : return 0; 33 : : } 34 : : 35 : : RTE_EXPORT_SYMBOL(rte_graph_worker_model_get) 36 : : uint8_t 37 : 16 : rte_graph_worker_model_get(struct rte_graph *graph) 38 : : { 39 [ + - ]: 16 : if (!rte_graph_model_is_valid(graph->model)) 40 : : return -EINVAL; 41 : : 42 : 16 : return graph->model; 43 : : }