Skip to content

Commit ecb4f7f

Browse files
committed
zebra: mac sync update/del/expiry in extern_learn mode
Dataplane Sync MAC Update: - Install sync local MAC only if it's inactive On hold timer expiry: - Flush the MAC, and no reprogram, as no dynamic learn during static Sync Del: - Explicit MAC flush if MAC is inactive, if it has no PEER flags Sync MAC update: - In Peer Proxy, no additional BGP update computation Netlink MAC Update processing: - Ignore VXLAN Info message in extern mode - Ignore MAC netlink update if interface is down. Presently done only for extern mode Signed-off-by: Patrice Brissette <pbrisset@cisco.com> Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
1 parent 33b4b31 commit ecb4f7f

4 files changed

Lines changed: 70 additions & 26 deletions

File tree

zebra/zebra_evpn_mac.c

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,20 +1480,21 @@ int zebra_evpn_sync_mac_dp_install(struct zebra_mac *mac, bool set_inactive,
14801480
return 0;
14811481
}
14821482

1483-
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
1484-
char mac_buf[MAC_BUF_SIZE];
1483+
if (!zebra_mac_ext_learn_mode() || CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL_INACTIVE)) {
1484+
/* For Extern Only mode:
1485+
* Update the dataplane only when the MAC is inactive
1486+
*/
1487+
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
1488+
char mac_buf[MAC_BUF_SIZE];
14851489

1486-
zlog_debug("dp-install sync-mac vni %u mac %pEA es %s %s%s%s",
1487-
zevpn->vni, &mac->macaddr,
1488-
mac->es ? mac->es->esi_str : "-",
1489-
zebra_evpn_zebra_mac_flag_dump(mac, mac_buf,
1490-
sizeof(mac_buf)),
1491-
set_static ? "static " : "",
1492-
set_inactive ? "inactive " : "");
1490+
zlog_debug("dp-install sync-mac vni %u mac %pEA es %s %s%s%s", zevpn->vni,
1491+
&mac->macaddr, mac->es ? mac->es->esi_str : "-",
1492+
zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)),
1493+
set_static ? "static " : "", set_inactive ? "inactive " : "");
1494+
}
1495+
dplane_local_mac_add(ifp, br_ifp, vid, &mac->macaddr, sticky, set_static,
1496+
set_inactive);
14931497
}
1494-
1495-
dplane_local_mac_add(ifp, br_ifp, vid, &mac->macaddr, sticky,
1496-
set_static, set_inactive);
14971498
return 0;
14981499
}
14991500

@@ -1545,16 +1546,23 @@ static void zebra_evpn_mac_hold_exp_cb(struct event *t)
15451546
zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)));
15461547
}
15471548

1548-
/* re-program the local mac in the dataplane if the mac is no
1549-
* longer static
1550-
*/
1551-
if (old_static != new_static)
1552-
zebra_evpn_sync_mac_dp_install(mac, false, false, __func__);
1549+
if (zebra_mac_ext_learn_mode()) {
1550+
vlanid_t vid;
1551+
struct interface *ifp;
1552+
/* Upon expiry, MAC is deleted from DP. */
1553+
zebra_evpn_mac_get_access_info(mac, &ifp, &vid);
1554+
zebra_evpn_flush_local_mac(mac, ifp);
1555+
} else {
1556+
/* re-program the local mac in the dataplane if the mac is no
1557+
* longer static
1558+
*/
1559+
if (old_static != new_static)
1560+
zebra_evpn_sync_mac_dp_install(mac, false, false, __func__);
15531561

1554-
/* inform bgp if needed */
1555-
if (old_bgp_ready != new_bgp_ready)
1556-
zebra_evpn_mac_send_add_del_to_client(mac, old_bgp_ready,
1557-
new_bgp_ready);
1562+
/* inform bgp if needed */
1563+
if (old_bgp_ready != new_bgp_ready)
1564+
zebra_evpn_mac_send_add_del_to_client(mac, old_bgp_ready, new_bgp_ready);
1565+
}
15581566
}
15591567

15601568
static inline void zebra_evpn_mac_start_hold_timer(struct zebra_mac *mac)
@@ -1610,7 +1618,15 @@ void zebra_evpn_sync_mac_del(struct zebra_mac *mac)
16101618
zebra_evpn_mac_start_hold_timer(mac);
16111619
new_static = zebra_evpn_mac_is_static(mac);
16121620

