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 rte_graph_model_is_valid(uint8_t model)9rte_graph_model_is_valid(uint8_t model) 10 { 11 if (model > RTE_GRAPH_MODEL_MCORE_DISPATCH) 12 return false; 13 14 return true; 15 } 16 17 int rte_graph_worker_model_set(uint8_t model)18rte_graph_worker_model_set(uint8_t model) 19 { 20 struct graph_head *graph_head = graph_list_head_get(); 21 struct graph *graph; 22 23 if (!rte_graph_model_is_valid(model)) 24 return -EINVAL; 25 26 STAILQ_FOREACH(graph, graph_head, next) 27 graph->graph->model = model; 28 29 return 0; 30 } 31 32 uint8_t rte_graph_worker_model_get(struct rte_graph * graph)33rte_graph_worker_model_get(struct rte_graph *graph) 34 { 35 if (!rte_graph_model_is_valid(graph->model)) 36 return -EINVAL; 37 38 return graph->model; 39 } 40