diff options
author | Sharath Ramamurthy <sramamurthy@nvidia.com> | 2021-07-27 09:47:52 +0200 |
---|---|---|
committer | Stephen Worley <sworley@nvidia.com> | 2023-02-14 00:12:04 +0100 |
commit | 784d88aa14c115411ed21f6ac518ab1a8f9d27b7 (patch) | |
tree | 86c103be00f0442b205027ca2cc2f852275eac94 /zebra/zebra_vxlan.c | |
parent | zebra: data structure changes for single vxlan device (diff) | |
download | frr-784d88aa14c115411ed21f6ac518ab1a8f9d27b7.tar.xz frr-784d88aa14c115411ed21f6ac518ab1a8f9d27b7.zip |
zebra: multiple vlan aware bridge datastructure changes and vxlan device iftype derivation from netlink
This change set introduces data structure changes required for multiple vlan aware bridge
functionality. A new structure zebra_l2_bridge_if encapsulates the vlan to access_bd
association of the bridge. A vlan_table hash_table is used to record each instance
of the vlan to access_bd of the bridge via zebra_l2_bridge_vlan structure.
vxlan iftype derivation: netlink attribute IFLA_VXLAN_COLLECT_METADATA is used
to derive the iftype of the vxlan device. If the attribute is present, then the
vxlan interface is treated as single vxlan device, otherwise it would default to
traditional vxlan device.
zebra_vxlan_check_readd_vtep, zebra_vxlan_dp_network_mac_add/del is modified to
be vni aware.
mac_fdb_read_for_bridge - is modified to be (vlan, bridge) aware
Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
Diffstat (limited to 'zebra/zebra_vxlan.c')
-rw-r--r-- | zebra/zebra_vxlan.c | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 3e7f56680..0df43982e 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -110,8 +110,6 @@ static int zl3vni_rmac_uninstall(struct zebra_l3vni *zl3vni, static void *zl3vni_alloc(void *p); static struct zebra_l3vni *zl3vni_add(vni_t vni, vrf_id_t vrf_id); static int zl3vni_del(struct zebra_l3vni *zl3vni); -static void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni); -static void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni); static void zevpn_build_hash_table(void); static unsigned int zebra_vxlan_sg_hash_key_make(const void *p); @@ -121,10 +119,6 @@ static void zebra_vxlan_sg_do_deref(struct zebra_vrf *zvrf, static struct zebra_vxlan_sg *zebra_vxlan_sg_do_ref(struct zebra_vrf *vrf, struct in_addr sip, struct in_addr mcast_grp); -static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp); -static void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp); static void zebra_vxlan_cleanup_sg_table(struct zebra_vrf *zvrf); bool zebra_evpn_do_dup_addr_detect(struct zebra_vrf *zvrf) @@ -889,7 +883,6 @@ struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if) { struct interface *tmp_if = NULL; struct zebra_if *zif; - struct zebra_l2info_bridge *br; struct zebra_from_svi_param in_param; struct interface **p_ifp; /* Defensive check, caller expected to invoke only with valid bridge. */ @@ -899,8 +892,7 @@ struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if) /* Determine if bridge is VLAN-aware or not */ zif = br_if->info; assert(zif); - br = &zif->l2info.br; - in_param.bridge_vlan_aware = br->vlan_aware; + in_param.bridge_vlan_aware = IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif); /* Check oper status of the SVI. */ if (!in_param.bridge_vlan_aware) return if_is_operative(br_if) ? br_if : NULL; @@ -1904,7 +1896,6 @@ static struct zebra_l3vni *zl3vni_from_svi(struct interface *ifp, { struct zebra_l3vni *zl3vni = NULL; struct zebra_if *zif = NULL; - struct zebra_l2info_bridge *br = NULL; struct zebra_from_svi_param in_param = {}; struct zebra_l3vni **p_zl3vni; @@ -1919,8 +1910,7 @@ static struct zebra_l3vni *zl3vni_from_svi(struct interface *ifp, /* Determine if bridge is VLAN-aware or not */ zif = br_if->info; assert(zif); - br = &zif->l2info.br; - in_param.bridge_vlan_aware = br->vlan_aware; + in_param.bridge_vlan_aware = IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif); if (in_param.bridge_vlan_aware) { struct zebra_l2info_vlan *vl; @@ -2067,7 +2057,7 @@ static int zl3vni_send_del_to_client(struct zebra_l3vni *zl3vni) return zserv_send_message(client, s); } -static void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni) +void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni) { if (!zl3vni) return; @@ -2076,7 +2066,7 @@ static void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni) zl3vni_send_add_to_client(zl3vni); } -static void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni) +void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni) { if (!zl3vni) return; @@ -3961,20 +3951,17 @@ stream_failure: /* * Handle remote vtep delete by kernel; re-add the vtep if we have it */ -int zebra_vxlan_check_readd_vtep(struct interface *ifp, +int zebra_vxlan_check_readd_vtep(struct interface *ifp, vni_t vni, struct in_addr vtep_ip) { struct zebra_if *zif; struct zebra_vrf *zvrf = NULL; - struct zebra_l2info_vxlan *vxl; - vni_t vni; struct zebra_evpn *zevpn = NULL; struct zebra_vtep *zvtep = NULL; + struct zebra_vxlan_vni *vnip; zif = ifp->info; assert(zif); - vxl = &zif->l2info.vxl; - vni = vxl->vni_info.vni.vni; /* If EVPN is not enabled, nothing to do. */ if (!is_evpn_enabled()) @@ -3985,6 +3972,10 @@ int zebra_vxlan_check_readd_vtep(struct interface *ifp, if (!zvrf) return -1; + vnip = zebra_vxlan_if_vni_find(zif, vni); + if (!vnip) + return 0; + /* Locate hash entry; it is expected to exist. */ zevpn = zebra_evpn_lookup(vni); if (!zevpn) @@ -4012,18 +4003,14 @@ int zebra_vxlan_check_readd_vtep(struct interface *ifp, static int zebra_vxlan_check_del_local_mac(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, - vlanid_t vid) + vlanid_t vid, vni_t vni) { struct zebra_if *zif; - struct zebra_l2info_vxlan *vxl; - vni_t vni; struct zebra_evpn *zevpn; struct zebra_mac *mac; zif = ifp->info; assert(zif); - vxl = &zif->l2info.vxl; - vni = vxl->vni_info.vni.vni; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -4075,7 +4062,8 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, int zebra_vxlan_dp_network_mac_add(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, vlanid_t vid, - uint32_t nhg_id, bool sticky, bool dp_static) + vni_t vni, uint32_t nhg_id, bool sticky, + bool dp_static) { struct zebra_evpn_es *es; struct interface *acc_ifp; @@ -4099,8 +4087,8 @@ int zebra_vxlan_dp_network_mac_add(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) zlog_debug("dpAdd remote MAC %pEA VID %u", macaddr, vid); - return zebra_vxlan_check_del_local_mac(ifp, br_if, macaddr, - vid); + return zebra_vxlan_check_del_local_mac(ifp, br_if, macaddr, vid, + vni); } /* If local MAC on a down local ES translate the network-mac-add @@ -4121,19 +4109,16 @@ int zebra_vxlan_dp_network_mac_add(struct interface *ifp, */ int zebra_vxlan_dp_network_mac_del(struct interface *ifp, struct interface *br_if, - struct ethaddr *macaddr, vlanid_t vid) + struct ethaddr *macaddr, vlanid_t vid, + vni_t vni) { struct zebra_if *zif = NULL; - struct zebra_l2info_vxlan *vxl = NULL; - vni_t vni; struct zebra_evpn *zevpn = NULL; struct zebra_l3vni *zl3vni = NULL; struct zebra_mac *mac = NULL; zif = ifp->info; assert(zif); - vxl = &zif->l2info.vxl; - vni = vxl->vni_info.vni.vni; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -6157,8 +6142,8 @@ static struct zebra_vxlan_sg *zebra_vxlan_sg_do_ref(struct zebra_vrf *zvrf, return vxlan_sg; } -static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp) +void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, + struct in_addr mcast_grp) { struct zebra_vrf *zvrf; @@ -6173,8 +6158,7 @@ static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, zebra_vxlan_sg_do_deref(zvrf, local_vtep_ip, mcast_grp); } -static void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp) +void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, struct in_addr mcast_grp) { struct zebra_vrf *zvrf; |