From e345ee5cb94cb28cac4ba62af67c2c540916a429 Mon Sep 17 00:00:00 2001 From: Elias Rudberg Date: Tue, 26 Jan 2021 13:56:45 +0100 Subject: nat: configurable handoff frame queue size Make number of worker handoff frame queue elements configurable as a set nat frame-queue-nelts command. The default value is 64 which is the same value that was previously hard-coded. The idea is that allowing larger values can be useful in some cases, to avoid congestion drops. Also add nat_set_fq_options API support and a corresponding test case. Type: improvement Change-Id: I5c321eb2d7997f76fac2703d9c4a5b2516375db3 Signed-off-by: Elias Rudberg --- src/plugins/nat/nat.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/plugins/nat/nat.h') diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h index 86f6342ab09..d7f60dd2145 100644 --- a/src/plugins/nat/nat.h +++ b/src/plugins/nat/nat.h @@ -36,8 +36,8 @@ #include #include -/* number of worker handoff frame queue elements */ -#define NAT_FQ_NELTS 64 +/* default number of worker handoff frame queue elements */ +#define NAT_FQ_NELTS_DEFAULT 64 /* NAT buffer flags */ #define SNAT_FLAG_HAIRPINNING (1 << 0) @@ -782,6 +782,9 @@ typedef struct snat_main_s /* pat - dynamic mapping enabled or conneciton tracking */ u8 pat; + /* number of worker handoff frame queue elements */ + u32 frame_queue_nelts; + /* nat44 plugin enabled */ u8 enabled; @@ -1298,6 +1301,15 @@ clib_error_t *nat44_api_hookup (vlib_main_t * vm); */ int snat_set_workers (uword * bitmap); +/** + * @brief Set NAT plugin number of frame queue elements + * + * @param frame_queue_nelts number of worker handoff frame queue elements + * + * @return 0 on success, non-zero value otherwise + */ +int snat_set_frame_queue_nelts (u32 frame_queue_nelts); + /** * @brief Enable/disable NAT44 feature on the interface * -- cgit 1.2.3-korg