Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
VAT for qos_record_enable_disable API
[vpp.git]
/
src
/
vlib
/
threads_cli.c
diff --git
a/src/vlib/threads_cli.c
b/src/vlib/threads_cli.c
index
54cc1ae
..
02bdea5
100644
(file)
--- a/
src/vlib/threads_cli.c
+++ b/
src/vlib/threads_cli.c
@@
-15,6
+15,7
@@
#define _GNU_SOURCE
#include <vppinfra/format.h>
#define _GNU_SOURCE
#include <vppinfra/format.h>
+#include <vppinfra/linux/sysfs.h>
#include <vlib/vlib.h>
#include <vlib/threads.h>
#include <vlib/vlib.h>
#include <vlib/threads.h>
@@
-97,14
+98,14
@@
show_threads_fn (vlib_main_t * vm,
u8 *p = 0;
p = format (p, "%s%u/topology/core_id%c", sys_cpu_path, lcore, 0);
u8 *p = 0;
p = format (p, "%s%u/topology/core_id%c", sys_cpu_path, lcore, 0);
-
v
lib_sysfs_read ((char *) p, "%d", &core_id);
+
c
lib_sysfs_read ((char *) p, "%d", &core_id);
vec_reset_length (p);
p =
format (p,
"%s%u/topology/physical_package_id%c",
sys_cpu_path, lcore, 0);
vec_reset_length (p);
p =
format (p,
"%s%u/topology/physical_package_id%c",
sys_cpu_path, lcore, 0);
-
v
lib_sysfs_read ((char *) p, "%d", &socket_id);
+
c
lib_sysfs_read ((char *) p, "%d", &socket_id);
vec_free (p);
line = format (line, "%-7u%-7u%-7u%", lcore, core_id, socket_id);
vec_free (p);
line = format (line, "%-7u%-7u%-7u%", lcore, core_id, socket_id);
@@
-163,21
+164,31
@@
trace_frame_queue (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (line_input, "index %u", &index))
;
else
else if (unformat (line_input, "index %u", &index))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
}
- unformat_free (line_input);
-
if (enable > 1)
if (enable > 1)
- return clib_error_return (0, "expecting on or off");
+ {
+ error = clib_error_return (0, "expecting on or off");
+ goto done;
+ }
if (vec_len (tm->frame_queue_mains) == 0)
if (vec_len (tm->frame_queue_mains) == 0)
- return clib_error_return (0, "no worker handoffs exist");
+ {
+ error = clib_error_return (0, "no worker handoffs exist");
+ goto done;
+ }
if (index > vec_len (tm->frame_queue_mains) - 1)
if (index > vec_len (tm->frame_queue_mains) - 1)
- return clib_error_return (0,
- "expecting valid worker handoff queue index");
+ {
+ error = clib_error_return (0,
+ "expecting valid worker handoff queue index");
+ goto done;
+ }
fqm = vec_elt_at_index (tm->frame_queue_mains, index);
fqm = vec_elt_at_index (tm->frame_queue_mains, index);
@@
-185,7
+196,7
@@
trace_frame_queue (vlib_main_t * vm, unformat_input_t * input,
if (num_fq == 0)
{
vlib_cli_output (vm, "No frame queues exist\n");
if (num_fq == 0)
{
vlib_cli_output (vm, "No frame queues exist\n");
-
return error
;
+
goto done
;
}
// Allocate storage for trace if necessary
}
// Allocate storage for trace if necessary
@@
-204,6
+215,10
@@
trace_frame_queue (vlib_main_t * vm, unformat_input_t * input,
memset (fqh, 0, sizeof (*fqh));
fqm->vlib_frame_queues[fqix]->trace = enable;
}
memset (fqh, 0, sizeof (*fqh));
fqm->vlib_frame_queues[fqix]->trace = enable;
}
+
+done:
+ unformat_free (line_input);
+
return error;
}
return error;
}
@@
-432,28
+447,33
@@
test_frame_queue_nelts (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (line_input, "index %u", &index))
;
else
else if (unformat (line_input, "index %u", &index))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
}
- unformat_free (line_input);
-
if (index > vec_len (tm->frame_queue_mains) - 1)
if (index > vec_len (tm->frame_queue_mains) - 1)
- return clib_error_return (0,
- "expecting valid worker handoff queue index");
+ {
+ error = clib_error_return (0,
+ "expecting valid worker handoff queue index");
+ goto done;
+ }
fqm = vec_elt_at_index (tm->frame_queue_mains, index);
if ((nelts != 4) && (nelts != 8) && (nelts != 16) && (nelts != 32))
{
fqm = vec_elt_at_index (tm->frame_queue_mains, index);
if ((nelts != 4) && (nelts != 8) && (nelts != 16) && (nelts != 32))
{
- return clib_error_return (0, "expecting 4,8,16,32");
+ error = clib_error_return (0, "expecting 4,8,16,32");
+ goto done;
}
num_fq = vec_len (fqm->vlib_frame_queues);
if (num_fq == 0)
{
vlib_cli_output (vm, "No frame queues exist\n");
}
num_fq = vec_len (fqm->vlib_frame_queues);
if (num_fq == 0)
{
vlib_cli_output (vm, "No frame queues exist\n");
-
return error
;
+
goto done
;
}
for (fqix = 0; fqix < num_fq; fqix++)
}
for (fqix = 0; fqix < num_fq; fqix++)
@@
-461,6
+481,9
@@
test_frame_queue_nelts (vlib_main_t * vm, unformat_input_t * input,
fqm->vlib_frame_queues[fqix]->nelts = nelts;
}
fqm->vlib_frame_queues[fqix]->nelts = nelts;
}
+done:
+ unformat_free (line_input);
+
return error;
}
return error;
}
@@
-499,15
+522,19
@@
test_frame_queue_threshold (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (line_input, "index %u", &index))
;
else
else if (unformat (line_input, "index %u", &index))
;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
}
- unformat_free (line_input);
-
if (index > vec_len (tm->frame_queue_mains) - 1)
if (index > vec_len (tm->frame_queue_mains) - 1)
- return clib_error_return (0,
- "expecting valid worker handoff queue index");
+ {
+ error = clib_error_return (0,
+ "expecting valid worker handoff queue index");
+ goto done;
+ }
fqm = vec_elt_at_index (tm->frame_queue_mains, index);
fqm = vec_elt_at_index (tm->frame_queue_mains, index);
@@
-515,7
+542,7
@@
test_frame_queue_threshold (vlib_main_t * vm, unformat_input_t * input,
if (threshold == ~(u32) 0)
{
vlib_cli_output (vm, "expecting threshold value\n");
if (threshold == ~(u32) 0)
{
vlib_cli_output (vm, "expecting threshold value\n");
-
return error
;
+
goto done
;
}
if (threshold == 0)
}
if (threshold == 0)
@@
-525,7
+552,7
@@
test_frame_queue_threshold (vlib_main_t * vm, unformat_input_t * input,
if (num_fq == 0)
{
vlib_cli_output (vm, "No frame queues exist\n");
if (num_fq == 0)
{
vlib_cli_output (vm, "No frame queues exist\n");
-
return error
;
+
goto done
;
}
for (fqix = 0; fqix < num_fq; fqix++)
}
for (fqix = 0; fqix < num_fq; fqix++)
@@
-533,6
+560,9
@@
test_frame_queue_threshold (vlib_main_t * vm, unformat_input_t * input,
fqm->vlib_frame_queues[fqix]->vector_threshold = threshold;
}
fqm->vlib_frame_queues[fqix]->vector_threshold = threshold;
}
+done:
+ unformat_free (line_input);
+
return error;
}
return error;
}