net/bonding: fix selection logic
Arrays agg_count and agg_bandwidth should be indexed by slave_id not by aggregator port_id. The new_agg_id should be chosen as slave_id from slaves table in different selection modes. Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes") Cc: stable@dpdk.org Signed-off-by: Krzysztof Kanas <kkanas@marvell.com> Acked-by: Chas Williams <chas3@att.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
5fde1a7592
commit
8d75f49e61
@ -673,9 +673,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id)
|
|||||||
uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0};
|
uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0};
|
||||||
uint64_t agg_count[RTE_MAX_ETHPORTS] = {0};
|
uint64_t agg_count[RTE_MAX_ETHPORTS] = {0};
|
||||||
uint16_t default_slave = 0;
|
uint16_t default_slave = 0;
|
||||||
uint16_t mode_count_id;
|
|
||||||
uint16_t mode_band_id;
|
|
||||||
struct rte_eth_link link_info;
|
struct rte_eth_link link_info;
|
||||||
|
uint16_t agg_new_idx = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
slaves = internals->active_slaves;
|
slaves = internals->active_slaves;
|
||||||
@ -696,8 +695,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id)
|
|||||||
slaves[i], rte_strerror(-ret));
|
slaves[i], rte_strerror(-ret));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
agg_count[agg->aggregator_port_id] += 1;
|
agg_count[i] += 1;
|
||||||
agg_bandwidth[agg->aggregator_port_id] += link_info.link_speed;
|
agg_bandwidth[i] += link_info.link_speed;
|
||||||
|
|
||||||
/* Actors system ID is not checked since all slave device have the same
|
/* Actors system ID is not checked since all slave device have the same
|
||||||
* ID (MAC address). */
|
* ID (MAC address). */
|
||||||
@ -718,22 +717,22 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id)
|
|||||||
|
|
||||||
switch (internals->mode4.agg_selection) {
|
switch (internals->mode4.agg_selection) {
|
||||||
case AGG_COUNT:
|
case AGG_COUNT:
|
||||||
mode_count_id = max_index(agg_count, slaves_count);
|
agg_new_idx = max_index(agg_count, slaves_count);
|
||||||
new_agg_id = mode_count_id;
|
new_agg_id = slaves[agg_new_idx];
|
||||||
break;
|
break;
|
||||||
case AGG_BANDWIDTH:
|
case AGG_BANDWIDTH:
|
||||||
mode_band_id = max_index(agg_bandwidth, slaves_count);
|
agg_new_idx = max_index(agg_bandwidth, slaves_count);
|
||||||
new_agg_id = mode_band_id;
|
new_agg_id = slaves[agg_new_idx];
|
||||||
break;
|
break;
|
||||||
case AGG_STABLE:
|
case AGG_STABLE:
|
||||||
if (default_slave == slaves_count)
|
if (default_slave == slaves_count)
|
||||||
new_agg_id = slave_id;
|
new_agg_id = slaves[slave_id];
|
||||||
else
|
else
|
||||||
new_agg_id = slaves[default_slave];
|
new_agg_id = slaves[default_slave];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (default_slave == slaves_count)
|
if (default_slave == slaves_count)
|
||||||
new_agg_id = slave_id;
|
new_agg_id = slaves[slave_id];
|
||||||
else
|
else
|
||||||
new_agg_id = slaves[default_slave];
|
new_agg_id = slaves[default_slave];
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user