Merge pull request #9378 from AnuradhaKaruppiah/evpn-mh-cleanup

evpn-mh: fixes for sync-MAC-IP handling on ES bond del/add
This commit is contained in:
Sri Mohana Singamsetty 2021-10-22 09:26:06 -07:00 committed by GitHub
commit ffab914521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 10 deletions

View File

@ -1423,8 +1423,24 @@ void zebra_evpn_rem_macip_add(vni_t vni, const struct ethaddr *macaddr,
* REMOTE - if ES is not local
*/
if (flags & ZEBRA_MACIP_TYPE_SYNC_PATH) {
zebra_evpn_process_sync_macip_add(zevpn, macaddr, ipa_len,
ipaddr, flags, seq, esi);
struct zebra_evpn_es *es;
es = zebra_evpn_es_find(esi);
if (es && (es->flags & ZEBRA_EVPNES_READY_FOR_BGP)) {
zebra_evpn_process_sync_macip_add(zevpn, macaddr,
ipa_len, ipaddr,
flags, seq, esi);
} else {
if (IS_ZEBRA_DEBUG_EVPN_MH_ES) {
char esi_str[ESI_STR_LEN];
esi_to_str(esi, esi_str, sizeof(esi_str));
zlog_debug(
"Ignore sync-macip add; ES %s is not ready",
esi_str);
}
}
return;
}

View File

@ -1342,6 +1342,25 @@ int zebra_evpn_sync_mac_dp_install(struct zebra_mac *mac, bool set_inactive,
struct zebra_if *zif;
struct interface *br_ifp;
/* If the ES-EVI doesn't exist defer install. When the ES-EVI is
* created we will attempt to install the mac entry again
*/
if (mac->es) {
struct zebra_evpn_es_evi *es_evi;
es_evi = zebra_evpn_es_evi_find(mac->es, mac->zevpn);
if (!es_evi) {
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
zlog_debug(
"%s: dp-install sync-mac vni %u mac %pEA es %s 0x%x %sskipped, no es-evi",
caller, zevpn->vni, &mac->macaddr,
mac->es ? mac->es->esi_str : "-",
mac->flags,
set_inactive ? "inactive " : "");
return -1;
}
}
/* get the access vlan from the vxlan_device */
zebra_evpn_mac_get_access_info(mac, &ifp, &vid);

View File

@ -186,8 +186,8 @@ static void zebra_evpn_es_evi_free(struct zebra_evpn_es_evi *es_evi)
}
/* find the ES-EVI in the per-L2-VNI RB tree */
static struct zebra_evpn_es_evi *
zebra_evpn_es_evi_find(struct zebra_evpn_es *es, struct zebra_evpn *zevpn)
struct zebra_evpn_es_evi *zebra_evpn_es_evi_find(struct zebra_evpn_es *es,
struct zebra_evpn *zevpn)
{
struct zebra_evpn_es_evi es_evi;
@ -229,6 +229,34 @@ static void zebra_evpn_local_es_evi_del(struct zebra_evpn_es *es,
zebra_evpn_local_es_evi_do_del(es_evi);
}
/* If there are any existing MAC entries for this es/zevpn we need
* to install it in the dataplane.
*
* Note: primary purpose of this is to handle es del/re-add windows where
* sync MAC entries may be added by bgpd before the es-evi membership is
* created in the dataplane and in zebra
*/
static void zebra_evpn_es_evi_mac_install(struct zebra_evpn_es_evi *es_evi)
{
struct zebra_mac *mac;
struct listnode *node;
struct zebra_evpn_es *es = es_evi->es;
if (listcount(es->mac_list) && IS_ZEBRA_DEBUG_EVPN_MH_ES)
zlog_debug("dp-mac install on es %s evi %d add", es->esi_str,
es_evi->zevpn->vni);
for (ALL_LIST_ELEMENTS_RO(es->mac_list, node, mac)) {
if (mac->zevpn != es_evi->zevpn)
continue;
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL))
continue;
zebra_evpn_sync_mac_dp_install(mac, false, false, __func__);
}
}
/* Create an ES-EVI if it doesn't already exist and tell BGP */
static void zebra_evpn_local_es_evi_add(struct zebra_evpn_es *es,
struct zebra_evpn *zevpn)
@ -250,6 +278,8 @@ static void zebra_evpn_local_es_evi_add(struct zebra_evpn_es *es,
listnode_add(zevpn->local_es_evi_list, &es_evi->l2vni_listnode);
zebra_evpn_es_evi_re_eval_send_to_client(es_evi);
zebra_evpn_es_evi_mac_install(es_evi);
}
}
@ -1050,15 +1080,15 @@ void zebra_evpn_if_cleanup(struct zebra_if *zif)
vlanid_t vid;
struct zebra_evpn_es *es;
if (!bf_is_inited(zif->vlan_bitmap))
return;
if (bf_is_inited(zif->vlan_bitmap)) {
bf_for_each_set_bit(zif->vlan_bitmap, vid, IF_VLAN_BITMAP_MAX)
{
zebra_evpn_vl_mbr_deref(vid, zif);
}
bf_for_each_set_bit(zif->vlan_bitmap, vid, IF_VLAN_BITMAP_MAX) {
zebra_evpn_vl_mbr_deref(vid, zif);
bf_free(zif->vlan_bitmap);
}
bf_free(zif->vlan_bitmap);
/* Delete associated Ethernet Segment */
es = zif->es_info.es;
if (es)

View File

@ -387,5 +387,7 @@ extern void zebra_evpn_acc_bd_svi_mac_add(struct interface *vlan_if);
extern void zebra_evpn_es_bypass_update(struct zebra_evpn_es *es,
struct interface *ifp, bool bypass);
extern void zebra_evpn_proc_remote_nh(ZAPI_HANDLER_ARGS);
extern struct zebra_evpn_es_evi *
zebra_evpn_es_evi_find(struct zebra_evpn_es *es, struct zebra_evpn *zevpn);
#endif /* _ZEBRA_EVPN_MH_H */