bridge: Enable multicast support on the bridge
authorFlavio Leitner <fbl@redhat.com>
Thu, 19 Jun 2014 01:14:35 +0000 (22:14 -0300)
committerBen Pfaff <blp@nicira.com>
Tue, 24 Jun 2014 18:17:09 +0000 (11:17 -0700)
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
NEWS
tests/ovs-vsctl.at
utilities/ovs-vsctl.8.in
vswitchd/bridge.c
vswitchd/vswitch.ovsschema
vswitchd/vswitch.xml

diff --git a/NEWS b/NEWS
index 26b0d74..0a68f0b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ v2.3.0 - xx xxx xxxx
      packets with the larger number of masks, but when paired with an
      older kernel module, some workloads may perform worse with the
      new userspace.
+   - Support for multicast snooping (IGMPv1 and IGMPv2)
 
 v2.2.0 - Internal Release
 ---------------------
index 1c4ce4f..9fa3468 100644 (file)
@@ -639,6 +639,7 @@ fail_mode           : []
 flood_vlans         : []
 flow_tables         : {}
 ipfix               : []
+mcast_snooping_enable: false
 mirrors             : []
 name                : "br0"
 netflow             : []
@@ -1131,6 +1132,7 @@ fail_mode           : []
 flood_vlans         : []
 flow_tables         : {}
 ipfix               : []
+mcast_snooping_enable: false
 mirrors             : []
 name                : "br0"
 netflow             : []
index 50d8879..d397721 100644 (file)
@@ -968,6 +968,36 @@ Deconfigure STP from above:
 .IP
 .B "ovs\-vsctl set Bridge br0 stp_enable=false"
 .PP
+.SS "Multicast Snooping"
+.PP
+Configure bridge \fBbr0\fR to enable multicast snooping:
+.IP
+.B "ovs\-vsctl set Bridge br0 mcast_snooping_enable=true"
+.PP
+Set the multicast snooping aging time \fBbr0\fR to 300 seconds:
+.IP
+.B "ovs\-vsctl set Bridge br0 other_config:mcast-snooping-aging-time=300"
+.PP
+Set the multicast snooping table size \fBbr0\fR to 2048 entries:
+.IP
+.B "ovs\-vsctl set Bridge br0 other_config:mcast-snooping-table-size=2048"
+.PP
+Disable flooding of unregistered multicast packets to all ports. When
+set to true, the switch will send unregistered multicast packets only
+to ports connected to multicast routers. When it is set to false, the
+switch will send them to all ports. This command disables the flood of
+unregistered packets on bridge \fBbr0\fR.
+.IP
+.B "ovs\-vsctl set Bridge br0 other_config:mcast-snooping-disable-flood-unregistered=true"
+.PP
+Enable flooding of multicast packets on a specific port.
+.IP
+.B "ovs\-vsctl set Port eth1 other_config:mcast-snooping-flood=true"
+.PP
+Deconfigure multicasting snooping from above:
+.IP
+.B "ovs\-vsctl set Bridge br0 mcast_snooping_enable=false"
+.PP
 .SS "OpenFlow Version"
 .PP
 Configure bridge \fBbr0\fR to support OpenFlow versions 1.0, 1.2, and
index 1fa1820..25e3279 100644 (file)
@@ -34,6 +34,7 @@
 #include "lacp.h"
 #include "list.h"
 #include "mac-learning.h"
+#include "mcast-snooping.h"
 #include "meta-flow.h"
 #include "netdev.h"
 #include "ofp-print.h"
@@ -223,6 +224,7 @@ static void bridge_configure_datapath_id(struct bridge *);
 static void bridge_configure_netflow(struct bridge *);
 static void bridge_configure_forward_bpdu(struct bridge *);
 static void bridge_configure_mac_table(struct bridge *);
+static void bridge_configure_mcast_snooping(struct bridge *);
 static void bridge_configure_sflow(struct bridge *, int *sflow_bridge_number);
 static void bridge_configure_ipfix(struct bridge *);
 static void bridge_configure_stp(struct bridge *);
@@ -614,6 +616,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
         bridge_configure_mirrors(br);
         bridge_configure_forward_bpdu(br);
         bridge_configure_mac_table(br);
+        bridge_configure_mcast_snooping(br);
         bridge_configure_remotes(br, managers, n_managers);
         bridge_configure_netflow(br);
         bridge_configure_sflow(br, &sflow_bridge_number);
@@ -1614,6 +1617,52 @@ bridge_configure_mac_table(struct bridge *br)
     ofproto_set_mac_table_config(br->ofproto, idle_time, mac_table_size);
 }
 
