zebra: Check for nh group support in dplane ctx

Only queue a nexthop object update if the dataplane
supports nexthop objects. Otherwise, mark it as a success
since we should only me sending them to the kernel
if we think they are valid anywyay.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-04-23 10:24:58 -04:00
parent de3f548819
commit 3230a4dba5

View File

@ -1593,6 +1593,11 @@ static int dplane_ctx_nexthop_init(struct zebra_dplane_ctx *ctx,
structs */
zns = ((struct zebra_vrf *)vrf_info_lookup(nhe->vrf_id))->zns;
if (!zns->supports_nh) {
ret = EOPNOTSUPP;
goto done;
}
// TODO: Might not need to mark this as an update, since
// it probably won't require two messages
dplane_ctx_ns_init(ctx, zns, (op == DPLANE_OP_NH_UPDATE));
@ -1885,8 +1890,12 @@ done:
if (ret == AOK)
result = ZEBRA_DPLANE_REQUEST_QUEUED;
else {
atomic_fetch_add_explicit(&zdplane_info.dg_nexthop_errors, 1,
memory_order_relaxed);
if (ret == EOPNOTSUPP)
result = ZEBRA_DPLANE_REQUEST_SUCCESS;
else
atomic_fetch_add_explicit(
&zdplane_info.dg_nexthop_errors, 1,
memory_order_relaxed);
if (ctx)
dplane_ctx_free(&ctx);
}