diff options
author | Luca Muscariello <muscariello@ieee.org> | 2023-01-10 16:48:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2023-01-10 16:48:16 +0000 |
commit | 8adfb21bf73bdb4c77d04a9c8005bd9008dd52ca (patch) | |
tree | f3625410471076ae07e0cfb4c8b5209459609918 /hicn-plugin/src/faces | |
parent | c31c2eab0ef33df0bf1d46238b7509d1429b110e (diff) | |
parent | 55d06ad1cd4f64fc7382bcaf14dc57c1f16db8fe (diff) |
Merge "feat: upgrade to VPP 22.10"
Diffstat (limited to 'hicn-plugin/src/faces')
-rw-r--r-- | hicn-plugin/src/faces/app/face_prod.c | 17 | ||||
-rw-r--r-- | hicn-plugin/src/faces/app/face_prod.h | 7 | ||||
-rw-r--r-- | hicn-plugin/src/faces/face.c | 17 | ||||
-rw-r--r-- | hicn-plugin/src/faces/face_cli.c | 14 |
4 files changed, 34 insertions, 21 deletions
diff --git a/hicn-plugin/src/faces/app/face_prod.c b/hicn-plugin/src/faces/app/face_prod.c index 73e2a1262..54fbd418a 100644 --- a/hicn-plugin/src/faces/app/face_prod.c +++ b/hicn-plugin/src/faces/app/face_prod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Cisco and/or its affiliates. + * Copyright (c) 2021-2023 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: @@ -17,6 +17,7 @@ #include <vlib/vlib.h> #include <vnet/vnet.h> #include <vnet/interface_funcs.h> +#include <vppinfra/pool.h> #include "face_prod.h" #include "address_mgr.h" @@ -24,6 +25,7 @@ #include "../../route.h" #include "../../cache_policies/cs_lru.h" +#define INITIAL_POOL_SIZE 16 hicn_face_prod_state_t *face_state_vec; /* used to check if an interface is already in the vector */ @@ -32,9 +34,6 @@ u32 *face_state_pool; static int hicn_app_state_create (u32 swif, index_t adj_index, fib_prefix_t *prefix) { - /* Make sure that the pool is not empty */ - pool_validate_index (face_state_pool, 0); - u32 *swif_app; u8 found = 0; @@ -74,9 +73,6 @@ hicn_app_state_create (u32 swif, index_t adj_index, fib_prefix_t *prefix) static int hicn_app_state_del (u32 swif) { - /* Make sure that the pool is not empty */ - pool_validate_index (face_state_pool, 0); - u32 *temp; u32 *swif_app = NULL; u8 found = 0; @@ -357,6 +353,13 @@ format_hicn_face_prod (u8 *s, va_list *args) return s; } +void +hicn_face_prod_init () +{ + /* Make sure that the pool is not empty */ + pool_alloc (face_state_pool, INITIAL_POOL_SIZE); +} + VNET_FEATURE_INIT (hicn_prod_app_input_ip6, static) = { .arc_name = "ip6-unicast", .node_name = "hicn-face-prod-input", diff --git a/hicn-plugin/src/faces/app/face_prod.h b/hicn-plugin/src/faces/app/face_prod.h index 51373d541..46bdf7c24 100644 --- a/hicn-plugin/src/faces/app/face_prod.h +++ b/hicn-plugin/src/faces/app/face_prod.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Cisco and/or its affiliates. + * Copyright (c) 2021-2023 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: @@ -96,6 +96,11 @@ int hicn_face_prod_set_lru_max (hicn_face_id_t face_id, u32 *requested_size); */ u8 *format_hicn_face_prod (u8 *s, va_list *args); +/** + * @brief Init the producer face module + */ +void hicn_face_prod_init (); + #endif /* _FACE_PROD_H_ */ /* diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c index 58c1c34c8..84fd5e6ee 100644 --- a/hicn-plugin/src/faces/face.c +++ b/hicn-plugin/src/faces/face.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Cisco and/or its affiliates. + * Copyright (c) 2021-2023 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: @@ -15,6 +15,7 @@ #include <vnet/fib/fib_entry_track.h> #include "face.h" +#include "app/face_prod.h" #include "../hicn.h" #include "../params.h" #include "../error.h" @@ -60,14 +61,14 @@ face_show (u8 *s, int face_id, u32 indent) mhash_t hicn_face_hashtb; const static char *const hicn_face6_nodes[] = { - "hicn6-face-output", // this is the name you give your node in - // VLIB_REGISTER_NODE + "hicn6-face-output", // this is the name you give your node in + // VLIB_REGISTER_NODE NULL, }; const static char *const hicn_face4_nodes[] = { - "hicn4-face-output", // this is the name you give your node in - // VLIB_REGISTER_NODE + "hicn4-face-output", // this is the name you give your node in + // VLIB_REGISTER_NODE NULL, }; @@ -151,7 +152,6 @@ static const fib_node_vft_t hicn_face_fib_node_vft = { void hicn_face_module_init (vlib_main_t *vm) { - pool_validate (hicn_dpoi_face_pool); pool_alloc (hicn_dpoi_face_pool, 1024); counters = vec_new (vlib_combined_counter_main_t, HICN_PARAM_FACES_MAX * HICN_N_COUNTER); @@ -171,6 +171,11 @@ hicn_face_module_init (vlib_main_t *vm) */ hicn_face_fib_node_type = fib_node_register_new_type ("hicn_face_fib_node", &hicn_face_fib_node_vft); + + /* + * Init producer face module + */ + hicn_face_prod_init (); } u8 * diff --git a/hicn-plugin/src/faces/face_cli.c b/hicn-plugin/src/faces/face_cli.c index 20acefc5b..1c1501478 100644 --- a/hicn-plugin/src/faces/face_cli.c +++ b/hicn-plugin/src/faces/face_cli.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Cisco and/or its affiliates. + * Copyright (c) 2021-2023 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: @@ -82,12 +82,12 @@ hicn_face_cli_show_command_fn (vlib_main_t *vm, unformat_input_t *main_input, HICN_FACE_CTRX_STRING[i]); if (n) - _vec_len (n) = 0; + vec_set_len (n, 0); n = format (n, "packets"); s = format (s, "%U%-16v%16Ld", format_white_space, 30 - strlen (HICN_FACE_CTRX_STRING[i]), n, v.packets); - _vec_len (n) = 0; + vec_set_len (n, 0); n = format (n, "bytes"); s = format (s, "\n%U%-16v%16Ld\n", format_white_space, indent + 30, n, v.bytes); @@ -120,13 +120,13 @@ hicn_face_cli_show_command_fn (vlib_main_t *vm, unformat_input_t *main_input, HICN_FACE_CTRX_STRING[i]); if (n) - _vec_len (n) = 0; + vec_set_len (n, 0); n = format (n, "packets"); s = format (s, "%U%-16v%16Ld", format_white_space, 30 - strlen (HICN_FACE_CTRX_STRING[i]), n, v.packets); - _vec_len (n) = 0; + vec_set_len (n, 0); n = format (n, "bytes"); s = format (s, "\n%U%-16v%16Ld\n", format_white_space, @@ -158,13 +158,13 @@ hicn_face_cli_show_command_fn (vlib_main_t *vm, unformat_input_t *main_input, HICN_FACE_CTRX_STRING[i]); if (n) - _vec_len (n) = 0; + vec_set_len (n, 0); n = format (n, "packets"); s = format (s, "%U%-16v%16Ld", format_white_space, 30 - strlen (HICN_FACE_CTRX_STRING[i]), n, v.packets); - _vec_len (n) = 0; + vec_set_len (n, 0); n = format (n, "bytes"); s = format (s, "\n%U%-16v%16Ld\n", format_white_space, indent + 30, n, v.bytes); |