2017-12-19 15:49:02 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
2013-06-03 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MAIN_H_
|
|
|
|
#define _MAIN_H_
|
|
|
|
|
2013-09-18 10:00:00 +00:00
|
|
|
enum policer_action {
|
2019-04-11 09:15:14 +00:00
|
|
|
GREEN = RTE_COLOR_GREEN,
|
|
|
|
YELLOW = RTE_COLOR_YELLOW,
|
|
|
|
RED = RTE_COLOR_RED,
|
|
|
|
DROP = 3,
|
2013-09-18 10:00:00 +00:00
|
|
|
};
|
|
|
|
|
2021-07-16 13:57:52 +00:00
|
|
|
/* Policy implemented as a static structure. 8< */
|
2019-04-11 09:15:14 +00:00
|
|
|
enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =
|
2013-09-18 10:00:00 +00:00
|
|
|
{
|
|
|
|
{ GREEN, RED, RED},
|
|
|
|
{ DROP, YELLOW, RED},
|
|
|
|
{ DROP, DROP, RED}
|
|
|
|
};
|
2021-07-16 13:57:52 +00:00
|
|
|
/* >8 End of policy implemented as a static structure. */
|
2013-09-18 10:00:00 +00:00
|
|
|
|
2013-06-03 00:00:00 +00:00
|
|
|
#if APP_MODE == APP_MODE_FWD
|
|
|
|
|
2018-01-08 15:43:56 +00:00
|
|
|
#define FUNC_METER(m, p, time, pkt_len, pkt_color) \
|
|
|
|
({ \
|
|
|
|
void *mp = m; \
|
|
|
|
void *pp = p; \
|
|
|
|
mp = mp; \
|
|
|
|
pp = pp; \
|
|
|
|
time = time; \
|
|
|
|
pkt_len = pkt_len; \
|
|
|
|
pkt_color; \
|
|
|
|
})
|
2016-05-13 08:35:07 +00:00
|
|
|
#define FUNC_CONFIG(a, b) 0
|
2013-06-03 00:00:00 +00:00
|
|
|
#define FLOW_METER int
|
2018-01-08 15:43:56 +00:00
|
|
|
#define PROFILE app_srtcm_profile
|
2013-06-03 00:00:00 +00:00
|
|
|
|
|
|
|
#elif APP_MODE == APP_MODE_SRTCM_COLOR_BLIND
|
|
|
|
|
2018-01-08 15:43:56 +00:00
|
|
|
#define FUNC_METER(m, p, time, pkt_len, pkt_color) \
|
|
|
|
rte_meter_srtcm_color_blind_check(m, p, time, pkt_len)
|
2013-06-03 00:00:00 +00:00
|
|
|
#define FUNC_CONFIG rte_meter_srtcm_config
|
|
|
|
#define FLOW_METER struct rte_meter_srtcm
|
2018-01-08 15:43:56 +00:00
|
|
|
#define PROFILE app_srtcm_profile
|
2013-06-03 00:00:00 +00:00
|
|
|
|
|
|
|
#elif (APP_MODE == APP_MODE_SRTCM_COLOR_AWARE)
|
|
|
|
|
|
|
|
#define FUNC_METER rte_meter_srtcm_color_aware_check
|
|
|
|
#define FUNC_CONFIG rte_meter_srtcm_config
|
|
|
|
#define FLOW_METER struct rte_meter_srtcm
|
2018-01-08 15:43:56 +00:00
|
|
|
#define PROFILE app_srtcm_profile
|
2013-06-03 00:00:00 +00:00
|
|
|
|
|
|
|
#elif (APP_MODE == APP_MODE_TRTCM_COLOR_BLIND)
|
|
|
|
|
2018-01-08 15:43:56 +00:00
|
|
|
#define FUNC_METER(m, p, time, pkt_len, pkt_color) \
|
|
|
|
rte_meter_trtcm_color_blind_check(m, p, time, pkt_len)
|
2013-06-03 00:00:00 +00:00
|
|
|
#define FUNC_CONFIG rte_meter_trtcm_config
|
|
|
|
#define FLOW_METER struct rte_meter_trtcm
|
2018-01-08 15:43:56 +00:00
|
|
|
#define PROFILE app_trtcm_profile
|
2013-06-03 00:00:00 +00:00
|
|
|
|
|
|
|
#elif (APP_MODE == APP_MODE_TRTCM_COLOR_AWARE)
|
|
|
|
|
2018-01-08 15:43:56 +00:00
|
|
|
#define FUNC_METER rte_meter_trtcm_color_aware_check
|
2013-06-03 00:00:00 +00:00
|
|
|
#define FUNC_CONFIG rte_meter_trtcm_config
|
|
|
|
#define FLOW_METER struct rte_meter_trtcm
|
2018-01-08 15:43:56 +00:00
|
|
|
#define PROFILE app_trtcm_profile
|
2013-06-03 00:00:00 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
#error Invalid value for APP_MODE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _MAIN_H_ */
|