diff options
author | Zak Whittington <zwhitt.vmware@gmail.com> | 2018-08-07 14:13:17 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-08-07 14:23:47 -0700 |
commit | f89547e2c893d71a2c1178363212413f2e58914a (patch) | |
tree | feaf5ff6a8a7ff3b84836f4683f2fc7d32de2343 /ofproto | |
parent | 7e5f6b1e1617def60ed8161c1de009f68aa72cdd (diff) | |
download | openvswitch-f89547e2c893d71a2c1178363212413f2e58914a.tar.gz |
ofproto-dpif-xlate: use new info-level logging helper when sending out an in_port
Added new helper function similar to xlate_report_error called
xlate_report_info that logs info-level messages, and used that
function to add an extra log message when attempting to send
out an in-port.
VMware-BZ: 2158607
Signed-off-by: Zak Whittington <zwhitt.vmware@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif-xlate.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 01f1fafeb..aa169bff3 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -674,6 +674,34 @@ xlate_report_error(const struct xlate_ctx *ctx, const char *format, ...) ds_destroy(&s); } +/* This is like xlate_report() for messages that should be logged + at the info level (even when not tracing). */ +static void OVS_PRINTF_FORMAT(2, 3) +xlate_report_info(const struct xlate_ctx *ctx, const char *format, ...) +{ + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + if (!OVS_UNLIKELY(ctx->xin->trace) + && (!ctx->xin->packet || VLOG_DROP_INFO(&rl))) { + return; + } + + struct ds s = DS_EMPTY_INITIALIZER; + va_list args; + va_start(args, format); + ds_put_format_valist(&s, format, args); + va_end(args); + + if (ctx->xin->trace) { + oftrace_report(ctx->xin->trace, OFT_WARN, ds_cstr(&s)); + } else { + ds_put_format(&s, " on bridge %s while processing ", + ctx->xbridge->name); + flow_format(&s, &ctx->base_flow, NULL); + VLOG_INFO("%s", ds_cstr(&s)); + } + ds_destroy(&s); +} + /* This is like xlate_report() for messages that should be logged at debug * level (even if we are not tracing) because they can be valuable for * debugging. */ @@ -5007,7 +5035,7 @@ xlate_output_action(struct xlate_ctx *ctx, ofp_port_t port, if (port != ctx->xin->flow.in_port.ofp_port) { compose_output_action(ctx, port, NULL, is_last_action, truncate); } else { - xlate_report(ctx, OFT_WARN, "skipping output to input port"); + xlate_report_info(ctx, "skipping output to input port"); } break; } @@ -5092,7 +5120,7 @@ xlate_output_trunc_action(struct xlate_ctx *ctx, ctx->xout->slow |= SLOW_ACTION; } } else { - xlate_report(ctx, OFT_WARN, "skipping output to input port"); + xlate_report_info(ctx, "skipping output to input port"); } break; } |