From: Filip Tehlar Date: Thu, 17 Jun 2021 01:28:22 +0000 (+0000) Subject: bier: api cleanup X-Git-Tag: v22.02-rc0~300 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=52d80c55d6eede5391026d68b7ef6b6cf2566a6b bier: api cleanup use autogenerated code Type: improvement Signed-off-by: Filip Tehlar Change-Id: I86459d918ac46bed523e847db9f9c7179147d022 --- diff --git a/src/vat/api_format.c b/src/vat/api_format.c index a1c5e8ef5d8..2317af3d960 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -81,8 +81,6 @@ #define __plugin_msg_base 0 #include -#include - void vl_api_set_elog_main (elog_main_t * m); int vl_api_set_elog_trace_api_messages (int enable); @@ -3261,8 +3259,6 @@ _(ip_mroute_add_del_reply) \ _(mpls_route_add_del_reply) \ _(mpls_table_add_del_reply) \ _(mpls_ip_bind_unbind_reply) \ -_(bier_route_add_del_reply) \ -_(bier_table_add_del_reply) \ _(sw_interface_set_unnumbered_reply) \ _(set_ip_flow_hash_reply) \ _(sw_interface_ip6_enable_disable_reply) \ @@ -3416,8 +3412,6 @@ _(IP_MROUTE_ADD_DEL_REPLY, ip_mroute_add_del_reply) \ _(MPLS_TABLE_ADD_DEL_REPLY, mpls_table_add_del_reply) \ _(MPLS_ROUTE_ADD_DEL_REPLY, mpls_route_add_del_reply) \ _(MPLS_IP_BIND_UNBIND_REPLY, mpls_ip_bind_unbind_reply) \ -_(BIER_ROUTE_ADD_DEL_REPLY, bier_route_add_del_reply) \ -_(BIER_TABLE_ADD_DEL_REPLY, bier_table_add_del_reply) \ _(MPLS_TUNNEL_ADD_DEL_REPLY, mpls_tunnel_add_del_reply) \ _(SW_INTERFACE_SET_UNNUMBERED_REPLY, \ sw_interface_set_unnumbered_reply) \ @@ -6742,156 +6736,6 @@ api_sr_mpls_policy_del (vat_main_t * vam) return ret; } -static int -api_bier_table_add_del (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bier_table_add_del_t *mp; - u8 is_add = 1; - u32 set = 0, sub_domain = 0, hdr_len = 3; - mpls_label_t local_label = MPLS_LABEL_INVALID; - int ret; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "sub-domain %d", &sub_domain)) - ; - else if (unformat (i, "set %d", &set)) - ; - else if (unformat (i, "label %d", &local_label)) - ; - else if (unformat (i, "hdr-len %d", &hdr_len)) - ; - else if (unformat (i, "add")) - is_add = 1; - else if (unformat (i, "del")) - is_add = 0; - else - { - clib_warning ("parse error '%U'", format_unformat_error, i); - return -99; - } - } - - if (MPLS_LABEL_INVALID == local_label) - { - errmsg ("missing label\n"); - return -99; - } - - /* Construct the API message */ - M (BIER_TABLE_ADD_DEL, mp); - - mp->bt_is_add = is_add; - mp->bt_label = ntohl (local_label); - mp->bt_tbl_id.bt_set = set; - mp->bt_tbl_id.bt_sub_domain = sub_domain; - mp->bt_tbl_id.bt_hdr_len_id = hdr_len; - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - - return (ret); -} - -static int -api_bier_route_add_del (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bier_route_add_del_t *mp; - u8 is_add = 1; - u32 set = 0, sub_domain = 0, hdr_len = 3, bp = 0; - ip4_address_t v4_next_hop_address; - ip6_address_t v6_next_hop_address; - u8 next_hop_set = 0; - u8 next_hop_proto_is_ip4 = 1; - mpls_label_t next_hop_out_label = MPLS_LABEL_INVALID; - int ret; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "%U", unformat_ip4_address, &v4_next_hop_address)) - { - next_hop_proto_is_ip4 = 1; - next_hop_set = 1; - } - else if (unformat (i, "%U", unformat_ip6_address, &v6_next_hop_address)) - { - next_hop_proto_is_ip4 = 0; - next_hop_set = 1; - } - if (unformat (i, "sub-domain %d", &sub_domain)) - ; - else if (unformat (i, "set %d", &set)) - ; - else if (unformat (i, "hdr-len %d", &hdr_len)) - ; - else if (unformat (i, "bp %d", &bp)) - ; - else if (unformat (i, "add")) - is_add = 1; - else if (unformat (i, "del")) - is_add = 0; - else if (unformat (i, "out-label %d", &next_hop_out_label)) - ; - else - { - clib_warning ("parse error '%U'", format_unformat_error, i); - return -99; - } - } - - if (!next_hop_set || (MPLS_LABEL_INVALID == next_hop_out_label)) - { - errmsg ("next hop / label set\n"); - return -99; - } - if (0 == bp) - { - errmsg ("bit=position not set\n"); - return -99; - } - - /* Construct the API message */ - M2 (BIER_ROUTE_ADD_DEL, mp, sizeof (vl_api_fib_path_t)); - - mp->br_is_add = is_add; - mp->br_route.br_tbl_id.bt_set = set; - mp->br_route.br_tbl_id.bt_sub_domain = sub_domain; - mp->br_route.br_tbl_id.bt_hdr_len_id = hdr_len; - mp->br_route.br_bp = ntohs (bp); - mp->br_route.br_n_paths = 1; - mp->br_route.br_paths[0].n_labels = 1; - mp->br_route.br_paths[0].label_stack[0].label = ntohl (next_hop_out_label); - mp->br_route.br_paths[0].proto = (next_hop_proto_is_ip4 ? - FIB_API_PATH_NH_PROTO_IP4 : - FIB_API_PATH_NH_PROTO_IP6); - - if (next_hop_proto_is_ip4) - { - clib_memcpy (&mp->br_route.br_paths[0].nh.address.ip4, - &v4_next_hop_address, sizeof (v4_next_hop_address)); - } - else - { - clib_memcpy (&mp->br_route.br_paths[0].nh.address.ip6, - &v6_next_hop_address, sizeof (v6_next_hop_address)); - } - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - - return (ret); -} - static int api_mpls_tunnel_add_del (vat_main_t * vam) { @@ -14819,12 +14663,6 @@ _(sr_mpls_policy_add, \ "bsid [weight ] [spray] next [next ]") \ _(sr_mpls_policy_del, \ "bsid ") \ -_(bier_table_add_del, \ - "