mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +00:00
tc: Improve logging of mismatched actions.
Currently we log the 980-ish byte long tc_action structure as a single long hex string. That is very hard to read and hard to spot the difference between two. And most of the fields are zero. Use the sparse hex dump instead as we do for keys already. Ex.: Action 1 mismatch: - Expected Action: 00000000 f0 3c 00 00 01 00 00 00-00 00 00 00 00 00 00 00 000003d0 00 00 00 00 ff ff ff ff- - Received Action: 00000000 f0 3c 00 00 01 01 00 00-00 00 00 00 00 00 00 00 000003d0 00 00 00 00 ff ff ff ff- Without the change, each action would be a 1900+ characters long string of mostly zeroes. Acked-by: Simon Horman <horms@ovn.org> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
parent
bd86266ea9
commit
a413fed99b
25
lib/tc.c
25
lib/tc.c
@ -3858,15 +3858,13 @@ log_tc_flower_match(const char *msg,
|
|||||||
|
|
||||||
ds_put_cstr(&s, "\nExpected Actions:\n");
|
ds_put_cstr(&s, "\nExpected Actions:\n");
|
||||||
for (i = 0, action = a->actions; i < a->action_count; i++, action++) {
|
for (i = 0, action = a->actions; i < a->action_count; i++, action++) {
|
||||||
ds_put_cstr(&s, " - ");
|
ds_put_format(&s, " - %d -\n", i);
|
||||||
ds_put_hex(&s, action, sizeof *action);
|
ds_put_sparse_hex_dump(&s, action, sizeof *action, 0, false);
|
||||||
ds_put_cstr(&s, "\n");
|
|
||||||
}
|
}
|
||||||
ds_put_cstr(&s, "Received Actions:\n");
|
ds_put_cstr(&s, "\nReceived Actions:\n");
|
||||||
for (i = 0, action = b->actions; i < b->action_count; i++, action++) {
|
for (i = 0, action = b->actions; i < b->action_count; i++, action++) {
|
||||||
ds_put_cstr(&s, " - ");
|
ds_put_format(&s, " - %d -\n", i);
|
||||||
ds_put_hex(&s, action, sizeof *action);
|
ds_put_sparse_hex_dump(&s, action, sizeof *action, 0, false);
|
||||||
ds_put_cstr(&s, "\n");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Only dump the delta in actions. */
|
/* Only dump the delta in actions. */
|
||||||
@ -3875,12 +3873,13 @@ log_tc_flower_match(const char *msg,
|
|||||||
|
|
||||||
for (int i = 0; i < a->action_count; i++, action_a++, action_b++) {
|
for (int i = 0; i < a->action_count; i++, action_a++, action_b++) {
|
||||||
if (memcmp(action_a, action_b, sizeof *action_a)) {
|
if (memcmp(action_a, action_b, sizeof *action_a)) {
|
||||||
ds_put_format(&s,
|
ds_put_format(&s, "\nAction %d mismatch:\n"
|
||||||
"\nAction %d mismatch:\n - Expected Action: ",
|
" - Expected Action:\n", i);
|
||||||
i);
|
ds_put_sparse_hex_dump(&s, action_a, sizeof *action_a,
|
||||||
ds_put_hex(&s, action_a, sizeof *action_a);
|
0, false);
|
||||||
ds_put_cstr(&s, "\n - Received Action: ");
|
ds_put_cstr(&s, " - Received Action:\n");
|
||||||
ds_put_hex(&s, action_b, sizeof *action_b);
|
ds_put_sparse_hex_dump(&s, action_b, sizeof *action_b,
|
||||||
|
0, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user