Hi Sola, Sola Zhang via dev <[email protected]> writes:
> In a non-LACP balance-slb bond, bond_check_admissibility() drops broadcast > and multicast on members other than the active one, and the check runs > before the multicast-snooping lookup. When an IGMP/MLD-snooping switch > forwards a group to a single member that is not the active one, OVS drops > the stream and a receiver behind the bond stalls. > > other_config:all-members-active=true already lets such traffic through, but > it also admits broadcast, which a flooding switch then duplicates. Extend > the knob to take a value: 'multicast' admits multicast but not broadcast on > the non-active members, while 'true' keeps admitting both and 'false' (the > default) keeps dropping both. The boolean values remain valid, so existing > configurations are unaffected. > > Signed-off-by: Sola Zhang <[email protected]> > --- Thanks for the quick follow up. This looks better to me. Comments below. > v2 -> v3: > - Reworded two struct-field comments (no functional change) to avoid > false-positive checkpatch "whitespace around operator" warnings. > v1 -> v2: > - Per Aaron Conole's review, dropped the separate > multicast-all-members-active knob and instead gave the existing > all-members-active knob a value (true/false/multicast). 'true' still > means both broadcast and multicast, so existing configurations are > unaffected. Did not add a 'broadcast' value, as suggested. > - v1 (RFC): > https://patchwork.ozlabs.org/project/openvswitch/patch/[email protected]/ > > ofproto/bond.c | 31 +++++++++++++++----- > ofproto/bond.h | 15 ++++++++-- > tests/ofproto-dpif.at | 68 +++++++++++++++++++++++++++++++++++++++++++ > vswitchd/bridge.c | 15 ++++++++-- > vswitchd/vswitch.xml | 34 +++++++++++++++++----- > 5 files changed, 142 insertions(+), 21 deletions(-) This could probably also use a NEWS call out. > diff --git a/ofproto/bond.c b/ofproto/bond.c > index ef481a360..50728dd06 100644 > --- a/ofproto/bond.c > +++ b/ofproto/bond.c > @@ -125,8 +125,10 @@ struct bond { > uint32_t basis; /* Basis for flow hash function. */ > bool use_lb_output_action; /* Use lb_output action to avoid > recirculation. > Applicable only for Balance TCP mode. */ > - bool all_members_active; /* Accept multicast packets on secondary > - members of a non-LACP Balance SLB bond. */ > + enum bond_all_members_active all_members_active; > + /* Delivery of broadcast and multicast > packets > + on secondary members of a Balance SLB bond > + without LACP. */ > char *primary; /* Name of the primary member. */ > > /* SLB specific bonding info. */ > @@ -502,7 +504,8 @@ bond_reconfigure(struct bond *bond, const struct > bond_settings *s) > } > > bond->all_members_active = (bond->balance == BM_SLB) > - ? s->all_members_active : false; > + ? s->all_members_active > + : BOND_ALL_MEMBERS_ACTIVE_OFF; > > if (bond->balance != BM_AB) { > if (!bond->recirc_id) { > @@ -931,9 +934,15 @@ bond_check_admissibility(struct bond *bond, const void > *member_, > break; > } > > - /* Drop all multicast packets on inactive members. */ > - if (eth_addr_is_multicast(eth_dst)) { > - if (bond->active_member != member && !bond->all_members_active) { > + /* Drop broadcast and multicast packets on inactive members, unless > + * 'all-members-active' admits them: 'true' admits both, 'multicast' > + * admits multicast but not broadcast. */ > + if (eth_addr_is_multicast(eth_dst) && bond->active_member != member) { > + enum bond_all_members_active ama = bond->all_members_active; > + bool admit = ama == BOND_ALL_MEMBERS_ACTIVE_ALL > + || (ama == BOND_ALL_MEMBERS_ACTIVE_MULTICAST > + && !eth_addr_is_broadcast(eth_dst)); > + if (!admit) { > goto out; > } > } > @@ -1565,8 +1574,14 @@ bond_print_details(struct ds *ds, const struct bond > *bond) > use_lb_output_action ? recirc_id : -1); > > if (bond->balance == BM_SLB) { > - ds_put_format(ds, "all members active: %s\n", > - bond->all_members_active ? "true" : "false"); > + const char *ama = "false"; > + if (bond->all_members_active == BOND_ALL_MEMBERS_ACTIVE_ALL) { > + ama = "true"; > + } else if (bond->all_members_active > + == BOND_ALL_MEMBERS_ACTIVE_MULTICAST) { > + ama = "multicast"; > + } > + ds_put_format(ds, "all members active: %s\n", ama); > } > > ds_put_format(ds, "updelay: %d ms\n", bond->updelay); > diff --git a/ofproto/bond.h b/ofproto/bond.h > index 3aa5c640d..263fdcd05 100644 > --- a/ofproto/bond.h > +++ b/ofproto/bond.h > @@ -38,6 +38,14 @@ enum bond_mode { > bool bond_mode_from_string(enum bond_mode *, const char *); > const char *bond_mode_to_string(enum bond_mode); > > +/* How a balance-slb bond treats broadcast and multicast frames received on > its > + * non-active members, configured via other_config:all-members-active. */ > +enum bond_all_members_active { > + BOND_ALL_MEMBERS_ACTIVE_OFF, /* Drop broadcast and multicast. */ > + BOND_ALL_MEMBERS_ACTIVE_MULTICAST, /* Admit multicast, drop broadcast. > */ > + BOND_ALL_MEMBERS_ACTIVE_ALL, /* Admit broadcast and multicast. */ > +}; > + > /* Configuration for a bond as a whole. */ > struct bond_settings { > char *name; /* Bond's name, for log messages. */ > @@ -62,9 +70,10 @@ struct bond_settings { > ovs run. */ > bool use_lb_output_action; /* Use lb_output action. Only applicable for > bond mode BALANCE TCP. */ > - bool all_members_active; /* Accept multicast packets on secondary > - interface. Only applicable for non-LACP > - BALANCE SLB bond mode. */ > + enum bond_all_members_active all_members_active; > + /* Delivery of broadcast and multicast > packets > + on secondary members. Only applicable to > + Balance SLB bonds without LACP. */ > }; > > /* Program startup. */ > diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at > index efb36e058..20e9dee89 100644 > --- a/tests/ofproto-dpif.at > +++ b/tests/ofproto-dpif.at > @@ -946,6 +946,74 @@ Datapath actions: 100 > OVS_VSWITCHD_STOP() > AT_CLEANUP > > +AT_SETUP([ofproto-dpif - bond - allow multicast only]) > +dnl With 'all-members-active=multicast', multicast is accepted on the > +dnl non-active member but broadcast is still dropped. > +OVS_VSWITCHD_START([dnl > + add-bond br0 bond0 p1 p2 -- dnl > + set Port bond0 bond-mode=balance-slb > other-config:bond-rebalance-interval=0 dnl > + other_config:all-members-active=multicast -- dnl > + set Interface p1 type=dummy ofport_request=1 -- dnl > + set Interface p2 type=dummy ofport_request=2]) > + > +AT_CHECK([ovs-appctl bond/set-active-member bond0 p1], [0], [ignore]) > +AT_CHECK([ovs-ofctl add-flow br0 actions=NORMAL]) > + > +OVS_WAIT_UNTIL_EQUAL([ovs-appctl bond/show bond0 | STRIP_ACTIVE_MEMBER_MAC], > [dnl > +---- bond0 ---- > +bond_mode: balance-slb > +bond may use recirculation: no, Recirc-ID : -1 > +bond-hash-basis: 0 > +lb_output action: disabled, bond-id: -1 > +all members active: multicast > +updelay: 0 ms > +downdelay: 0 ms > +lacp_status: off > +lacp_fallback_ab: false > +active-backup primary: <none> > +<active member mac del> > + > +member p1: enabled > + active member > + may_enable: true > + > +member p2: enabled > + may_enable: true > +]) > + > +dnl Multicast is admitted on the non-active member p2. > +AT_CHECK([ovs-appctl ofproto/trace br0 in_port=2,dl_dst=01:00:5e:00:00:01], > [0], [dnl > +Flow: > in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=01:00:5e:00:00:01,dl_type=0x0000 > + > +bridge("br0") > +------------- > + 0. priority 32768 > + NORMAL > + -> no learned MAC for destination, flooding > + > +Final flow: unchanged > +Megaflow: > recirc_id=0,eth,in_port=2,dl_src=00:00:00:00:00:00,dl_dst=01:00:5e:00:00:01,dl_type=0x0000 > +Datapath actions: 100 > +]) > + > +dnl Broadcast is still dropped on the non-active member p2. > +AT_CHECK([ovs-appctl ofproto/trace br0 in_port=2,dl_dst=ff:ff:ff:ff:ff:ff], > [0], [dnl > +Flow: > in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000 > + > +bridge("br0") > +------------- > + 0. priority 32768 > + NORMAL > + -> bonding refused admissibility, dropping > + > +Final flow: unchanged > +Megaflow: > recirc_id=0,eth,in_port=2,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000 > +Datapath actions: drop > +]) > + > +OVS_VSWITCHD_STOP() > +AT_CLEANUP > + > AT_SETUP([ofproto-dpif - resubmit]) > OVS_VSWITCHD_START > add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21 > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c > index c00abd295..77e6d2aab 100644 > --- a/vswitchd/bridge.c > +++ b/vswitchd/bridge.c > @@ -4752,9 +4752,18 @@ port_configure_bond(struct port *port, struct > bond_settings *s) > s->use_lb_output_action = (s->balance == BM_TCP) > && smap_get_bool(&port->cfg->other_config, > "lb-output-action", false); > - /* all_members_active is disabled by default. */ > - s->all_members_active = smap_get_bool(&port->cfg->other_config, > - "all-members-active", false); > + /* all-members-active admits broadcast and multicast ("true") or > multicast > + * only ("multicast") on non-active members of a balance-slb bond; > disabled > + * ("false") by default. */ > + const char *all_members_active = > + smap_get_def(&port->cfg->other_config, "all-members-active", > "false"); > + if (!strcmp(all_members_active, "true")) { Maybe we could consider using strcasecmp for these. smap_get_bool does an internal strcasecmp. It helps for 'True'/'False'/'Multicast' (and other weird capitalization quirks). > + s->all_members_active = BOND_ALL_MEMBERS_ACTIVE_ALL; > + } else if (!strcmp(all_members_active, "multicast")) { > + s->all_members_active = BOND_ALL_MEMBERS_ACTIVE_MULTICAST; > + } else { > + s->all_members_active = BOND_ALL_MEMBERS_ACTIVE_OFF; Might be worth logging if an unknown value comes in (ie it isn't 'true', 'false', or 'multicast'). Since 'false' is set as default, we don't need to check against empty. Something like: } else { if (strcasecmp("false", all_members_active)) { VLOG_WARN("port %s: unsupported all-members-active value '%s'", port->name, all_members_active); } } > + } > } > > /* Returns true if 'port' is synthetic, that is, if we constructed it locally > diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml > index 4eec70fe4..e9479ca97 100644 > --- a/vswitchd/vswitch.xml > +++ b/vswitchd/vswitch.xml > @@ -2246,16 +2246,36 @@ > </column> > > <column name="other_config" key="all-members-active" > - type='{"type": "boolean"}'> > + type='{"type": "string", > + "enum": ["set", ["true", "false", "multicast"]]}'> > <p> > - Enable/Disable delivery of broadcast/multicast packets on secondary > - interface of a balance-slb bond. Relevant only when > - <ref column="lacp"/> is <code>off</code>. > + Controls delivery of broadcast and multicast packets to the > + non-active members of a balance-slb bond. Relevant only when > + <ref column="lacp"/> is <code>off</code>. Possible values: > </p> > + <dl> > + <dt><code>false</code> (default)</dt> > + <dd> > + Drop broadcast and multicast on non-active members. > + </dd> > + <dt><code>true</code></dt> > + <dd> > + Deliver both broadcast and multicast on non-active members. > + Identical to <code>all_slaves_active</code> for Linux kernel > + bonds. > + </dd> > + <dt><code>multicast</code></dt> > + <dd> > + Deliver multicast but not broadcast on non-active members. > Useful > + when an upstream switch snoops IGMP/MLD and forwards a group to a > + single member, which need not be the bond's active one, while > + still letting that switch handle broadcast. > + </dd> > + </dl> > <p> > - This parameter is identical to <code>all_slaves_active</code> for > - Linux kernel bonds. Disabled by default as it is not a desirable > - configuration for most users. > + Disabled (<code>false</code>) by default. The boolean values > + <code>true</code> and <code>false</code> keep their original > meaning > + for backward compatibility. I think the comment about backward compatibility isn't needed here. We generally try to just document behavior, not history. The history in this case isn't useful for an operator to make any decisions, and the historical value 'true' is also the modern value 'true'. > </p> > </column> _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
