summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-01-12 08:15:02 -0800
committerBen Pfaff <blp@ovn.org>2017-01-12 08:58:20 -0800
commit2d9b49dd92bfbd040da5ad60b84d0629a355b099 (patch)
tree39dd0d57ec7745dd4236d9e1f8d1f3c7d51137bd /lib
parent9fff138ec3a6dbe75073d16cba7fbe86ac273c36 (diff)
downloadopenvswitch-2d9b49dd92bfbd040da5ad60b84d0629a355b099.tar.gz
ofproto-dpif: Make ofproto/trace output easier to read.
"ovs-appctl ofproto/trace" is invaluable for debugging, but as the users of Open vSwitch have evolved it has failed to keep up with the times. It's pretty easy to design OpenFlow tables and pipelines that resubmit dozens of times. Each resubmit causes an additional tab of indentation, so the output wraps around, sometimes again and again, and makes the output close to unreadable. ovn-trace pioneered better formatting for tracing in OVN logical datapaths, mostly by not increasing indentation for tail recursion, which in practice gets rid of almost all indentation. This commit experiments with redoing ofproto/trace the same way. Try looking at, for example, the testsuite output for test 2282 "ovn -- 3 HVs, 3 LRs connected via LS, source IP based routes". Without this commit, it indents 61 levels (488 spaces!). With this commit, it indents 1 level (4 spaces) and it's possible to actually understand what's going on almost at a glance. To see this for yourself, try the following command either with or without this commit (but be sure to keep the change to ovn.at that adds an ofproto/trace to the test): make check TESTSUITEFLAGS='-d 2282' && less tests/testsuite.dir/2282/testsuite.log Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Lance Richardson <lrichard@redhat.com> Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/nx-match.c15
-rw-r--r--lib/nx-match.h6
2 files changed, 8 insertions, 13 deletions
diff --git a/lib/nx-match.c b/lib/nx-match.c
index e990aedbd..a7589ff8a 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1768,15 +1768,13 @@ nxm_execute_stack_push(const struct ofpact_stack *push,
nx_stack_push(stack, &dst_value.u8[sizeof dst_value - bytes], bytes);
}
-void
+bool
nxm_execute_stack_pop(const struct ofpact_stack *pop,
struct flow *flow, struct flow_wildcards *wc,
struct ofpbuf *stack)
{
uint8_t src_bytes;
const void *src = nx_stack_pop(stack, &src_bytes);
-
- /* Only pop if stack is not empty. Otherwise, give warning. */
if (src) {
union mf_subvalue src_value;
uint8_t dst_bytes = DIV_ROUND_UP(pop->subfield.n_bits, 8);
@@ -1790,13 +1788,10 @@ nxm_execute_stack_pop(const struct ofpact_stack *pop,
(union mf_subvalue *)&exact_match_mask,
&wc->masks);
mf_write_subfield_flow(&pop->subfield, &src_value, flow);
+ return true;
} else {
- if (!VLOG_DROP_WARN(&rl)) {
- char *flow_str = flow_to_string(flow);
- VLOG_WARN_RL(&rl, "Failed to pop from an empty stack. On flow\n"
- " %s", flow_str);
- free(flow_str);
- }
+ /* Attempted to pop from an empty stack. */
+ return false;
}
}
diff --git a/lib/nx-match.h b/lib/nx-match.h
index ab093e1f8..0ba9f5e35 100644
--- a/lib/nx-match.h
+++ b/lib/nx-match.h
@@ -132,9 +132,9 @@ void *nx_stack_pop(struct ofpbuf *stack, uint8_t *bytes);
void nxm_execute_stack_push(const struct ofpact_stack *,
const struct flow *, struct flow_wildcards *,
struct ofpbuf *);
-void nxm_execute_stack_pop(const struct ofpact_stack *,
- struct flow *, struct flow_wildcards *,
- struct ofpbuf *);
+bool nxm_execute_stack_pop(const struct ofpact_stack *,
+ struct flow *, struct flow_wildcards *,
+ struct ofpbuf *);
ovs_be64 oxm_bitmap_from_mf_bitmap(const struct mf_bitmap *, enum ofp_version);
struct mf_bitmap oxm_bitmap_to_mf_bitmap(ovs_be64 oxm_bitmap,