> What motivated this change?
Just defensive coding. I noticed it when looking over the patch
again. If n_stb_slaves is 0, e.g. there are no enabled slaves. It's
better to choose something (e.g. the active slave) instead of trigger
a divide by zero.
Ethan
>
>> @@ -1518,9 +1520,13 @@ choose_output_slave(const struct bond *bond, const
>> struct flow *flow,
>> switch (bond->balance) {
>> case BM_AB:
>> return bond->active_slave;
>> - case BM_STB:
>> - return bond->stb_slaves[bond_hash(bond, flow, vlan)
>> - % bond->n_stb_slaves];
>> + case BM_STABLE:
>> + if (bond->n_stb_slaves) {
>> + return bond->stb_slaves[bond_hash(bond, flow, vlan)
>> + % bond->n_stb_slaves];
>> + } else {
>> + return bond->active_slave;
>> + }
>> case BM_SLB:
>> case BM_TCP:
>> e = lookup_bond_entry(bond, flow, vlan);
>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev