From: Ethan Jackson Date: Wed, 13 Oct 2010 22:12:12 +0000 (+0000) Subject: vswitchd: Bubble no-flood configuration up to bridge X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4e2e1f28976fd17435a7748c233286188778344;p=openvswitch vswitchd: Bubble no-flood configuration up to bridge When bridge.c decides to flood a packet as the result of a "normal" flow action, it now checks whether each port is configured to receive flood packets. Bug #3741 --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 5e99fcab..bb2bf5a4 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1277,6 +1277,15 @@ ofproto_port_del(struct ofproto *ofproto, uint16_t odp_port) return error; } +/* Checks if 'ofproto' thinks 'odp_port' should be included in floods. Returns + * true if 'odp_port' exists and should be included, false otherwise. */ +bool +ofproto_port_is_floodable(struct ofproto *ofproto, uint16_t odp_port) +{ + struct ofport *ofport = get_port(ofproto, odp_port); + return ofport && !(ofport->opp.config & OFPPC_NO_FLOOD); +} + int ofproto_send_packet(struct ofproto *p, const struct flow *flow, const union ofp_action *actions, size_t n_actions, diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index 0c403e90..362ea264 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -95,6 +95,7 @@ void ofproto_wait(struct ofproto *); bool ofproto_is_alive(const struct ofproto *); int ofproto_port_del(struct ofproto *, uint16_t odp_port); +bool ofproto_port_is_floodable(struct ofproto *, uint16_t odp_port); /* Configuration. */ void ofproto_set_datapath_id(struct ofproto *, uint64_t datapath_id); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 74ac87ef..4a7f90bf 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2203,6 +2203,20 @@ port_includes_vlan(const struct port *port, uint16_t vlan) return vlan == port->vlan || port_trunks_vlan(port, vlan); } +static bool +port_is_floodable(const struct port *port) +{ + int i; + + for (i = 0; i < port->n_ifaces; i++) { + if (!ofproto_port_is_floodable(port->bridge->ofproto, + port->ifaces[i]->dp_ifidx)) { + return false; + } + } + return true; +} + static size_t compose_dsts(const struct bridge *br, const struct flow *flow, uint16_t vlan, const struct port *in_port, const struct port *out_port, @@ -2217,7 +2231,9 @@ compose_dsts(const struct bridge *br, const struct flow *flow, uint16_t vlan, /* XXX even better, define each VLAN as a datapath port group */ for (i = 0; i < br->n_ports; i++) { struct port *port = br->ports[i]; - if (port != in_port && port_includes_vlan(port, vlan) + if (port != in_port + && port_is_floodable(port) + && port_includes_vlan(port, vlan) && !port->is_mirror_output_port && set_dst(dst, flow, in_port, port, tags)) { mirrors |= port->dst_mirrors;