[ovs-dev] [PATCH 1/3] tunnel: Avoid flow_to_string() call when rate-limited.
Ben Pfaff
blp at ovn.org
Thu Dec 28 20:34:48 UTC 2017
flow_to_string() is relatively expensive. It is better to avoid it if the
string is not actually going to be used.
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ofproto/tunnel.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 1676f4d46fdf..9896d715a6f7 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -309,10 +309,11 @@ tnl_port_receive(const struct flow *flow) OVS_EXCLUDED(rwlock)
tnl_port = tnl_find(flow);
ofport = tnl_port ? tnl_port->ofport : NULL;
if (!tnl_port) {
- char *flow_str = flow_to_string(flow, NULL);
-
- VLOG_WARN_RL(&rl, "receive tunnel port not found (%s)", flow_str);
- free(flow_str);
+ if (!VLOG_DROP_WARN(&rl)) {
+ char *flow_str = flow_to_string(flow, NULL);
+ VLOG_WARN("receive tunnel port not found (%s)", flow_str);
+ free(flow_str);
+ }
goto out;
}
--
2.10.2
More information about the dev
mailing list