1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #ifndef _MAIN_H_ 6 #define _MAIN_H_ 7 8 enum policer_action { 9 GREEN = e_RTE_METER_GREEN, 10 YELLOW = e_RTE_METER_YELLOW, 11 RED = e_RTE_METER_RED, 12 DROP = 3, 13 }; 14 15 enum policer_action policer_table[e_RTE_METER_COLORS][e_RTE_METER_COLORS] = 16 { 17 { GREEN, RED, RED}, 18 { DROP, YELLOW, RED}, 19 { DROP, DROP, RED} 20 }; 21 22 #if APP_MODE == APP_MODE_FWD 23 24 #define FUNC_METER(a,b,c,d) color, flow_id=flow_id, pkt_len=pkt_len, time=time 25 #define FUNC_CONFIG(a, b) 0 26 #define PARAMS app_srtcm_params 27 #define FLOW_METER int 28 29 #elif APP_MODE == APP_MODE_SRTCM_COLOR_BLIND 30 31 #define FUNC_METER(a,b,c,d) rte_meter_srtcm_color_blind_check(a,b,c) 32 #define FUNC_CONFIG rte_meter_srtcm_config 33 #define PARAMS app_srtcm_params 34 #define FLOW_METER struct rte_meter_srtcm 35 36 #elif (APP_MODE == APP_MODE_SRTCM_COLOR_AWARE) 37 38 #define FUNC_METER rte_meter_srtcm_color_aware_check 39 #define FUNC_CONFIG rte_meter_srtcm_config 40 #define PARAMS app_srtcm_params 41 #define FLOW_METER struct rte_meter_srtcm 42 43 #elif (APP_MODE == APP_MODE_TRTCM_COLOR_BLIND) 44 45 #define FUNC_METER(a,b,c,d) rte_meter_trtcm_color_blind_check(a,b,c) 46 #define FUNC_CONFIG rte_meter_trtcm_config 47 #define PARAMS app_trtcm_params 48 #define FLOW_METER struct rte_meter_trtcm 49 50 #elif (APP_MODE == APP_MODE_TRTCM_COLOR_AWARE) 51 52 #define FUNC_METER rte_meter_trtcm_color_aware_check 53 #define FUNC_CONFIG rte_meter_trtcm_config 54 #define PARAMS app_trtcm_params 55 #define FLOW_METER struct rte_meter_trtcm 56 57 #else 58 #error Invalid value for APP_MODE 59 #endif 60 61 62 63 64 #endif /* _MAIN_H_ */ 65