From patchwork Thu Aug 11 19:36:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 658318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3s9JDR4kDQz9sDf for ; Fri, 12 Aug 2016 05:36:39 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 9911B10C6A; Thu, 11 Aug 2016 12:36:38 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id B6A4710C63 for ; Thu, 11 Aug 2016 12:36:36 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 4A69B420249 for ; Thu, 11 Aug 2016 13:36:36 -0600 (MDT) X-ASG-Debug-ID: 1470944195-09eadd61e31c7a0001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar5.cudamail.com with ESMTP id UbWEegaAWk1EmpxQ (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 11 Aug 2016 13:36:35 -0600 (MDT) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO relay2-d.mail.gandi.net) (217.70.183.194) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 11 Aug 2016 19:36:34 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at ovn.org designates 217.70.183.194 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.194 X-Barracuda-RBL-IP: 217.70.183.194 Received: from mfilter31-d.gandi.net (mfilter31-d.gandi.net [217.70.178.162]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 0D364C5A55; Thu, 11 Aug 2016 21:36:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter31-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter31-d.gandi.net (mfilter31-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 6GCZFXlUwV1J; Thu, 11 Aug 2016 21:36:31 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from archer.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B6E39C5A43; Thu, 11 Aug 2016 21:36:30 +0200 (CEST) X-CudaMail-Envelope-Sender: joe@ovn.org From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-810042575 X-CudaMail-DTE: 081116 X-CudaMail-Originating-IP: 217.70.183.194 Date: Thu, 11 Aug 2016 12:36:16 -0700 X-ASG-Orig-Subj: [##CM-V1-810042575##][PATCHv2] ofproto-dpif-xlate: Log flow in XLATE_REPORT_ERROR. Message-Id: <20160811193616.24446-1-joe@ovn.org> X-Mailer: git-send-email 2.9.2 X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1470944195 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCHv2] ofproto-dpif-xlate: Log flow in XLATE_REPORT_ERROR. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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 Acked-by: Ben Pfaff --- ofproto/ofproto-dpif-xlate.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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