+/* Set multicast snooping table configuration for 'br'. */
+static void
+bridge_configure_mcast_snooping(struct bridge *br)
+{
+    if (!br->cfg->mcast_snooping_enable) {
+        ofproto_set_mcast_snooping(br->ofproto, NULL);
+    } else {
+        struct port *port;
+        struct ofproto_mcast_snooping_settings br_s;
+        const char *idle_time_str;
+        const char *max_entries_str;
+
+        idle_time_str = smap_get(&br->cfg->other_config,
+                                 "mcast-snooping-aging-time");
+        br_s.idle_time = (idle_time_str && atoi(idle_time_str)
+                          ? atoi(idle_time_str)
+                          : MCAST_ENTRY_DEFAULT_IDLE_TIME);
+
+        max_entries_str = smap_get(&br->cfg->other_config,
+                                   "mcast-snooping-table-size");
+        br_s.max_entries = (max_entries_str && atoi(max_entries_str)
+                            ? atoi(max_entries_str)
+                            : MCAST_DEFAULT_MAX_ENTRIES);
+
+        br_s.flood_unreg = !smap_get_bool(&br->cfg->other_config,
+                                    "mcast-snooping-disable-flood-unregistered",
+                                    false);
+
+        /* Configure multicast snooping on the bridge */
+        if (ofproto_set_mcast_snooping(br->ofproto, &br_s)) {
+            VLOG_ERR("bridge %s: could not enable multicast snooping",
+                     br->name);
+            return;
+        }
+
+        HMAP_FOR_EACH (port, hmap_node, &br->ports) {
+            bool flood = smap_get_bool(&port->cfg->other_config,
+                                       "mcast-snooping-flood", false);
+            if (ofproto_port_set_mcast_snooping(br->ofproto, port, flood)) {
+                VLOG_ERR("port %s: could not configure mcast snooping",
+                         port->name);
+            }
+        }
+    }
+}
+
 static void
 find_local_hw_addr(const struct bridge *br, uint8_t ea[ETH_ADDR_LEN],
                    const struct port *fake_br, struct iface **hw_addr_iface)
index 285cf6d..bc9ea73 100644 (file)
@@ -1,6 +1,6 @@
 {"name": "Open_vSwitch",
- "version": "7.7.0",
- "cksum": "2517737670 20677",
+ "version": "7.8.0",
+ "cksum": "2676751133 20740",
  "tables": {
    "Open_vSwitch": {
      "columns": {
@@ -54,6 +54,8 @@
          "ephemeral": true},
        "stp_enable": {
          "type": "boolean"},
+       "mcast_snooping_enable": {
+         "type": "boolean"},
        "ports": {
          "type": {"key": {"type": "uuid",
                           "refTable": "Port"},
index a984ace..69b3567 100644 (file)
         ports to <code>forwarding</code>, in seconds.  By default, the
         forwarding delay is 15 seconds.
       </column>
+
+      <column name="other_config" key="mcast-snooping-aging-time"
+              type='{"type": "integer", "minInteger": 1}'>
+        <p>
+          The maximum number of seconds to retain a multicast snooping entry for
+          which no packets have been seen.  The default is currently 300
+          seconds (5 minutes).  The value, if specified, is forced into a
+          reasonable range, currently 15 to 3600 seconds.
+        </p>
+      </column>
+
+      <column name="other_config" key="mcast-snooping-table-size"
+              type='{"type": "integer", "minInteger": 1}'>
+        <p>
+          The maximum number of multicast snooping addresses to learn.  The
+          default is currently 2048.  The value, if specified, is forced into
+          a reasonable range, currently 10 to 1,000,000.
+        </p>
+      </column>
+      <column name="other_config" key="mcast-snooping-disable-flood-unregistered"
+              type='{"type": "boolean"}'>
+        <p>
+          If set to <code>false</code>, unregistered multicast packets are forwarded
+          to all ports.
+          If set to <code>true</code>, unregistered multicast packets are forwarded
+          to ports connected to multicast routers.
+        </p>
+      </column>
+    </group>
+
+    <group title="Multicast Snooping Configuration">
+      Multicast snooping (RFC 4541) monitors the Internet Group Management
+      Protocol (IGMP) traffic between hosts and multicast routers.  The
+      switch uses what IGMP snooping learns to forward multicast traffic
+      only to interfaces that are connected to interested receivers.
+      Currently it supports IGMPv1 and IGMPv2 protocols.
+
+      <column name="mcast_snooping_enable">
+        Enable multicast snooping on the bridge. For now, the default
+        is disabled.
+      </column>
     </group>
 
     <group title="Other Features">
         speed of the link.
       </column>
     </group>
+    <group title="Multicast Snooping">
+      <column name="other_config" key="mcast-snooping-flood"
+              type='{"type": "boolean"}'>
+        <p>
+          If set to <code>true</code>, multicast packets are unconditionally
+          forwarded to the specific port.
+        </p>
+      </column>
+    </group>
 
     <group title="Other Features">
       <column name="qos">