diff options
author | Dave Barach <dave@barachs.net> | 2016-08-30 17:01:52 -0400 |
---|---|---|
committer | Keith Burns <alagalah@gmail.com> | 2016-08-31 21:53:01 +0000 |
commit | b84a3e56e1287389528b188aefc4f69bc0bb8ae7 (patch) | |
tree | d5642e2e4738b230aacad640134852cebc3cccea /vpp | |
parent | 1edfba9a6394128ee5fad2b413e9e0a05972ef48 (diff) |
VPP-369 Add an L2 output classification feature
Change-Id: If03162d328c1ea179249e734537ebb01bade3331
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/app/sticky_hash.c | 40 | ||||
-rw-r--r-- | vpp/vpp-api/api.c | 15 | ||||
-rw-r--r-- | vpp/vpp-api/custom_dump.c | 1 | ||||
-rw-r--r-- | vpp/vpp-api/vpe.api | 1 |
4 files changed, 34 insertions, 23 deletions
diff --git a/vpp/app/sticky_hash.c b/vpp/app/sticky_hash.c index 05d681f4..5569c677 100644 --- a/vpp/app/sticky_hash.c +++ b/vpp/app/sticky_hash.c @@ -49,7 +49,7 @@ typedef struct vlib_main_t *vlib_main; vnet_main_t *vnet_main; vnet_classify_main_t *vnet_classify_main; - l2_classify_main_t *l2_classify_main; + l2_input_classify_main_t *l2_input_classify_main; } sticky_hash_main_t; @@ -197,11 +197,11 @@ sticky_hash_miss_node_fn (vlib_main_t * vm, fe0 = vnet_classify_find_or_add_entry_3 (ft0, mp->fdata, &was_found0); - fe0->next_index = L2_CLASSIFY_NEXT_IP4_INPUT; + fe0->next_index = L2_INPUT_CLASSIFY_NEXT_IP4_INPUT; fe0->advance = sizeof (ethernet_header_t); re0 = vnet_classify_find_or_add_entry_3 (rt0, mp->rdata, 0); - re0->next_index = L2_CLASSIFY_NEXT_IP4_INPUT; /* $$$ FIXME */ + re0->next_index = L2_INPUT_CLASSIFY_NEXT_IP4_INPUT; /* $$$ FIXME */ re0->advance = sizeof (ethernet_header_t); /* Note: we could get a whole vector of misses for the same sess */ @@ -271,7 +271,7 @@ sticky_hash_miss_init (vlib_main_t * vm) mp->vlib_main = vm; mp->vnet_main = vnet_get_main (); mp->vnet_classify_main = &vnet_classify_main; - mp->l2_classify_main = &l2_classify_main; + mp->l2_input_classify_main = &l2_input_classify_main; return 0; } @@ -287,7 +287,7 @@ static int ip4_sticky_hash_enable_disable u32 fib_index; ip4_fib_t *fib; vnet_classify_main_t *cm = mp->vnet_classify_main; - l2_classify_main_t *l2cm = mp->l2_classify_main; + l2_input_classify_main_t *l2cm = mp->l2_input_classify_main; vnet_classify_table_3_t *ft, *rt; fib_index = vec_elt (im->fib_index_by_sw_if_index, fwd_sw_if_index); @@ -302,7 +302,7 @@ static int ip4_sticky_hash_enable_disable fib->fwd_classify_table_index = ft - (vnet_classify_table_3_t *) cm->tables; mp->fwd_miss_next_index = - vlib_node_add_next (mp->vlib_main, l2_classify_node.index, + vlib_node_add_next (mp->vlib_main, l2_input_classify_node.index, sticky_hash_miss_node.index); ft->miss_next_index = mp->fwd_miss_next_index; @@ -315,51 +315,51 @@ static int ip4_sticky_hash_enable_disable } vec_validate - (l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP4], + (l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP4], fwd_sw_if_index); vec_validate - (l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP6], + (l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP6], fwd_sw_if_index); vec_validate - (l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_OTHER], + (l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_OTHER], fwd_sw_if_index); - l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP4] + l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP4] [fwd_sw_if_index] = fib->fwd_classify_table_index; - l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP6] + l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP6] [fwd_sw_if_index] = ~0; - l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_OTHER] + l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_OTHER] [fwd_sw_if_index] = ~0; vec_validate - (l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP4], + (l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP4], rev_sw_if_index); vec_validate - (l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP6], + (l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP6], rev_sw_if_index); vec_validate - (l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_OTHER], + (l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_OTHER], rev_sw_if_index); - l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP4] + l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP4] [rev_sw_if_index] = fib->rev_classify_table_index; - l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_IP6] + l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_IP6] [rev_sw_if_index] = ~0; - l2cm->classify_table_index_by_sw_if_index[L2_CLASSIFY_TABLE_OTHER] + l2cm->classify_table_index_by_sw_if_index[L2_INPUT_CLASSIFY_TABLE_OTHER] [rev_sw_if_index] = ~0; - vnet_l2_classify_enable_disable (fwd_sw_if_index, enable_disable); - vnet_l2_classify_enable_disable (rev_sw_if_index, enable_disable); + vnet_l2_input_classify_enable_disable (fwd_sw_if_index, enable_disable); + vnet_l2_input_classify_enable_disable (rev_sw_if_index, enable_disable); return 0; } diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index 00988184..fbebfa6b 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -3996,8 +3996,14 @@ static void vl_api_classify_set_interface_l2_tables_t_handler VALIDATE_SW_IF_INDEX (mp); - rv = vnet_l2_classify_set_tables (sw_if_index, ip4_table_index, - ip6_table_index, other_table_index); + if (mp->is_input) + rv = vnet_l2_input_classify_set_tables (sw_if_index, ip4_table_index, + ip6_table_index, + other_table_index); + else + rv = vnet_l2_output_classify_set_tables (sw_if_index, ip4_table_index, + ip6_table_index, + other_table_index); if (rv == 0) { @@ -4007,7 +4013,10 @@ static void vl_api_classify_set_interface_l2_tables_t_handler else enable = 0; - vnet_l2_classify_enable_disable (sw_if_index, enable); + if (mp->is_input) + vnet_l2_input_classify_enable_disable (sw_if_index, enable); + else + vnet_l2_output_classify_enable_disable (sw_if_index, enable); } BAD_SW_IF_INDEX_LABEL; diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c index 913ad1c6..566bcb9f 100644 --- a/vpp/vpp-api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -1274,6 +1274,7 @@ static void *vl_api_classify_set_interface_l2_tables_t_print s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index)); s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index)); s = format (s, "other-table %d ", ntohl (mp->other_table_index)); + s = format (s, "is-input %d ", mp->is_input); FINISH; } diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api index 0bfa2fa2..1f26d551 100644 --- a/vpp/vpp-api/vpe.api +++ b/vpp/vpp-api/vpe.api @@ -1731,6 +1731,7 @@ define classify_set_interface_l2_tables u32 ip4_table_index; u32 ip6_table_index; u32 other_table_index; + u8 is_input; }; /** \brief Set/unset l2 classification tables for an interface response |