diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2019-10-30 16:58:30 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-11-01 14:52:38 +0000 |
commit | f9d784b6b9d3acf141ccccf3faf51f409f405294 (patch) | |
tree | 4ea3c9b7d9583ca4810c207672e09b251ccade06 | |
parent | 3edd1bbe6a03e939eeb3eabbce0d4bda995c7ec1 (diff) |
quic: fifo size is u32
- Fix cli / config fifo size to only accept u32
size input.
- Make cli / config fifo-size input type handling
to be the same as vpp hoststack
- Update external transfer tests to use new
syntax with different fifo sizes for
vpp_echo client/server and vpp.
Type: fix
Change-Id: Ia5ddb2b8d3d9908ab502352819eebeec8ac0971d
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r-- | src/plugins/quic/quic.c | 37 | ||||
-rw-r--r-- | src/plugins/quic/quic.h | 4 | ||||
-rw-r--r-- | src/plugins/quic/test/test_quic.py | 9 |
3 files changed, 32 insertions, 18 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index 66796c7fb49..d9d58449f7e 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -2205,15 +2205,25 @@ quic_plugin_set_fifo_size_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { + quic_main_t *qm = &quic_main; unformat_input_t _line_input, *line_input = &_line_input; + uword tmp; + if (!unformat_user (input, unformat_line_input, line_input)) return 0; while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { - if (unformat - (line_input, "%U", unformat_data_size, &quic_main.udp_fifo_size)) - quic_update_fifo_size (); + if (unformat (line_input, "%U", unformat_memory_size, &tmp)) + { + if (tmp >= 0x100000000ULL) + { + return clib_error_return + (0, "fifo-size %llu (0x%llx) too large", tmp, tmp); + } + qm->udp_fifo_size = tmp; + quic_update_fifo_size (); + } else return clib_error_return (0, "unknown input '%U'", format_unformat_error, line_input); @@ -2273,7 +2283,7 @@ VLIB_CLI_COMMAND (quic_plugin_crypto_command, static) = VLIB_CLI_COMMAND(quic_plugin_set_fifo_size_command, static)= { .path = "quic set fifo-size", - .short_help = "quic set fifo-size N[Kb|Mb|GB] (default 64K)", + .short_help = "quic set fifo-size N[K|M|G] (default 64K)", .function = quic_plugin_set_fifo_size_command_fn, }; VLIB_CLI_COMMAND(quic_plugin_stats_command, static)= @@ -2293,15 +2303,22 @@ VLIB_PLUGIN_REGISTER () = static clib_error_t * quic_config_fn (vlib_main_t * vm, unformat_input_t * input) { - quic_main.udp_fifo_size = QUIC_DEFAULT_FIFO_SIZE; - quic_main.udp_fifo_prealloc = 0; + quic_main_t *qm = &quic_main; + uword tmp; + qm->udp_fifo_size = QUIC_DEFAULT_FIFO_SIZE; + qm->udp_fifo_prealloc = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { - if (unformat - (input, "fifo-size %U", unformat_data_size, - &quic_main.udp_fifo_size)) - ; + if (unformat (input, "fifo-size %U", unformat_memory_size, &tmp)) + { + if (tmp >= 0x100000000ULL) + { + return clib_error_return + (0, "fifo-size %llu (0x%llx) too large", tmp, tmp); + } + qm->udp_fifo_size = tmp; + } else if (unformat (input, "fifo-prealloc %u", &quic_main.udp_fifo_prealloc)) diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h index 85c78dd7871..88a8885ed6c 100644 --- a/src/plugins/quic/quic.h +++ b/src/plugins/quic/quic.h @@ -193,8 +193,8 @@ typedef struct quic_main_ ptls_handshake_properties_t hs_properties; quicly_cid_plaintext_t next_cid; - u64 udp_fifo_size; - u64 udp_fifo_prealloc; + u32 udp_fifo_size; + u32 udp_fifo_prealloc; } quic_main_t; #endif /* __included_quic_h__ */ diff --git a/src/plugins/quic/test/test_quic.py b/src/plugins/quic/test/test_quic.py index 48ef55f4157..13c6a9ae56e 100644 --- a/src/plugins/quic/test/test_quic.py +++ b/src/plugins/quic/test/test_quic.py @@ -200,16 +200,14 @@ class QUICEchoExtTestCase(QUICTestCase): "uri", self.uri, "json", - "fifo-size", "64", self.test_bytes, "socket-name", self.api_sock, "quic-setup", self.quic_setup] self.server_echo_test_args = common_args + \ - ["server", "appns", "server"] + ["server", "appns", "server"] # use default fifo-size self.client_echo_test_args = common_args + \ - ["client", "appns", "client"] - error = self.vapi.cli( - "quic set fifo-size 4Mb") + ["client", "appns", "client", "fifo-size", "4M"] + error = self.vapi.cli("quic set fifo-size 2M") if error: self.logger.critical(error) self.assertNotIn("failed", error) @@ -373,7 +371,6 @@ class QUICEchoExtServerStreamTestCase(QUICEchoExtTestCase): """QUIC Echo External Transfer Server Stream Test Case""" quic_setup = "serverstream" - @unittest.skipUnless(running_extended_tests, "part of extended tests") def test_quic_ext_transfer_server_stream(self): self.server("TX=10Mb", "RX=0") self.client("TX=0", "RX=10Mb") |