[ovs-dev] [PATCH] bond: Tag flows according to their hash bucket, not just their slave.

Ben Pfaff blp at nicira.com
Tue Aug 21 21:09:17 UTC 2012


Thank you, pushed to master and branch-1.[45678].

On Tue, Aug 21, 2012 at 01:39:05PM -0700, Ethan Jackson wrote:
> Acked-by: Ethan Jackson <ethan at nicira.com>
> 
> 
> On Fri, Aug 17, 2012 at 1:20 PM, Ben Pfaff <blp at nicira.com> wrote:
> > The bonding code is supposed to tag flows two ways:
> >
> >     - According to the chosen bond slave, to make it easy to invalidate all
> >       of the flows assigned to a given slave.
> >
> >     - According to the hash value for a flow, to make it easy to invalidate
> >       all of the flows that hash into the same bucket.
> >
> > However, the code wasn't actually applying the hash-based tags.  This
> > meant that rebalancing didn't take effect immediately, and so after
> > rebalancing we could get log messages like this:
> >
> >    inconsistency in subfacet (actions were: 5) (correct actions: 4)
> >
> > specifying some flow that was moved by the rebalance.
> >
> > This commit fixes the problem by applying the hash-based tags.
> >
> > Bug #12847.
> > Reported-by: Pratap Reddy <preddy at nicira.com>
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  AUTHORS    |    1 +
> >  lib/bond.c |   10 ++++++----
> >  2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/AUTHORS b/AUTHORS
> > index dee8931..28dc742 100644
> > --- a/AUTHORS
> > +++ b/AUTHORS
> > @@ -152,6 +152,7 @@ Paulo Cravero           pcravero at as2594.net
> >  Peter Balland           peter at nicira.com
> >  Peter Phaal             peter.phaal at inmon.com
> >  Prabina Pattnaik        Prabina.Pattnaik at nechclst.in
> > +Pratap Reddy            preddy at nicira.com
> >  Ralf Heiringhoff        ralf at frosty-geek.net
> >  Ram Jothikumar          rjothikumar at nicira.com
> >  Ramana Reddy            gtvrreddy at gmail.com
> > diff --git a/lib/bond.c b/lib/bond.c
> > index 7178416..77812ed 100644
> > --- a/lib/bond.c
> > +++ b/lib/bond.c
> > @@ -133,7 +133,7 @@ static struct bond_entry *lookup_bond_entry(const struct bond *,
> >  static tag_type bond_get_active_slave_tag(const struct bond *);
> >  static struct bond_slave *choose_output_slave(const struct bond *,
> >                                                const struct flow *,
> > -                                              uint16_t vlan);
> > +                                              uint16_t vlan, tag_type *tags);
> >  static void bond_update_fake_slave_stats(struct bond *);
> >
> >  /* Attempts to parse 's' as the name of a bond balancing mode.  If successful,
> > @@ -523,13 +523,14 @@ bond_compose_learning_packet(struct bond *bond,
> >  {
> >      struct bond_slave *slave;
> >      struct ofpbuf *packet;
> > +    tag_type tags = 0;
> >      struct flow flow;
> >
> >      assert(may_send_learning_packets(bond));
> >
> >      memset(&flow, 0, sizeof flow);
> >      memcpy(flow.dl_src, eth_src, ETH_ADDR_LEN);
> > -    slave = choose_output_slave(bond, &flow, vlan);
> > +    slave = choose_output_slave(bond, &flow, vlan, &tags);
> >
> >      packet = ofpbuf_new(0);
> >      compose_rarp(packet, eth_src);
> > @@ -637,7 +638,7 @@ void *
> >  bond_choose_output_slave(struct bond *bond, const struct flow *flow,
> >                           uint16_t vlan, tag_type *tags)
> >  {
> > -    struct bond_slave *slave = choose_output_slave(bond, flow, vlan);
> > +    struct bond_slave *slave = choose_output_slave(bond, flow, vlan, tags);
> >      if (slave) {
> >          *tags |= bond->balance == BM_STABLE ? bond->stb_tag : slave->tag;
> >          return slave->aux;
> > @@ -1405,7 +1406,7 @@ choose_stb_slave(const struct bond *bond, uint32_t flow_hash)
> >
> >  static struct bond_slave *
> >  choose_output_slave(const struct bond *bond, const struct flow *flow,
> > -                    uint16_t vlan)
> > +                    uint16_t vlan, tag_type *tags)
> >  {
> >      struct bond_entry *e;
> >
> > @@ -1441,6 +1442,7 @@ choose_output_slave(const struct bond *bond, const struct flow *flow,
> >              }
> >              e->tag = tag_create_random();
> >          }
> > +        *tags |= e->tag;
> >          return e->slave;
> >
> >      default:
> > --
> > 1.7.2.5
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list