[ovs-dev] [PATCH] tunnel: Drop 'base_flow' parameter from tnl_xlate_init().

Jarno Rajahalme jrajahalme at nicira.com
Fri Jul 24 20:00:30 UTC 2015


Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>

Btw, the line that clears the tunnel metadata of the base_flow above the tnl_xlate_init() call could benefit from a comment.

  Jarno

> On Jul 23, 2015, at 4:23 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> At the point when tnl_xlate_init() is called, all of the members that
> tnl_xlate_init() examines in 'base_flow' have the same values in 'flow',
> so there's no point in passing both.
> 
> CC: Jesse Gross <jesse at nicira.com>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> ofproto/ofproto-dpif-xlate.c |  2 +-
> ofproto/tunnel.c             | 12 +++++-------
> ofproto/tunnel.h             |  3 +--
> 3 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index a9d98ee..72e0a93 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -4809,7 +4809,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
>     }
>     is_icmp = is_icmpv4(flow) || is_icmpv6(flow);
> 
> -    tnl_may_send = tnl_xlate_init(&ctx.base_flow, flow, wc);
> +    tnl_may_send = tnl_xlate_init(flow, wc);
> 
>     ctx.recurse = 0;
>     ctx.resubmits = 0;
> diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
> index 91c13ab..372b385 100644
> --- a/ofproto/tunnel.c
> +++ b/ofproto/tunnel.c
> @@ -333,15 +333,14 @@ out:
> }
> 
> static bool
> -tnl_ecn_ok(const struct flow *base_flow, struct flow *flow,
> -           struct flow_wildcards *wc)
> +tnl_ecn_ok(struct flow *flow, struct flow_wildcards *wc)
> {
> -    if (is_ip_any(base_flow)) {
> +    if (is_ip_any(flow)) {
>         if ((flow->tunnel.ip_tos & IP_ECN_MASK) == IP_ECN_CE) {
>             if (wc) {
>                 wc->masks.nw_tos |= IP_ECN_MASK;
>             }
> -            if ((base_flow->nw_tos & IP_ECN_MASK) == IP_ECN_NOT_ECT) {
> +            if ((flow->nw_tos & IP_ECN_MASK) == IP_ECN_NOT_ECT) {
>                 VLOG_WARN_RL(&rl, "dropping tunnel packet marked ECN CE"
>                              " but is not ECN capable");
>                 return false;
> @@ -360,8 +359,7 @@ tnl_ecn_ok(const struct flow *base_flow, struct flow *flow,
>  *
>  * Returns false if the packet must be dropped. */
> bool
> -tnl_xlate_init(const struct flow *base_flow, struct flow *flow,
> -               struct flow_wildcards *wc)
> +tnl_xlate_init(struct flow *flow, struct flow_wildcards *wc)
> {
>     /* tnl_port_should_receive() examines the 'tunnel.ip_dst' field to
>      * determine the presence of the tunnel metadata.  However, since tunnels'
> @@ -385,7 +383,7 @@ tnl_xlate_init(const struct flow *base_flow, struct flow *flow,
> 
>             memset(&wc->masks.pkt_mark, 0xff, sizeof wc->masks.pkt_mark);
>         }
> -        if (!tnl_ecn_ok(base_flow, flow, wc)) {
> +        if (!tnl_ecn_ok(flow, wc)) {
>             return false;
>         }
> 
> diff --git a/ofproto/tunnel.h b/ofproto/tunnel.h
> index b8415ab..8f9ddab 100644
> --- a/ofproto/tunnel.h
> +++ b/ofproto/tunnel.h
> @@ -38,8 +38,7 @@ int tnl_port_add(const struct ofport_dpif *, const struct netdev *,
> void tnl_port_del(const struct ofport_dpif *);
> 
> const struct ofport_dpif *tnl_port_receive(const struct flow *);
> -bool tnl_xlate_init(const struct flow *base_flow, struct flow *flow,
> -                    struct flow_wildcards *);
> +bool tnl_xlate_init(struct flow *, struct flow_wildcards *);
> odp_port_t tnl_port_send(const struct ofport_dpif *, struct flow *,
>                          struct flow_wildcards *wc);
> 
> -- 
> 2.1.3
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list