diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-04-19 17:19:25 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-04-20 11:10:28 -0700 |
commit | 8bb6f31da62408faf4bcf479faa25640f428a151 (patch) | |
tree | f86d9e348afe128562119bd2e7f1f095e4933503 /lib/bond.c | |
parent | f76e2dfc8a1dd2581629a0a23c40cc43a77485d3 (diff) |
bond: Give stable bonds one tag.
Stable bonds require all flows to be revalidated when anything
changes. Instead of giving each slave a tag, and ORing them
together. This commit creates one tag representing the entire
bond. This will cause less false positives when deciding which
flows to revalidate.
Diffstat (limited to 'lib/bond.c')
-rw-r--r-- | lib/bond.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -107,7 +107,7 @@ struct bond { size_t n_stb_slaves; /* Number of slaves in 'stb_slaves'. */ size_t len_stb_slaves; /* Slaves allocated in 'stb_slaves'. */ bool stb_need_sort; /* True if stb_slaves is not sorted. */ - + tag_type stb_tag; /* Tag associated with this bond. */ /* Monitoring. */ enum bond_detect_mode detect; /* Link status mode, one of BLSM_*. */ @@ -328,9 +328,13 @@ bond_reconfigure(struct bond *bond, const struct bond_settings *s) if (bond->balance != BM_STABLE) { free(bond->stb_slaves); bond->stb_slaves = NULL; - } else if (!bond->stb_slaves) { + bond->stb_tag = 0; + } else if (!bond->stb_tag) { struct bond_slave *slave; + bond->stb_tag = tag_create_random(); + + assert(!bond->stb_slaves); bond->n_stb_slaves = 0; bond->len_stb_slaves = 0; bond->stb_slaves = NULL; @@ -479,11 +483,16 @@ bond_run(struct bond *bond, struct tag_set *tags, bool lacp_negotiated) } if (bond_stb_sort(bond) || is_tcp_hash != bond_is_tcp_hash(bond)) { - struct bond_slave *slave; bond_entry_reset(bond); - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - tag_set_add(tags, slave->tag); + if (bond->balance != BM_STABLE) { + struct bond_slave *slave; + + HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { + tag_set_add(tags, slave->tag); + } + } else { + tag_set_add(tags, bond->stb_tag); } } @@ -645,7 +654,7 @@ bond_choose_output_slave(struct bond *bond, const struct flow *flow, { struct bond_slave *slave = choose_output_slave(bond, flow, vlan); if (slave) { - *tags |= slave->tag; + *tags |= bond->balance == BM_STABLE ? bond->stb_tag : slave->tag; return slave->aux; } else { *tags |= bond->no_slaves_tag; |