Lines Matching defs:aggregator
100 static void ad_agg_selection_logic(struct aggregator *aggregator,
102 static void ad_clear_agg(struct aggregator *aggregator);
103 static void ad_initialize_agg(struct aggregator *aggregator);
133 * __get_first_agg - get the first aggregator in the bond
136 * Return the aggregator of the first slave in @bond, or %NULL if it can't be
140 static inline struct aggregator *__get_first_agg(struct port *port)
144 struct aggregator *agg;
152 agg = first_slave ? &(SLAVE_AD_INFO(first_slave)->aggregator) : NULL;
162 * Return nonzero if aggregator has a partner (denoted by a non-zero ether
165 static inline int __agg_has_partner(struct aggregator *agg)
201 * __get_agg_selection_mode - get the aggregator selection mode
204 * Get the aggregator selection mode. Can be %STABLE, %BANDWIDTH or %COUNT.
624 * __agg_ports_are_ready - check if all ports in an aggregator are ready
625 * @aggregator: the aggregator we're looking at
628 static int __agg_ports_are_ready(struct aggregator *aggregator)
633 if (aggregator) {
634 /* scan all ports in this aggregator to verfy if they are
637 for (port = aggregator->lag_ports;
651 * __set_agg_ports_ready - set value of Ready bit in all ports of an aggregator
652 * @aggregator: the aggregator we're looking at
656 static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
660 for (port = aggregator->lag_ports; port;
669 static int __agg_active_ports(struct aggregator *agg)
684 * __get_agg_bandwidth - get the total bandwidth of an aggregator
685 * @aggregator: the aggregator we're looking at
688 static u32 __get_agg_bandwidth(struct aggregator *aggregator)
690 int nports = __agg_active_ports(aggregator);
694 switch (__get_link_speed(aggregator->lag_ports)) {
745 * __get_active_agg - get the current active aggregator
746 * @aggregator: the aggregator we're looking at
750 static struct aggregator *__get_active_agg(struct aggregator *aggregator)
752 struct bonding *bond = aggregator->slave->bond;
757 if (SLAVE_AD_INFO(slave)->aggregator.is_active)
758 return &(SLAVE_AD_INFO(slave)->aggregator);
943 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
958 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
974 if (port->aggregator->is_active)
986 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
988 } else if (port->aggregator->is_active) {
1002 * port in an active aggregator is enabled
1004 if (port->aggregator &&
1005 port->aggregator->is_active &&
1037 if (port->aggregator->is_active)
1377 struct aggregator *aggregator, *free_aggregator = NULL, *temp_aggregator;
1390 /* if the port is connected to other aggregator, detach it */
1391 if (port->aggregator) {
1392 /* detach the port from its former aggregator */
1393 temp_aggregator = port->aggregator;
1400 * aggregator
1407 * aggregator
1414 * aggregator
1416 port->aggregator = NULL;
1423 /* if the aggregator is empty, clear its
1432 /* meaning: the port was related to an aggregator
1433 * but was not on the aggregator port list
1435 net_warn_ratelimited("%s: (slave %s): Warning: Port %d was related to aggregator %d but was not on its port list\n",
1439 port->aggregator->aggregator_identifier);
1442 /* search on all aggregators for a suitable aggregator for this port */
1444 aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
1446 /* keep a free aggregator for later use(if needed) */
1447 if (!aggregator->lag_ports) {
1449 free_aggregator = aggregator;
1452 /* check if current aggregator suits us */
1453 if (((aggregator->actor_oper_aggregator_key == port->actor_oper_port_key) && /* if all parameters match AND */
1454 MAC_ADDRESS_EQUAL(&(aggregator->partner_system), &(port->partner_oper.system)) &&
1455 (aggregator->partner_system_priority == port->partner_oper.system_priority) &&
1456 (aggregator->partner_oper_aggregator_key == port->partner_oper.key)
1459 !aggregator->is_individual) /* but is not individual OR */
1462 /* attach to the founded aggregator */
1463 port->aggregator = aggregator;
1465 port->aggregator->aggregator_identifier;
1466 port->next_port_in_aggregator = aggregator->lag_ports;
1467 port->aggregator->num_of_ports++;
1468 aggregator->lag_ports = port;
1471 port->aggregator->aggregator_identifier);
1480 /* the port couldn't find an aggregator - attach it to a new
1481 * aggregator
1485 /* assign port a new aggregator */
1486 port->aggregator = free_aggregator;
1488 port->aggregator->aggregator_identifier;
1490 /* update the new aggregator's parameters
1495 port->aggregator->is_individual = false;
1497 port->aggregator->is_individual = true;
1499 port->aggregator->actor_admin_aggregator_key =
1501 port->aggregator->actor_oper_aggregator_key =
1503 port->aggregator->partner_system =
1505 port->aggregator->partner_system_priority =
1507 port->aggregator->partner_oper_aggregator_key = port->partner_oper.key;
1508 port->aggregator->receive_state = 1;
1509 port->aggregator->transmit_state = 1;
1510 port->aggregator->lag_ports = port;
1511 port->aggregator->num_of_ports++;
1518 port->aggregator->aggregator_identifier);
1521 "Port %d did not find a suitable aggregator\n",
1525 /* if all aggregator's ports are READY_N == TRUE, set ready=TRUE
1526 * in all aggregator's ports, else set ready=FALSE in all
1527 * aggregator's ports
1529 __set_agg_ports_ready(port->aggregator,
1530 __agg_ports_are_ready(port->aggregator));
1532 aggregator = __get_first_agg(port);
1533 ad_agg_selection_logic(aggregator, update_slave_arr);
1535 if (!port->aggregator->is_active)
1539 /* Decide if "agg" is a better choice for the new active aggregator that
1542 static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1543 struct aggregator *curr)
1611 static int agg_device_up(const struct aggregator *agg)
1630 * @agg: the aggregator we're looking at
1633 * It is assumed that only one aggregator may be selected for a team.
1635 * The logic of this function is to select the aggregator according to
1638 * BOND_AD_STABLE: select the aggregator with the most ports attached to
1639 * it, and to reselect the active aggregator only if the previous
1640 * aggregator has no more ports related to it.
1642 * BOND_AD_BANDWIDTH: select the aggregator with the highest total
1646 * BOND_AD_COUNT: select the aggregator with largest number of ports
1654 static void ad_agg_selection_logic(struct aggregator *agg,
1657 struct aggregator *best, *active, *origin;
1669 agg = &(SLAVE_AD_INFO(slave)->aggregator);
1680 * aggregator if it's still active (it has an answering
1702 /* if there is new best aggregator, activate it */
1715 agg = &(SLAVE_AD_INFO(slave)->aggregator);
1753 /* if the selected aggregator is of join individuals
1774 * ad_clear_agg - clear a given aggregator's parameters
1775 * @aggregator: the aggregator we're looking at
1777 static void ad_clear_agg(struct aggregator *aggregator)
1779 if (aggregator) {
1780 aggregator->is_individual = false;
1781 aggregator->actor_admin_aggregator_key = 0;
1782 aggregator->actor_oper_aggregator_key = 0;
1783 eth_zero_addr(aggregator->partner_system.mac_addr_value);
1784 aggregator->partner_system_priority = 0;
1785 aggregator->partner_oper_aggregator_key = 0;
1786 aggregator->receive_state = 0;
1787 aggregator->transmit_state = 0;
1788 aggregator->lag_ports = NULL;
1789 aggregator->is_active = 0;
1790 aggregator->num_of_ports = 0;
1792 aggregator->slave ?
1793 aggregator->slave->dev->name : "NULL",
1794 aggregator->aggregator_identifier);
1799 * ad_initialize_agg - initialize a given aggregator's parameters
1800 * @aggregator: the aggregator we're looking at
1802 static void ad_initialize_agg(struct aggregator *aggregator)
1804 if (aggregator) {
1805 ad_clear_agg(aggregator);
1807 eth_zero_addr(aggregator->aggregator_mac_address.mac_addr_value);
1808 aggregator->aggregator_identifier = 0;
1809 aggregator->slave = NULL;
1864 port->aggregator = NULL;
1884 * Enable @port if it's in an active aggregator
1889 if (port->aggregator->is_active) {
1893 port->aggregator->aggregator_identifier);
1908 if (port->aggregator &&
1909 !MAC_ADDRESS_EQUAL(&(port->aggregator->partner_system),
1914 port->aggregator->aggregator_identifier);
1970 * bond_3ad_initiate_agg_selection - initate aggregator selection
2023 struct aggregator *aggregator;
2049 /* aggregator initialization */
2050 aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
2052 ad_initialize_agg(aggregator);
2054 aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr);
2055 aggregator->aggregator_identifier = ++BOND_AD_INFO(bond).aggregator_identifier;
2056 aggregator->slave = slave;
2057 aggregator->is_active = 0;
2058 aggregator->num_of_ports = 0;
2066 * Search for the aggregator that is related to this port, remove the
2067 * aggregator and assign another aggregator for other port related to it
2073 struct aggregator *aggregator, *new_aggregator, *temp_aggregator;
2082 aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
2092 aggregator->aggregator_identifier);
2102 /* check if this aggregator is occupied */
2103 if (aggregator->lag_ports) {
2104 /* check if there are other ports related to this aggregator
2106 * there is a reason to search for new aggregator, and that we
2109 if ((aggregator->lag_ports != port) ||
2110 (aggregator->lag_ports->next_port_in_aggregator)) {
2111 /* find new aggregator for the related port(s) */
2113 new_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator);
2114 /* if the new aggregator is empty, or it is
2125 /* if new aggregator found, copy the aggregator's
2127 * new aggregator
2131 aggregator->aggregator_identifier,
2136 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
2140 new_aggregator->is_individual = aggregator->is_individual;
2141 new_aggregator->actor_admin_aggregator_key = aggregator->actor_admin_aggregator_key;
2142 new_aggregator->actor_oper_aggregator_key = aggregator->actor_oper_aggregator_key;
2143 new_aggregator->partner_system = aggregator->partner_system;
2144 new_aggregator->partner_system_priority = aggregator->partner_system_priority;
2145 new_aggregator->partner_oper_aggregator_key = aggregator->partner_oper_aggregator_key;
2146 new_aggregator->receive_state = aggregator->receive_state;
2147 new_aggregator->transmit_state = aggregator->transmit_state;
2148 new_aggregator->lag_ports = aggregator->lag_ports;
2149 new_aggregator->is_active = aggregator->is_active;
2150 new_aggregator->num_of_ports = aggregator->num_of_ports;
2153 * the ports about the aggregator
2155 for (temp_port = aggregator->lag_ports; temp_port;
2157 temp_port->aggregator = new_aggregator;
2161 ad_clear_agg(aggregator);
2167 slave_warn(bond->dev, slave->dev, "unbinding aggregator, and could not find a new aggregator for its ports\n");
2171 * aggregator is the one we want to remove
2173 select_new_active_agg = aggregator->is_active;
2174 ad_clear_agg(aggregator);
2176 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
2177 /* select new active aggregator */
2188 /* find the aggregator that this port is connected to */
2190 temp_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator);
2192 /* search the port in the aggregator's related ports */
2197 /* the aggregator found - detach the port from
2198 * this aggregator
2210 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
2211 /* select new active aggregator */
2290 * times out, and it selects an aggregator for the ports that are yet not
2291 * related to any aggregator, and selects the active aggregator for a bond.
2297 struct aggregator *aggregator;
2319 /* select the active aggregator for the bond */
2327 aggregator = __get_first_agg(port);
2328 ad_agg_selection_logic(aggregator, &update_slave_arr);
2496 * Handle reselection of aggregator (if needed) for this port.
2523 * Handle reselection of aggregator (if needed) for this port.
2527 struct aggregator *agg;
2574 * if we have an active aggregator, we're up, if not, we're down.
2575 * Presumes that we cannot have an active aggregator if there are
2585 struct aggregator *active;
2595 active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator));
2616 * __bond_3ad_get_active_agg_info - get information of the active aggregator
2626 struct aggregator *aggregator = NULL;
2633 if (port->aggregator && port->aggregator->is_active) {
2634 aggregator = port->aggregator;
2639 if (!aggregator)
2642 ad_info->aggregator_id = aggregator->aggregator_identifier;
2643 ad_info->ports = __agg_active_ports(aggregator);
2644 ad_info->actor_key = aggregator->actor_oper_aggregator_key;
2645 ad_info->partner_key = aggregator->partner_oper_aggregator_key;
2647 aggregator->partner_system.mac_addr_value);