mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-02-01 16:49:01 +00:00
zebra: add init api for dplane lsp context
Add an init api (based on what had been a private/static api) to allow a caller to init a context and use it to generate LSP updates. This might be useful for testing, or from a dplane plugin. Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
0024ea8ecd
commit
65f264cf42
@ -1952,18 +1952,12 @@ done:
|
||||
/*
|
||||
* Capture information for an LSP update in a dplane context.
|
||||
*/
|
||||
static int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx,
|
||||
enum dplane_op_e op,
|
||||
zebra_lsp_t *lsp)
|
||||
int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
|
||||
zebra_lsp_t *lsp)
|
||||
{
|
||||
int ret = AOK;
|
||||
zebra_nhlfe_t *nhlfe, *new_nhlfe;
|
||||
|
||||
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
|
||||
zlog_debug("init dplane ctx %s: in-label %u ecmp# %d",
|
||||
dplane_op2str(op), lsp->ile.in_label,
|
||||
lsp->num_ecmp);
|
||||
|
||||
ctx->zd_op = op;
|
||||
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
|
||||
|
||||
@ -1975,6 +1969,20 @@ static int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx,
|
||||
|
||||
nhlfe_list_init(&(ctx->u.lsp.nhlfe_list));
|
||||
nhlfe_list_init(&(ctx->u.lsp.backup_nhlfe_list));
|
||||
|
||||
/* This may be called to create/init a dplane context, not necessarily
|
||||
* to copy an lsp object.
|
||||
*/
|
||||
if (lsp == NULL) {
|
||||
ret = AOK;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
|
||||
zlog_debug("init dplane ctx %s: in-label %u ecmp# %d",
|
||||
dplane_op2str(op), lsp->ile.in_label,
|
||||
lsp->num_ecmp);
|
||||
|
||||
ctx->u.lsp.ile = lsp->ile;
|
||||
ctx->u.lsp.addr_family = lsp->addr_family;
|
||||
ctx->u.lsp.num_ecmp = lsp->num_ecmp;
|
||||
|
||||
@ -310,6 +310,14 @@ dplane_ctx_get_nhe_nh_grp(const struct zebra_dplane_ctx *ctx);
|
||||
uint8_t dplane_ctx_get_nhe_nh_grp_count(const struct zebra_dplane_ctx *ctx);
|
||||
|
||||
/* Accessors for LSP information */
|
||||
|
||||
/* Init the internal LSP data struct - necessary before adding to it.
|
||||
* If 'lsp' is non-NULL, info will be copied from it to the internal
|
||||
* context data area.
|
||||
*/
|
||||
int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
|
||||
zebra_lsp_t *lsp);
|
||||
|
||||
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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user