f-stack/dpdk/examples/qos_meter/main.h

73 lines
1.8 KiB
C
Raw Normal View History

2019-06-25 11:12:58 +00:00
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
2017-04-21 10:43:26 +00:00
*/
#ifndef _MAIN_H_
#define _MAIN_H_
enum policer_action {
2020-06-18 16:55:50 +00:00
GREEN = RTE_COLOR_GREEN,
YELLOW = RTE_COLOR_YELLOW,
RED = RTE_COLOR_RED,
DROP = 3,
2017-04-21 10:43:26 +00:00
};
2020-06-18 16:55:50 +00:00
enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =
2017-04-21 10:43:26 +00:00
{
{ GREEN, RED, RED},
{ DROP, YELLOW, RED},
{ DROP, DROP, RED}
};
#if APP_MODE == APP_MODE_FWD
2019-06-25 11:12:58 +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; \
})
2017-04-21 10:43:26 +00:00
#define FUNC_CONFIG(a, b) 0
#define FLOW_METER int
2019-06-25 11:12:58 +00:00
#define PROFILE app_srtcm_profile
2017-04-21 10:43:26 +00:00
#elif APP_MODE == APP_MODE_SRTCM_COLOR_BLIND
2019-06-25 11:12:58 +00:00
#define FUNC_METER(m, p, time, pkt_len, pkt_color) \
rte_meter_srtcm_color_blind_check(m, p, time, pkt_len)
2017-04-21 10:43:26 +00:00
#define FUNC_CONFIG rte_meter_srtcm_config
#define FLOW_METER struct rte_meter_srtcm
2019-06-25 11:12:58 +00:00
#define PROFILE app_srtcm_profile
2017-04-21 10:43:26 +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
2019-06-25 11:12:58 +00:00
#define PROFILE app_srtcm_profile
2017-04-21 10:43:26 +00:00
#elif (APP_MODE == APP_MODE_TRTCM_COLOR_BLIND)
2019-06-25 11:12:58 +00:00
#define FUNC_METER(m, p, time, pkt_len, pkt_color) \
rte_meter_trtcm_color_blind_check(m, p, time, pkt_len)
2017-04-21 10:43:26 +00:00
#define FUNC_CONFIG rte_meter_trtcm_config
#define FLOW_METER struct rte_meter_trtcm
2019-06-25 11:12:58 +00:00
#define PROFILE app_trtcm_profile
2017-04-21 10:43:26 +00:00
#elif (APP_MODE == APP_MODE_TRTCM_COLOR_AWARE)
2019-06-25 11:12:58 +00:00
#define FUNC_METER rte_meter_trtcm_color_aware_check
2017-04-21 10:43:26 +00:00
#define FUNC_CONFIG rte_meter_trtcm_config
#define FLOW_METER struct rte_meter_trtcm
2019-06-25 11:12:58 +00:00
#define PROFILE app_trtcm_profile
2017-04-21 10:43:26 +00:00
#else
#error Invalid value for APP_MODE
#endif
#endif /* _MAIN_H_ */