diff options
Diffstat (limited to 'hicn-plugin/src/hicn.c')
-rw-r--r-- | hicn-plugin/src/hicn.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/hicn-plugin/src/hicn.c b/hicn-plugin/src/hicn.c index 9bec91455..d48ef4023 100644 --- a/hicn-plugin/src/hicn.c +++ b/hicn-plugin/src/hicn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021 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: @@ -25,22 +25,15 @@ #include "mgmt.h" #include "error.h" #include "faces/app/address_mgr.h" -#include "face_db.h" #include "udp_tunnels/udp_tunnel.h" #include "route.h" +#include "pg.h" hicn_main_t hicn_main; /* Module vars */ int hicn_infra_fwdr_initialized = 0; -/* - * Global time counters we're trying out for opportunistic hashtable - * expiration. - */ -uint16_t hicn_infra_fast_timer; /* Counts at 1 second intervals */ -uint16_t hicn_infra_slow_timer; /* Counts at 1 minute intervals */ - -hicn_face_bucket_t *hicn_face_bucket_pool; +// hicn_face_bucket_t *hicn_face_bucket_pool; /* * Init hicn forwarder with configurable PIT, CS sizes @@ -48,29 +41,27 @@ hicn_face_bucket_t *hicn_face_bucket_pool; static int hicn_infra_fwdr_init (uint32_t shard_pit_size, uint32_t shard_cs_size) { - int ret = 0; + int ret = HICN_ERROR_NONE; if (hicn_infra_fwdr_initialized) { ret = HICN_ERROR_FWD_ALREADY_ENABLED; - goto done; + goto DONE; } + /* Init per worker limits */ hicn_infra_pit_size = shard_pit_size; hicn_infra_cs_size = shard_cs_size; - /* Init the global time-compression counters */ - hicn_infra_fast_timer = 1; - hicn_infra_slow_timer = 1; + hicn_pit_create (&hicn_main.pitcs, hicn_infra_pit_size, hicn_infra_cs_size); - ret = hicn_pit_create (&hicn_main.pitcs, hicn_infra_pit_size); - hicn_pit_set_lru_max (&hicn_main.pitcs, hicn_infra_cs_size); -done: +DONE: if ((ret == HICN_ERROR_NONE) && !hicn_infra_fwdr_initialized) { hicn_infra_fwdr_initialized = 1; } - return (ret); + + return ret; } /* @@ -149,8 +140,8 @@ hicn_infra_plugin_enable_disable (int enable_disable, int pit_size_req, // check if CS is bugger tha PIT or bigger than the available // vlib_buffers uword cs_buffers = (n_buffers > HICN_PARAM_CS_MIN_MBUF) ? - n_buffers - HICN_PARAM_CS_MIN_MBUF : - 0; + n_buffers - HICN_PARAM_CS_MIN_MBUF : + 0; if (cs_size_req > (pit_size_req / 2) || cs_size_req > cs_buffers) { @@ -165,8 +156,6 @@ hicn_infra_plugin_enable_disable (int enable_disable, int pit_size_req, ret = hicn_infra_fwdr_init (pit_size, cs_size); - hicn_face_db_init (pit_size); - if (ret != HICN_ERROR_NONE) { goto done; @@ -223,24 +212,29 @@ hicn_init (vlib_main_t *vm) hicn_main_t *sm = &hicn_main; - /* Init other elements in the 'main' struct */ + // Init other elements in the 'main' struct sm->is_enabled = 0; error = hicn_api_plugin_hookup (vm); - /* Init the dpo module */ + // Init the dpo module hicn_dpos_init (); - /* Init the app manager */ + // Init the app manager address_mgr_init (); + // Init the face module hicn_face_module_init (vm); - /* Init the route module */ + // Init the route module hicn_route_init (); + // Init the UDP tunnels module udp_tunnel_init (); + // Init the packet generator module + hicn_pg_init (vm); + return error; } |