blob: a1bc9c5416286f2e4012e815267c8b82ab1a956e [file] [log] [blame]
Matus Fabian70e6a8d2016-06-20 08:10:42 -07001/*
2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __included_vnet_policer_classify_h__
17#define __included_vnet_policer_classify_h__
18
19#include <vlib/vlib.h>
20#include <vnet/vnet.h>
21#include <vnet/classify/vnet_classify.h>
22
khemendra kumard7bfa0e2017-11-27 15:15:53 +053023typedef enum
24{
Matus Fabian70e6a8d2016-06-20 08:10:42 -070025 POLICER_CLASSIFY_TABLE_IP4,
26 POLICER_CLASSIFY_TABLE_IP6,
27 POLICER_CLASSIFY_TABLE_L2,
28 POLICER_CLASSIFY_N_TABLES,
29} policer_classify_table_id_t;
30
khemendra kumard7bfa0e2017-11-27 15:15:53 +053031typedef enum
32{
Matus Fabian70e6a8d2016-06-20 08:10:42 -070033 POLICER_CLASSIFY_NEXT_INDEX_DROP,
34 POLICER_CLASSIFY_NEXT_INDEX_N_NEXT,
35} policer_classify_next_index_t;
36
khemendra kumard7bfa0e2017-11-27 15:15:53 +053037typedef struct
38{
Matus Fabian70e6a8d2016-06-20 08:10:42 -070039 /* Classifier table vectors */
khemendra kumard7bfa0e2017-11-27 15:15:53 +053040 u32 *classify_table_index_by_sw_if_index[POLICER_CLASSIFY_N_TABLES];
Matus Fabian70e6a8d2016-06-20 08:10:42 -070041
42 /* L2 next nodes for each feature */
43 u32 feat_next_node_index[32];
44
45 /* Convenience variables */
khemendra kumard7bfa0e2017-11-27 15:15:53 +053046 vlib_main_t *vlib_main;
47 vnet_main_t *vnet_main;
48 vnet_classify_main_t *vnet_classify_main;
49 vnet_config_main_t *vnet_config_main[POLICER_CLASSIFY_N_TABLES];
Matus Fabian70e6a8d2016-06-20 08:10:42 -070050} policer_classify_main_t;
51
Dave Wallace71612d62017-10-24 01:32:41 -040052extern policer_classify_main_t policer_classify_main;
Matus Fabian70e6a8d2016-06-20 08:10:42 -070053
54int vnet_set_policer_classify_intfc (vlib_main_t * vm, u32 sw_if_index,
khemendra kumard7bfa0e2017-11-27 15:15:53 +053055 u32 ip4_table_index, u32 ip6_table_index,
56 u32 l2_table_index, u32 is_add);
Matus Fabian70e6a8d2016-06-20 08:10:42 -070057
58#endif /* __included_vnet_policer_classify_h__ */
khemendra kumard7bfa0e2017-11-27 15:15:53 +053059
60/*
61 * fd.io coding-style-patch-verification: ON
62 *
63 * Local Variables:
64 * eval: (c-set-style "gnu")
65 * End:
66 */