zebra: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
This commit is contained in:
sri-mohan1 2024-05-19 14:40:55 +05:30
parent 659741f3fa
commit c2f2dde5c1

View File

@ -208,13 +208,13 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
chgflags); chgflags);
/* Removed from bridge? Cleanup and return */ /* Removed from bridge? Cleanup and return */
if ((chgflags & ZEBRA_VXLIF_MASTER_CHANGE) && if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE) &&
(zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) { (zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) {
zebra_vxlan_process_l3vni_oper_down(zl3vni); zebra_vxlan_process_l3vni_oper_down(zl3vni);
return 0; return 0;
} }
if ((chgflags & ZEBRA_VXLIF_MASTER_MAC_CHANGE) && if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_MAC_CHANGE) &&
if_is_operative(ifp) && is_l3vni_oper_up(zl3vni)) { if_is_operative(ifp) && is_l3vni_oper_up(zl3vni)) {
zebra_vxlan_process_l3vni_oper_down(zl3vni); zebra_vxlan_process_l3vni_oper_down(zl3vni);
zebra_vxlan_process_l3vni_oper_up(zl3vni); zebra_vxlan_process_l3vni_oper_up(zl3vni);
@ -224,7 +224,7 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
/* access-vlan change - process oper down, associate with new /* access-vlan change - process oper down, associate with new
* svi_if and then process oper up again * svi_if and then process oper up again
*/ */
if (chgflags & ZEBRA_VXLIF_VLAN_CHANGE) { if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_VLAN_CHANGE)) {
if (if_is_operative(ifp)) { if (if_is_operative(ifp)) {
zebra_vxlan_process_l3vni_oper_down(zl3vni); zebra_vxlan_process_l3vni_oper_down(zl3vni);
zl3vni->svi_if = NULL; zl3vni->svi_if = NULL;
@ -242,7 +242,7 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
* local-ip change - process oper down, associate with new * local-ip change - process oper down, associate with new
* local-ip and then process oper up again * local-ip and then process oper up again
*/ */
if (chgflags & ZEBRA_VXLIF_LOCAL_IP_CHANGE) { if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_LOCAL_IP_CHANGE)) {
if (if_is_operative(ifp)) { if (if_is_operative(ifp)) {
zebra_vxlan_process_l3vni_oper_down(zl3vni); zebra_vxlan_process_l3vni_oper_down(zl3vni);
zl3vni->local_vtep_ip = vxl->vtep_ip; zl3vni->local_vtep_ip = vxl->vtep_ip;
@ -262,7 +262,7 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
zl3vni_bridge_if_set(zl3vni, br_if, true /* set */); zl3vni_bridge_if_set(zl3vni, br_if, true /* set */);
/* if we have a valid new master, process l3-vni oper up */ /* if we have a valid new master, process l3-vni oper up */
if (chgflags & ZEBRA_VXLIF_MASTER_CHANGE) { if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE)) {
if (if_is_operative(ifp) && is_l3vni_oper_up(zl3vni)) if (if_is_operative(ifp) && is_l3vni_oper_up(zl3vni))
zebra_vxlan_process_l3vni_oper_up(zl3vni); zebra_vxlan_process_l3vni_oper_up(zl3vni);
} }
@ -285,7 +285,7 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
chgflags); chgflags);
/* Removed from bridge? Cleanup and return */ /* Removed from bridge? Cleanup and return */
if ((chgflags & ZEBRA_VXLIF_MASTER_CHANGE) && if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE) &&
(zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) { (zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) {
/* Delete from client, remove all remote VTEPs */ /* Delete from client, remove all remote VTEPs */
/* Also, free up all MACs and neighbors. */ /* Also, free up all MACs and neighbors. */
@ -298,7 +298,7 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
} }
/* Handle other changes. */ /* Handle other changes. */
if (chgflags & ZEBRA_VXLIF_VLAN_CHANGE) { if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_VLAN_CHANGE)) {
/* Remove all existing local neigh and MACs for this VNI /* Remove all existing local neigh and MACs for this VNI
* (including from BGP) * (including from BGP)
*/ */
@ -341,9 +341,10 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
return 0; return 0;
/* Inform BGP, if there is a change of interest. */ /* Inform BGP, if there is a change of interest. */
if (chgflags & if (CHECK_FLAG(chgflags, (ZEBRA_VXLIF_MASTER_CHANGE |
(ZEBRA_VXLIF_MASTER_CHANGE | ZEBRA_VXLIF_LOCAL_IP_CHANGE | ZEBRA_VXLIF_LOCAL_IP_CHANGE |
ZEBRA_VXLIF_MCAST_GRP_CHANGE | ZEBRA_VXLIF_VLAN_CHANGE)) ZEBRA_VXLIF_MCAST_GRP_CHANGE |
ZEBRA_VXLIF_VLAN_CHANGE)))
zebra_evpn_send_add_to_client(zevpn); zebra_evpn_send_add_to_client(zevpn);
/* If there is a valid new master or a VLAN mapping change, /* If there is a valid new master or a VLAN mapping change,
@ -351,9 +352,9 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp,
* Also, reinstall any remote MACs and neighbors * Also, reinstall any remote MACs and neighbors
* for this VNI (based on new VLAN). * for this VNI (based on new VLAN).
*/ */
if (chgflags & ZEBRA_VXLIF_MASTER_CHANGE) if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE))
zebra_evpn_read_mac_neigh(zevpn, ifp); zebra_evpn_read_mac_neigh(zevpn, ifp);
else if (chgflags & ZEBRA_VXLIF_VLAN_CHANGE) { else if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_VLAN_CHANGE)) {
struct neigh_walk_ctx n_wctx; struct neigh_walk_ctx n_wctx;
zebra_evpn_read_mac_neigh(zevpn, ifp); zebra_evpn_read_mac_neigh(zevpn, ifp);