blob: 3c86fb5ca862a324922fba6b38f8f3cdf7f22f84 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001/*
2 * Copyright (c) 2015 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
Dave Barachb84a3e52016-08-30 17:01:52 -040016#ifndef __included_vnet_l2_input_classify_h__
17#define __included_vnet_l2_input_classify_h__
Ed Warnickecb9cada2015-12-08 15:45:58 -070018
19#include <vlib/vlib.h>
20#include <vnet/vnet.h>
Ed Warnickecb9cada2015-12-08 15:45:58 -070021#include <vnet/ethernet/ethernet.h>
22#include <vnet/ethernet/packet.h>
23#include <vnet/ip/ip_packet.h>
24#include <vnet/ip/ip4_packet.h>
25#include <vnet/ip/ip6_packet.h>
26#include <vlib/cli.h>
27#include <vnet/l2/l2_input.h>
Dave Barachb84a3e52016-08-30 17:01:52 -040028#include <vnet/l2/l2_output.h>
Ed Warnickecb9cada2015-12-08 15:45:58 -070029#include <vnet/l2/feat_bitmap.h>
30#include <vppinfra/error.h>
31#include <vppinfra/hash.h>
32#include <vppinfra/cache.h>
33
34#include <vnet/classify/vnet_classify.h>
35
Dave Barach97d8dc22016-08-15 15:31:15 -040036typedef enum
37{
Dave Barachb84a3e52016-08-30 17:01:52 -040038 L2_INPUT_CLASSIFY_NEXT_DROP,
39 L2_INPUT_CLASSIFY_NEXT_ETHERNET_INPUT,
40 L2_INPUT_CLASSIFY_NEXT_IP4_INPUT,
41 L2_INPUT_CLASSIFY_NEXT_IP6_INPUT,
Dave Barachb84a3e52016-08-30 17:01:52 -040042 L2_INPUT_CLASSIFY_N_NEXT,
43} l2_input_classify_next_t;
Ed Warnickecb9cada2015-12-08 15:45:58 -070044
Dave Barach97d8dc22016-08-15 15:31:15 -040045typedef enum
46{
Dave Barachb84a3e52016-08-30 17:01:52 -040047 L2_INPUT_CLASSIFY_TABLE_IP4,
48 L2_INPUT_CLASSIFY_TABLE_IP6,
49 L2_INPUT_CLASSIFY_TABLE_OTHER,
50 L2_INPUT_CLASSIFY_N_TABLES,
51} l2_input_classify_table_id_t;
Ed Warnickecb9cada2015-12-08 15:45:58 -070052
Dave Barachb84a3e52016-08-30 17:01:52 -040053typedef enum
Dave Barach97d8dc22016-08-15 15:31:15 -040054{
Dave Barachb84a3e52016-08-30 17:01:52 -040055 L2_OUTPUT_CLASSIFY_NEXT_DROP,
56 L2_OUTPUT_CLASSIFY_N_NEXT,
57} l2_output_classify_next_t;
Ed Warnickecb9cada2015-12-08 15:45:58 -070058
Dave Barachb84a3e52016-08-30 17:01:52 -040059typedef enum
60{
61 L2_OUTPUT_CLASSIFY_TABLE_IP4,
62 L2_OUTPUT_CLASSIFY_TABLE_IP6,
63 L2_OUTPUT_CLASSIFY_TABLE_OTHER,
64 L2_OUTPUT_CLASSIFY_N_TABLES,
65} l2_output_classify_table_id_t;
66
67typedef struct _l2_classify_main
68{
John Lobeb0b2e2017-07-22 00:21:36 -040069 /* Next nodes for L2 input and output features */
70 u32 l2_inp_feat_next[32];
71 u32 l2_out_feat_next[32];
Ed Warnickecb9cada2015-12-08 15:45:58 -070072
73 /* Per-address-family classifier table vectors */
Dave Barachb84a3e52016-08-30 17:01:52 -040074 u32 *classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_N_TABLES];
75
Ed Warnickecb9cada2015-12-08 15:45:58 -070076 /* convenience variables */
Dave Barach97d8dc22016-08-15 15:31:15 -040077 vlib_main_t *vlib_main;
78 vnet_main_t *vnet_main;
79 vnet_classify_main_t *vnet_classify_main;
Dave Barachb84a3e52016-08-30 17:01:52 -040080} l2_input_classify_main_t;
Ed Warnickecb9cada2015-12-08 15:45:58 -070081
Dave Barachb84a3e52016-08-30 17:01:52 -040082typedef struct _l2_classify_main l2_output_classify_main_t;
Ed Warnickecb9cada2015-12-08 15:45:58 -070083
Dave Barachb84a3e52016-08-30 17:01:52 -040084extern l2_input_classify_main_t l2_input_classify_main;
85extern vlib_node_registration_t l2_input_classify_node;
Ed Warnickecb9cada2015-12-08 15:45:58 -070086
Dave Barachb84a3e52016-08-30 17:01:52 -040087extern l2_output_classify_main_t l2_output_classify_main;
88extern vlib_node_registration_t l2_output_classify_node;
Ed Warnickecb9cada2015-12-08 15:45:58 -070089
Dave Barachb84a3e52016-08-30 17:01:52 -040090void vnet_l2_input_classify_enable_disable (u32 sw_if_index,
91 int enable_disable);
Ed Warnickecb9cada2015-12-08 15:45:58 -070092
Dave Barachb84a3e52016-08-30 17:01:52 -040093int vnet_l2_input_classify_set_tables (u32 sw_if_index, u32 ip4_table_index,
94 u32 ip6_table_index,
95 u32 other_table_index);
96
97void vnet_l2_output_classify_enable_disable (u32 sw_if_index,
98 int enable_disable);
99
100int vnet_l2_output_classify_set_tables (u32 sw_if_index, u32 ip4_table_index,
101 u32 ip6_table_index,
102 u32 other_table_index);
103
104#endif /* __included_vnet_l2_input_classify_h__ */
Dave Barach97d8dc22016-08-15 15:31:15 -0400105
106/*
107 * fd.io coding-style-patch-verification: ON
108 *
109 * Local Variables:
110 * eval: (c-set-style "gnu")
111 * End:
112 */