aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-03-31 09:48:02 +0200
committerNeale Ranns <nranns@cisco.com>2020-04-08 14:54:23 +0000
commit61717cc38f321df3e28464336ac4e570aa47b490 (patch)
tree0499390bb4e65c1ec84161329d3d644bd1ff5596 /src/plugins/nat
parent7d697185437722ffce23a2d0b8838fc390cc6c84 (diff)
nat: use correct data types for memory sizes
Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Id2d181385f109163d4c806eecda166c2087c4b92
Diffstat (limited to 'src/plugins/nat')
-rw-r--r--src/plugins/nat/nat.api6
-rwxr-xr-xsrc/plugins/nat/nat.c8
-rw-r--r--src/plugins/nat/nat.h4
-rw-r--r--src/plugins/nat/nat64.c4
-rw-r--r--src/plugins/nat/nat64.h8
-rw-r--r--src/plugins/nat/nat64_db.c4
-rw-r--r--src/plugins/nat/nat64_db.h4
-rw-r--r--src/plugins/nat/nat_api.c12
8 files changed, 25 insertions, 25 deletions
diff --git a/src/plugins/nat/nat.api b/src/plugins/nat/nat.api
index 4567cb5f99c..10e7036608c 100644
--- a/src/plugins/nat/nat.api
+++ b/src/plugins/nat/nat.api
@@ -110,14 +110,14 @@ define nat_show_config_reply
u32 translation_buckets;
u32 translation_memory_size;
u32 user_buckets;
- u32 user_memory_size;
+ u64 user_memory_size;
u32 max_translations_per_user;
u32 outside_vrf_id;
u32 inside_vrf_id;
u32 nat64_bib_buckets;
- u32 nat64_bib_memory_size;
+ u64 nat64_bib_memory_size;
u32 nat64_st_buckets;
- u32 nat64_st_memory_size;
+ u64 nat64_st_memory_size;
};
enum nat_log_level : u8
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index fdf6334dd83..8e20df4e64e 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -3917,18 +3917,18 @@ snat_config (vlib_main_t * vm, unformat_input_t * input)
snat_main_per_thread_data_t *tsm;
u32 static_mapping_buckets = 1024;
- u32 static_mapping_memory_size = 64 << 20;
+ uword static_mapping_memory_size = 64 << 20;
u32 nat64_bib_buckets = 1024;
u32 nat64_bib_memory_size = 128 << 20;
u32 nat64_st_buckets = 2048;
- u32 nat64_st_memory_size = 256 << 20;
+ uword nat64_st_memory_size = 256 << 20;
u32 user_buckets = 128;
- u32 user_memory_size = 64 << 20;
+ uword user_memory_size = 64 << 20;
u32 translation_buckets = 1024;
- u32 translation_memory_size = 128 << 20;
+ uword translation_memory_size = 128 << 20;
u32 max_translations_per_user = ~0;
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h
index d2b114afbbe..187e351d318 100644
--- a/src/plugins/nat/nat.h
+++ b/src/plugins/nat/nat.h
@@ -711,10 +711,10 @@ typedef struct snat_main_s
u8 out2in_dpo;
u8 endpoint_dependent;
u32 translation_buckets;
- u32 translation_memory_size;
+ uword translation_memory_size;
u32 max_translations;
u32 user_buckets;
- u32 user_memory_size;
+ uword user_memory_size;
u32 max_translations_per_user;
u32 outside_vrf_id;
u32 outside_fib_index;
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 0dbeb5f4171..3aff99ddf85 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -256,8 +256,8 @@ static void nat64_free_out_addr_and_port (struct nat64_db_s *db,
u8 protocol);
void
-nat64_set_hash (u32 bib_buckets, u32 bib_memory_size, u32 st_buckets,
- u32 st_memory_size)
+nat64_set_hash (u32 bib_buckets, uword bib_memory_size, u32 st_buckets,
+ uword st_memory_size)
{
nat64_main_t *nm = &nat64_main;
nat64_db_t *db;
diff --git a/src/plugins/nat/nat64.h b/src/plugins/nat/nat64.h
index a95ded22893..f13334447b0 100644
--- a/src/plugins/nat/nat64.h
+++ b/src/plugins/nat/nat64.h
@@ -91,9 +91,9 @@ typedef struct
/** config parameters */
u32 bib_buckets;
- u32 bib_memory_size;
+ uword bib_memory_size;
u32 st_buckets;
- u32 st_memory_size;
+ uword st_memory_size;
/** values of various timeouts */
u32 udp_timeout;
@@ -359,8 +359,8 @@ void nat64_extract_ip4 (ip6_address_t * ip6, ip4_address_t * ip4,
* @param st_buckets Number of session table hash buckets.
* @param st_memory_size Memory size of session table hash.
*/
-void nat64_set_hash (u32 bib_buckets, u32 bib_memory_size, u32 st_buckets,
- u32 st_memory_size);
+void nat64_set_hash (u32 bib_buckets, uword bib_memory_size, u32 st_buckets,
+ uword st_memory_size);
/**
* @brief Get worker thread index for NAT64 in2out.
diff --git a/src/plugins/nat/nat64_db.c b/src/plugins/nat/nat64_db.c
index 178e483ff98..8c004f14686 100644
--- a/src/plugins/nat/nat64_db.c
+++ b/src/plugins/nat/nat64_db.c
@@ -23,8 +23,8 @@
#include <vnet/fib/fib_table.h>
int
-nat64_db_init (nat64_db_t * db, u32 bib_buckets, u32 bib_memory_size,
- u32 st_buckets, u32 st_memory_size,
+nat64_db_init (nat64_db_t * db, u32 bib_buckets, uword bib_memory_size,
+ u32 st_buckets, uword st_memory_size,
nat64_db_free_addr_port_function_t free_addr_port_cb)
{
clib_bihash_init_24_8 (&db->bib.in2out, "bib-in2out", bib_buckets,
diff --git a/src/plugins/nat/nat64_db.h b/src/plugins/nat/nat64_db.h
index e6fa8e727ad..68f048ca59e 100644
--- a/src/plugins/nat/nat64_db.h
+++ b/src/plugins/nat/nat64_db.h
@@ -153,8 +153,8 @@ typedef struct nat64_db_s
*
* @returns 0 on success, non-zero value otherwise.
*/
-int nat64_db_init (nat64_db_t * db, u32 bib_buckets, u32 bib_memory_size,
- u32 st_buckets, u32 st_memory_size,
+int nat64_db_init (nat64_db_t * db, u32 bib_buckets, uword bib_memory_size,
+ u32 st_buckets, uword st_memory_size,
nat64_db_free_addr_port_function_t free_addr_port_cb);
/**
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index a71c888b6c6..5db375ca58f 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -104,9 +104,9 @@ vl_api_nat_show_config_t_handler (vl_api_nat_show_config_t * mp)
REPLY_MACRO2 (VL_API_NAT_SHOW_CONFIG_REPLY,
({
rmp->translation_buckets = htonl (sm->translation_buckets);
- rmp->translation_memory_size = htonl (sm->translation_memory_size);
+ rmp->translation_memory_size = clib_host_to_net_u64 (sm->translation_memory_size);
rmp->user_buckets = htonl (sm->user_buckets);
- rmp->user_memory_size = htonl (sm->user_memory_size);
+ rmp->user_memory_size = clib_host_to_net_u64 (sm->user_memory_size);
rmp->max_translations_per_user = htonl (sm->max_translations_per_user);
rmp->outside_vrf_id = htonl (sm->outside_vrf_id);
rmp->inside_vrf_id = htonl (sm->inside_vrf_id);
@@ -117,10 +117,10 @@ vl_api_nat_show_config_t_handler (vl_api_nat_show_config_t * mp)
rmp->endpoint_dependent = sm->endpoint_dependent;
rmp->out2in_dpo = sm->out2in_dpo;
//rmp->dslite_ce = dm->is_ce;
- rmp->nat64_bib_buckets = n64m->bib_buckets;
- rmp->nat64_bib_memory_size = n64m->bib_memory_size;
- rmp->nat64_st_buckets = n64m->st_buckets;
- rmp->nat64_st_memory_size = n64m->st_memory_size;
+ rmp->nat64_bib_buckets = clib_net_to_host_u32(n64m->bib_buckets);
+ rmp->nat64_bib_memory_size = clib_net_to_host_u64(n64m->bib_memory_size);
+ rmp->nat64_st_buckets = clib_net_to_host_u32(n64m->st_buckets);
+ rmp->nat64_st_memory_size = clib_net_to_host_u64(n64m->st_memory_size);
}));
/* *INDENT-ON* */
}