Add member is_layer3 to struct ofport_dpif to mark layer 3 ports.  Set
it to "true" for the only layer 3 port we support for now: lisp.

Additionally, prevent flooding to layer 3 ports.  A later patch will
also prevent MAC learning.

Signed-off-by: Lorand Jakab <loja...@cisco.com>
---
v2:
  * Document new behavior in vswitch.xml as per Ben's comment
---
 lib/netdev-vport.c     |  8 ++++++++
 lib/netdev-vport.h     |  1 +
 ofproto/ofproto-dpif.c |  5 +++++
 vswitchd/vswitch.xml   | 13 +++++++++++--
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index ae4f626..07b2381 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -108,6 +108,14 @@ netdev_vport_is_patch(const struct netdev *netdev)
     return class->get_config == get_patch_config;
 }
 
+bool
+netdev_vport_is_layer3(const struct netdev *dev)
+{
+    const char *type = netdev_get_type(dev);
+
+    return (!strcmp("lisp", type));
+}
+
 static bool
 netdev_vport_needs_dst_port(const struct netdev *dev)
 {
diff --git a/lib/netdev-vport.h b/lib/netdev-vport.h
index dc49097..eaeb386 100644
--- a/lib/netdev-vport.h
+++ b/lib/netdev-vport.h
@@ -30,6 +30,7 @@ void netdev_vport_tunnel_register(void);
 void netdev_vport_patch_register(void);
 
 bool netdev_vport_is_patch(const struct netdev *);
+bool netdev_vport_is_layer3(const struct netdev *);
 
 char *netdev_vport_patch_peer(const struct netdev *netdev);
 
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 3391594..4b029f9 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -332,6 +332,7 @@ struct ofport_dpif {
     struct bfd *bfd;            /* BFD, if any. */
     bool may_enable;            /* May be enabled in bonds. */
     bool is_tunnel;             /* This port is a tunnel. */
+    bool is_layer3;             /* This is a layer 3 port. */
     long long int carrier_seq;  /* Carrier status changes. */
     struct ofport_dpif *peer;   /* Peer if patch port. */
 
@@ -1720,6 +1721,8 @@ port_construct(struct ofport *port_)
         return 0;
     }
 
+    port->is_layer3 = netdev_vport_is_layer3(netdev);
+
     error = dpif_port_query_by_name(ofproto->backer->dpif,
                                     netdev_vport_get_dpif_port(netdev, namebuf,
                                                                sizeof namebuf),
@@ -2305,6 +2308,7 @@ bundle_update(struct ofbundle *bundle)
     bundle->floodable = true;
     LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
         if (port->up.pp.config & OFPUTIL_PC_NO_FLOOD
+            || port->is_layer3
             || !stp_forward_in_state(port->stp_state)) {
             bundle->floodable = false;
             break;
@@ -2352,6 +2356,7 @@ bundle_add_port(struct ofbundle *bundle, ofp_port_t 
ofp_port,
         port->bundle = bundle;
         list_push_back(&bundle->ports, &port->bundle_node);
         if (port->up.pp.config & OFPUTIL_PC_NO_FLOOD
+            || port->is_layer3
             || !stp_forward_in_state(port->stp_state)) {
             bundle->floodable = false;
         }
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 9da34d9..afa49db 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1387,8 +1387,17 @@
 
           <dt><code>lisp</code></dt>
           <dd>
-            A layer 3 tunnel over the experimental, UDP-based Locator/ID
-            Separation Protocol (RFC 6830).
+            <p>
+              A layer 3 tunnel over the experimental, UDP-based Locator/ID
+              Separation Protocol (RFC 6830).
+            </p>
+            <p>
+              Only IPv4 and IPv6 packets are supported by the protocol, and
+              they are sent and received without an Ethernet header.  Traffic
+              to/from LISP ports is expected to be configured explicitly, and
+              the ports are not intended to participate in learning based
+              switching.  As such, they are always excluded from packet
+              flooding.
           </dd>
 
           <dt><code>patch</code></dt>
-- 
1.8.3.4 (Apple Git-47)

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to