diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-11-10 15:09:37 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2022-02-04 15:33:58 -0500 | 
| commit | e3ee55d4bde5de9d39a91b53b30f67a6e45bbdb8 (patch) | |
| tree | b3b2e0daed7d1a4f313f65f4a3c80b9615649c1f /zebra/zebra_dplane.c | |
| parent | 00249e255ee651eefb027f3a3c8deb0f130f6193 (diff) | |
zebra: set zd_is_update in 1 spot
The ctx->zd_is_update is being set in various
spots based upon the same value that we are
passing into dplane_ctx_ns_init.  Let's just
consolidate all this into the dplane_ctx_ns_init
so that the zd_is_udpate value is set at the
same time that we increment the sequence numbers
to use.
As a note for future me's reading this.  The sequence
number choosen for the seq number passed to the
kernel is that each context gets a copy of the
appropriate nlsock to use.  Since it's a copy
at a point in time, we know we have a unique sequence
number value.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zebra_dplane.c')
| -rw-r--r-- | zebra/zebra_dplane.c | 9 | 
1 files changed, 2 insertions, 7 deletions
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index bf34fb54a9..96a606af98 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -2296,6 +2296,8 @@ static int dplane_ctx_ns_init(struct zebra_dplane_ctx *ctx,  {  	dplane_info_from_zns(&(ctx->zd_ns_info), zns); +	ctx->zd_is_update = is_update; +  #if defined(HAVE_NETLINK)  	/* Increment message counter after copying to context struct - may need  	 * two messages in some 'update' cases. @@ -2514,7 +2516,6 @@ int dplane_ctx_nexthop_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,  	 * it probably won't require two messages  	 */  	dplane_ctx_ns_init(ctx, zns, (op == DPLANE_OP_NH_UPDATE)); -	ctx->zd_is_update = (op == DPLANE_OP_NH_UPDATE);  	ret = AOK; @@ -2537,7 +2538,6 @@ int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,  	/* Capture namespace info */  	dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT),  			   (op == DPLANE_OP_LSP_UPDATE)); -	ctx->zd_is_update = (op == DPLANE_OP_LSP_UPDATE);  	memset(&ctx->u.lsp, 0, sizeof(ctx->u.lsp)); @@ -2813,7 +2813,6 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx,  	dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT),  			   op == DPLANE_OP_RULE_UPDATE); -	ctx->zd_is_update = (op == DPLANE_OP_RULE_UPDATE);  	ctx->zd_vrf_id = new_rule->vrf_id;  	strlcpy(ctx->zd_ifname, new_rule->ifname, sizeof(ctx->zd_ifname)); @@ -2859,7 +2858,6 @@ static int dplane_ctx_iptable_init(struct zebra_dplane_ctx *ctx,  	ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;  	dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT), false); -	ctx->zd_is_update = false;  	ctx->zd_vrf_id = iptable->vrf_id;  	memcpy(&ctx->u.iptable, iptable, sizeof(struct zebra_pbr_iptable)); @@ -2899,7 +2897,6 @@ static int dplane_ctx_ipset_init(struct zebra_dplane_ctx *ctx,  	ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;  	dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT), false); -	ctx->zd_is_update = false;  	ctx->zd_vrf_id = ipset->vrf_id; @@ -2934,7 +2931,6 @@ dplane_ctx_ipset_entry_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,  	ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;  	dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT), false); -	ctx->zd_is_update = false;  	ctx->zd_vrf_id = ipset->vrf_id; @@ -3015,7 +3011,6 @@ dplane_route_update_internal(struct route_node *rn,  		 */  		if ((op == DPLANE_OP_ROUTE_UPDATE) &&  		    old_re && (old_re != re)) { -			ctx->zd_is_update = true;  			old_re->dplane_sequence =  				zebra_router_get_next_sequence();  | 
