Lines Matching full: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);
136 * __get_first_agg - get the first aggregator in the bond
139 * Return the aggregator of the first slave in @bond, or %NULL if it can't be
143 static inline struct aggregator *__get_first_agg(struct port *port) in __get_first_agg()
147 struct aggregator *agg; in __get_first_agg()
155 agg = first_slave ? &(SLAVE_AD_INFO(first_slave)->aggregator) : NULL; in __get_first_agg()
165 * Return nonzero if aggregator has a partner (denoted by a non-zero ether
168 static inline int __agg_has_partner(struct aggregator *agg) in __agg_has_partner()
252 * __get_agg_selection_mode - get the aggregator selection mode
255 * Get the aggregator selection mode. Can be %STABLE, %BANDWIDTH or %COUNT.
690 * __agg_ports_are_ready - check if all ports in an aggregator are ready
691 * @aggregator: the aggregator we're looking at
694 static int __agg_ports_are_ready(struct aggregator *aggregator) in __agg_ports_are_ready() argument
699 if (aggregator) { in __agg_ports_are_ready()
700 /* scan all ports in this aggregator to verfy if they are in __agg_ports_are_ready()
703 for (port = aggregator->lag_ports; in __agg_ports_are_ready()
717 * __set_agg_ports_ready - set value of Ready bit in all ports of an aggregator
718 * @aggregator: the aggregator we're looking at
722 static void __set_agg_ports_ready(struct aggregator *aggregator, int val) in __set_agg_ports_ready() argument
726 for (port = aggregator->lag_ports; port; in __set_agg_ports_ready()
735 static int __agg_active_ports(struct aggregator *agg) in __agg_active_ports()
750 * __get_agg_bandwidth - get the total bandwidth of an aggregator
751 * @aggregator: the aggregator we're looking at
754 static u32 __get_agg_bandwidth(struct aggregator *aggregator) in __get_agg_bandwidth() argument
756 int nports = __agg_active_ports(aggregator); in __get_agg_bandwidth()
760 switch (__get_link_speed(aggregator->lag_ports)) { in __get_agg_bandwidth()
820 * __get_active_agg - get the current active aggregator
821 * @aggregator: the aggregator we're looking at
825 static struct aggregator *__get_active_agg(struct aggregator *aggregator) in __get_active_agg() argument
827 struct bonding *bond = aggregator->slave->bond; in __get_active_agg()
832 if (SLAVE_AD_INFO(slave)->aggregator.is_active) in __get_active_agg()
833 return &(SLAVE_AD_INFO(slave)->aggregator); in __get_active_agg()
1019 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator)); in ad_mux_machine()
1034 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator)); in ad_mux_machine()
1050 if (port->aggregator->is_active) { in ad_mux_machine()
1066 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator)); in ad_mux_machine()
1068 } else if (port->aggregator->is_active) { in ad_mux_machine()
1077 * port in an active aggregator is enabled in ad_mux_machine()
1079 if (port->aggregator->is_active && in ad_mux_machine()
1094 * port is enabled for an active aggregator. in ad_mux_machine()
1098 if (port->aggregator->is_active && in ad_mux_machine()
1116 * port in an active aggregator is enabled in ad_mux_machine()
1118 if (port->aggregator && in ad_mux_machine()
1119 port->aggregator->is_active && in ad_mux_machine()
1151 if (port->aggregator->is_active) in ad_mux_machine()
1506 struct aggregator *aggregator, *free_aggregator = NULL, *temp_aggregator; in ad_port_selection_logic() local
1519 /* if the port is connected to other aggregator, detach it */ in ad_port_selection_logic()
1520 if (port->aggregator) { in ad_port_selection_logic()
1521 /* detach the port from its former aggregator */ in ad_port_selection_logic()
1522 temp_aggregator = port->aggregator; in ad_port_selection_logic()
1529 * aggregator in ad_port_selection_logic()
1536 * aggregator in ad_port_selection_logic()
1543 * aggregator in ad_port_selection_logic()
1545 port->aggregator = NULL; in ad_port_selection_logic()
1552 /* if the aggregator is empty, clear its in ad_port_selection_logic()
1561 /* meaning: the port was related to an aggregator in ad_port_selection_logic()
1562 * but was not on the aggregator port list in ad_port_selection_logic()
1564 …net_warn_ratelimited("%s: (slave %s): Warning: Port %d was related to aggregator %d but was not on… in ad_port_selection_logic()
1568 port->aggregator->aggregator_identifier); in ad_port_selection_logic()
1571 /* search on all aggregators for a suitable aggregator for this port */ in ad_port_selection_logic()
1573 aggregator = &(SLAVE_AD_INFO(slave)->aggregator); in ad_port_selection_logic()
1575 /* keep a free aggregator for later use(if needed) */ in ad_port_selection_logic()
1576 if (!aggregator->lag_ports) { in ad_port_selection_logic()
1578 free_aggregator = aggregator; in ad_port_selection_logic()
1581 /* check if current aggregator suits us */ in ad_port_selection_logic()
1582 …if (((aggregator->actor_oper_aggregator_key == port->actor_oper_port_key) && /* if all parameters … in ad_port_selection_logic()
1583 MAC_ADDRESS_EQUAL(&(aggregator->partner_system), &(port->partner_oper.system)) && in ad_port_selection_logic()
1584 (aggregator->partner_system_priority == port->partner_oper.system_priority) && in ad_port_selection_logic()
1585 (aggregator->partner_oper_aggregator_key == port->partner_oper.key) in ad_port_selection_logic()
1587 ((__agg_has_partner(aggregator) && /* partner answers */ in ad_port_selection_logic()
1588 !aggregator->is_individual) /* but is not individual OR */ in ad_port_selection_logic()
1591 /* attach to the founded aggregator */ in ad_port_selection_logic()
1592 port->aggregator = aggregator; in ad_port_selection_logic()
1594 port->aggregator->aggregator_identifier; in ad_port_selection_logic()
1595 port->next_port_in_aggregator = aggregator->lag_ports; in ad_port_selection_logic()
1596 port->aggregator->num_of_ports++; in ad_port_selection_logic()
1597 aggregator->lag_ports = port; in ad_port_selection_logic()
1600 port->aggregator->aggregator_identifier); in ad_port_selection_logic()
1609 /* the port couldn't find an aggregator - attach it to a new in ad_port_selection_logic()
1610 * aggregator in ad_port_selection_logic()
1614 /* assign port a new aggregator */ in ad_port_selection_logic()
1615 port->aggregator = free_aggregator; in ad_port_selection_logic()
1617 port->aggregator->aggregator_identifier; in ad_port_selection_logic()
1619 /* update the new aggregator's parameters in ad_port_selection_logic()
1624 port->aggregator->is_individual = false; in ad_port_selection_logic()
1626 port->aggregator->is_individual = true; in ad_port_selection_logic()
1628 port->aggregator->actor_admin_aggregator_key = in ad_port_selection_logic()
1630 port->aggregator->actor_oper_aggregator_key = in ad_port_selection_logic()
1632 port->aggregator->partner_system = in ad_port_selection_logic()
1634 port->aggregator->partner_system_priority = in ad_port_selection_logic()
1636 port->aggregator->partner_oper_aggregator_key = port->partner_oper.key; in ad_port_selection_logic()
1637 port->aggregator->receive_state = 1; in ad_port_selection_logic()
1638 port->aggregator->transmit_state = 1; in ad_port_selection_logic()
1639 port->aggregator->lag_ports = port; in ad_port_selection_logic()
1640 port->aggregator->num_of_ports++; in ad_port_selection_logic()
1647 port->aggregator->aggregator_identifier); in ad_port_selection_logic()
1650 "Port %d did not find a suitable aggregator\n", in ad_port_selection_logic()
1655 /* if all aggregator's ports are READY_N == TRUE, set ready=TRUE in ad_port_selection_logic()
1656 * in all aggregator's ports, else set ready=FALSE in all in ad_port_selection_logic()
1657 * aggregator's ports in ad_port_selection_logic()
1659 __set_agg_ports_ready(port->aggregator, in ad_port_selection_logic()
1660 __agg_ports_are_ready(port->aggregator)); in ad_port_selection_logic()
1662 aggregator = __get_first_agg(port); in ad_port_selection_logic()
1663 ad_agg_selection_logic(aggregator, update_slave_arr); in ad_port_selection_logic()
1665 if (!port->aggregator->is_active) in ad_port_selection_logic()
1669 /* Decide if "agg" is a better choice for the new active aggregator that
1672 static struct aggregator *ad_agg_selection_test(struct aggregator *best, in ad_agg_selection_test()
1673 struct aggregator *curr) in ad_agg_selection_test()
1741 static int agg_device_up(const struct aggregator *agg) in agg_device_up()
1760 * @agg: the aggregator we're looking at
1763 * It is assumed that only one aggregator may be selected for a team.
1765 * The logic of this function is to select the aggregator according to
1768 * BOND_AD_STABLE: select the aggregator with the most ports attached to
1769 * it, and to reselect the active aggregator only if the previous
1770 * aggregator has no more ports related to it.
1772 * BOND_AD_BANDWIDTH: select the aggregator with the highest total
1776 * BOND_AD_COUNT: select the aggregator with largest number of ports
1784 static void ad_agg_selection_logic(struct aggregator *agg, in ad_agg_selection_logic()
1787 struct aggregator *best, *active, *origin; in ad_agg_selection_logic()
1799 agg = &(SLAVE_AD_INFO(slave)->aggregator); in ad_agg_selection_logic()
1810 * aggregator if it's still active (it has an answering in ad_agg_selection_logic()
1832 /* if there is new best aggregator, activate it */ in ad_agg_selection_logic()
1845 agg = &(SLAVE_AD_INFO(slave)->aggregator); in ad_agg_selection_logic()
1883 /* if the selected aggregator is of join individuals in ad_agg_selection_logic()
1904 * ad_clear_agg - clear a given aggregator's parameters
1905 * @aggregator: the aggregator we're looking at
1907 static void ad_clear_agg(struct aggregator *aggregator) in ad_clear_agg() argument
1909 if (aggregator) { in ad_clear_agg()
1910 aggregator->is_individual = false; in ad_clear_agg()
1911 aggregator->actor_admin_aggregator_key = 0; in ad_clear_agg()
1912 aggregator->actor_oper_aggregator_key = 0; in ad_clear_agg()
1913 eth_zero_addr(aggregator->partner_system.mac_addr_value); in ad_clear_agg()
1914 aggregator->partner_system_priority = 0; in ad_clear_agg()
1915 aggregator->partner_oper_aggregator_key = 0; in ad_clear_agg()
1916 aggregator->receive_state = 0; in ad_clear_agg()
1917 aggregator->transmit_state = 0; in ad_clear_agg()
1918 aggregator->lag_ports = NULL; in ad_clear_agg()
1919 aggregator->is_active = 0; in ad_clear_agg()
1920 aggregator->num_of_ports = 0; in ad_clear_agg()
1922 aggregator->slave ? in ad_clear_agg()
1923 aggregator->slave->dev->name : "NULL", in ad_clear_agg()
1924 aggregator->aggregator_identifier); in ad_clear_agg()
1929 * ad_initialize_agg - initialize a given aggregator's parameters
1930 * @aggregator: the aggregator we're looking at
1932 static void ad_initialize_agg(struct aggregator *aggregator) in ad_initialize_agg() argument
1934 if (aggregator) { in ad_initialize_agg()
1935 ad_clear_agg(aggregator); in ad_initialize_agg()
1937 eth_zero_addr(aggregator->aggregator_mac_address.mac_addr_value); in ad_initialize_agg()
1938 aggregator->aggregator_identifier = 0; in ad_initialize_agg()
1939 aggregator->slave = NULL; in ad_initialize_agg()
1994 port->aggregator = NULL; in ad_initialize_port()
2013 * Enable @port if it's in an active aggregator
2017 if (port->aggregator->is_active) { in ad_enable_collecting()
2023 port->aggregator->aggregator_identifier); in ad_enable_collecting()
2035 if (port->aggregator && __agg_has_partner(port->aggregator)) { in ad_disable_distributing()
2039 port->aggregator->aggregator_identifier); in ad_disable_distributing()
2051 * Enable @port if it's in an active aggregator
2056 if (port->aggregator->is_active) { in ad_enable_collecting_distributing()
2060 port->aggregator->aggregator_identifier); in ad_enable_collecting_distributing()
2075 if (port->aggregator && __agg_has_partner(port->aggregator)) { in ad_disable_collecting_distributing()
2079 port->aggregator->aggregator_identifier); in ad_disable_collecting_distributing()
2135 * bond_3ad_initiate_agg_selection - initate aggregator selection
2182 struct aggregator *aggregator; in bond_3ad_bind_slave() local
2208 /* aggregator initialization */ in bond_3ad_bind_slave()
2209 aggregator = &(SLAVE_AD_INFO(slave)->aggregator); in bond_3ad_bind_slave()
2211 ad_initialize_agg(aggregator); in bond_3ad_bind_slave()
2213 aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr); in bond_3ad_bind_slave()
2214 aggregator->aggregator_identifier = ++BOND_AD_INFO(bond).aggregator_identifier; in bond_3ad_bind_slave()
2215 aggregator->slave = slave; in bond_3ad_bind_slave()
2216 aggregator->is_active = 0; in bond_3ad_bind_slave()
2217 aggregator->num_of_ports = 0; in bond_3ad_bind_slave()
2225 * Search for the aggregator that is related to this port, remove the
2226 * aggregator and assign another aggregator for other port related to it
2232 struct aggregator *aggregator, *new_aggregator, *temp_aggregator; in bond_3ad_unbind_slave() local
2241 aggregator = &(SLAVE_AD_INFO(slave)->aggregator); in bond_3ad_unbind_slave()
2251 aggregator->aggregator_identifier); in bond_3ad_unbind_slave()
2261 /* check if this aggregator is occupied */ in bond_3ad_unbind_slave()
2262 if (aggregator->lag_ports) { in bond_3ad_unbind_slave()
2263 /* check if there are other ports related to this aggregator in bond_3ad_unbind_slave()
2265 * there is a reason to search for new aggregator, and that we in bond_3ad_unbind_slave()
2268 if ((aggregator->lag_ports != port) || in bond_3ad_unbind_slave()
2269 (aggregator->lag_ports->next_port_in_aggregator)) { in bond_3ad_unbind_slave()
2270 /* find new aggregator for the related port(s) */ in bond_3ad_unbind_slave()
2272 new_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator); in bond_3ad_unbind_slave()
2273 /* if the new aggregator is empty, or it is in bond_3ad_unbind_slave()
2284 /* if new aggregator found, copy the aggregator's in bond_3ad_unbind_slave()
2286 * new aggregator in bond_3ad_unbind_slave()
2290 aggregator->aggregator_identifier, in bond_3ad_unbind_slave()
2295 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n"); in bond_3ad_unbind_slave()
2299 new_aggregator->is_individual = aggregator->is_individual; in bond_3ad_unbind_slave()
2300 new_aggregator->actor_admin_aggregator_key = aggregator->actor_admin_aggregator_key; in bond_3ad_unbind_slave()
2301 new_aggregator->actor_oper_aggregator_key = aggregator->actor_oper_aggregator_key; in bond_3ad_unbind_slave()
2302 new_aggregator->partner_system = aggregator->partner_system; in bond_3ad_unbind_slave()
2303 new_aggregator->partner_system_priority = aggregator->partner_system_priority; in bond_3ad_unbind_slave()
2304 new_aggregator->partner_oper_aggregator_key = aggregator->partner_oper_aggregator_key; in bond_3ad_unbind_slave()
2305 new_aggregator->receive_state = aggregator->receive_state; in bond_3ad_unbind_slave()
2306 new_aggregator->transmit_state = aggregator->transmit_state; in bond_3ad_unbind_slave()
2307 new_aggregator->lag_ports = aggregator->lag_ports; in bond_3ad_unbind_slave()
2308 new_aggregator->is_active = aggregator->is_active; in bond_3ad_unbind_slave()
2309 new_aggregator->num_of_ports = aggregator->num_of_ports; in bond_3ad_unbind_slave()
2312 * the ports about the aggregator in bond_3ad_unbind_slave()
2314 for (temp_port = aggregator->lag_ports; temp_port; in bond_3ad_unbind_slave()
2316 temp_port->aggregator = new_aggregator; in bond_3ad_unbind_slave()
2320 ad_clear_agg(aggregator); in bond_3ad_unbind_slave()
2326 …slave_warn(bond->dev, slave->dev, "unbinding aggregator, and could not find a new aggregator for i… in bond_3ad_unbind_slave()
2330 * aggregator is the one we want to remove in bond_3ad_unbind_slave()
2332 select_new_active_agg = aggregator->is_active; in bond_3ad_unbind_slave()
2333 ad_clear_agg(aggregator); in bond_3ad_unbind_slave()
2335 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n"); in bond_3ad_unbind_slave()
2336 /* select new active aggregator */ in bond_3ad_unbind_slave()
2347 /* find the aggregator that this port is connected to */ in bond_3ad_unbind_slave()
2349 temp_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator); in bond_3ad_unbind_slave()
2351 /* search the port in the aggregator's related ports */ in bond_3ad_unbind_slave()
2356 /* the aggregator found - detach the port from in bond_3ad_unbind_slave()
2357 * this aggregator in bond_3ad_unbind_slave()
2369 slave_info(bond->dev, slave->dev, "Removing an active aggregator\n"); in bond_3ad_unbind_slave()
2370 /* select new active aggregator */ in bond_3ad_unbind_slave()
2449 * times out, and it selects an aggregator for the ports that are yet not
2450 * related to any aggregator, and selects the active aggregator for a bond.
2456 struct aggregator *aggregator; in bond_3ad_state_machine_handler() local
2478 /* select the active aggregator for the bond */ in bond_3ad_state_machine_handler()
2486 aggregator = __get_first_agg(port); in bond_3ad_state_machine_handler()
2487 ad_agg_selection_logic(aggregator, &update_slave_arr); in bond_3ad_state_machine_handler()
2655 * Handle reselection of aggregator (if needed) for this port.
2682 * Handle reselection of aggregator (if needed) for this port.
2686 struct aggregator *agg; in bond_3ad_handle_link_change()
2733 * if we have an active aggregator, we're up, if not, we're down.
2734 * Presumes that we cannot have an active aggregator if there are
2744 struct aggregator *active; in bond_3ad_set_carrier()
2754 active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator)); in bond_3ad_set_carrier()
2775 * __bond_3ad_get_active_agg_info - get information of the active aggregator
2785 struct aggregator *aggregator = NULL; in __bond_3ad_get_active_agg_info() local
2792 if (port->aggregator && port->aggregator->is_active) { in __bond_3ad_get_active_agg_info()
2793 aggregator = port->aggregator; in __bond_3ad_get_active_agg_info()
2798 if (!aggregator) in __bond_3ad_get_active_agg_info()
2801 ad_info->aggregator_id = aggregator->aggregator_identifier; in __bond_3ad_get_active_agg_info()
2802 ad_info->ports = __agg_active_ports(aggregator); in __bond_3ad_get_active_agg_info()
2803 ad_info->actor_key = aggregator->actor_oper_aggregator_key; in __bond_3ad_get_active_agg_info()
2804 ad_info->partner_key = aggregator->partner_oper_aggregator_key; in __bond_3ad_get_active_agg_info()
2806 aggregator->partner_system.mac_addr_value); in __bond_3ad_get_active_agg_info()