nuttx/net/nat/Kconfig
Zhe Weng 879c337e30 net/nat: Use hashtable to optimize performance
Performance tested on simulator:

Before optimization:      -25% bandwidth @2k entries, -64% @10k entries
hashtable size=  2(1bit): -24% bandwidth @2k entries, -65% @10k entries
hashtable size=  4(2bits):-15% bandwidth @2k entries, -51% @10k entries
hashtable size= 32(5bits): -3% bandwidth @2k entries, -14% @10k entries
hashtable size=256(8bits): -1% bandwidth @2k entries,  -3% @10k entries

Note: Tested on worst performance, the earliest entry will be the worst.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-12-22 20:20:12 +08:00

56 lines
1.5 KiB
Plaintext

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config NET_NAT
bool "Network Address Translation (NAT)"
default n
depends on NET_IPFORWARD && IOB_BUFSIZE >= 68
---help---
Enable or disable Network Address Translation (NAT) function.
Note: When forwarding IPv4 packet and applying NAT, NAT may be
applied directly on a single I/O buffer containing L3 packet header,
and NAT may need a continuous buffer of at least 68 Bytes
(IPv4 20B + ICMP 8B + IPv4 20B + TCP 20B).
config NET_NAT_HASH_BITS
int "The bits of NAT entry hashtable"
default 5
range 1 10
depends on NET_NAT
---help---
The hashtable of NAT entries will have (1 << bits) buckets.
config NET_NAT_TCP_EXPIRE_SEC
int "TCP NAT entry expiration seconds"
default 86400
depends on NET_NAT
---help---
The expiration time for idle TCP entry in NAT.
Note: The default value 86400 is suggested by RFC2663, Section 2.6,
Page 5.
config NET_NAT_UDP_EXPIRE_SEC
int "UDP NAT entry expiration seconds"
default 240
depends on NET_NAT
---help---
The expiration time for idle UDP entry in NAT.
Note: RFC2663 (Section 2.6, Page 5) suggests that non-TCP sessions
that have not been used for a couple of minutes can be assumed to be
terminated.
config NET_NAT_ICMP_EXPIRE_SEC
int "ICMP NAT entry expiration seconds"
default 60
depends on NET_NAT
---help---
The expiration time for idle ICMP entry in NAT.
Note: The default value 60 is suggested by RFC5508, Section 3.2,
Page 8.