X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat64_db.h;h=68f048ca59efbcad5056703d8ea78dd2630c7cd8;hb=61717cc38f321df3e28464336ac4e570aa47b490;hp=4345fd309740c27eaa65901b55ac04657953d84a;hpb=a3a6ec63d34c98e19b18530c165d09ac61389225;p=vpp.git diff --git a/src/plugins/nat/nat64_db.h b/src/plugins/nat/nat64_db.h index 4345fd30974..68f048ca59e 100644 --- a/src/plugins/nat/nat64_db.h +++ b/src/plugins/nat/nat64_db.h @@ -68,6 +68,9 @@ typedef struct /* BIB lookup */ clib_bihash_24_8_t in2out; clib_bihash_24_8_t out2in; + + u32 limit; + u32 bib_entries_num; } nat64_db_bib_t; typedef struct @@ -115,6 +118,9 @@ typedef struct /* session lookup */ clib_bihash_48_8_t in2out; clib_bihash_48_8_t out2in; + + u32 limit; + u32 st_entries_num; } nat64_db_st_t; struct nat64_db_s; @@ -132,6 +138,7 @@ typedef struct nat64_db_s nat64_db_bib_t bib; nat64_db_st_t st; nat64_db_free_addr_port_function_t free_addr_port_cb; + u8 addr_free; } nat64_db_t; /** @@ -146,13 +153,14 @@ 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); /** * @brief Create new NAT64 BIB entry. * + * @param thread_index thread index. * @param db NAT64 DB. * @param in_addr Inside IPv6 address. * @param out_addr Outside IPv4 address. @@ -164,20 +172,23 @@ int nat64_db_init (nat64_db_t * db, u32 bib_buckets, u32 bib_memory_size, * * @returns BIB entry on success, 0 otherwise. */ -nat64_db_bib_entry_t *nat64_db_bib_entry_create (nat64_db_t * db, +nat64_db_bib_entry_t *nat64_db_bib_entry_create (u32 thread_index, + nat64_db_t * db, ip6_address_t * in_addr, ip4_address_t * out_addr, u16 in_port, u16 out_port, - u32 fib_index, - u8 proto, u8 is_static); + u32 fib_index, u8 proto, + u8 is_static); /** * @brief Free NAT64 BIB entry. * + * @param thread_index thread index. * @param db NAT64 DB. * @param bibe BIB entry. */ -void nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe); +void nat64_db_bib_entry_free (u32 thread_index, nat64_db_t * db, + nat64_db_bib_entry_t * bibe); /** * @brief Call back function when walking NAT64 BIB, non-zero @@ -194,7 +205,8 @@ typedef int (*nat64_db_bib_walk_fn_t) (nat64_db_bib_entry_t * bibe, * - 6 TCP BIB * - 17 UDP BIB * - 1/58 ICMP BIB - * - otherwise "unknown" protocol BIB + * + * u - otherwise "unknown" protocol BIB * @param fn The function to invoke on each entry visited. * @param ctx A context passed in the visit function. */ @@ -233,6 +245,7 @@ nat64_db_bib_entry_t *nat64_db_bib_entry_by_index (nat64_db_t * db, /** * @brief Create new NAT64 session table entry. * + * @param thread_index thread index. * @param db NAT64 DB. * @param bibe Corresponding BIB entry. * @param in_r_addr Inside IPv6 address of the remote host. @@ -241,7 +254,8 @@ nat64_db_bib_entry_t *nat64_db_bib_entry_by_index (nat64_db_t * db, * * @returns BIB entry on success, 0 otherwise. */ -nat64_db_st_entry_t *nat64_db_st_entry_create (nat64_db_t * db, +nat64_db_st_entry_t *nat64_db_st_entry_create (u32 thread_index, + nat64_db_t * db, nat64_db_bib_entry_t * bibe, ip6_address_t * in_r_addr, ip4_address_t * out_r_addr, @@ -250,10 +264,12 @@ nat64_db_st_entry_t *nat64_db_st_entry_create (nat64_db_t * db, /** * @brief Free NAT64 session table entry. * + * @param thread_index thread index. * @param db NAT64 DB. * @param ste Session table entry. */ -void nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste); +void nat64_db_st_entry_free (u32 thread_index, nat64_db_t * db, + nat64_db_st_entry_t * ste); /** * @brief Find NAT64 session table entry. @@ -301,18 +317,21 @@ void nat64_db_st_walk (nat64_db_t * db, u8 proto, /** * @brief Free expired session entries in session tables. * + * @param thread_index thread index. * @param db NAT64 DB. * @param now Current time. */ -void nad64_db_st_free_expired (nat64_db_t * db, u32 now); +void nad64_db_st_free_expired (u32 thread_index, nat64_db_t * db, u32 now); /** * @brief Free sessions using specific outside address. * + * @param thread_index thread index. * @param db NAT64 DB. * @param out_addr Outside address to match. */ -void nat64_db_free_out_addr (nat64_db_t * db, ip4_address_t * out_addr); +void nat64_db_free_out_addr (u32 thread_index, nat64_db_t * db, + ip4_address_t * out_addr); /* * @brief Get ST entry index.