From 3ab54059be88b0dce9e6a97e2ddc32723f3dfacf Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Fri, 3 May 2019 11:02:16 -0400 Subject: [PATCH] zebra: add dplane context lsp setters Add some setters for dataplane context LSP data to support LSP async notifications. Signed-off-by: Mark Stapp --- zebra/zebra_dplane.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ zebra/zebra_dplane.h | 15 +++++++++++++ 2 files changed, 66 insertions(+) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 6b3d24aeb3..df6188661b 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -914,6 +914,13 @@ mpls_label_t dplane_ctx_get_in_label(const struct zebra_dplane_ctx *ctx) return ctx->u.lsp.ile.in_label; } +void dplane_ctx_set_in_label(struct zebra_dplane_ctx *ctx, mpls_label_t label) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.lsp.ile.in_label = label; +} + uint8_t dplane_ctx_get_addr_family(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); @@ -921,6 +928,14 @@ uint8_t dplane_ctx_get_addr_family(const struct zebra_dplane_ctx *ctx) return ctx->u.lsp.addr_family; } +void dplane_ctx_set_addr_family(struct zebra_dplane_ctx *ctx, + uint8_t family) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.lsp.addr_family = family; +} + uint32_t dplane_ctx_get_lsp_flags(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); @@ -928,6 +943,14 @@ uint32_t dplane_ctx_get_lsp_flags(const struct zebra_dplane_ctx *ctx) return ctx->u.lsp.flags; } +void dplane_ctx_set_lsp_flags(struct zebra_dplane_ctx *ctx, + uint32_t flags) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.lsp.flags = flags; +} + const zebra_nhlfe_t *dplane_ctx_get_nhlfe(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); @@ -935,6 +958,24 @@ const zebra_nhlfe_t *dplane_ctx_get_nhlfe(const struct zebra_dplane_ctx *ctx) return ctx->u.lsp.nhlfe_list; } +zebra_nhlfe_t *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx, + enum lsp_types_t lsp_type, + enum nexthop_types_t nh_type, + union g_addr *gate, + ifindex_t ifindex, + mpls_label_t out_label) +{ + zebra_nhlfe_t *nhlfe; + + DPLANE_CTX_VALID(ctx); + + nhlfe = zebra_mpls_lsp_add_nhlfe(&(ctx->u.lsp), + lsp_type, nh_type, gate, + ifindex, out_label); + + return nhlfe; +} + const zebra_nhlfe_t * dplane_ctx_get_best_nhlfe(const struct zebra_dplane_ctx *ctx) { @@ -943,6 +984,16 @@ dplane_ctx_get_best_nhlfe(const struct zebra_dplane_ctx *ctx) return ctx->u.lsp.best_nhlfe; } +const zebra_nhlfe_t * +dplane_ctx_set_best_nhlfe(struct zebra_dplane_ctx *ctx, + zebra_nhlfe_t *nhlfe) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.lsp.best_nhlfe = nhlfe; + return ctx->u.lsp.best_nhlfe; +} + uint32_t dplane_ctx_get_lsp_num_ecmp(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index 60fd05e22d..506dcb4996 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -235,11 +235,26 @@ const struct nexthop_group *dplane_ctx_get_old_ng( /* Accessors for LSP information */ mpls_label_t dplane_ctx_get_in_label(const struct zebra_dplane_ctx *ctx); +void dplane_ctx_set_in_label(struct zebra_dplane_ctx *ctx, + mpls_label_t label); uint8_t dplane_ctx_get_addr_family(const struct zebra_dplane_ctx *ctx); +void dplane_ctx_set_addr_family(struct zebra_dplane_ctx *ctx, + uint8_t family); uint32_t dplane_ctx_get_lsp_flags(const struct zebra_dplane_ctx *ctx); +void dplane_ctx_set_lsp_flags(struct zebra_dplane_ctx *ctx, + uint32_t flags); const zebra_nhlfe_t *dplane_ctx_get_nhlfe(const struct zebra_dplane_ctx *ctx); +zebra_nhlfe_t *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx, + enum lsp_types_t lsp_type, + enum nexthop_types_t nh_type, + union g_addr *gate, + ifindex_t ifindex, + mpls_label_t out_label); + const zebra_nhlfe_t *dplane_ctx_get_best_nhlfe( const struct zebra_dplane_ctx *ctx); +const zebra_nhlfe_t *dplane_ctx_set_best_nhlfe(struct zebra_dplane_ctx *ctx, + zebra_nhlfe_t *nhlfe); uint32_t dplane_ctx_get_lsp_num_ecmp(const struct zebra_dplane_ctx *ctx); /* Accessors for pseudowire information */ -- 2.39.5