Signed-off-by: Flavio Leitner <f...@redhat.com> --- NEWS | 1 + tests/ovs-vsctl.at | 2 ++ utilities/ovs-vsctl.8.in | 30 ++++++++++++++++++++++++++++ vswitchd/bridge.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ vswitchd/vswitch.ovsschema | 6 ++++-- vswitchd/vswitch.xml | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 136 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS index 82a61e1..0cf5b47 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,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 --------------------- diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index 440bf1a..600491f 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -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 : [] diff --git a/utilities/ovs-vsctl.8.in b/utilities/ovs-vsctl.8.in index 1701b48..c77d2eb 100644 --- a/utilities/ovs-vsctl.8.in +++ b/utilities/ovs-vsctl.8.in @@ -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 diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 9764c1f..a94814e 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -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" @@ -218,6 +219,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 *); @@ -609,6 +611,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); @@ -1609,6 +1612,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) diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema index 285cf6d..bc9ea73 100644 --- a/vswitchd/vswitch.ovsschema +++ b/vswitchd/vswitch.ovsschema @@ -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"}, diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index acefed2..cbe62ea 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -649,6 +649,47 @@ 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"> @@ -1161,6 +1202,15 @@ 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"> -- 1.9.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev