aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/strategy_dpo_manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/strategy_dpo_manager.c')
-rw-r--r--hicn-plugin/src/strategy_dpo_manager.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/hicn-plugin/src/strategy_dpo_manager.c b/hicn-plugin/src/strategy_dpo_manager.c
index 3c441ccac..1e136b47b 100644
--- a/hicn-plugin/src/strategy_dpo_manager.c
+++ b/hicn-plugin/src/strategy_dpo_manager.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Cisco and/or its affiliates.
+ * Copyright (c) 2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -19,6 +19,8 @@
#include "strategy_dpo_ctx.h"
#include "strategies/dpo_mw.h"
#include "strategies/dpo_rr.h"
+#include "strategies/dpo_rp.h"
+#include "strategies/dpo_lr.h"
#include "strategy.h"
#include "faces/face.h"
@@ -92,20 +94,31 @@ hicn_dpo_get_strategy_vft_from_id (u8 vfts_id)
return hicn_strategy_vfts[strategies_id[vfts_id]];
}
+u8 *
+hicn_strategy_dpo_format (u8 *s, va_list *ap)
+{
+ index_t index = va_arg (*ap, index_t);
+ hicn_dpo_ctx_t *dpo_ctx = NULL;
+ u32 indent = va_arg (*ap, u32);
+
+ dpo_ctx = hicn_strategy_dpo_ctx_get (index);
+ if (dpo_ctx == NULL)
+ return s;
+
+ return hicn_dpo_vfts[dpo_ctx->dpo_type]->hicn_dpo_format (s, dpo_ctx,
+ indent);
+}
+
void
hicn_dpos_init (void)
{
hicn_strategy_init_dpo_ctx_pool ();
hicn_dpo_strategy_mw_module_init ();
hicn_dpo_strategy_rr_module_init ();
+ hicn_dpo_strategy_rp_module_init ();
+ hicn_dpo_strategy_lr_module_init ();
- default_dpo.hicn_dpo_is_type = &hicn_dpo_is_type_strategy_mw;
- default_dpo.hicn_dpo_get_type = &hicn_dpo_strategy_mw_get_type;
- default_dpo.hicn_dpo_module_init = &hicn_dpo_strategy_mw_module_init;
- default_dpo.hicn_dpo_create = &hicn_strategy_mw_ctx_create;
- default_dpo.hicn_dpo_add_update_nh = &hicn_strategy_mw_ctx_add_nh;
- default_dpo.hicn_dpo_del_nh = &hicn_strategy_mw_ctx_del_nh;
- default_dpo.hicn_dpo_format = &hicn_strategy_mw_format_ctx;
+ default_dpo = *hicn_dpo_vfts[hicn_dpo_strategy_mw_get_type ()];
}
u8 *
@@ -128,12 +141,12 @@ format_hicn_strategy_list (u8 *s, int n, ...)
return (s);
}
-u8
+int
hicn_dpo_strategy_id_is_valid (int strategy_id)
{
return vec_len (strategies_id) > strategy_id ?
- HICN_ERROR_NONE :
- HICN_ERROR_DPO_MGR_ID_NOT_VALID;
+ HICN_ERROR_NONE :
+ HICN_ERROR_DPO_MGR_ID_NOT_VALID;
}
int