diff mbox

[ovs-dev,PATCHv2] ofproto-dpif-xlate: Log flow in XLATE_REPORT_ERROR.

Message ID 20160811193616.24446-1-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer Aug. 11, 2016, 7:36 p.m. UTC
To assist debugging pipelines when resubmit resource checks fail, print
the base_flow from the translation context. This base flow can then be
used from ofproto/trace to figure out which parts of the pipeline lead
to this translation error.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 ofproto/ofproto-dpif-xlate.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

Comments

Ben Pfaff Aug. 11, 2016, 8:42 p.m. UTC | #1
On Thu, Aug 11, 2016 at 12:36:16PM -0700, Joe Stringer wrote:
> To assist debugging pipelines when resubmit resource checks fail, print
> the base_flow from the translation context. This base flow can then be
> used from ofproto/trace to figure out which parts of the pipeline lead
> to this translation error.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>

Acked-by: Ben Pfaff <blp@ovn.org>
Joe Stringer Aug. 11, 2016, 9:54 p.m. UTC | #2
On 11 August 2016 at 13:42, Ben Pfaff <blp@ovn.org> wrote:
> On Thu, Aug 11, 2016 at 12:36:16PM -0700, Joe Stringer wrote:
>> To assist debugging pipelines when resubmit resource checks fail, print
>> the base_flow from the translation context. This base flow can then be
>> used from ofproto/trace to figure out which parts of the pipeline lead
>> to this translation error.
>>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>
> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks, applied to master.
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 393854e4bfc7..1e375b58f195 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -627,13 +627,19 @@  xlate_report(struct xlate_ctx *ctx, const char *format, ...)
 
 static struct vlog_rate_limit error_report_rl = VLOG_RATE_LIMIT_INIT(1, 5);
 
-#define XLATE_REPORT_ERROR(CTX, ...)                    \
-    do {                                                \
-        if (OVS_UNLIKELY((CTX)->xin->report_hook)) {    \
-            xlate_report(CTX, __VA_ARGS__);             \
-        } else {                                        \
-            VLOG_ERR_RL(&error_report_rl, __VA_ARGS__); \
-        }                                               \
+#define XLATE_REPORT_ERROR(CTX, ...)                            \
+    do {                                                        \
+        if (OVS_UNLIKELY((CTX)->xin->report_hook)) {            \
+            xlate_report(CTX, __VA_ARGS__);                     \
+        } else {                                                \
+            struct ds ds = DS_EMPTY_INITIALIZER;                \
+                                                                \
+            ds_put_format(&ds, __VA_ARGS__);                    \
+            ds_put_cstr(&ds, ": ");                             \
+            flow_format(&ds, &ctx->base_flow);                  \
+            VLOG_ERR_RL(&error_report_rl, ds_cstr(&ds));        \
+            ds_destroy(&ds);                                    \
+        }                                                       \
     } while (0)
 
 static inline void