1613-
if (old_static != new_static)
1621+
if (zebra_mac_ext_learn_mode() && !new_static &&
1622+
CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL_INACTIVE)) {
1623+
/* Clear the MAC from Peer Proxy, as no age out will happen for extern mode */
1624+
struct interface *ifp;
1625+
vlanid_t vid;
1626+
1627+
zebra_evpn_mac_get_access_info(mac, &ifp, &vid);
1628+
zebra_evpn_flush_local_mac(mac, ifp);
1629+
} else if (old_static != new_static)
16141630
/* program the local mac in the kernel */
16151631
zebra_evpn_sync_mac_dp_install(mac, false, false, __func__);
16161632
}
@@ -1823,8 +1839,16 @@ struct zebra_mac *zebra_evpn_proc_sync_mac_update(struct zebra_evpn *zevpn,
18231839
if (old_static != new_static)
18241840
inform_dataplane = true;
18251841

1826-
old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(old_flags);
1827-
new_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(mac->flags);
1842+
/* when going from peer-active to peer-proxy, nothing should be happening
1843+
* Route is maintain in BGP
1844+
*/
1845+
if (zebra_mac_ext_learn_mode() && CHECK_FLAG(new_flags, ZEBRA_MAC_ES_PEER_PROXY)) {
1846+
old_bgp_ready = false;
1847+
new_bgp_ready = false;
1848+
} else {
1849+
old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(old_flags);
1850+
new_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(mac->flags);
1851+
}
18281852
if (old_bgp_ready != new_bgp_ready)
18291853
inform_bgp = true;
18301854
}
@@ -2411,7 +2435,9 @@ int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, struct zebra_mac *mac,
24112435
new_bgp_ready);
24122436
}
24132437

2414-
/* re-install the inactive entry in the kernel */
2438+
/* In EXT-LEARN mode as well, the MAC will be reprogrammed as static,
2439+
* post age out, until proxy is withdrawn
2440+
*/
24152441
zebra_evpn_sync_mac_dp_install(mac, true, false, __func__);
24162442

24172443
return 0;

zebra/zebra_evpn_mh.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ static void zebra_evpn_mh_update_protodown_es(struct zebra_evpn_es *es,
6060
bool resync_dplane);
6161
static void zebra_evpn_mh_clear_protodown_es(struct zebra_evpn_es *es);
6262
static void zebra_evpn_mh_startup_delay_timer_start(const char *rc);
63+
static void zebra_evpn_es_bypass_update_macs(struct zebra_evpn_es *es, struct interface *ifp,
64+
bool bypass);
6365
static void zebra_evpn_es_vtep_local_set(struct zebra_evpn_es_vtep *es_vtep);
6466
static void zebra_evpn_es_vtep_local_clear(struct zebra_evpn_es_vtep *es_vtep);
6567

@@ -2232,7 +2234,7 @@ static void zebra_evpn_es_setup_evis(struct zebra_evpn_es *es)
22322234
}
22332235
}
22342236

2235-
static void zebra_evpn_flush_local_mac(struct zebra_mac *mac,
2237+
void zebra_evpn_flush_local_mac(struct zebra_mac *mac,
22362238
struct interface *ifp)
22372239
{
22382240
vlanid_t vid;

zebra/zebra_evpn_mh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ void zebra_evpn_es_type0_esi_update(struct zebra_if *zif, esi_t *esi);
425425
void zebra_evpn_es_df_pref_update(struct zebra_if *zif, uint16_t df_pref);
426426
void zebra_evpn_es_bypass_cfg_update(struct zebra_if *zif, bool bypass);
427427
void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set);
428+
void zebra_evpn_flush_local_mac(struct zebra_mac *mac,
429+
struct interface *ifp);
428430

429431
void zebra_evpn_mh_if_init(struct zebra_if *zif);
430432

zebra/zebra_neigh.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,12 @@ static void zebra_neigh_macfdb_update(struct zebra_dplane_ctx *ctx)
682682

683683

684684
if (IS_ZEBRA_IF_VXLAN(ifp)) {
685+
/* In mac-extern-learn mode the Linux kernel should never give us an entry
686+
* with VxLAN info
687+
*/
688+
if (zebra_mac_ext_learn_mode())
689+
return;
690+
685691
if (!dst_present)
686692
return;
687693

@@ -702,6 +708,14 @@ static void zebra_neigh_macfdb_update(struct zebra_dplane_ctx *ctx)
702708
!!(ndm_flags & ZEBRA_NTF_EXT_LEARNED));
703709
return;
704710
}
711+
if (zebra_mac_ext_learn_mode()) {
712+
if (!if_is_operative(ifp)) {
713+
if (IS_ZEBRA_DEBUG_KERNEL)
714+
zlog_debug("Interface %s(%u) not operative:Ignore Mac update",
715+
ifp->name, ifp->ifindex);
716+
return;
717+
}
718+
}
705719

706720
zebra_vxlan_local_mac_add_update(ifp, br_if, &mac, vid, sticky, local_inactive,
707721
dp_static);

0 commit comments

Comments
 (0)