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

36 lines
915 B
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 __INCLUDE_RTE_POLICER_H__
#define __INCLUDE_RTE_POLICER_H__
#include <stdint.h>
#include <rte_meter.h>
enum rte_phb_action {
2020-06-18 16:55:50 +00:00
e_RTE_PHB_ACTION_GREEN = RTE_COLOR_GREEN,
e_RTE_PHB_ACTION_YELLOW = RTE_COLOR_YELLOW,
e_RTE_PHB_ACTION_RED = RTE_COLOR_RED,
2017-04-21 10:43:26 +00:00
e_RTE_PHB_ACTION_DROP = 3,
};
struct rte_phb {
2020-06-18 16:55:50 +00:00
enum rte_phb_action actions[RTE_COLORS][RTE_COLORS];
2017-04-21 10:43:26 +00:00
};
int
rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
2020-06-18 16:55:50 +00:00
enum rte_color pre_meter, enum rte_color post_meter, enum rte_phb_action action);
2017-04-21 10:43:26 +00:00
static inline enum rte_phb_action
2020-06-18 16:55:50 +00:00
policer_run(struct rte_phb *phb_table, uint32_t phb_table_index, enum rte_color pre_meter, enum rte_color post_meter)
2017-04-21 10:43:26 +00:00
{
struct rte_phb *phb = &phb_table[phb_table_index];
enum rte_phb_action action = phb->actions[pre_meter][post_meter];
return action;
}
#endif