ofproto-dpif: add support for layer 3 ports
authorLorand Jakab <lojakab@cisco.com>
Tue, 19 Nov 2013 09:06:44 +0000 (11:06 +0200)
committerBen Pfaff <blp@nicira.com>
Tue, 19 Nov 2013 19:06:04 +0000 (11:06 -0800)
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 <lojakab@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/netdev-vport.c
lib/netdev-vport.h
ofproto/ofproto-dpif.c
vswitchd/vswitch.xml

index ae4f626..07b2381 100644 (file)
@@ -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)
 {
index dc49097..eaeb386 100644 (file)
@@ -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);
 
index 3391594..b984ea5 100644 (file)
@@ -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. */
 
@@ -1708,6 +1709,7 @@ port_construct(struct ofport *port_)
     port->realdev_ofp_port = 0;
     port->vlandev_vid = 0;
     port->carrier_seq = netdev_get_carrier_resets(netdev);
+    port->is_layer3 = netdev_vport_is_layer3(netdev);
 
     if (netdev_vport_is_patch(netdev)) {
         /* By bailing out here, we don't submit the port to the sFlow module
@@ -2305,6 +2307,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 +2355,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;
         }
index 9da34d9..35d59b9 100644 (file)
 
           <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.
+            </p>
           </dd>
 
           <dt><code>patch</code></dt>