From 25e26dc5136137c771715145dd5b2884060ff9eb Mon Sep 17 00:00:00 2001 From: Steve Shin Date: Tue, 8 Nov 2016 10:47:10 -0800 Subject: VPP-521: Classify API enhancement to redirect traffic to pre-defined VRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ingress packets are punted to the “Input ACL node” where traffic is classified based on n-tuple keys. If no matched session is found from the classify tables, then it will be passed to “the lookup node” for normal packet forwarding. If a classify session is hit from one of classify tables, then packet vnet buffer field sw_if_index[VLIB_TX] will be updated to the new FIB index used for subsequent IP lookup for this packet. Change-Id: Ifdea63196ddb81c2d5c43b8c98e11ddbf5b11858 Signed-off-by: Steve Shin --- vpp-api-test/vat/api_format.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'vpp-api-test') diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 65114ec2d70..b32c159da8f 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -8756,6 +8756,8 @@ api_classify_add_del_table (vat_main_t * vam) u32 memory_size = 32 << 20; u8 *mask = 0; f64 timeout; + u32 current_data_flag = 0; + int current_data_offset = 0; while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { @@ -8785,6 +8787,10 @@ api_classify_add_del_table (vat_main_t * vam) else if (unformat (i, "acl-miss-next %U", unformat_acl_next_index, &miss_next_index)) ; + else if (unformat (i, "current-data-flag %d", ¤t_data_flag)) + ; + else if (unformat (i, "current-data-offset %d", ¤t_data_offset)) + ; else break; } @@ -8823,6 +8829,8 @@ api_classify_add_del_table (vat_main_t * vam) mp->match_n_vectors = ntohl (match); mp->next_table_index = ntohl (next_table_index); mp->miss_next_index = ntohl (miss_next_index); + mp->current_data_flag = ntohl (current_data_flag); + mp->current_data_offset = ntohl (current_data_offset); clib_memcpy (mp->mask, mask, vec_len (mask)); vec_free (mask); @@ -9282,6 +9290,8 @@ api_classify_add_del_session (vat_main_t * vam) f64 timeout; u32 skip_n_vectors = 0; u32 match_n_vectors = 0; + u32 action = 0; + u32 metadata = 0; /* * Warning: you have to supply skip_n and match_n @@ -9319,6 +9329,14 @@ api_classify_add_del_session (vat_main_t * vam) ; else if (unformat (i, "table-index %d", &table_index)) ; + else if (unformat (i, "action set-ip4-fib-id %d", &metadata)) + action = 1; + else if (unformat (i, "action set-ip6-fib-id %d", &metadata)) + action = 2; + else if (unformat (i, "action %d", &action)) + ; + else if (unformat (i, "metadata %d", &metadata)) + ; else break; } @@ -9342,6 +9360,8 @@ api_classify_add_del_session (vat_main_t * vam) mp->hit_next_index = ntohl (hit_next_index); mp->opaque_index = ntohl (opaque_index); mp->advance = ntohl (advance); + mp->action = action; + mp->metadata = ntohl (metadata); clib_memcpy (mp->match, match, vec_len (match)); vec_free (match); @@ -16641,12 +16661,14 @@ _(sr_multicast_map_add_del, \ "address [ip6 multicast address] sr-policy [policy name] [del]") \ _(classify_add_del_table, \ "buckets [skip ] [match ] [memory_size ]\n" \ - "[del] mask \n" \ - " [l2-miss-next | miss-next | acl-miss-next] ") \ + " [del] mask \n" \ + " [l2-miss-next | miss-next | acl-miss-next] \n" \ + " [current-data-flag ] [current-data-offset ] [table ]") \ _(classify_add_del_session, \ "[hit-next|l2-hit-next|acl-hit-next|policer-hit-next] \n" \ " table-index skip_n match_n match [hex] [l2]\n" \ - " [l3 [ip4|ip6]]") \ + " [l3 [ip4|ip6]] [action set-ip4-fib-id ]\n" \ + " [action set-ip6-fib-id | action metadata ] [del]") \ _(classify_set_interface_ip_table, \ " | sw_if_index table ") \ _(classify_set_interface_l2_tables, \ -- cgit 1.2.3-korg