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