From 3198b2b3478802a2369f5fa51e018c0a77138326 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 19 Aug 2021 16:33:53 -0400 Subject: [PATCH] zebra: Convert to `struct zebra_mac` as per our internal standard We do not use typedef's to talk about structures as per our standard. Fixing. Signed-off-by: Donald Sharp --- zebra/dplane_fpm_nl.c | 4 +- zebra/zebra_evpn.c | 12 ++-- zebra/zebra_evpn_mac.c | 137 ++++++++++++++++++------------------ zebra/zebra_evpn_mac.h | 55 ++++++++------- zebra/zebra_evpn_mh.c | 18 ++--- zebra/zebra_evpn_mh.h | 8 +-- zebra/zebra_evpn_neigh.c | 48 +++++++------ zebra/zebra_evpn_neigh.h | 27 +++---- zebra/zebra_fpm.c | 7 +- zebra/zebra_vxlan.c | 94 +++++++++++++------------ zebra/zebra_vxlan_private.h | 12 ++-- 11 files changed, 220 insertions(+), 202 deletions(-) diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 9abed77fa6..868456657e 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -1055,7 +1055,7 @@ struct fpm_rmac_arg { static void fpm_enqueue_rmac_table(struct hash_bucket *bucket, void *arg) { struct fpm_rmac_arg *fra = arg; - zebra_mac_t *zrmac = bucket->data; + struct zebra_mac *zrmac = bucket->data; struct zebra_if *zif = fra->zl3vni->vxlan_if->info; const struct zebra_l2info_vxlan *vxl = &zif->l2info.vxl; struct zebra_if *br_zif; @@ -1190,7 +1190,7 @@ static int fpm_rib_reset(struct thread *t) */ static void fpm_unset_rmac_table(struct hash_bucket *bucket, void *arg) { - zebra_mac_t *zrmac = bucket->data; + struct zebra_mac *zrmac = bucket->data; UNSET_FLAG(zrmac->flags, ZEBRA_MAC_FPM_SENT); } diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index d32fc1aff6..ab9dafa3cf 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -434,7 +434,7 @@ int zebra_evpn_advertise_subnet(struct zebra_evpn *zevpn, struct interface *ifp, int zebra_evpn_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, struct ethaddr *macaddr, struct ipaddr *ip) { - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; struct zebra_if *zif = NULL; struct zebra_l2info_vxlan *vxl = NULL; @@ -459,7 +459,7 @@ int zebra_evpn_gw_macip_del(struct interface *ifp, struct zebra_evpn *zevpn, struct ipaddr *ip) { zebra_neigh_t *n = NULL; - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; /* If the neigh entry is not present nothing to do*/ n = zebra_evpn_neigh_lookup(zevpn, ip); @@ -900,10 +900,10 @@ struct interface *zebra_evpn_map_to_macvlan(struct interface *br_if, */ void zebra_evpn_install_mac_hash(struct hash_bucket *bucket, void *ctxt) { - zebra_mac_t *mac; + struct zebra_mac *mac; struct mac_walk_ctx *wctx = ctxt; - mac = (zebra_mac_t *)bucket->data; + mac = (struct zebra_mac *)bucket->data; if (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)) zebra_evpn_rem_mac_install(wctx->zevpn, mac, false); @@ -1394,7 +1394,7 @@ void zebra_evpn_rem_macip_add(vni_t vni, const struct ethaddr *macaddr, { struct zebra_evpn *zevpn; struct zebra_vtep *zvtep; - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; struct interface *ifp = NULL; struct zebra_if *zif = NULL; struct zebra_vrf *zvrf; @@ -1470,7 +1470,7 @@ void zebra_evpn_rem_macip_del(vni_t vni, const struct ethaddr *macaddr, struct in_addr vtep_ip) { struct zebra_evpn *zevpn; - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; zebra_neigh_t *n = NULL; struct interface *ifp = NULL; struct zebra_if *zif = NULL; diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 67b14bf82a..8ce05ed03f 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -53,14 +53,14 @@ uint32_t num_valid_macs(struct zebra_evpn *zevpn) uint32_t num_macs = 0; struct hash *hash; struct hash_bucket *hb; - zebra_mac_t *mac; + struct zebra_mac *mac; hash = zevpn->mac_table; if (!hash) return num_macs; for (i = 0; i < hash->size; i++) { for (hb = hash->index[i]; hb; hb = hb->next) { - mac = (zebra_mac_t *)hb->data; + mac = (struct zebra_mac *)hb->data; if (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE) || CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL) || !CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO)) @@ -77,14 +77,14 @@ uint32_t num_dup_detected_macs(struct zebra_evpn *zevpn) uint32_t num_macs = 0; struct hash *hash; struct hash_bucket *hb; - zebra_mac_t *mac; + struct zebra_mac *mac; hash = zevpn->mac_table; if (!hash) return num_macs; for (i = 0; i < hash->size; i++) { for (hb = hash->index[i]; hb; hb = hb->next) { - mac = (zebra_mac_t *)hb->data; + mac = (struct zebra_mac *)hb->data; if (CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) num_macs++; } @@ -120,7 +120,7 @@ void zebra_evpn_mac_ifp_del(struct interface *ifp) } /* Unlink local mac from a destination access port */ -static void zebra_evpn_mac_ifp_unlink(zebra_mac_t *zmac) +static void zebra_evpn_mac_ifp_unlink(struct zebra_mac *zmac) { struct zebra_if *zif; struct interface *ifp = zmac->ifp; @@ -143,7 +143,8 @@ static void zebra_evpn_mac_ifp_unlink(zebra_mac_t *zmac) * local mac is associated with a zero ESI i.e. single attach or lacp-bypass * bridge port member */ -static void zebra_evpn_mac_ifp_link(zebra_mac_t *zmac, struct interface *ifp) +static void zebra_evpn_mac_ifp_link(struct zebra_mac *zmac, + struct interface *ifp) { struct zebra_if *zif; @@ -178,7 +179,7 @@ static void zebra_evpn_mac_ifp_link(zebra_mac_t *zmac, struct interface *ifp) } /* If the mac is a local mac clear links to destination access port */ -void zebra_evpn_mac_clear_fwd_info(zebra_mac_t *zmac) +void zebra_evpn_mac_clear_fwd_info(struct zebra_mac *zmac) { zebra_evpn_mac_ifp_unlink(zmac); memset(&zmac->fwd_info, 0, sizeof(zmac->fwd_info)); @@ -187,7 +188,7 @@ void zebra_evpn_mac_clear_fwd_info(zebra_mac_t *zmac) /* * Install remote MAC into the forwarding plane. */ -int zebra_evpn_rem_mac_install(struct zebra_evpn *zevpn, zebra_mac_t *mac, +int zebra_evpn_rem_mac_install(struct zebra_evpn *zevpn, struct zebra_mac *mac, bool was_static) { const struct zebra_if *zif, *br_zif; @@ -243,8 +244,8 @@ int zebra_evpn_rem_mac_install(struct zebra_evpn *zevpn, zebra_mac_t *mac, /* * Uninstall remote MAC from the forwarding plane. */ -int zebra_evpn_rem_mac_uninstall(struct zebra_evpn *zevpn, zebra_mac_t *mac, - bool force) +int zebra_evpn_rem_mac_uninstall(struct zebra_evpn *zevpn, + struct zebra_mac *mac, bool force) { const struct zebra_if *zif, *br_zif; const struct zebra_l2info_vxlan *vxl; @@ -296,7 +297,7 @@ int zebra_evpn_rem_mac_uninstall(struct zebra_evpn *zevpn, zebra_mac_t *mac, * Decrement neighbor refcount of MAC; uninstall and free it if * appropriate. */ -void zebra_evpn_deref_ip2mac(struct zebra_evpn *zevpn, zebra_mac_t *mac) +void zebra_evpn_deref_ip2mac(struct zebra_evpn *zevpn, struct zebra_mac *mac) { if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO)) return; @@ -316,7 +317,7 @@ void zebra_evpn_deref_ip2mac(struct zebra_evpn *zevpn, zebra_mac_t *mac) zebra_evpn_mac_del(zevpn, mac); } -static void zebra_evpn_mac_get_access_info(zebra_mac_t *mac, +static void zebra_evpn_mac_get_access_info(struct zebra_mac *mac, struct interface **ifpP, vlanid_t *vid) { @@ -346,7 +347,7 @@ static void zebra_evpn_mac_get_access_info(zebra_mac_t *mac, } #define MAC_BUF_SIZE 256 -static char *zebra_evpn_zebra_mac_flag_dump(struct zebra_mac_t_ *mac, char *buf, +static char *zebra_evpn_zebra_mac_flag_dump(struct zebra_mac *mac, char *buf, size_t len) { if (mac->flags == 0) { @@ -379,7 +380,7 @@ static char *zebra_evpn_zebra_mac_flag_dump(struct zebra_mac_t_ *mac, char *buf, static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) { struct zebra_vrf *zvrf = NULL; - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; struct zebra_evpn *zevpn = NULL; struct listnode *node = NULL; zebra_neigh_t *nbr = NULL; @@ -455,7 +456,7 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) } static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, - zebra_mac_t *mac, + struct zebra_mac *mac, struct in_addr vtep_ip, bool do_dad, bool *is_dup_detect, bool is_local) @@ -605,7 +606,7 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, /* * Print a specific MAC entry. */ -void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json) +void zebra_evpn_print_mac(struct zebra_mac *mac, void *ctxt, json_object *json) { struct vty *vty; zebra_neigh_t *n = NULL; @@ -827,7 +828,7 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json) } } -static char *zebra_evpn_print_mac_flags(zebra_mac_t *mac, char *flags_buf, +static char *zebra_evpn_print_mac_flags(struct zebra_mac *mac, char *flags_buf, size_t flags_buf_sz) { snprintf(flags_buf, flags_buf_sz, "%s%s%s%s", @@ -846,7 +847,7 @@ void zebra_evpn_print_mac_hash(struct hash_bucket *bucket, void *ctxt) { struct vty *vty; json_object *json_mac_hdr = NULL, *json_mac = NULL; - zebra_mac_t *mac; + struct zebra_mac *mac; char buf1[ETHER_ADDR_STRLEN]; char addr_buf[PREFIX_STRLEN]; struct mac_walk_ctx *wctx = ctxt; @@ -854,7 +855,7 @@ void zebra_evpn_print_mac_hash(struct hash_bucket *bucket, void *ctxt) vty = wctx->vty; json_mac_hdr = wctx->json; - mac = (zebra_mac_t *)bucket->data; + mac = (struct zebra_mac *)bucket->data; prefix_mac2str(&mac->macaddr, buf1, sizeof(buf1)); @@ -967,13 +968,13 @@ void zebra_evpn_print_mac_hash_detail(struct hash_bucket *bucket, void *ctxt) { struct vty *vty; json_object *json_mac_hdr = NULL; - zebra_mac_t *mac; + struct zebra_mac *mac; struct mac_walk_ctx *wctx = ctxt; char buf1[ETHER_ADDR_STRLEN]; vty = wctx->vty; json_mac_hdr = wctx->json; - mac = (zebra_mac_t *)bucket->data; + mac = (struct zebra_mac *)bucket->data; if (!mac) return; @@ -1055,7 +1056,7 @@ int zebra_evpn_macip_send_msg_to_client(vni_t vni, static unsigned int mac_hash_keymake(const void *p) { - const zebra_mac_t *pmac = p; + const struct zebra_mac *pmac = p; const void *pnt = (void *)pmac->macaddr.octet; return jhash(pnt, ETH_ALEN, 0xa5a5a55a); @@ -1066,8 +1067,8 @@ static unsigned int mac_hash_keymake(const void *p) */ static bool mac_cmp(const void *p1, const void *p2) { - const zebra_mac_t *pmac1 = p1; - const zebra_mac_t *pmac2 = p2; + const struct zebra_mac *pmac1 = p1; + const struct zebra_mac *pmac2 = p2; if (pmac1 == NULL && pmac2 == NULL) return true; @@ -1084,10 +1085,10 @@ static bool mac_cmp(const void *p1, const void *p2) */ static void *zebra_evpn_mac_alloc(void *p) { - const zebra_mac_t *tmp_mac = p; - zebra_mac_t *mac; + const struct zebra_mac *tmp_mac = p; + struct zebra_mac *mac; - mac = XCALLOC(MTYPE_MAC, sizeof(zebra_mac_t)); + mac = XCALLOC(MTYPE_MAC, sizeof(struct zebra_mac)); *mac = *tmp_mac; return ((void *)mac); @@ -1096,13 +1097,13 @@ static void *zebra_evpn_mac_alloc(void *p) /* * Add MAC entry. */ -zebra_mac_t *zebra_evpn_mac_add(struct zebra_evpn *zevpn, - const struct ethaddr *macaddr) +struct zebra_mac *zebra_evpn_mac_add(struct zebra_evpn *zevpn, + const struct ethaddr *macaddr) { - zebra_mac_t tmp_mac; - zebra_mac_t *mac = NULL; + struct zebra_mac tmp_mac; + struct zebra_mac *mac = NULL; - memset(&tmp_mac, 0, sizeof(zebra_mac_t)); + memset(&tmp_mac, 0, sizeof(struct zebra_mac)); memcpy(&tmp_mac.macaddr, macaddr, ETH_ALEN); mac = hash_get(zevpn->mac_table, &tmp_mac, zebra_evpn_mac_alloc); assert(mac); @@ -1128,9 +1129,9 @@ zebra_mac_t *zebra_evpn_mac_add(struct zebra_evpn *zevpn, /* * Delete MAC entry. */ -int zebra_evpn_mac_del(struct zebra_evpn *zevpn, zebra_mac_t *mac) +int zebra_evpn_mac_del(struct zebra_evpn *zevpn, struct zebra_mac *mac) { - zebra_mac_t *tmp_mac; + struct zebra_mac *tmp_mac; if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) { char mac_buf[MAC_BUF_SIZE]; @@ -1171,7 +1172,7 @@ int zebra_evpn_mac_del(struct zebra_evpn *zevpn, zebra_mac_t *mac) } static bool zebra_evpn_check_mac_del_from_db(struct mac_walk_ctx *wctx, - zebra_mac_t *mac) + struct zebra_mac *mac) { if ((wctx->flags & DEL_LOCAL_MAC) && (mac->flags & ZEBRA_MAC_LOCAL)) return true; @@ -1207,7 +1208,7 @@ static bool zebra_evpn_check_mac_del_from_db(struct mac_walk_ctx *wctx, static void zebra_evpn_mac_del_hash_entry(struct hash_bucket *bucket, void *arg) { struct mac_walk_ctx *wctx = arg; - zebra_mac_t *mac = bucket->data; + struct zebra_mac *mac = bucket->data; if (zebra_evpn_check_mac_del_from_db(wctx, mac)) { if (wctx->upd_client && (mac->flags & ZEBRA_MAC_LOCAL)) { @@ -1256,11 +1257,11 @@ void zebra_evpn_mac_del_all(struct zebra_evpn *zevpn, int uninstall, /* * Look up MAC hash entry. */ -zebra_mac_t *zebra_evpn_mac_lookup(struct zebra_evpn *zevpn, - const struct ethaddr *mac) +struct zebra_mac *zebra_evpn_mac_lookup(struct zebra_evpn *zevpn, + const struct ethaddr *mac) { - zebra_mac_t tmp; - zebra_mac_t *pmac; + struct zebra_mac tmp; + struct zebra_mac *pmac; memset(&tmp, 0, sizeof(tmp)); memcpy(&tmp.macaddr, mac, ETH_ALEN); @@ -1330,7 +1331,7 @@ struct hash *zebra_mac_db_create(const char *desc) } /* program sync mac flags in the dataplane */ -int zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive, +int zebra_evpn_sync_mac_dp_install(struct zebra_mac *mac, bool set_inactive, bool force_clear_static, const char *caller) { struct interface *ifp; @@ -1429,7 +1430,8 @@ int zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive, return 0; } -void zebra_evpn_mac_send_add_del_to_client(zebra_mac_t *mac, bool old_bgp_ready, +void zebra_evpn_mac_send_add_del_to_client(struct zebra_mac *mac, + bool old_bgp_ready, bool new_bgp_ready) { if (new_bgp_ready) @@ -1450,7 +1452,7 @@ void zebra_evpn_mac_send_add_del_to_client(zebra_mac_t *mac, bool old_bgp_ready, */ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) { - zebra_mac_t *mac; + struct zebra_mac *mac; bool old_bgp_ready; bool new_bgp_ready; bool old_static; @@ -1496,7 +1498,7 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) return 0; } -static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) +static inline void zebra_evpn_mac_start_hold_timer(struct zebra_mac *mac) { if (mac->hold_timer) return; @@ -1515,7 +1517,7 @@ static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) zmh_info->mac_hold_time, &mac->hold_timer); } -void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) +void zebra_evpn_mac_stop_hold_timer(struct zebra_mac *mac) { if (!mac->hold_timer) return; @@ -1534,7 +1536,7 @@ void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) THREAD_OFF(mac->hold_timer); } -void zebra_evpn_sync_mac_del(zebra_mac_t *mac) +void zebra_evpn_sync_mac_del(struct zebra_mac *mac) { bool old_static; bool new_static; @@ -1564,8 +1566,8 @@ void zebra_evpn_sync_mac_del(zebra_mac_t *mac) } static inline bool zebra_evpn_mac_is_bgp_seq_ok(struct zebra_evpn *zevpn, - zebra_mac_t *mac, uint32_t seq, - uint16_t ipa_len, + struct zebra_mac *mac, + uint32_t seq, uint16_t ipa_len, const struct ipaddr *ipaddr, bool sync) { @@ -1630,12 +1632,12 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(struct zebra_evpn *zevpn, return true; } -zebra_mac_t *zebra_evpn_proc_sync_mac_update( +struct zebra_mac *zebra_evpn_proc_sync_mac_update( struct zebra_evpn *zevpn, const struct ethaddr *macaddr, uint16_t ipa_len, const struct ipaddr *ipaddr, uint8_t flags, uint32_t seq, const esi_t *esi, struct sync_mac_ip_ctx *ctx) { - zebra_mac_t *mac; + struct zebra_mac *mac; bool inform_bgp = false; bool inform_dataplane = false; bool seq_change = false; @@ -1752,7 +1754,7 @@ zebra_mac_t *zebra_evpn_proc_sync_mac_update( if (IS_ZEBRA_DEBUG_EVPN_MH_MAC && (old_flags != new_flags)) { char mac_buf[MAC_BUF_SIZE], omac_buf[MAC_BUF_SIZE]; - struct zebra_mac_t_ omac; + struct zebra_mac omac; omac.flags = old_flags; zlog_debug( @@ -1845,7 +1847,7 @@ zebra_mac_t *zebra_evpn_proc_sync_mac_update( /* update local fowarding info. return true if a dest-ES change * is detected */ -static bool zebra_evpn_local_mac_update_fwd_info(zebra_mac_t *mac, +static bool zebra_evpn_local_mac_update_fwd_info(struct zebra_mac *mac, struct interface *ifp, vlanid_t vid) { @@ -1882,7 +1884,7 @@ static void zebra_evpn_send_mac_hash_entry_to_client(struct hash_bucket *bucket, void *arg) { struct mac_walk_ctx *wctx = arg; - zebra_mac_t *zmac = bucket->data; + struct zebra_mac *zmac = bucket->data; if (CHECK_FLAG(zmac->flags, ZEBRA_MAC_DEF_GW)) return; @@ -1908,7 +1910,7 @@ void zebra_evpn_send_mac_list_to_client(struct zebra_evpn *zevpn) &wctx); } -void zebra_evpn_rem_mac_del(struct zebra_evpn *zevpn, zebra_mac_t *mac) +void zebra_evpn_rem_mac_del(struct zebra_evpn *zevpn, struct zebra_mac *mac) { zebra_evpn_process_neigh_on_remote_mac_del(zevpn, mac); /* the remote sequence number in the auto mac entry @@ -1936,9 +1938,9 @@ void zebra_evpn_rem_mac_del(struct zebra_evpn *zevpn, zebra_mac_t *mac) /* Print Duplicate MAC */ void zebra_evpn_print_dad_mac_hash(struct hash_bucket *bucket, void *ctxt) { - zebra_mac_t *mac; + struct zebra_mac *mac; - mac = (zebra_mac_t *)bucket->data; + mac = (struct zebra_mac *)bucket->data; if (!mac) return; @@ -1950,9 +1952,9 @@ void zebra_evpn_print_dad_mac_hash(struct hash_bucket *bucket, void *ctxt) void zebra_evpn_print_dad_mac_hash_detail(struct hash_bucket *bucket, void *ctxt) { - zebra_mac_t *mac; + struct zebra_mac *mac; - mac = (zebra_mac_t *)bucket->data; + mac = (struct zebra_mac *)bucket->data; if (!mac) return; @@ -1963,8 +1965,8 @@ void zebra_evpn_print_dad_mac_hash_detail(struct hash_bucket *bucket, int zebra_evpn_mac_remote_macip_add( struct zebra_evpn *zevpn, struct zebra_vrf *zvrf, const struct ethaddr *macaddr, uint16_t ipa_len, - const struct ipaddr *ipaddr, zebra_mac_t **macp, struct in_addr vtep_ip, - uint8_t flags, uint32_t seq, const esi_t *esi) + const struct ipaddr *ipaddr, struct zebra_mac **macp, + struct in_addr vtep_ip, uint8_t flags, uint32_t seq, const esi_t *esi) { char buf1[INET6_ADDRSTRLEN]; bool sticky; @@ -1974,7 +1976,7 @@ int zebra_evpn_mac_remote_macip_add( bool is_dup_detect = false; esi_t *old_esi; bool old_static = false; - zebra_mac_t *mac; + struct zebra_mac *mac; bool old_es_present; bool new_es_present; @@ -2132,7 +2134,7 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, struct interface *ifp, const struct ethaddr *macaddr, vlanid_t vid, bool sticky, bool local_inactive, - bool dp_static, zebra_mac_t *mac) + bool dp_static, struct zebra_mac *mac) { bool mac_sticky = false; bool inform_client = false; @@ -2373,7 +2375,7 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, return 0; } -int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, zebra_mac_t *mac, +int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, struct zebra_mac *mac, bool clear_static) { bool old_bgp_ready; @@ -2450,11 +2452,12 @@ int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, zebra_mac_t *mac, } int zebra_evpn_mac_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, - const struct ipaddr *ip, zebra_mac_t **macp, + const struct ipaddr *ip, + struct zebra_mac **macp, const struct ethaddr *macaddr, vlanid_t vlan_id, bool def_gw) { - zebra_mac_t *mac; + struct zebra_mac *mac; ns_id_t local_ns_id = NS_DEFAULT; struct zebra_vrf *zvrf; @@ -2490,7 +2493,7 @@ int zebra_evpn_mac_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, void zebra_evpn_mac_svi_del(struct interface *ifp, struct zebra_evpn *zevpn) { - zebra_mac_t *mac; + struct zebra_mac *mac; struct ethaddr macaddr; bool old_bgp_ready; @@ -2513,7 +2516,7 @@ void zebra_evpn_mac_svi_del(struct interface *ifp, struct zebra_evpn *zevpn) void zebra_evpn_mac_svi_add(struct interface *ifp, struct zebra_evpn *zevpn) { - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; struct ethaddr macaddr; struct zebra_if *zif = ifp->info; bool old_bgp_ready; diff --git a/zebra/zebra_evpn_mac.h b/zebra/zebra_evpn_mac.h index 74bb5b8536..d0bb18a5fc 100644 --- a/zebra/zebra_evpn_mac.h +++ b/zebra/zebra_evpn_mac.h @@ -29,7 +29,6 @@ extern "C" { #endif -typedef struct zebra_mac_t_ zebra_mac_t; struct host_rb_entry { RB_ENTRY(host_rb_entry) hl_entry; @@ -52,7 +51,7 @@ RB_PROTOTYPE(host_rb_tree_entry, host_rb_entry, hl_entry, * information. The correct VNI will be obtained as zebra maintains * the mapping (of VLAN to VNI). */ -struct zebra_mac_t_ { +struct zebra_mac { /* MAC address. */ struct ethaddr macaddr; @@ -185,7 +184,7 @@ struct sync_mac_ip_ctx { bool mac_created; bool mac_inactive; bool mac_dp_update_deferred; - zebra_mac_t *mac; + struct zebra_mac *mac; }; /**************************** SYNC MAC handling *****************************/ @@ -194,7 +193,7 @@ struct sync_mac_ip_ctx { * peer we cannot let it age out i.e. we set the static bit * in the dataplane */ -static inline bool zebra_evpn_mac_is_static(zebra_mac_t *mac) +static inline bool zebra_evpn_mac_is_static(struct zebra_mac *mac) { return ((mac->flags & ZEBRA_MAC_ALL_PEER_FLAGS) || mac->sync_neigh_cnt); } @@ -207,15 +206,15 @@ static inline bool zebra_evpn_mac_is_ready_for_bgp(uint32_t flags) || (flags & ZEBRA_MAC_ES_PEER_ACTIVE)); } -void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac); +void zebra_evpn_mac_stop_hold_timer(struct zebra_mac *mac); -static inline void zebra_evpn_mac_clear_sync_info(zebra_mac_t *mac) +static inline void zebra_evpn_mac_clear_sync_info(struct zebra_mac *mac) { UNSET_FLAG(mac->flags, ZEBRA_MAC_ALL_PEER_FLAGS); zebra_evpn_mac_stop_hold_timer(mac); } -static inline bool zebra_evpn_mac_in_use(zebra_mac_t *mac) +static inline bool zebra_evpn_mac_in_use(struct zebra_mac *mac) { return !list_isempty(mac->neigh_list) || CHECK_FLAG(mac->flags, ZEBRA_MAC_SVI); @@ -224,27 +223,28 @@ static inline bool zebra_evpn_mac_in_use(zebra_mac_t *mac) struct hash *zebra_mac_db_create(const char *desc); uint32_t num_valid_macs(struct zebra_evpn *zevi); uint32_t num_dup_detected_macs(struct zebra_evpn *zevi); -int zebra_evpn_rem_mac_uninstall(struct zebra_evpn *zevi, zebra_mac_t *mac, +int zebra_evpn_rem_mac_uninstall(struct zebra_evpn *zevi, struct zebra_mac *mac, bool force); -int zebra_evpn_rem_mac_install(struct zebra_evpn *zevi, zebra_mac_t *mac, +int zebra_evpn_rem_mac_install(struct zebra_evpn *zevi, struct zebra_mac *mac, bool was_static); -void zebra_evpn_deref_ip2mac(struct zebra_evpn *zevi, zebra_mac_t *mac); -zebra_mac_t *zebra_evpn_mac_lookup(struct zebra_evpn *zevi, - const struct ethaddr *mac); -zebra_mac_t *zebra_evpn_mac_add(struct zebra_evpn *zevi, - const struct ethaddr *macaddr); -int zebra_evpn_mac_del(struct zebra_evpn *zevi, zebra_mac_t *mac); +void zebra_evpn_deref_ip2mac(struct zebra_evpn *zevi, struct zebra_mac *mac); +struct zebra_mac *zebra_evpn_mac_lookup(struct zebra_evpn *zevi, + const struct ethaddr *mac); +struct zebra_mac *zebra_evpn_mac_add(struct zebra_evpn *zevi, + const struct ethaddr *macaddr); +int zebra_evpn_mac_del(struct zebra_evpn *zevi, struct zebra_mac *mac); int zebra_evpn_macip_send_msg_to_client(uint32_t id, const struct ethaddr *macaddr, const struct ipaddr *ip, uint8_t flags, uint32_t seq, int state, struct zebra_evpn_es *es, uint16_t cmd); -void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json); +void zebra_evpn_print_mac(struct zebra_mac *mac, void *ctxt, json_object *json); void zebra_evpn_print_mac_hash(struct hash_bucket *bucket, void *ctxt); void zebra_evpn_print_mac_hash_detail(struct hash_bucket *bucket, void *ctxt); -int zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive, +int zebra_evpn_sync_mac_dp_install(struct zebra_mac *mac, bool set_inactive, bool force_clear_static, const char *caller); -void zebra_evpn_mac_send_add_del_to_client(zebra_mac_t *mac, bool old_bgp_ready, +void zebra_evpn_mac_send_add_del_to_client(struct zebra_mac *mac, + bool old_bgp_ready, bool new_bgp_ready); void zebra_evpn_mac_del_all(struct zebra_evpn *zevi, int uninstall, @@ -255,37 +255,38 @@ int zebra_evpn_mac_send_add_to_client(vni_t vni, const struct ethaddr *macaddr, int zebra_evpn_mac_send_del_to_client(vni_t vni, const struct ethaddr *macaddr, uint32_t flags, bool force); void zebra_evpn_send_mac_list_to_client(struct zebra_evpn *zevi); -zebra_mac_t *zebra_evpn_proc_sync_mac_update( +struct zebra_mac *zebra_evpn_proc_sync_mac_update( struct zebra_evpn *zevi, const struct ethaddr *macaddr, uint16_t ipa_len, const struct ipaddr *ipaddr, uint8_t flags, uint32_t seq, const esi_t *esi, struct sync_mac_ip_ctx *ctx); -void zebra_evpn_sync_mac_del(zebra_mac_t *mac); -void zebra_evpn_rem_mac_del(struct zebra_evpn *zevi, zebra_mac_t *mac); +void zebra_evpn_sync_mac_del(struct zebra_mac *mac); +void zebra_evpn_rem_mac_del(struct zebra_evpn *zevi, struct zebra_mac *mac); void zebra_evpn_print_dad_mac_hash(struct hash_bucket *bucket, void *ctxt); void zebra_evpn_print_dad_mac_hash_detail(struct hash_bucket *bucket, void *ctxt); int zebra_evpn_mac_remote_macip_add( struct zebra_evpn *zevpn, struct zebra_vrf *zvrf, const struct ethaddr *macaddr, uint16_t ipa_len, - const struct ipaddr *ipaddr, zebra_mac_t **macp, struct in_addr vtep_ip, - uint8_t flags, uint32_t seq, const esi_t *esi); + const struct ipaddr *ipaddr, struct zebra_mac **macp, + struct in_addr vtep_ip, uint8_t flags, uint32_t seq, const esi_t *esi); int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, struct zebra_evpn *zevpn, struct interface *ifp, const struct ethaddr *macaddr, vlanid_t vid, bool sticky, bool local_inactive, - bool dp_static, zebra_mac_t *mac); -int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, zebra_mac_t *mac, + bool dp_static, struct zebra_mac *mac); +int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, struct zebra_mac *mac, bool clear_static); int zebra_evpn_mac_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, - const struct ipaddr *ip, zebra_mac_t **macp, + const struct ipaddr *ip, + struct zebra_mac **macp, const struct ethaddr *macaddr, vlanid_t vlan_id, bool def_gw); void zebra_evpn_mac_svi_add(struct interface *ifp, struct zebra_evpn *zevpn); void zebra_evpn_mac_svi_del(struct interface *ifp, struct zebra_evpn *zevpn); void zebra_evpn_mac_ifp_del(struct interface *ifp); -void zebra_evpn_mac_clear_fwd_info(zebra_mac_t *zmac); +void zebra_evpn_mac_clear_fwd_info(struct zebra_mac *zmac); #ifdef __cplusplus } diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 088ad639c3..e03cf9db06 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -1183,7 +1183,7 @@ bool zebra_evpn_nhg_is_local_es(uint32_t nhg_id, /* update remote macs associated with the ES */ static void zebra_evpn_nhg_mac_update(struct zebra_evpn_es *es) { - zebra_mac_t *mac; + struct zebra_mac *mac; struct listnode *node; bool local_via_nw; @@ -1995,7 +1995,8 @@ static void zebra_evpn_es_setup_evis(struct zebra_evpn_es *es) } } -static void zebra_evpn_flush_local_mac(zebra_mac_t *mac, struct interface *ifp) +static void zebra_evpn_flush_local_mac(struct zebra_mac *mac, + struct interface *ifp) { struct zebra_if *zif; struct interface *br_ifp; @@ -2022,7 +2023,7 @@ static void zebra_evpn_flush_local_mac(zebra_mac_t *mac, struct interface *ifp) static void zebra_evpn_es_flush_local_macs(struct zebra_evpn_es *es, struct interface *ifp, bool add) { - zebra_mac_t *mac; + struct zebra_mac *mac; struct listnode *node; struct listnode *nnode; @@ -2508,7 +2509,7 @@ stream_failure: return; } -void zebra_evpn_es_mac_deref_entry(zebra_mac_t *mac) +void zebra_evpn_es_mac_deref_entry(struct zebra_mac *mac) { struct zebra_evpn_es *es = mac->es; @@ -2524,7 +2525,8 @@ void zebra_evpn_es_mac_deref_entry(zebra_mac_t *mac) /* Associate a MAC entry with a local or remote ES. Returns false if there * was no ES change. */ -bool zebra_evpn_es_mac_ref_entry(zebra_mac_t *mac, struct zebra_evpn_es *es) +bool zebra_evpn_es_mac_ref_entry(struct zebra_mac *mac, + struct zebra_evpn_es *es) { if (mac->es == es) return false; @@ -2542,7 +2544,7 @@ bool zebra_evpn_es_mac_ref_entry(zebra_mac_t *mac, struct zebra_evpn_es *es) return true; } -bool zebra_evpn_es_mac_ref(zebra_mac_t *mac, const esi_t *esi) +bool zebra_evpn_es_mac_ref(struct zebra_mac *mac, const esi_t *esi) { struct zebra_evpn_es *es; @@ -2681,7 +2683,7 @@ static void zebra_evpn_es_df_pref_update(struct zebra_if *zif, uint16_t df_pref) static void zebra_evpn_es_bypass_update_macs(struct zebra_evpn_es *es, struct interface *ifp, bool bypass) { - zebra_mac_t *mac; + struct zebra_mac *mac; struct listnode *node; struct listnode *nnode; struct zebra_if *zif; @@ -2856,7 +2858,7 @@ void zebra_evpn_if_es_print(struct vty *vty, json_object *json, static void zebra_evpn_local_mac_oper_state_change(struct zebra_evpn_es *es) { - zebra_mac_t *mac; + struct zebra_mac *mac; struct listnode *node; /* If fast-failover is supported by the dataplane via the use diff --git a/zebra/zebra_evpn_mh.h b/zebra/zebra_evpn_mh.h index fff7f005db..853af7c4bc 100644 --- a/zebra/zebra_evpn_mh.h +++ b/zebra/zebra_evpn_mh.h @@ -272,7 +272,7 @@ static inline bool zebra_evpn_send_to_client_ok(struct zebra_evpn *zevpn) return !!(zevpn->flags & ZEVPN_READY_FOR_BGP); } -static inline bool zebra_evpn_mac_is_es_local(zebra_mac_t *mac) +static inline bool zebra_evpn_mac_is_es_local(struct zebra_mac *mac) { return mac->es && (mac->es->flags & ZEBRA_EVPNES_LOCAL); } @@ -336,10 +336,10 @@ int zebra_evpn_remote_es_del(const esi_t *esi, struct in_addr vtep_ip); extern void zebra_evpn_es_evi_show(struct vty *vty, bool uj, int detail); extern void zebra_evpn_es_evi_show_vni(struct vty *vty, bool uj, vni_t vni, int detail); -extern void zebra_evpn_es_mac_deref_entry(zebra_mac_t *mac); -extern bool zebra_evpn_es_mac_ref_entry(zebra_mac_t *mac, +extern void zebra_evpn_es_mac_deref_entry(struct zebra_mac *mac); +extern bool zebra_evpn_es_mac_ref_entry(struct zebra_mac *mac, struct zebra_evpn_es *es); -extern bool zebra_evpn_es_mac_ref(zebra_mac_t *mac, const esi_t *esi); +extern bool zebra_evpn_es_mac_ref(struct zebra_mac *mac, const esi_t *esi); extern struct zebra_evpn_es *zebra_evpn_es_find(const esi_t *esi); extern void zebra_evpn_interface_init(void); extern int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp); diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index 41c95ae2f7..2301576df7 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -133,7 +133,7 @@ void zebra_evpn_find_neigh_addr_width(struct hash_bucket *bucket, void *ctxt) /* * Count of remote neighbors referencing this MAC. */ -int remote_neigh_count(zebra_mac_t *zmac) +int remote_neigh_count(struct zebra_mac *zmac) { zebra_neigh_t *n = NULL; struct listnode *node = NULL; @@ -205,7 +205,7 @@ static void *zebra_evpn_neigh_alloc(void *p) static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, const struct ethaddr *macaddr, - zebra_mac_t *mac, + struct zebra_mac *mac, bool send_mac_update) { bool old_static; @@ -286,8 +286,8 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, */ int zebra_evpn_neigh_send_add_to_client(vni_t vni, const struct ipaddr *ip, const struct ethaddr *macaddr, - zebra_mac_t *zmac, uint32_t neigh_flags, - uint32_t seq) + struct zebra_mac *zmac, + uint32_t neigh_flags, uint32_t seq) { uint8_t flags = 0; @@ -359,7 +359,7 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, bool new_n_static, bool defer_n_dp, bool defer_mac_dp, const char *caller) { - zebra_mac_t *mac = n->mac; + struct zebra_mac *mac = n->mac; bool old_mac_static; bool new_mac_static; @@ -467,7 +467,7 @@ static inline void zebra_evpn_neigh_start_hold_timer(zebra_neigh_t *n) static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, bool send_mac_update) { - zebra_mac_t *mac = n->mac; + struct zebra_mac *mac = n->mac; struct zebra_evpn *zevpn = n->zevpn; bool old_static; bool new_static; @@ -545,7 +545,8 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn, zebra_neigh_t *n, static zebra_neigh_t *zebra_evpn_neigh_add(struct zebra_evpn *zevpn, const struct ipaddr *ip, const struct ethaddr *mac, - zebra_mac_t *zmac, uint32_t n_flags) + struct zebra_mac *zmac, + uint32_t n_flags) { zebra_neigh_t tmp_n; zebra_neigh_t *n = NULL; @@ -621,7 +622,7 @@ zebra_evpn_proc_sync_neigh_update(struct zebra_evpn *zevpn, zebra_neigh_t *n, { struct interface *ifp = NULL; bool is_router; - zebra_mac_t *mac = ctx->mac; + struct zebra_mac *mac = ctx->mac; uint32_t tmp_seq; bool old_router = false; bool old_bgp_ready = false; @@ -914,7 +915,7 @@ zebra_neigh_t *zebra_evpn_neigh_lookup(struct zebra_evpn *zevpn, * locally or undergoing any other change (such as sequence number). */ void zebra_evpn_process_neigh_on_local_mac_change(struct zebra_evpn *zevpn, - zebra_mac_t *zmac, + struct zebra_mac *zmac, bool seq_change, bool es_change) { @@ -958,7 +959,7 @@ void zebra_evpn_process_neigh_on_local_mac_change(struct zebra_evpn *zevpn, * deleted. */ void zebra_evpn_process_neigh_on_local_mac_del(struct zebra_evpn *zevpn, - zebra_mac_t *zmac) + struct zebra_mac *zmac) { zebra_neigh_t *n = NULL; struct listnode *node = NULL; @@ -991,7 +992,7 @@ void zebra_evpn_process_neigh_on_local_mac_del(struct zebra_evpn *zevpn, * learnt. */ void zebra_evpn_process_neigh_on_remote_mac_add(struct zebra_evpn *zevpn, - zebra_mac_t *zmac) + struct zebra_mac *zmac) { zebra_neigh_t *n = NULL; struct listnode *node = NULL; @@ -1021,7 +1022,7 @@ void zebra_evpn_process_neigh_on_remote_mac_add(struct zebra_evpn *zevpn, * deleted. */ void zebra_evpn_process_neigh_on_remote_mac_del(struct zebra_evpn *zevpn, - zebra_mac_t *zmac) + struct zebra_mac *zmac) { /* NOTE: Currently a NO-OP. */ } @@ -1049,8 +1050,8 @@ static inline void zebra_evpn_local_neigh_update_log( * from MAC. */ static int zebra_evpn_ip_inherit_dad_from_mac(struct zebra_vrf *zvrf, - zebra_mac_t *old_zmac, - zebra_mac_t *new_zmac, + struct zebra_mac *old_zmac, + struct zebra_mac *new_zmac, zebra_neigh_t *nbr) { bool is_old_mac_dup = false; @@ -1263,7 +1264,7 @@ int zebra_evpn_local_neigh_update(struct zebra_evpn *zevpn, { struct zebra_vrf *zvrf; zebra_neigh_t *n = NULL; - zebra_mac_t *zmac = NULL, *old_zmac = NULL; + struct zebra_mac *zmac = NULL, *old_zmac = NULL; uint32_t old_mac_seq = 0, mac_new_seq = 0; bool upd_mac_seq = false; bool neigh_mac_change = false; @@ -1605,7 +1606,7 @@ int zebra_evpn_remote_neigh_update(struct zebra_evpn *zevpn, uint16_t state) { zebra_neigh_t *n = NULL; - zebra_mac_t *zmac = NULL; + struct zebra_mac *zmac = NULL; /* If the neighbor is unknown, there is no further action. */ n = zebra_evpn_neigh_lookup(zevpn, ip); @@ -1649,7 +1650,7 @@ zebra_evpn_send_neigh_hash_entry_to_client(struct hash_bucket *bucket, { struct mac_walk_ctx *wctx = arg; zebra_neigh_t *zn = bucket->data; - zebra_mac_t *zmac = NULL; + struct zebra_mac *zmac = NULL; if (CHECK_FLAG(zn->flags, ZEBRA_NEIGH_DEF_GW)) return; @@ -2054,12 +2055,13 @@ void zebra_evpn_print_dad_neigh_hash_detail(struct hash_bucket *bucket, void zebra_evpn_neigh_remote_macip_add(struct zebra_evpn *zevpn, struct zebra_vrf *zvrf, const struct ipaddr *ipaddr, - zebra_mac_t *mac, struct in_addr vtep_ip, - uint8_t flags, uint32_t seq) + struct zebra_mac *mac, + struct in_addr vtep_ip, uint8_t flags, + uint32_t seq) { zebra_neigh_t *n; int update_neigh = 0; - zebra_mac_t *old_mac = NULL; + struct zebra_mac *old_mac = NULL; bool old_static = false; bool do_dad = false; bool is_dup_detect = false; @@ -2187,7 +2189,7 @@ void zebra_evpn_neigh_remote_macip_add(struct zebra_evpn *zevpn, int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, struct ipaddr *ip, - zebra_mac_t *mac) + struct zebra_mac *mac) { zebra_neigh_t *n; @@ -2247,7 +2249,7 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, void zebra_evpn_neigh_remote_uninstall(struct zebra_evpn *zevpn, struct zebra_vrf *zvrf, zebra_neigh_t *n, - zebra_mac_t *mac, + struct zebra_mac *mac, const struct ipaddr *ipaddr) { if (zvrf->dad_freeze && CHECK_FLAG(n->flags, ZEBRA_NEIGH_DUPLICATE) @@ -2284,7 +2286,7 @@ void zebra_evpn_neigh_remote_uninstall(struct zebra_evpn *zevpn, int zebra_evpn_neigh_del_ip(struct zebra_evpn *zevpn, const struct ipaddr *ip) { zebra_neigh_t *n; - zebra_mac_t *zmac; + struct zebra_mac *zmac; bool old_bgp_ready; bool new_bgp_ready; struct zebra_vrf *zvrf; diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h index e36ec98a0e..2af24fddb7 100644 --- a/zebra/zebra_evpn_neigh.h +++ b/zebra/zebra_evpn_neigh.h @@ -58,7 +58,7 @@ struct zebra_neigh_t_ { struct ethaddr emac; /* Back pointer to MAC. Only applicable to hosts in a L2-VNI. */ - zebra_mac_t *mac; + struct zebra_mac *mac; /* Underlying interface. */ ifindex_t ifindex; @@ -207,20 +207,20 @@ static inline bool zebra_evpn_neigh_clear_sync_info(zebra_neigh_t *n) return old_n_static != new_n_static; } -int remote_neigh_count(zebra_mac_t *zmac); +int remote_neigh_count(struct zebra_mac *zmac); int neigh_list_cmp(void *p1, void *p2); struct hash *zebra_neigh_db_create(const char *desc); uint32_t num_dup_detected_neighs(struct zebra_evpn *zevpn); void zebra_evpn_find_neigh_addr_width(struct hash_bucket *bucket, void *ctxt); -int remote_neigh_count(zebra_mac_t *zmac); +int remote_neigh_count(struct zebra_mac *zmac); int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, zebra_neigh_t *n, bool was_static); void zebra_evpn_install_neigh_hash(struct hash_bucket *bucket, void *ctxt); int zebra_evpn_neigh_send_add_to_client(vni_t vni, const struct ipaddr *ip, const struct ethaddr *macaddr, - zebra_mac_t *zmac, uint32_t neigh_flags, - uint32_t seq); + struct zebra_mac *zmac, + uint32_t neigh_flags, uint32_t seq); int zebra_evpn_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip, struct ethaddr *macaddr, uint32_t flags, int state, bool force); @@ -242,15 +242,15 @@ zebra_neigh_t *zebra_evpn_neigh_lookup(struct zebra_evpn *zevpn, int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, zebra_neigh_t *n, bool was_static); void zebra_evpn_process_neigh_on_remote_mac_add(struct zebra_evpn *zevpn, - zebra_mac_t *zmac); + struct zebra_mac *zmac); void zebra_evpn_process_neigh_on_local_mac_del(struct zebra_evpn *zevpn, - zebra_mac_t *zmac); + struct zebra_mac *zmac); void zebra_evpn_process_neigh_on_local_mac_change(struct zebra_evpn *zevpn, - zebra_mac_t *zmac, + struct zebra_mac *zmac, bool seq_change, bool es_change); void zebra_evpn_process_neigh_on_remote_mac_del(struct zebra_evpn *zevpn, - zebra_mac_t *zmac); + struct zebra_mac *zmac); int zebra_evpn_local_neigh_update(struct zebra_evpn *zevpn, struct interface *ifp, const struct ipaddr *ip, @@ -273,14 +273,15 @@ void zebra_evpn_print_dad_neigh_hash_detail(struct hash_bucket *bucket, void zebra_evpn_neigh_remote_macip_add(struct zebra_evpn *zevpn, struct zebra_vrf *zvrf, const struct ipaddr *ipaddr, - zebra_mac_t *mac, struct in_addr vtep_ip, - uint8_t flags, uint32_t seq); + struct zebra_mac *mac, + struct in_addr vtep_ip, uint8_t flags, + uint32_t seq); int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, struct ipaddr *ip, - zebra_mac_t *mac); + struct zebra_mac *mac); void zebra_evpn_neigh_remote_uninstall(struct zebra_evpn *zevpn, struct zebra_vrf *zvrf, zebra_neigh_t *n, - zebra_mac_t *mac, + struct zebra_mac *mac, const struct ipaddr *ipaddr); int zebra_evpn_neigh_del_ip(struct zebra_evpn *zevpn, const struct ipaddr *ip); diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 855e19dc45..bc0a8da434 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1553,8 +1553,9 @@ static void zfpm_mac_info_del(struct fpm_mac_info_t *fpm_mac) * This function checks if we already have enqueued an update for this RMAC, * If yes, update the same fpm_mac_info_t. Else, create and enqueue an update. */ -static int zfpm_trigger_rmac_update(zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, - bool delete, const char *reason) +static int zfpm_trigger_rmac_update(struct zebra_mac *rmac, + zebra_l3vni_t *zl3vni, bool delete, + const char *reason) { struct fpm_mac_info_t *fpm_mac, key; struct interface *vxlan_if, *svi_if; @@ -1637,7 +1638,7 @@ static int zfpm_trigger_rmac_update(zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, static void zfpm_trigger_rmac_update_wrapper(struct hash_bucket *bucket, void *args) { - zebra_mac_t *zrmac = (zebra_mac_t *)bucket->data; + struct zebra_mac *zrmac = (struct zebra_mac *)bucket->data; zebra_l3vni_t *zl3vni = (zebra_l3vni_t *)args; zfpm_trigger_rmac_update(zrmac, zl3vni, false, "RMAC added"); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index d2cb8da9aa..9eb1ebb440 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -63,15 +63,17 @@ DEFINE_MTYPE_STATIC(ZEBRA, L3VNI_MAC, "EVPN L3VNI MAC"); DEFINE_MTYPE_STATIC(ZEBRA, L3NEIGH, "EVPN Neighbor"); DEFINE_MTYPE_STATIC(ZEBRA, ZVXLAN_SG, "zebra VxLAN multicast group"); -DEFINE_HOOK(zebra_rmac_update, (zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, - bool delete, const char *reason), (rmac, zl3vni, delete, reason)); +DEFINE_HOOK(zebra_rmac_update, + (struct zebra_mac * rmac, zebra_l3vni_t *zl3vni, bool delete, + const char *reason), + (rmac, zl3vni, delete, reason)); /* static function declarations */ static void zevpn_print_neigh_hash_all_evpn(struct hash_bucket *bucket, void **args); static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty, json_object *json); -static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty, +static void zl3vni_print_rmac(struct zebra_mac *zrmac, struct vty *vty, json_object *json); static void zevpn_print_mac_hash_all_evpn(struct hash_bucket *bucket, void *ctxt); @@ -88,14 +90,15 @@ static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n); /* l3-vni rmac related APIs */ static void zl3vni_print_rmac_hash(struct hash_bucket *, void *); -static zebra_mac_t *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, - const struct ethaddr *rmac); +static struct zebra_mac *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, + const struct ethaddr *rmac); static void *zl3vni_rmac_alloc(void *p); -static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, - const struct ethaddr *rmac); -static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac); -static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac); -static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac); +static struct zebra_mac *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, + const struct ethaddr *rmac); +static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, struct zebra_mac *zrmac); +static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, struct zebra_mac *zrmac); +static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, + struct zebra_mac *zrmac); /* l3-vni related APIs*/ static void *zl3vni_alloc(void *p); @@ -357,7 +360,7 @@ static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty, } /* Print a specific RMAC entry */ -static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty, +static void zl3vni_print_rmac(struct zebra_mac *zrmac, struct vty *vty, json_object *json) { char buf1[ETHER_ADDR_STRLEN]; @@ -652,7 +655,7 @@ static void zl3vni_print_rmac_hash_all_vni(struct hash_bucket *bucket, static void zl3vni_print_rmac_hash(struct hash_bucket *bucket, void *ctx) { - zebra_mac_t *zrmac = NULL; + struct zebra_mac *zrmac = NULL; struct rmac_walk_ctx *wctx = NULL; struct vty *vty = NULL; struct json_object *json = NULL; @@ -664,7 +667,7 @@ static void zl3vni_print_rmac_hash(struct hash_bucket *bucket, void *ctx) json = wctx->json; if (json) json_rmac = json_object_new_object(); - zrmac = (zebra_mac_t *)bucket->data; + zrmac = (struct zebra_mac *)bucket->data; if (!json) { vty_out(vty, "%-17s %-21pI4\n", @@ -1132,11 +1135,11 @@ static void rb_delete_host(struct host_rb_tree_entry *hrbe, struct prefix *host) /* * Look up MAC hash entry. */ -static zebra_mac_t *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, - const struct ethaddr *rmac) +static struct zebra_mac *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, + const struct ethaddr *rmac) { - zebra_mac_t tmp; - zebra_mac_t *pmac; + struct zebra_mac tmp; + struct zebra_mac *pmac; memset(&tmp, 0, sizeof(tmp)); memcpy(&tmp.macaddr, rmac, ETH_ALEN); @@ -1150,10 +1153,10 @@ static zebra_mac_t *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, */ static void *zl3vni_rmac_alloc(void *p) { - const zebra_mac_t *tmp_rmac = p; - zebra_mac_t *zrmac; + const struct zebra_mac *tmp_rmac = p; + struct zebra_mac *zrmac; - zrmac = XCALLOC(MTYPE_L3VNI_MAC, sizeof(zebra_mac_t)); + zrmac = XCALLOC(MTYPE_L3VNI_MAC, sizeof(struct zebra_mac)); *zrmac = *tmp_rmac; return ((void *)zrmac); @@ -1162,13 +1165,13 @@ static void *zl3vni_rmac_alloc(void *p) /* * Add RMAC entry to l3-vni */ -static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, - const struct ethaddr *rmac) +static struct zebra_mac *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, + const struct ethaddr *rmac) { - zebra_mac_t tmp_rmac; - zebra_mac_t *zrmac = NULL; + struct zebra_mac tmp_rmac; + struct zebra_mac *zrmac = NULL; - memset(&tmp_rmac, 0, sizeof(zebra_mac_t)); + memset(&tmp_rmac, 0, sizeof(struct zebra_mac)); memcpy(&tmp_rmac.macaddr, rmac, ETH_ALEN); zrmac = hash_get(zl3vni->rmac_table, &tmp_rmac, zl3vni_rmac_alloc); assert(zrmac); @@ -1184,9 +1187,9 @@ static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, /* * Delete MAC entry. */ -static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) +static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, struct zebra_mac *zrmac) { - zebra_mac_t *tmp_rmac; + struct zebra_mac *tmp_rmac; struct host_rb_entry *hle; while (!RB_EMPTY(host_rb_tree_entry, &zrmac->host_rb)) { @@ -1205,7 +1208,7 @@ static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) /* * Install remote RMAC into the forwarding plane. */ -static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) +static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, struct zebra_mac *zrmac) { const struct zebra_if *zif = NULL, *br_zif = NULL; const struct zebra_l2info_vxlan *vxl = NULL; @@ -1246,7 +1249,7 @@ static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) /* * Uninstall remote RMAC from the forwarding plane. */ -static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) +static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, struct zebra_mac *zrmac) { const struct zebra_if *zif = NULL, *br_zif; const struct zebra_l2info_vxlan *vxl = NULL; @@ -1296,7 +1299,7 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, const struct ipaddr *vtep_ip, const struct prefix *host_prefix) { - zebra_mac_t *zrmac = NULL; + struct zebra_mac *zrmac = NULL; zrmac = zl3vni_rmac_lookup(zl3vni, rmac); if (!zrmac) { @@ -1339,8 +1342,9 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, /* handle rmac delete */ -static void zl3vni_remote_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac, - struct prefix *host_prefix) +static void zl3vni_remote_rmac_del(zebra_l3vni_t *zl3vni, + struct zebra_mac *zrmac, + struct prefix *host_prefix) { rb_delete_host(&zrmac->host_rb, host_prefix); @@ -2129,10 +2133,10 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, /* delete and uninstall rmac hash entry */ static void zl3vni_del_rmac_hash_entry(struct hash_bucket *bucket, void *ctx) { - zebra_mac_t *zrmac = NULL; + struct zebra_mac *zrmac = NULL; zebra_l3vni_t *zl3vni = NULL; - zrmac = (zebra_mac_t *)bucket->data; + zrmac = (struct zebra_mac *)bucket->data; zl3vni = (zebra_l3vni_t *)ctx; zl3vni_rmac_uninstall(zl3vni, zrmac); @@ -2158,7 +2162,7 @@ static void zl3vni_del_nh_hash_entry(struct hash_bucket *bucket, void *ctx) static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni, struct ethaddr *rmac) { - zebra_mac_t *zrmac = NULL; + struct zebra_mac *zrmac = NULL; zrmac = zl3vni_rmac_lookup(zl3vni, rmac); if (!zrmac) @@ -2231,7 +2235,7 @@ void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id, { zebra_l3vni_t *zl3vni = NULL; zebra_neigh_t *nh = NULL; - zebra_mac_t *zrmac = NULL; + struct zebra_mac *zrmac = NULL; zl3vni = zl3vni_from_vrf(vrf_id); if (!zl3vni) @@ -2256,7 +2260,7 @@ void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni, struct ethaddr *rmac, bool use_json) { zebra_l3vni_t *zl3vni = NULL; - zebra_mac_t *zrmac = NULL; + struct zebra_mac *zrmac = NULL; json_object *json = NULL; if (!is_evpn_enabled()) { @@ -2988,7 +2992,7 @@ void zebra_vxlan_print_specific_mac_vni(struct vty *vty, struct zebra_vrf *zvrf, bool use_json) { struct zebra_evpn *zevpn; - zebra_mac_t *mac; + struct zebra_mac *mac; json_object *json = NULL; if (!is_evpn_enabled()) @@ -3087,7 +3091,7 @@ int zebra_vxlan_clear_dup_detect_vni_mac(struct zebra_vrf *zvrf, vni_t vni, size_t errmsg_len) { struct zebra_evpn *zevpn; - zebra_mac_t *mac; + struct zebra_mac *mac; struct listnode *node = NULL; zebra_neigh_t *nbr = NULL; @@ -3176,7 +3180,7 @@ int zebra_vxlan_clear_dup_detect_vni_ip(struct zebra_vrf *zvrf, vni_t vni, { struct zebra_evpn *zevpn; zebra_neigh_t *nbr; - zebra_mac_t *mac; + struct zebra_mac *mac; char buf[INET6_ADDRSTRLEN]; char buf2[ETHER_ADDR_STRLEN]; @@ -3240,12 +3244,12 @@ int zebra_vxlan_clear_dup_detect_vni_ip(struct zebra_vrf *zvrf, vni_t vni, static void zevpn_clear_dup_mac_hash(struct hash_bucket *bucket, void *ctxt) { struct mac_walk_ctx *wctx = ctxt; - zebra_mac_t *mac; + struct zebra_mac *mac; struct zebra_evpn *zevpn; struct listnode *node = NULL; zebra_neigh_t *nbr = NULL; - mac = (zebra_mac_t *)bucket->data; + mac = (struct zebra_mac *)bucket->data; if (!mac) return; @@ -3987,7 +3991,7 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, struct zebra_l2info_vxlan *vxl; vni_t vni; struct zebra_evpn *zevpn; - zebra_mac_t *mac; + struct zebra_mac *mac; zif = ifp->info; assert(zif); @@ -4084,7 +4088,7 @@ int zebra_vxlan_dp_network_mac_del(struct interface *ifp, vni_t vni; struct zebra_evpn *zevpn = NULL; zebra_l3vni_t *zl3vni = NULL; - zebra_mac_t *mac = NULL; + struct zebra_mac *mac = NULL; zif = ifp->info; assert(zif); @@ -4139,7 +4143,7 @@ int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, vlanid_t vid) { struct zebra_evpn *zevpn; - zebra_mac_t *mac; + struct zebra_mac *mac; /* We are interested in MACs only on ports or (port, VLAN) that * map to a VNI. diff --git a/zebra/zebra_vxlan_private.h b/zebra/zebra_vxlan_private.h index 6deaef2af7..fa47185402 100644 --- a/zebra/zebra_vxlan_private.h +++ b/zebra/zebra_vxlan_private.h @@ -226,8 +226,10 @@ extern struct interface *zl3vni_map_to_mac_vlan_if(zebra_l3vni_t *zl3vni); extern zebra_l3vni_t *zl3vni_lookup(vni_t vni); extern vni_t vni_id_from_svi(struct interface *ifp, struct interface *br_if); -DECLARE_HOOK(zebra_rmac_update, (zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, - bool delete, const char *reason), (rmac, zl3vni, delete, reason)); +DECLARE_HOOK(zebra_rmac_update, + (struct zebra_mac * rmac, zebra_l3vni_t *zl3vni, bool delete, + const char *reason), + (rmac, zl3vni, delete, reason)); #ifdef __cplusplus @@ -257,8 +259,10 @@ typedef struct zebra_vxlan_sg_ { } zebra_vxlan_sg_t; extern struct zebra_evpn *zevpn_lookup(vni_t vni); -extern void zebra_vxlan_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive, - bool force_clear_static, const char *caller); +extern void zebra_vxlan_sync_mac_dp_install(struct zebra_mac *mac, + bool set_inactive, + bool force_clear_static, + const char *caller); extern bool zebra_evpn_do_dup_addr_detect(struct zebra_vrf *zvrf); #endif /* _ZEBRA_VXLAN_PRIVATE_H */ -- 2.39.5