]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/examples/qos_meter/rte_policer.c
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / dpdk / examples / qos_meter / rte_policer.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5 #include <stdlib.h>
6 #include "rte_policer.h"
7
8 int
9 rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
10 enum rte_meter_color pre_meter, enum rte_meter_color post_meter, enum rte_phb_action action)
11 {
12 struct rte_phb *phb = NULL;
13
14 /* User argument checking */
15 if (phb_table == NULL) {
16 return -1;
17 }
18
19 if ((pre_meter > e_RTE_METER_RED) || (post_meter > e_RTE_METER_RED) || (pre_meter > post_meter)) {
20 return -2;
21 }
22
23 /* Set action in PHB table entry */
24 phb = &phb_table[phb_table_index];
25 phb->actions[pre_meter][post_meter] = action;
26
27
28 return 0;
29 }