numam-dpdk/examples/qos_meter/rte_policer.h
Jasvinder Singh c1656328db meter: replace color definitions
This patch implements the changes proposed in the deprecation
note[1]. Replace multiple color definitions in various places such as
rte_meter.h, rte_tm.h and rte_mtr.h with single rte_color defined
in rte_meter.h.

This is simple search and replace exercise without any implementation
change.

[1] https://mails.dpdk.org/archives/dev/2019-January/123861.html

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2019-04-11 14:27:32 +02:00

36 lines
915 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
*/
#ifndef __INCLUDE_RTE_POLICER_H__
#define __INCLUDE_RTE_POLICER_H__
#include <stdint.h>
#include <rte_meter.h>
enum rte_phb_action {
e_RTE_PHB_ACTION_GREEN = RTE_COLOR_GREEN,
e_RTE_PHB_ACTION_YELLOW = RTE_COLOR_YELLOW,
e_RTE_PHB_ACTION_RED = RTE_COLOR_RED,
e_RTE_PHB_ACTION_DROP = 3,
};
struct rte_phb {
enum rte_phb_action actions[RTE_COLORS][RTE_COLORS];
};
int
rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
enum rte_color pre_meter, enum rte_color post_meter, enum rte_phb_action action);
static inline enum rte_phb_action
policer_run(struct rte_phb *phb_table, uint32_t phb_table_index, enum rte_color pre_meter, enum rte_color post_meter)
{
struct rte_phb *phb = &phb_table[phb_table_index];
enum rte_phb_action action = phb->actions[pre_meter][post_meter];
return action;
}
#endif