Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 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 Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 16 | #ifndef __included_vnet_l2_input_classify_h__ |
| 17 | #define __included_vnet_l2_input_classify_h__ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 18 | |
| 19 | #include <vlib/vlib.h> |
| 20 | #include <vnet/vnet.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 21 | #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 Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 28 | #include <vnet/l2/l2_output.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 29 | #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 Barach | 97d8dc2 | 2016-08-15 15:31:15 -0400 | [diff] [blame] | 36 | typedef enum |
| 37 | { |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 38 | 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, |
| 42 | L2_INPUT_CLASSIFY_NEXT_LI, |
| 43 | L2_INPUT_CLASSIFY_N_NEXT, |
| 44 | } l2_input_classify_next_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 45 | |
Dave Barach | 97d8dc2 | 2016-08-15 15:31:15 -0400 | [diff] [blame] | 46 | typedef enum |
| 47 | { |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 48 | L2_INPUT_CLASSIFY_TABLE_IP4, |
| 49 | L2_INPUT_CLASSIFY_TABLE_IP6, |
| 50 | L2_INPUT_CLASSIFY_TABLE_OTHER, |
| 51 | L2_INPUT_CLASSIFY_N_TABLES, |
| 52 | } l2_input_classify_table_id_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 53 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 54 | typedef enum |
Dave Barach | 97d8dc2 | 2016-08-15 15:31:15 -0400 | [diff] [blame] | 55 | { |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 56 | L2_OUTPUT_CLASSIFY_NEXT_DROP, |
| 57 | L2_OUTPUT_CLASSIFY_N_NEXT, |
| 58 | } l2_output_classify_next_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 59 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 60 | typedef enum |
| 61 | { |
| 62 | L2_OUTPUT_CLASSIFY_TABLE_IP4, |
| 63 | L2_OUTPUT_CLASSIFY_TABLE_IP6, |
| 64 | L2_OUTPUT_CLASSIFY_TABLE_OTHER, |
| 65 | L2_OUTPUT_CLASSIFY_N_TABLES, |
| 66 | } l2_output_classify_table_id_t; |
| 67 | |
| 68 | typedef struct _l2_classify_main |
| 69 | { |
John Lo | beb0b2e | 2017-07-22 00:21:36 -0400 | [diff] [blame] | 70 | /* Next nodes for L2 input and output features */ |
| 71 | u32 l2_inp_feat_next[32]; |
| 72 | u32 l2_out_feat_next[32]; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 73 | |
| 74 | /* Per-address-family classifier table vectors */ |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 75 | u32 *classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_N_TABLES]; |
| 76 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 77 | /* convenience variables */ |
Dave Barach | 97d8dc2 | 2016-08-15 15:31:15 -0400 | [diff] [blame] | 78 | vlib_main_t *vlib_main; |
| 79 | vnet_main_t *vnet_main; |
| 80 | vnet_classify_main_t *vnet_classify_main; |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 81 | } l2_input_classify_main_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 82 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 83 | typedef struct _l2_classify_main l2_output_classify_main_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 84 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 85 | extern l2_input_classify_main_t l2_input_classify_main; |
| 86 | extern vlib_node_registration_t l2_input_classify_node; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 87 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 88 | extern l2_output_classify_main_t l2_output_classify_main; |
| 89 | extern vlib_node_registration_t l2_output_classify_node; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 90 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 91 | void vnet_l2_input_classify_enable_disable (u32 sw_if_index, |
| 92 | int enable_disable); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 93 | |
Dave Barach | b84a3e5 | 2016-08-30 17:01:52 -0400 | [diff] [blame] | 94 | int vnet_l2_input_classify_set_tables (u32 sw_if_index, u32 ip4_table_index, |
| 95 | u32 ip6_table_index, |
| 96 | u32 other_table_index); |
| 97 | |
| 98 | void vnet_l2_output_classify_enable_disable (u32 sw_if_index, |
| 99 | int enable_disable); |
| 100 | |
| 101 | int vnet_l2_output_classify_set_tables (u32 sw_if_index, u32 ip4_table_index, |
| 102 | u32 ip6_table_index, |
| 103 | u32 other_table_index); |
| 104 | |
| 105 | #endif /* __included_vnet_l2_input_classify_h__ */ |
Dave Barach | 97d8dc2 | 2016-08-15 15:31:15 -0400 | [diff] [blame] | 106 | |
| 107 | /* |
| 108 | * fd.io coding-style-patch-verification: ON |
| 109 | * |
| 110 | * Local Variables: |
| 111 | * eval: (c-set-style "gnu") |
| 112 | * End: |
| 113 | */ |