1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #include <stdlib.h> 6 #include "rte_policer.h" 7 8 int rte_phb_config(struct rte_phb * phb_table,uint32_t phb_table_index,enum rte_color pre_meter,enum rte_color post_meter,enum rte_phb_action action)9rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index, 10 enum rte_color pre_meter, enum rte_color post_meter, enum rte_phb_action action) 11 { 12 struct rte_phb *phb = NULL; 13 14 /* User argument checking */ 15 if (phb_table == NULL) { 16 return -1; 17 } 18 19 if ((pre_meter > RTE_COLOR_RED) || (post_meter > RTE_COLOR_RED) || (pre_meter > post_meter)) { 20 return -2; 21 } 22 23 /* Set action in PHB table entry */ 24 phb = &phb_table[phb_table_index]; 25 phb->actions[pre_meter][post_meter] = action; 26 27 28 return 0; 29 } 30