Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
quic: disable vnet_crypto and batching if no crypto engines are loaded
[vpp.git]
/
src
/
vlib
/
unix
/
cj.c
diff --git
a/src/vlib/unix/cj.c
b/src/vlib/unix/cj.c
index
33ba163
..
e163e1a
100644
(file)
--- a/
src/vlib/unix/cj.c
+++ b/
src/vlib/unix/cj.c
@@
-19,7
+19,7
@@
/**
* @file
/**
* @file
- * Circular jo
o
urnal diagnostic mechanism.
+ * Circular journal diagnostic mechanism.
*
* The @c cj thread-safe circular log buffer scheme is occasionally useful
* when chasing bugs. Calls to it should not be checked in.
*
* The @c cj thread-safe circular log buffer scheme is occasionally useful
* when chasing bugs. Calls to it should not be checked in.
@@
-44,11
+44,11
@@
cj_log (u32 type, void *data0, void *data1)
if (cjm->enable == 0)
return;
if (cjm->enable == 0)
return;
- new_tail =
__sync_add_an
d_fetch (&cjm->tail, 1);
+ new_tail =
clib_atomic_ad
d_fetch (&cjm->tail, 1);
r = (cj_record_t *) & (cjm->records[new_tail & (cjm->num_records - 1)]);
r->time = vlib_time_now (cjm->vlib_main);
r = (cj_record_t *) & (cjm->records[new_tail & (cjm->num_records - 1)]);
r->time = vlib_time_now (cjm->vlib_main);
- r->
cpu = os_get_cpu_number
();
+ r->
thread_index = vlib_get_thread_index
();
r->type = type;
r->data[0] = pointer_to_uword (data0);
r->data[1] = pointer_to_uword (data1);
r->type = type;
r->data[0] = pointer_to_uword (data0);
r->data[1] = pointer_to_uword (data1);
@@
-97,7
+97,7
@@
cj_config (vlib_main_t * vm, unformat_input_t * input)
cjm->num_records = max_pow2 (cjm->num_records);
vec_validate (cjm->records, cjm->num_records - 1);
cjm->num_records = max_pow2 (cjm->num_records);
vec_validate (cjm->records, cjm->num_records - 1);
- memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
+
clib_
memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
cjm->tail = ~0;
cjm->enable = enable;
cjm->tail = ~0;
cjm->enable = enable;
@@
-106,7
+106,7
@@
cj_config (vlib_main_t * vm, unformat_input_t * input)
/*?
* Configure the circular journal diagnostic mechanism. This is only useful
/*?
* Configure the circular journal diagnostic mechanism. This is only useful
- * if you, the deveoper, have written code to make use of the circular
+ * if you, the deve
l
oper, have written code to make use of the circular
* journal.
*
* @cfgcmd{records, <number>}
* journal.
*
* @cfgcmd{records, <number>}
@@
-133,7
+133,8
@@
static inline void
cj_dump_one_record (cj_record_t * r)
{
fprintf (stderr, "[%d]: %10.6f T%02d %llx %llx\n",
cj_dump_one_record (cj_record_t * r)
{
fprintf (stderr, "[%d]: %10.6f T%02d %llx %llx\n",
- r->cpu, r->time, r->type, (long long unsigned int) r->data[0],
+ r->thread_index, r->time, r->type,
+ (long long unsigned int) r->data[0],
(long long unsigned int) r->data[1]);
}
(long long unsigned int) r->data[1]);
}
@@
-161,7
+162,7
@@
cj_dump_internal (u8 filter0_enable, u64 filter0,
index = (cjm->tail + 1) & (cjm->num_records - 1);
r = &(cjm->records[index]);
index = (cjm->tail + 1) & (cjm->num_records - 1);
r = &(cjm->records[index]);
- if (r->
cpu
!= (u32) ~ 0)
+ if (r->
thread_index
!= (u32) ~ 0)
{
/* Yes, dump from tail + 1 to the end */
for (i = index; i < cjm->num_records; i++)
{
/* Yes, dump from tail + 1 to the end */
for (i = index; i < cjm->num_records; i++)
@@
-177,7
+178,7
@@
cj_dump_internal (u8 filter0_enable, u64 filter0,
}
/* dump from the beginning through the final tail */
r = cjm->records;
}
/* dump from the beginning through the final tail */
r = cjm->records;
- for (i = 0; i <
= cjm->tail
; i++)
+ for (i = 0; i <
index
; i++)
{
if (filter0_enable && (r->data[0] != filter0))
goto skip2;
{
if (filter0_enable && (r->data[0] != filter0))
goto skip2;
@@
-219,18
+220,28
@@
cj_command_fn (vlib_main_t * vm,
{
int is_enable = -1;
int is_dump = -1;
{
int is_enable = -1;
int is_dump = -1;
+ unformat_input_t _line_input, *line_input = &_line_input;
+ clib_error_t *error = NULL;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ /* Get a line of input. */
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return clib_error_return (0, "expected enable | disable | dump");
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
{
- if (unformat (
input, "enable") || unformat (
input, "on"))
+ if (unformat (
line_input, "enable") || unformat (line_
input, "on"))
is_enable = 1;
is_enable = 1;
- else if (unformat (input, "disable") || unformat (input, "off"))
+ else if (unformat (line_input, "disable")
+ || unformat (line_input, "off"))
is_enable = 0;
is_enable = 0;
- else if (unformat (input, "dump"))
+ else if (unformat (
line_
input, "dump"))
is_dump = 1;
else
is_dump = 1;
else
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
+ {
+ error = clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
if (is_enable >= 0)
}
if (is_enable >= 0)
@@
-239,13
+250,15
@@
cj_command_fn (vlib_main_t * vm,
if (is_dump > 0)
cj_dump ();
if (is_dump > 0)
cj_dump ();
- return 0;
+done:
+ unformat_free (line_input);
+ return error;
}
/*?
* Enable, disable the collection of diagnostic data into a
* circular journal or dump the circular journal diagnostic data.
}
/*?
* Enable, disable the collection of diagnostic data into a
* circular journal or dump the circular journal diagnostic data.
- * This is only useful if you, the deveoper, have written code to make
+ * This is only useful if you, the deve
l
oper, have written code to make
* use of the circular journal.
*
* When dumping the data it is formatted and sent to @c stderr of the
* use of the circular journal.
*
* When dumping the data it is formatted and sent to @c stderr of the