diff options
| author | Stephen Worley <sworley@nvidia.com> | 2022-02-15 18:21:18 -0500 | 
|---|---|---|
| committer | Stephen Worley <sworley@nvidia.com> | 2022-03-09 18:02:44 -0500 | 
| commit | 7140b00cb0c0f9e9f007f092890f04166a9a66f8 (patch) | |
| tree | fe1a6c80ae26474ae22234ce09ef9f8c49ac8a2c /zebra/interface.c | |
| parent | 26a64ff9ca7b8afdd5ab9b9bc8a59f3ea9dbc53b (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/interface.c')
| -rw-r--r-- | zebra/interface.c | 27 | 
1 files changed, 12 insertions, 15 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 10cc665752..69d611e583 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1246,8 +1246,8 @@ static bool if_ignore_set_protodown(const struct interface *ifp, bool new_down,  	/* Current state as we know it */  	old_down = !!(ZEBRA_IF_IS_PROTODOWN(zif)); -	old_set_down = !!(zif->flags & ZIF_FLAG_SET_PROTODOWN); -	old_unset_down = !!(zif->flags & ZIF_FLAG_UNSET_PROTODOWN); +	old_set_down = !!CHECK_FLAG(zif->flags, ZIF_FLAG_SET_PROTODOWN); +	old_unset_down = !!CHECK_FLAG(zif->flags, ZIF_FLAG_UNSET_PROTODOWN);  	if (new_protodown_rc == zif->protodown_rc) {  		/* Early return if already down & reason bitfield matches */ @@ -1311,9 +1311,9 @@ int zebra_if_update_protodown_rc(struct interface *ifp, bool new_down,  	zif->protodown_rc = new_protodown_rc;  	if (new_down) -		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);  #ifdef HAVE_NETLINK  	dplane_intf_update(ifp); @@ -1450,15 +1450,12 @@ static void zebra_if_update_ctx(struct zebra_dplane_ctx *ctx,  	}  	/* Update our info */ -	if (down) -		zif->flags |= ZIF_FLAG_PROTODOWN; -	else -		zif->flags &= ~ZIF_FLAG_PROTODOWN; +	COND_FLAG(zif->flags, ZIF_FLAG_PROTODOWN, down);  done:  	/* Clear our dplane flags */ -	zif->flags &= ~ZIF_FLAG_SET_PROTODOWN; -	zif->flags &= ~ZIF_FLAG_UNSET_PROTODOWN; +	UNSET_FLAG(zif->flags, ZIF_FLAG_SET_PROTODOWN); +	UNSET_FLAG(zif->flags, ZIF_FLAG_UNSET_PROTODOWN);  }  /* @@ -1859,19 +1856,19 @@ const char *zebra_protodown_rc_str(uint32_t protodown_rc, char *pd_buf,  	strlcat(pd_buf, "(", pd_buf_len); -	if (protodown_rc & ZEBRA_PROTODOWN_EXTERNAL) +	if (CHECK_FLAG(protodown_rc, ZEBRA_PROTODOWN_EXTERNAL))  		strlcat(pd_buf, "external,", pd_buf_len); -	if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) +	if (CHECK_FLAG(protodown_rc, ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY))  		strlcat(pd_buf, "startup-delay,", pd_buf_len); -	if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN) +	if (CHECK_FLAG(protodown_rc, ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN))  		strlcat(pd_buf, "uplinks-down,", pd_buf_len); -	if (protodown_rc & ZEBRA_PROTODOWN_VRRP) +	if (CHECK_FLAG(protodown_rc, ZEBRA_PROTODOWN_VRRP))  		strlcat(pd_buf, "vrrp,", pd_buf_len); -	if (protodown_rc & ZEBRA_PROTODOWN_SHARP) +	if (CHECK_FLAG(protodown_rc, ZEBRA_PROTODOWN_SHARP))  		strlcat(pd_buf, "sharp,", pd_buf_len);  	len = strnlen(pd_buf, pd_buf_len);  | 
