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 = RTE_COLOR_GREEN, 10 YELLOW = RTE_COLOR_YELLOW, 11 RED = RTE_COLOR_RED, 12 DROP = 3, 13 }; 14 15 /* Policy implemented as a static structure. 8< */ 16 enum policer_action policer_table[RTE_COLORS][RTE_COLORS] = 17 { 18 { GREEN, RED, RED}, 19 { DROP, YELLOW, RED}, 20 { DROP, DROP, RED} 21 }; 22 /* >8 End of policy implemented as a static structure. */ 23 24 #if APP_MODE == APP_MODE_FWD 25 26 #define FUNC_METER(m, p, time, pkt_len, pkt_color) \ 27 __extension__ ({ \ 28 void *mp = m; \ 29 void *pp = p; \ 30 mp = mp; \ 31 pp = pp; \ 32 time = time; \ 33 pkt_len = pkt_len; \ 34 pkt_color; \ 35 }) 36 #define FUNC_CONFIG(a, b) 0 37 #define FLOW_METER int 38 #define PROFILE app_srtcm_profile 39 40 #elif APP_MODE == APP_MODE_SRTCM_COLOR_BLIND 41 42 #define FUNC_METER(m, p, time, pkt_len, pkt_color) \ 43 rte_meter_srtcm_color_blind_check(m, p, time, pkt_len) 44 #define FUNC_CONFIG rte_meter_srtcm_config 45 #define FLOW_METER struct rte_meter_srtcm 46 #define PROFILE app_srtcm_profile 47 48 #elif (APP_MODE == APP_MODE_SRTCM_COLOR_AWARE) 49 50 #define FUNC_METER rte_meter_srtcm_color_aware_check 51 #define FUNC_CONFIG rte_meter_srtcm_config 52 #define FLOW_METER struct rte_meter_srtcm 53 #define PROFILE app_srtcm_profile 54 55 #elif (APP_MODE == APP_MODE_TRTCM_COLOR_BLIND) 56 57 #define FUNC_METER(m, p, time, pkt_len, pkt_color) \ 58 rte_meter_trtcm_color_blind_check(m, p, time, pkt_len) 59 #define FUNC_CONFIG rte_meter_trtcm_config 60 #define FLOW_METER struct rte_meter_trtcm 61 #define PROFILE app_trtcm_profile 62 63 #elif (APP_MODE == APP_MODE_TRTCM_COLOR_AWARE) 64 65 #define FUNC_METER rte_meter_trtcm_color_aware_check 66 #define FUNC_CONFIG rte_meter_trtcm_config 67 #define FLOW_METER struct rte_meter_trtcm 68 #define PROFILE app_trtcm_profile 69 70 #else 71 #error Invalid value for APP_MODE 72 #endif 73 74 #endif /* _MAIN_H_ */ 75