X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fgbp%2Fgbp_api.c;h=7c36da6829a43d6ae6a9a1f484863e1e135b3a7f;hb=32f6d8e0c;hp=74355d1c03344b3eb1aead3bbabe1fc397de3a68;hpb=8006c6aa425126529b4017768a9201e4f03964ad;p=vpp.git diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c index 74355d1c033..7c36da6829a 100644 --- a/src/plugins/gbp/gbp_api.c +++ b/src/plugins/gbp/gbp_api.c @@ -80,9 +80,8 @@ _(GBP_EXT_ITF_DUMP, gbp_ext_itf_dump) \ _(GBP_CONTRACT_ADD_DEL, gbp_contract_add_del) \ _(GBP_CONTRACT_DUMP, gbp_contract_dump) \ - _(GBP_ENDPOINT_LEARN_SET_INACTIVE_THRESHOLD, gbp_endpoint_learn_set_inactive_threshold) \ - _(GBP_VXLAN_TUNNEL_ADD, gbp_vxlan_tunnel_add) \ - _(GBP_VXLAN_TUNNEL_DEL, gbp_vxlan_tunnel_del) \ + _(GBP_VXLAN_TUNNEL_ADD, gbp_vxlan_tunnel_add) \ + _(GBP_VXLAN_TUNNEL_DEL, gbp_vxlan_tunnel_del) \ _(GBP_VXLAN_TUNNEL_DUMP, gbp_vxlan_tunnel_dump) gbp_main_t gbp_main; @@ -199,19 +198,6 @@ vl_api_gbp_endpoint_del_t_handler (vl_api_gbp_endpoint_del_t * mp) REPLY_MACRO (VL_API_GBP_ENDPOINT_DEL_REPLY + GBP_MSG_BASE); } -static void - vl_api_gbp_endpoint_learn_set_inactive_threshold_t_handler - (vl_api_gbp_endpoint_learn_set_inactive_threshold_t * mp) -{ - vl_api_gbp_endpoint_learn_set_inactive_threshold_reply_t *rmp; - int rv = 0; - - gbp_learn_set_inactive_threshold (ntohl (mp->threshold)); - - REPLY_MACRO (VL_API_GBP_ENDPOINT_LEARN_SET_INACTIVE_THRESHOLD_REPLY + - GBP_MSG_BASE); -} - typedef struct gbp_walk_ctx_t_ { vl_api_registration_t *reg; @@ -290,17 +276,29 @@ vl_api_gbp_endpoint_dump_t_handler (vl_api_gbp_endpoint_dump_t * mp) gbp_endpoint_walk (gbp_endpoint_send_details, &ctx); } +static void +gbp_retention_decode (const vl_api_gbp_endpoint_retention_t * in, + gbp_endpoint_retention_t * out) +{ + out->remote_ep_timeout = ntohl (in->remote_ep_timeout); +} + static void vl_api_gbp_endpoint_group_add_t_handler (vl_api_gbp_endpoint_group_add_t * mp) { vl_api_gbp_endpoint_group_add_reply_t *rmp; + gbp_endpoint_retention_t retention; int rv = 0; + gbp_retention_decode (&mp->epg.retention, &retention); + rv = gbp_endpoint_group_add_and_lock (ntohs (mp->epg.epg_id), + ntohs (mp->epg.sclass), ntohl (mp->epg.bd_id), ntohl (mp->epg.rd_id), - ntohl (mp->epg.uplink_sw_if_index)); + ntohl (mp->epg.uplink_sw_if_index), + &retention); REPLY_MACRO (VL_API_GBP_ENDPOINT_GROUP_ADD_REPLY + GBP_MSG_BASE); } @@ -341,7 +339,8 @@ vl_api_gbp_bridge_domain_add_t_handler (vl_api_gbp_bridge_domain_add_t * mp) gbp_bridge_domain_flags_from_api (mp->bd.flags), ntohl (mp->bd.bvi_sw_if_index), - ntohl (mp->bd.uu_fwd_sw_if_index)); + ntohl (mp->bd.uu_fwd_sw_if_index), + ntohl (mp->bd.bm_flood_sw_if_index)); REPLY_MACRO (VL_API_GBP_BRIDGE_DOMAIN_ADD_REPLY + GBP_MSG_BASE); } @@ -523,8 +522,9 @@ gbp_endpoint_group_send_details (gbp_endpoint_group_t * gg, void *args) mp->epg.uplink_sw_if_index = ntohl (gg->gg_uplink_sw_if_index); mp->epg.epg_id = ntohs (gg->gg_id); + mp->epg.sclass = ntohs (gg->gg_sclass); mp->epg.bd_id = ntohl (gbp_endpoint_group_get_bd_id (gg)); - mp->epg.rd_id = ntohl (gg->gg_rd); + mp->epg.rd_id = ntohl (gbp_route_domain_get_rd_id (gg->gg_rd)); vl_api_send_msg (ctx->reg, (u8 *) mp); @@ -567,6 +567,7 @@ gbp_bridge_domain_send_details (gbp_bridge_domain_t * gb, void *args) mp->bd.bd_id = ntohl (gb->gb_bd_id); mp->bd.bvi_sw_if_index = ntohl (gb->gb_bvi_sw_if_index); mp->bd.uu_fwd_sw_if_index = ntohl (gb->gb_uu_fwd_sw_if_index); + mp->bd.bm_flood_sw_if_index = ntohl (gb->gb_bm_flood_sw_if_index); vl_api_send_msg (ctx->reg, (u8 *) mp); @@ -645,10 +646,10 @@ vl_api_gbp_recirc_add_del_t_handler (vl_api_gbp_recirc_add_del_t * mp) goto bad_sw_if_index; if (mp->is_add) - gbp_recirc_add (sw_if_index, - ntohs (mp->recirc.epg_id), mp->recirc.is_ext); + rv = gbp_recirc_add (sw_if_index, + ntohs (mp->recirc.epg_id), mp->recirc.is_ext); else - gbp_recirc_delete (sw_if_index); + rv = gbp_recirc_delete (sw_if_index); BAD_SW_IF_INDEX_LABEL; @@ -672,7 +673,7 @@ gbp_recirc_send_details (gbp_recirc_t * gr, void *args) mp->recirc.epg_id = ntohs (gr->gr_epg); mp->recirc.sw_if_index = ntohl (gr->gr_sw_if_index); - mp->recirc.is_ext = ntohl (gr->gr_is_ext); + mp->recirc.is_ext = gr->gr_is_ext; vl_api_send_msg (ctx->reg, (u8 *) mp); @@ -700,17 +701,20 @@ static void vl_api_gbp_ext_itf_add_del_t_handler (vl_api_gbp_ext_itf_add_del_t * mp) { vl_api_gbp_ext_itf_add_del_reply_t *rmp; - u32 sw_if_index; + u32 sw_if_index = ~0; + vl_api_gbp_ext_itf_t *ext_itf; int rv = 0; - sw_if_index = ntohl (mp->ext_itf.sw_if_index); + ext_itf = &mp->ext_itf; + if (ext_itf) + sw_if_index = ntohl (ext_itf->sw_if_index); + if (!vnet_sw_if_index_is_api_valid (sw_if_index)) goto bad_sw_if_index; if (mp->is_add) rv = gbp_ext_itf_add (sw_if_index, - ntohl (mp->ext_itf.bd_id), - ntohl (mp->ext_itf.rd_id)); + ntohl (ext_itf->bd_id), ntohl (ext_itf->rd_id)); else rv = gbp_ext_itf_delete (sw_if_index); @@ -924,8 +928,11 @@ static void vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp) { vl_api_gbp_contract_add_del_reply_t *rmp; + u16 *allowed_ethertypes; index_t *rules; - int rv = 0; + int ii, rv = 0; + u8 *data, n_et; + u16 *et; if (mp->is_add) { @@ -934,9 +941,28 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp) if (0 != rv) goto out; + allowed_ethertypes = NULL; + + /* + * move past the variable legnth array of rules to get to the + * allowed ether types + */ + data = (((u8 *) & mp->contract.n_ether_types) + + (sizeof (mp->contract.rules[0]) * mp->contract.n_rules)); + n_et = *data; + et = (u16 *) (++data); + vec_validate (allowed_ethertypes, n_et - 1); + + for (ii = 0; ii < n_et; ii++) + { + /* leave the ether types in network order */ + allowed_ethertypes[ii] = et[ii]; + } + rv = gbp_contract_update (ntohs (mp->contract.src_epg), ntohs (mp->contract.dst_epg), - ntohl (mp->contract.acl_index), rules); + ntohl (mp->contract.acl_index), + rules, allowed_ethertypes); } else rv = gbp_contract_delete (ntohs (mp->contract.src_epg),