Lines Matching defs:aggregator
104 static void ad_agg_selection_logic(struct aggregator *aggregator,
106 static void ad_clear_agg(struct aggregator *aggregator);
107 static void ad_initialize_agg(struct aggregator *aggregator);
137 * __get_first_agg - get the first aggregator in the bond
140 * Return the aggregator of the first slave in @bond, or %NULL if it can't be
144 static inline struct aggregator *__get_first_agg(struct port *port)
148 struct aggregator *agg;
156 agg = first_slave ? &(SLAVE_AD_INFO(first_slave)->aggregator) : NULL;
166 * Return nonzero if aggregator has a partner (denoted by a non-zero ether
169 static inline int __agg_has_partner(struct aggregator *agg)
205 * __get_agg_selection_mode - get the aggregator selection mode
208 * Get the aggregator selection mode. Can be %STABLE, %BANDWIDTH or %COUNT.
643 * __agg_ports_are_ready - check if all ports in an aggregator are ready
644 * @aggregator: the aggregator we're looking at
647 static int __agg_ports_are_ready(struct aggregator *aggregator)
652 if (aggregator) {
653 /* scan all ports in this aggregator to verfy if they are
656 for (port = aggregator->lag_ports;
670 * __set_agg_ports_ready - set value of Ready bit in all ports of an aggregator
671 * @aggregator: the aggregator we're looking at
675 static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
679 for (port = aggregator->lag_ports; port;
688 static int __agg_active_ports(struct aggregator *agg)
703 * __get_agg_bandwidth - get the total bandwidth of an aggregator
704 * @aggregator: the aggregator we're looking at
707 static u32 __get_agg_bandwidth(struct aggregator *aggregator)
709 int nports = __agg_active_ports(aggregator);
713 switch (__get_link_speed(aggregator->lag_ports)) {
773 * __get_active_agg - get the current active aggregator
774 * @aggregator: the aggregator we're looking at
778 static struct aggregator *__get_active_agg(struct aggregator *aggregator)
780 struct bonding *bond = aggregator->slave->bond;
785 if (SLAVE_AD_INFO(slave)->aggregator.is_active)
786 return &(SLAVE_AD_INFO(slave)->aggregator);
971 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
986 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
1002 if (port->aggregator->is_active)
1014 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
1016 } else if (port->aggregator->is_active) {
1030 * port in an active aggregator is enabled
1032 if (port->aggregator &&
1033 port->aggregator->is_active &&
1065 if (port->aggregator->is_active)
1406 struct aggregator *aggregator, *free_aggregator = NULL, *temp_aggregator;
1419 /* if the port is connected to other aggregator, detach it */
1420 if (port->aggregator) {
1421 /* detach the port from its former aggregator */
1422 temp_aggregator = port->aggregator;
1429 * aggregator
1436 * aggregator
1443 * aggregator
1445 port->aggregator = NULL;
1452 /* if the aggregator is empty, clear its
1461 /* meaning: the port was related to an aggregator
1462 * but was not on the aggregator port list
1464 net_warn_ratelimited("%s: (slave %s): Warning: Port %d was related to aggregator %d but was not on its port list\n",
1468 port->aggregator->aggregator_identifier);
1471 /* search on all aggregators for a suitable aggregator for this port */
1473 aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
1475 /* keep a free aggregator for later use(if needed) */
1476 if (!aggregator->lag_ports) {
1478 free_aggregator = aggregator;
1481 /* check if current aggregator suits us */
1482 if (((aggregator->actor_oper_aggregator_key == port->actor_oper_port_key) && /* if all parameters match AND */
1483 MAC_ADDRESS_EQUAL(&(aggregator->partner_system), &(port->partner_oper.system)) &&
1484 (aggregator->partner_system_priority == port->partner_oper.system_priority) &&
1485 (aggregator->partner_oper_aggregator_key == port->partner_oper.key)
1488 !aggregator->is_individual) /* but is not individual OR */
1491 /* attach to the founded aggregator */
1492 port->aggregator = aggregator;
1494 port->aggregator->aggregator_identifier;
1495 port->next_port_in_aggregator = aggregator->lag_ports;
1496 port->aggregator->num_of_ports++;
1497 aggregator->lag_ports = port;
1500 port->aggregator->aggregator_identifier);
1509 /* the port couldn't find an aggregator - attach it to a new
1510 * aggregator
1514 /* assign port a new aggregator */
1515 port->aggregator = free_aggregator;
1517 port->aggregator->aggregator_identifier;
1519 /* update the new aggregator's parameters
1524 port->aggregator->is_individual = false;
1526 port->aggregator->is_individual = true;
1528 port->aggregator->actor_admin_aggregator_key =
1530 port->aggregator->actor_oper_aggregator_key =
1532 port->aggregator->partner_system =
1534 port->aggregator->partner_system_priority =
1536 port->aggregator->partner_oper_aggregator_key = port->partner_oper.key;
1537 port->aggregator->receive_state = 1;
1538 port->aggregator->transmit_state = 1;
1539 port->aggregator->lag_ports = port;
1540 port->aggregator->num_of_ports++;
1547 port->aggregator->aggregator_identifier);
1550 "Port %d did not find a suitable aggregator\n",
1555 /* if all aggregator's ports are READY_N == TRUE, set ready=TRUE
1556 * in all aggregator's ports, else set ready=FALSE in all
1557 * aggregator's ports
1559 __set_agg_ports_ready(port->aggregator,
1560 __agg_ports_are_ready(port->aggregator));
1562 aggregator = __get_first_agg(port);
1563 ad_agg_selection_logic(aggregator, update_slave_arr);
1565 if (!port->aggregator->is_active)
1569 /* Decide if "agg" is a better choice for the new active aggregator that
1572 static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1573 struct aggregator *curr)
1641 static int agg_device_up(const struct aggregator *agg)
1660 * @agg: the aggregator we're looking at
1663 * It is assumed that only one aggregator may be selected for a team.
1665 * The logic of this function is to select the aggregator according to
1668 * BOND_AD_STABLE: select the aggregator with the most ports attached to
1669 * it, and to reselect the active aggregator only if the previous
1670 * aggregator has no more ports related to it.
1672 * BOND_AD_BANDWIDTH: select the aggregator with the highest total
1676 * BOND_AD_COUNT: select the aggregator with largest number of ports
1684 static void ad_agg_selection_logic(struct aggregator *agg,
1687 struct aggregator *best, *active, *origin;
1699 agg = &(SLAVE_AD_INFO(slave)->aggregator);
1710 * aggregator if it's still active (it has an answering
1732 /* if there is new best aggregator, activate it */
1745 agg = &(SLAVE_AD_INFO(slave)->aggregator);
1783 /* if the selected aggregator is of join individuals
1804 * ad_clear_agg - clear a given aggregator's parameters
1805 * @aggregator: the aggregator we're looking at
1807 static void ad_clear_agg(struct aggregator *aggregator)
1809 if (aggregator) {
1810 aggregator->is_individual = false;
1811 aggregator->actor_admin_aggregator_key = 0;
1812 aggregator->actor_oper_aggregator_key = 0;
1813 eth_zero_addr(aggregator->partner_system.mac_addr_value);
1814 aggregator->partner_system_priority = 0;
1815 aggregator->partner_oper_aggregator_key = 0;
1816 aggregator->receive_state = 0;
1817 aggregator->transmit_state = 0;
1818 aggregator->lag_ports = NULL;
1819 aggregator->is_active = 0;
1820 aggregator->num_of_ports = 0;
1822 aggregator->slave ?
1823 aggregator->slave->dev->name : "NULL",
1824 aggregator->aggregator_identifier);
1829 * ad_initialize_agg - initialize a given aggregator's parameters
1830 * @aggregator: the aggregator we're looking at
1832 static void ad_initialize_agg(struct aggregator *aggregator)
1834 if (aggregator) {
1835 ad_clear_agg(aggregator);
1837 eth_zero_addr(aggregator->aggregator_mac_address.mac_addr_value);
1838 aggregator->aggregator_identifier = 0;
1839 aggregator->slave = NULL;
1894 port->aggregator = NULL;
1914 * Enable @port if it's in an active aggregator
1919 if (port->aggregator->is_active) {
1923 port->aggregator->aggregator_identifier);
1938 if (port->aggregator &&
1939 !MAC_ADDRESS_EQUAL(&(port->aggregator->partner_system),
1944 port->aggregator->aggregator_identifier);
2000 * bond_3ad_initiate_agg_selection - initate aggregator selection
2047 struct aggregator *aggregator;
2073 /* aggregator initialization */
2074 aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
2076 ad_initialize_agg(aggregator);
2078 aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr);
2079 aggregator->aggregator_identifier = ++BOND_AD_INFO(bond).aggregator_identifier;
2080 aggregator->slave = slave;
2081 aggregator->is_active = 0;
2082 aggregator->num_of_ports = 0;
2090 * Search for the aggregator that is related to this port, remove the
2091 * aggregator and assign another aggregator for other port related to it
2097 struct aggregator *aggregator, *new_aggregator, *temp_aggregator;
2106 aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
2116 aggregator->aggregator_identifier);
2126 /* check if this aggregator is occupied */
2127 if (aggregator->lag_ports) {
2128 /* check if there are other ports related to this aggregator
2130 * there is a reason to search for new aggregator, and that we
2133 if ((aggregator->lag_ports != port) ||
2134 (aggregator->lag_ports->next_port_in_aggregator)) {
2135 /* find new aggregator for the related port(s) */
2137 new_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator);
2138 /* if the new aggregator is empty, or it is
2149 /* if new aggregator found, copy the aggregator's
2151 * new aggregator
2155 aggregator->aggregator_identifier,
2160 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
2164 new_aggregator->is_individual = aggregator->is_individual;
2165 new_aggregator->actor_admin_aggregator_key = aggregator->actor_admin_aggregator_key;
2166 new_aggregator->actor_oper_aggregator_key = aggregator->actor_oper_aggregator_key;
2167 new_aggregator->partner_system = aggregator->partner_system;
2168 new_aggregator->partner_system_priority = aggregator->partner_system_priority;
2169 new_aggregator->partner_oper_aggregator_key = aggregator->partner_oper_aggregator_key;
2170 new_aggregator->receive_state = aggregator->receive_state;
2171 new_aggregator->transmit_state = aggregator->transmit_state;
2172 new_aggregator->lag_ports = aggregator->lag_ports;
2173 new_aggregator->is_active = aggregator->is_active;
2174 new_aggregator->num_of_ports = aggregator->num_of_ports;
2177 * the ports about the aggregator
2179 for (temp_port = aggregator->lag_ports; temp_port;
2181 temp_port->aggregator = new_aggregator;
2185 ad_clear_agg(aggregator);
2191 slave_warn(bond->dev, slave->dev, "unbinding aggregator, and could not find a new aggregator for its ports\n");
2195 * aggregator is the one we want to remove
2197 select_new_active_agg = aggregator->is_active;
2198 ad_clear_agg(aggregator);
2200 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
2201 /* select new active aggregator */
2212 /* find the aggregator that this port is connected to */
2214 temp_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator);
2216 /* search the port in the aggregator's related ports */
2221 /* the aggregator found - detach the port from
2222 * this aggregator
2234 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
2235 /* select new active aggregator */
2314 * times out, and it selects an aggregator for the ports that are yet not
2315 * related to any aggregator, and selects the active aggregator for a bond.
2321 struct aggregator *aggregator;
2343 /* select the active aggregator for the bond */
2351 aggregator = __get_first_agg(port);
2352 ad_agg_selection_logic(aggregator, &update_slave_arr);
2520 * Handle reselection of aggregator (if needed) for this port.
2547 * Handle reselection of aggregator (if needed) for this port.
2551 struct aggregator *agg;
2598 * if we have an active aggregator, we're up, if not, we're down.
2599 * Presumes that we cannot have an active aggregator if there are
2609 struct aggregator *active;
2619 active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator));
2640 * __bond_3ad_get_active_agg_info - get information of the active aggregator
2650 struct aggregator *aggregator = NULL;
2657 if (port->aggregator && port->aggregator->is_active) {
2658 aggregator = port->aggregator;
2663 if (!aggregator)
2666 ad_info->aggregator_id = aggregator->aggregator_identifier;
2667 ad_info->ports = __agg_active_ports(aggregator);
2668 ad_info->actor_key = aggregator->actor_oper_aggregator_key;
2669 ad_info->partner_key = aggregator->partner_oper_aggregator_key;
2671 aggregator->partner_system.mac_addr_value);