aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/cli.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-21 11:48:34 +0100
committerDave Barach <openvpp@barachs.net>2019-01-30 16:19:22 +0000
commit910d3694e8b22c9d14e5f2913d14ae149e184620 (patch)
treee4993e93e4d7dba51a5898e82bb6149a3e4bd7ba /src/plugins/dpdk/device/cli.c
parent4fd5a9d3e6abdf61f266da8400a299fe5b0eb0ed (diff)
buffers: major cleanup and improvements
This patch introduces following changes: - deprecated free lists which are not used and not compatible with external buffer managers (i.e. DPDK) - introduces native support for per-numa buffer pools - significantly improves performance of buffer alloc and free Change-Id: I4a8e723ae47056717afd6cac0efe87cb731b5be7 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/device/cli.c')
-rw-r--r--src/plugins/dpdk/device/cli.c91
1 files changed, 19 insertions, 72 deletions
diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c
index bbe367f7ec5..209f4ed51ed 100644
--- a/src/plugins/dpdk/device/cli.c
+++ b/src/plugins/dpdk/device/cli.c
@@ -382,27 +382,27 @@ static clib_error_t *
show_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- struct rte_mempool *rmp;
- int i;
+ vlib_buffer_main_t *bm = vm->buffer_main;
+ vlib_buffer_pool_t *bp;
- for (i = 0; i < vec_len (dpdk_main.pktmbuf_pools); i++)
- {
- rmp = dpdk_main.pktmbuf_pools[i];
- if (rmp)
- {
- unsigned count = rte_mempool_avail_count (rmp);
- unsigned free_count = rte_mempool_in_use_count (rmp);
+ vec_foreach (bp, bm->buffer_pools)
+ {
+ struct rte_mempool *rmp = dpdk_mempool_by_buffer_pool_index[bp->index];
+ if (rmp)
+ {
+ unsigned count = rte_mempool_avail_count (rmp);
+ unsigned free_count = rte_mempool_in_use_count (rmp);
- vlib_cli_output (vm,
- "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
- rmp->name, (u32) count, (u32) free_count,
- (u32) (count + free_count));
- }
- else
- {
- vlib_cli_output (vm, "rte_mempool is NULL (!)\n");
- }
- }
+ vlib_cli_output (vm,
+ "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
+ rmp->name, (u32) count, (u32) free_count,
+ (u32) (count + free_count));
+ }
+ else
+ {
+ vlib_cli_output (vm, "rte_mempool is NULL (!)\n");
+ }
+ }
return 0;
}
@@ -2018,59 +2018,6 @@ VLIB_CLI_COMMAND (show_vpe_version_command, static) = {
};
/* *INDENT-ON* */
-#if CLI_DEBUG
-
-static clib_error_t *
-dpdk_validate_buffers_fn (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd_arg)
-{
- u32 n_invalid_bufs = 0, uninitialized = 0;
- u32 is_poison = 0, is_test = 0;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "poison"))
- is_poison = 1;
- else if (unformat (input, "trajectory"))
- is_test = 1;
- else
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
- }
-
- if (VLIB_BUFFER_TRACE_TRAJECTORY == 0)
- {
- vlib_cli_output (vm, "Trajectory not enabled. Recompile with "
- "VLIB_BUFFER_TRACE_TRAJECTORY 1");
- return 0;
- }
- if (is_poison)
- {
- dpdk_buffer_poison_trajectory_all ();
- }
- if (is_test)
- {
- n_invalid_bufs = dpdk_buffer_validate_trajectory_all (&uninitialized);
- if (!n_invalid_bufs)
- vlib_cli_output (vm, "All buffers are valid %d uninitialized",
- uninitialized);
- else
- vlib_cli_output (vm, "Found %d invalid buffers and %d uninitialized",
- n_invalid_bufs, uninitialized);
- }
- return 0;
-}
-
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (test_dpdk_buffers_command, static) =
-{
- .path = "test dpdk buffers",
- .short_help = "test dpdk buffers [poison] [trajectory]",
- .function = dpdk_validate_buffers_fn,
-};
-/* *INDENT-ON* */
-
-#endif
-
clib_error_t *
dpdk_cli_init (vlib_main_t * vm)
{