summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-24 13:58:05 -0700
committerDamjan Marion <dmarion@me.com>2018-09-25 07:42:08 +0000
commitca031860c3dd48929230825aed2c166d032ee1f0 (patch)
tree0dc102b56d222f0666d4f0067b618610770a4d19 /src/vnet
parent2e08b1aa6a44c8346d9cbdc8acec55896327cc63 (diff)
tcp: add option to cfg max rx fifo size
Change-Id: Icff3d688506e7658330db004c58bcfcac273fcec Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/tcp/tcp.c13
-rw-r--r--src/vnet/tcp/tcp.h16
-rw-r--r--src/vnet/tcp/tcp_output.c3
3 files changed, 22 insertions, 10 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 45eaf016b1e..d00f4abb118 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -765,8 +765,9 @@ format_tcp_vars (u8 * s, va_list * args)
tc->snd_una_max - tc->iss);
s = format (s, " rcv_nxt %u rcv_las %u\n",
tc->rcv_nxt - tc->irs, tc->rcv_las - tc->irs);
- s = format (s, " snd_wnd %u rcv_wnd %u snd_wl1 %u snd_wl2 %u\n",
- tc->snd_wnd, tc->rcv_wnd, tc->snd_wl1 - tc->irs,
+ s = format (s, " snd_wnd %u rcv_wnd %u rcv_wscale %u ",
+ tc->snd_wnd, tc->rcv_wnd, tc->rcv_wscale);
+ s = format (s, "snd_wl1 %u snd_wl2 %u\n", tc->snd_wl1 - tc->irs,
tc->snd_wl2 - tc->iss);
s = format (s, " flight size %u out space %u cc space %u rcv_wnd_av %u\n",
tcp_flight_size (tc), tcp_available_output_snd_space (tc),
@@ -1388,9 +1389,8 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input)
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat
- (input, "preallocated-connections %d",
- &tm->preallocated_connections))
+ if (unformat (input, "preallocated-connections %d",
+ &tm->preallocated_connections))
;
else if (unformat (input, "preallocated-half-open-connections %d",
&tm->preallocated_half_open_connections))
@@ -1398,6 +1398,9 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "buffer-fail-fraction %f",
&tm->buffer_fail_fraction))
;
+ else if (unformat (input, "max-rx-fifo %U", unformat_memory_size,
+ &tm->max_rx_fifo))
+ ;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index e4168c4b701..37b4573cf25 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -32,7 +32,7 @@
#define TCP_MAX_OPTION_SPACE 40
#define TCP_DUPACK_THRESHOLD 3
-#define TCP_MAX_RX_FIFO_SIZE 4 << 20
+#define TCP_MAX_RX_FIFO_SIZE 32 << 20
#define TCP_MIN_RX_FIFO_SIZE 4 << 10
#define TCP_IW_N_SEGMENTS 10
#define TCP_ALWAYS_ACK 1 /**< On/off delayed acks */
@@ -408,9 +408,20 @@ typedef struct _tcp_main
/* Congestion control algorithms registered */
tcp_cc_algorithm_t *cc_algos;
+ /** vlib buffer size */
+ u32 bytes_per_buffer;
+
+ /*
+ * Configuration
+ */
+
/* Flag that indicates if stack is on or off */
u8 is_enabled;
+ /** Max rx fifo size for a session. It is used in to compute the
+ * rfc 7323 window scaling factor */
+ u32 max_rx_fifo;
+
/** Number of preallocated connections */
u32 preallocated_connections;
u32 preallocated_half_open_connections;
@@ -421,9 +432,6 @@ typedef struct _tcp_main
u32 last_v6_address_rotor;
ip6_address_t *ip6_src_addresses;
- /** vlib buffer size */
- u32 bytes_per_buffer;
-
u8 punt_unknown4;
u8 punt_unknown6;
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index f37958e12f2..0d5feb976f8 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -118,12 +118,13 @@ tcp_initial_wnd_unscaled (tcp_connection_t * tc)
u32
tcp_initial_window_to_advertise (tcp_connection_t * tc)
{
+ tcp_main_t *tm = &tcp_main;
u32 max_fifo;
/* Initial wnd for SYN. Fifos are not allocated yet.
* Use some predefined value. For SYN-ACK we still want the
* scale to be computed in the same way */
- max_fifo = TCP_MAX_RX_FIFO_SIZE;
+ max_fifo = tm->max_rx_fifo ? tm->max_rx_fifo : TCP_MAX_RX_FIFO_SIZE;
tc->rcv_wscale = tcp_window_compute_scale (max_fifo);
tc->rcv_wnd = tcp_initial_wnd_unscaled (tc);