aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/strategies/dpo_rr.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/strategies/dpo_rr.c')
-rw-r--r--hicn-plugin/src/strategies/dpo_rr.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/hicn-plugin/src/strategies/dpo_rr.c b/hicn-plugin/src/strategies/dpo_rr.c
index 3fe506bd1..1fb72b953 100644
--- a/hicn-plugin/src/strategies/dpo_rr.c
+++ b/hicn-plugin/src/strategies/dpo_rr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 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:
@@ -28,9 +28,16 @@ static const hicn_dpo_vft_t hicn_dpo_rr_vft = {
.hicn_dpo_get_type = &hicn_dpo_strategy_rr_get_type,
.hicn_dpo_module_init = &hicn_dpo_strategy_rr_module_init,
.hicn_dpo_create = &hicn_strategy_rr_ctx_create,
+ .hicn_dpo_update_type = &hicn_strategy_rr_update_ctx_type,
.hicn_dpo_add_update_nh = &hicn_strategy_rr_ctx_add_nh,
.hicn_dpo_del_nh = &hicn_strategy_rr_ctx_del_nh,
- .hicn_dpo_format = &hicn_strategy_rr_format_ctx
+ .hicn_dpo_format = &hicn_dpo_strategy_rr_format
+};
+
+const static dpo_vft_t dpo_strategy_rr_ctx_vft = {
+ .dv_lock = hicn_strategy_dpo_ctx_lock,
+ .dv_unlock = hicn_strategy_dpo_ctx_unlock,
+ .dv_format = hicn_strategy_dpo_format,
};
int
@@ -59,26 +66,10 @@ hicn_dpo_strategy_rr_get_type (void)
//////////////////////////////////////////////////////////////////////////////////////////////////
u8 *
-hicn_strategy_rr_format_ctx (u8 *s, int n, ...)
-{
- va_list args;
- va_start (args, n);
- s = format_hicn_strategy_rr_ctx (s, &args);
- return s;
-}
-
-u8 *
-format_hicn_strategy_rr_ctx (u8 *s, va_list *ap)
+hicn_dpo_strategy_rr_format (u8 *s, hicn_dpo_ctx_t *dpo_ctx, u32 indent)
{
int i = 0;
- index_t index = va_arg (*ap, index_t);
- hicn_dpo_ctx_t *dpo_ctx = NULL;
hicn_strategy_rr_ctx_t *rr_dpo_ctx = NULL;
- u32 indent = va_arg (*ap, u32);
-
- dpo_ctx = hicn_strategy_dpo_ctx_get (index);
- if (dpo_ctx == NULL)
- return s;
rr_dpo_ctx = (hicn_strategy_rr_ctx_t *) dpo_ctx->data;
@@ -117,8 +108,19 @@ hicn_strategy_rr_ctx_create (fib_protocol_t proto,
*dpo_idx = hicn_strategy_dpo_ctx_get_index (hicn_strategy_ctx);
- init_dpo_ctx (hicn_strategy_ctx, next_hop, nh_len, hicn_dpo_type_rr, proto);
+ init_dpo_ctx (hicn_strategy_ctx, next_hop, nh_len, hicn_dpo_type_rr,
+ (dpo_proto_t) proto);
+
+ hicn_strategy_rr_ctx->current_nhop = 0;
+}
+
+void
+hicn_strategy_rr_update_ctx_type (hicn_dpo_ctx_t *hicn_strategy_ctx)
+{
+ hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx;
+ hicn_strategy_rr_ctx = (hicn_strategy_rr_ctx_t *) hicn_strategy_ctx->data;
+ hicn_strategy_ctx->dpo_type = hicn_dpo_type_rr;
hicn_strategy_rr_ctx->current_nhop = 0;
}