[ovs-dev] [PATCH 20/31] fixup: Clarify how legacy L3 tunnels work.

Ben Pfaff blp at ovn.org
Mon Jun 12 22:28:45 UTC 2017


Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 ofproto/ofproto-dpif-xlate.c |  2 +-
 ofproto/tunnel.c             | 17 ++++--------
 ofproto/tunnel.h             |  2 +-
 vswitchd/vswitch.xml         | 62 ++++++++++++++++++++++++++++++++++++--------
 4 files changed, 58 insertions(+), 25 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 623b7a0ee6c5..d18d58c87c20 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -6154,7 +6154,7 @@ xlate_wc_init(struct xlate_ctx *ctx)
         netflow_mask_wc(&ctx->xin->flow, ctx->wc);
     }
 
-    tnl_wc_init(&ctx->xin->flow, ctx->wc, ctx->xbridge->packet_type_aware);
+    tnl_wc_init(&ctx->xin->flow, ctx->wc);
 }
 
 static void
diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index caf01be5f14b..0bde801993a5 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -361,8 +361,7 @@ tnl_process_ecn(struct flow *flow)
 }
 
 void
-tnl_wc_init(struct flow *flow, struct flow_wildcards *wc,
-            bool packet_type_aware)
+tnl_wc_init(struct flow *flow, struct flow_wildcards *wc)
 {
     if (tnl_port_should_receive(flow)) {
         wc->masks.tunnel.tun_id = OVS_BE64_MAX;
@@ -387,10 +386,6 @@ tnl_wc_init(struct flow *flow, struct flow_wildcards *wc,
             && IP_ECN_is_ce(flow->tunnel.ip_tos)) {
             wc->masks.nw_tos |= IP_ECN_MASK;
         }
-        if (!packet_type_aware) {
-            /* Match on packet_type for tunneled packets.*/
-            wc->masks.packet_type = OVS_BE32_MAX;
-        }
     }
 }
 
@@ -570,19 +565,17 @@ tnl_find(const struct flow *flow) OVS_REQ_RDLOCK(rwlock)
                     match.ip_dst_flow = ip_dst_flow;
                     match.ip_src_flow = ip_src == IP_SRC_FLOW;
 
-                    /* If it's about a Non-ethernet packet then we look for a
-                     * layer3 tunnel port first, as it would be attached to a
-                     * non-PTAP bridge. Then for a versatile tunnel port as it
-                     * would be attached to a PTAP bridge. */
+                    /* If it's about a non-Ethernet packet, look for a layer-3
+                     * tunnel port first. */
                     if (pt_ns(flow->packet_type) == OFPHTN_ETHERTYPE) {
-                        /* Try to find a layer3 port first. */
                         match.is_layer3 = true;
                         tnl_port = tnl_find_exact(&match, map);
                         if (tnl_port) {
                             return tnl_port;
                         }
                     }
-                    /* Check for a non-layer3 or versatile tunnel port. */
+
+                    /* Then check for a non-layer3 or versatile tunnel port. */
                     match.is_layer3 = false;
                     tnl_port = tnl_find_exact(&match, map);
                     if (tnl_port) {
diff --git a/ofproto/tunnel.h b/ofproto/tunnel.h
index dc004cc18b66..b0ec67c2bd74 100644
--- a/ofproto/tunnel.h
+++ b/ofproto/tunnel.h
@@ -39,7 +39,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 *);
-void tnl_wc_init(struct flow *, struct flow_wildcards *, bool);
+void tnl_wc_init(struct flow *, struct flow_wildcards *);
 bool tnl_process_ecn(struct flow *);
 odp_port_t tnl_port_send(const struct ofport_dpif *, struct flow *,
                          struct flow_wildcards *wc);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index dc97d75dc113..b3d818e5a72a 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2402,21 +2402,46 @@
               <code>gpe</code>: Support for Generic Protocol Encapsulation in
               accordance with IETF draft
               <code>https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe</code>.
+              Without this option, a VXLAN packet always encapsulates an
+              Ethernet frame.  With this option, an VXLAN packet may also
+              encapsulate an IPv4, IPv6, NSH, or MPLS packet.
             </li>
           </ul>
         </column>
 
         <column name="options" key="layer3" type='{"type": "boolean"}'>
           <p>
-            By default, or if set to false, the tunnel carries L2 packets (with
-            an Ethernet header).  If set to true, the tunnel carries L3 packets
-            (without an Ethernet header present).
+            Unless <ref column="options" key="exts"/> enables the
+            <code>gpe</code> extension, this option is ignored.  In this case,
+            then the tunnel sends and receives only Ethernet frames.
           </p>
 
           <p>
-            To set this option to true, the <code>gpe</code> extension must
-            also be enabled in <ref column="options" key="exts"/>.
+            When <ref column="options" key="exts"/> enables <code>gpe</code>,
+            and <ref column="options" key="layer3"/> is <code>true</code>,
+            then the tunnel sends and receives only IPv4 and IPv6 packets.
           </p>
+
+          <p>
+            When <ref column="options" key="exts"/> enables <code>gpe</code>,
+            and <ref column="options" key="layer3"/> is missing or
+            <code>false</code>, then the meaning of this column depends on <ref
+            column="other_config" key="legacy-l3-tunnel"/> in the <ref
+            table="Bridge"/> table:
+          </p>
+
+          <ul>
+            <li>
+              If legacy L3 tunneling behavior is enabled, then the tunnel sends
+              and receives only Ethernet packets.  (Open vSwitch 2.7 and
+              earlier only supported this mode.)
+            </li>
+
+            <li>
+              If legacy L3 tunneling behavior is disabled, then the tunnel
+              sends and receives any kind of packet supported by VXLAN-GPE.
+            </li>
+          </ul>
         </column>
       </group>
 
@@ -2427,15 +2452,30 @@
 
         <column name="options" key="layer3" type='{"type": "boolean"}'>
           <p>
-            By default, or if set to false, the tunnel carries L2 packets (with
-            an Ethernet header).  If set to true, the tunnel carries L3 packets
-            (without an Ethernet header present).
+            When missing or <code>false</code>, the meaning of this column
+            depends on <ref column="other_config" key="legacy-l3-tunnel"/> in
+            the <ref table="Bridge"/> table:
           </p>
 
+          <ul>
+            <li>
+              If legacy L3 tunneling behavior is enabled, then the tunnel sends
+              and receives only Ethernet packets.  (Open vSwitch 2.7 and
+              earlier only supported this mode.)
+            </li>
+
+            <li>
+              If legacy L3 tunneling behavior is disabled, then the tunnel
+              sends and receives any kind of packet.
+            </li>
+          </ul>
+
           <p>
-            A single GRE tunnel cannot carry both L2 and L3 packets, but the
-            same effect can be realized by creating two tunnels with different
-            <code>layer3</code> settings and otherwise the same configuration.
+            When <code>true</code>, then the tunnel sends and receives only
+            non-Ethernet packets.  (When legacy L3 tunneling is enabled,
+            Ethernet packets through the same tunnel are handled by a similar
+            port with this column set to <code>false</code>, if one is
+            configured.)
           </p>
         </column>
       </group>
-- 
2.10.2



More information about the dev mailing list