bond = xzalloc(sizeof *bond);
bond->ofproto = ofproto;
hmap_init(&bond->slaves);
- list_init(&bond->enabled_slaves);
+ ovs_list_init(&bond->enabled_slaves);
ovs_mutex_init(&bond->mutex);
ovs_refcount_init(&bond->ref_cnt);
hmap_init(&bond->pr_rule_ops);
if (!slave->enabled) {
ds_put_cstr(&ds, " (disabled)");
}
- if (!list_is_empty(&slave->entries)) {
+ if (!ovs_list_is_empty(&slave->entries)) {
struct bond_entry *e;
ds_put_cstr(&ds, " (");
LIST_FOR_EACH (e, list_node, &slave->entries) {
- if (&e->list_node != list_front(&slave->entries)) {
+ if (&e->list_node != ovs_list_front(&slave->entries)) {
ds_put_cstr(&ds, " + ");
}
ds_put_format(&ds, "h%"PRIdPTR": %"PRIu64"kB",
{
struct bond_entry *e;
- if (list_is_short(&from->entries)) {
+ if (ovs_list_is_short(&from->entries)) {
/* 'from' carries no more than one MAC hash, so shifting load away from
* it would be pointless. */
return NULL;
break;
}
}
- list_insert(&pos->bal_node, &slave->bal_node);
+ ovs_list_insert(&pos->bal_node, &slave->bal_node);
}
/* Removes 'slave' from its current list and then inserts it into 'bals' so
static void
reinsert_bal(struct ovs_list *bals, struct bond_slave *slave)
{
- list_remove(&slave->bal_node);
+ ovs_list_remove(&slave->bal_node);
insert_bal(bals, slave);
}
* Compute each slave's tx_bytes as the sum of its entries' tx_bytes. */
HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) {
slave->tx_bytes = 0;
- list_init(&slave->entries);
+ ovs_list_init(&slave->entries);
}
for (e = &bond->hash[0]; e <= &bond->hash[BOND_MASK]; e++) {
if (e->slave && e->tx_bytes) {
e->slave->tx_bytes += e->tx_bytes;
- list_push_back(&e->slave->entries, &e->list_node);
+ ovs_list_push_back(&e->slave->entries, &e->list_node);
}
}
*
* XXX This is O(n**2) in the number of slaves but it could be O(n lg n)
* with a proper list sort algorithm. */
- list_init(&bals);
+ ovs_list_init(&bals);
HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) {
if (slave->enabled) {
insert_bal(&bals, slave);
log_bals(bond, &bals);
/* Shift load from the most-loaded slaves to the least-loaded slaves. */
- while (!list_is_short(&bals)) {
- struct bond_slave *from = bond_slave_from_bal_node(list_front(&bals));
- struct bond_slave *to = bond_slave_from_bal_node(list_back(&bals));
+ while (!ovs_list_is_short(&bals)) {
+ struct bond_slave *from = bond_slave_from_bal_node(ovs_list_front(&bals));
+ struct bond_slave *to = bond_slave_from_bal_node(ovs_list_back(&bals));
uint64_t overload;
overload = from->tx_bytes - to->tx_bytes;
* We don't add the element to to->hashes. That would only allow
* 'e' to be migrated to another slave in this rebalancing run, and
* there is no point in doing that. */
- list_remove(&e->list_node);
+ ovs_list_remove(&e->list_node);
/* Re-sort 'bals'. */
reinsert_bal(&bals, from);
} else {
/* Can't usefully migrate anything away from 'from'.
* Don't reconsider it. */
- list_remove(&from->bal_node);
+ ovs_list_remove(&from->bal_node);
}
}
ovs_mutex_lock(&slave->bond->mutex);
if (enable) {
- list_insert(&slave->bond->enabled_slaves, &slave->list_node);
+ ovs_list_insert(&slave->bond->enabled_slaves, &slave->list_node);
} else {
- list_remove(&slave->list_node);
+ ovs_list_remove(&slave->list_node);
}
ovs_mutex_unlock(&slave->bond->mutex);
struct ovs_list *node;
ovs_mutex_lock(&bond->mutex);
- if (list_is_empty(&bond->enabled_slaves)) {
+ if (ovs_list_is_empty(&bond->enabled_slaves)) {
ovs_mutex_unlock(&bond->mutex);
return NULL;
}
- node = list_pop_front(&bond->enabled_slaves);
- list_push_back(&bond->enabled_slaves, node);
+ node = ovs_list_pop_front(&bond->enabled_slaves);
+ ovs_list_push_back(&bond->enabled_slaves, node);
ovs_mutex_unlock(&bond->mutex);
return CONTAINER_OF(node, struct bond_slave, list_node);