[ovs-dev] [PATCH 1/3] tunnel: Avoid flow_to_string() call when rate-limited.

Yifeng Sun pkusunyifeng at gmail.com
Thu Dec 28 22:30:33 UTC 2017


Looks good, thanks for the change.

Reviewed-by: Yifeng Sun <pkusunyifeng at gmail.com>

On Thu, Dec 28, 2017 at 12:34 PM, Ben Pfaff <blp at ovn.org> wrote:

> 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
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list