summaryrefslogtreecommitdiff
path: root/zebra/if_netlink.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@nvidia.com>2022-02-15 18:21:18 -0500
committerStephen Worley <sworley@nvidia.com>2022-03-09 18:02:44 -0500
commit7140b00cb0c0f9e9f007f092890f04166a9a66f8 (patch)
treefe1a6c80ae26474ae22234ce09ef9f8c49ac8a2c /zebra/if_netlink.c
parent26a64ff9ca7b8afdd5ab9b9bc8a59f3ea9dbc53b (diff)
zebra: use SET/UNSET/CHECK/COND in protodown code
Use the SET/UNSET/CHECK/COND macros for flag bifields where appropriate throught the protodown code base. Signed-off-by: Stephen Worley <sworley@nvidia.com>
Diffstat (limited to 'zebra/if_netlink.c')
-rw-r--r--zebra/if_netlink.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 0ed03ae750..e21ff533ec 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -852,11 +852,10 @@ static void netlink_proc_dplane_if_protodown(struct zebra_if *zif,
* If the reason we got from the kernel is ONLY frr though, don't
* set it.
*/
- if (protodown && rc_bitfield &&
- is_if_protodown_reason_only_frr(rc_bitfield) == false)
- zif->protodown_rc |= ZEBRA_PROTODOWN_EXTERNAL;
- else
- zif->protodown_rc &= ~ZEBRA_PROTODOWN_EXTERNAL;
+ COND_FLAG(zif->protodown_rc, ZEBRA_PROTODOWN_EXTERNAL,
+ protodown && rc_bitfield &&
+ !is_if_protodown_reason_only_frr(rc_bitfield));
+
old_protodown = !!ZEBRA_IF_IS_PROTODOWN(zif);
if (protodown == old_protodown)
@@ -866,17 +865,16 @@ static void netlink_proc_dplane_if_protodown(struct zebra_if *zif,
zlog_debug("interface %s dplane change, protdown %s",
zif->ifp->name, protodown ? "on" : "off");
- if (protodown)
- zif->flags |= ZIF_FLAG_PROTODOWN;
- else
- zif->flags &= ~ZIF_FLAG_PROTODOWN;
+ /* Set protodown, respectively */
+ COND_FLAG(zif->flags, ZIF_FLAG_PROTODOWN, protodown);
if (zebra_evpn_is_es_bond_member(zif->ifp)) {
/* Check it's not already being sent to the dplane first */
- if (protodown && (zif->flags & ZIF_FLAG_SET_PROTODOWN))
+ if (protodown && CHECK_FLAG(zif->flags, ZIF_FLAG_SET_PROTODOWN))
return;
- if (!protodown && (zif->flags & ZIF_FLAG_UNSET_PROTODOWN))
+ if (!protodown
+ && CHECK_FLAG(zif->flags, ZIF_FLAG_UNSET_PROTODOWN))
return;
if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL)
@@ -885,9 +883,9 @@ static void netlink_proc_dplane_if_protodown(struct zebra_if *zif,
zif->ifp->name, old_protodown ? "on" : "off");
if (old_protodown)
- zif->flags |= ZIF_FLAG_SET_PROTODOWN;
+ SET_FLAG(zif->flags, ZIF_FLAG_SET_PROTODOWN);
else
- zif->flags |= ZIF_FLAG_UNSET_PROTODOWN;
+ SET_FLAG(zif->flags, ZIF_FLAG_UNSET_PROTODOWN);
dplane_intf_update(zif->ifp);
}
@@ -926,7 +924,7 @@ static void if_sweep_protodown(struct zebra_if *zif)
zif->protodown_rc);
/* Only clear our reason codes, leave external if it was set */
- zif->protodown_rc &= ~ZEBRA_PROTODOWN_ALL;
+ UNSET_FLAG(zif->protodown_rc, ZEBRA_PROTODOWN_ALL);
dplane_intf_update(zif->ifp);
}