From: Jarno Rajahalme <jrajahalme@nicira.com>
Date: Fri, 11 Apr 2014 19:39:24 +0000 (-0700)
Subject: Clarify tunnel wildcarding.
X-Git-Tag: sliver-openvswitch-2.2.90-1~3^2~138
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3cccd4084392fc05838eb001b1f8ddba23b53321;p=sliver-openvswitch.git

Clarify tunnel wildcarding.

It would seem we should set the 'tunnel.ip_dst' in 'wc' when calling
tnl_port_should_receive(), as it is reading that flow field.  However,
since tunnels' datapath port numbers are different from the non-tunnel
ports, and we always unwildcard the 'in_port', we do not need to
unwildcard the 'tunnel.ip_dst' for non-tunneled packets.

Also, 'nw_tos' need not be unwildcarded if it is not examined.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
---

diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 336b81030..d2e9584f1 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -302,8 +302,8 @@ tnl_ecn_ok(const struct flow *base_flow, struct flow *flow,
            struct flow_wildcards *wc)
 {
     if (is_ip_any(base_flow)) {
-        wc->masks.nw_tos |= IP_ECN_MASK;
         if ((flow->tunnel.ip_tos & IP_ECN_MASK) == IP_ECN_CE) {
+            wc->masks.nw_tos |= IP_ECN_MASK;
             if ((base_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");
@@ -326,6 +326,11 @@ bool
 tnl_xlate_init(const struct flow *base_flow, 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'
+     * datapath port numbers are different from the non-tunnel ports, and we
+     * always unwildcard the 'in_port', we do not need to unwildcard
+     * the 'tunnel.ip_dst' for non-tunneled packets. */
     if (tnl_port_should_receive(flow)) {
         wc->masks.tunnel.tun_id = OVS_BE64_MAX;
         wc->masks.tunnel.ip_src = OVS_BE32_MAX;