X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fbond.c;h=fe84f9c212bd8b9277a74b2fa6ab07f033bd4402;hb=75fad143babf79f0f2841163f03843cf22e988df;hp=62f38c9ae09eac2a110774b381a8540b45c617e4;hpb=b8dddecfcc418ac4dcf01f6c57d976895e549c49;p=sliver-openvswitch.git diff --git a/lib/bond.c b/lib/bond.c index 62f38c9ae..fe84f9c21 100644 --- a/lib/bond.c +++ b/lib/bond.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "coverage.h" #include "dynamic-string.h" @@ -772,8 +773,12 @@ choose_entry_to_migrate(const struct bond_slave *from, uint64_t to_tx_bytes) delta = e->tx_bytes; old_ratio = (double)from->tx_bytes / to_tx_bytes; new_ratio = (double)(from->tx_bytes - delta) / (to_tx_bytes + delta); - if (old_ratio - new_ratio > 0.1) { - /* Would decrease the ratio, move it. */ + if (old_ratio - new_ratio > 0.1 + && fabs(new_ratio - 1.0) < fabs(old_ratio - 1.0)) { + /* We're aiming for an ideal ratio of 1, meaning both the 'from' + and 'to' slave have the same load. Therefore, we only move an + entry if it decreases the load on 'from', and brings us closer + to equal traffic load. */ return e; } }