bonding: rename bond components
Subsystems (14)
v4 cover bonding: rename bond components
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
There are a few problems with this change. First up, "port" is used in the bonding 802.3ad code, so the first step here is to rename port to ad_port, so we can reuse port. Second, we have the issue of not wanting to break any existing userspace, which I believe this patchset accomplishes, preserving all existing sysfs and procfs interfaces, and adding module parameter aliases where necessary.
Third, we do still have the issue of ease of backporting fixes to -stable trees. I've not had a huge amount of time to spend on it, but brief forays into coccinelle didn't really pay off (since it's meant to operate on code, not patches), and the best solution I can come up with is providing a shell script someone could run over git-format-patch output before git-am'ing the result to a -stable tree, though scripting these changes in the first place turned out to be not the best thing to do anyway, due to subtle cases where use of master or slave can NOT yet be replaced, so a large amount of work was done by hand, inspection, trial and error, which is why this set is a lot longer in coming than I'd originally hoped. I don't expect -stable backports to be horrible to figure out one way or another though, and I don't believe that a bit of inconvenience on that front is enough to warrant not making these changes.
See here for further details on Red Hat's commitment to this work:
https://www.redhat.com/en/blog/making-open-source-more-inclusive-eradicating-problematic-language
As far as testing goes, I've manually operated on various bonds while working on this code, and have run it through multiple lnst test runs, which exercises the existing sysfs interfaces fairly extensively. As far as I can tell through testing and inspection, there is no breakage of any existing interfaces with this set.
v2: legacy module parameters are retained this time, and we're trying out bond/port instead of aggregator/link in place of master/slave. The procfs interface legacy output is also duplicated or dropped, depending on Kconfig, rather than being replaced.
v3: remove Kconfig knob, leave sysfs and procfs interfaces entirely untouched, but update documentation to reference their deprecated nature, explain the name changes, add references to NetworkManager, include more netlink/iproute2 examples and make note of netlink being the preferred interface for userspace interaction with bonds.
v4: documentation table of contents fixes
Jarod Wilson (5):
bonding: rename 802.3ad's struct port to ad_port
bonding: replace use of the term master where possible
bonding: rename slave to port where possible
bonding: rename bonding_sysfs_slave.c to _port.c
bonding: update Documentation for port/bond terminology
.clang-format | 4 +- Documentation/networking/bonding.rst | 581 ++-- drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/core/lag.c | 2 +- drivers/infiniband/core/roce_gid_mgmt.c | 10 +- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/net/bonding/Makefile | 2 +- drivers/net/bonding/bond_3ad.c | 1701 ++++++------ drivers/net/bonding/bond_alb.c | 689 ++--- drivers/net/bonding/bond_debugfs.c | 2 +- drivers/net/bonding/bond_main.c | 2341 +++++++++-------- drivers/net/bonding/bond_netlink.c | 114 +- drivers/net/bonding/bond_options.c | 258 +- drivers/net/bonding/bond_procfs.c | 86 +- drivers/net/bonding/bond_sysfs.c | 78 +- drivers/net/bonding/bond_sysfs_port.c | 185 ++ drivers/net/bonding/bond_sysfs_slave.c | 176 -- .../ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 +- .../net/ethernet/mellanox/mlx4/en_netdev.c | 14 +- .../ethernet/mellanox/mlx5/core/en/rep/bond.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../ethernet/netronome/nfp/flower/lag_conf.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 12 +- include/linux/netdevice.h | 22 +- include/net/bond_3ad.h | 42 +- include/net/bond_alb.h | 74 +- include/net/bond_options.h | 18 +- include/net/bonding.h | 362 +-- include/net/lag.h | 2 +- 29 files changed, 3482 insertions(+), 3307 deletions(-) create mode 100644 drivers/net/bonding/bond_sysfs_port.c delete mode 100644 drivers/net/bonding/bond_sysfs_slave.c
Signature · 1 line
2.28.0
PATCH v4 1/5 bonding: rename 802.3ad's struct port to ad_port
The intention is to reuse "port" in place of "slave" in the bonding driver after making this change, as port is consistent with the bridge and team drivers, and allows us to remove socially problematic language from the bonding driver.
--- drivers/net/bonding/bond_3ad.c | 1307 ++++++++++++------------ drivers/net/bonding/bond_main.c | 4 +- drivers/net/bonding/bond_netlink.c | 6 +- drivers/net/bonding/bond_procfs.c | 36 +- drivers/net/bonding/bond_sysfs_slave.c | 10 +- include/net/bond_3ad.h | 14 +- 6 files changed, 688 insertions(+), 689 deletions(-)
drivers/net/bonding/bond_3ad.c +653 -654
@@ -89,60 +89,60 @@ static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =MULTICAST_LACPDU_ADDR ;/* ================= main 802.3ad protocol functions ================== */ -static int ad_lacpdu_send (struct port *port); -static int ad_marker_send (struct port *port,struct bond_marker *marker); -static void ad_mux_machine (struct port *port,bool *update_slave_arr); -static void ad_rx_machine (struct lacpdu *lacpdu,struct port *port); -static void ad_tx_machine (struct port *port); -static void ad_periodic_machine (struct port *port); -static void ad_port_selection_logic (struct port *port,bool *update_slave_arr); +static int ad_lacpdu_send (struct ad_port *ad_port); +static int ad_marker_send (struct ad_port *ad_port,struct bond_marker *marker); +static void ad_mux_machine (struct ad_port *ad_port,bool *update_slave_arr); +static void ad_rx_machine (struct lacpdu *lacpdu,struct ad_port *ad_port); +static void ad_tx_machine (struct ad_port *ad_port); +static void ad_periodic_machine (struct ad_port *ad_port); +static void ad_port_selection_logic (struct ad_port *ad_port,bool *update_slave_arr);static void ad_agg_selection_logic (struct aggregator *aggregator,bool *update_slave_arr);static void ad_clear_agg (struct aggregator *aggregator);static void ad_initialize_agg (struct aggregator *aggregator); -static void ad_initialize_port (struct port *port,int lacp_fast); -static void ad_enable_collecting_distributing (struct port *port, +static void ad_initialize_port (struct ad_port *ad_port,int lacp_fast); +static void ad_enable_collecting_distributing (struct ad_port *ad_port,bool *update_slave_arr); -static void ad_disable_collecting_distributing (struct port *port, +static void ad_disable_collecting_distributing (struct ad_port *ad_port,bool *update_slave_arr);static void ad_marker_info_received (struct bond_marker *marker_info, -struct port *port); +struct ad_port *ad_port);static void ad_marker_response_received (struct bond_marker *marker, -struct port *port); -static void ad_update_actor_keys (struct port *port,bool reset); +struct ad_port *ad_port); +static void ad_update_actor_keys (struct ad_port *ad_port,bool reset);/* ================= api to bonding and kernel code ================== */ /** -* __get_bond_by_port - get the port's bonding struct -* @port: the port we're looking at +* __get_bond_by_ad_port - get the ad_port's bonding struct +* @ad_port: the ad_port we're looking at * -* Return @port's bonding struct, or %NULL if it can't be found. +* Return @ad_port's bonding struct, or %NULL if it can't be found. */ -static inline struct bonding *__get_bond_by_port (struct port *port) +static inline struct bonding *__get_bond_by_ad_port (struct ad_port *ad_port) { -if (port->slave ==NULL ) +if (ad_port->slave ==NULL )return NULL ; -return bond_get_bond_by_slave (port->slave); +return bond_get_bond_by_slave (ad_port->slave); }/** * __get_first_agg - get the first aggregator in the bond -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * Return the aggregator of the first slave in @bond, or %NULL if it can't be * found. * The caller must hold RCU or RTNL lock. */ -static inline struct aggregator *__get_first_agg (struct port *port) +static inline struct aggregator *__get_first_agg (struct ad_port *ad_port) { -struct bonding *bond =__get_bond_by_port (port); +struct bonding *bond =__get_bond_by_ad_port (ad_port);struct slave *first_slave;struct aggregator *agg; -/* If there's no bond for this port, or bond has no slaves */ +/* If there's no bond for this ad_port, or bond has no slaves */ if (bond ==NULL )return NULL ;
@@ -167,44 +167,44 @@ static inline int __agg_has_partner(struct aggregator *agg) }/** -* __disable_port - disable the port's slave -* @port: the port we're looking at +* __disable_ad_port - disable the ad_port's slave +* @ad_port: the ad_port we're looking at */ -static inline void __disable_port (struct port *port) +static inline void __disable_ad_port (struct ad_port *ad_port) { -bond_set_slave_inactive_flags (port->slave,BOND_SLAVE_NOTIFY_LATER ); +bond_set_slave_inactive_flags (ad_port->slave,BOND_SLAVE_NOTIFY_LATER ); }/** -* __enable_port - enable the port's slave, if it's up -* @port: the port we're looking at +* __enable_ad_port - enable the ad_port's slave, if it's up +* @ad_port: the ad_port we're looking at */ -static inline void __enable_port (struct port *port) +static inline void __enable_ad_port (struct ad_port *ad_port) { -struct slave *slave = port->slave; +struct slave *slave = ad_port->slave;if ((slave->link ==BOND_LINK_UP ) &&bond_slave_is_up (slave))bond_set_slave_active_flags (slave,BOND_SLAVE_NOTIFY_LATER ); }/** -* __port_is_enabled - check if the port's slave is in active state -* @port: the port we're looking at +* __ad_port_is_enabled - check if the ad_port's slave is in active state +* @ad_port: the ad_port we're looking at */ -static inline int __port_is_enabled (struct port *port) +static inline int __ad_port_is_enabled (struct ad_port *ad_port) { -return bond_is_active_slave (port->slave); +return bond_is_active_slave (ad_port->slave); }/** * __get_agg_selection_mode - get the aggregator selection mode -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * Get the aggregator selection mode. Can be %STABLE, %BANDWIDTH or %COUNT. */ -static inline u32 __get_agg_selection_mode (struct port *port) +static inline u32 __get_agg_selection_mode (struct ad_port *ad_port) { -struct bonding *bond =__get_bond_by_port (port); +struct bonding *bond =__get_bond_by_ad_port (ad_port);if (bond ==NULL )return BOND_AD_STABLE ;
@@ -214,11 +214,11 @@ static inline u32 __get_agg_selection_mode(struct port *port)/** * __check_agg_selection_timer - check if the selection timer has expired -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at */ -static inline int __check_agg_selection_timer (struct port *port) +static inline int __check_agg_selection_timer (struct ad_port *ad_port) { -struct bonding *bond =__get_bond_by_port (port); +struct bonding *bond =__get_bond_by_ad_port (ad_port);if (bond ==NULL )return 0 ;
@@ -227,10 +227,10 @@ static inline int __check_agg_selection_timer(struct port *port) }/** -* __get_link_speed - get a port's speed -* @port: the port we're looking at +* __get_link_speed - get an ad_port's speed +* @ad_port: the ad_port we're looking at * -* Return @port's speed in 802.3ad enum format. i.e. one of: +* Return @ad_port's speed in 802.3ad enum format. i.e. one of: * 0, * %AD_LINK_SPEED_10MBPS, * %AD_LINK_SPEED_100MBPS,
@@ -246,9 +246,9 @@ static inline int __check_agg_selection_timer(struct port *port)* %AD_LINK_SPEED_56000MBPS * %AD_LINK_SPEED_100000MBPS */ -static u16 __get_link_speed (struct port *port) +static u16 __get_link_speed (struct ad_port *ad_port) { -struct slave *slave = port->slave; +struct slave *slave = ad_port->slave;u16 speed;/* this if covers only a special case: when the configuration starts
@@ -318,28 +318,28 @@ static u16 __get_link_speed(struct port *port)pr_warn_once ("%s: (slave %s): unknown ethtool speed (%d) for port %d (set it to 0)\n" , slave->bond->dev->name, slave->dev->name, slave->speed, - port->actor_port_number); + ad_port->actor_port_number); speed =0 ;break ; } }slave_dbg (slave->bond->dev, slave->dev,"Port %d Received link speed %d update from adapter\n" , - port->actor_port_number, speed); + ad_port->actor_port_number, speed);return speed; }/** -* __get_duplex - get a port's duplex -* @port: the port we're looking at +* __get_duplex - get an ad_port's duplex +* @ad_port: the ad_port we're looking at * -* Return @port's duplex in 802.3ad bitmask format. i.e.: +* Return @ad_port's duplex in 802.3ad bitmask format. i.e.: * 0x01 if in full duplex * 0x00 otherwise */ -static u8 __get_duplex (struct port *port) +static u8 __get_duplex (struct ad_port *ad_port) { -struct slave *slave = port->slave; +struct slave *slave = ad_port->slave;u8 retval =0x0 ;/* handling a special case: when the configuration starts with
@@ -350,25 +350,25 @@ static u8 __get_duplex(struct port *port)case DUPLEX_FULL : retval =0x1 ;slave_dbg (slave->bond->dev, slave->dev,"Port %d Received status full duplex update from adapter\n" , - port->actor_port_number); + ad_port->actor_port_number);break ;case DUPLEX_HALF :default : retval =0x0 ;slave_dbg (slave->bond->dev, slave->dev,"Port %d Received status NOT full duplex update from adapter\n" , - port->actor_port_number); + ad_port->actor_port_number);break ; } }return retval; } -static void __ad_actor_update_port (struct port *port) +static void __ad_actor_update_port (struct ad_port *ad_port) { -const struct bonding *bond =bond_get_bond_by_slave (port->slave); +const struct bonding *bond =bond_get_bond_by_slave (ad_port->slave); - port->actor_system =BOND_AD_INFO (bond).system.sys_mac_addr; - port->actor_system_priority =BOND_AD_INFO (bond).system.sys_priority; + ad_port->actor_system =BOND_AD_INFO (bond).system.sys_mac_addr; + ad_port->actor_system_priority =BOND_AD_INFO (bond).system.sys_priority; }/* Conversions */
@@ -414,9 +414,9 @@ static u16 __ad_timer_to_ticks(u16 timer_type, u16 par)/* ================= ad_rx_machine helper functions ================== */ /** -* __choose_matched - update a port's matched variable from a received lacpdu +* __choose_matched - update an ad_port's matched variable from a received lacpdu * @lacpdu: the lacpdu we've received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * Update the value of the matched variable, using parameter values from a * newly received lacpdu. Parameter values for the partner carried in the
@@ -436,41 +436,41 @@ static u16 __ad_timer_to_ticks(u16 timer_type, u16 par)* used here to implement the language from 802.3ad 43.4.9 that requires * recordPDU to "match" the LACPDU parameters to the stored values. */ -static void __choose_matched (struct lacpdu *lacpdu,struct port *port) +static void __choose_matched (struct lacpdu *lacpdu,struct ad_port *ad_port) {/* check if all parameters are alike * or this is individual link(aggregation == FALSE) * then update the state machine Matched variable. */ -if (((ntohs (lacpdu->partner_port) == port->actor_port_number) && - (ntohs (lacpdu->partner_port_priority) == port->actor_port_priority) && -MAC_ADDRESS_EQUAL (&(lacpdu->partner_system), &(port->actor_system)) && - (ntohs (lacpdu->partner_system_priority) == port->actor_system_priority) && - (ntohs (lacpdu->partner_key) == port->actor_oper_port_key) && - ((lacpdu->partner_state &LACP_STATE_AGGREGATION ) == (port->actor_oper_port_state &LACP_STATE_AGGREGATION ))) || +if (((ntohs (lacpdu->partner_port) == ad_port->actor_port_number) && + (ntohs (lacpdu->partner_port_priority) == ad_port->actor_port_priority) && +MAC_ADDRESS_EQUAL (&(lacpdu->partner_system), &(ad_port->actor_system)) && + (ntohs (lacpdu->partner_system_priority) == ad_port->actor_system_priority) && + (ntohs (lacpdu->partner_key) == ad_port->actor_oper_port_key) && + ((lacpdu->partner_state &LACP_STATE_AGGREGATION ) == (ad_port->actor_oper_port_state &LACP_STATE_AGGREGATION ))) || ((lacpdu->actor_state &LACP_STATE_AGGREGATION ) ==0 ) ) { - port->sm_vars |=AD_PORT_MATCHED ; + ad_port->sm_vars |=AD_PORT_MATCHED ; }else { - port->sm_vars &= ~AD_PORT_MATCHED ; + ad_port->sm_vars &= ~AD_PORT_MATCHED ; } }/** * __record_pdu - record parameters from a received lacpdu * @lacpdu: the lacpdu we've received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * Record the parameter values for the Actor carried in a received lacpdu as * the current partner operational parameter values and sets * actor_oper_port_state.defaulted to FALSE. */ -static void __record_pdu (struct lacpdu *lacpdu,struct port *port) +static void __record_pdu (struct lacpdu *lacpdu,struct ad_port *ad_port) { -if (lacpdu && port) { -struct port_params *partner = &port->partner_oper; +if (lacpdu && ad_port) { +struct port_params *partner = &ad_port->partner_oper; -__choose_matched (lacpdu, port); +__choose_matched (lacpdu, ad_port);/* record the new parameter values for the partner * operational */
@@ -482,19 +482,19 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port) partner->port_state = lacpdu->actor_state;/* set actor_oper_port_state.defaulted to FALSE */ - port->actor_oper_port_state &= ~LACP_STATE_DEFAULTED ; + ad_port->actor_oper_port_state &= ~LACP_STATE_DEFAULTED ;/* set the partner sync. to on if the partner is sync, -* and the port is matched +* and the ad_port is matched */ -if ((port->sm_vars &AD_PORT_MATCHED ) && +if ((ad_port->sm_vars &AD_PORT_MATCHED ) && (lacpdu->actor_state &LACP_STATE_SYNCHRONIZATION )) { partner->port_state |=LACP_STATE_SYNCHRONIZATION ; -slave_dbg (port->slave->bond->dev, port->slave->dev, +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"partner sync=1\n" ); }else { partner->port_state &= ~LACP_STATE_SYNCHRONIZATION ; -slave_dbg (port->slave->bond->dev, port->slave->dev, +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"partner sync=0\n" ); } }
@@ -502,41 +502,41 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port)/** * __record_default - record default parameters -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * This function records the default parameter values for the partner carried * in the Partner Admin parameters as the current partner operational parameter * values and sets actor_oper_port_state.defaulted to TRUE. */ -static void __record_default (struct port *port) +static void __record_default (struct ad_port *ad_port) { -if (port) { +if (ad_port) {/* record the partner admin parameters */ -memcpy (&port->partner_oper, &port->partner_admin, +memcpy (&ad_port->partner_oper, &ad_port->partner_admin,sizeof (struct port_params ));/* set actor_oper_port_state.defaulted to true */ - port->actor_oper_port_state |=LACP_STATE_DEFAULTED ; + ad_port->actor_oper_port_state |=LACP_STATE_DEFAULTED ; } }/** -* __update_selected - update a port's Selected variable from a received lacpdu +* __update_selected - update an ad_port's Selected variable from a received lacpdu * @lacpdu: the lacpdu we've received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * Update the value of the selected variable, using parameter values from a * newly received lacpdu. The parameter values for the Actor carried in the * received PDU are compared with the corresponding operational parameter -* values for the ports partner. If one or more of the comparisons shows that +* values for the ad_ports partner. If one or more of the comparisons shows that * the value(s) received in the PDU differ from the current operational values, * then selected is set to FALSE and actor_oper_port_state.synchronization is * set to out_of_sync. Otherwise, selected remains unchanged. */ -static void __update_selected (struct lacpdu *lacpdu,struct port *port) +static void __update_selected (struct lacpdu *lacpdu,struct ad_port *ad_port) { -if (lacpdu && port) { -const struct port_params *partner = &port->partner_oper; +if (lacpdu && ad_port) { +const struct port_params *partner = &ad_port->partner_oper;/* check if any parameter is different then * update the state machine selected variable.
@@ -547,14 +547,14 @@ static void __update_selected(struct lacpdu *lacpdu, struct port *port)ntohs (lacpdu->actor_system_priority) != partner->system_priority ||ntohs (lacpdu->actor_key) != partner->key || (lacpdu->actor_state & LACP_STATE_AGGREGATION) != (partner->port_state & LACP_STATE_AGGREGATION)) { - port->sm_vars &= ~AD_PORT_SELECTED; + ad_port->sm_vars &= ~AD_PORT_SELECTED; } } }/** -* __update_default_selected - update a port's Selected variable from Partner -* @port: the port we're looking at +* __update_default_selected - update an ad_port's Selected variable from Partner +* @ad_port: the ad_port we're looking at * * This function updates the value of the selected variable, using the partner * administrative parameter values. The administrative values are compared with
@@ -564,11 +564,11 @@ static void __update_selected(struct lacpdu *lacpdu, struct port *port)* actor_oper_port_state.synchronization is set to OUT_OF_SYNC. Otherwise, * Selected remains unchanged. */ -static void __update_default_selected (struct port *port) +static void __update_default_selected (struct ad_port *ad_port) { -if (port) { -const struct port_params *admin = &port->partner_admin; -const struct port_params *oper = &port->partner_oper; +if (ad_port) { +const struct port_params *admin = &ad_port->partner_admin; +const struct port_params *oper = &ad_port->partner_oper;/* check if any parameter is different then * update the state machine selected variable.
@@ -580,15 +580,15 @@ static void __update_default_selected(struct port *port) admin->key != oper->key || (admin->port_state & LACP_STATE_AGGREGATION) != (oper->port_state & LACP_STATE_AGGREGATION)) { - port->sm_vars &= ~AD_PORT_SELECTED ; + ad_port->sm_vars &= ~AD_PORT_SELECTED ; } } }/** -* __update_ntt - update a port's ntt variable from a received lacpdu +* __update_ntt - update an ad_port's ntt variable from a received lacpdu * @lacpdu: the lacpdu we've received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * Updates the value of the ntt variable, using parameter values from a newly * received lacpdu. The parameter values for the partner carried in the
@@ -597,46 +597,46 @@ static void __update_default_selected(struct port *port)* value(s) received in the PDU differ from the current operational values, * then ntt is set to TRUE. Otherwise, ntt remains unchanged. */ -static void __update_ntt (struct lacpdu *lacpdu,struct port *port) +static void __update_ntt (struct lacpdu *lacpdu,struct ad_port *ad_port) { -/* validate lacpdu and port */ -if (lacpdu && port) { +/* validate lacpdu and ad_port */ +if (lacpdu && ad_port) {/* check if any parameter is different then -* update the port->ntt. +* update the ad_port->ntt. */ -if ((ntohs (lacpdu->partner_port) != port->actor_port_number) || - (ntohs (lacpdu->partner_port_priority) != port->actor_port_priority) || - !MAC_ADDRESS_EQUAL (&(lacpdu->partner_system), &(port->actor_system)) || - (ntohs (lacpdu->partner_system_priority) != port->actor_system_priority) || - (ntohs (lacpdu->partner_key) != port->actor_oper_port_key) || - ((lacpdu->partner_state &LACP_STATE_LACP_ACTIVITY ) != (port->actor_oper_port_state &LACP_STATE_LACP_ACTIVITY )) || - ((lacpdu->partner_state &LACP_STATE_LACP_TIMEOUT ) != (port->actor_oper_port_state &LACP_STATE_LACP_TIMEOUT )) || - ((lacpdu->partner_state &LACP_STATE_SYNCHRONIZATION ) != (port->actor_oper_port_state &LACP_STATE_SYNCHRONIZATION )) || - ((lacpdu->partner_state &LACP_STATE_AGGREGATION ) != (port->actor_oper_port_state &LACP_STATE_AGGREGATION )) +if ((ntohs (lacpdu->partner_port) != ad_port->actor_port_number) || + (ntohs (lacpdu->partner_port_priority) != ad_port->actor_port_priority) || + !MAC_ADDRESS_EQUAL (&(lacpdu->partner_system), &(ad_port->actor_system)) || + (ntohs (lacpdu->partner_system_priority) != ad_port->actor_system_priority) || + (ntohs (lacpdu->partner_key) != ad_port->actor_oper_port_key) || + ((lacpdu->partner_state &LACP_STATE_LACP_ACTIVITY ) != (ad_port->actor_oper_port_state &LACP_STATE_LACP_ACTIVITY )) || + ((lacpdu->partner_state &LACP_STATE_LACP_TIMEOUT ) != (ad_port->actor_oper_port_state &LACP_STATE_LACP_TIMEOUT )) || + ((lacpdu->partner_state &LACP_STATE_SYNCHRONIZATION ) != (ad_port->actor_oper_port_state &LACP_STATE_SYNCHRONIZATION )) || + ((lacpdu->partner_state &LACP_STATE_AGGREGATION ) != (ad_port->actor_oper_port_state &LACP_STATE_AGGREGATION )) ) { - port->ntt = true; + ad_port->ntt = true; } } }/** -* __agg_ports_are_ready - check if all ports in an aggregator are ready +* __agg_ports_are_ready - check if all ad_ports in an aggregator are ready * @aggregator: the aggregator we're looking at * */ static int __agg_ports_are_ready (struct aggregator *aggregator) { -struct port *port; +struct ad_port *ad_port;int retval =1 ;if (aggregator) { -/* scan all ports in this aggregator to verfy if they are +/* scan all ad_ports in this aggregator to verfy if they are * all ready. */ -for (port = aggregator->lag_ports; - port; - port = port->next_port_in_aggregator) { -if (!(port->sm_vars &AD_PORT_READY_N )) { +for (ad_port = aggregator->lag_ports; + ad_port; + ad_port = ad_port->next_port_in_aggregator) { +if (!(ad_port->sm_vars &AD_PORT_READY_N )) { retval =0 ;break ; }
@@ -647,32 +647,32 @@ static int __agg_ports_are_ready(struct aggregator *aggregator) }/** -* __set_agg_ports_ready - set value of Ready bit in all ports of an aggregator +* __set_agg_ports_ready - set value of Ready bit in all ad_ports of an aggregator * @aggregator: the aggregator we're looking at -* @val: Should the ports' ready bit be set on or off +* @val: Should the ad_ports' ready bit be set on or off * */ static void __set_agg_ports_ready (struct aggregator *aggregator,int val) { -struct port *port; +struct ad_port *ad_port; -for (port = aggregator->lag_ports; port; - port = port->next_port_in_aggregator) { +for (ad_port = aggregator->lag_ports; ad_port; + ad_port = ad_port->next_port_in_aggregator) {if (val) - port->sm_vars |=AD_PORT_READY ; + ad_port->sm_vars |=AD_PORT_READY ;else - port->sm_vars &= ~AD_PORT_READY ; + ad_port->sm_vars &= ~AD_PORT_READY ; } } -static int __agg_active_ports (struct aggregator *agg) +static int __agg_active_ad_ports (struct aggregator *agg) { -struct port *port; +struct ad_port *ad_port;int active =0 ; -for (port = agg->lag_ports; port; - port = port->next_port_in_aggregator) { -if (port->is_enabled) +for (ad_port = agg->lag_ports; ad_port; + ad_port = ad_port->next_port_in_aggregator) { +if (ad_port->is_enabled) active++; }
@@ -686,7 +686,7 @@ static int __agg_active_ports(struct aggregator *agg)*/ static u32 __get_agg_bandwidth (struct aggregator *aggregator) { -int nports =__agg_active_ports (aggregator); +int nports =__agg_active_ad_ports (aggregator);u32 bandwidth =0 ;if (nports) {
@@ -760,13 +760,13 @@ static struct aggregator *__get_active_agg(struct aggregator *aggregator) }/** -* __update_lacpdu_from_port - update a port's lacpdu fields -* @port: the port we're looking at +* __update_lacpdu_from_ad_port - update an ad_port's lacpdu fields +* @ad_port: the ad_port we're looking at */ -static inline void __update_lacpdu_from_port (struct port *port) +static inline void __update_lacpdu_from_ad_port (struct ad_port *ad_port) { -struct lacpdu *lacpdu = &port->lacpdu; -const struct port_params *partner = &port->partner_oper; +struct lacpdu *lacpdu = &ad_port->lacpdu; +const struct port_params *partner = &ad_port->partner_oper;/* update current actual Actor parameters * lacpdu->subtype initialized
@@ -775,15 +775,15 @@ static inline void __update_lacpdu_from_port(struct port *port)* lacpdu->actor_information_length initialized */ - lacpdu->actor_system_priority =htons (port->actor_system_priority); - lacpdu->actor_system = port->actor_system; - lacpdu->actor_key =htons (port->actor_oper_port_key); - lacpdu->actor_port_priority =htons (port->actor_port_priority); - lacpdu->actor_port =htons (port->actor_port_number); - lacpdu->actor_state = port->actor_oper_port_state; -slave_dbg (port->slave->bond->dev, port->slave->dev, -"update lacpdu: actor port state %x\n" , - port->actor_oper_port_state); + lacpdu->actor_system_priority =htons (ad_port->actor_system_priority); + lacpdu->actor_system = ad_port->actor_system; + lacpdu->actor_key =htons (ad_port->actor_oper_port_key); + lacpdu->actor_port_priority =htons (ad_port->actor_port_priority); + lacpdu->actor_port =htons (ad_port->actor_port_number); + lacpdu->actor_state = ad_port->actor_oper_port_state; +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, +"update lacpdu: actor ad port state %x\n" , + ad_port->actor_oper_port_state);/* lacpdu->reserved_3_1 initialized * lacpdu->tlv_type_partner_info initialized
@@ -811,15 +811,15 @@ static inline void __update_lacpdu_from_port(struct port *port)/* ================= main 802.3ad protocol code ========================= */ /** -* ad_lacpdu_send - send out a lacpdu packet on a given port -* @port: the port we're looking at +* ad_lacpdu_send - send out a lacpdu packet on a given ad_port +* @ad_port: the ad_port we're looking at * * Returns: 0 on success * < 0 on error */ -static int ad_lacpdu_send (struct port *port) +static int ad_lacpdu_send (struct ad_port *ad_port) { -struct slave *slave = port->slave; +struct slave *slave = ad_port->slave;struct sk_buff *skb;struct lacpdu_header *lacpdu_header;int length =sizeof (struct lacpdu_header );
@@ -846,7 +846,7 @@ static int ad_lacpdu_send(struct port *port)ether_addr_copy (lacpdu_header->hdr.h_source, slave->perm_hwaddr); lacpdu_header->hdr.h_proto =PKT_TYPE_LACPDU ; - lacpdu_header->lacpdu = port->lacpdu; + lacpdu_header->lacpdu = ad_port->lacpdu;dev_queue_xmit (skb);
@@ -854,16 +854,16 @@ static int ad_lacpdu_send(struct port *port) }/** -* ad_marker_send - send marker information/response on a given port -* @port: the port we're looking at +* ad_marker_send - send marker information/response on a given ad_port +* @ad_port: the ad_port we're looking at * @marker: marker data to send * * Returns: 0 on success * < 0 on error */ -static int ad_marker_send (struct port *port,struct bond_marker *marker) +static int ad_marker_send (struct ad_port *ad_port,struct bond_marker *marker) { -struct slave *slave = port->slave; +struct slave *slave = ad_port->slave;struct sk_buff *skb;struct bond_marker_header *marker_header;int length =sizeof (struct bond_marker_header );
@@ -907,104 +907,104 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker) }/** -* ad_mux_machine - handle a port's mux state machine -* @port: the port we're looking at +* ad_mux_machine - handle an ad_port's mux state machine +* @ad_port: the ad_port we're looking at * @update_slave_arr: Does slave array need update? */ -static void ad_mux_machine (struct port *port,bool *update_slave_arr) +static void ad_mux_machine (struct ad_port *ad_port,bool *update_slave_arr) {mux_states_t last_state;/* keep current State Machine state to compare later if it was * changed */ - last_state = port->sm_mux_state; + last_state = ad_port->sm_mux_state; -if (port->sm_vars &AD_PORT_BEGIN ) { - port->sm_mux_state =AD_MUX_DETACHED ; +if (ad_port->sm_vars &AD_PORT_BEGIN ) { + ad_port->sm_mux_state =AD_MUX_DETACHED ; }else { -switch (port->sm_mux_state) { +switch (ad_port->sm_mux_state) {case AD_MUX_DETACHED : -if ((port->sm_vars &AD_PORT_SELECTED ) - || (port->sm_vars &AD_PORT_STANDBY )) +if ((ad_port->sm_vars &AD_PORT_SELECTED ) + || (ad_port->sm_vars &AD_PORT_STANDBY ))/* if SELECTED or STANDBY */ - port->sm_mux_state =AD_MUX_WAITING ; + ad_port->sm_mux_state =AD_MUX_WAITING ;break ;case AD_MUX_WAITING :/* if SELECTED == FALSE return to DETACH state */ -if (!(port->sm_vars &AD_PORT_SELECTED )) { - port->sm_vars &= ~AD_PORT_READY_N ; +if (!(ad_port->sm_vars &AD_PORT_SELECTED )) { + ad_port->sm_vars &= ~AD_PORT_READY_N ;/* in order to withhold the Selection Logic to * check all ports READY_N value every callback * cycle to update ready variable, we check * READY_N and update READY here */ -__set_agg_ports_ready (port->aggregator,__agg_ports_are_ready (port->aggregator)); - port->sm_mux_state =AD_MUX_DETACHED ; +__set_agg_ports_ready (ad_port->aggregator,__agg_ports_are_ready (ad_port->aggregator)); + ad_port->sm_mux_state =AD_MUX_DETACHED ;break ; }/* check if the wait_while_timer expired */ -if (port->sm_mux_timer_counter - && !(--port->sm_mux_timer_counter)) - port->sm_vars |=AD_PORT_READY_N ; +if (ad_port->sm_mux_timer_counter + && !(--ad_port->sm_mux_timer_counter)) + ad_port->sm_vars |=AD_PORT_READY_N ;/* in order to withhold the selection logic to check * all ports READY_N value every callback cycle to * update ready variable, we check READY_N and update * READY here */ -__set_agg_ports_ready (port->aggregator,__agg_ports_are_ready (port->aggregator)); +__set_agg_ports_ready (ad_port->aggregator,__agg_ports_are_ready (ad_port->aggregator)); -/* if the wait_while_timer expired, and the port is +/* if the wait_while_timer expired, and the ad_port is * in READY state, move to ATTACHED state */ -if ((port->sm_vars &AD_PORT_READY ) - && !port->sm_mux_timer_counter) - port->sm_mux_state =AD_MUX_ATTACHED ; +if ((ad_port->sm_vars &AD_PORT_READY ) + && !ad_port->sm_mux_timer_counter) + ad_port->sm_mux_state =AD_MUX_ATTACHED ;break ;case AD_MUX_ATTACHED :/* check also if agg_select_timer expired (so the -* edable port will take place only after this timer) +* edable ad_port will take place only after this timer) */ -if ((port->sm_vars &AD_PORT_SELECTED ) && - (port->partner_oper.port_state &LACP_STATE_SYNCHRONIZATION ) && - !__check_agg_selection_timer (port)) { -if (port->aggregator->is_active) - port->sm_mux_state = +if ((ad_port->sm_vars &AD_PORT_SELECTED ) && + (ad_port->partner_oper.port_state &LACP_STATE_SYNCHRONIZATION ) && + !__check_agg_selection_timer (ad_port)) { +if (ad_port->aggregator->is_active) + ad_port->sm_mux_state =AD_MUX_COLLECTING_DISTRIBUTING ; - }else if (!(port->sm_vars &AD_PORT_SELECTED ) || - (port->sm_vars &AD_PORT_STANDBY )) { + }else if (!(ad_port->sm_vars &AD_PORT_SELECTED ) || + (ad_port->sm_vars &AD_PORT_STANDBY )) {/* if UNSELECTED or STANDBY */ - port->sm_vars &= ~AD_PORT_READY_N ; + ad_port->sm_vars &= ~AD_PORT_READY_N ;/* in order to withhold the selection logic to * check all ports READY_N value every callback * cycle to update ready variable, we check * READY_N and update READY here */ -__set_agg_ports_ready (port->aggregator,__agg_ports_are_ready (port->aggregator)); - port->sm_mux_state =AD_MUX_DETACHED ; - }else if (port->aggregator->is_active) { - port->actor_oper_port_state |= +__set_agg_ports_ready (ad_port->aggregator,__agg_ports_are_ready (ad_port->aggregator)); + ad_port->sm_mux_state =AD_MUX_DETACHED ; + }else if (ad_port->aggregator->is_active) { + ad_port->actor_oper_port_state |=LACP_STATE_SYNCHRONIZATION ; }break ;case AD_MUX_COLLECTING_DISTRIBUTING : -if (!(port->sm_vars &AD_PORT_SELECTED ) || - (port->sm_vars &AD_PORT_STANDBY ) || - !(port->partner_oper.port_state &LACP_STATE_SYNCHRONIZATION ) || - !(port->actor_oper_port_state &LACP_STATE_SYNCHRONIZATION )) { - port->sm_mux_state =AD_MUX_ATTACHED ; +if (!(ad_port->sm_vars &AD_PORT_SELECTED ) || + (ad_port->sm_vars &AD_PORT_STANDBY ) || + !(ad_port->partner_oper.port_state &LACP_STATE_SYNCHRONIZATION ) || + !(ad_port->actor_oper_port_state &LACP_STATE_SYNCHRONIZATION )) { + ad_port->sm_mux_state =AD_MUX_ATTACHED ; }else { -/* if port state hasn't changed make +/* if ad_port state hasn't changed make * sure that a collecting distributing -* port in an active aggregator is enabled +* ad_port in an active aggregator is enabled */ -if (port->aggregator && - port->aggregator->is_active && - !__port_is_enabled (port)) { +if (ad_port->aggregator && + ad_port->aggregator->is_active && + !__ad_port_is_enabled (ad_port)) { -__enable_port (port); +__enable_ad_port (ad_port); } }break ;
@@ -1014,44 +1014,43 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) }/* check if the state machine was changed */ -if (port->sm_mux_state != last_state) { -slave_dbg (port->slave->bond->dev, port->slave->dev, +if (ad_port->sm_mux_state != last_state) { +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"Mux Machine: Port=%d, Last State=%d, Curr State=%d\n" , - port->actor_port_number, - last_state, - port->sm_mux_state); -switch (port->sm_mux_state) { + ad_port->actor_port_number, last_state, + ad_port->sm_mux_state); +switch (ad_port->sm_mux_state) {case AD_MUX_DETACHED : - port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; -ad_disable_collecting_distributing (port, + ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; +ad_disable_collecting_distributing (ad_port, update_slave_arr); - port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; - port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; - port->ntt = true; + ad_port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; + ad_port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; + ad_port->ntt = true;break ;case AD_MUX_WAITING : - port->sm_mux_timer_counter =__ad_timer_to_ticks (AD_WAIT_WHILE_TIMER ,0 ); + ad_port->sm_mux_timer_counter =__ad_timer_to_ticks (AD_WAIT_WHILE_TIMER ,0 );break ;case AD_MUX_ATTACHED : -if (port->aggregator->is_active) - port->actor_oper_port_state |= +if (ad_port->aggregator->is_active) + ad_port->actor_oper_port_state |=LACP_STATE_SYNCHRONIZATION ;else - port->actor_oper_port_state &= + ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; - port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; - port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; -ad_disable_collecting_distributing (port, + ad_port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; + ad_port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; +ad_disable_collecting_distributing (ad_port, update_slave_arr); - port->ntt = true; + ad_port->ntt = true;break ;case AD_MUX_COLLECTING_DISTRIBUTING : - port->actor_oper_port_state |=LACP_STATE_COLLECTING ; - port->actor_oper_port_state |=LACP_STATE_DISTRIBUTING ; - port->actor_oper_port_state |=LACP_STATE_SYNCHRONIZATION ; -ad_enable_collecting_distributing (port, + ad_port->actor_oper_port_state |=LACP_STATE_COLLECTING ; + ad_port->actor_oper_port_state |=LACP_STATE_DISTRIBUTING ; + ad_port->actor_oper_port_state |=LACP_STATE_SYNCHRONIZATION ; +ad_enable_collecting_distributing (ad_port, update_slave_arr); - port->ntt = true; + ad_port->ntt = true;break ;default :break ;
@@ -1060,69 +1059,69 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) }/** -* ad_rx_machine - handle a port's rx State Machine +* ad_rx_machine - handle an ad_port's rx State Machine * @lacpdu: the lacpdu we've received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * If lacpdu arrived, stop previous timer (if exists) and set the next state as * CURRENT. If timer expired set the state machine in the proper state. * In other cases, this function checks if we need to switch to other state. */ -static void ad_rx_machine (struct lacpdu *lacpdu,struct port *port) +static void ad_rx_machine (struct lacpdu *lacpdu,struct ad_port *ad_port) {rx_states_t last_state;/* keep current State Machine state to compare later if it was * changed */ - last_state = port->sm_rx_state; + last_state = ad_port->sm_rx_state;if (lacpdu) { -atomic64_inc (&SLAVE_AD_INFO (port->slave)->stats.lacpdu_rx); -atomic64_inc (&BOND_AD_INFO (port->slave->bond).stats.lacpdu_rx); +atomic64_inc (&SLAVE_AD_INFO (ad_port->slave)->stats.lacpdu_rx); +atomic64_inc (&BOND_AD_INFO (ad_port->slave->bond).stats.lacpdu_rx); }/* check if state machine should change state */ -/* first, check if port was reinitialized */ -if (port->sm_vars &AD_PORT_BEGIN ) { - port->sm_rx_state =AD_RX_INITIALIZE ; - port->sm_vars |=AD_PORT_CHURNED ; +/* first, check if ad_port was reinitialized */ +if (ad_port->sm_vars &AD_PORT_BEGIN ) { + ad_port->sm_rx_state =AD_RX_INITIALIZE ; + ad_port->sm_vars |=AD_PORT_CHURNED ;/* check if port is not enabled */ - }else if (!(port->sm_vars &AD_PORT_BEGIN ) && !port->is_enabled) - port->sm_rx_state =AD_RX_PORT_DISABLED ; + }else if (!(ad_port->sm_vars &AD_PORT_BEGIN ) && !ad_port->is_enabled) + ad_port->sm_rx_state =AD_RX_PORT_DISABLED ;/* check if new lacpdu arrived */ -else if (lacpdu && ((port->sm_rx_state ==AD_RX_EXPIRED ) || - (port->sm_rx_state ==AD_RX_DEFAULTED ) || - (port->sm_rx_state ==AD_RX_CURRENT ))) { -if (port->sm_rx_state !=AD_RX_CURRENT ) - port->sm_vars |=AD_PORT_CHURNED ; - port->sm_rx_timer_counter =0 ; - port->sm_rx_state =AD_RX_CURRENT ; +else if (lacpdu && ((ad_port->sm_rx_state ==AD_RX_EXPIRED ) || + (ad_port->sm_rx_state ==AD_RX_DEFAULTED ) || + (ad_port->sm_rx_state ==AD_RX_CURRENT ))) { +if (ad_port->sm_rx_state !=AD_RX_CURRENT ) + ad_port->sm_vars |=AD_PORT_CHURNED ; + ad_port->sm_rx_timer_counter =0 ; + ad_port->sm_rx_state =AD_RX_CURRENT ; }else {/* if timer is on, and if it is expired */ -if (port->sm_rx_timer_counter && - !(--port->sm_rx_timer_counter)) { -switch (port->sm_rx_state) { +if (ad_port->sm_rx_timer_counter && + !(--ad_port->sm_rx_timer_counter)) { +switch (ad_port->sm_rx_state) {case AD_RX_EXPIRED : - port->sm_rx_state =AD_RX_DEFAULTED ; + ad_port->sm_rx_state =AD_RX_DEFAULTED ;break ;case AD_RX_CURRENT : - port->sm_rx_state =AD_RX_EXPIRED ; + ad_port->sm_rx_state =AD_RX_EXPIRED ;break ;default :break ; } }else {/* if no lacpdu arrived and no timer is on */ -switch (port->sm_rx_state) { +switch (ad_port->sm_rx_state) {case AD_RX_PORT_DISABLED : -if (port->is_enabled && - (port->sm_vars &AD_PORT_LACP_ENABLED )) - port->sm_rx_state =AD_RX_EXPIRED ; -else if (port->is_enabled - && ((port->sm_vars +if (ad_port->is_enabled && + (ad_port->sm_vars &AD_PORT_LACP_ENABLED )) + ad_port->sm_rx_state =AD_RX_EXPIRED ; +else if (ad_port->is_enabled + && ((ad_port->sm_vars &AD_PORT_LACP_ENABLED ) ==0 )) - port->sm_rx_state =AD_RX_LACP_DISABLED ; + ad_port->sm_rx_state =AD_RX_LACP_DISABLED ;break ;default :break ;
@@ -1132,68 +1131,68 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) }/* check if the State machine was changed or new lacpdu arrived */ -if ((port->sm_rx_state != last_state) || (lacpdu)) { -slave_dbg (port->slave->bond->dev, port->slave->dev, +if ((ad_port->sm_rx_state != last_state) || (lacpdu)) { +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"Rx Machine: Port=%d, Last State=%d, Curr State=%d\n" , - port->actor_port_number, + ad_port->actor_port_number, last_state, - port->sm_rx_state); -switch (port->sm_rx_state) { + ad_port->sm_rx_state); +switch (ad_port->sm_rx_state) {case AD_RX_INITIALIZE : -if (!(port->actor_oper_port_key &AD_DUPLEX_KEY_MASKS )) - port->sm_vars &= ~AD_PORT_LACP_ENABLED ; +if (!(ad_port->actor_oper_port_key &AD_DUPLEX_KEY_MASKS )) + ad_port->sm_vars &= ~AD_PORT_LACP_ENABLED ;else - port->sm_vars |=AD_PORT_LACP_ENABLED ; - port->sm_vars &= ~AD_PORT_SELECTED ; -__record_default (port); - port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ; - port->sm_rx_state =AD_RX_PORT_DISABLED ; + ad_port->sm_vars |=AD_PORT_LACP_ENABLED ; + ad_port->sm_vars &= ~AD_PORT_SELECTED ; +__record_default (ad_port); + ad_port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ; + ad_port->sm_rx_state =AD_RX_PORT_DISABLED ; fallthrough;case AD_RX_PORT_DISABLED : - port->sm_vars &= ~AD_PORT_MATCHED ; + ad_port->sm_vars &= ~AD_PORT_MATCHED ;break ;case AD_RX_LACP_DISABLED : - port->sm_vars &= ~AD_PORT_SELECTED ; -__record_default (port); - port->partner_oper.port_state &= ~LACP_STATE_AGGREGATION ; - port->sm_vars |=AD_PORT_MATCHED ; - port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ; + ad_port->sm_vars &= ~AD_PORT_SELECTED ; +__record_default (ad_port); + ad_port->partner_oper.port_state &= ~LACP_STATE_AGGREGATION ; + ad_port->sm_vars |=AD_PORT_MATCHED ; + ad_port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ;break ;case AD_RX_EXPIRED :/* Reset of the Synchronization flag (Standard 43.4.12) -* This reset cause to disable this port in the +* This reset cause to disable this ad_port in the * COLLECTING_DISTRIBUTING state of the mux machine in * case of EXPIRED even if LINK_DOWN didn't arrive for -* the port. +* the ad_port. */ - port->partner_oper.port_state &= ~LACP_STATE_SYNCHRONIZATION ; - port->sm_vars &= ~AD_PORT_MATCHED ; - port->partner_oper.port_state |=LACP_STATE_LACP_TIMEOUT ; - port->partner_oper.port_state |=LACP_STATE_LACP_ACTIVITY ; - port->sm_rx_timer_counter =__ad_timer_to_ticks (AD_CURRENT_WHILE_TIMER , (u16)(AD_SHORT_TIMEOUT )); - port->actor_oper_port_state |=LACP_STATE_EXPIRED ; - port->sm_vars |=AD_PORT_CHURNED ; + ad_port->partner_oper.port_state &= ~LACP_STATE_SYNCHRONIZATION ; + ad_port->sm_vars &= ~AD_PORT_MATCHED ; + ad_port->partner_oper.port_state |=LACP_STATE_LACP_TIMEOUT ; + ad_port->partner_oper.port_state |=LACP_STATE_LACP_ACTIVITY ; + ad_port->sm_rx_timer_counter =__ad_timer_to_ticks (AD_CURRENT_WHILE_TIMER , (u16)(AD_SHORT_TIMEOUT )); + ad_port->actor_oper_port_state |=LACP_STATE_EXPIRED ; + ad_port->sm_vars |=AD_PORT_CHURNED ;break ;case AD_RX_DEFAULTED : -__update_default_selected (port); -__record_default (port); - port->sm_vars |=AD_PORT_MATCHED ; - port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ; +__update_default_selected (ad_port); +__record_default (ad_port); + ad_port->sm_vars |=AD_PORT_MATCHED ; + ad_port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ;break ;case AD_RX_CURRENT :/* detect loopback situation */ if (MAC_ADDRESS_EQUAL (&(lacpdu->actor_system), - &(port->actor_system))) { -slave_err (port->slave->bond->dev, port->slave->dev,"An illegal loopback occurred on slave\n" + &(ad_port->actor_system))) { +slave_err (ad_port->slave->bond->dev, ad_port->slave->dev,"An illegal loopback occurred on slave\n" "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n" );return ; } -__update_selected (lacpdu, port); -__update_ntt (lacpdu, port); -__record_pdu (lacpdu, port); - port->sm_rx_timer_counter =__ad_timer_to_ticks (AD_CURRENT_WHILE_TIMER , (u16)(port->actor_oper_port_state &LACP_STATE_LACP_TIMEOUT )); - port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ; +__update_selected (lacpdu, ad_port); +__update_ntt (lacpdu, ad_port); +__record_pdu (lacpdu, ad_port); + ad_port->sm_rx_timer_counter =__ad_timer_to_ticks (AD_CURRENT_WHILE_TIMER , (u16)(ad_port->actor_oper_port_state &LACP_STATE_LACP_TIMEOUT )); + ad_port->actor_oper_port_state &= ~LACP_STATE_EXPIRED ;break ;default :break ;
@@ -1202,116 +1201,116 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) }/** -* ad_churn_machine - handle port churn's state machine -* @port: the port we're looking at +* ad_churn_machine - handle ad_port churn's state machine +* @ad_port: the ad_port we're looking at * */ -static void ad_churn_machine (struct port *port) +static void ad_churn_machine (struct ad_port *ad_port) { -if (port->sm_vars &AD_PORT_CHURNED ) { - port->sm_vars &= ~AD_PORT_CHURNED ; - port->sm_churn_actor_state =AD_CHURN_MONITOR ; - port->sm_churn_partner_state =AD_CHURN_MONITOR ; - port->sm_churn_actor_timer_counter = +if (ad_port->sm_vars &AD_PORT_CHURNED ) { + ad_port->sm_vars &= ~AD_PORT_CHURNED ; + ad_port->sm_churn_actor_state =AD_CHURN_MONITOR ; + ad_port->sm_churn_partner_state =AD_CHURN_MONITOR ; + ad_port->sm_churn_actor_timer_counter =__ad_timer_to_ticks (AD_ACTOR_CHURN_TIMER ,0 ); - port->sm_churn_partner_timer_counter = + ad_port->sm_churn_partner_timer_counter =__ad_timer_to_ticks (AD_PARTNER_CHURN_TIMER ,0 );return ; } -if (port->sm_churn_actor_timer_counter && - !(--port->sm_churn_actor_timer_counter) && - port->sm_churn_actor_state ==AD_CHURN_MONITOR ) { -if (port->actor_oper_port_state &LACP_STATE_SYNCHRONIZATION ) { - port->sm_churn_actor_state =AD_NO_CHURN ; +if (ad_port->sm_churn_actor_timer_counter && + !(--ad_port->sm_churn_actor_timer_counter) && + ad_port->sm_churn_actor_state ==AD_CHURN_MONITOR ) { +if (ad_port->actor_oper_port_state &LACP_STATE_SYNCHRONIZATION ) { + ad_port->sm_churn_actor_state =AD_NO_CHURN ; }else { - port->churn_actor_count++; - port->sm_churn_actor_state =AD_CHURN ; + ad_port->churn_actor_count++; + ad_port->sm_churn_actor_state =AD_CHURN ; } } -if (port->sm_churn_partner_timer_counter && - !(--port->sm_churn_partner_timer_counter) && - port->sm_churn_partner_state ==AD_CHURN_MONITOR ) { -if (port->partner_oper.port_state &LACP_STATE_SYNCHRONIZATION ) { - port->sm_churn_partner_state =AD_NO_CHURN ; +if (ad_port->sm_churn_partner_timer_counter && + !(--ad_port->sm_churn_partner_timer_counter) && + ad_port->sm_churn_partner_state ==AD_CHURN_MONITOR ) { +if (ad_port->partner_oper.port_state &LACP_STATE_SYNCHRONIZATION ) { + ad_port->sm_churn_partner_state =AD_NO_CHURN ; }else { - port->churn_partner_count++; - port->sm_churn_partner_state =AD_CHURN ; + ad_port->churn_partner_count++; + ad_port->sm_churn_partner_state =AD_CHURN ; } } }/** -* ad_tx_machine - handle a port's tx state machine -* @port: the port we're looking at +* ad_tx_machine - handle an ad_port's tx state machine +* @ad_port: the ad_port we're looking at */ -static void ad_tx_machine (struct port *port) +static void ad_tx_machine (struct ad_port *ad_port) {/* check if tx timer expired, to verify that we do not send more than * 3 packets per second */ -if (port->sm_tx_timer_counter && !(--port->sm_tx_timer_counter)) { +if (ad_port->sm_tx_timer_counter && !(--ad_port->sm_tx_timer_counter)) {/* check if there is something to send */ -if (port->ntt && (port->sm_vars &AD_PORT_LACP_ENABLED )) { -__update_lacpdu_from_port (port); +if (ad_port->ntt && (ad_port->sm_vars &AD_PORT_LACP_ENABLED )) { +__update_lacpdu_from_ad_port (ad_port); -if (ad_lacpdu_send (port) >=0 ) { -slave_dbg (port->slave->bond->dev, - port->slave->dev, +if (ad_lacpdu_send (ad_port) >=0 ) { +slave_dbg (ad_port->slave->bond->dev, + ad_port->slave->dev,"Sent LACPDU on port %d\n" , - port->actor_port_number); + ad_port->actor_port_number);/* mark ntt as false, so it will not be sent * again until demanded */ - port->ntt = false; + ad_port->ntt = false; } }/* restart tx timer(to verify that we will not exceed * AD_MAX_TX_IN_SECOND */ - port->sm_tx_timer_counter = ad_ticks_per_sec/AD_MAX_TX_IN_SECOND ; + ad_port->sm_tx_timer_counter = ad_ticks_per_sec/AD_MAX_TX_IN_SECOND ; } }/** -* ad_periodic_machine - handle a port's periodic state machine -* @port: the port we're looking at +* ad_periodic_machine - handle an ad_port's periodic state machine +* @ad_port: the ad_port we're looking at * * Turn ntt flag on priodically to perform periodic transmission of lacpdu's. */ -static void ad_periodic_machine (struct port *port) +static void ad_periodic_machine (struct ad_port *ad_port) {periodic_states_t last_state;/* keep current state machine state to compare later if it was changed */ - last_state = port->sm_periodic_state; + last_state = ad_port->sm_periodic_state; -/* check if port was reinitialized */ -if (((port->sm_vars &AD_PORT_BEGIN ) || !(port->sm_vars &AD_PORT_LACP_ENABLED ) || !port->is_enabled) || - (!(port->actor_oper_port_state &LACP_STATE_LACP_ACTIVITY ) && !(port->partner_oper.port_state &LACP_STATE_LACP_ACTIVITY )) +/* check if ad_port was reinitialized */ +if (((ad_port->sm_vars &AD_PORT_BEGIN ) || !(ad_port->sm_vars &AD_PORT_LACP_ENABLED ) || !ad_port->is_enabled) || + (!(ad_port->actor_oper_port_state &LACP_STATE_LACP_ACTIVITY ) && !(ad_port->partner_oper.port_state &LACP_STATE_LACP_ACTIVITY )) ) { - port->sm_periodic_state =AD_NO_PERIODIC ; + ad_port->sm_periodic_state =AD_NO_PERIODIC ; }/* check if state machine should change state */ -else if (port->sm_periodic_timer_counter) { +else if (ad_port->sm_periodic_timer_counter) {/* check if periodic state machine expired */ -if (!(--port->sm_periodic_timer_counter)) { +if (!(--ad_port->sm_periodic_timer_counter)) {/* if expired then do tx */ - port->sm_periodic_state =AD_PERIODIC_TX ; + ad_port->sm_periodic_state =AD_PERIODIC_TX ; }else {/* If not expired, check if there is some new timeout * parameter from the partner state */ -switch (port->sm_periodic_state) { +switch (ad_port->sm_periodic_state) {case AD_FAST_PERIODIC : -if (!(port->partner_oper.port_state +if (!(ad_port->partner_oper.port_state &LACP_STATE_LACP_TIMEOUT )) - port->sm_periodic_state =AD_SLOW_PERIODIC ; + ad_port->sm_periodic_state =AD_SLOW_PERIODIC ;break ;case AD_SLOW_PERIODIC : -if ((port->partner_oper.port_state &LACP_STATE_LACP_TIMEOUT )) { - port->sm_periodic_timer_counter =0 ; - port->sm_periodic_state =AD_PERIODIC_TX ; +if ((ad_port->partner_oper.port_state &LACP_STATE_LACP_TIMEOUT )) { + ad_port->sm_periodic_timer_counter =0 ; + ad_port->sm_periodic_state =AD_PERIODIC_TX ; }break ;default :
@@ -1319,16 +1318,16 @@ static void ad_periodic_machine(struct port *port) } } }else { -switch (port->sm_periodic_state) { +switch (ad_port->sm_periodic_state) {case AD_NO_PERIODIC : - port->sm_periodic_state =AD_FAST_PERIODIC ; + ad_port->sm_periodic_state =AD_FAST_PERIODIC ;break ;case AD_PERIODIC_TX : -if (!(port->partner_oper.port_state & +if (!(ad_port->partner_oper.port_state &LACP_STATE_LACP_TIMEOUT )) - port->sm_periodic_state =AD_SLOW_PERIODIC ; + ad_port->sm_periodic_state =AD_SLOW_PERIODIC ;else - port->sm_periodic_state =AD_FAST_PERIODIC ; + ad_port->sm_periodic_state =AD_FAST_PERIODIC ;break ;default :break ;
@@ -1336,25 +1335,25 @@ static void ad_periodic_machine(struct port *port) }/* check if the state machine was changed */ -if (port->sm_periodic_state != last_state) { -slave_dbg (port->slave->bond->dev, port->slave->dev, +if (ad_port->sm_periodic_state != last_state) { +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n" , - port->actor_port_number, last_state, - port->sm_periodic_state); -switch (port->sm_periodic_state) { + ad_port->actor_port_number, last_state, + ad_port->sm_periodic_state); +switch (ad_port->sm_periodic_state) {case AD_NO_PERIODIC : - port->sm_periodic_timer_counter =0 ; + ad_port->sm_periodic_timer_counter =0 ;break ;case AD_FAST_PERIODIC :/* decrement 1 tick we lost in the PERIODIC_TX cycle */ - port->sm_periodic_timer_counter =__ad_timer_to_ticks (AD_PERIODIC_TIMER , (u16)(AD_FAST_PERIODIC_TIME ))-1 ; + ad_port->sm_periodic_timer_counter =__ad_timer_to_ticks (AD_PERIODIC_TIMER , (u16)(AD_FAST_PERIODIC_TIME ))-1 ;break ;case AD_SLOW_PERIODIC :/* decrement 1 tick we lost in the PERIODIC_TX cycle */ - port->sm_periodic_timer_counter =__ad_timer_to_ticks (AD_PERIODIC_TIMER , (u16)(AD_SLOW_PERIODIC_TIME ))-1 ; + ad_port->sm_periodic_timer_counter =__ad_timer_to_ticks (AD_PERIODIC_TIMER , (u16)(AD_SLOW_PERIODIC_TIME ))-1 ;break ;case AD_PERIODIC_TX : - port->ntt = true; + ad_port->ntt = true;break ;default :break ;
@@ -1364,60 +1363,60 @@ static void ad_periodic_machine(struct port *port)/** * ad_port_selection_logic - select aggregation groups -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * @update_slave_arr: Does slave array need update? * -* Select aggregation groups, and assign each port for it's aggregetor. The +* Select aggregation groups, and assign each ad_port for it's aggregetor. The * selection logic is called in the inititalization (after all the handshkes), * and after every lacpdu receive (if selected is off). */ -static void ad_port_selection_logic (struct port *port,bool *update_slave_arr) +static void ad_port_selection_logic (struct ad_port *ad_port,bool *update_slave_arr) {struct aggregator *aggregator, *free_aggregator =NULL , *temp_aggregator; -struct port *last_port =NULL , *curr_port; +struct ad_port *last_port =NULL , *curr_port;struct list_head *iter;struct bonding *bond;struct slave *slave;int found =0 ; -/* if the port is already Selected, do nothing */ -if (port->sm_vars &AD_PORT_SELECTED ) +/* if the ad_port is already Selected, do nothing */ +if (ad_port->sm_vars &AD_PORT_SELECTED )return ; - bond =__get_bond_by_port (port); + bond =__get_bond_by_ad_port (ad_port); -/* if the port is connected to other aggregator, detach it */ -if (port->aggregator) { -/* detach the port from its former aggregator */ - temp_aggregator = port->aggregator; +/* if the ad_port is connected to other aggregator, detach it */ +if (ad_port->aggregator) { +/* detach the ad_port from its former aggregator */ + temp_aggregator = ad_port->aggregator;for (curr_port = temp_aggregator->lag_ports; curr_port; last_port = curr_port, curr_port = curr_port->next_port_in_aggregator) { -if (curr_port == port) { +if (curr_port == ad_port) { temp_aggregator->num_of_ports--; -/* if it is the first port attached to the +/* if it is the first ad_port attached to the * aggregator */ if (!last_port) { temp_aggregator->lag_ports = - port->next_port_in_aggregator; + ad_port->next_port_in_aggregator; }else { -/* not the first port attached to the +/* not the first ad_port attached to the * aggregator */ last_port->next_port_in_aggregator = - port->next_port_in_aggregator; + ad_port->next_port_in_aggregator; } -/* clear the port's relations to this +/* clear the ad_port's relations to this * aggregator */ - port->aggregator =NULL ; - port->next_port_in_aggregator =NULL ; - port->actor_port_aggregator_identifier =0 ; + ad_port->aggregator =NULL ; + ad_port->next_port_in_aggregator =NULL ; + ad_port->actor_port_aggregator_identifier =0 ; -slave_dbg (bond->dev, port->slave->dev,"Port %d left LAG %d\n" , - port->actor_port_number, +slave_dbg (bond->dev, ad_port->slave->dev,"Port %d left LAG %d\n" , + ad_port->actor_port_number, temp_aggregator->aggregator_identifier);/* if the aggregator is empty, clear its * parameters, and set it ready to be attached
@@ -1428,17 +1427,17 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) } }if (!curr_port) { -/* meaning: the port was related to an aggregator -* but was not on the aggregator port list +/* meaning: the ad_port was related to an aggregator +* but was not on the aggregator ad_port list */ net_warn_ratelimited ("%s: (slave %s): Warning: Port %d was related to aggregator %d but was not on its port list\n" , - port->slave->bond->dev->name, - port->slave->dev->name, - port->actor_port_number, - port->aggregator->aggregator_identifier); + ad_port->slave->bond->dev->name, + ad_port->slave->dev->name, + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier); } } -/* search on all aggregators for a suitable aggregator for this port */ +/* search all aggregators for a suitable aggregator for this ad_port */ bond_for_each_slave (bond, slave, iter) { aggregator = &(SLAVE_AD_INFO (slave)->aggregator);
@@ -1449,90 +1448,90 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)continue ; }/* check if current aggregator suits us */ -if (((aggregator->actor_oper_aggregator_key == port->actor_oper_port_key) &&/* if all parameters match AND */ -MAC_ADDRESS_EQUAL (&(aggregator->partner_system), &(port->partner_oper.system)) && - (aggregator->partner_system_priority == port->partner_oper.system_priority) && - (aggregator->partner_oper_aggregator_key == port->partner_oper.key) +if (((aggregator->actor_oper_aggregator_key == ad_port->actor_oper_port_key) &&/* if all parameters match AND */ +MAC_ADDRESS_EQUAL (&(aggregator->partner_system), &(ad_port->partner_oper.system)) && + (aggregator->partner_system_priority == ad_port->partner_oper.system_priority) && + (aggregator->partner_oper_aggregator_key == ad_port->partner_oper.key) ) && - ((!MAC_ADDRESS_EQUAL (&(port->partner_oper.system), &(null_mac_addr)) &&/* partner answers */ + ((!MAC_ADDRESS_EQUAL (&(ad_port->partner_oper.system), &(null_mac_addr)) &&/* partner answers */ !aggregator->is_individual)/* but is not individual OR */ ) ) {/* attach to the founded aggregator */ - port->aggregator = aggregator; - port->actor_port_aggregator_identifier = - port->aggregator->aggregator_identifier; - port->next_port_in_aggregator = aggregator->lag_ports; - port->aggregator->num_of_ports++; - aggregator->lag_ports = port; + ad_port->aggregator = aggregator; + ad_port->actor_port_aggregator_identifier = + ad_port->aggregator->aggregator_identifier; + ad_port->next_port_in_aggregator = aggregator->lag_ports; + ad_port->aggregator->num_of_ports++; + aggregator->lag_ports = ad_port;slave_dbg (bond->dev, slave->dev,"Port %d joined LAG %d (existing LAG)\n" , - port->actor_port_number, - port->aggregator->aggregator_identifier); + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier); -/* mark this port as selected */ - port->sm_vars |=AD_PORT_SELECTED ; +/* mark this ad_port as selected */ + ad_port->sm_vars |=AD_PORT_SELECTED ; found =1 ;break ; } } -/* the port couldn't find an aggregator - attach it to a new +/* the ad_port couldn't find an aggregator - attach it to a new * aggregator */ if (!found) {if (free_aggregator) { -/* assign port a new aggregator */ - port->aggregator = free_aggregator; - port->actor_port_aggregator_identifier = - port->aggregator->aggregator_identifier; +/* assign ad_port a new aggregator */ + ad_port->aggregator = free_aggregator; + ad_port->actor_port_aggregator_identifier = + ad_port->aggregator->aggregator_identifier;/* update the new aggregator's parameters -* if port was responsed from the end-user +* if ad_port was responsed from the end-user */ -if (port->actor_oper_port_key &AD_DUPLEX_KEY_MASKS ) +if (ad_port->actor_oper_port_key &AD_DUPLEX_KEY_MASKS )/* if port is full duplex */ - port->aggregator->is_individual = false; + ad_port->aggregator->is_individual = false;else - port->aggregator->is_individual = true; - - port->aggregator->actor_admin_aggregator_key = - port->actor_admin_port_key; - port->aggregator->actor_oper_aggregator_key = - port->actor_oper_port_key; - port->aggregator->partner_system = - port->partner_oper.system; - port->aggregator->partner_system_priority = - port->partner_oper.system_priority; - port->aggregator->partner_oper_aggregator_key = port->partner_oper.key; - port->aggregator->receive_state =1 ; - port->aggregator->transmit_state =1 ; - port->aggregator->lag_ports = port; - port->aggregator->num_of_ports++; + ad_port->aggregator->is_individual = true; + + ad_port->aggregator->actor_admin_aggregator_key = + ad_port->actor_admin_port_key; + ad_port->aggregator->actor_oper_aggregator_key = + ad_port->actor_oper_port_key; + ad_port->aggregator->partner_system = + ad_port->partner_oper.system; + ad_port->aggregator->partner_system_priority = + ad_port->partner_oper.system_priority; + ad_port->aggregator->partner_oper_aggregator_key = ad_port->partner_oper.key; + ad_port->aggregator->receive_state =1 ; + ad_port->aggregator->transmit_state =1 ; + ad_port->aggregator->lag_ports = ad_port; + ad_port->aggregator->num_of_ports++;/* mark this port as selected */ - port->sm_vars |=AD_PORT_SELECTED ; + ad_port->sm_vars |=AD_PORT_SELECTED ; -slave_dbg (bond->dev, port->slave->dev,"Port %d joined LAG %d (new LAG)\n" , - port->actor_port_number, - port->aggregator->aggregator_identifier); +slave_dbg (bond->dev, ad_port->slave->dev,"Port %d joined LAG %d (new LAG)\n" , + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier); }else { -slave_err (bond->dev, port->slave->dev, +slave_err (bond->dev, ad_port->slave->dev,"Port %d did not find a suitable aggregator\n" , - port->actor_port_number); + ad_port->actor_port_number); } } -/* if all aggregator's ports are READY_N == TRUE, set ready=TRUE -* in all aggregator's ports, else set ready=FALSE in all -* aggregator's ports +/* if all aggregator's ad_ports are READY_N == TRUE, set ready=TRUE +* in all aggregator's ad_ports, else set ready=FALSE in all +* aggregator's ad_ports */ -__set_agg_ports_ready (port->aggregator, -__agg_ports_are_ready (port->aggregator)); +__set_agg_ports_ready (ad_port->aggregator, +__agg_ports_are_ready (ad_port->aggregator)); - aggregator =__get_first_agg (port); + aggregator =__get_first_agg (ad_port);ad_agg_selection_logic (aggregator, update_slave_arr); -if (!port->aggregator->is_active) - port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; +if (!ad_port->aggregator->is_active) + ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; }/* Decide if "agg" is a better choice for the new active aggregator that
@@ -1560,7 +1559,7 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,* 4. Therefore, current and best both have partner replies or * both do not, so perform selection policy: * -* BOND_AD_COUNT: Select by count of ports. If count is equal, +* BOND_AD_COUNT: Select by count of ad_ports. If count is equal, * select by bandwidth. * * BOND_AD_STABLE, BOND_AD_BANDWIDTH: Select by bandwidth.
@@ -1582,10 +1581,10 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,switch (__get_agg_selection_mode (curr->lag_ports)) {case BOND_AD_COUNT : -if (__agg_active_ports (curr) >__agg_active_ports (best)) +if (__agg_active_ad_ports (curr) >__agg_active_ad_ports (best))return curr; -if (__agg_active_ports (curr) <__agg_active_ports (best)) +if (__agg_active_ad_ports (curr) <__agg_active_ad_ports (best))return best; fallthrough;
@@ -1609,15 +1608,15 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,static int agg_device_up (const struct aggregator *agg) { -struct port *port = agg->lag_ports; +struct ad_port *ad_port = agg->lag_ports; -if (!port) +if (!ad_port)return 0 ; -for (port = agg->lag_ports; port; - port = port->next_port_in_aggregator) { -if (netif_running (port->slave->dev) && -netif_carrier_ok (port->slave->dev)) +for (ad_port = agg->lag_ports; ad_port; + ad_port = ad_port->next_port_in_aggregator) { +if (netif_running (ad_port->slave->dev) && +netif_carrier_ok (ad_port->slave->dev))return 1 ; }
@@ -1634,15 +1633,15 @@ static int agg_device_up(const struct aggregator *agg)* The logic of this function is to select the aggregator according to * the ad_select policy: * -* BOND_AD_STABLE: select the aggregator with the most ports attached to +* BOND_AD_STABLE: select the aggregator with the most ad_ports attached to * it, and to reselect the active aggregator only if the previous -* aggregator has no more ports related to it. +* aggregator has no more ad_ports related to it. * * BOND_AD_BANDWIDTH: select the aggregator with the highest total * bandwidth, and reselect whenever a link state change takes place or the * set of slaves in the bond changes. * -* BOND_AD_COUNT: select the aggregator with largest number of ports +* BOND_AD_COUNT: select the aggregator with largest number of ad_ports * (slaves), and reselect whenever a link state change takes place or the * set of slaves in the bond changes. *
@@ -1657,7 +1656,7 @@ static void ad_agg_selection_logic(struct aggregator *agg,struct bonding *bond = agg->slave->bond;struct list_head *iter;struct slave *slave; -struct port *port; +struct ad_port *ad_port;rcu_read_lock (); origin = agg;
@@ -1669,7 +1668,7 @@ static void ad_agg_selection_logic(struct aggregator *agg, agg->is_active =0 ; -if (__agg_active_ports (agg) &&agg_device_up (agg)) +if (__agg_active_ad_ports (agg) &&agg_device_up (agg)) best =ad_agg_selection_test (best, agg); }
@@ -1681,7 +1680,7 @@ static void ad_agg_selection_logic(struct aggregator *agg,* answering partner. */ if (active && active->lag_ports && -__agg_active_ports (active) && +__agg_active_ad_ports (active) && (__agg_has_partner (active) || (!__agg_has_partner (active) && !__agg_has_partner (best)))) {
@@ -1736,13 +1735,13 @@ static void ad_agg_selection_logic(struct aggregator *agg, best->partner_oper_aggregator_key, best->is_individual, best->is_active); -/* disable the ports that were related to the former +/* disable the ad_ports that were related to the former * active_aggregator */ if (active) { -for (port = active->lag_ports; port; - port = port->next_port_in_aggregator) { -__disable_port (port); +for (ad_port = active->lag_ports; ad_port; + ad_port = ad_port->next_port_in_aggregator) { +__disable_ad_port (ad_port); } }/* Slave array needs update. */
@@ -1750,15 +1749,15 @@ static void ad_agg_selection_logic(struct aggregator *agg, }/* if the selected aggregator is of join individuals -* (partner_system is NULL), enable their ports +* (partner_system is NULL), enable their ad_ports */ active =__get_active_agg (origin);if (active) {if (!__agg_has_partner (active)) { -for (port = active->lag_ports; port; - port = port->next_port_in_aggregator) { -__enable_port (port); +for (ad_port = active->lag_ports; ad_port; + ad_port = ad_port->next_port_in_aggregator) { +__enable_ad_port (ad_port); } } }
@@ -1809,11 +1808,11 @@ static void ad_initialize_agg(struct aggregator *aggregator) }/** -* ad_initialize_port - initialize a given port's parameters -* @port: the port we're looking at +* ad_initialize_port - initialize a given ad_port's parameters +* @ad_port: the ad_port we're looking at * @lacp_fast: boolean. whether fast periodic should be used */ -static void ad_initialize_port (struct port *port,int lacp_fast) +static void ad_initialize_port (struct ad_port *ad_port,int lacp_fast) {static const struct port_params tmpl = { .system_priority =0xffff ,
@@ -1834,83 +1833,83 @@ static void ad_initialize_port(struct port *port, int lacp_fast) .collector_max_delay = htons(AD_COLLECTOR_MAX_DELAY), }; -if (port) { - port->actor_port_priority =0xff ; - port->actor_port_aggregator_identifier =0 ; - port->ntt = false; - port->actor_admin_port_state =LACP_STATE_AGGREGATION | +if (ad_port) { + ad_port->actor_port_priority =0xff ; + ad_port->actor_port_aggregator_identifier =0 ; + ad_port->ntt = false; + ad_port->actor_admin_port_state =LACP_STATE_AGGREGATION |LACP_STATE_LACP_ACTIVITY ; - port->actor_oper_port_state =LACP_STATE_AGGREGATION | + ad_port->actor_oper_port_state =LACP_STATE_AGGREGATION |LACP_STATE_LACP_ACTIVITY ;if (lacp_fast) - port->actor_oper_port_state |=LACP_STATE_LACP_TIMEOUT ; + ad_port->actor_oper_port_state |=LACP_STATE_LACP_TIMEOUT ; -memcpy (&port->partner_admin, &tmpl,sizeof (tmpl)); -memcpy (&port->partner_oper, &tmpl,sizeof (tmpl)); +memcpy (&ad_port->partner_admin, &tmpl,sizeof (tmpl)); +memcpy (&ad_port->partner_oper, &tmpl,sizeof (tmpl)); - port->is_enabled = true; + ad_port->is_enabled = true;/* private parameters */ - port->sm_vars =AD_PORT_BEGIN |AD_PORT_LACP_ENABLED ; - port->sm_rx_state =0 ; - port->sm_rx_timer_counter =0 ; - port->sm_periodic_state =0 ; - port->sm_periodic_timer_counter =0 ; - port->sm_mux_state =0 ; - port->sm_mux_timer_counter =0 ; - port->sm_tx_state =0 ; - port->aggregator =NULL ; - port->next_port_in_aggregator =NULL ; - port->transaction_id =0 ; - - port->sm_churn_actor_timer_counter =0 ; - port->sm_churn_actor_state =0 ; - port->churn_actor_count =0 ; - port->sm_churn_partner_timer_counter =0 ; - port->sm_churn_partner_state =0 ; - port->churn_partner_count =0 ; - -memcpy (&port->lacpdu, &lacpdu,sizeof (lacpdu)); + ad_port->sm_vars =AD_PORT_BEGIN |AD_PORT_LACP_ENABLED ; + ad_port->sm_rx_state =0 ; + ad_port->sm_rx_timer_counter =0 ; + ad_port->sm_periodic_state =0 ; + ad_port->sm_periodic_timer_counter =0 ; + ad_port->sm_mux_state =0 ; + ad_port->sm_mux_timer_counter =0 ; + ad_port->sm_tx_state =0 ; + ad_port->aggregator =NULL ; + ad_port->next_port_in_aggregator =NULL ; + ad_port->transaction_id =0 ; + + ad_port->sm_churn_actor_timer_counter =0 ; + ad_port->sm_churn_actor_state =0 ; + ad_port->churn_actor_count =0 ; + ad_port->sm_churn_partner_timer_counter =0 ; + ad_port->sm_churn_partner_state =0 ; + ad_port->churn_partner_count =0 ; + +memcpy (&ad_port->lacpdu, &lacpdu,sizeof (lacpdu)); } }/** -* ad_enable_collecting_distributing - enable a port's transmit/receive -* @port: the port we're looking at +* ad_enable_collecting_distributing - enable an ad_port's transmit/receive +* @ad_port: the ad_port we're looking at * @update_slave_arr: Does slave array need update? * -* Enable @port if it's in an active aggregator +* Enable @ad_port if it's in an active aggregator */ -static void ad_enable_collecting_distributing (struct port *port, +static void ad_enable_collecting_distributing (struct ad_port *ad_port,bool *update_slave_arr) { -if (port->aggregator->is_active) { -slave_dbg (port->slave->bond->dev, port->slave->dev, +if (ad_port->aggregator->is_active) { +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"Enabling port %d (LAG %d)\n" , - port->actor_port_number, - port->aggregator->aggregator_identifier); -__enable_port (port); + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier); +__enable_ad_port (ad_port);/* Slave array needs update */ *update_slave_arr = true; } }/** -* ad_disable_collecting_distributing - disable a port's transmit/receive -* @port: the port we're looking at +* ad_disable_collecting_distributing - disable an ad_port's transmit/receive +* @ad_port: the ad_port we're looking at * @update_slave_arr: Does slave array need update? */ -static void ad_disable_collecting_distributing (struct port *port, +static void ad_disable_collecting_distributing (struct ad_port *ad_port,bool *update_slave_arr) { -if (port->aggregator && - !MAC_ADDRESS_EQUAL (&(port->aggregator->partner_system), +if (ad_port->aggregator && + !MAC_ADDRESS_EQUAL (&(ad_port->aggregator->partner_system), &(null_mac_addr))) { -slave_dbg (port->slave->bond->dev, port->slave->dev, +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"Disabling port %d (LAG %d)\n" , - port->actor_port_number, - port->aggregator->aggregator_identifier); -__disable_port (port); + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier); +__disable_ad_port (ad_port);/* Slave array needs an update */ *update_slave_arr = true; }
@@ -1919,15 +1918,15 @@ static void ad_disable_collecting_distributing(struct port *port,/** * ad_marker_info_received - handle receive of a Marker information frame * @marker_info: Marker info received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at */ static void ad_marker_info_received (struct bond_marker *marker_info, -struct port *port) +struct ad_port *ad_port) {struct bond_marker marker; -atomic64_inc (&SLAVE_AD_INFO (port->slave)->stats.marker_rx); -atomic64_inc (&BOND_AD_INFO (port->slave->bond).stats.marker_rx); +atomic64_inc (&SLAVE_AD_INFO (ad_port->slave)->stats.marker_rx); +atomic64_inc (&BOND_AD_INFO (ad_port->slave->bond).stats.marker_rx);/* copy the received marker data to the response marker */ memcpy (&marker, marker_info,sizeof (struct bond_marker ));
@@ -1935,26 +1934,26 @@ static void ad_marker_info_received(struct bond_marker *marker_info, marker.tlv_type =AD_MARKER_RESPONSE_SUBTYPE ;/* send the marker response */ -if (ad_marker_send (port, &marker) >=0 ) -slave_dbg (port->slave->bond->dev, port->slave->dev, +if (ad_marker_send (ad_port, &marker) >=0 ) +slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev,"Sent Marker Response on port %d\n" , - port->actor_port_number); + ad_port->actor_port_number); }/** * ad_marker_response_received - handle receive of a marker response frame * @marker: marker PDU received -* @port: the port we're looking at +* @ad_port: the ad_port we're looking at * * This function does nothing since we decided not to implement send and handle * response for marker PDU's, in this stage, but only to respond to marker * information. */ static void ad_marker_response_received (struct bond_marker *marker, -struct port *port) +struct ad_port *ad_port) { -atomic64_inc (&SLAVE_AD_INFO (port->slave)->stats.marker_resp_rx); -atomic64_inc (&BOND_AD_INFO (port->slave->bond).stats.marker_resp_rx); +atomic64_inc (&SLAVE_AD_INFO (ad_port->slave)->stats.marker_resp_rx); +atomic64_inc (&BOND_AD_INFO (ad_port->slave->bond).stats.marker_resp_rx);/* DO NOTHING, SINCE WE DECIDED NOT TO IMPLEMENT THIS FEATURE FOR NOW */ }
@@ -2014,7 +2013,7 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution) }/** -* bond_3ad_bind_slave - initialize a slave's port +* bond_3ad_bind_slave - initialize a slave's ad_port * @slave: slave struct to work on * * Returns: 0 on success
@@ -2023,32 +2022,32 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)void bond_3ad_bind_slave (struct slave *slave) {struct bonding *bond =bond_get_bond_by_slave (slave); -struct port *port; +struct ad_port *ad_port;struct aggregator *aggregator;/* check that the slave has not been initialized yet. */ -if (SLAVE_AD_INFO (slave)->port.slave != slave) { +if (SLAVE_AD_INFO (slave)->ad_port.slave != slave) { -/* port initialization */ - port = &(SLAVE_AD_INFO (slave)->port); +/* ad_port initialization */ + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); -ad_initialize_port (port, bond->params.lacp_fast); +ad_initialize_port (ad_port, bond->params.lacp_fast); - port->slave = slave; - port->actor_port_number =SLAVE_AD_INFO (slave)->id; + ad_port->slave = slave; + ad_port->actor_port_number =SLAVE_AD_INFO (slave)->id;/* key is determined according to the link speed, duplex and * user key */ - port->actor_admin_port_key = bond->params.ad_user_port_key <<6 ; -ad_update_actor_keys (port, false); + ad_port->actor_admin_port_key = bond->params.ad_user_port_key <<6 ; +ad_update_actor_keys (ad_port, false);/* actor system is the bond's system */ -__ad_actor_update_port (port); +__ad_actor_update_port (ad_port);/* tx timer(to verify that no more than MAX_TX_IN_SECOND * lacpdu's are sent in one second) */ - port->sm_tx_timer_counter = ad_ticks_per_sec/AD_MAX_TX_IN_SECOND ; + ad_port->sm_tx_timer_counter = ad_ticks_per_sec/AD_MAX_TX_IN_SECOND ; -__disable_port (port); +__disable_ad_port (ad_port);/* aggregator initialization */ aggregator = &(SLAVE_AD_INFO (slave)->aggregator);
@@ -2064,16 +2063,16 @@ void bond_3ad_bind_slave(struct slave *slave) }/** -* bond_3ad_unbind_slave - deinitialize a slave's port +* bond_3ad_unbind_slave - deinitialize a slave's ad_port * @slave: slave struct to work on * -* Search for the aggregator that is related to this port, remove the -* aggregator and assign another aggregator for other port related to it -* (if any), and remove the port. +* Search for the aggregator that is related to this ad_port, remove the +* aggregator and assign another aggregator for other ad_port related to it +* (if any), and remove the ad_port. */ void bond_3ad_unbind_slave (struct slave *slave) { -struct port *port, *prev_port, *temp_port; +struct ad_port *ad_port, *prev_port, *temp_port;struct aggregator *aggregator, *new_aggregator, *temp_aggregator;int select_new_active_agg =0 ;struct bonding *bond = slave->bond;
@@ -2084,10 +2083,10 @@ void bond_3ad_unbind_slave(struct slave *slave)/* Sync against bond_3ad_state_machine_handler() */ spin_lock_bh (&bond->mode_lock); aggregator = &(SLAVE_AD_INFO (slave)->aggregator); - port = &(SLAVE_AD_INFO (slave)->port); + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); -/* if slave is null, the whole port is not initialized */ -if (!port->slave) { +/* if slave is null, the whole ad_port is not initialized */ +if (!ad_port->slave) {slave_warn (bond->dev, slave->dev,"Trying to unbind an uninitialized port\n" ); goto out; }
@@ -2095,31 +2094,31 @@ void bond_3ad_unbind_slave(struct slave *slave)slave_dbg (bond->dev, slave->dev,"Unbinding Link Aggregation Group %d\n" , aggregator->aggregator_identifier); -/* Tell the partner that this port is not suitable for aggregation */ - port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; - port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; - port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; - port->actor_oper_port_state &= ~LACP_STATE_AGGREGATION ; -__update_lacpdu_from_port (port); -ad_lacpdu_send (port); +/* Tell the partner that this ad_port is not suitable for aggregation */ + ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ; + ad_port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; + ad_port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; + ad_port->actor_oper_port_state &= ~LACP_STATE_AGGREGATION ; +__update_lacpdu_from_ad_port (ad_port); +ad_lacpdu_send (ad_port);/* check if this aggregator is occupied */ if (aggregator->lag_ports) { -/* check if there are other ports related to this aggregator -* except the port related to this slave(thats ensure us that +/* check if there are other ad_ports related to this aggregator +* except the ad_port related to this slave(thats ensure us that * there is a reason to search for new aggregator, and that we * will find one */ -if ((aggregator->lag_ports != port) || +if ((aggregator->lag_ports != ad_port) || (aggregator->lag_ports->next_port_in_aggregator)) { -/* find new aggregator for the related port(s) */ +/* find new aggregator for the related ad_port(s) */ bond_for_each_slave (bond, slave_iter, iter) { new_aggregator = &(SLAVE_AD_INFO (slave_iter)->aggregator);/* if the new aggregator is empty, or it is -* connected to our port only +* connected to our ad_port only */ if (!new_aggregator->lag_ports || - ((new_aggregator->lag_ports == port) && + ((new_aggregator->lag_ports == ad_port) && !new_aggregator->lag_ports->next_port_in_aggregator))break ; }
@@ -2130,12 +2129,12 @@ void bond_3ad_unbind_slave(struct slave *slave)* parameters and connect the related lag_ports to the * new aggregator */ -if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { +if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == ad_port) && !new_aggregator->lag_ports->next_port_in_aggregator))) {slave_dbg (bond->dev, slave->dev,"Some port(s) related to LAG %d - replacing with LAG %d\n" , aggregator->aggregator_identifier, new_aggregator->aggregator_identifier); -if ((new_aggregator->lag_ports == port) && +if ((new_aggregator->lag_ports == ad_port) && new_aggregator->is_active) {slave_info (bond->dev, slave->dev,"Removing an active aggregator\n" ); select_new_active_agg =1 ;
@@ -2165,13 +2164,13 @@ void bond_3ad_unbind_slave(struct slave *slave)ad_clear_agg (aggregator);if (select_new_active_agg) -ad_agg_selection_logic (__get_first_agg (port), +ad_agg_selection_logic (__get_first_agg (ad_port), &dummy_slave_update); }else {slave_warn (bond->dev, slave->dev,"unbinding aggregator, and could not find a new aggregator for its ports\n" ); } }else { -/* in case that the only port related to this +/* in case that the only ad_port related to this * aggregator is the one we want to remove */ select_new_active_agg = aggregator->is_active;
@@ -2179,7 +2178,7 @@ void bond_3ad_unbind_slave(struct slave *slave)if (select_new_active_agg) {slave_info (bond->dev, slave->dev,"Removing an active aggregator\n" );/* select new active aggregator */ - temp_aggregator =__get_first_agg (port); + temp_aggregator =__get_first_agg (ad_port);if (temp_aggregator)ad_agg_selection_logic (temp_aggregator, &dummy_slave_update);
@@ -2187,17 +2186,17 @@ void bond_3ad_unbind_slave(struct slave *slave) } } -slave_dbg (bond->dev, slave->dev,"Unbinding port %d\n" , port->actor_port_number); +slave_dbg (bond->dev, slave->dev,"Unbinding port %d\n" , ad_port->actor_port_number); -/* find the aggregator that this port is connected to */ +/* find the aggregator that this ad_port is connected to */ bond_for_each_slave (bond, slave_iter, iter) { temp_aggregator = &(SLAVE_AD_INFO (slave_iter)->aggregator); prev_port =NULL ; -/* search the port in the aggregator's related ports */ +/* search the ad_port in the aggregator's related ad_ports */ for (temp_port = temp_aggregator->lag_ports; temp_port; prev_port = temp_port, temp_port = temp_port->next_port_in_aggregator) { -if (temp_port == port) { +if (temp_port == ad_port) {/* the aggregator found - detach the port from * this aggregator */
@@ -2206,13 +2205,13 @@ void bond_3ad_unbind_slave(struct slave *slave)else temp_aggregator->lag_ports = temp_port->next_port_in_aggregator; temp_aggregator->num_of_ports--; -if (__agg_active_ports (temp_aggregator) ==0 ) { +if (__agg_active_ad_ports (temp_aggregator) ==0 ) { select_new_active_agg = temp_aggregator->is_active;ad_clear_agg (temp_aggregator);if (select_new_active_agg) {slave_info (bond->dev, slave->dev,"Removing an active aggregator\n" );/* select new active aggregator */ -ad_agg_selection_logic (__get_first_agg (port), +ad_agg_selection_logic (__get_first_agg (ad_port), &dummy_slave_update); } }
@@ -2220,17 +2219,17 @@ void bond_3ad_unbind_slave(struct slave *slave) } } } - port->slave =NULL ; + ad_port->slave =NULL ; out:spin_unlock_bh (&bond->mode_lock); }/** -* bond_3ad_update_ad_actor_settings - reflect change of actor settings to ports +* bond_3ad_update_ad_actor_settings - reflect change of actor settings to ad_ports * @bond: bonding struct to work on * -* If an ad_actor setting gets changed we need to update the individual port +* If an ad_actor setting gets changed we need to update the individual ad_port * settings so the bond device will use the new values when it gets upped. */ void bond_3ad_update_ad_actor_settings (struct bonding *bond)
@@ -2250,10 +2249,10 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond)spin_lock_bh (&bond->mode_lock);bond_for_each_slave (bond, slave, iter) { -struct port *port = &(SLAVE_AD_INFO (slave))->port; +struct ad_port *ad_port = &(SLAVE_AD_INFO (slave))->ad_port; -__ad_actor_update_port (port); - port->ntt = true; +__ad_actor_update_port (ad_port); + ad_port->ntt = true; }spin_unlock_bh (&bond->mode_lock); }
@@ -2268,7 +2267,7 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond)* reply of one to each other might be delayed until next tick. * * This function also complete the initialization when the agg_select_timer -* times out, and it selects an aggregator for the ports that are yet not +* times out, and it selects an aggregator for the ad_ports that are yet not * related to any aggregator, and selects the active aggregator for a bond. */ void bond_3ad_state_machine_handler (struct work_struct *work)
@@ -2278,11 +2277,11 @@ void bond_3ad_state_machine_handler(struct work_struct *work)struct aggregator *aggregator;struct list_head *iter;struct slave *slave; -struct port *port; +struct ad_port *ad_port;bool should_notify_rtnl =BOND_SLAVE_NOTIFY_LATER ;bool update_slave_arr = false; -/* Lock to protect data accessed by all (e.g., port->sm_vars) and +/* Lock to protect data accessed by all (e.g., ad_port->sm_vars) and * against running with bond_3ad_unbind_slave. ad_rx_machine may run * concurrently due to incoming LACPDU as well. */
@@ -2297,41 +2296,41 @@ void bond_3ad_state_machine_handler(struct work_struct *work)if (BOND_AD_INFO (bond).agg_select_timer && !(--BOND_AD_INFO (bond).agg_select_timer)) { slave =bond_first_slave_rcu (bond); - port = slave ? &(SLAVE_AD_INFO (slave)->port) :NULL ; + ad_port = slave ? &(SLAVE_AD_INFO (slave)->ad_port) :NULL ;/* select the active aggregator for the bond */ -if (port) { -if (!port->slave) { +if (ad_port) { +if (!ad_port->slave) {net_warn_ratelimited ("%s: Warning: bond's first port is uninitialized\n" , bond->dev->name); goto re_arm; } - aggregator =__get_first_agg (port); + aggregator =__get_first_agg (ad_port);ad_agg_selection_logic (aggregator, &update_slave_arr); }bond_3ad_set_carrier (bond); } -/* for each port run the state machines */ +/* for each ad_port run the state machines */ bond_for_each_slave_rcu (bond, slave, iter) { - port = &(SLAVE_AD_INFO (slave)->port); -if (!port->slave) { + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); +if (!ad_port->slave) {net_warn_ratelimited ("%s: Warning: Found an uninitialized port\n" , bond->dev->name); goto re_arm; } -ad_rx_machine (NULL , port); -ad_periodic_machine (port); -ad_port_selection_logic (port, &update_slave_arr); -ad_mux_machine (port, &update_slave_arr); -ad_tx_machine (port); -ad_churn_machine (port); +ad_rx_machine (NULL , ad_port); +ad_periodic_machine (ad_port); +ad_port_selection_logic (ad_port, &update_slave_arr); +ad_mux_machine (ad_port, &update_slave_arr); +ad_tx_machine (ad_port); +ad_churn_machine (ad_port);/* turn off the BEGIN bit, since we already handled it */ -if (port->sm_vars &AD_PORT_BEGIN ) - port->sm_vars &= ~AD_PORT_BEGIN ; +if (ad_port->sm_vars &AD_PORT_BEGIN ) + ad_port->sm_vars &= ~AD_PORT_BEGIN ; } re_arm:
@@ -2368,11 +2367,11 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave)struct bonding *bond = slave->bond;int ret =RX_HANDLER_ANOTHER ;struct bond_marker *marker; -struct port *port; +struct ad_port *ad_port;atomic64_t *stat; - port = &(SLAVE_AD_INFO (slave)->port); -if (!port->slave) { + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); +if (!ad_port->slave) {net_warn_ratelimited ("%s: Warning: port of slave %s is uninitialized\n" , slave->dev->name, slave->bond->dev->name);return ret;
@@ -2383,10 +2382,10 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave) ret =RX_HANDLER_CONSUMED ;slave_dbg (slave->bond->dev, slave->dev,"Received LACPDU on port %d\n" , - port->actor_port_number); + ad_port->actor_port_number);/* Protect against concurrent state machines */ spin_lock (&slave->bond->mode_lock); -ad_rx_machine (lacpdu, port); +ad_rx_machine (lacpdu, ad_port);spin_unlock (&slave->bond->mode_lock);break ;case AD_TYPE_MARKER :
@@ -2398,17 +2397,17 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave)switch (marker->tlv_type) {case AD_MARKER_INFORMATION_SUBTYPE :slave_dbg (slave->bond->dev, slave->dev,"Received Marker Information on port %d\n" , - port->actor_port_number); -ad_marker_info_received (marker, port); + ad_port->actor_port_number); +ad_marker_info_received (marker, ad_port);break ;case AD_MARKER_RESPONSE_SUBTYPE :slave_dbg (slave->bond->dev, slave->dev,"Received Marker Response on port %d\n" , - port->actor_port_number); -ad_marker_response_received (marker, port); + ad_port->actor_port_number); +ad_marker_response_received (marker, ad_port);break ;default :slave_dbg (slave->bond->dev, slave->dev,"Received an unknown Marker subtype on port %d\n" , - port->actor_port_number); + ad_port->actor_port_number); stat = &SLAVE_AD_INFO (slave)->stats.marker_unknown_rx;atomic64_inc (stat); stat = &BOND_AD_INFO (bond).stats.marker_unknown_rx;
@@ -2424,47 +2423,47 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave) }/** -* ad_update_actor_keys - Update the oper / admin keys for a port based on +* ad_update_actor_keys - Update the oper / admin keys for an ad_port based on * its current speed and duplex settings. * -* @port: the port we'are looking at +* @ad_port: the ad_port we'are looking at * @reset: Boolean to just reset the speed and the duplex part of the key * * The logic to change the oper / admin keys is: * (a) A full duplex port can participate in LACP with partner. * (b) When the speed is changed, LACP need to be reinitiated. */ -static void ad_update_actor_keys (struct port *port,bool reset) +static void ad_update_actor_keys (struct ad_port *ad_port,bool reset) {u8 duplex =0 ;u16 ospeed =0 , speed =0 ; -u16 old_oper_key = port->actor_oper_port_key; +u16 old_oper_key = ad_port->actor_oper_port_key; - port->actor_admin_port_key &= ~(AD_SPEED_KEY_MASKS |AD_DUPLEX_KEY_MASKS ); + ad_port->actor_admin_port_key &= ~(AD_SPEED_KEY_MASKS |AD_DUPLEX_KEY_MASKS );if (!reset) { - speed =__get_link_speed (port); + speed =__get_link_speed (ad_port); ospeed = (old_oper_key &AD_SPEED_KEY_MASKS ) >>1 ; - duplex =__get_duplex (port); - port->actor_admin_port_key |= (speed <<1 ) | duplex; + duplex =__get_duplex (ad_port); + ad_port->actor_admin_port_key |= (speed <<1 ) | duplex; } - port->actor_oper_port_key = port->actor_admin_port_key; + ad_port->actor_oper_port_key = ad_port->actor_admin_port_key; -if (old_oper_key != port->actor_oper_port_key) { +if (old_oper_key != ad_port->actor_oper_port_key) {/* Only 'duplex' port participates in LACP */ if (duplex) - port->sm_vars |=AD_PORT_LACP_ENABLED ; + ad_port->sm_vars |=AD_PORT_LACP_ENABLED ;else - port->sm_vars &= ~AD_PORT_LACP_ENABLED ; + ad_port->sm_vars &= ~AD_PORT_LACP_ENABLED ;if (!reset) {if (!speed) { -slave_err (port->slave->bond->dev, - port->slave->dev, +slave_err (ad_port->slave->bond->dev, + ad_port->slave->dev,"speed changed to 0 on port %d\n" , - port->actor_port_number); + ad_port->actor_port_number); }else if (duplex && ospeed != speed) {/* Speed change restarts LACP state-machine */ - port->sm_vars |=AD_PORT_BEGIN ; + ad_port->sm_vars |=AD_PORT_BEGIN ; } } }
@@ -2476,26 +2475,26 @@ static void ad_update_actor_keys(struct port *port, bool reset)* * @slave: slave struct to work on * -* Handle reselection of aggregator (if needed) for this port. +* Handle reselection of aggregator (if needed) for this ad_port. */ void bond_3ad_adapter_speed_duplex_changed (struct slave *slave) { -struct port *port; +struct ad_port *ad_port; - port = &(SLAVE_AD_INFO (slave)->port); + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); -/* if slave is null, the whole port is not initialized */ -if (!port->slave) { +/* if slave is null, the whole ad_port is not initialized */ +if (!ad_port->slave) {slave_warn (slave->bond->dev, slave->dev,"speed/duplex changed for uninitialized port\n" );return ; }spin_lock_bh (&slave->bond->mode_lock); -ad_update_actor_keys (port, false); +ad_update_actor_keys (ad_port, false);spin_unlock_bh (&slave->bond->mode_lock);slave_dbg (slave->bond->dev, slave->dev,"Port %d changed speed/duplex\n" , - port->actor_port_number); + ad_port->actor_port_number); }/**
@@ -2503,18 +2502,18 @@ void bond_3ad_adapter_speed_duplex_changed(struct slave *slave)* @slave: slave struct to work on * @link: whether the link is now up or down * -* Handle reselection of aggregator (if needed) for this port. +* Handle reselection of aggregator (if needed) for this ad_port. */ void bond_3ad_handle_link_change (struct slave *slave,char link) {struct aggregator *agg; -struct port *port; +struct ad_port *ad_port;bool dummy; - port = &(SLAVE_AD_INFO (slave)->port); + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); -/* if slave is null, the whole port is not initialized */ -if (!port->slave) { +/* if slave is null, the whole ad_port is not initialized */ +if (!ad_port->slave) {slave_warn (slave->bond->dev, slave->dev,"link status changed for uninitialized port\n" );return ; }
@@ -2528,20 +2527,20 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)* some of he adaptors(ce1000.lan) report. */ if (link ==BOND_LINK_UP ) { - port->is_enabled = true; -ad_update_actor_keys (port, false); + ad_port->is_enabled = true; +ad_update_actor_keys (ad_port, false); }else {/* link has failed */ - port->is_enabled = false; -ad_update_actor_keys (port, true); + ad_port->is_enabled = false; +ad_update_actor_keys (ad_port, true); } - agg =__get_first_agg (port); + agg =__get_first_agg (ad_port);ad_agg_selection_logic (agg, &dummy);spin_unlock_bh (&slave->bond->mode_lock);slave_dbg (slave->bond->dev, slave->dev,"Port %d changed link status to %s\n" , - port->actor_port_number, + ad_port->actor_port_number, link ==BOND_LINK_UP ?"UP" :"DOWN" );/* RTNL is held and mode_lock is released so it's safe
@@ -2578,7 +2577,7 @@ int bond_3ad_set_carrier(struct bonding *bond) active =__get_active_agg (&(SLAVE_AD_INFO (first_slave)->aggregator));if (active) {/* are enough slaves available to consider link up? */ -if (__agg_active_ports (active) < bond->params.min_links) { +if (__agg_active_ad_ports (active) < bond->params.min_links) {if (netif_carrier_ok (bond->dev)) {netif_carrier_off (bond->dev); goto out;
@@ -2609,12 +2608,12 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond,struct aggregator *aggregator =NULL ;struct list_head *iter;struct slave *slave; -struct port *port; +struct ad_port *ad_port;bond_for_each_slave_rcu (bond, slave, iter) { - port = &(SLAVE_AD_INFO (slave)->port); -if (port->aggregator && port->aggregator->is_active) { - aggregator = port->aggregator; + ad_port = &(SLAVE_AD_INFO (slave)->ad_port); +if (ad_port->aggregator && ad_port->aggregator->is_active) { + aggregator = ad_port->aggregator;break ; } }
@@ -2623,7 +2622,7 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond,return -1 ; ad_info->aggregator_id = aggregator->aggregator_identifier; - ad_info->ports =__agg_active_ports (aggregator); + ad_info->ports =__agg_active_ad_ports (aggregator); ad_info->actor_key = aggregator->actor_oper_aggregator_key; ad_info->partner_key = aggregator->partner_oper_aggregator_key; ether_addr_copy(ad_info->partner_system,
@@ -2668,15 +2667,15 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,* @bond: bonding struct * * When modify lacp_rate parameter via sysfs, -* update actor_oper_port_state of each port. +* update actor_oper_port_state of each ad_port. * * Hold bond->mode_lock, -* so we can modify port->actor_oper_port_state, +* so we can modify ad_port->actor_oper_port_state, * no matter bond is up or down. */ void bond_3ad_update_lacp_rate (struct bonding *bond) { -struct port *port =NULL ; +struct ad_port *ad_port =NULL ;struct list_head *iter;struct slave *slave;int lacp_fast;
@@ -2684,11 +2683,11 @@ void bond_3ad_update_lacp_rate(struct bonding *bond) lacp_fast = bond->params.lacp_fast;spin_lock_bh (&bond->mode_lock);bond_for_each_slave (bond, slave, iter) { - port = &(SLAVE_AD_INFO (slave)->port); + ad_port = &(SLAVE_AD_INFO (slave)->ad_port);if (lacp_fast) - port->actor_oper_port_state |=LACP_STATE_LACP_TIMEOUT ; + ad_port->actor_oper_port_state |=LACP_STATE_LACP_TIMEOUT ;else - port->actor_oper_port_state &= ~LACP_STATE_LACP_TIMEOUT ; + ad_port->actor_oper_port_state &= ~LACP_STATE_LACP_TIMEOUT ; }spin_unlock_bh (&bond->mode_lock); }
drivers/net/bonding/bond_main.c +2 -2
@@ -1151,7 +1151,7 @@ static void bond_poll_controller(struct net_device *bond_dev)if (BOND_MODE (bond) ==BOND_MODE_8023AD ) {struct aggregator *agg = -SLAVE_AD_INFO (slave)->port.aggregator; +SLAVE_AD_INFO (slave)->ad_port.aggregator;if (agg && agg->aggregator_identifier != ad_info.aggregator_id)
@@ -4338,7 +4338,7 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)if (BOND_MODE (bond) ==BOND_MODE_8023AD ) {struct aggregator *agg; - agg =SLAVE_AD_INFO (slave)->port.aggregator; + agg =SLAVE_AD_INFO (slave)->ad_port.aggregator;if (!agg || agg->aggregator_identifier != agg_id)continue ; }
drivers/net/bonding/bond_netlink.c +3 -3
@@ -54,10 +54,10 @@ static int bond_fill_slave_info(struct sk_buff *skb,if (BOND_MODE (slave->bond) ==BOND_MODE_8023AD ) {const struct aggregator *agg; -const struct port *ad_port; +const struct ad_port *ad_port; - ad_port = &SLAVE_AD_INFO (slave)->port; - agg =SLAVE_AD_INFO (slave)->port.aggregator; + ad_port = &SLAVE_AD_INFO (slave)->ad_port; + agg =SLAVE_AD_INFO (slave)->ad_port.aggregator;if (agg) {if (nla_put_u16 (skb,IFLA_BOND_SLAVE_AD_AGGREGATOR_ID , agg->aggregator_identifier))
drivers/net/bonding/bond_procfs.c +18 -18
@@ -191,49 +191,49 @@ static void bond_info_show_slave(struct seq_file *seq,seq_printf (seq,"Slave queue ID: %d\n" , slave->queue_id);if (BOND_MODE (bond) ==BOND_MODE_8023AD ) { -const struct port *port = &SLAVE_AD_INFO (slave)->port; -const struct aggregator *agg = port->aggregator; +const struct ad_port *ad_port = &SLAVE_AD_INFO (slave)->ad_port; +const struct aggregator *agg = ad_port->aggregator;if (agg) {seq_printf (seq,"Aggregator ID: %d\n" , agg->aggregator_identifier);seq_printf (seq,"Actor Churn State: %s\n" , -bond_3ad_churn_desc (port->sm_churn_actor_state)); +bond_3ad_churn_desc (ad_port->sm_churn_actor_state));seq_printf (seq,"Partner Churn State: %s\n" , -bond_3ad_churn_desc (port->sm_churn_partner_state)); +bond_3ad_churn_desc (ad_port->sm_churn_partner_state));seq_printf (seq,"Actor Churned Count: %d\n" , - port->churn_actor_count); + ad_port->churn_actor_count);seq_printf (seq,"Partner Churned Count: %d\n" , - port->churn_partner_count); + ad_port->churn_partner_count);if (capable (CAP_NET_ADMIN )) {seq_puts (seq,"details actor lacp pdu:\n" );seq_printf (seq," system priority: %d\n" , - port->actor_system_priority); + ad_port->actor_system_priority);seq_printf (seq," system mac address: %pM\n" , - &port->actor_system); + &ad_port->actor_system);seq_printf (seq," port key: %d\n" , - port->actor_oper_port_key); + ad_port->actor_oper_port_key);seq_printf (seq," port priority: %d\n" , - port->actor_port_priority); + ad_port->actor_port_priority);seq_printf (seq," port number: %d\n" , - port->actor_port_number); + ad_port->actor_port_number);seq_printf (seq," port state: %d\n" , - port->actor_oper_port_state); + ad_port->actor_oper_port_state);seq_puts (seq,"details partner lacp pdu:\n" );seq_printf (seq," system priority: %d\n" , - port->partner_oper.system_priority); + ad_port->partner_oper.system_priority);seq_printf (seq," system mac address: %pM\n" , - &port->partner_oper.system); + &ad_port->partner_oper.system);seq_printf (seq," oper key: %d\n" , - port->partner_oper.key); + ad_port->partner_oper.key);seq_printf (seq," port priority: %d\n" , - port->partner_oper.port_priority); + ad_port->partner_oper.port_priority);seq_printf (seq," port number: %d\n" , - port->partner_oper.port_number); + ad_port->partner_oper.port_number);seq_printf (seq," port state: %d\n" , - port->partner_oper.port_state); + ad_port->partner_oper.port_state); } }else {seq_puts (seq,"Aggregator ID: N/A\n" );
drivers/net/bonding/bond_sysfs_slave.c +5 -5
@@ -68,7 +68,7 @@ static ssize_t ad_aggregator_id_show(struct slave *slave, char *buf)const struct aggregator *agg;if (BOND_MODE (slave->bond) ==BOND_MODE_8023AD ) { - agg =SLAVE_AD_INFO (slave)->port.aggregator; + agg =SLAVE_AD_INFO (slave)->ad_port.aggregator;if (agg)return sprintf (buf,"%d\n" , agg->aggregator_identifier);
@@ -80,10 +80,10 @@ static SLAVE_ATTR_RO(ad_aggregator_id);static ssize_t ad_actor_oper_port_state_show (struct slave *slave,char *buf) { -const struct port *ad_port; +const struct ad_port *ad_port;if (BOND_MODE (slave->bond) ==BOND_MODE_8023AD ) { - ad_port = &SLAVE_AD_INFO (slave)->port; + ad_port = &SLAVE_AD_INFO (slave)->ad_port;if (ad_port->aggregator)return sprintf (buf,"%u\n" , ad_port->actor_oper_port_state);
@@ -95,10 +95,10 @@ static SLAVE_ATTR_RO(ad_actor_oper_port_state);static ssize_t ad_partner_oper_port_state_show (struct slave *slave,char *buf) { -const struct port *ad_port; +const struct ad_port *ad_port;if (BOND_MODE (slave->bond) ==BOND_MODE_8023AD ) { - ad_port = &SLAVE_AD_INFO (slave)->port; + ad_port = &SLAVE_AD_INFO (slave)->ad_port;if (ad_port->aggregator)return sprintf (buf,"%u\n" , ad_port->partner_oper.port_state);
include/net/bond_3ad.h +7 -7
@@ -157,7 +157,7 @@ typedef struct bond_marker_header {struct slave ;struct bonding ;struct ad_info ; -struct port ; +struct ad_port ;#ifdef __ia64__#pragma pack(8)
@@ -188,7 +188,7 @@ typedef struct aggregator {u16 partner_oper_aggregator_key;u16 receive_state;/* BOOLEAN */ u16 transmit_state;/* BOOLEAN */ -struct port *lag_ports; +struct ad_port *lag_ports;/* ****** PRIVATE PARAMETERS ****** */ struct slave *slave;/* pointer to the bond slave that this aggregator belongs to */ u16 is_active;/* BOOLEAN. Indicates if this aggregator is active */
@@ -204,8 +204,8 @@ struct port_params {u16 port_state; }; -/* port structure(43.4.6 in the 802.3ad standard) */ -typedef struct port { +/* ad_port structure(43.4.6 in the 802.3ad standard) */ +typedef struct ad_port { u16 actor_port_number; u16 actor_port_priority; struct mac_addr actor_system; /* This parameter is added here although it is not specified in the standard, just for simplification */
@@ -240,10 +240,10 @@ typedef struct port {churn_state_t sm_churn_partner_state;struct slave *slave;/* pointer to the bond slave that this port belongs to */ struct aggregator *aggregator;/* pointer to an aggregator that this port related to */ -struct port *next_port_in_aggregator;/* Next port on the linked list of the parent aggregator */ +struct ad_port *next_port_in_aggregator;/* Next port on the linked list of the parent aggregator */ u32 transaction_id;/* continuous number for identification of Marker PDU's; */ struct lacpdu lacpdu;/* the lacpdu that will be sent for this port */ -} port_t; +} ad_port_t;/* system structure */ struct ad_system {
@@ -268,7 +268,7 @@ struct ad_bond_info {struct ad_slave_info {struct aggregator aggregator;/* 802.3ad aggregator structure */ -struct port port;/* 802.3ad port structure */ +struct ad_port ad_port;/* 802.3ad port structure */ struct bond_3ad_stats stats;u16 id; };
Signature · 1 line
2.28.0
PATCH v4 2/5 bonding: replace use of the term master where possible
In reply to Jarod WilsonSimply refer to what was the bonding "master" as the "bond" or bonding device, depending on context. However, do retain compat code for the bonding_masters sysfs interface to avoid breaking userspace.
--- drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/core/lag.c | 2 +- drivers/infiniband/core/roce_gid_mgmt.c | 6 +- drivers/net/bonding/bond_3ad.c | 2 +- drivers/net/bonding/bond_main.c | 58 +++++++++---------- drivers/net/bonding/bond_procfs.c | 4 +- drivers/net/bonding/bond_sysfs.c | 8 +-- .../net/ethernet/mellanox/mlx4/en_netdev.c | 10 ++-- .../ethernet/netronome/nfp/flower/lag_conf.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 8 +-- include/linux/netdevice.h | 8 +-- include/net/bonding.h | 4 +- 12 files changed, 58 insertions(+), 56 deletions(-)
drivers/infiniband/core/cma.c +1 -1
@@ -4753,7 +4753,7 @@ static int cma_netdev_callback(struct notifier_block *self, unsigned long event,if (event !=NETDEV_BONDING_FAILOVER )return NOTIFY_DONE ; -if (!netif_is_bond_master (ndev)) +if (!netif_is_bond_dev (ndev))return NOTIFY_DONE ;mutex_lock (&lock);
drivers/infiniband/core/lag.c +1 -1
@@ -128,7 +128,7 @@ struct net_device *rdma_lag_get_ah_roce_slave(struct ib_device *device,dev_hold (master);rcu_read_unlock (); -if (!netif_is_bond_master (master)) +if (!netif_is_bond_dev (master)) goto put; slave =rdma_get_xmit_slave_udp (device, master, ah_attr, flags);
drivers/infiniband/core/roce_gid_mgmt.c +3 -3
@@ -129,7 +129,7 @@ enum bonding_slave_state {static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu (struct net_device *dev,struct net_device *upper) { -if (upper &&netif_is_bond_master (upper)) { +if (upper &&netif_is_bond_dev (upper)) {struct net_device *pdev =bond_option_active_slave_get_rcu (netdev_priv (upper));
@@ -216,7 +216,7 @@ is_ndev_for_default_gid_filter(struct ib_device *ib_dev, u8 port,* make sure that it the upper netdevice of rdma netdevice. */ res = ((cookie_ndev == rdma_ndev && !netif_is_bond_slave (rdma_ndev)) || - (netif_is_bond_master (cookie_ndev) && + (netif_is_bond_dev (cookie_ndev) &&rdma_is_upper_dev_rcu (rdma_ndev, cookie_ndev)));rcu_read_unlock ();
@@ -271,7 +271,7 @@ is_upper_ndev_bond_master_filter(struct ib_device *ib_dev, u8 port,return false;rcu_read_lock (); -if (netif_is_bond_master (cookie_ndev) && +if (netif_is_bond_dev (cookie_ndev) &&rdma_is_upper_dev_rcu (rdma_ndev, cookie_ndev)) match = true;rcu_read_unlock ();
drivers/net/bonding/bond_3ad.c +1 -1
@@ -2550,7 +2550,7 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) }/** -* bond_3ad_set_carrier - set link state for bonding master +* bond_3ad_set_carrier - set link state for bonding device * @bond: bonding structure * * if we have an active aggregator, we're up, if not, we're down.
drivers/net/bonding/bond_main.c +29 -29
200 lines not on this page · raw message
drivers/net/bonding/bond_procfs.c +2 -2
@@ -54,7 +54,7 @@ static void bond_info_seq_stop(struct seq_file *seq, void *v)rcu_read_unlock (); } -static void bond_info_show_master (struct seq_file *seq) +static void bond_info_show_bond_dev (struct seq_file *seq) {struct bonding *bond =PDE_DATA (file_inode (seq->file));const struct bond_opt_value *optval;
@@ -245,7 +245,7 @@ static int bond_info_seq_show(struct seq_file *seq, void *v) {if (v ==SEQ_START_TOKEN ) {seq_printf (seq,"%s\n" , bond_version); -bond_info_show_master (seq); +bond_info_show_bond_dev (seq); }else bond_info_show_slave (seq, v);
drivers/net/bonding/bond_sysfs.c +4 -4
@@ -28,7 +28,7 @@#define to_bond (cd) ((struct bonding *)(netdev_priv(to_net_dev(cd)))) -/* "show" function for the bond_masters attribute. +/* "show" function for the bonding_masters attribute. * The class parameter is ignored. */ static ssize_t bonding_show_bonds(struct class *cls,
@@ -70,7 +70,7 @@ static struct net_device *bond_get_by_name(struct bond_net *bn, const char *ifnareturn NULL ; } -/* "store" function for the bond_masters attribute. This is what +/* "store" function for the bonding_masters attribute. This is what * creates and deletes entire bonds. * * The class parameter is ignored.
@@ -127,7 +127,7 @@ static ssize_t bonding_store_bonds(struct class *cls,return -EPERM ; } -/* class attribute for bond_masters file. This ends up in /sys/class/net */ +/* class attribute for bonding_masters file. This ends up in /sys/class/net */ static const struct class_attribute class_attr_bonding_masters = { .attr = { .name ="bonding_masters" ,
@@ -788,7 +788,7 @@ int bond_create_sysfs(struct bond_net *bn)* configure multiple bonding devices. */ if (ret == -EEXIST ) { -/* Is someone being kinky and naming a device bonding_master? */ +/* Is someone naming a device bonding_masters? */ if (__dev_get_by_name (bn->net, class_attr_bonding_masters.attr.name)) pr_err("network device named %s already exists in sysfs\n",
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +5 -5
@@ -2982,18 +2982,18 @@ int mlx4_en_netdev_event(struct notifier_block *this, ¬ifier_info->bonding_info;/* required mode 1, 2 or 4 */ -if ((bonding_info->master.bond_mode !=BOND_MODE_ACTIVEBACKUP ) && - (bonding_info->master.bond_mode !=BOND_MODE_XOR ) && - (bonding_info->master.bond_mode !=BOND_MODE_8023AD )) +if ((bonding_info->bond.bond_mode !=BOND_MODE_ACTIVEBACKUP ) && + (bonding_info->bond.bond_mode !=BOND_MODE_XOR ) && + (bonding_info->bond.bond_mode !=BOND_MODE_8023AD )) do_bond = false;/* require exactly 2 slaves */ -if (bonding_info->master.num_slaves !=2 ) +if (bonding_info->bond.num_slaves !=2 ) do_bond = false;/* calc v2p */ if (do_bond) { -if (bonding_info->master.bond_mode == +if (bonding_info->bond.bond_mode ==BOND_MODE_ACTIVEBACKUP ) {/* in active-backup mode virtual ports are * mapped to the physical port of the active
drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +1 -1
@@ -483,7 +483,7 @@ nfp_fl_lag_schedule_group_delete(struct nfp_fl_lag *lag, priv = container_of(lag, struct nfp_flower_priv, nfp_lag); -if (!netif_is_bond_master (master)) +if (!netif_is_bond_dev (master))return ;mutex_lock (&lag->lock);
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +4 -4
@@ -3216,7 +3216,7 @@ netxen_list_config_ip(struct netxen_adapter *adapter, goto out;if (is_vlan_dev (dev)) dev =vlan_dev_real_dev (dev); - cur->master = !!netif_is_bond_master (dev); + cur->master = !!netif_is_bond_dev (dev); cur->ip_addr = ifa->ifa_address;list_add_tail (&cur->list, &adapter->ip_list);netxen_config_ipaddr (adapter, ifa->ifa_address,NX_IP_UP );
@@ -3322,7 +3322,7 @@ static void netxen_config_master(struct net_device *dev, unsigned long event)* Now we should program the bond's (and its vlans') * addresses in the netxen NIC. */ -if (master &&netif_is_bond_master (master) && +if (master &&netif_is_bond_dev (master) && !netif_is_bond_slave (dev)) {netxen_config_indev_addr (adapter, master, event);for_each_netdev_rcu (&init_net, slave)
@@ -3358,7 +3358,7 @@ static int netxen_netdev_event(struct notifier_block *this, }if (event ==NETDEV_UP || event ==NETDEV_DOWN ) {/* If this is a bonding device, look for netxen-based slaves*/ -if (netif_is_bond_master (dev)) { +if (netif_is_bond_dev (dev)) {rcu_read_lock ();for_each_netdev_in_bond_rcu (dev, slave) {if (!netxen_config_checkdev (slave))
@@ -3403,7 +3403,7 @@ netxen_inetaddr_event(struct notifier_block *this, }if (event ==NETDEV_UP || event ==NETDEV_DOWN ) {/* If this is a bonding device, look for netxen-based slaves*/ -if (netif_is_bond_master (dev)) { +if (netif_is_bond_dev (dev)) {rcu_read_lock ();for_each_netdev_in_bond_rcu (dev, slave) {if (!netxen_config_checkdev (slave))
include/linux/netdevice.h +4 -4
@@ -1501,7 +1501,7 @@ struct net_device_ops {* * @IFF_802_1Q_VLAN: 802.1Q VLAN device * @IFF_EBRIDGE: Ethernet bridging device -* @IFF_BONDING: bonding master or slave +* @IFF_BONDING: bonding netdev or slave * @IFF_ISATAP: ISATAP interface (RFC4214) * @IFF_WAN_HDLC: WAN HDLC device * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
@@ -4668,7 +4668,7 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,struct netdev_bonding_info {ifslave slave; -ifbond master; +ifbond bond; };struct netdev_notifier_bonding_info {
@@ -4892,7 +4892,7 @@ static inline bool netif_is_macvlan_port(const struct net_device *dev)return dev->priv_flags &IFF_MACVLAN_PORT ; } -static inline bool netif_is_bond_master (const struct net_device *dev) +static inline bool netif_is_bond_dev (const struct net_device *dev) {return dev->flags &IFF_MASTER && dev->priv_flags &IFF_BONDING ; }
@@ -4959,7 +4959,7 @@ static inline bool netif_is_team_port(const struct net_device *dev)static inline bool netif_is_lag_master (const struct net_device *dev) { -return netif_is_bond_master (dev) ||netif_is_team_master (dev); +return netif_is_bond_dev (dev) ||netif_is_team_master (dev); }static inline bool netif_is_lag_port (const struct net_device *dev)
include/net/bonding.h +3 -1
@@ -156,7 +156,7 @@ struct bond_parm_tbl {struct slave {struct net_device *dev;/* first - useful for panic debug */ -struct bonding *bond;/* our master */ +struct bonding *bond;/* our bond link aggregator */ int delay;/* all three in jiffies */ unsigned long last_link_up;
@@ -613,7 +613,9 @@ struct bond_net {#ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_dir;#endif +/* _masters is a legacy interface identical to _devs */ struct class_attribute class_attr_bonding_masters; +struct class_attribute class_attr_bonding_devs; };int bond_arp_rcv (const struct sk_buff *skb,struct bonding *bond,struct slave *slave);
Signature · 1 line
2.28.0
Re: [PATCH 2/5] bonding: replace use of the term master where possible
Quoted 113 lines · Jarod Wilson
Simply refer to what was the bonding "master" as the "bond" or bonding device, depending on context. However, do retain compat code for the
bonding_masterssysfs interface to avoid breaking userspace.Cc Jay Vosburgh <[email protected]>Cc Veaceslav Falico <[email protected]>Cc Andy Gospodarek <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Thomas Davis <[email protected]>Signed-off-by Jarod Wilson <[email protected]>---
drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/core/lag.c | 2 +- drivers/infiniband/core/roce_gid_mgmt.c | 6 +- drivers/net/bonding/bond_3ad.c | 2 +- drivers/net/bonding/bond_main.c | 58 +++++++++---------- drivers/net/bonding/bond_procfs.c | 4 +- drivers/net/bonding/bond_sysfs.c | 8 +-- .../net/ethernet/mellanox/mlx4/en_netdev.c | 10 ++-- .../ethernet/netronome/nfp/flower/lag_conf.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 8 +-- include/linux/netdevice.h | 8 +-- include/net/bonding.h | 4 +- 12 files changed, 58 insertions(+), 56 deletions(-)drivers/infiniband/core/cma.c +1
-1@@ -4753,7 +4753,7 @@ static int cma_netdev_callback(struct notifier_block *self, unsigned long event,if (event !=NETDEV_BONDING_FAILOVER )return NOTIFY_DONE ; -if (!netif_is_bond_master (ndev)) +if (!netif_is_bond_dev (ndev))return NOTIFY_DONE ;mutex_lock (&lock);drivers/infiniband/core/lag.c +1
-1@@ -128,7 +128,7 @@ struct net_device *rdma_lag_get_ah_roce_slave(struct ib_device *device,dev_hold (master);rcu_read_unlock (); -if (!netif_is_bond_master (master)) +if (!netif_is_bond_dev (master)) goto put; slave =rdma_get_xmit_slave_udp (device, master, ah_attr, flags);drivers/infiniband/core/roce_gid_mgmt.c +3
-3@@ -129,7 +129,7 @@ enum bonding_slave_state {static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu (struct net_device *dev,struct net_device *upper) { -if (upper &&netif_is_bond_master (upper)) { +if (upper &&netif_is_bond_dev (upper)) {struct net_device *pdev =bond_option_active_slave_get_rcu (netdev_priv (upper));@@ -216,7 +216,7 @@ is_ndev_for_default_gid_filter(struct ib_device *ib_dev, u8 port,* make sure that it the upper netdevice of rdma netdevice. */ res = ((cookie_ndev == rdma_ndev && !netif_is_bond_slave (rdma_ndev)) || - (netif_is_bond_master (cookie_ndev) && + (netif_is_bond_dev (cookie_ndev) &&rdma_is_upper_dev_rcu (rdma_ndev, cookie_ndev)));rcu_read_unlock ();@@ -271,7 +271,7 @@ is_upper_ndev_bond_master_filter(struct ib_device *ib_dev, u8 port,return false;rcu_read_lock (); -if (netif_is_bond_master (cookie_ndev) && +if (netif_is_bond_dev (cookie_ndev) &&rdma_is_upper_dev_rcu (rdma_ndev, cookie_ndev)) match = true;rcu_read_unlock ();drivers/net/bonding/bond_3ad.c +1
-1@@ -2550,7 +2550,7 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) }/** -* bond_3ad_set_carrier - set link state for bonding master +* bond_3ad_set_carrier - set link state for bonding device * @bond: bonding structure * * if we have an active aggregator, we're up, if not, we're down. drivers/net/bonding/bond_main.c +2
-2@@ -469,8 +469,8 @@ static const struct xfrmdev_ops bond_xfrmdev_ops = {/*------------------------------- Link status -------------------------------*/ -/* Set the carrier state for the master according to the state of its -* slaves. If any slaves are up, the master is up. In 802.3ad mode, +/* Set the carrier state for the bond according to the state of its +* slaves. If any slaves are up, the bond is up. In 802.3ad mode, * do special 802.3ad magic. * * Returns zero if carrier state does not change, nonzero if it does.
drivers/net/bonding/bond_main.c static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) · line 1378
Quoted 8 lines
drivers/net/bonding/bond_main.c +1
-1@@ -1372,7 +1372,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)* inactive slave links without being forced to bind to them * explicitly. * -* At the same time, packets that are passed to the bonding master +* At the same time, packets that are passed to the bonding bond * (including link-local ones) can have their originating interface * determined via PACKET_ORIGDEV socket option. */
The text "bonding bond" seems a bit awkward, and could be simply
"bond."
Quoted 180 lines
drivers/net/bonding/bond_main.c +11
-11@@ -1439,8 +1439,8 @@ static enum netdev_lag_hash bond_lag_hash_type(struct bonding *bond, } } -static int bond_master_upper_dev_link (struct bonding *bond,struct slave *slave, -struct netlink_ext_ack *extack) +static int bond_upper_dev_link (struct bonding *bond,struct slave *slave, +struct netlink_ext_ack *extack) {struct netdev_lag_upper_info lag_upper_info;enum netdev_lag_tx_type type;@@ -1515,7 +1515,7 @@ static void bond_netdev_notify_work(struct work_struct *_work)struct netdev_bonding_info binfo;bond_fill_ifslave (slave, &binfo.slave); -bond_fill_ifbond (slave->bond, &binfo.master); +bond_fill_ifbond (slave->bond, &binfo.bond);netdev_bonding_info_change (slave->dev, &binfo);rtnl_unlock (); }else {@@ -1538,7 +1538,7 @@ void bond_lower_state_changed(struct slave *slave)netdev_lower_state_changed (slave->dev, &info); } -/* enslave device <slave> to bond device <master> */ +/* enslave device <slave> to bond device <bond> */ int bond_enslave (struct net_device *bond_dev,struct net_device *slave_dev,struct netlink_ext_ack *extack) {@@ -1667,7 +1667,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,call_netdevice_notifiers (NETDEV_JOIN , slave_dev); -/* If this is the first slave, then we need to set the master's hardware +/* If this is the first slave, then we need to set the bond's hardware * address to be the same as the slave's. */ if (!bond_has_slaves(bond) &&@@ -1700,15 +1700,15 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,/* Save slave's original ("permanent") mac address for modes * that need it, and for restoring it upon release, and then -* set it to the master's address +* set it to the bond's address */ bond_hw_addr_copy (new_slave->perm_hwaddr, slave_dev->dev_addr, slave_dev->addr_len);if (!bond->params.fail_over_mac ||BOND_MODE (bond) !=BOND_MODE_ACTIVEBACKUP ) { -/* Set slave to master's mac address. The application already -* set the master's mac address to that of the first slave +/* Set slave to bond's mac address. The application already +* set the bond's mac address to that of the first slave */ memcpy (ss.__data, bond_dev->dev_addr, bond_dev->addr_len); ss.ss_family = slave_dev->type;@@ -1874,7 +1874,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,#ifdef CONFIG_NET_POLL_CONTROLLER if (bond->dev->npinfo) {if (slave_enable_netpoll (new_slave)) { -slave_info (bond_dev, slave_dev,"master_dev is using netpoll, but new slave device does not support netpoll\n" ); +slave_info (bond_dev, slave_dev,"bond_dev is using netpoll, but new slave device does not support netpoll\n" ); res = -EBUSY ; goto err_detach; }@@ -1891,9 +1891,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, goto err_detach; } - res =bond_master_upper_dev_link (bond, new_slave, extack); + res =bond_upper_dev_link (bond, new_slave, extack);if (res) { -slave_dbg (bond_dev, slave_dev,"Error %d calling bond_master_upper_dev_link\n" , res); +slave_dbg (bond_dev, slave_dev,"Error %d calling bond_upper_dev_link\n" , res); goto err_unregister; }@@ -1984,7 +1984,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,slave_disable_netpoll (new_slave);
err_close:drivers/net/bonding/bond_main.c +1
-1-if (!netif_is_bond_master (slave_dev)) +if (!netif_is_bond_dev (slave_dev))slave_dev->priv_flags &= ~IFF_BONDING; dev_close(slave_dev);drivers/net/bonding/bond_main.c +1
-1@@ -1992,7 +1992,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, slave_dev->flags &= ~IFF_SLAVE ;if (!bond->params.fail_over_mac ||BOND_MODE (bond) !=BOND_MODE_ACTIVEBACKUP ) { -/* XXX TODO - fom follow mode needs to change master's +/* XXX TODO - fom follow mode needs to change bond's * MAC if this slave's MAC is in use by the bond, or at * least print a warning. */ @@ -2009,7 +2009,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,bond_free_slave (new_slave);
err_undo_flags:drivers/net/bonding/bond_main.c +1
-1-/* Enslave of first slave has failed and we need to fix master's mac */ +/* Enslave of first slave has failed and we need to fix bond's mac */ if (!bond_has_slaves(bond)) { if (ether_addr_equal_64bits(bond_dev->dev_addr, slave_dev->dev_addr))drivers/net/bonding/bond_main.c +9
-9@@ -2025,7 +2025,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,return res; } -/* Try to release the slave device <slave> from the bond device <master> +/* Try to release the slave device <slave> from the bond device <bond> * It is legal to access curr_active_slave without a lock because all the function * is RTNL-locked. If "all" is true it means that the function is being called * while destroying a bond interface and all slaves are being released. @@ -2046,7 +2046,7 @@ static int __bond_release_one(struct net_device *bond_dev,int old_flags = bond_dev->flags;netdev_features_t old_features = bond_dev->features; -/* slave is not a slave or master is not master of this slave */ +/* slave is not a slave or bond is not bond of this slave */ if (!(slave_dev->flags &IFF_SLAVE ) || !netdev_has_upper_dev (slave_dev, bond_dev)) {slave_dbg (bond_dev, slave_dev,"cannot release slave\n" );@@ -2183,7 +2183,7 @@ static int __bond_release_one(struct net_device *bond_dev,else dev_set_mtu (slave_dev, slave->original_mtu); -if (!netif_is_bond_master (slave_dev)) +if (!netif_is_bond_dev (slave_dev)) slave_dev->priv_flags &= ~IFF_BONDING ;bond_free_slave (slave);@@ -3255,8 +3255,8 @@ static int bond_event_changename(struct bonding *bond)return NOTIFY_DONE ; } -static int bond_master_netdev_event (unsigned long event, -struct net_device *bond_dev) +static int bond_dev_netdev_event (unsigned long event, +struct net_device *bond_dev) {struct bonding *event_bond =netdev_priv (bond_dev);@@ -3379,7 +3379,7 @@ static int bond_slave_netdev_event(unsigned long event,bond_compute_features (bond);break ;case NETDEV_RESEND_IGMP : -/* Propagate to master device */ +/* Propagate to bond device */ call_netdevice_notifiers (event, slave->bond->dev);break ;default :@@ -3410,7 +3410,7 @@ static int bond_netdev_event(struct notifier_block *this,if (event_dev->flags &IFF_MASTER ) {int ret; - ret =bond_master_netdev_event (event, event_dev); + ret =bond_dev_netdev_event (event, event_dev);if (ret !=NOTIFY_DONE )return ret; }@@ -3923,7 +3923,7 @@ static int bond_neigh_init(struct neighbour *n)* slave exists. So we must declare proxy setup function which will * be used at run time to resolve the actual slave neigh param setup. * -* It's also called by master devices (such as vlans) to setup their +* It's also called by upper-level devices (such as vlans) to setup their * underlying devices. In that case - do nothing, we're already set up from * our init. */ @@ -3937,7 +3937,7 @@ static int bond_neigh_setup(struct net_device *dev,return 0 ; } -/* Change the MTU of all of a master's slaves to match the master */ +/* Change the MTU of all of a bond's slaves to match the bond */ static int bond_change_mtu (struct net_device *bond_dev,int new_mtu) {struct bonding *bond =netdev_priv (bond_dev);
drivers/net/bonding/bond_main.c static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) · line 3998
Quoted 8 lines
drivers/net/bonding/bond_main.c +1
-1@@ -3992,7 +3992,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)/* Change HW address * * Note that many devices must be down to change the HW address, and -* downing the master releases all slaves. We can make bonds full of +* downing the bond releases all slaves. We can make bonds full of * bonding devices to test this, however. */ static int bond_set_mac_address (struct net_device *bond_dev,void *addr)
Terminology change aside, this comment is no longer factually
correct; setting the bond down has not released all slaves for quite a while.
Quoted 202 lines
drivers/net/bonding/bond_main.c +2
-2@@ -4480,11 +4480,11 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb,return txq; } -static struct net_device *bond_xmit_get_slave (struct net_device *master_dev, +static struct net_device *bond_xmit_get_slave (struct net_device *bond_dev,struct sk_buff *skb,bool all_slaves) { -struct bonding *bond =netdev_priv (master_dev); +struct bonding *bond =netdev_priv (bond_dev);struct bond_up_slave *slaves;struct slave *slave =NULL ;drivers/net/bonding/bond_procfs.c +2
-2@@ -54,7 +54,7 @@ static void bond_info_seq_stop(struct seq_file *seq, void *v)rcu_read_unlock (); } -static void bond_info_show_master (struct seq_file *seq) +static void bond_info_show_bond_dev (struct seq_file *seq) {struct bonding *bond =PDE_DATA (file_inode (seq->file));const struct bond_opt_value *optval;@@ -245,7 +245,7 @@ static int bond_info_seq_show(struct seq_file *seq, void *v) {if (v ==SEQ_START_TOKEN ) {seq_printf (seq,"%s\n" , bond_version); -bond_info_show_master (seq); +bond_info_show_bond_dev (seq); }else bond_info_show_slave (seq, v);drivers/net/bonding/bond_sysfs.c +4
-4@@ -28,7 +28,7 @@#define to_bond (cd) ((struct bonding *)(netdev_priv(to_net_dev(cd)))) -/* "show" function for the bond_masters attribute. +/* "show" function for the bonding_masters attribute. * The class parameter is ignored. */ static ssize_t bonding_show_bonds(struct class *cls,@@ -70,7 +70,7 @@ static struct net_device *bond_get_by_name(struct bond_net *bn, const char *ifnareturn NULL ; } -/* "store" function for the bond_masters attribute. This is what +/* "store" function for the bonding_masters attribute. This is what * creates and deletes entire bonds. * * The class parameter is ignored. @@ -127,7 +127,7 @@ static ssize_t bonding_store_bonds(struct class *cls,return -EPERM ; } -/* class attribute for bond_masters file. This ends up in /sys/class/net */ +/* class attribute for bonding_masters file. This ends up in /sys/class/net */ static const struct class_attribute class_attr_bonding_masters = { .attr = { .name ="bonding_masters" ,@@ -788,7 +788,7 @@ int bond_create_sysfs(struct bond_net *bn)* configure multiple bonding devices. */ if (ret == -EEXIST ) { -/* Is someone being kinky and naming a device bonding_master? */ +/* Is someone naming a device bonding_masters? */ if (__dev_get_by_name (bn->net, class_attr_bonding_masters.attr.name)) pr_err("network device named %s already exists in sysfs\n",drivers/net/ethernet/mellanox/mlx4/en_netdev.c +5
-5@@ -2982,18 +2982,18 @@ int mlx4_en_netdev_event(struct notifier_block *this, ¬ifier_info->bonding_info;/* required mode 1, 2 or 4 */ -if ((bonding_info->master.bond_mode !=BOND_MODE_ACTIVEBACKUP ) && - (bonding_info->master.bond_mode !=BOND_MODE_XOR ) && - (bonding_info->master.bond_mode !=BOND_MODE_8023AD )) +if ((bonding_info->bond.bond_mode !=BOND_MODE_ACTIVEBACKUP ) && + (bonding_info->bond.bond_mode !=BOND_MODE_XOR ) && + (bonding_info->bond.bond_mode !=BOND_MODE_8023AD )) do_bond = false;/* require exactly 2 slaves */ -if (bonding_info->master.num_slaves !=2 ) +if (bonding_info->bond.num_slaves !=2 ) do_bond = false;/* calc v2p */ if (do_bond) { -if (bonding_info->master.bond_mode == +if (bonding_info->bond.bond_mode ==BOND_MODE_ACTIVEBACKUP ) {/* in active-backup mode virtual ports are * mapped to the physical port of the active drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +1
-1@@ -483,7 +483,7 @@ nfp_fl_lag_schedule_group_delete(struct nfp_fl_lag *lag, priv = container_of(lag, struct nfp_flower_priv, nfp_lag); -if (!netif_is_bond_master (master)) +if (!netif_is_bond_dev (master))return ;mutex_lock (&lag->lock);drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +4
-4@@ -3216,7 +3216,7 @@ netxen_list_config_ip(struct netxen_adapter *adapter, goto out;if (is_vlan_dev (dev)) dev =vlan_dev_real_dev (dev); - cur->master = !!netif_is_bond_master (dev); + cur->master = !!netif_is_bond_dev (dev); cur->ip_addr = ifa->ifa_address;list_add_tail (&cur->list, &adapter->ip_list);netxen_config_ipaddr (adapter, ifa->ifa_address,NX_IP_UP );@@ -3322,7 +3322,7 @@ static void netxen_config_master(struct net_device *dev, unsigned long event)* Now we should program the bond's (and its vlans') * addresses in the netxen NIC. */ -if (master &&netif_is_bond_master (master) && +if (master &&netif_is_bond_dev (master) && !netif_is_bond_slave (dev)) {netxen_config_indev_addr (adapter, master, event);for_each_netdev_rcu (&init_net, slave)@@ -3358,7 +3358,7 @@ static int netxen_netdev_event(struct notifier_block *this, }if (event ==NETDEV_UP || event ==NETDEV_DOWN ) {/* If this is a bonding device, look for netxen-based slaves*/ -if (netif_is_bond_master (dev)) { +if (netif_is_bond_dev (dev)) {rcu_read_lock ();for_each_netdev_in_bond_rcu (dev, slave) {if (!netxen_config_checkdev (slave))@@ -3403,7 +3403,7 @@ netxen_inetaddr_event(struct notifier_block *this, }if (event ==NETDEV_UP || event ==NETDEV_DOWN ) {/* If this is a bonding device, look for netxen-based slaves*/ -if (netif_is_bond_master (dev)) { +if (netif_is_bond_dev (dev)) {rcu_read_lock ();for_each_netdev_in_bond_rcu (dev, slave) {if (!netxen_config_checkdev (slave))include/linux/netdevice.h +4
-4@@ -1501,7 +1501,7 @@ struct net_device_ops {* * @IFF_802_1Q_VLAN: 802.1Q VLAN device * @IFF_EBRIDGE: Ethernet bridging device -* @IFF_BONDING: bonding master or slave +* @IFF_BONDING: bonding netdev or slave * @IFF_ISATAP: ISATAP interface (RFC4214) * @IFF_WAN_HDLC: WAN HDLC device * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to @@ -4668,7 +4668,7 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,struct netdev_bonding_info {ifslave slave; -ifbond master; +ifbond bond; };struct netdev_notifier_bonding_info {@@ -4892,7 +4892,7 @@ static inline bool netif_is_macvlan_port(const struct net_device *dev)return dev->priv_flags &IFF_MACVLAN_PORT ; } -static inline bool netif_is_bond_master (const struct net_device *dev) +static inline bool netif_is_bond_dev (const struct net_device *dev) {return dev->flags &IFF_MASTER && dev->priv_flags &IFF_BONDING ; }@@ -4959,7 +4959,7 @@ static inline bool netif_is_team_port(const struct net_device *dev)static inline bool netif_is_lag_master (const struct net_device *dev) { -return netif_is_bond_master (dev) ||netif_is_team_master (dev); +return netif_is_bond_dev (dev) ||netif_is_team_master (dev); }static inline bool netif_is_lag_port (const struct net_device *dev)include/net/bonding.h +0
-0
include/net/bonding.h struct bond_parm_tbl { · line 159
Quoted 5 lines
include/net/bonding.h +1
-1@@ -156,7 +156,7 @@ struct bond_parm_tbl {struct slave {struct net_device *dev;/* first - useful for panic debug */ -struct bonding *bond;/* our master */ +struct bonding *bond;/* our bond link aggregator */
Perhaps "bond we are a port of"? The term "aggregator" implies
LACP in my mind.
include/net/bonding.h struct bond_net { · line 618
Quoted 10 lines
include/net/bonding.h +2
-0int delay;/* all three in jiffies */ unsigned long last_link_up;@@ -613,7 +613,9 @@ struct bond_net {#ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_dir;#endif +/* _masters is a legacy interface identical to _devs */ struct class_attribute class_attr_bonding_masters; +struct class_attribute class_attr_bonding_devs;
Is class_attr_bonding_devs used anywhere? Is this perhaps left
over from a prior version of the patch set?
-J
Quoted 6 lines
include/net/bonding.h +0
-0};int bond_arp_rcv (const struct sk_buff *skb,struct bonding *bond,struct slave *slave);Signature · 1 line
2.28.0
---
-Jay Vosburgh, [email protected]
PATCH v4 3/5 bonding: rename slave to port where possible
In reply to Jarod WilsonUse "port" to denote individual component interfaces in a bond, rather than "slave". This is more consistent with the team and bridge drivers, and eliminates the use of a good amount of problematic language in the bonding driver.
Legacy sysfs, procfs and module parameter bits that use slave in their names are retained for the purposes of not breaking anyone's userspace.
v3: simply omit interfaces with new names, sysfs and procfs should already be deprecated in favor of netlink/iproute2.
--- .clang-format | 4 +- drivers/infiniband/core/roce_gid_mgmt.c | 4 +- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/net/bonding/bond_3ad.c | 598 ++--- drivers/net/bonding/bond_alb.c | 689 ++--- drivers/net/bonding/bond_debugfs.c | 2 +- drivers/net/bonding/bond_main.c | 2321 +++++++++-------- drivers/net/bonding/bond_netlink.c | 112 +- drivers/net/bonding/bond_options.c | 258 +- drivers/net/bonding/bond_procfs.c | 48 +- drivers/net/bonding/bond_sysfs.c | 70 +- drivers/net/bonding/bond_sysfs_slave.c | 159 +- .../ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 +- .../net/ethernet/mellanox/mlx4/en_netdev.c | 4 +- .../ethernet/mellanox/mlx5/core/en/rep/bond.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 4 +- include/linux/netdevice.h | 16 +- include/net/bond_3ad.h | 30 +- include/net/bond_alb.h | 74 +- include/net/bond_options.h | 18 +- include/net/bonding.h | 358 +-- include/net/lag.h | 2 +- 23 files changed, 2420 insertions(+), 2361 deletions(-)
.clang-format +2 -2
@@ -92,8 +92,8 @@ ForEachMacros: - 'blkg_for_each_descendant_post' - 'blkg_for_each_descendant_pre' - 'blk_queue_for_each_rl' - - 'bond_for_each_slave' - - 'bond_for_each_slave_rcu' + - 'bond_for_each_port' + - 'bond_for_each_port_rcu' - 'bpf_for_each_spilled_reg' - 'btree_for_each_safe128' - 'btree_for_each_safe32'
drivers/infiniband/core/roce_gid_mgmt.c +2 -2
@@ -131,7 +131,7 @@ static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu(struct net_de {if (upper &&netif_is_bond_dev (upper)) {struct net_device *pdev = -bond_option_active_slave_get_rcu (netdev_priv (upper)); +bond_option_active_port_get_rcu (netdev_priv (upper));if (pdev) return dev == pdev ? BONDING_SLAVE_STATE_ACTIVE :
@@ -215,7 +215,7 @@ is_ndev_for_default_gid_filter(struct ib_device *ib_dev, u8 port,* Additionally when event(cookie) netdevice is bond master device, * make sure that it the upper netdevice of rdma netdevice. */ - res = ((cookie_ndev == rdma_ndev && !netif_is_bond_slave (rdma_ndev)) || + res = ((cookie_ndev == rdma_ndev && !netif_is_bond_port (rdma_ndev)) || (netif_is_bond_dev (cookie_ndev) &&rdma_is_upper_dev_rcu (rdma_ndev, cookie_ndev)));
drivers/infiniband/hw/mlx4/main.c +1 -1
@@ -145,7 +145,7 @@ static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_nif (upper) {struct net_device *active; - active =bond_option_active_slave_get_rcu (netdev_priv (upper)); + active =bond_option_active_port_get_rcu (netdev_priv (upper));if (active) dev = active; }
drivers/net/bonding/bond_3ad.c +299 -299
1,339 lines not on this page · raw message
drivers/net/bonding/bond_alb.c +345 -344
1,456 lines not on this page · raw message
drivers/net/bonding/bond_debugfs.c +1 -1
@@ -38,7 +38,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) &client_info->ip_src, &client_info->ip_dst, &client_info->mac_dst, - client_info->slave->dev->name); + client_info->port->dev->name); }spin_unlock_bh (&bond->mode_lock);
drivers/net/bonding/bond_main.c +1165 -1156
163 lines not on this page · raw message
drivers/net/bonding/bond_netlink.c +56 -56
112 lines not on this page · raw message
drivers/net/bonding/bond_options.c +145 -113
258 lines not on this page · raw message
drivers/net/bonding/bond_procfs.c +24 -24
48 lines not on this page · raw message
drivers/net/bonding/bond_sysfs.c +35 -35
70 lines not on this page · raw message
drivers/net/bonding/bond_sysfs_slave.c +84 -75
159 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +2 -2
Lines of this file are not shown. View the raw message.
include/net/bond_alb.h +38 -36
74 lines not on this page · raw message
include/net/bonding.h +179 -179
358 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.28.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH 3/5] bonding: rename slave to port where possible
Quoted 87 lines · Jarod Wilson
Use "port" to denote individual component interfaces in a bond, rather than "slave". This is more consistent with the team and bridge drivers, and eliminates the use of a good amount of problematic language in the bonding driver.
Legacy sysfs, procfs and module parameter bits that use slave in their names are retained for the purposes of not breaking anyone's userspace.
v3: simply omit interfaces with new names, sysfs and procfs should already be deprecated in favor of netlink/iproute2.
Cc Jay Vosburgh <[email protected]>Cc Veaceslav Falico <[email protected]>Cc Andy Gospodarek <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Thomas Davis <[email protected]>Signed-off-by Jarod Wilson <[email protected]>---
.clang-format | 4 +- drivers/infiniband/core/roce_gid_mgmt.c | 4 +- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/net/bonding/bond_3ad.c | 598 ++--- drivers/net/bonding/bond_alb.c | 689 ++--- drivers/net/bonding/bond_debugfs.c | 2 +- drivers/net/bonding/bond_main.c | 2321 +++++++++-------- drivers/net/bonding/bond_netlink.c | 112 +- drivers/net/bonding/bond_options.c | 258 +- drivers/net/bonding/bond_procfs.c | 48 +- drivers/net/bonding/bond_sysfs.c | 70 +- drivers/net/bonding/bond_sysfs_slave.c | 159 +- .../ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 +- .../net/ethernet/mellanox/mlx4/en_netdev.c | 4 +- .../ethernet/mellanox/mlx5/core/en/rep/bond.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 4 +- include/linux/netdevice.h | 16 +- include/net/bond_3ad.h | 30 +- include/net/bond_alb.h | 74 +- include/net/bond_options.h | 18 +- include/net/bonding.h | 358 +-- include/net/lag.h | 2 +- 23 files changed, 2420 insertions(+), 2361 deletions(-).clang-format +2
-2@@ -92,8 +92,8 @@ ForEachMacros: - 'blkg_for_each_descendant_post' - 'blkg_for_each_descendant_pre' - 'blk_queue_for_each_rl' - - 'bond_for_each_slave' - - 'bond_for_each_slave_rcu' + - 'bond_for_each_port' + - 'bond_for_each_port_rcu' - 'bpf_for_each_spilled_reg' - 'btree_for_each_safe128' - 'btree_for_each_safe32'drivers/infiniband/core/roce_gid_mgmt.c +2
-2@@ -131,7 +131,7 @@ static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu(struct net_de {if (upper &&netif_is_bond_dev (upper)) {struct net_device *pdev = -bond_option_active_slave_get_rcu (netdev_priv (upper)); +bond_option_active_port_get_rcu (netdev_priv (upper));if (pdev) return dev == pdev ? BONDING_SLAVE_STATE_ACTIVE :@@ -215,7 +215,7 @@ is_ndev_for_default_gid_filter(struct ib_device *ib_dev, u8 port,* Additionally when event(cookie) netdevice is bond master device, * make sure that it the upper netdevice of rdma netdevice. */ - res = ((cookie_ndev == rdma_ndev && !netif_is_bond_slave (rdma_ndev)) || + res = ((cookie_ndev == rdma_ndev && !netif_is_bond_port (rdma_ndev)) || (netif_is_bond_dev (cookie_ndev) &&rdma_is_upper_dev_rcu (rdma_ndev, cookie_ndev)));drivers/infiniband/hw/mlx4/main.c +0
-0
drivers/infiniband/hw/mlx4/main.c static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_n · line 151
Quoted 8 lines
drivers/infiniband/hw/mlx4/main.c +1
-1@@ -145,7 +145,7 @@ static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_nif (upper) {struct net_device *active; - active =bond_option_active_slave_get_rcu (netdev_priv (upper)); + active =bond_option_active_port_get_rcu (netdev_priv (upper));if (active) dev = active; }
I believe that this block, and the later blocks that change
device drivers, should trigger inclusion the appropriate maintainers on the Cc list. This applies to patch #2 in the series as well, which I didn't think of when reading it.
Quoted 2,990 lines
drivers/net/bonding/bond_3ad.c +210
-210@@ -91,20 +91,20 @@ static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =/* ================= main 802.3ad protocol functions ================== */ static int ad_lacpdu_send (struct ad_port *ad_port);static int ad_marker_send (struct ad_port *ad_port,struct bond_marker *marker); -static void ad_mux_machine (struct ad_port *ad_port,bool *update_slave_arr); +static void ad_mux_machine (struct ad_port *ad_port,bool *update_port_arr);static void ad_rx_machine (struct lacpdu *lacpdu,struct ad_port *ad_port);static void ad_tx_machine (struct ad_port *ad_port);static void ad_periodic_machine (struct ad_port *ad_port); -static void ad_port_selection_logic (struct ad_port *ad_port,bool *update_slave_arr); +static void ad_port_selection_logic (struct ad_port *ad_port,bool *update_port_arr);static void ad_agg_selection_logic (struct aggregator *aggregator, -bool *update_slave_arr); +bool *update_port_arr);static void ad_clear_agg (struct aggregator *aggregator);static void ad_initialize_agg (struct aggregator *aggregator);static void ad_initialize_port (struct ad_port *ad_port,int lacp_fast);static void ad_enable_collecting_distributing (struct ad_port *ad_port, -bool *update_slave_arr); +bool *update_port_arr);static void ad_disable_collecting_distributing (struct ad_port *ad_port, -bool *update_slave_arr); +bool *update_port_arr);static void ad_marker_info_received (struct bond_marker *marker_info,struct ad_port *ad_port); static void ad_marker_response_received(struct bond_marker *marker,@@ -122,33 +122,33 @@ static void ad_update_actor_keys(struct ad_port *ad_port, bool reset);*/ static inline struct bonding *__get_bond_by_ad_port (struct ad_port *ad_port) { -if (ad_port->slave ==NULL ) +if (ad_port->port ==NULL )return NULL ; -return bond_get_bond_by_slave (ad_port->slave); +return bond_get_bond_by_port (ad_port->port); }/** * __get_first_agg - get the first aggregator in the bond * @ad_port: the ad_port we're looking at * -* Return the aggregator of the first slave in @bond, or %NULL if it can't be +* Return the aggregator of the first port in @bond, or %NULL if it can't be * found. * The caller must hold RCU or RTNL lock. */ static inline struct aggregator *__get_first_agg (struct ad_port *ad_port) {struct bonding *bond =__get_bond_by_ad_port (ad_port); -struct slave *first_slave; +struct bond_port *first_port;struct aggregator *agg; -/* If there's no bond for this ad_port, or bond has no slaves */ +/* If there's no bond for this ad_port, or bond has no ports */ if (bond ==NULL )return NULL ;rcu_read_lock (); - first_slave =bond_first_slave_rcu (bond); - agg = first_slave ? &(SLAVE_AD_INFO (first_slave)->aggregator) :NULL ; + first_port =bond_first_port_rcu (bond); + agg = first_port ? &(PORT_AD_INFO (first_port)->aggregator) :NULL ;rcu_read_unlock ();return agg;@@ -167,33 +167,33 @@ static inline int __agg_has_partner(struct aggregator *agg) }/** -* __disable_ad_port - disable the ad_port's slave +* __disable_ad_port - disable the ad_port's port * @ad_port: the ad_port we're looking at */ static inline void __disable_ad_port (struct ad_port *ad_port) { -bond_set_slave_inactive_flags (ad_port->slave,BOND_SLAVE_NOTIFY_LATER ); +bond_set_port_inactive_flags (ad_port->port,BOND_PORT_NOTIFY_LATER ); }/** -* __enable_ad_port - enable the ad_port's slave, if it's up +* __enable_ad_port - enable the ad_port's port, if it's up * @ad_port: the ad_port we're looking at */ static inline void __enable_ad_port (struct ad_port *ad_port) { -struct slave *slave = ad_port->slave; +struct bond_port *port = ad_port->port; -if ((slave->link ==BOND_LINK_UP ) &&bond_slave_is_up (slave)) -bond_set_slave_active_flags (slave,BOND_SLAVE_NOTIFY_LATER ); +if ((port->link ==BOND_LINK_UP ) &&bond_port_is_up (port)) +bond_set_port_active_flags (port,BOND_PORT_NOTIFY_LATER ); }/** -* __ad_port_is_enabled - check if the ad_port's slave is in active state +* __ad_port_is_enabled - check if the ad_port's port is in active state * @ad_port: the ad_port we're looking at */ static inline int __ad_port_is_enabled (struct ad_port *ad_port) { -return bond_is_active_slave (ad_port->slave); +return bond_is_active_port (ad_port->port); }/** @@ -248,7 +248,7 @@ static inline int __check_agg_selection_timer(struct ad_port *ad_port)*/ static u16 __get_link_speed (struct ad_port *ad_port) { -struct slave *slave = ad_port->slave; +struct bond_port *port = ad_port->port;u16 speed;/* this if covers only a special case: when the configuration starts @@ -256,10 +256,10 @@ static u16 __get_link_speed(struct ad_port *ad_port)* This is done in spite of the fact that the e100 driver reports 0 * to be compatible with MVT in the future. */ -if (slave->link !=BOND_LINK_UP ) +if (port->link !=BOND_LINK_UP ) speed =0 ;else { -switch (slave->speed) { +switch (port->speed) {case SPEED_10 : speed =AD_LINK_SPEED_10MBPS ;break ;@@ -314,18 +314,18 @@ static u16 __get_link_speed(struct ad_port *ad_port)default :/* unknown speed value from ethtool. shouldn't happen */ -if (slave->speed !=SPEED_UNKNOWN ) -pr_warn_once ("%s: (slave %s): unknown ethtool speed (%d) for port %d (set it to 0)\n" , - slave->bond->dev->name, - slave->dev->name, slave->speed, +if (port->speed !=SPEED_UNKNOWN ) +pr_warn_once ("%s: (port %s): unknown ethtool speed (%d) for port %d (set it to 0)\n" , + port->bond->dev->name, + port->dev->name, port->speed, ad_port->actor_port_number); speed =0 ;break ; } } -slave_dbg (slave->bond->dev, slave->dev,"Port %d Received link speed %d update from adapter\n" , - ad_port->actor_port_number, speed); +port_dbg (port->bond->dev, port->dev,"Port %d Received link speed %d update from adapter\n" , + ad_port->actor_port_number, speed);return speed; }@@ -339,24 +339,24 @@ static u16 __get_link_speed(struct ad_port *ad_port)*/ static u8 __get_duplex (struct ad_port *ad_port) { -struct slave *slave = ad_port->slave; +struct bond_port *port = ad_port->port;u8 retval =0x0 ;/* handling a special case: when the configuration starts with * link down, it sets the duplex to 0. */ -if (slave->link ==BOND_LINK_UP ) { -switch (slave->duplex) { +if (port->link ==BOND_LINK_UP ) { +switch (port->duplex) {case DUPLEX_FULL : retval =0x1 ; -slave_dbg (slave->bond->dev, slave->dev,"Port %d Received status full duplex update from adapter\n" , - ad_port->actor_port_number); +port_dbg (port->bond->dev, port->dev,"Port %d Received status full duplex update from adapter\n" , + ad_port->actor_port_number);break ;case DUPLEX_HALF :default : retval =0x0 ; -slave_dbg (slave->bond->dev, slave->dev,"Port %d Received status NOT full duplex update from adapter\n" , - ad_port->actor_port_number); +port_dbg (port->bond->dev, port->dev,"Port %d Received status NOT full duplex update from adapter\n" , + ad_port->actor_port_number);break ; } }@@ -365,7 +365,7 @@ static u8 __get_duplex(struct ad_port *ad_port)static void __ad_actor_update_port (struct ad_port *ad_port) { -const struct bonding *bond =bond_get_bond_by_slave (ad_port->slave); +const struct bonding *bond =bond_get_bond_by_port (ad_port->port); ad_port->actor_system =BOND_AD_INFO (bond).system.sys_mac_addr; ad_port->actor_system_priority =BOND_AD_INFO (bond).system.sys_priority;@@ -490,12 +490,12 @@ static void __record_pdu(struct lacpdu *lacpdu, struct ad_port *ad_port)if ((ad_port->sm_vars &AD_PORT_MATCHED ) && (lacpdu->actor_state &LACP_STATE_SYNCHRONIZATION )) { partner->port_state |=LACP_STATE_SYNCHRONIZATION ; -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"partner sync=1\n" ); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"partner sync=1\n" ); }else { partner->port_state &= ~LACP_STATE_SYNCHRONIZATION ; -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"partner sync=0\n" ); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"partner sync=0\n" ); } } }@@ -748,13 +748,13 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator)*/ static struct aggregator *__get_active_agg (struct aggregator *aggregator) { -struct bonding *bond = aggregator->slave->bond; +struct bonding *bond = aggregator->port->bond;struct list_head *iter; -struct slave *slave; +struct bond_port *port; -bond_for_each_slave_rcu (bond, slave, iter) -if (SLAVE_AD_INFO (slave)->aggregator.is_active) -return &(SLAVE_AD_INFO (slave)->aggregator); +bond_for_each_port_rcu (bond, port, iter) +if (PORT_AD_INFO (port)->aggregator.is_active) +return &(PORT_AD_INFO (port)->aggregator);return NULL ; }@@ -781,9 +781,9 @@ static inline void __update_lacpdu_from_ad_port(struct ad_port *ad_port) lacpdu->actor_port_priority =htons (ad_port->actor_port_priority); lacpdu->actor_port =htons (ad_port->actor_port_number); lacpdu->actor_state = ad_port->actor_oper_port_state; -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"update lacpdu: actor ad port state %x\n" , - ad_port->actor_oper_port_state); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"update lacpdu: actor ad port state %x\n" , + ad_port->actor_oper_port_state);/* lacpdu->reserved_3_1 initialized * lacpdu->tlv_type_partner_info initialized @@ -819,7 +819,7 @@ static inline void __update_lacpdu_from_ad_port(struct ad_port *ad_port)*/ static int ad_lacpdu_send (struct ad_port *ad_port) { -struct slave *slave = ad_port->slave; +struct bond_port *port = ad_port->port;struct sk_buff *skb;struct lacpdu_header *lacpdu_header;int length =sizeof (struct lacpdu_header );@@ -828,10 +828,10 @@ static int ad_lacpdu_send(struct ad_port *ad_port)if (!skb)return -ENOMEM ; -atomic64_inc (&SLAVE_AD_INFO (slave)->stats.lacpdu_tx); -atomic64_inc (&BOND_AD_INFO (slave->bond).stats.lacpdu_tx); +atomic64_inc (&PORT_AD_INFO (port)->stats.lacpdu_tx); +atomic64_inc (&BOND_AD_INFO (port->bond).stats.lacpdu_tx); - skb->dev = slave->dev; + skb->dev = port->dev;skb_reset_mac_header (skb); skb->network_header = skb->mac_header +ETH_HLEN ; skb->protocol =PKT_TYPE_LACPDU ;@@ -843,7 +843,7 @@ static int ad_lacpdu_send(struct ad_port *ad_port)/* Note: source address is set to be the member's PERMANENT address, * because we use it to identify loopback lacpdus in receive. */ -ether_addr_copy (lacpdu_header->hdr.h_source, slave->perm_hwaddr); +ether_addr_copy (lacpdu_header->hdr.h_source, port->perm_hwaddr); lacpdu_header->hdr.h_proto =PKT_TYPE_LACPDU ; lacpdu_header->lacpdu = ad_port->lacpdu;@@ -863,7 +863,7 @@ static int ad_lacpdu_send(struct ad_port *ad_port)*/ static int ad_marker_send (struct ad_port *ad_port,struct bond_marker *marker) { -struct slave *slave = ad_port->slave; +struct bond_port *port = ad_port->port;struct sk_buff *skb;struct bond_marker_header *marker_header;int length =sizeof (struct bond_marker_header );@@ -874,18 +874,18 @@ static int ad_marker_send(struct ad_port *ad_port, struct bond_marker *marker)switch (marker->tlv_type) {case AD_MARKER_INFORMATION_SUBTYPE : -atomic64_inc (&SLAVE_AD_INFO (slave)->stats.marker_tx); -atomic64_inc (&BOND_AD_INFO (slave->bond).stats.marker_tx); +atomic64_inc (&PORT_AD_INFO (port)->stats.marker_tx); +atomic64_inc (&BOND_AD_INFO (port->bond).stats.marker_tx);break ;case AD_MARKER_RESPONSE_SUBTYPE : -atomic64_inc (&SLAVE_AD_INFO (slave)->stats.marker_resp_tx); -atomic64_inc (&BOND_AD_INFO (slave->bond).stats.marker_resp_tx); +atomic64_inc (&PORT_AD_INFO (port)->stats.marker_resp_tx); +atomic64_inc (&BOND_AD_INFO (port->bond).stats.marker_resp_tx);break ; }skb_reserve (skb,16 ); - skb->dev = slave->dev; + skb->dev = port->dev;skb_reset_mac_header (skb); skb->network_header = skb->mac_header +ETH_HLEN ; skb->protocol =PKT_TYPE_LACPDU ;@@ -896,7 +896,7 @@ static int ad_marker_send(struct ad_port *ad_port, struct bond_marker *marker)/* Note: source address is set to be the member's PERMANENT address, * because we use it to identify loopback MARKERs in receive. */ -ether_addr_copy (marker_header->hdr.h_source, slave->perm_hwaddr); +ether_addr_copy (marker_header->hdr.h_source, port->perm_hwaddr); marker_header->hdr.h_proto =PKT_TYPE_LACPDU ; marker_header->marker = *marker;@@ -909,9 +909,9 @@ static int ad_marker_send(struct ad_port *ad_port, struct bond_marker *marker)/** * ad_mux_machine - handle an ad_port's mux state machine * @ad_port: the ad_port we're looking at -* @update_slave_arr: Does slave array need update? +* @update_port_arr: Does port array need update? */ -static void ad_mux_machine (struct ad_port *ad_port,bool *update_slave_arr) +static void ad_mux_machine (struct ad_port *ad_port,bool *update_port_arr) {mux_states_t last_state;@@ -1015,15 +1015,15 @@ static void ad_mux_machine(struct ad_port *ad_port, bool *update_slave_arr)/* check if the state machine was changed */ if (ad_port->sm_mux_state != last_state) { -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"Mux Machine: Port=%d, Last State=%d, Curr State=%d\n" , - ad_port->actor_port_number, last_state, - ad_port->sm_mux_state); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"Mux Machine: Port=%d, Last State=%d, Curr State=%d\n" , + ad_port->actor_port_number, last_state, + ad_port->sm_mux_state);switch (ad_port->sm_mux_state) {case AD_MUX_DETACHED : ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ;ad_disable_collecting_distributing (ad_port, - update_slave_arr); + update_port_arr); ad_port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; ad_port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ; ad_port->ntt = true;@@ -1041,7 +1041,7 @@ static void ad_mux_machine(struct ad_port *ad_port, bool *update_slave_arr) ad_port->actor_oper_port_state &= ~LACP_STATE_COLLECTING ; ad_port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING ;ad_disable_collecting_distributing (ad_port, - update_slave_arr); + update_port_arr); ad_port->ntt = true;break ;case AD_MUX_COLLECTING_DISTRIBUTING :@@ -1049,7 +1049,7 @@ static void ad_mux_machine(struct ad_port *ad_port, bool *update_slave_arr) ad_port->actor_oper_port_state |=LACP_STATE_DISTRIBUTING ; ad_port->actor_oper_port_state |=LACP_STATE_SYNCHRONIZATION ;ad_enable_collecting_distributing (ad_port, - update_slave_arr); + update_port_arr); ad_port->ntt = true;break ;default :@@ -1077,8 +1077,8 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct ad_port *ad_port) last_state = ad_port->sm_rx_state;if (lacpdu) { -atomic64_inc (&SLAVE_AD_INFO (ad_port->slave)->stats.lacpdu_rx); -atomic64_inc (&BOND_AD_INFO (ad_port->slave->bond).stats.lacpdu_rx); +atomic64_inc (&PORT_AD_INFO (ad_port->port)->stats.lacpdu_rx); +atomic64_inc (&BOND_AD_INFO (ad_port->port->bond).stats.lacpdu_rx); }/* check if state machine should change state */ @@ -1132,11 +1132,11 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct ad_port *ad_port)/* check if the State machine was changed or new lacpdu arrived */ if ((ad_port->sm_rx_state != last_state) || (lacpdu)) { -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"Rx Machine: Port=%d, Last State=%d, Curr State=%d\n" , - ad_port->actor_port_number, - last_state, - ad_port->sm_rx_state); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"Rx Machine: Port=%d, Last State=%d, Curr State=%d\n" , + ad_port->actor_port_number, + last_state, + ad_port->sm_rx_state);switch (ad_port->sm_rx_state) {case AD_RX_INITIALIZE :if (!(ad_port->actor_oper_port_key &AD_DUPLEX_KEY_MASKS ))@@ -1184,8 +1184,8 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct ad_port *ad_port)/* detect loopback situation */ if (MAC_ADDRESS_EQUAL (&(lacpdu->actor_system), &(ad_port->actor_system))) { -slave_err (ad_port->slave->bond->dev, ad_port->slave->dev,"An illegal loopback occurred on slave\n" -"Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n" ); +port_err (ad_port->port->bond->dev, ad_port->port->dev,"An illegal loopback occurred on port\n" +"Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n" );return ; }__update_selected (lacpdu, ad_port);@@ -1254,10 +1254,10 @@ static void ad_tx_machine(struct ad_port *ad_port)__update_lacpdu_from_ad_port (ad_port);if (ad_lacpdu_send (ad_port) >=0 ) { -slave_dbg (ad_port->slave->bond->dev, - ad_port->slave->dev, -"Sent LACPDU on port %d\n" , - ad_port->actor_port_number); +port_dbg (ad_port->port->bond->dev, + ad_port->port->dev, +"Sent LACPDU on port %d\n" , + ad_port->actor_port_number);/* mark ntt as false, so it will not be sent * again until demanded @@ -1336,10 +1336,10 @@ static void ad_periodic_machine(struct ad_port *ad_port)/* check if the state machine was changed */ if (ad_port->sm_periodic_state != last_state) { -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n" , - ad_port->actor_port_number, last_state, - ad_port->sm_periodic_state); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n" , + ad_port->actor_port_number, last_state, + ad_port->sm_periodic_state);switch (ad_port->sm_periodic_state) {case AD_NO_PERIODIC : ad_port->sm_periodic_timer_counter =0 ;@@ -1364,19 +1364,19 @@ static void ad_periodic_machine(struct ad_port *ad_port)/** * ad_port_selection_logic - select aggregation groups * @ad_port: the ad_port we're looking at -* @update_slave_arr: Does slave array need update? +* @update_port_arr: Does port array need update? * * Select aggregation groups, and assign each ad_port for it's aggregetor. The * selection logic is called in the inititalization (after all the handshkes), * and after every lacpdu receive (if selected is off). */ -static void ad_port_selection_logic (struct ad_port *ad_port,bool *update_slave_arr) +static void ad_port_selection_logic (struct ad_port *ad_port,bool *update_port_arr) {struct aggregator *aggregator, *free_aggregator =NULL , *temp_aggregator;struct ad_port *last_port =NULL , *curr_port;struct list_head *iter;struct bonding *bond; -struct slave *slave; +struct bond_port *port;int found =0 ;/* if the ad_port is already Selected, do nothing */ @@ -1415,9 +1415,9 @@ static void ad_port_selection_logic(struct ad_port *ad_port, bool *update_slave_ ad_port->next_port_in_aggregator =NULL ; ad_port->actor_port_aggregator_identifier =0 ; -slave_dbg (bond->dev, ad_port->slave->dev,"Port %d left LAG %d\n" , - ad_port->actor_port_number, - temp_aggregator->aggregator_identifier); +port_dbg (bond->dev, ad_port->port->dev,"Port %d left LAG %d\n" , + ad_port->actor_port_number, + temp_aggregator->aggregator_identifier);/* if the aggregator is empty, clear its * parameters, and set it ready to be attached */ @@ -1430,16 +1430,16 @@ static void ad_port_selection_logic(struct ad_port *ad_port, bool *update_slave_/* meaning: the ad_port was related to an aggregator * but was not on the aggregator ad_port list */ -net_warn_ratelimited ("%s: (slave %s): Warning: Port %d was related to aggregator %d but was not on its port list\n" , - ad_port->slave->bond->dev->name, - ad_port->slave->dev->name, +net_warn_ratelimited ("%s: (port %s): Warning: Port %d was related to aggregator %d but was not on its port list\n" , + ad_port->port->bond->dev->name, + ad_port->port->dev->name, ad_port->actor_port_number, ad_port->aggregator->aggregator_identifier); } }/* search all aggregators for a suitable aggregator for this ad_port */ -bond_for_each_slave (bond, slave, iter) { - aggregator = &(SLAVE_AD_INFO (slave)->aggregator); +bond_for_each_port (bond, port, iter) { + aggregator = &(PORT_AD_INFO (port)->aggregator);/* keep a free aggregator for later use(if needed) */ if (!aggregator->lag_ports) {@@ -1464,9 +1464,9 @@ static void ad_port_selection_logic(struct ad_port *ad_port, bool *update_slave_ ad_port->next_port_in_aggregator = aggregator->lag_ports; ad_port->aggregator->num_of_ports++; aggregator->lag_ports = ad_port; -slave_dbg (bond->dev, slave->dev,"Port %d joined LAG %d (existing LAG)\n" , - ad_port->actor_port_number, - ad_port->aggregator->aggregator_identifier); +port_dbg (bond->dev, port->dev,"Port %d joined LAG %d (existing LAG)\n" , + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier);/* mark this ad_port as selected */ ad_port->sm_vars |=AD_PORT_SELECTED ;@@ -1511,13 +1511,13 @@ static void ad_port_selection_logic(struct ad_port *ad_port, bool *update_slave_/* mark this port as selected */ ad_port->sm_vars |=AD_PORT_SELECTED ; -slave_dbg (bond->dev, ad_port->slave->dev,"Port %d joined LAG %d (new LAG)\n" , - ad_port->actor_port_number, - ad_port->aggregator->aggregator_identifier); +port_dbg (bond->dev, ad_port->port->dev,"Port %d joined LAG %d (new LAG)\n" , + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier); }else { -slave_err (bond->dev, ad_port->slave->dev, -"Port %d did not find a suitable aggregator\n" , - ad_port->actor_port_number); +port_err (bond->dev, ad_port->port->dev, +"Port %d did not find a suitable aggregator\n" , + ad_port->actor_port_number); } }/* if all aggregator's ad_ports are READY_N == TRUE, set ready=TRUE @@ -1528,7 +1528,7 @@ static void ad_port_selection_logic(struct ad_port *ad_port, bool *update_slave_ __agg_ports_are_ready(ad_port->aggregator)); aggregator =__get_first_agg (ad_port); -ad_agg_selection_logic (aggregator, update_slave_arr); +ad_agg_selection_logic (aggregator, update_port_arr);if (!ad_port->aggregator->is_active) ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ;@@ -1596,9 +1596,9 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,break ;default : -net_warn_ratelimited ("%s: (slave %s): Impossible agg select mode %d\n" , - curr->slave->bond->dev->name, - curr->slave->dev->name, +net_warn_ratelimited ("%s: (port %s): Impossible agg select mode %d\n" , + curr->port->bond->dev->name, + curr->port->dev->name,__get_agg_selection_mode (curr->lag_ports));break ; }@@ -1615,8 +1615,8 @@ static int agg_device_up(const struct aggregator *agg)for (ad_port = agg->lag_ports; ad_port; ad_port = ad_port->next_port_in_aggregator) { -if (netif_running (ad_port->slave->dev) && -netif_carrier_ok (ad_port->slave->dev)) +if (netif_running (ad_port->port->dev) && +netif_carrier_ok (ad_port->port->dev))return 1 ; }@@ -1626,7 +1626,7 @@ static int agg_device_up(const struct aggregator *agg)/** * ad_agg_selection_logic - select an aggregation group for a team * @agg: the aggregator we're looking at -* @update_slave_arr: Does slave array need update? +* @update_port_arr: Does port array need update? * * It is assumed that only one aggregator may be selected for a team. * @@ -1639,23 +1639,23 @@ static int agg_device_up(const struct aggregator *agg)* * BOND_AD_BANDWIDTH: select the aggregator with the highest total * bandwidth, and reselect whenever a link state change takes place or the -* set of slaves in the bond changes. +* set of ports in the bond changes. * * BOND_AD_COUNT: select the aggregator with largest number of ad_ports -* (slaves), and reselect whenever a link state change takes place or the -* set of slaves in the bond changes. +* (ports), and reselect whenever a link state change takes place or the +* set of ports in the bond changes. * * FIXME: this function MUST be called with the first agg in the bond, or * __get_active_agg() won't work correctly. This function should be better * called with the bond itself, and retrieve the first agg from it. */ static void ad_agg_selection_logic (struct aggregator *agg, -bool *update_slave_arr) +bool *update_port_arr) {struct aggregator *best, *active, *origin; -struct bonding *bond = agg->slave->bond; +struct bonding *bond = agg->port->bond;struct list_head *iter; -struct slave *slave; +struct bond_port *port;struct ad_port *ad_port;rcu_read_lock ();@@ -1663,8 +1663,8 @@ static void ad_agg_selection_logic(struct aggregator *agg, active =__get_active_agg (agg); best = (active &&agg_device_up (active)) ? active :NULL ; -bond_for_each_slave_rcu (bond, slave, iter) { - agg = &(SLAVE_AD_INFO (slave)->aggregator); +bond_for_each_port_rcu (bond, port, iter) { + agg = &(PORT_AD_INFO (port)->aggregator); agg->is_active =0 ;@@ -1699,24 +1699,24 @@ static void ad_agg_selection_logic(struct aggregator *agg,/* if there is new best aggregator, activate it */ if (best) { -netdev_dbg (bond->dev,"(slave %s): best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n" , - best->slave ? best->slave->dev->name :"NULL" , +netdev_dbg (bond->dev,"(port %s): best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n" , + best->port ? best->port->dev->name :"NULL" , best->aggregator_identifier, best->num_of_ports, best->actor_oper_aggregator_key, best->partner_oper_aggregator_key, best->is_individual, best->is_active); -netdev_dbg (bond->dev,"(slave %s): best ports %p slave %p\n" , - best->slave ? best->slave->dev->name :"NULL" , - best->lag_ports, best->slave); - -bond_for_each_slave_rcu (bond, slave, iter) { - agg = &(SLAVE_AD_INFO (slave)->aggregator); - -slave_dbg (bond->dev, slave->dev,"Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n" , - agg->aggregator_identifier, agg->num_of_ports, - agg->actor_oper_aggregator_key, - agg->partner_oper_aggregator_key, - agg->is_individual, agg->is_active); +netdev_dbg (bond->dev,"(port %s): best ports %p port %p\n" , + best->port ? best->port->dev->name :"NULL" , + best->lag_ports, best->port); + +bond_for_each_port_rcu (bond, port, iter) { + agg = &(PORT_AD_INFO (port)->aggregator); + +port_dbg (bond->dev, port->dev,"Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n" , + agg->aggregator_identifier, agg->num_of_ports, + agg->actor_oper_aggregator_key, + agg->partner_oper_aggregator_key, + agg->is_individual, agg->is_active); }/* check if any partner replies */ @@ -1725,11 +1725,11 @@ static void ad_agg_selection_logic(struct aggregator *agg, bond->dev->name); best->is_active =1 ; -netdev_dbg (bond->dev,"(slave %s): LAG %d chosen as the active LAG\n" , - best->slave ? best->slave->dev->name :"NULL" , +netdev_dbg (bond->dev,"(port %s): LAG %d chosen as the active LAG\n" , + best->port ? best->port->dev->name :"NULL" , best->aggregator_identifier); - netdev_dbg(bond->dev, "(slave %s): Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", - best->slave ? best->slave->dev->name : "NULL", + netdev_dbg(bond->dev, "(port %s): Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", + best->port ? best->port->dev->name : "NULL", best->aggregator_identifier, best->num_of_ports, best->actor_oper_aggregator_key, best->partner_oper_aggregator_key,@@ -1744,8 +1744,8 @@ static void ad_agg_selection_logic(struct aggregator *agg,__disable_ad_port (ad_port); } } -/* Slave array needs update. */ - *update_slave_arr = true; +/* Port array needs update. */ + *update_port_arr = true; }/* if the selected aggregator is of join individuals @@ -1786,8 +1786,8 @@ static void ad_clear_agg(struct aggregator *aggregator) aggregator->is_active =0 ; aggregator->num_of_ports =0 ;pr_debug ("%s: LAG %d was cleared\n" , - aggregator->slave ? - aggregator->slave->dev->name :"NULL" , + aggregator->port ? + aggregator->port->dev->name :"NULL" , aggregator->aggregator_identifier); } }@@ -1803,7 +1803,7 @@ static void ad_initialize_agg(struct aggregator *aggregator)eth_zero_addr (aggregator->aggregator_mac_address.mac_addr_value); aggregator->aggregator_identifier =0 ; - aggregator->slave =NULL ; + aggregator->port =NULL ; } }@@ -1876,42 +1876,42 @@ static void ad_initialize_port(struct ad_port *ad_port, int lacp_fast)/** * ad_enable_collecting_distributing - enable an ad_port's transmit/receive * @ad_port: the ad_port we're looking at -* @update_slave_arr: Does slave array need update? +* @update_port_arr: Does port array need update? * * Enable @ad_port if it's in an active aggregator */ static void ad_enable_collecting_distributing (struct ad_port *ad_port, -bool *update_slave_arr) +bool *update_port_arr) {if (ad_port->aggregator->is_active) { -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"Enabling port %d (LAG %d)\n" , - ad_port->actor_port_number, - ad_port->aggregator->aggregator_identifier); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"Enabling port %d (LAG %d)\n" , + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier);__enable_ad_port (ad_port); -/* Slave array needs update */ - *update_slave_arr = true; +/* Port array needs update */ + *update_port_arr = true; } }/** * ad_disable_collecting_distributing - disable an ad_port's transmit/receive * @ad_port: the ad_port we're looking at -* @update_slave_arr: Does slave array need update? +* @update_port_arr: Does port array need update? */ static void ad_disable_collecting_distributing (struct ad_port *ad_port, -bool *update_slave_arr) +bool *update_port_arr) {if (ad_port->aggregator && !MAC_ADDRESS_EQUAL (&(ad_port->aggregator->partner_system), &(null_mac_addr))) { -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"Disabling port %d (LAG %d)\n" , - ad_port->actor_port_number, - ad_port->aggregator->aggregator_identifier); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"Disabling port %d (LAG %d)\n" , + ad_port->actor_port_number, + ad_port->aggregator->aggregator_identifier);__disable_ad_port (ad_port); -/* Slave array needs an update */ - *update_slave_arr = true; +/* Port array needs an update */ + *update_port_arr = true; } }@@ -1925,8 +1925,8 @@ static void ad_marker_info_received(struct bond_marker *marker_info, {struct bond_marker marker; -atomic64_inc (&SLAVE_AD_INFO (ad_port->slave)->stats.marker_rx); -atomic64_inc (&BOND_AD_INFO (ad_port->slave->bond).stats.marker_rx); +atomic64_inc (&PORT_AD_INFO (ad_port->port)->stats.marker_rx); +atomic64_inc (&BOND_AD_INFO (ad_port->port->bond).stats.marker_rx);/* copy the received marker data to the response marker */ memcpy (&marker, marker_info,sizeof (struct bond_marker ));@@ -1935,9 +1935,9 @@ static void ad_marker_info_received(struct bond_marker *marker_info,/* send the marker response */ if (ad_marker_send (ad_port, &marker) >=0 ) -slave_dbg (ad_port->slave->bond->dev, ad_port->slave->dev, -"Sent Marker Response on port %d\n" , - ad_port->actor_port_number); +port_dbg (ad_port->port->bond->dev, ad_port->port->dev, +"Sent Marker Response on port %d\n" , + ad_port->actor_port_number); }/** @@ -1952,8 +1952,8 @@ static void ad_marker_info_received(struct bond_marker *marker_info,static void ad_marker_response_received (struct bond_marker *marker,struct ad_port *ad_port) { -atomic64_inc (&SLAVE_AD_INFO (ad_port->slave)->stats.marker_resp_rx); -atomic64_inc (&BOND_AD_INFO (ad_port->slave->bond).stats.marker_resp_rx); +atomic64_inc (&PORT_AD_INFO (ad_port->port)->stats.marker_resp_rx); +atomic64_inc (&BOND_AD_INFO (ad_port->port->bond).stats.marker_resp_rx);/* DO NOTHING, SINCE WE DECIDED NOT TO IMPLEMENT THIS FEATURE FOR NOW */ }@@ -2013,28 +2013,28 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution) }/** -* bond_3ad_bind_slave - initialize a slave's ad_port -* @slave: slave struct to work on +* bond_3ad_bind_port - initialize a port's ad_port +* @port: port struct to work on * * Returns: 0 on success * < 0 on error */ -void bond_3ad_bind_slave (struct slave *slave) +void bond_3ad_bind_port (struct bond_port *port) { -struct bonding *bond =bond_get_bond_by_slave (slave); +struct bonding *bond =bond_get_bond_by_port (port);struct ad_port *ad_port;struct aggregator *aggregator; -/* check that the slave has not been initialized yet. */ -if (SLAVE_AD_INFO (slave)->ad_port.slave != slave) { +/* check that the port has not been initialized yet. */ +if (PORT_AD_INFO (port)->ad_port.port != port) {/* ad_port initialization */ - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); + ad_port = &(PORT_AD_INFO (port)->ad_port);ad_initialize_port (ad_port, bond->params.lacp_fast); - ad_port->slave = slave; - ad_port->actor_port_number =SLAVE_AD_INFO (slave)->id; + ad_port->port = port; + ad_port->actor_port_number =PORT_AD_INFO (port)->id;/* key is determined according to the link speed, duplex and * user key */ @@ -2050,49 +2050,49 @@ void bond_3ad_bind_slave(struct slave *slave)__disable_ad_port (ad_port);/* aggregator initialization */ - aggregator = &(SLAVE_AD_INFO (slave)->aggregator); + aggregator = &(PORT_AD_INFO (port)->aggregator);ad_initialize_agg (aggregator); aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr); aggregator->aggregator_identifier = ++BOND_AD_INFO (bond).aggregator_identifier; - aggregator->slave = slave; + aggregator->port = port; aggregator->is_active =0 ; aggregator->num_of_ports =0 ; } }/** -* bond_3ad_unbind_slave - deinitialize a slave's ad_port -* @slave: slave struct to work on +* bond_3ad_unbind_port - deinitialize a port's ad_port +* @port: port struct to work on * * Search for the aggregator that is related to this ad_port, remove the * aggregator and assign another aggregator for other ad_port related to it * (if any), and remove the ad_port. */ -void bond_3ad_unbind_slave (struct slave *slave) +void bond_3ad_unbind_port (struct bond_port *port) {struct ad_port *ad_port, *prev_port, *temp_port;struct aggregator *aggregator, *new_aggregator, *temp_aggregator;int select_new_active_agg =0 ; -struct bonding *bond = slave->bond; -struct slave *slave_iter; +struct bonding *bond = port->bond; +struct bond_port *port_iter;struct list_head *iter; -bool dummy_slave_update;/* Ignore this value as caller updates array */ +bool dummy_port_update;/* Ignore this value as caller updates array */ /* Sync against bond_3ad_state_machine_handler() */ spin_lock_bh (&bond->mode_lock); - aggregator = &(SLAVE_AD_INFO (slave)->aggregator); - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); + aggregator = &(PORT_AD_INFO (port)->aggregator); + ad_port = &(PORT_AD_INFO (port)->ad_port); -/* if slave is null, the whole ad_port is not initialized */ -if (!ad_port->slave) { -slave_warn (bond->dev, slave->dev,"Trying to unbind an uninitialized port\n" ); +/* if port is null, the whole ad_port is not initialized */ +if (!ad_port->port) { +port_warn (bond->dev, port->dev,"Trying to unbind an uninitialized port\n" ); goto out; } -slave_dbg (bond->dev, slave->dev,"Unbinding Link Aggregation Group %d\n" , - aggregator->aggregator_identifier); +port_dbg (bond->dev, port->dev,"Unbinding Link Aggregation Group %d\n" , + aggregator->aggregator_identifier);/* Tell the partner that this ad_port is not suitable for aggregation */ ad_port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION ;@@ -2105,15 +2105,15 @@ void bond_3ad_unbind_slave(struct slave *slave)/* check if this aggregator is occupied */ if (aggregator->lag_ports) {/* check if there are other ad_ports related to this aggregator -* except the ad_port related to this slave(thats ensure us that +* except the ad_port related to this port (thats ensure us that * there is a reason to search for new aggregator, and that we * will find one */ if ((aggregator->lag_ports != ad_port) || (aggregator->lag_ports->next_port_in_aggregator)) {/* find new aggregator for the related ad_port(s) */ -bond_for_each_slave (bond, slave_iter, iter) { - new_aggregator = &(SLAVE_AD_INFO (slave_iter)->aggregator); +bond_for_each_port (bond, port_iter, iter) { + new_aggregator = &(PORT_AD_INFO (port_iter)->aggregator);/* if the new aggregator is empty, or it is * connected to our ad_port only */ @@ -2122,7 +2122,7 @@ void bond_3ad_unbind_slave(struct slave *slave) !new_aggregator->lag_ports->next_port_in_aggregator)) break; } -if (!slave_iter) +if (!port_iter) new_aggregator =NULL ;/* if new aggregator found, copy the aggregator's @@ -2130,13 +2130,13 @@ void bond_3ad_unbind_slave(struct slave *slave)* new aggregator */ if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == ad_port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { -slave_dbg (bond->dev, slave->dev,"Some port(s) related to LAG %d - replacing with LAG %d\n" , - aggregator->aggregator_identifier, - new_aggregator->aggregator_identifier); +port_dbg (bond->dev, port->dev,"Some port(s) related to LAG %d - replacing with LAG %d\n" , + aggregator->aggregator_identifier, + new_aggregator->aggregator_identifier);if ((new_aggregator->lag_ports == ad_port) && new_aggregator->is_active) { -slave_info (bond->dev, slave->dev,"Removing an active aggregator\n" ); +port_info (bond->dev, port->dev,"Removing an active aggregator\n" ); select_new_active_agg =1 ; }@@ -2165,9 +2165,9 @@ void bond_3ad_unbind_slave(struct slave *slave)if (select_new_active_agg)ad_agg_selection_logic (__get_first_agg (ad_port), - &dummy_slave_update); + &dummy_port_update); }else { -slave_warn (bond->dev, slave->dev,"unbinding aggregator, and could not find a new aggregator for its ports\n" ); +port_warn (bond->dev, port->dev,"unbinding aggregator, and could not find a new aggregator for its ports\n" ); } }else {/* in case that the only ad_port related to this @@ -2176,21 +2176,21 @@ void bond_3ad_unbind_slave(struct slave *slave) select_new_active_agg = aggregator->is_active;ad_clear_agg (aggregator);if (select_new_active_agg) { -slave_info (bond->dev, slave->dev,"Removing an active aggregator\n" ); +port_info (bond->dev, port->dev,"Removing an active aggregator\n" );/* select new active aggregator */ temp_aggregator =__get_first_agg (ad_port);if (temp_aggregator)ad_agg_selection_logic (temp_aggregator, - &dummy_slave_update); + &dummy_port_update); } } } -slave_dbg (bond->dev, slave->dev,"Unbinding port %d\n" , ad_port->actor_port_number); +port_dbg (bond->dev, port->dev,"Unbinding port %d\n" , ad_port->actor_port_number);/* find the aggregator that this ad_port is connected to */ -bond_for_each_slave (bond, slave_iter, iter) { - temp_aggregator = &(SLAVE_AD_INFO (slave_iter)->aggregator); +bond_for_each_port (bond, port_iter, iter) { + temp_aggregator = &(PORT_AD_INFO (port_iter)->aggregator); prev_port =NULL ;/* search the ad_port in the aggregator's related ad_ports */ for (temp_port = temp_aggregator->lag_ports; temp_port;@@ -2209,17 +2209,17 @@ void bond_3ad_unbind_slave(struct slave *slave) select_new_active_agg = temp_aggregator->is_active;ad_clear_agg (temp_aggregator);if (select_new_active_agg) { -slave_info (bond->dev, slave->dev,"Removing an active aggregator\n" ); +port_info (bond->dev, port->dev,"Removing an active aggregator\n" );/* select new active aggregator */ ad_agg_selection_logic (__get_first_agg (ad_port), - &dummy_slave_update); + &dummy_port_update); } }break ; } } } - ad_port->slave =NULL ; + ad_port->port =NULL ;out:
spin_unlock_bh(&bond->mode_lock);drivers/net/bonding/bond_3ad.c +18
-18@@ -2235,7 +2235,7 @@ void bond_3ad_unbind_slave(struct slave *slave)void bond_3ad_update_ad_actor_settings (struct bonding *bond) {struct list_head *iter; -struct slave *slave; +struct bond_port *port;ASSERT_RTNL ();@@ -2248,8 +2248,8 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond) *((struct mac_addr *)bond->params.ad_actor_system);spin_lock_bh (&bond->mode_lock); -bond_for_each_slave (bond, slave, iter) { -struct ad_port *ad_port = &(SLAVE_AD_INFO (slave))->ad_port; +bond_for_each_port (bond, port, iter) { +struct ad_port *ad_port = &(PORT_AD_INFO (port))->ad_port;__ad_actor_update_port (ad_port); ad_port->ntt = true;@@ -2276,46 +2276,46 @@ void bond_3ad_state_machine_handler(struct work_struct *work) ad_work.work);struct aggregator *aggregator;struct list_head *iter; -struct slave *slave; +struct bond_port *port;struct ad_port *ad_port; -bool should_notify_rtnl =BOND_SLAVE_NOTIFY_LATER ; -bool update_slave_arr = false; +bool should_notify_rtnl =BOND_PORT_NOTIFY_LATER ; +bool update_port_arr = false;/* Lock to protect data accessed by all (e.g., ad_port->sm_vars) and -* against running with bond_3ad_unbind_slave. ad_rx_machine may run +* against running with bond_3ad_unbind_port. ad_rx_machine may run * concurrently due to incoming LACPDU as well. */ spin_lock_bh (&bond->mode_lock);rcu_read_lock (); -/* check if there are any slaves */ -if (!bond_has_slaves (bond)) +/* check if there are any ports */ +if (!bond_has_ports (bond)) goto re_arm;/* check if agg_select_timer timer after initialize is timed out */ if (BOND_AD_INFO (bond).agg_select_timer && !(--BOND_AD_INFO (bond).agg_select_timer)) { - slave =bond_first_slave_rcu (bond); - ad_port = slave ? &(SLAVE_AD_INFO (slave)->ad_port) :NULL ; + port =bond_first_port_rcu (bond); + ad_port = port ? &(PORT_AD_INFO (port)->ad_port) :NULL ;/* select the active aggregator for the bond */ if (ad_port) { -if (!ad_port->slave) { +if (!ad_port->port) {net_warn_ratelimited ("%s: Warning: bond's first port is uninitialized\n" , bond->dev->name); goto re_arm; } aggregator =__get_first_agg (ad_port); -ad_agg_selection_logic (aggregator, &update_slave_arr); +ad_agg_selection_logic (aggregator, &update_port_arr); }bond_3ad_set_carrier (bond); }/* for each ad_port run the state machines */ -bond_for_each_slave_rcu (bond, slave, iter) { - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); -if (!ad_port->slave) { +bond_for_each_port_rcu (bond, port, iter) { + ad_port = &(PORT_AD_INFO (port)->ad_port); +if (!ad_port->port) {net_warn_ratelimited ("%s: Warning: Found an uninitialized port\n" , bond->dev->name); goto re_arm;@@ -2323,8 +2323,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work)ad_rx_machine (NULL , ad_port);ad_periodic_machine (ad_port); -ad_port_selection_logic (ad_port, &update_slave_arr); -ad_mux_machine (ad_port, &update_slave_arr); +ad_port_selection_logic (ad_port, &update_port_arr); +ad_mux_machine (ad_port, &update_port_arr);ad_tx_machine (ad_port);ad_churn_machine (ad_port);@@ -2334,20 +2334,20 @@ void bond_3ad_state_machine_handler(struct work_struct *work) }
re_arm:drivers/net/bonding/bond_3ad.c +3
-3-bond_for_each_slave_rcu (bond, slave, iter) { -if (slave->should_notify) { - should_notify_rtnl =BOND_SLAVE_NOTIFY_NOW ; +bond_for_each_port_rcu (bond, port, iter) { +if (port->should_notify) { + should_notify_rtnl =BOND_PORT_NOTIFY_NOW ;break; } } rcu_read_unlock(); spin_unlock_bh(&bond->mode_lock);drivers/net/bonding/bond_3ad.c +2
-2-if (update_slave_arr) -bond_slave_arr_work_rearm (bond,0 ); +if (update_port_arr) +bond_port_arr_work_rearm (bond,0 );if (should_notify_rtnl && rtnl_trylock()) {drivers/net/bonding/bond_3ad.c +1
-1-bond_slave_state_notify (bond); +bond_port_state_notify (bond);rtnl_unlock(); } queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks);drivers/net/bonding/bond_3ad.c +65
-65@@ -2356,37 +2356,37 @@ void bond_3ad_state_machine_handler(struct work_struct *work)/** * bond_3ad_rx_indication - handle a received frame * @lacpdu: received lacpdu -* @slave: slave struct to work on +* @port: port struct to work on * * It is assumed that frames that were sent on this NIC don't returned as new * received frames (loopback). Since only the payload is given to this * function, it check for loopback. */ -static int bond_3ad_rx_indication (struct lacpdu *lacpdu,struct slave *slave) +static int bond_3ad_rx_indication (struct lacpdu *lacpdu,struct bond_port *port) { -struct bonding *bond = slave->bond; +struct bonding *bond = port->bond;int ret =RX_HANDLER_ANOTHER ;struct bond_marker *marker;struct ad_port *ad_port;atomic64_t *stat; - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); -if (!ad_port->slave) { -net_warn_ratelimited ("%s: Warning: port of slave %s is uninitialized\n" , - slave->dev->name, slave->bond->dev->name); + ad_port = &(PORT_AD_INFO (port)->ad_port); +if (!ad_port->port) { +net_warn_ratelimited ("%s: Warning: port of bond %s is uninitialized\n" , + port->dev->name, port->bond->dev->name);return ret; }switch (lacpdu->subtype) {case AD_TYPE_LACPDU : ret =RX_HANDLER_CONSUMED ; -slave_dbg (slave->bond->dev, slave->dev, -"Received LACPDU on port %d\n" , - ad_port->actor_port_number); +port_dbg (port->bond->dev, port->dev, +"Received LACPDU on port %d\n" , + ad_port->actor_port_number);/* Protect against concurrent state machines */ -spin_lock (&slave->bond->mode_lock); +spin_lock (&port->bond->mode_lock);ad_rx_machine (lacpdu, ad_port); -spin_unlock (&slave->bond->mode_lock); +spin_unlock (&port->bond->mode_lock);break ;case AD_TYPE_MARKER : ret =RX_HANDLER_CONSUMED ;@@ -2396,26 +2396,26 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave) marker = (struct bond_marker *)lacpdu;switch (marker->tlv_type) {case AD_MARKER_INFORMATION_SUBTYPE : -slave_dbg (slave->bond->dev, slave->dev,"Received Marker Information on port %d\n" , - ad_port->actor_port_number); +port_dbg (port->bond->dev, port->dev,"Received Marker Information on port %d\n" , + ad_port->actor_port_number);ad_marker_info_received (marker, ad_port);break ;case AD_MARKER_RESPONSE_SUBTYPE : -slave_dbg (slave->bond->dev, slave->dev,"Received Marker Response on port %d\n" , - ad_port->actor_port_number); +port_dbg (port->bond->dev, port->dev,"Received Marker Response on port %d\n" , + ad_port->actor_port_number);ad_marker_response_received (marker, ad_port);break ;default : -slave_dbg (slave->bond->dev, slave->dev,"Received an unknown Marker subtype on port %d\n" , - ad_port->actor_port_number); - stat = &SLAVE_AD_INFO (slave)->stats.marker_unknown_rx; +port_dbg (port->bond->dev, port->dev,"Received an unknown Marker subtype on port %d\n" , + ad_port->actor_port_number); + stat = &PORT_AD_INFO (port)->stats.marker_unknown_rx;atomic64_inc (stat); stat = &BOND_AD_INFO (bond).stats.marker_unknown_rx;atomic64_inc (stat); }break ;default : -atomic64_inc (&SLAVE_AD_INFO (slave)->stats.lacpdu_unknown_rx); +atomic64_inc (&PORT_AD_INFO (port)->stats.lacpdu_unknown_rx);atomic64_inc (&BOND_AD_INFO (bond).stats.lacpdu_unknown_rx); }@@ -2457,10 +2457,10 @@ static void ad_update_actor_keys(struct ad_port *ad_port, bool reset)if (!reset) {if (!speed) { -slave_err (ad_port->slave->bond->dev, - ad_port->slave->dev, -"speed changed to 0 on port %d\n" , - ad_port->actor_port_number); +port_err (ad_port->port->bond->dev, + ad_port->port->dev, +"speed changed to 0 on port %d\n" , + ad_port->actor_port_number); }else if (duplex && ospeed != speed) {/* Speed change restarts LACP state-machine */ ad_port->sm_vars |=AD_PORT_BEGIN ;@@ -2470,55 +2470,55 @@ static void ad_update_actor_keys(struct ad_port *ad_port, bool reset) }/** -* bond_3ad_adapter_speed_duplex_changed - handle a slave's speed / duplex +* bond_3ad_adapter_speed_duplex_changed - handle a port's speed / duplex * change indication * -* @slave: slave struct to work on +* @port: port struct to work on * * Handle reselection of aggregator (if needed) for this ad_port. */ -void bond_3ad_adapter_speed_duplex_changed (struct slave *slave) +void bond_3ad_adapter_speed_duplex_changed (struct bond_port *port) {struct ad_port *ad_port; - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); + ad_port = &(PORT_AD_INFO (port)->ad_port); -/* if slave is null, the whole ad_port is not initialized */ -if (!ad_port->slave) { -slave_warn (slave->bond->dev, slave->dev, -"speed/duplex changed for uninitialized port\n" ); +/* if port is null, the whole ad_port is not initialized */ +if (!ad_port->port) { +port_warn (port->bond->dev, port->dev, +"speed/duplex changed for uninitialized port\n" );return ; } -spin_lock_bh (&slave->bond->mode_lock); +spin_lock_bh (&port->bond->mode_lock);ad_update_actor_keys (ad_port, false); -spin_unlock_bh (&slave->bond->mode_lock); -slave_dbg (slave->bond->dev, slave->dev,"Port %d changed speed/duplex\n" , - ad_port->actor_port_number); +spin_unlock_bh (&port->bond->mode_lock); +port_dbg (port->bond->dev, port->dev,"Port %d changed speed/duplex\n" , + ad_port->actor_port_number); }/** -* bond_3ad_handle_link_change - handle a slave's link status change indication -* @slave: slave struct to work on +* bond_3ad_handle_link_change - handle a port's link status change indication +* @port: port struct to work on * @link: whether the link is now up or down * * Handle reselection of aggregator (if needed) for this ad_port. */ -void bond_3ad_handle_link_change (struct slave *slave,char link) +void bond_3ad_handle_link_change (struct bond_port *port,char link) {struct aggregator *agg;struct ad_port *ad_port;bool dummy; - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); + ad_port = &(PORT_AD_INFO (port)->ad_port); -/* if slave is null, the whole ad_port is not initialized */ -if (!ad_port->slave) { -slave_warn (slave->bond->dev, slave->dev,"link status changed for uninitialized port\n" ); +/* if port is null, the whole ad_port is not initialized */ +if (!ad_port->port) { +port_warn (port->bond->dev, port->dev,"link status changed for uninitialized port\n" );return ; } -spin_lock_bh (&slave->bond->mode_lock); +spin_lock_bh (&port->bond->mode_lock);/* on link down we are zeroing duplex and speed since * some of the adaptors(ce1000.lan) report full duplex/speed * instead of N/A(duplex) / 0(speed). @@ -2537,16 +2537,16 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) agg =__get_first_agg (ad_port);ad_agg_selection_logic (agg, &dummy); -spin_unlock_bh (&slave->bond->mode_lock); +spin_unlock_bh (&port->bond->mode_lock); -slave_dbg (slave->bond->dev, slave->dev,"Port %d changed link status to %s\n" , - ad_port->actor_port_number, - link ==BOND_LINK_UP ?"UP" :"DOWN" ); +port_dbg (port->bond->dev, port->dev,"Port %d changed link status to %s\n" , + ad_port->actor_port_number, + link ==BOND_LINK_UP ?"UP" :"DOWN" );/* RTNL is held and mode_lock is released so it's safe -* to update slave_array here. +* to update port_array here. */ -bond_update_slave_arr (slave->bond,NULL ); +bond_update_port_arr (port->bond,NULL ); }/** @@ -2555,7 +2555,7 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)* * if we have an active aggregator, we're up, if not, we're down. * Presumes that we cannot have an active aggregator if there are -* no slaves with link up. +* no ports with link up. * * This behavior complies with IEEE 802.3 section 43.3.9. * @@ -2565,18 +2565,18 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)int bond_3ad_set_carrier (struct bonding *bond) {struct aggregator *active; -struct slave *first_slave; +struct bond_port *first_port;int ret =1 ;rcu_read_lock (); - first_slave =bond_first_slave_rcu (bond); -if (!first_slave) { + first_port =bond_first_port_rcu (bond); +if (!first_port) { ret =0 ; goto out; } - active =__get_active_agg (&(SLAVE_AD_INFO (first_slave)->aggregator)); + active =__get_active_agg (&(PORT_AD_INFO (first_port)->aggregator));if (active) { -/* are enough slaves available to consider link up? */ +/* are enough ports available to consider link up? */ if (__agg_active_ad_ports (active) < bond->params.min_links) {if (netif_carrier_ok (bond->dev)) {netif_carrier_off (bond->dev);@@ -2607,11 +2607,11 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond, {struct aggregator *aggregator =NULL ;struct list_head *iter; -struct slave *slave; +struct bond_port *port;struct ad_port *ad_port; -bond_for_each_slave_rcu (bond, slave, iter) { - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); +bond_for_each_port_rcu (bond, port, iter) { + ad_port = &(PORT_AD_INFO (port)->ad_port);if (ad_port->aggregator && ad_port->aggregator->is_active) { aggregator = ad_port->aggregator;break ;@@ -2642,7 +2642,7 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) }int bond_3ad_lacpdu_recv (const struct sk_buff *skb,struct bonding *bond, -struct slave *slave) +struct bond_port *port) {struct lacpdu *lacpdu, _lacpdu;@@ -2654,12 +2654,12 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, lacpdu =skb_header_pointer (skb,0 ,sizeof (_lacpdu), &_lacpdu);if (!lacpdu) { -atomic64_inc (&SLAVE_AD_INFO (slave)->stats.lacpdu_illegal_rx); +atomic64_inc (&PORT_AD_INFO (port)->stats.lacpdu_illegal_rx);atomic64_inc (&BOND_AD_INFO (bond).stats.lacpdu_illegal_rx);return RX_HANDLER_ANOTHER ; } -return bond_3ad_rx_indication (lacpdu, slave); +return bond_3ad_rx_indication (lacpdu, port); }/** @@ -2677,13 +2677,13 @@ void bond_3ad_update_lacp_rate(struct bonding *bond) {struct ad_port *ad_port =NULL ;struct list_head *iter; -struct slave *slave; +struct bond_port *port;int lacp_fast; lacp_fast = bond->params.lacp_fast;spin_lock_bh (&bond->mode_lock); -bond_for_each_slave (bond, slave, iter) { - ad_port = &(SLAVE_AD_INFO (slave)->ad_port); +bond_for_each_port (bond, port, iter) { + ad_port = &(PORT_AD_INFO (port)->ad_port);if (lacp_fast) ad_port->actor_oper_port_state |=LACP_STATE_LACP_TIMEOUT ;else drivers/net/bonding/bond_alb.c +44
-44@@ -51,7 +51,7 @@ struct arp_pkt {#pragma pack()/* Forward declaration */ -static void alb_send_learning_packets (struct slave *slave,u8 mac_addr[], +static void alb_send_learning_packets (struct bond_port *port,u8 mac_addr[],bool strict_match);static void rlb_purge_src_ip (struct bonding *bond,struct arp_pkt *arp);static void rlb_src_unlink (struct bonding *bond,u32 index);@@ -79,29 +79,29 @@ static inline void tlb_init_table_entry(struct tlb_client_info *entry, int save_ entry->tx_bytes =0 ; } - entry->tx_slave =NULL ; + entry->tx_port =NULL ; entry->next =TLB_NULL_INDEX ; entry->prev =TLB_NULL_INDEX ; } -static inline void tlb_init_slave (struct slave *slave) +static inline void tlb_init_port (struct bond_port *port) { -SLAVE_TLB_INFO (slave).load =0 ; -SLAVE_TLB_INFO (slave).head =TLB_NULL_INDEX ; +PORT_TLB_INFO (port).load =0 ; +PORT_TLB_INFO (port).head =TLB_NULL_INDEX ; } -static void __tlb_clear_slave (struct bonding *bond,struct slave *slave, -int save_load) +static void __tlb_clear_port (struct bonding *bond,struct bond_port *port, +int save_load) {struct tlb_client_info *tx_hash_table;u32 index; -/* clear slave from tx_hashtbl */ +/* clear port from tx_hashtbl */ tx_hash_table =BOND_ALB_INFO (bond).tx_hashtbl;/* skip this if we've already freed the tx hash table */ if (tx_hash_table) { - index =SLAVE_TLB_INFO (slave).head; + index =PORT_TLB_INFO (port).head;while (index !=TLB_NULL_INDEX ) {u32 next_index = tx_hash_table[index].next;tlb_init_table_entry (&tx_hash_table[index], save_load);@@ -109,14 +109,14 @@ static void __tlb_clear_slave(struct bonding *bond, struct slave *slave, } } -tlb_init_slave (slave); +tlb_init_port (port); } -static void tlb_clear_slave (struct bonding *bond,struct slave *slave, -int save_load) +static void tlb_clear_port (struct bonding *bond,struct bond_port *port, +int save_load) {spin_lock_bh (&bond->mode_lock); -__tlb_clear_slave (bond, slave, save_load); +__tlb_clear_port (bond, port, save_load);spin_unlock_bh (&bond->mode_lock); }@@ -144,7 +144,7 @@ static int tlb_initialize(struct bonding *bond)return 0 ; } -/* Must be called only after all slaves have been released */ +/* Must be called only after all ports have been released */ static void tlb_deinitialize (struct bonding *bond) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));@@ -157,28 +157,28 @@ static void tlb_deinitialize(struct bonding *bond)spin_unlock_bh (&bond->mode_lock); } -static long long compute_gap (struct slave *slave) +static long long compute_gap (struct bond_port *port) { -return (s64) (slave->speed <<20 ) -/* Convert to Megabit per sec */ - (s64) (SLAVE_TLB_INFO (slave).load <<3 );/* Bytes to bits */ +return (s64) (port->speed <<20 ) -/* Convert to Megabit per sec */ + (s64) (PORT_TLB_INFO (port).load <<3 );/* Bytes to bits */ } -static struct slave *tlb_get_least_loaded_slave (struct bonding *bond) +static struct bond_port *tlb_get_least_loaded_port (struct bonding *bond) { -struct slave *slave, *least_loaded; +struct bond_port *port, *least_loaded;struct list_head *iter;long long max_gap; least_loaded =NULL ; max_gap =LLONG_MIN ; -/* Find the slave with the largest gap */ -bond_for_each_slave_rcu (bond, slave, iter) { -if (bond_slave_can_tx (slave)) { -long long gap =compute_gap (slave); +/* Find the port with the largest gap */ +bond_for_each_port_rcu (bond, port, iter) { +if (bond_port_can_tx (port)) { +long long gap =compute_gap (port);if (max_gap < gap) { - least_loaded = slave; + least_loaded = port; max_gap = gap; } }@@ -187,56 +187,56 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)return least_loaded; } -static struct slave *__tlb_choose_channel (struct bonding *bond,u32 hash_index, +static struct bond_port *__tlb_choose_channel (struct bonding *bond,u32 hash_index,u32 skb_len) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));struct tlb_client_info *hash_table; -struct slave *assigned_slave; +struct bond_port *assigned_port; hash_table = bond_info->tx_hashtbl; - assigned_slave = hash_table[hash_index].tx_slave; -if (!assigned_slave) { - assigned_slave =tlb_get_least_loaded_slave (bond); + assigned_port = hash_table[hash_index].tx_port; +if (!assigned_port) { + assigned_port =tlb_get_least_loaded_port (bond); -if (assigned_slave) { -struct tlb_slave_info *slave_info = - &(SLAVE_TLB_INFO (assigned_slave)); -u32 next_index = slave_info->head; +if (assigned_port) { +struct tlb_port_info *port_info = + &(PORT_TLB_INFO (assigned_port)); +u32 next_index = port_info->head; - hash_table[hash_index].tx_slave = assigned_slave; + hash_table[hash_index].tx_port = assigned_port; hash_table[hash_index].next = next_index; hash_table[hash_index].prev =TLB_NULL_INDEX ;if (next_index !=TLB_NULL_INDEX ) hash_table[next_index].prev = hash_index; - slave_info->head = hash_index; - slave_info->load += + port_info->head = hash_index; + port_info->load += hash_table[hash_index].load_history; } } -if (assigned_slave) +if (assigned_port) hash_table[hash_index].tx_bytes += skb_len; -return assigned_slave; +return assigned_port; } -static struct slave *tlb_choose_channel (struct bonding *bond,u32 hash_index, +static struct bond_port *tlb_choose_channel (struct bonding *bond,u32 hash_index,u32 skb_len) { -struct slave *tx_slave; +struct bond_port *tx_port;/* We don't need to disable softirq here, becase * tlb_choose_channel() is only called by bond_alb_xmit() * which already has softirq disabled. */ spin_lock (&bond->mode_lock); - tx_slave =__tlb_choose_channel (bond, hash_index, skb_len); + tx_port =__tlb_choose_channel (bond, hash_index, skb_len);spin_unlock (&bond->mode_lock); -return tx_slave; +return tx_port; }/*********************** rlb specific functions ***************************/ @@ -269,7 +269,7 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) }static int rlb_arp_recv (const struct sk_buff *skb,struct bonding *bond, -struct slave *slave) +struct bond_port *port) {struct arp_pkt *arp, _arp;@@ -295,67 +295,67 @@ static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond,if (arp->op_code ==htons (ARPOP_REPLY )) {/* update rx hash table for this ARP */ rlb_update_entry_from_arp (bond, arp); -slave_dbg (bond->dev, slave->dev,"Server received an ARP Reply from client\n" ); +port_dbg (bond->dev, port->dev,"Server received an ARP Reply from client\n" ); }out:
return RX_HANDLER_ANOTHER; }/* Caller must hold
rcu_read_lock()*/drivers/net/bonding/bond_alb.c +1
-1-static struct slave *__rlb_next_rx_slave (struct bonding *bond) +static struct bond_port *__rlb_next_rx_port (struct bonding *bond){ struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));drivers/net/bonding/bond_alb.c +1
-1-struct slave *before =NULL , *rx_slave =NULL , *slave; +struct bond_port *before =NULL , *rx_port =NULL , *port;struct list_head *iter; bool found = false;drivers/net/bonding/bond_alb.c +2
-2-bond_for_each_slave_rcu (bond, slave, iter) { -if (!bond_slave_can_tx (slave)) +bond_for_each_port_rcu (bond, port, iter) { +if (!bond_port_can_tx (port))continue; if (!found) {drivers/net/bonding/bond_alb.c +2
-2-if (!before || before->speed < slave->speed) - before = slave; +if (!before || before->speed < port->speed) + before = port;} else {drivers/net/bonding/bond_alb.c +2
-2-if (!rx_slave || rx_slave->speed < slave->speed) - rx_slave = slave; +if (!rx_port || rx_port->speed < port->speed) + rx_port = port;}drivers/net/bonding/bond_alb.c +1
-1-if (slave == bond_info->rx_slave) +if (port == bond_info->rx_port)found = true; } /* we didn't find anything after the current or we have somethingdrivers/net/bonding/bond_alb.c +1
-1-* better before and up to the current slave +* better before and up to the current port */drivers/net/bonding/bond_alb.c +5
-5-if (!rx_slave || (before && rx_slave->speed < before->speed)) - rx_slave = before; +if (!rx_port || (before && rx_port->speed < before->speed)) + rx_port = before; -if (rx_slave) - bond_info->rx_slave = rx_slave; +if (rx_port) + bond_info->rx_port = rx_port; -return rx_slave; +return rx_port;}
/* Caller must hold RTNL,
rcu_read_lockis obtained only to silence checkers */drivers/net/bonding/bond_alb.c +1
-1-static struct slave *rlb_next_rx_slave (struct bonding *bond) +static struct bond_port *rlb_next_rx_port (struct bonding *bond){
drivers/net/bonding/bond_alb.c +1
-1-struct slave *rx_slave; +struct bond_port *rx_port;ASSERT_RTNL(); rcu_read_lock();drivers/net/bonding/bond_alb.c +1
-1- rx_slave =__rlb_next_rx_slave (bond); + rx_port =__rlb_next_rx_port (bond);rcu_read_unlock();drivers/net/bonding/bond_alb.c +1
-1-return rx_slave; +return rx_port;}
drivers/net/bonding/bond_alb.c +1
-1-/* teach the switch the mac of a disabled slave +/* teach the switch the mac of a disabled port * on the primary for fault tolerance * * Caller must hold RTNL */ static void
rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[]){drivers/net/bonding/bond_alb.c +1
-1-struct slave *curr_active =rtnl_dereference (bond->curr_active_slave); +struct bond_port *curr_active =rtnl_dereference (bond->curr_active_port);if (!curr_active) return;drivers/net/bonding/bond_alb.c +280
-279@@ -372,32 +372,32 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])alb_send_learning_packets (curr_active, addr, true); } -/* slave being removed should not be active at this point +/* port being removed should not be active at this point * * Caller must hold rtnl. */ -static void rlb_clear_slave (struct bonding *bond,struct slave *slave) +static void rlb_clear_port (struct bonding *bond,struct bond_port *port) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));struct rlb_client_info *rx_hash_table;u32 index, next_index; -/* clear slave from rx_hashtbl */ +/* clear port from rx_hashtbl */ spin_lock_bh (&bond->mode_lock); rx_hash_table = bond_info->rx_hashtbl; index = bond_info->rx_hashtbl_used_head;for (; index !=RLB_NULL_INDEX ; index = next_index) { next_index = rx_hash_table[index].used_next; -if (rx_hash_table[index].slave == slave) { -struct slave *assigned_slave =rlb_next_rx_slave (bond); +if (rx_hash_table[index].port == port) { +struct bond_port *assigned_port =rlb_next_rx_port (bond); -if (assigned_slave) { - rx_hash_table[index].slave = assigned_slave; +if (assigned_port) { + rx_hash_table[index].port = assigned_port;if (is_valid_ether_addr (rx_hash_table[index].mac_dst)) { bond_info->rx_hashtbl[index].ntt =1 ; bond_info->rx_ntt =1 ; -/* A slave has been removed from the +/* A port has been removed from the * table because it is either disabled * or being released. We must retry the * update to avoid clients from not @@ -407,23 +407,23 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave) bond_info->rlb_update_retry_counter =RLB_UPDATE_RETRY ; } - }else {/* there is no active slave */ - rx_hash_table[index].slave =NULL ; + }else {/* there is no active port */ + rx_hash_table[index].port =NULL ; } } }spin_unlock_bh (&bond->mode_lock); -if (slave !=rtnl_dereference (bond->curr_active_slave)) -rlb_teach_disabled_mac_on_primary (bond, slave->dev->dev_addr); +if (port !=rtnl_dereference (bond->curr_active_port)) +rlb_teach_disabled_mac_on_primary (bond, port->dev->dev_addr); }static void rlb_update_client (struct rlb_client_info *client_info) {int i; -if (!client_info->slave || !is_valid_ether_addr (client_info->mac_dst)) +if (!client_info->port || !is_valid_ether_addr (client_info->mac_dst))return ;for (i =0 ; i <RLB_ARP_BURST_SIZE ; i++) {@@ -431,19 +431,19 @@ static void rlb_update_client(struct rlb_client_info *client_info) skb =arp_create (ARPOP_REPLY ,ETH_P_ARP , client_info->ip_dst, - client_info->slave->dev, + client_info->port->dev, client_info->ip_src, client_info->mac_dst, - client_info->slave->dev->dev_addr, + client_info->port->dev->dev_addr, client_info->mac_dst);if (!skb) { -slave_err (client_info->slave->bond->dev, - client_info->slave->dev, -"failed to create an ARP packet\n" ); +port_err (client_info->port->bond->dev, + client_info->port->dev, +"failed to create an ARP packet\n" );continue ; } - skb->dev = client_info->slave->dev; + skb->dev = client_info->port->dev;if (client_info->vlan_id) { __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),@@ -482,8 +482,8 @@ static void rlb_update_rx_clients(struct bonding *bond)spin_unlock_bh (&bond->mode_lock); } -/* The slave was assigned a new mac address - update the clients */ -static void rlb_req_update_slave_clients (struct bonding *bond,struct slave *slave) +/* The port was assigned a new mac address - update the clients */ +static void rlb_req_update_port_clients (struct bonding *bond,struct bond_port *port) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));struct rlb_client_info *client_info;@@ -497,7 +497,7 @@ static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *sla hash_index = client_info->used_next) { client_info = &(bond_info->rx_hashtbl[hash_index]); -if ((client_info->slave == slave) && +if ((client_info->port == port) &&is_valid_ether_addr (client_info->mac_dst)) { client_info->ntt =1 ; ntt =1 ;@@ -528,16 +528,16 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) hash_index = client_info->used_next) { client_info = &(bond_info->rx_hashtbl[hash_index]); -if (!client_info->slave) { +if (!client_info->port) {netdev_err (bond->dev,"found a client with no channel in the client's hash table\n" );continue ; }/* update all clients using this src_ip, that are not assigned -* to the team's address (curr_active_slave) and have a known +* to the team's address (curr_active_port) and have a known * unicast mac address. */ if ((client_info->ip_src == src_ip) && - !ether_addr_equal_64bits (client_info->slave->dev->dev_addr, + !ether_addr_equal_64bits (client_info->port->dev->dev_addr, bond->dev->dev_addr) &&is_valid_ether_addr (client_info->mac_dst)) { client_info->ntt =1 ;@@ -548,18 +548,18 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip)spin_unlock (&bond->mode_lock); } -static struct slave *rlb_choose_channel (struct sk_buff *skb, +static struct bond_port *rlb_choose_channel (struct sk_buff *skb,struct bonding *bond,const struct arp_pkt *arp) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond)); -struct slave *assigned_slave, *curr_active_slave; +struct bond_port *assigned_port, *curr_active_port;struct rlb_client_info *client_info;u32 hash_index =0 ;spin_lock (&bond->mode_lock); - curr_active_slave =rcu_dereference (bond->curr_active_slave); + curr_active_port =rcu_dereference (bond->curr_active_port); hash_index =_simple_hash ((u8 *)&arp->ip_dst,sizeof (arp->ip_dst)); client_info = &(bond_info->rx_hashtbl[hash_index]);@@ -574,27 +574,27 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, }ether_addr_copy (client_info->mac_src, arp->mac_src); - assigned_slave = client_info->slave; -if (assigned_slave) { + assigned_port = client_info->port; +if (assigned_port) {spin_unlock (&bond->mode_lock); -return assigned_slave; +return assigned_port; } }else {/* the entry is already assigned to some other client, -* move the old client to primary (curr_active_slave) so +* move the old client to primary (curr_active_port) so * that the new client can be assigned to this entry. */ -if (curr_active_slave && - client_info->slave != curr_active_slave) { - client_info->slave = curr_active_slave; +if (curr_active_port && + client_info->port != curr_active_port) { + client_info->port = curr_active_port;rlb_update_client (client_info); } } } -/* assign a new slave */ - assigned_slave =__rlb_next_rx_slave (bond); +/* assign a new port */ + assigned_port =__rlb_next_rx_port (bond); -if (assigned_slave) { +if (assigned_port) {if (!(client_info->assigned && client_info->ip_src == arp->ip_src)) {/* ip_src is going to be updated, @@ -614,7 +614,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb,*/ ether_addr_copy (client_info->mac_dst, arp->mac_dst);ether_addr_copy (client_info->mac_src, arp->mac_src); - client_info->slave = assigned_slave; + client_info->port = assigned_port;if (is_valid_ether_addr (client_info->mac_dst)) { client_info->ntt =1 ;@@ -640,16 +640,16 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb,spin_unlock (&bond->mode_lock); -return assigned_slave; +return assigned_port; }/* chooses (and returns) transmit channel for arp reply * does not choose channel for other arp types since they are -* sent on the curr_active_slave +* sent on the curr_active_port */ -static struct slave *rlb_arp_xmit (struct sk_buff *skb,struct bonding *bond) +static struct bond_port *rlb_arp_xmit (struct sk_buff *skb,struct bonding *bond) { -struct slave *tx_slave =NULL ; +struct bond_port *tx_port =NULL ;struct arp_pkt *arp;if (!pskb_network_may_pull (skb,sizeof (*arp)))@@ -659,24 +659,24 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)/* Don't modify or load balance ARPs that do not originate locally * (e.g.,arrive via a bridge). */ -if (!bond_slave_has_mac_rx (bond, arp->mac_src)) +if (!bond_port_has_mac_rx (bond, arp->mac_src))return NULL ;if (arp->op_code ==htons (ARPOP_REPLY )) {/* the arp must be sent on the selected rx channel */ - tx_slave =rlb_choose_channel (skb, bond, arp); -if (tx_slave) -bond_hw_addr_copy (arp->mac_src, tx_slave->dev->dev_addr, - tx_slave->dev->addr_len); -netdev_dbg (bond->dev,"(slave %s): Server sent ARP Reply packet\n" , - tx_slave ? tx_slave->dev->name :"NULL" ); + tx_port =rlb_choose_channel (skb, bond, arp); +if (tx_port) +bond_hw_addr_copy (arp->mac_src, tx_port->dev->dev_addr, + tx_port->dev->addr_len); +netdev_dbg (bond->dev,"(port %s): Server sent ARP Reply packet\n" , + tx_port ? tx_port->dev->name :"NULL" ); }else if (arp->op_code ==htons (ARPOP_REQUEST )) {/* Create an entry in the rx_hashtbl for this client as a * place holder. * When the arp reply is received the entry will be updated * with the correct unicast address of the client. */ - tx_slave =rlb_choose_channel (skb, bond, arp); + tx_port =rlb_choose_channel (skb, bond, arp);/* The ARP reply packets must be delayed so that * they can cancel out the influence of the ARP request. @@ -685,21 +685,21 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)/* arp requests are broadcast and are sent on the primary * the arp request will collapse all clients on the subnet to -* the primary slave. We must register these clients to be +* the primary port. We must register these clients to be * updated with their assigned mac. */ rlb_req_update_subnet_clients (bond, arp->ip_src); -netdev_dbg (bond->dev,"(slave %s): Server sent ARP Request packet\n" , - tx_slave ? tx_slave->dev->name :"NULL" ); +netdev_dbg (bond->dev,"(port %s): Server sent ARP Request packet\n" , + tx_port ? tx_port->dev->name :"NULL" ); } -return tx_slave; +return tx_port; }static void rlb_rebalance (struct bonding *bond) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond)); -struct slave *assigned_slave; +struct bond_port *assigned_port;struct rlb_client_info *client_info;int ntt;u32 hash_index;@@ -711,9 +711,9 @@ static void rlb_rebalance(struct bonding *bond)for (; hash_index !=RLB_NULL_INDEX ; hash_index = client_info->used_next) { client_info = &(bond_info->rx_hashtbl[hash_index]); - assigned_slave =__rlb_next_rx_slave (bond); -if (assigned_slave && (client_info->slave != assigned_slave)) { - client_info->slave = assigned_slave; + assigned_port =__rlb_next_rx_port (bond); +if (assigned_port && (client_info->port != assigned_port)) { + client_info->port = assigned_port;if (!is_zero_ether_addr (client_info->mac_dst)) { client_info->ntt =1 ; ntt =1 ;@@ -733,7 +733,7 @@ static void rlb_init_table_entry_dst(struct rlb_client_info *entry) entry->used_next =RLB_NULL_INDEX ; entry->used_prev =RLB_NULL_INDEX ; entry->assigned =0 ; - entry->slave =NULL ; + entry->port =NULL ; entry->vlan_id =0 ; }static void rlb_init_table_entry_src (struct rlb_client_info *entry)@@ -902,7 +902,7 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id)/*********************** tlb/rlb shared functions *********************/ -static void alb_send_lp_vid (struct slave *slave,u8 mac_addr[], +static void alb_send_lp_vid (struct bond_port *port,u8 mac_addr[],__be16 vlan_proto,u16 vid) {struct learning_pkt pkt;@@ -924,10 +924,10 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], skb->network_header = skb->mac_header +ETH_HLEN ; skb->protocol = pkt.type; skb->priority =TC_PRIO_CONTROL ; - skb->dev = slave->dev; + skb->dev = port->dev; -slave_dbg (slave->bond->dev, slave->dev, -"Send learning packet: mac %pM vlan %d\n" , mac_addr, vid); +port_dbg (port->bond->dev, port->dev, +"Send learning packet: mac %pM vlan %d\n" , mac_addr, vid);if (vid)__vlan_hwaccel_put_tag (skb, vlan_proto, vid);@@ -937,7 +937,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],struct alb_walk_data {struct bonding *bond; -struct slave *slave; +struct bond_port *port;u8 *mac_addr;bool strict_match; };@@ -948,18 +948,18 @@ static int alb_upper_dev_walk(struct net_device *upper,struct alb_walk_data *data = (struct alb_walk_data *)priv->data;bool strict_match = data->strict_match;struct bonding *bond = data->bond; -struct slave *slave = data->slave; +struct bond_port *port = data->port;u8 *mac_addr = data->mac_addr;struct bond_vlan_tag *tags;if (is_vlan_dev (upper) && bond->dev->lower_level == upper->lower_level -1 ) {if (upper->addr_assign_type ==NET_ADDR_STOLEN ) { -alb_send_lp_vid (slave, mac_addr, +alb_send_lp_vid (port, mac_addr,vlan_dev_vlan_proto (upper),vlan_dev_vlan_id (upper)); }else { -alb_send_lp_vid (slave, upper->dev_addr, +alb_send_lp_vid (port, upper->dev_addr,vlan_dev_vlan_proto (upper),vlan_dev_vlan_id (upper)); }@@ -972,7 +972,7 @@ static int alb_upper_dev_walk(struct net_device *upper, tags =bond_verify_device_path (bond->dev, upper,0 );if (IS_ERR_OR_NULL (tags))BUG (); -alb_send_lp_vid (slave, upper->dev_addr, +alb_send_lp_vid (port, upper->dev_addr, tags[0 ].vlan_proto, tags[0 ].vlan_id);kfree (tags); }@@ -980,21 +980,21 @@ static int alb_upper_dev_walk(struct net_device *upper,return 0 ; } -static void alb_send_learning_packets (struct slave *slave,u8 mac_addr[], +static void alb_send_learning_packets (struct bond_port *port,u8 mac_addr[],bool strict_match) { -struct bonding *bond =bond_get_bond_by_slave (slave); +struct bonding *bond =bond_get_bond_by_port (port);struct netdev_nested_priv priv;struct alb_walk_data data = { .strict_match = strict_match, .mac_addr = mac_addr, - .slave = slave, + .port = port, .bond = bond, }; priv.data = (void *)&data;/* send untagged */ -alb_send_lp_vid (slave, mac_addr,0 ,0 ); +alb_send_lp_vid (port, mac_addr,0 ,0 );/* loop through all devices and see if we need to send a packet * for that device. @@ -1004,43 +1004,43 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],rcu_read_unlock (); } -static int alb_set_slave_mac_addr (struct slave *slave,u8 addr[], +static int alb_set_port_mac_addr (struct bond_port *port,u8 addr[],unsigned int len) { -struct net_device *dev = slave->dev; +struct net_device *dev = port->dev;struct sockaddr_storage ss; -if (BOND_MODE (slave->bond) ==BOND_MODE_TLB ) { +if (BOND_MODE (port->bond) ==BOND_MODE_TLB ) {memcpy (dev->dev_addr, addr, len);return 0 ; } -/* for rlb each slave must have a unique hw mac addresses so that -* each slave will receive packets destined to a different mac +/* for rlb each port must have a unique hw mac addresses so that +* each port will receive packets destined to a different mac */ memcpy (ss.__data, addr, len); ss.ss_family = dev->type;if (dev_set_mac_address (dev, (struct sockaddr *)&ss,NULL )) { -slave_err (slave->bond->dev, dev,"dev_set_mac_address on slave failed! ALB mode requires that the base driver support setting the hw address also when the network device's interface is open\n" ); +port_err (port->bond->dev, dev,"dev_set_mac_address on port failed! ALB mode requires that the base driver support setting the hw address also when the network device's interface is open\n" );return -EOPNOTSUPP ; }return 0 ; } -/* Swap MAC addresses between two slaves. +/* Swap MAC addresses between two ports. * * Called with RTNL held, and no other locks. */ -static void alb_swap_mac_addr (struct slave *slave1,struct slave *slave2) +static void alb_swap_mac_addr (struct bond_port *port1,struct bond_port *port2) {u8 tmp_mac_addr[MAX_ADDR_LEN ]; -bond_hw_addr_copy (tmp_mac_addr, slave1->dev->dev_addr, - slave1->dev->addr_len); -alb_set_slave_mac_addr (slave1, slave2->dev->dev_addr, - slave2->dev->addr_len); -alb_set_slave_mac_addr (slave2, tmp_mac_addr, - slave1->dev->addr_len); +bond_hw_addr_copy (tmp_mac_addr, port1->dev->dev_addr, + port1->dev->addr_len); +alb_set_port_mac_addr (port1, port2->dev->dev_addr, + port2->dev->addr_len); +alb_set_port_mac_addr (port2, tmp_mac_addr, + port1->dev->addr_len); }@@ -1048,77 +1048,77 @@ static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)* * Called with RTNL and no other locks */ -static void alb_fasten_mac_swap (struct bonding *bond,struct slave *slave1, -struct slave *slave2) +static void alb_fasten_mac_swap (struct bonding *bond,struct bond_port *port1, +struct bond_port *port2) { -int slaves_state_differ = (bond_slave_can_tx (slave1) !=bond_slave_can_tx (slave2)); -struct slave *disabled_slave =NULL ; +int ports_state_differ = (bond_port_can_tx (port1) !=bond_port_can_tx (port2)); +struct bond_port *disabled_port =NULL ;ASSERT_RTNL ();/* fasten the change in the switch */ -if (bond_slave_can_tx (slave1)) { -alb_send_learning_packets (slave1, slave1->dev->dev_addr, false); +if (bond_port_can_tx (port1)) { +alb_send_learning_packets (port1, port1->dev->dev_addr, false);if (bond->alb_info.rlb_enabled) {/* inform the clients that the mac address * has changed */ -rlb_req_update_slave_clients (bond, slave1); +rlb_req_update_port_clients (bond, port1); } }else { - disabled_slave = slave1; + disabled_port = port1; } -if (bond_slave_can_tx (slave2)) { -alb_send_learning_packets (slave2, slave2->dev->dev_addr, false); +if (bond_port_can_tx (port2)) { +alb_send_learning_packets (port2, port2->dev->dev_addr, false);if (bond->alb_info.rlb_enabled) {/* inform the clients that the mac address * has changed */ -rlb_req_update_slave_clients (bond, slave2); +rlb_req_update_port_clients (bond, port2); } }else { - disabled_slave = slave2; + disabled_port = port2; } -if (bond->alb_info.rlb_enabled && slaves_state_differ) { -/* A disabled slave was assigned an active mac addr */ +if (bond->alb_info.rlb_enabled && ports_state_differ) { +/* A disabled port was assigned an active mac addr */ rlb_teach_disabled_mac_on_primary (bond, - disabled_slave->dev->dev_addr); + disabled_port->dev->dev_addr); } }/** * alb_change_hw_addr_on_detach * @bond: bonding we're working on -* @slave: the slave that was just detached +* @port: the port that was just detached * -* We assume that @slave was already detached from the slave list. +* We assume that @port was already detached from the port list. * -* If @slave's permanent hw address is different both from its current +* If @port's permanent hw address is different both from its current * address and from @bond's address, then somewhere in the bond there's -* a slave that has @slave's permanet address as its current address. -* We'll make sure that that slave no longer uses @slave's permanent address. +* a port that has @port's permanet address as its current address. +* We'll make sure that that port no longer uses @port's permanent address. * * Caller must hold RTNL and no other locks */ -static void alb_change_hw_addr_on_detach (struct bonding *bond,struct slave *slave) +static void alb_change_hw_addr_on_detach (struct bonding *bond,struct bond_port *port) {int perm_curr_diff;int perm_bond_diff; -struct slave *found_slave; +struct bond_port *found_port; - perm_curr_diff = !ether_addr_equal_64bits (slave->perm_hwaddr, - slave->dev->dev_addr); - perm_bond_diff = !ether_addr_equal_64bits (slave->perm_hwaddr, + perm_curr_diff = !ether_addr_equal_64bits (port->perm_hwaddr, + port->dev->dev_addr); + perm_bond_diff = !ether_addr_equal_64bits (port->perm_hwaddr, bond->dev->dev_addr);if (perm_curr_diff && perm_bond_diff) { - found_slave =bond_slave_has_mac (bond, slave->perm_hwaddr); + found_port =bond_port_has_mac (bond, port->perm_hwaddr); -if (found_slave) { -alb_swap_mac_addr (slave, found_slave); -alb_fasten_mac_swap (bond, slave, found_slave); +if (found_port) { +alb_swap_mac_addr (port, found_port); +alb_fasten_mac_swap (bond, port, found_port); } } }@@ -1126,81 +1126,81 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla/** * alb_handle_addr_collision_on_attach * @bond: bonding we're working on -* @slave: the slave that was just attached +* @port: the port that was just attached * -* checks uniqueness of slave's mac address and handles the case the -* new slave uses the bonds mac address. +* checks uniqueness of port's mac address and handles the case the +* new port uses the bonds mac address. * -* If the permanent hw address of @slave is @bond's hw address, we need to -* find a different hw address to give @slave, that isn't in use by any other -* slave in the bond. This address must be, of course, one of the permanent -* addresses of the other slaves. +* If the permanent hw address of @port is @bond's hw address, we need to +* find a different hw address to give @port, that isn't in use by any other +* port in the bond. This address must be, of course, one of the permanent +* addresses of the other ports. * -* We go over the slave list, and for each slave there we compare its -* permanent hw address with the current address of all the other slaves. -* If no match was found, then we've found a slave with a permanent address -* that isn't used by any other slave in the bond, so we can assign it to -* @slave. +* We go over the port list, and for each port there we compare its +* permanent hw address with the current address of all the other ports. +* If no match was found, then we've found a port with a permanent address +* that isn't used by any other port in the bond, so we can assign it to +* @port. * -* assumption: this function is called before @slave is attached to the -* bond slave list. +* assumption: this function is called before @port is attached to the +* bond port list. */ -static int alb_handle_addr_collision_on_attach (struct bonding *bond,struct slave *slave) +static int alb_handle_addr_collision_on_attach (struct bonding *bond,struct bond_port *port) { -struct slave *has_bond_addr =rcu_access_pointer (bond->curr_active_slave); -struct slave *tmp_slave1, *free_mac_slave =NULL ; +struct bond_port *has_bond_addr =rcu_access_pointer (bond->curr_active_port); +struct bond_port *tmp_port1, *free_mac_port =NULL ;struct list_head *iter; -if (!bond_has_slaves (bond)) { -/* this is the first slave */ +if (!bond_has_ports (bond)) { +/* this is the first port */ return 0 ; } -/* if slave's mac address differs from bond's mac address -* check uniqueness of slave's mac address against the other -* slaves in the bond. +/* if port's mac address differs from bond's mac address +* check uniqueness of port's mac address against the other +* ports in the bond. */ -if (!ether_addr_equal_64bits (slave->perm_hwaddr, bond->dev->dev_addr)) { -if (!bond_slave_has_mac (bond, slave->dev->dev_addr)) +if (!ether_addr_equal_64bits (port->perm_hwaddr, bond->dev->dev_addr)) { +if (!bond_port_has_mac (bond, port->dev->dev_addr))return 0 ; -/* Try setting slave mac to bond address and fall-through +/* Try setting port mac to bond address and fall-through * to code handling that situation below... */ -alb_set_slave_mac_addr (slave, bond->dev->dev_addr, +alb_set_port_mac_addr (port, bond->dev->dev_addr, bond->dev->addr_len); } -/* The slave's address is equal to the address of the bond. -* Search for a spare address in the bond for this slave. +/* The port's address is equal to the address of the bond. +* Search for a spare address in the bond for this port. */ -bond_for_each_slave (bond, tmp_slave1, iter) { -if (!bond_slave_has_mac (bond, tmp_slave1->perm_hwaddr)) { -/* no slave has tmp_slave1's perm addr +bond_for_each_port (bond, tmp_port1, iter) { +if (!bond_port_has_mac (bond, tmp_port1->perm_hwaddr)) { +/* no port has tmp_port1's perm addr * as its curr addr */ - free_mac_slave = tmp_slave1; + free_mac_port = tmp_port1;break ; }if (!has_bond_addr) { -if (ether_addr_equal_64bits (tmp_slave1->dev->dev_addr, +if (ether_addr_equal_64bits (tmp_port1->dev->dev_addr, bond->dev->dev_addr)) { - has_bond_addr = tmp_slave1; + has_bond_addr = tmp_port1; } } } -if (free_mac_slave) { -alb_set_slave_mac_addr (slave, free_mac_slave->perm_hwaddr, - free_mac_slave->dev->addr_len); +if (free_mac_port) { +alb_set_port_mac_addr (port, free_mac_port->perm_hwaddr, + free_mac_port->dev->addr_len); -slave_warn (bond->dev, slave->dev,"the slave hw address is in use by the bond; giving it the hw address of %s\n" , - free_mac_slave->dev->name); +port_warn (bond->dev, port->dev,"the port hw address is in use by the bond; giving it the hw address of %s\n" , + free_mac_port->dev->name); }else if (has_bond_addr) { -slave_err (bond->dev, slave->dev,"the slave hw address is in use by the bond; couldn't find a slave with a free hw address to give it (this should not have happened)\n" ); +port_err (bond->dev, port->dev,"the port hw address is in use by the bond; couldn't find a port with a free hw address to give it (this should not have happened)\n" );return -EFAULT ; }@@ -1212,18 +1212,18 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav* @bond: bonding we're working on * @addr: MAC address to set * -* In TLB mode all slaves are configured to the bond's hw address, but set +* In TLB mode all ports are configured to the bond's hw address, but set * their dev_addr field to different addresses (based on their permanent hw * addresses). * -* For each slave, this function sets the interface to the new address and then +* For each port, this function sets the interface to the new address and then * changes its dev_addr field to its previous value. * * Unwinding assumes bond's mac address has not yet changed. */ static int alb_set_mac_address (struct bonding *bond,void *addr) { -struct slave *slave, *rollback_slave; +struct bond_port *port, *rollback_port;struct list_head *iter;struct sockaddr_storage ss;char tmp_addr[MAX_ADDR_LEN ];@@ -1232,16 +1232,16 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)if (bond->alb_info.rlb_enabled)return 0 ; -bond_for_each_slave (bond, slave, iter) { +bond_for_each_port (bond, port, iter) {/* save net_device's current hw address */ -bond_hw_addr_copy (tmp_addr, slave->dev->dev_addr, - slave->dev->addr_len); +bond_hw_addr_copy (tmp_addr, port->dev->dev_addr, + port->dev->addr_len); - res =dev_set_mac_address (slave->dev, addr,NULL ); + res =dev_set_mac_address (port->dev, addr,NULL );/* restore net_device's hw address */ -bond_hw_addr_copy (slave->dev->dev_addr, tmp_addr, - slave->dev->addr_len); +bond_hw_addr_copy (port->dev->dev_addr, tmp_addr, + port->dev->addr_len);if (res) goto unwind;@@ -1253,16 +1253,16 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)memcpy (ss.__data, bond->dev->dev_addr, bond->dev->addr_len); ss.ss_family = bond->dev->type; -/* unwind from head to the slave that failed */ -bond_for_each_slave (bond, rollback_slave, iter) { -if (rollback_slave == slave) +/* unwind from head to the port that failed */ +bond_for_each_port (bond, rollback_port, iter) { +if (rollback_port == port)break ; -bond_hw_addr_copy (tmp_addr, rollback_slave->dev->dev_addr, - rollback_slave->dev->addr_len); -dev_set_mac_address (rollback_slave->dev, +bond_hw_addr_copy (tmp_addr, rollback_port->dev->dev_addr, + rollback_port->dev->addr_len); +dev_set_mac_address (rollback_port->dev, (struct sockaddr *)&ss,NULL ); -bond_hw_addr_copy (rollback_slave->dev->dev_addr, tmp_addr, - rollback_slave->dev->addr_len); +bond_hw_addr_copy (rollback_port->dev->dev_addr, tmp_addr, + rollback_port->dev->addr_len); }return res;@@ -1303,30 +1303,30 @@ void bond_alb_deinitialize(struct bonding *bond) }static netdev_tx_t bond_do_alb_xmit (struct sk_buff *skb,struct bonding *bond, -struct slave *tx_slave) +struct bond_port *tx_port) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));struct ethhdr *eth_data =eth_hdr (skb); -if (!tx_slave) { +if (!tx_port) {/* unbalanced or unassigned, send through primary */ - tx_slave =rcu_dereference (bond->curr_active_slave); + tx_port =rcu_dereference (bond->curr_active_port);if (bond->params.tlb_dynamic_lb) bond_info->unbalanced_load += skb->len; } -if (tx_slave &&bond_slave_can_tx (tx_slave)) { -if (tx_slave !=rcu_access_pointer (bond->curr_active_slave)) { +if (tx_port &&bond_port_can_tx (tx_port)) { +if (tx_port !=rcu_access_pointer (bond->curr_active_port)) {ether_addr_copy (eth_data->h_source, - tx_slave->dev->dev_addr); + tx_port->dev->dev_addr); } -return bond_dev_queue_xmit (bond, skb, tx_slave->dev); +return bond_dev_queue_xmit (bond, skb, tx_port->dev); } -if (tx_slave && bond->params.tlb_dynamic_lb) { +if (tx_port && bond->params.tlb_dynamic_lb) {spin_lock (&bond->mode_lock); -__tlb_clear_slave (bond, tx_slave,0 ); +__tlb_clear_port (bond, tx_port,0 );spin_unlock (&bond->mode_lock); }@@ -1334,10 +1334,10 @@ static netdev_tx_t bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond,return bond_tx_drop (bond->dev, skb); } -struct slave *bond_xmit_tlb_slave_get (struct bonding *bond, -struct sk_buff *skb) +struct bond_port *bond_xmit_tlb_port_get (struct bonding *bond, +struct sk_buff *skb) { -struct slave *tx_slave =NULL ; +struct bond_port *tx_port =NULL ;struct ethhdr *eth_data;u32 hash_index;@@ -1353,40 +1353,40 @@ struct slave *bond_xmit_tlb_slave_get(struct bonding *bond,case htons (ETH_P_IPV6 ): hash_index =bond_xmit_hash (bond, skb);if (bond->params.tlb_dynamic_lb) { - tx_slave =tlb_choose_channel (bond, + tx_port =tlb_choose_channel (bond, hash_index &0xFF , skb->len); }else { -struct bond_up_slave *slaves; +struct bond_up_port *ports;unsigned int count; - slaves =rcu_dereference (bond->usable_slaves); - count = slaves ?READ_ONCE (slaves->count) :0 ; + ports =rcu_dereference (bond->usable_ports); + count = ports ?READ_ONCE (ports->count) :0 ;if (likely (count)) - tx_slave = slaves->arr[hash_index % + tx_port = ports->arr[hash_index % count]; }break ; } } -return tx_slave; +return tx_port; }netdev_tx_t bond_tlb_xmit (struct sk_buff *skb,struct net_device *bond_dev) {struct bonding *bond =netdev_priv (bond_dev); -struct slave *tx_slave; +struct bond_port *tx_port; - tx_slave =bond_xmit_tlb_slave_get (bond, skb); -return bond_do_alb_xmit (skb, bond, tx_slave); + tx_port =bond_xmit_tlb_port_get (bond, skb); +return bond_do_alb_xmit (skb, bond, tx_port); } -struct slave *bond_xmit_alb_slave_get (struct bonding *bond, +struct bond_port *bond_xmit_alb_port_get (struct bonding *bond,struct sk_buff *skb) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));static const __be32 ip_bcast =htonl (0xffffffff ); -struct slave *tx_slave =NULL ; +struct bond_port *tx_port =NULL ;const u8 *hash_start =NULL ;bool do_tx_balance = true;struct ethhdr *eth_data;@@ -1483,7 +1483,7 @@ struct slave *bond_xmit_alb_slave_get(struct bonding *bond,case ETH_P_ARP : do_tx_balance = false;if (bond_info->rlb_enabled) - tx_slave =rlb_arp_xmit (skb, bond); + tx_port =rlb_arp_xmit (skb, bond);break ;default : do_tx_balance = false;@@ -1493,33 +1493,33 @@ struct slave *bond_xmit_alb_slave_get(struct bonding *bond,if (do_tx_balance) {if (bond->params.tlb_dynamic_lb) { hash_index =_simple_hash (hash_start, hash_size); - tx_slave =tlb_choose_channel (bond, hash_index, skb->len); + tx_port =tlb_choose_channel (bond, hash_index, skb->len); }else {/* -* do_tx_balance means we are free to select the tx_slave +* do_tx_balance means we are free to select the tx_port * So we do exactly what tlb would do for hash selection */ -struct bond_up_slave *slaves; +struct bond_up_port *ports;unsigned int count; - slaves =rcu_dereference (bond->usable_slaves); - count = slaves ?READ_ONCE (slaves->count) :0 ; + ports =rcu_dereference (bond->usable_ports); + count = ports ?READ_ONCE (ports->count) :0 ;if (likely (count)) - tx_slave = slaves->arr[bond_xmit_hash (bond, skb) % + tx_port = ports->arr[bond_xmit_hash (bond, skb) % count]; } } -return tx_slave; +return tx_port; }netdev_tx_t bond_alb_xmit (struct sk_buff *skb,struct net_device *bond_dev) {struct bonding *bond =netdev_priv (bond_dev); -struct slave *tx_slave =NULL ; +struct bond_port *tx_port =NULL ; - tx_slave =bond_xmit_alb_slave_get (bond, skb); -return bond_do_alb_xmit (skb, bond, tx_slave); + tx_port =bond_xmit_alb_port_get (bond, skb); +return bond_do_alb_xmit (skb, bond, tx_port); }void bond_alb_monitor (struct work_struct *work)@@ -1528,9 +1528,9 @@ void bond_alb_monitor(struct work_struct *work) alb_work.work);struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));struct list_head *iter; -struct slave *slave; +struct bond_port *port; -if (!bond_has_slaves (bond)) { +if (!bond_has_ports (bond)) { bond_info->tx_rebalance_counter =0 ; bond_info->lp_counter =0 ; goto re_arm;@@ -1545,15 +1545,15 @@ void bond_alb_monitor(struct work_struct *work)if (bond_info->lp_counter >=BOND_ALB_LP_TICKS (bond)) {bool strict_match; -bond_for_each_slave_rcu (bond, slave, iter) { +bond_for_each_port_rcu (bond, port, iter) {/* If updating current_active, use all currently * user mac addreses (!strict_match). Otherwise, only -* use mac of the slave device. +* use mac of the port device. * In RLB mode, we always use strict matches. */ - strict_match = (slave !=rcu_access_pointer (bond->curr_active_slave) || + strict_match = (port !=rcu_access_pointer (bond->curr_active_port) || bond_info->rlb_enabled); -alb_send_learning_packets (slave, slave->dev->dev_addr, +alb_send_learning_packets (port, port->dev->dev_addr, strict_match); } bond_info->lp_counter =0 ;@@ -1561,10 +1561,10 @@ void bond_alb_monitor(struct work_struct *work)/* rebalance tx traffic */ if (bond_info->tx_rebalance_counter >=BOND_TLB_REBALANCE_TICKS ) { -bond_for_each_slave_rcu (bond, slave, iter) { -tlb_clear_slave (bond, slave,1 ); -if (slave ==rcu_access_pointer (bond->curr_active_slave)) { -SLAVE_TLB_INFO (slave).load = +bond_for_each_port_rcu (bond, port, iter) { +tlb_clear_port (bond, port,1 ); +if (port ==rcu_access_pointer (bond->curr_active_port)) { +PORT_TLB_INFO (port).load = bond_info->unbalanced_load /BOND_TLB_REBALANCE_INTERVAL ; bond_info->unbalanced_load =0 ;@@ -1587,10 +1587,10 @@ void bond_alb_monitor(struct work_struct *work) bond_info->rlb_promisc_timeout_counter =0 ;/* If the primary was set to promiscuous mode -* because a slave was disabled then +* because a port was disabled then * it can now leave promiscuous mode. */ -dev_set_promiscuity (rtnl_dereference (bond->curr_active_slave)->dev, +dev_set_promiscuity (rtnl_dereference (bond->curr_active_port)->dev,-1 ); bond_info->primary_is_promisc =0 ;@@ -1621,23 +1621,23 @@ void bond_alb_monitor(struct work_struct *work)queue_delayed_work (bond->wq, &bond->alb_work, alb_delta_in_ticks); } -/* assumption: called before the slave is attached to the bond +/* assumption: called before the port is attached to the bond * and not locked by the bond lock */ -int bond_alb_init_slave (struct bonding *bond,struct slave *slave) +int bond_alb_init_port (struct bonding *bond,struct bond_port *port) {int res; - res =alb_set_slave_mac_addr (slave, slave->perm_hwaddr, - slave->dev->addr_len); + res =alb_set_port_mac_addr (port, port->perm_hwaddr, + port->dev->addr_len);if (res)return res; - res =alb_handle_addr_collision_on_attach (bond, slave); + res =alb_handle_addr_collision_on_attach (bond, port);if (res)return res; -tlb_init_slave (slave); +tlb_init_port (port);/* order a rebalance ASAP */ bond->alb_info.tx_rebalance_counter =BOND_TLB_REBALANCE_TICKS ;@@ -1648,33 +1648,34 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)return 0 ; } -/* Remove slave from tlb and rlb hash tables, and fix up MAC addresses +/* Remove port from tlb and rlb hash tables, and fix up MAC addresses * if necessary. * * Caller must hold RTNL and no other locks */ -void bond_alb_deinit_slave (struct bonding *bond,struct slave *slave) +void bond_alb_deinit_port (struct bonding *bond,struct bond_port *port) { -if (bond_has_slaves (bond)) -alb_change_hw_addr_on_detach (bond, slave); +if (bond_has_ports (bond)) +alb_change_hw_addr_on_detach (bond, port); -tlb_clear_slave (bond, slave,0 ); +tlb_clear_port (bond, port,0 );if (bond->alb_info.rlb_enabled) { - bond->alb_info.rx_slave =NULL ; -rlb_clear_slave (bond, slave); + bond->alb_info.rx_port =NULL ; +rlb_clear_port (bond, port); } } -void bond_alb_handle_link_change (struct bonding *bond,struct slave *slave,char link) +void bond_alb_handle_link_change (struct bonding *bond,struct bond_port *port, +char link) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));if (link ==BOND_LINK_DOWN ) { -tlb_clear_slave (bond, slave,0 ); +tlb_clear_port (bond, port,0 );if (bond->alb_info.rlb_enabled) -rlb_clear_slave (bond, slave); +rlb_clear_port (bond, port); }else if (link ==BOND_LINK_UP ) {/* order a rebalance ASAP */ bond_info->tx_rebalance_counter =BOND_TLB_REBALANCE_TICKS ;@@ -1689,28 +1690,28 @@ void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char }if (bond_is_nondyn_tlb (bond)) { -if (bond_update_slave_arr (bond,NULL )) -pr_err ("Failed to build slave-array for TLB mode.\n" ); +if (bond_update_port_arr (bond,NULL )) +pr_err ("Failed to build port-array for TLB mode.\n" ); } }/** -* bond_alb_handle_active_change - assign new curr_active_slave +* bond_alb_handle_active_change - assign new curr_active_port * @bond: our bonding struct -* @new_slave: new slave to assign +* @new_port: new port to assign * -* Set the bond->curr_active_slave to @new_slave and handle +* Set the bond->curr_active_port to @new_port and handle * mac address swapping and promiscuity changes as needed. * * Caller must hold RTNL */ -void bond_alb_handle_active_change (struct bonding *bond,struct slave *new_slave) +void bond_alb_handle_active_change (struct bonding *bond,struct bond_port *new_port) { -struct slave *swap_slave; -struct slave *curr_active; +struct bond_port *swap_port; +struct bond_port *curr_active; - curr_active =rtnl_dereference (bond->curr_active_slave); -if (curr_active == new_slave) + curr_active =rtnl_dereference (bond->curr_active_port); +if (curr_active == new_port)return ;if (curr_active && bond->alb_info.primary_is_promisc) {@@ -1719,57 +1720,57 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave bond->alb_info.rlb_promisc_timeout_counter =0 ; } - swap_slave = curr_active; -rcu_assign_pointer (bond->curr_active_slave, new_slave); + swap_port = curr_active; +rcu_assign_pointer (bond->curr_active_port, new_port); -if (!new_slave || !bond_has_slaves (bond)) +if (!new_port || !bond_has_ports (bond))return ; -/* set the new curr_active_slave to the bonds mac address -* i.e. swap mac addresses of old curr_active_slave and new curr_active_slave +/* set the new curr_active_port to the bonds mac address +* i.e. swap mac addresses of old curr_active_port and new curr_active_port */ -if (!swap_slave) - swap_slave =bond_slave_has_mac (bond, bond->dev->dev_addr); +if (!swap_port) + swap_port =bond_port_has_mac (bond, bond->dev->dev_addr); -/* Arrange for swap_slave and new_slave to temporarily be +/* Arrange for swap_port and new_port to temporarily be * ignored so we can mess with their MAC addresses without * fear of interference from transmit activity. */ -if (swap_slave) -tlb_clear_slave (bond, swap_slave,1 ); -tlb_clear_slave (bond, new_slave,1 ); +if (swap_port) +tlb_clear_port (bond, swap_port,1 ); +tlb_clear_port (bond, new_port,1 ); -/* in TLB mode, the slave might flip down/up with the old dev_addr, +/* in TLB mode, the port might flip down/up with the old dev_addr, * and thus filter bond->dev_addr's packets, so force bond's mac */ if (BOND_MODE (bond) ==BOND_MODE_TLB ) {struct sockaddr_storage ss;u8 tmp_addr[MAX_ADDR_LEN ]; -bond_hw_addr_copy (tmp_addr, new_slave->dev->dev_addr, - new_slave->dev->addr_len); +bond_hw_addr_copy (tmp_addr, new_port->dev->dev_addr, + new_port->dev->addr_len);bond_hw_addr_copy (ss.__data, bond->dev->dev_addr, bond->dev->addr_len); ss.ss_family = bond->dev->type;/* we don't care if it can't change its mac, best effort */ -dev_set_mac_address (new_slave->dev, (struct sockaddr *)&ss, +dev_set_mac_address (new_port->dev, (struct sockaddr *)&ss,NULL ); -bond_hw_addr_copy (new_slave->dev->dev_addr, tmp_addr, - new_slave->dev->addr_len); +bond_hw_addr_copy (new_port->dev->dev_addr, tmp_addr, + new_port->dev->addr_len); } -/* curr_active_slave must be set before calling alb_swap_mac_addr */ -if (swap_slave) { +/* curr_active_port must be set before calling alb_swap_mac_addr */ +if (swap_port) {/* swap mac address */ -alb_swap_mac_addr (swap_slave, new_slave); -alb_fasten_mac_swap (bond, swap_slave, new_slave); +alb_swap_mac_addr (swap_port, new_port); +alb_fasten_mac_swap (bond, swap_port, new_port); }else { -/* set the new_slave to the bond mac address */ -alb_set_slave_mac_addr (new_slave, bond->dev->dev_addr, +/* set the new_port to the bond mac address */ +alb_set_port_mac_addr (new_port, bond->dev->dev_addr, bond->dev->addr_len); -alb_send_learning_packets (new_slave, bond->dev->dev_addr, +alb_send_learning_packets (new_port, bond->dev->dev_addr, false); } }@@ -1779,8 +1780,8 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) {struct bonding *bond =netdev_priv (bond_dev);struct sockaddr_storage *ss = addr; -struct slave *curr_active; -struct slave *swap_slave; +struct bond_port *curr_active; +struct bond_port *swap_port;int res;if (!is_valid_ether_addr (ss->__data))@@ -1792,28 +1793,28 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)bond_hw_addr_copy (bond_dev->dev_addr, ss->__data, bond_dev->addr_len); -/* If there is no curr_active_slave there is nothing else to do. +/* If there is no curr_active_port there is nothing else to do. * Otherwise we'll need to pass the new address to it and handle * duplications. */ - curr_active =rtnl_dereference (bond->curr_active_slave); + curr_active =rtnl_dereference (bond->curr_active_port);if (!curr_active)return 0 ; - swap_slave =bond_slave_has_mac (bond, bond_dev->dev_addr); + swap_port =bond_port_has_mac (bond, bond_dev->dev_addr); -if (swap_slave) { -alb_swap_mac_addr (swap_slave, curr_active); -alb_fasten_mac_swap (bond, swap_slave, curr_active); +if (swap_port) { +alb_swap_mac_addr (swap_port, curr_active); +alb_fasten_mac_swap (bond, swap_port, curr_active); }else { -alb_set_slave_mac_addr (curr_active, bond_dev->dev_addr, +alb_set_port_mac_addr (curr_active, bond_dev->dev_addr, bond_dev->addr_len);alb_send_learning_packets (curr_active, bond_dev->dev_addr, false);if (bond->alb_info.rlb_enabled) {/* inform clients mac address has changed */ -rlb_req_update_slave_clients (bond, curr_active); +rlb_req_update_port_clients (bond, curr_active); } }drivers/net/bonding/bond_debugfs.c +1
-1@@ -38,7 +38,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) &client_info->ip_src, &client_info->ip_dst, &client_info->mac_dst, - client_info->slave->dev->name); + client_info->port->dev->name); }spin_unlock_bh (&bond->mode_lock);drivers/net/bonding/bond_main.c +7
-7@@ -17,14 +17,14 @@* ifconfig bond0 ipaddress netmask up * will setup a network device, with an ip address. No mac address * will be assigned at this time. The hw mac address will come from -* the first slave bonded to the channel. All slaves will then use +* the first port bonded to the channel. All ports will then use * this hw mac address. * * ifconfig bond0 down -* will release all slaves, marking them as down. +* will release all ports, marking them as down. * * ifenslave bond0 eth0 -* will attach eth0 to bond0 as a slave. eth0 hw mac address will either +* will attach eth0 to bond0 as a port. eth0 hw mac address will either * a: be used as initial mac address * b: if a hw mac address already is there, eth0's hw mac address * will then be set from bond0. @@ -109,10 +109,10 @@ static char *arp_ip_target[BOND_MAX_ARP_TARGETS];static char *arp_validate;static char *arp_all_targets;static char *fail_over_mac; -static int all_slaves_active; +static int apa;static struct bond_params bonding_defaults;static int resend_igmp =BOND_DEFAULT_RESEND_IGMP ; -static int packets_per_slave =1 ; +static int rr_ppp =1 ;static int lp_interval =BOND_ALB_DEFAULT_LP_INTERVAL ;module_param (max_bonds, int,0 );@@ -143,12 +143,12 @@ MODULE_PARM_DESC(mode, "Mode of operation; 0 for balance-rr, "module_param (primary, charp,0 );MODULE_PARM_DESC (primary,"Primary network device to use" );module_param (primary_reselect, charp,0 ); -MODULE_PARM_DESC (primary_reselect,"Reselect primary slave " +MODULE_PARM_DESC (primary_reselect,"Reselect primary port " "once it comes up; " "0 for always (default), " "1 for only if speed of primary is " "better, " -"2 for only on active slave " +"2 for only on active port " "failure" );module_param (lacp_rate, charp,0 );MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; "
drivers/net/bonding/bond_main.c +0
-1@@ -176,24 +176,36 @@ MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes; "module_param (arp_all_targets, charp,0 );MODULE_PARM_DESC (arp_all_targets,"fail on any/all arp targets timeout; 0 for any (default), 1 for all" );module_param (fail_over_mac, charp,0 ); -MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
drivers/net/bonding/bond_main.c MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes; " · line 185
Quoted 10 lines
drivers/net/bonding/bond_main.c +4
-3+MODULE_PARM_DESC (fail_over_mac,"For active-backup, do not set all ports to " "the same MAC; 0 for none (default), " "1 for active, 2 for follow" ); -module_param (all_slaves_active, int,0 ); -MODULE_PARM_DESC (all_slaves_active,"Keep all frames received on an interface " -"by setting active flag for all slaves; " +module_param_named (all_ports_active, apa, int,0644 ); +MODULE_PARM_DESC (all_ports_active,"Keep all frames received on an interface " +"by setting active flag for all ports; " "0 for never (default), 1 for always." );
I don't agree that we should add new module parameters. The
existing ones remain, so there is no incentive for users to change, and portable code will end up with the old names anyway. I'd prefer to the only path to move is away from module parameters entirely, not just to different names.
I haven't seen actual use of the bonding module parameters in a
long time. I'm willing to believe there are still users, but I haven't seen examples of it in years. If there is a use case that would absolutely require module parameters (and could not migrate to a feature complete netlink API) I'd like to hear about it.
Quoted 352 lines
drivers/net/bonding/bond_main.c +0
-0module_param (resend_igmp, int,0 );MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on "
"link failure");drivers/net/bonding/bond_main.c +4
-4-module_param (packets_per_slave, int,0 ); -MODULE_PARM_DESC (packets_per_slave,"Packets to send per slave in balance-rr " -"mode; 0 for a random slave, 1 packet per " -"slave (default), >1 packets per slave." ); +module_param_named (packets_per_port, rr_ppp, int,0644 ); +MODULE_PARM_DESC (packets_per_port,"Packets to send per port in balance-rr " +"mode; 0 for a random port, 1 packet per " +"port (default), >1 packets per port." );
module_param(lp_interval, uint, 0);
MODULE_PARM_DESC(lp_interval, "The number of seconds between instances where "
"the bonding driver sends learning packets to "drivers/net/bonding/bond_main.c +13
-1- "each slaves peer switch. The default is 1."); + "each port's peer switch. The default is 1."); +/* legacy compatability module parameters */ +module_param_named (all_slaves_active, apa, int,0644 ); +MODULE_PARM_DESC (all_slaves_active,"Keep all frames received on an interface " +"by setting active flag for all slaves; " +"0 for never (default), 1 for always. " +"(Legacy compat synonym for all_ports_active)." ); +module_param_named (packets_per_slave, rr_ppp, int,0644 ); +MODULE_PARM_DESC (packets_per_slave,"Packets to send per slave in balance-rr " +"mode; 0 for a random slave, 1 packet per " +"slave (default), >1 packets per slave. " +"(Legacy compat synonym for packets_per_port)." ); +/* end legacy compatability module parameters */ /*----------------------------- Global variables ----------------------------*/
drivers/net/bonding/bond_main.c +10
-10@@ -254,7 +266,7 @@ static int bond_init(struct net_device *bond_dev);static void bond_uninit (struct net_device *bond_dev);static void bond_get_stats (struct net_device *bond_dev,struct rtnl_link_stats64 *stats); -static void bond_slave_arr_handler (struct work_struct *work); +static void bond_port_arr_handler (struct work_struct *work);static bool bond_time_in_interval (struct bonding *bond,unsigned long last_act,int mod);static void bond_netdev_notify_work (struct work_struct *work);@@ -284,19 +296,19 @@ const char *bond_mode_name(int mode)* * @bond: bond device that got this skb for tx. * @skb: hw accel VLAN tagged skb to transmit -* @slave_dev: slave that is supposed to xmit this skbuff +* @port_dev: port that is supposed to xmit this skbuff */ netdev_tx_t bond_dev_queue_xmit (struct bonding *bond,struct sk_buff *skb, -struct net_device *slave_dev) +struct net_device *port_dev) { - skb->dev = slave_dev; + skb->dev = port_dev;BUILD_BUG_ON (sizeof (skb->queue_mapping) !=sizeof (qdisc_skb_cb (skb)->slave_dev_queue_mapping));skb_set_queue_mapping (skb,qdisc_skb_cb (skb)->slave_dev_queue_mapping);if (unlikely (netpoll_tx_running (bond->dev))) -return bond_netpoll_send_skb (bond_get_slave_by_dev (bond, slave_dev), skb); +return bond_netpoll_send_skb (bond_get_port_by_dev (bond, port_dev), skb);return dev_queue_xmit (skb); }@@ -304,7 +316,7 @@ netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,/*---------------------------------- VLAN -----------------------------------*/ /* In the following 2 functions, bond_vlan_rx_add_vid and bond_vlan_rx_kill_vid, -* We don't protect the slave list iteration with a lock because: +* We don't protect the port list iteration with a lock because: * a. This operation is performed in IOCTL context, * b. The operation is protected by the RTNL semaphore in the 8021q code, * c. Holding a lock with BH disabled while directly calling a base driver @@ -320,7 +332,7 @@ netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,*/ /** -* bond_vlan_rx_add_vid - Propagates adding an id to slaves +* bond_vlan_rx_add_vid - Propagates adding an id to ports * @bond_dev: bonding net device that got called * @proto: network protocol ID * @vid: vlan id being added @@ -329,12 +341,12 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev, __be16 proto, u16 vid) {struct bonding *bond =netdev_priv (bond_dev); -struct slave *slave, *rollback_slave; +struct bond_port *port, *rollback_port;struct list_head *iter;int res; -bond_for_each_slave (bond, slave, iter) { - res =vlan_vid_add (slave->dev, proto, vid); +bond_for_each_port (bond, port, iter) { + res =vlan_vid_add (port->dev, proto, vid);if (res) goto unwind; }@@ -342,19 +354,19 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev,return 0 ;unwind:
drivers/net/bonding/bond_main.c +3
-3-/* unwind to the slave that failed */ -bond_for_each_slave (bond, rollback_slave, iter) { -if (rollback_slave == slave) +/* unwind to the port that failed */ +bond_for_each_port (bond, rollback_port, iter) { +if (rollback_port == port)break;drivers/net/bonding/bond_main.c +1
-1-vlan_vid_del (rollback_slave->dev, proto, vid); +vlan_vid_del (rollback_port->dev, proto, vid);} return res; }/**
- *bond_vlan_rx_kill_vid- Propagates deleting an id to slaves
+ *bond_vlan_rx_kill_vid- Propagates deleting an id to ports
* @bond_dev: bonding net device that got called
* @proto: network protocol ID
* @vid: vlan id being removeddrivers/net/bonding/bond_main.c +48
-47@@ -364,10 +376,10 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, {struct bonding *bond =netdev_priv (bond_dev);struct list_head *iter; -struct slave *slave; +struct bond_port *port; -bond_for_each_slave (bond, slave, iter) -vlan_vid_del (slave->dev, proto, vid); +bond_for_each_port (bond, port, iter) +vlan_vid_del (port->dev, proto, vid);if (bond_is_lb (bond))bond_alb_clear_vlan (bond, vid);@@ -386,23 +398,23 @@ static int bond_ipsec_add_sa(struct xfrm_state *xs) {struct net_device *bond_dev = xs->xso.dev;struct bonding *bond; -struct slave *slave; +struct bond_port *port;if (!bond_dev)return -EINVAL ; bond =netdev_priv (bond_dev); - slave =rcu_dereference (bond->curr_active_slave); - xs->xso.real_dev = slave->dev; + port =rcu_dereference (bond->curr_active_port); + xs->xso.real_dev = port->dev; bond->xs = xs; -if (!(slave->dev->xfrmdev_ops - && slave->dev->xfrmdev_ops->xdo_dev_state_add)) { -slave_warn (bond_dev, slave->dev,"Slave does not support ipsec offload\n" ); +if (!(port->dev->xfrmdev_ops + && port->dev->xfrmdev_ops->xdo_dev_state_add)) { +port_warn (bond_dev, port->dev,"Port does not support ipsec offload\n" );return -EINVAL ; } -return slave->dev->xfrmdev_ops->xdo_dev_state_add (xs); +return port->dev->xfrmdev_ops->xdo_dev_state_add (xs); }/** @@ -413,26 +425,26 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs) {struct net_device *bond_dev = xs->xso.dev;struct bonding *bond; -struct slave *slave; +struct bond_port *port;if (!bond_dev)return ;Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
drivers/net/bonding/bond_main.c static void bond_ipsec_del_sa(struct xfrm_state *xs) · line 427
Quoted 10 lines
drivers/net/bonding/bond_main.c +2
-3bond =netdev_priv (bond_dev); - slave =rcu_dereference (bond->curr_active_slave); + port =rcu_dereference (bond->curr_active_port); -if (!slave) +if (!port)return ; - xs->xso.real_dev = slave->dev;
This comment could instead be removed, it doesn't really add
anything.
drivers/net/bonding/bond_main.c
Quoted 28 lines
drivers/net/bonding/bond_main.c +5
-5Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Could remove this one, too.
drivers/net/bonding/bond_main.c
Quoted 37 lines
drivers/net/bonding/bond_main.c +6
-6Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
And this one.
drivers/net/bonding/bond_main.c
Quoted 792 lines
drivers/net/bonding/bond_main.c +32
-32Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
out:
break; default:drivers/net/bonding/bond_main.c +60
-60Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
out:
return err; }drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{
drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (!np) return;drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
__netpoll_free(np); }drivers/net/bonding/bond_main.c +89
-89Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
The comment could just be deleted, and perhaps something like
"bond_add_port" better describes what the function does? I presume this choice is to match "release" on the other end, but "connect" makes me think the bond itself is being connected to something, like connect(2).
drivers/net/bonding/bond_main.c
Quoted 575 lines
drivers/net/bonding/bond_main.c +163
-165Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Again, could remove the comment instead.
drivers/net/bonding/bond_main.c
Quoted 124 lines
drivers/net/bonding/bond_main.c +0
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_sysfs_del:drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_upper_unlink:drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_unregister:drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_detach:drivers/net/bonding/bond_main.c +4
-4Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
block_netpoll_tx();drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unblock_netpoll_tx(); }drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
synchronize_rcu();drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_close:drivers/net/bonding/bond_main.c +3
-3Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_restore_mac:drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (!bond->params.fail_over_mac || BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { /* XXX TODO - fom follow mode needs to change bond'sdrivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
* least print a warning. */drivers/net/bonding/bond_main.c +4
-4Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
}
err_restore_mtu:drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_free:drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_undo_flags:drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (ether_addr_equal_64bits(bond_dev->dev_addr,drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
eth_hw_addr_random(bond_dev); if (bond_dev->type != ARPHRD_ETHER) { dev_close(bond_dev);drivers/net/bonding/bond_main.c +10
-10Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_main.c
Quoted 12 lines
drivers/net/bonding/bond_main.c +4
-4Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_main.c
Quoted 138 lines
drivers/net/bonding/bond_main.c +39
-39Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_main.c
Quoted 706 lines
drivers/net/bonding/bond_main.c +99
-99Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
do_failover:block_netpoll_tx();drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unblock_netpoll_tx(); }drivers/net/bonding/bond_main.c +21
-21@@ -2683,45 +2693,45 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
found:
addr = bond_confirm_addr(rt->dst.dev, targets[i], 0); ip_rt_put(rt);drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
kfree(tags); } }drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{ int i; if (!sip || !bond_has_this_ip(bond, tip)) {drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
return; } i = bond_get_targets_ip(bond->params.arp_targets, sip); if (i == -1) {drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
return; }drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
}
int bond_arp_rcv(const struct
sk_buff*skb, struct bonding *bond,drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{ struct arphdr *arp = (struct arphdr *)skb->data;drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unsigned char *arp_ptr; __be32 sip, tip; int is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP); unsigned int alen;drivers/net/bonding/bond_main.c +4
-4Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
return RX_HANDLER_ANOTHER; } else if (!is_arp) { return RX_HANDLER_ANOTHER;drivers/net/bonding/bond_main.c +27
-27Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
out_unlock:if (arp != (struct arphdr *)skb->data)drivers/net/bonding/bond_main.c +21
-21Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_main.c
Quoted 312 lines
drivers/net/bonding/bond_main.c +83
-83Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
do_failover:block_netpoll_tx();drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unblock_netpoll_tx(); }drivers/net/bonding/bond_main.c +7
-7Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Not one of my more eloquent log messages; as long as this is
being edited, I'd change the text to something along the lines of "impossible: c_active %s c_arp %s both set"
drivers/net/bonding/bond_main.c
Quoted 571 lines
drivers/net/bonding/bond_main.c +32
-32Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
check_state:drivers/net/bonding/bond_main.c +3
-3Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
break; } }drivers/net/bonding/bond_main.c +98
-98Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unwind:
drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
int tmp_res;drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
break;drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (
tmp_res)drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
} return res;drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
This comment is really old and no longer accurate, e.g., setting
the bond down no longer releases all ports. I'd suggest just removing it entirely.
drivers/net/bonding/bond_main.c
Quoted 769 lines
drivers/net/bonding/bond_main.c +57
-58Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
non_igmp:drivers/net/bonding/bond_main.c +4
-4Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
} return NULL; }drivers/net/bonding/bond_main.c +20
-20Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err:
drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
}
drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{ int idx; /* Rare situation where caller has asked to skip a specificdrivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
* only possible when the call is initiated from
*__bond_release_one(). In this situation; overwrite thedrivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
* array to avoid a situation where the xmit path may choose
drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
*/drivers/net/bonding/bond_main.c +5
-5Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
break; } } }drivers/net/bonding/bond_main.c +3
-3Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{
drivers/net/bonding/bond_main.c +3
-3Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
kfree_rcu(usable, rcu);drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
kfree_rcu(all, rcu); }drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{
drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (usable) {drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
kfree_rcu(usable, rcu); }drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (all) {drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
kfree_rcu(all, rcu); } }drivers/net/bonding/bond_main.c +3
-3Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{
drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
struct list_head *iter; int agg_id = 0; int ret = 0;drivers/net/bonding/bond_main.c +15
-15Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
out:
drivers/net/bonding/bond_main.c +5
-5Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
}drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
return ret; }drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
struct
sk_buff*skb,drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
{
drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
unsigned int count; u32 hash; hash = bond_xmit_hash(bond, skb);drivers/net/bonding/bond_main.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
if (unlikely(!count)) return NULL;drivers/net/bonding/bond_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
}
/* Use this Xmit function for 3AD as well as XOR modes. The current
- * usable slave array is formed in the control path. The xmit function
+ * usable port array is formed in the control path. The xmit function
* just calculates hash and sends the packet out.
*/
staticnetdev_tx_tbond_3ad_xor_xmit(structsk_buff*skb,
structnet_device*dev){ struct bonding *bond = netdev_priv(dev);drivers/net/bonding/bond_main.c +6
-6Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
return bond_tx_drop(dev, skb); }drivers/net/bonding/bond_main.c +55
-55Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_options.c
Quoted 538 lines
drivers/net/bonding/bond_main.c +21
-21Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
I think the "legacy sysfs" description is confusing, as this
whole block is option names that don't appear in sysfs unless there's an attr in the per_bond_attrs, and more than just these four have sysfs attrs. Perhaps organize the block into "in sysfs" and "not in sysfs" sections for clarity, and call this set "backwards compatibility" names?
drivers/net/bonding/bond_sysfs.c
Quoted 493 lines
drivers/net/bonding/bond_options.c +48
-50Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
out:
drivers/net/bonding/bond_options.c +26
-26Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
out:
return ret;drivers/net/bonding/bond_options.c +5
-5Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
err_no_cmd:drivers/net/bonding/bond_options.c +1
-1Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
ret = -EPERM; goto out; }The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_sysfs.c
Quoted 39 lines
drivers/net/bonding/bond_sysfs.c +5
-5Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_sysfs.c
Quoted 27 lines
drivers/net/bonding/bond_sysfs.c +6
-6Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_sysfs.c
Quoted 32 lines
drivers/net/bonding/bond_sysfs.c +6
-6Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_sysfs.c
Quoted 36 lines
drivers/net/bonding/bond_sysfs.c +7
-7Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Another comment to delete instead.
drivers/net/bonding/bond_sysfs_slave.c
Quoted 264 lines
drivers/net/bonding/bond_sysfs.c +8
-8Lines of this file are not shown. View the raw message.
drivers/net/bonding/bond_sysfs_slave.c +65
-70Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
From the changelog at the top, I thought the sysfs API wasn't
going to change; is this an oversight?
include/net/bond_options.h
Quoted 465 lines
drivers/net/bonding/bond_sysfs_slave.c +19
-5Lines of this file are not shown. View the raw message.
drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +1
-1Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2
-2Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +2
-2Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1
-1Lines of this file are not shown. View the raw message.
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +2
-2Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Same comment about the "legacy sysfs" nomenclature as above.
include/net/bonding.h
Quoted 27 lines
include/net/bond_options.h +0
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Is the text format of log messages considered to be part of the
"protected" user API? I personally don't think so, but I'm also reasonably sure that there are applications that scrape the log and may be perturbed by the change of wording here.
Quoted 651 lines
include/net/bonding.h +171
-171Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.28.0
---
-Jay Vosburgh, [email protected]
Part of the diff is not shown here. View the raw message.
PATCH v4 4/5 bonding: rename bonding_sysfs_slave.c to _port.c
In reply to Jarod WilsonNow that use of "slave" has been replaced by "port", rename this file too.
---
drivers/net/bonding/Makefile | 2 +-
drivers/net/bonding/{bond_sysfs_slave.c => bond_sysfs_port.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/net/bonding/{bond_sysfs_slave.c => bond_sysfs_port.c} (100%)drivers/net/bonding/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-$(CONFIG_BONDING) += bonding.o -bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_sysfs_slave.o bond_debugfs.o bond_netlink.o bond_options.o +bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_sysfs_port.o bond_debugfs.o bond_netlink.o bond_options.o proc-$(CONFIG_PROC_FS) += bond_procfs.o bonding-objs += $(proc-y)
drivers/net/bonding/bond_sysfs_port.c renamed from drivers/net/bonding/bond_sysfs_slave.c +0 -0
Signature · 1 line
2.28.0
PATCH v4 5/5 bonding: update Documentation for port/bond terminology
In reply to Jarod WilsonSwap in port/bond terminology where appropriate, leaving all legacy sysfs and procfs interface mentions in place, but marked as deprecated. Additionally, add more netlink/iproute2 documentation, and note that this is the preferred method of interfacing with the bonding driver. While we're at it, also make some mention of NetworkManager's existence.
--- Documentation/networking/bonding.rst | 581 ++++++++++++++++----------- 1 file changed, 348 insertions(+), 233 deletions(-)
Documentation/networking/bonding.rst +348 -233
@@ -21,6 +21,15 @@ Added Sysfs information: 2006/04/24 - Mitch Williams <mitch.a.williams at intel.com> +Major terminology rework done late 2020, to start to remove the use of +the socially problematic terms "master" and "slave" from the code. The +"master" device is now referred to as simply the "bond" device and the +"slave" devices as "ports", but all sysfs, procfs and module options +have been retained as-is for userspace compatibility. The sysfs and +procfs interfaces are deprecated though, in favor of userspace making +use of netlink and iproute for any and all bonding configuration and +information-gathering work. + Introduction ============
@@ -53,10 +62,11 @@ who to ask for help, please follow the links at the end of this file. 3.2.2 Configuring Multiple Bonds with Initscripts 3.3 Configuring Bonding Manually with Ifenslave 3.3.1 Configuring Multiple Bonds Manually - 3.4 Configuring Bonding Manually via Sysfs - 3.5 Configuration with Interfaces Support - 3.6 Overriding Configuration for Special Cases - 3.7 Configuring LACP for 802.3ad mode in a more secure way + 3.4 Configuring Bonding Manually via netlink + 3.5 Configuring Bonding Manually via Sysfs + 3.6 Configuration with Interfaces Support + 3.7 Overriding Configuration for Special Cases + 3.8 Configuring LACP for 802.3ad mode in a more secure way 4. Querying Bonding Configuration 4.1 Bonding Configuration
@@ -134,8 +144,8 @@ Build and install the new kernel and modules. 1.2 Bonding Control Utility --------------------------- -It is recommended to configure bonding via iproute2 (netlink) -or sysfs, the old ifenslave control utility is obsolete. +It is recommended to configure bonding via iproute2 (netlink). +The sysfs interfaces and the old ifenslave control utility are obsolete. 2. Bonding Driver Options =========================
@@ -167,22 +177,23 @@ or, for backwards compatibility, the option value. E.g., The parameters are as follows: -active_slave +active_port +active_slave (DEPRECATED) - Specifies the new active slave for modes that support it + Specifies the new active port for modes that support it (active-backup, balance-alb and balance-tlb). Possible values - are the name of any currently enslaved interface, or an empty - string. If a name is given, the slave and its link must be up in order - to be selected as the new active slave. If an empty string is - specified, the current active slave is cleared, and a new active - slave is selected automatically. + are the name of any currently aggregated interface, or an empty + string. If a name is given, the port and its port must be up in order + to be selected as the new active port. If an empty string is + specified, the current active port is cleared, and a new active + port is selected automatically. Note that this is only available through the sysfs interface. No module parameter by this name exists. The normal value of this option is the name of the currently - active slave, or the empty string if there is no active slave or - the current mode does not use an active slave. + active port, or the empty string if there is no active port or + the current mode does not use an active port. ad_actor_sys_prio
@@ -199,8 +210,8 @@ ad_actor_system protocol packet exchanges (LACPDUs). The value cannot be NULL or multicast. It is preferred to have the local-admin bit set for this mac but driver does not enforce it. If the value is not given then - system defaults to using the masters' mac address as actors' system - address. + system defaults to using the bonds' mac address as actors' + system address. This parameter has effect only in 802.3ad mode and is available through SysFs interface.
@@ -216,8 +227,8 @@ ad_select bandwidth. Reselection of the active aggregator occurs only when all - slaves of the active aggregator are down or the active - aggregator has no slaves. + ports of the active aggregator are down or the active + aggregator has no ports. This is the default value.
@@ -226,18 +237,18 @@ ad_select The active aggregator is chosen by largest aggregate bandwidth. Reselection occurs if: - - A slave is added to or removed from the bond + - A port is added to or removed from the bond - - Any slave's link state changes + - Any port's link state changes - - Any slave's 802.3ad association state changes + - Any port's 802.3ad association state changes - The bond's administrative state changes to up count or 2 The active aggregator is chosen by the largest number of - ports (slaves). Reselection occurs as described under the + ports (ports). Reselection occurs as described under the "bandwidth" setting, above. The bandwidth and count selection policies permit failover of
@@ -265,7 +276,8 @@ ad_user_port_key This parameter has effect only in 802.3ad mode and is available through SysFs interface. -all_slaves_active +all_ports_active +all_slaves_active (DEPRECATED) Specifies that duplicate frames (received on inactive ports) should be dropped (0) or delivered (1).
@@ -281,10 +293,10 @@ arp_interval Specifies the ARP link monitoring frequency in milliseconds. - The ARP monitor works by periodically checking the slave + The ARP monitor works by periodically checking the port devices to determine whether they have sent or received traffic recently (the precise criteria depends upon the - bonding mode, and the state of the slave). Regular traffic is + bonding mode, and the state of the port). Regular traffic is generated via ARP probes issued for the addresses specified by the arp_ip_target option.
@@ -327,50 +339,50 @@ arp_validate active or 1 - Validation is performed only for the active slave. + Validation is performed only for the active port. backup or 2 - Validation is performed only for backup slaves. + Validation is performed only for backup ports. all or 3 - Validation is performed for all slaves. + Validation is performed for all ports. filter or 4 - Filtering is applied to all slaves. No validation is + Filtering is applied to all ports. No validation is performed. filter_active or 5 - Filtering is applied to all slaves, validation is performed - only for the active slave. + Filtering is applied to all ports, validation is performed + only for the active port. filter_backup or 6 - Filtering is applied to all slaves, validation is performed - only for backup slaves. + Filtering is applied to all ports, validation is performed + only for backup ports. Validation: Enabling validation causes the ARP monitor to examine the incoming - ARP requests and replies, and only consider a slave to be up if it + ARP requests and replies, and only consider a port to be up if it is receiving the appropriate ARP traffic. - For an active slave, the validation checks ARP replies to confirm - that they were generated by an arp_ip_target. Since backup slaves + For an active port, the validation checks ARP replies to confirm + that they were generated by an arp_ip_target. Since backup ports do not typically receive these replies, the validation performed - for backup slaves is on the broadcast ARP request sent out via the - active slave. It is possible that some switch or network - configurations may result in situations wherein the backup slaves + for backup ports is on the broadcast ARP request sent out via the + active port. It is possible that some switch or network + configurations may result in situations wherein the backup ports do not receive the ARP requests; in such a situation, validation - of backup slaves must be disabled. + of backup ports must be disabled. - The validation of ARP requests on backup slaves is mainly helping - bonding to decide which slaves are more likely to work in case of - the active slave failure, it doesn't really guarantee that the - backup slave will work if it's selected as the next active slave. + The validation of ARP requests on backup ports is mainly helping + bonding to decide which ports are more likely to work in case of + the active port failure, it doesn't really guarantee that the + backup port will work if it's selected as the next active port. Validation is useful in network configurations in which multiple bonding hosts are concurrently issuing ARPs to one or more targets
@@ -387,11 +399,11 @@ arp_validate Enabling filtering causes the ARP monitor to only use incoming ARP packets for link availability purposes. Arriving packets that are not ARPs are delivered normally, but do not count when determining - if a slave is available. + if a port is available. Filtering operates by only considering the reception of ARP packets (any ARP packet, regardless of source or destination) when - determining if a slave has received traffic for link availability + determining if a port has received traffic for link availability purposes. Filtering is useful in network configurations in which significant
@@ -405,26 +417,26 @@ arp_validate arp_all_targets Specifies the quantity of arp_ip_targets that must be reachable - in order for the ARP monitor to consider a slave as being up. - This option affects only active-backup mode for slaves with + in order for the ARP monitor to consider a port as being up. + This option affects only active-backup mode for ports with arp_validation enabled. Possible values are: any or 0 - consider the slave up only when any of the arp_ip_targets + consider the port up only when any of the arp_ip_targets is reachable all or 1 - consider the slave up only when all of the arp_ip_targets + consider the port up only when all of the arp_ip_targets are reachable downdelay Specifies the time, in milliseconds, to wait before disabling - a slave after a link failure has been detected. This option + a port after a link failure has been detected. This option is only valid for the miimon link monitor. The downdelay value should be a multiple of the miimon value; if not, it will be rounded down to the nearest multiple. The default
@@ -432,8 +444,8 @@ downdelay fail_over_mac - Specifies whether active-backup mode should set all slaves to - the same MAC address at enslavement (the traditional + Specifies whether active-backup mode should set all ports to + the same MAC address at connection (the traditional behavior), or, when enabled, perform special handling of the bond's MAC address in accordance with the selected policy.
@@ -442,16 +454,16 @@ fail_over_mac none or 0 This setting disables fail_over_mac, and causes - bonding to set all slaves of an active-backup bond to - the same MAC address at enslavement time. This is the + bonding to set all ports of an active-backup bond to + the same MAC address at connection time. This is the default. active or 1 The "active" fail_over_mac policy indicates that the MAC address of the bond should always be the MAC - address of the currently active slave. The MAC - address of the slaves is not changed; instead, the MAC + address of the currently active port. The MAC + address of the ports is not changed; instead, the MAC address of the bond changes during a failover. This policy is useful for devices that cannot ever
@@ -478,12 +490,12 @@ fail_over_mac The "follow" fail_over_mac policy causes the MAC address of the bond to be selected normally (normally - the MAC address of the first slave added to the bond). - However, the second and subsequent slaves are not set + the MAC address of the first port added to the bond). + However, the second and subsequent ports are not set to this MAC address while they are in a backup role; a - slave is programmed with the bond's MAC address at - failover time (and the formerly active slave receives - the newly active slave's MAC address). + port is programmed with the bond's MAC address at + failover time (and the formerly active port receives + the newly active port's MAC address). This policy is useful for multiport devices that either become confused or incur a performance penalty
@@ -491,11 +503,11 @@ fail_over_mac address. - The default policy is none, unless the first slave cannot + The default policy is none, unless the first port cannot change its MAC address, in which case the active policy is selected by default. - This option may be modified via sysfs only when no slaves are + This option may be modified via sysfs only when no ports are present in the bond. This option was added in bonding version 3.2.0. The "follow"
@@ -526,7 +538,7 @@ max_bonds miimon Specifies the MII link monitoring frequency in milliseconds. - This determines how often the link state of each slave is + This determines how often the link state of each port is inspected for link failures. A value of zero disables MII link monitoring. A value of 100 is a good starting point. The use_carrier option, below, affects how the link state is
@@ -558,22 +570,22 @@ mode balance-rr or 0 Round-robin policy: Transmit packets in sequential - order from the first available slave through the + order from the first available port through the last. This mode provides load balancing and fault tolerance. active-backup or 1 - Active-backup policy: Only one slave in the bond is - active. A different slave becomes active if, and only - if, the active slave fails. The bond's MAC address is + Active-backup policy: Only one port in the bond is + active. A different port becomes active if, and only + if, the active port fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. In bonding version 2.6.2 or later, when a failover occurs in active-backup mode, bonding will issue one - or more gratuitous ARPs on the newly active slave. - One gratuitous ARP is issued for the bonding master + or more gratuitous ARPs on the newly active port. + One gratuitous ARP is issued for the bonding device interface and each VLAN interfaces configured above it, provided that the interface has at least one IP address configured. Gratuitous ARPs issued for VLAN
@@ -588,7 +600,7 @@ mode XOR policy: Transmit based on the selected transmit hash policy. The default policy is a simple [(source MAC address XOR'd with destination MAC address XOR - packet type ID) modulo slave count]. Alternate transmit + packet type ID) modulo port count]. Alternate transmit policies may be selected via the xmit_hash_policy option, described below.
@@ -596,17 +608,17 @@ mode broadcast or 3 - Broadcast policy: transmits everything on all slave + Broadcast policy: transmits everything on all port interfaces. This mode provides fault tolerance. 802.3ad or 4 IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and - duplex settings. Utilizes all slaves in the active + duplex settings. Utilizes all ports in the active aggregator according to the 802.3ad specification. - Slave selection for outgoing traffic is done according + Port selection for outgoing traffic is done according to the transmit hash policy, which may be changed from the default simple XOR policy via the xmit_hash_policy option, documented below. Note that not all transmit
@@ -619,7 +631,7 @@ mode Prerequisites: 1. Ethtool support in the base drivers for retrieving - the speed and duplex of each slave. + the speed and duplex of each port. 2. A switch that supports IEEE 802.3ad Dynamic link aggregation.
@@ -634,20 +646,20 @@ mode In tlb_dynamic_lb=1 mode; the outgoing traffic is distributed according to the current load (computed - relative to the speed) on each slave. + relative to the speed) on each port. In tlb_dynamic_lb=0 mode; the load balancing based on current load is disabled and the load is distributed only using the hash distribution. - Incoming traffic is received by the current slave. - If the receiving slave fails, another slave takes over - the MAC address of the failed receiving slave. + Incoming traffic is received by the current port. + If the receiving port fails, another port takes over + the MAC address of the failed receiving port. Prerequisite: Ethtool support in the base drivers for retrieving the - speed of each slave. + speed of each port. balance-alb or 6
@@ -658,7 +670,7 @@ mode The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware - address of one of the slaves in the bond such that + address of one of the ports in the bond such that different peers use different hardware addresses for the server.
@@ -668,24 +680,24 @@ mode IP information from the ARP packet. When the ARP Reply arrives from the peer, its hardware address is retrieved and the bonding driver initiates an ARP - reply to this peer assigning it to one of the slaves + reply to this peer assigning it to one of the ports in the bond. A problematic outcome of using ARP negotiation for balancing is that each time that an ARP request is broadcast it uses the hardware address of the bond. Hence, peers learn the hardware address of the bond and the balancing of receive traffic - collapses to the current slave. This is handled by + collapses to the current port. This is handled by sending updates (ARP Replies) to all the peers with their individually assigned hardware address such that the traffic is redistributed. Receive traffic is also - redistributed when a new slave is added to the bond - and when an inactive slave is re-activated. The + redistributed when a new port is added to the bond + and when an inactive port is re-activated. The receive load is distributed sequentially (round robin) - among the group of highest speed slaves in the bond. + among the group of highest speed ports in the bond. - When a link is reconnected or a new slave joins the + When a link is reconnected or a new port joins the bond the receive traffic is redistributed among all - active slaves in the bond by initiating ARP Replies + active ports in the bond by initiating ARP Replies with the selected MAC address to each of the clients. The updelay parameter (detailed below) must be set to a value equal or greater than the switch's
@@ -695,16 +707,16 @@ mode Prerequisites: 1. Ethtool support in the base drivers for retrieving - the speed of each slave. + the speed of each port. 2. Base driver support for setting the hardware address of a device while it is open. This is - required so that there will always be one slave in the + required so that there will always be one port in the team using the bond hardware address (the - curr_active_slave) while having a unique hardware - address for each slave in the bond. If the - curr_active_slave fails its hardware address is - swapped with the new curr_active_slave that was + curr_active_port) while having a unique hardware + address for each port in the bond. If the + curr_active_port fails its hardware address is + swapped with the new curr_active_port that was chosen. num_grat_arp,
@@ -712,7 +724,7 @@ num_unsol_na Specify the number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements) to be issued after a - failover event. As soon as the link is up on the new slave + failover event. As soon as the link is up on the new port (possibly immediately) a peer notification is sent on the bonding device and each VLAN sub-device. This is repeated at the rate specified by peer_notif_delay if the number is
@@ -726,10 +738,11 @@ num_unsol_na are generated by the ipv4 and ipv6 code and the numbers of repetitions cannot be set independently. -packets_per_slave +packets_per_port +packets_per_slave (DEPRECATED) - Specify the number of packets to transmit through a slave before - moving to the next one. When set to 0 then a slave is chosen at + Specify the number of packets to transmit through a port before + moving to the next one. When set to 0 then a port is chosen at random. The valid range is 0 - 65535; the default value is 1. This option
@@ -747,11 +760,11 @@ peer_notif_delay primary - A string (eth0, eth2, etc) specifying which slave is the + A string (eth0, eth2, etc) specifying which port is the primary device. The specified device will always be the - active slave while it is available. Only when the primary is + active port while it is available. Only when the primary is off-line will alternate devices be used. This is useful when - one slave is preferred over another, e.g., when one slave has + one port is preferred over another, e.g., when one port has higher throughput than another. The primary option is only valid for active-backup(1),
@@ -759,41 +772,41 @@ primary primary_reselect - Specifies the reselection policy for the primary slave. This - affects how the primary slave is chosen to become the active slave - when failure of the active slave or recovery of the primary slave + Specifies the reselection policy for the primary port. This + affects how the primary port is chosen to become the active port + when failure of the active port or recovery of the primary port occurs. This option is designed to prevent flip-flopping between - the primary slave and other slaves. Possible values are: + the primary port and other ports. Possible values are: always or 0 (default) - The primary slave becomes the active slave whenever it + The primary port becomes the active port whenever it comes back up. better or 1 - The primary slave becomes the active slave when it comes - back up, if the speed and duplex of the primary slave is + The primary port becomes the active port when it comes + back up, if the speed and duplex of the primary port is better than the speed and duplex of the current active - slave. + port. failure or 2 - The primary slave becomes the active slave only if the - current active slave fails and the primary slave is up. + The primary port becomes the active port only if the + current active port fails and the primary port is up. The primary_reselect setting is ignored in two cases: - If no slaves are active, the first slave to recover is - made the active slave. + If no ports are active, the first port to recover is + made the active port. - When initially enslaved, the primary slave is always made - the active slave. + When initially connected, the primary port is always made + the active port. Changing the primary_reselect policy via sysfs will cause an - immediate selection of the best active slave according to the new + immediate selection of the best active port according to the new policy. This may or may not result in a change of the active - slave, depending upon the circumstances. + port, depending upon the circumstances. This option was added for bonding version 3.6.0.
@@ -803,7 +816,7 @@ tlb_dynamic_lb mode. The value has no effect on any other modes. The default behavior of tlb mode is to shuffle active flows across - slaves based on the load in that interval. This gives nice lb + ports based on the load in that interval. This gives nice lb characteristics but can cause packet reordering. If re-ordering is a concern use this variable to disable flow shuffling and rely on load balancing provided solely by the hash distribution.
@@ -822,7 +835,7 @@ tlb_dynamic_lb updelay Specifies the time, in milliseconds, to wait before enabling a - slave after a link recovery has been detected. This option is + port after a link recovery has been detected. This option is only valid for the miimon link monitor. The updelay value should be a multiple of the miimon value; if not, it will be rounded down to the nearest multiple. The default value is 0.
@@ -851,7 +864,7 @@ use_carrier xmit_hash_policy - Selects the transmit hash policy to use for slave selection in + Selects the transmit hash policy to use for port selection in balance-xor, 802.3ad, and tlb modes. Possible values are: layer2
@@ -860,10 +873,10 @@ xmit_hash_policy field to generate the hash. The formula is hash = source MAC XOR destination MAC XOR packet type ID - slave number = hash modulo slave count + port number = hash modulo port count This algorithm will place all traffic to a particular - network peer on the same slave. + network peer on the same port. This algorithm is 802.3ad compliant.
@@ -879,13 +892,13 @@ xmit_hash_policy hash = hash XOR source IP XOR destination IP hash = hash XOR (hash RSHIFT 16) hash = hash XOR (hash RSHIFT 8) - And then hash is reduced modulo slave count. + And then hash is reduced modulo port count. If the protocol is IPv6 then the source and destination addresses are first hashed using ipv6_addr_hash. This algorithm will place all traffic to a particular - network peer on the same slave. For non-IP traffic, + network peer on the same port. For non-IP traffic, the formula is the same as for the layer2 transmit hash policy.
@@ -901,8 +914,8 @@ xmit_hash_policy This policy uses upper layer protocol information, when available, to generate the hash. This allows for traffic to a particular network peer to span multiple - slaves, although a single connection will not span - multiple slaves. + ports, although a single connection will not span + multiple ports. The formula for unfragmented TCP and UDP packets is
@@ -910,7 +923,7 @@ xmit_hash_policy hash = hash XOR source IP XOR destination IP hash = hash XOR (hash RSHIFT 16) hash = hash XOR (hash RSHIFT 8) - And then hash is reduced modulo slave count. + And then hash is reduced modulo port count. If the protocol is IPv6 then the source and destination addresses are first hashed using ipv6_addr_hash.
@@ -968,16 +981,16 @@ resend_igmp This option is useful for bonding modes balance-rr (0), active-backup (1), balance-tlb (5) and balance-alb (6), in which a failover can - switch the IGMP traffic from one slave to another. Therefore a fresh + switch the IGMP traffic from one port to another. Therefore a fresh IGMP report must be issued to cause the switch to forward the incoming - IGMP traffic over the newly selected slave. + IGMP traffic over the newly selected port. This option was added for bonding version 3.7.0. lp_interval Specifies the number of seconds between instances where the bonding - driver sends learning packets to each slaves peer switch. + driver sends learning packets to each ports peer switch. The valid range is 1 - 0x7fffffff; the default value is 1. This Option has effect only in balance-tlb and balance-alb modes.
@@ -986,11 +999,11 @@ lp_interval ============================== You can configure bonding using either your distro's network -initialization scripts, or manually using either iproute2 or the -sysfs interface. Distros generally use one of three packages for the -network initialization scripts: initscripts, sysconfig or interfaces. -Recent versions of these packages have support for bonding, while older -versions do not. +initialization scripts, or manually using either iproute2, NetworkManager, +or the sysfs interface. Distros generally use one of four packages for +the network initialization scripts: initscripts, sysconfig, interfaces, or +NetworkManager. Any remotely modern version of these packages should have +support for bonding, but very old versions may not. We will first describe the options for configuring bonding for distros using versions of initscripts, sysconfig and interfaces with full
@@ -1004,15 +1017,18 @@ Determining this is fairly straightforward. First, look for a file called interfaces in /etc/network directory. If this file is present in your system, then your system use interfaces. See -Configuration with Interfaces Support. +Configuration with Interfaces Support. Many modern distros now use +NetworkManager, for which you should find the directory /etc/NetworkManager +on your system, the NetworkManager GUI, and nmcli for command-line based +configuration of network components, including bonds. Else, issue the command:: $ rpm -qf /sbin/ifup It will respond with a line of text starting with either -"initscripts" or "sysconfig," followed by some numbers. This is the -package that provides your network initialization scripts. +"initscripts", "sysconfig" or "NetworkManager", followed by some numbers. +This is the package that provides your network initialization scripts. Next, to determine if your installation supports bonding, issue the command::
@@ -1020,7 +1036,14 @@ issue the command:: $ grep ifenslave /sbin/ifup If this returns any matches, then your initscripts or -sysconfig has support for bonding. +sysconfig has support for bonding. Note however, that ifenslave has been +deprecated for quite some time, any many distributions no longer use it +as a primary means of configuring bonds. In some cases, ifup is simply a +wrapper script that calls NetworkManager's nmcli, which has had support +for bonding since it's earliest days being deployed as a distribution +default network management infrastructure. + +Note: classic ifenslave binaries are considered deprecated. 3.1 Configuration with Sysconfig Support ----------------------------------------
@@ -1034,9 +1057,9 @@ front end does not provide any means to work with bonding devices. Bonding devices can be managed by hand, however, as follows. First, if they have not already been configured, configure the -slave devices. On SLES 9, this is most easily done by running the +port devices. On SLES 9, this is most easily done by running the yast2 sysconfig configuration utility. The goal is for to create an -ifcfg-id file for each slave device. The simplest way to accomplish +ifcfg-id file for each port device. The simplest way to accomplish this is to configure the devices for DHCP (this is only to get the file ifcfg-id file created; see below for some issues with DHCP). The name of the configuration file for each device will be of the form::
@@ -1047,8 +1070,8 @@ Where the "xx" portion will be replaced with the digits from the device's permanent MAC address. Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been -created, it is necessary to edit the configuration files for the slave -devices (the MAC addresses correspond to those of the slave devices). +created, it is necessary to edit the configuration files for the port +devices (the MAC addresses correspond to those of the port devices). Before editing, the file will contain multiple lines, and will look something like this::
@@ -1111,7 +1134,7 @@ The possible values are: ======== ====================================================== The line BONDING_MASTER='yes' indicates that the device is a -bonding master device. The only useful value is "yes." +bonding aggregator device. The only useful value is "yes." The contents of BONDING_MODULE_OPTS are supplied to the instance of the bonding module for this device. Specify the options
@@ -1119,9 +1142,9 @@ for the bonding mode, link monitoring, and so on here. Do not include the max_bonds bonding parameter; this will confuse the configuration system if you have multiple bonding devices. -Finally, supply one BONDING_SLAVEn="slave device" for each -slave. where "n" is an increasing value, one for each slave. The -"slave device" is either an interface name, e.g., "eth0", or a device +Finally, supply one BONDING_SLAVEn="port device" for each +port. where "n" is an increasing value, one for each port. The +"port device" is either an interface name, e.g., "eth0", or a device specifier for the network device. The interface name is easier to find, but the ethN names are subject to change at boot time if, e.g., a device early in the sequence has failed. The device specifiers
@@ -1129,7 +1152,7 @@ a device early in the sequence has failed. The device specifiers network device, and will not change unless the device's bus location changes (for example, it is moved from one PCI slot to another). The example above uses one of each type for demonstration purposes; most -configurations will choose one or the other for all slave devices. +configurations will choose one or the other for all port devices. When all configuration files have been modified or created, networking must be restarted for the configuration changes to take
@@ -1162,7 +1185,7 @@ Under sysconfig, configuring a device with BOOTPROTO='dhcp' will cause it to query DHCP for its IP address information. At this writing, this does not function for bonding devices; the scripts attempt to obtain the device address from DHCP prior to adding any of -the slave devices. Without active slaves, the DHCP requests are not +the port devices. Without active ports, the DHCP requests are not sent to the network. 3.1.2 Configuring Multiple Bonds with Sysconfig
@@ -1237,6 +1260,14 @@ place the following text:: Be sure to change the networking specific lines (IPADDR, NETMASK, NETWORK and BROADCAST) to match your network configuration. +Note that recent Red Hat and Fedora releases (at least Red Hat Enterprise +Linux 8 and Fedora 30 or newer) prefer NetworkManager over the network +initscripts, but the two can coexist on a system. By default, NetworkManager +will try to handle all ifcfg-* files, including bonding ones, unless the +following line is added to tell classis initscripts to handle them:: + + NM_CONTROLLED=no + For later versions of initscripts, such as that found with Fedora 7 (or later) and Red Hat Enterprise Linux version 5 (or later), it is possible, and, indeed, preferable, to specify the bonding options in the ifcfg-bond0
@@ -1416,8 +1447,85 @@ RHEL 4 as well. On kernels exhibiting this problem, it will be impossible to configure multiple bonds with differing parameters (as they are older kernels, and also lack sysfs support). -3.4 Configuring Bonding Manually via Sysfs ------------------------------------------- +3.4 Configuring Bonding Manually via netlink +-------------------------------------------- + +The iproute2 utility can manage bonding devices over the bonding driver's +netlink interface. This is the officially endorsed and current method via +which any bonding device interactions from userspace should be done. The +iproute2 v4.x and later are known to fully support bonding. + +This interface allows dynamic configuration of all bonds in the system +without unloading the module. It also allows for adding and removing +bonds at runtime. The ifenslave utility is no longer relevant, though it +may still exist in some distributions as a wrapper script simply calling +various "ip link ..." invocations underneath. + +Use of the netlink/iproute2 interface allows you to use multiple bonds +with different configurations without having to reload the module. It also +allows you to use multiple, differently configured bonds when bonding +is compiled into the kernel. + +Creating and Destroying Bonds +----------------------------- +To add a new bond foo:: + + # ip link add foo type bond + +To remove an existing bond bar:: + + # ip link del bar + +To show all existing bonds:: + + # ip link show type bond + +Adding and Removing Ports +------------------------- +Bond component port interfaces must be in a down state to be added to a +bond. + +To connect interface eth0 to bond bond0:: + + # ip link set eth0 down + # ip link set eth0 master bond0 + +To free port eth0 from bond bond0:: + + # ip link set eth0 nomaster + +Once ports are added to the bond, bring it up:: + + # ip link set bond0 up + +When an interface eth1 is connected to a bond, among its flags in "ip link +show" output:: + + # ip link show eth1 + 3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000 + link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff + +...we see SLAVE, indicating this interface is part of another aggregate +device (also present for team and brige ports), and we see 'master bond0', +which lets us know that it's part of the device named bond0, which is +presumably, a bonding device. We can confirm this by looking for bond0 +in the output of:: + + # ip link show type bond + +All current components of bond0 can quickly be identified by:: + + # ip link show master bond0 + +Further iproute2 enhancements may be in order to give a more detailed +overview of bonds in the system, similar to /proc/net/bonding/<bond>. + + +3.5 Configuring Bonding Manually via Sysfs (DEPRECATED) +------------------------------------------------------- + +The bonding sysfs interface is deprecated, all users are urged to use +iproute2 which manages bonds via netlink. Starting with version 3.0.0, Channel Bonding may be configured via the sysfs interface. This interface allows dynamic configuration
@@ -1444,7 +1552,7 @@ To add a new bond foo:: To remove an existing bond bar:: - # echo -bar > /sys/class/net/bonding_masters + # echo -bar > /sys/class/net/bonding_master To show all existing bonds::
@@ -1456,30 +1564,30 @@ To show all existing bonds:: truncated if you have more than a few hundred bonds. This is unlikely to occur under normal operating conditions. -Adding and Removing Slaves --------------------------- -Interfaces may be enslaved to a bond using the file +Adding and Removing Ports +------------------------- +Interfaces may be connected to a bond using the file /sys/class/net/<bond>/bonding/slaves. The semantics for this file are the same as for the bonding_masters file. -To enslave interface eth0 to bond bond0:: +To connect interface eth0 to bond bond0:: # ifconfig bond0 up # echo +eth0 > /sys/class/net/bond0/bonding/slaves -To free slave eth0 from bond bond0:: +To free port eth0 from bond bond0:: # echo -eth0 > /sys/class/net/bond0/bonding/slaves -When an interface is enslaved to a bond, symlinks between the +When an interface is connected to a bond, symlinks between the two are created in the sysfs filesystem. In this case, you would get -/sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and +/sys/class/net/bond0/lower_eth0 pointing to /sys/class/net/eth0, and /sys/class/net/eth0/master pointing to /sys/class/net/bond0. This means that you can tell quickly whether or not an -interface is enslaved by looking for the master symlink. Thus: +interface is connected by looking for the master symlink. Thus: # echo -eth0 > /sys/class/net/eth0/master/bonding/slaves -will free eth0 from whatever bond it is enslaved to, regardless of +will free eth0 from whatever bond it is connected to, regardless of the name of the bond interface. Changing a Bond's Configuration
@@ -1536,7 +1644,7 @@ To configure the interval between learning packet transmits:: .. note:: the lp_interval is the number of seconds between instances where - the bonding driver sends learning packets to each slaves peer switch. The + the bonding driver sends learning packets to each port's peer switch. The default interval is 1 second. Example Configuration
@@ -1570,7 +1678,7 @@ your init script:: echo +eth2 > /sys/class/net/bond1/bonding/slaves echo +eth3 > /sys/class/net/bond1/bonding/slaves -3.5 Configuration with Interfaces Support +3.6 Configuration with Interfaces Support ----------------------------------------- This section applies to distros which use /etc/network/interfaces file
@@ -1589,7 +1697,7 @@ Example Configurations ---------------------- In /etc/network/interfaces, the following stanza will configure bond0, in -active-backup mode, with eth0 and eth1 as slaves:: +active-backup mode, with eth0 and eth1 as ports:: auto bond0 iface bond0 inet dhcp
@@ -1623,7 +1731,7 @@ For a full list of ``bond-*`` supported options in /etc/network/interfaces and some more advanced examples tailored to you particular distros, see the files in /usr/share/doc/ifenslave-2.6. -3.6 Overriding Configuration for Special Cases +3.7 Overriding Configuration for Special Cases ---------------------------------------------- When using the bonding driver, the physical port which transmits a frame is
@@ -1645,7 +1753,7 @@ tx_queues can be used to change this value. There is no sysfs parameter available as the allocation is done at module init time. The output of the file /proc/net/bonding/bondX has changed so the output Queue -ID is now printed for each slave:: +ID is now printed for each slave port:: Bonding Mode: fault-tolerance (active-backup) Primary Slave: None
@@ -1667,18 +1775,20 @@ ID is now printed for each slave:: Permanent HW addr: 00:1a:a0:12:8f:cc Slave queue ID: 2 -The queue_id for a slave can be set using the command:: +Note: the procfs interface is considered deprecated. + +The queue_id for a port can be set using the command:: # echo "eth1:2" > /sys/class/net/bond0/bonding/queue_id Any interface that needs a queue_id set should set it with multiple calls like the one above until proper priorities are set for all interfaces. On distributions that allow configuration via initscripts, multiple 'queue_id' -arguments can be added to BONDING_OPTS to set all needed slave queues. +arguments can be added to BONDING_OPTS to set all needed port queues. These queue id's can be used in conjunction with the tc utility to configure a multiqueue qdisc and filters to bias certain traffic to transmit on certain -slave devices. For instance, say we wanted, in the above configuration to +port devices. For instance, say we wanted, in the above configuration to force all traffic bound to 192.168.1.100 to use eth1 in the bond as its output device. The following commands would accomplish this::
@@ -1695,16 +1805,16 @@ selection policy to be overridden, selecting instead qid 2, which maps to eth1. Note that qid values begin at 1. Qid 0 is reserved to initiate to the driver that normal output policy selection should take place. One benefit to simply -leaving the qid for a slave to 0 is the multiqueue awareness in the bonding +leaving the qid for a port to 0 is the multiqueue awareness in the bonding driver that is now present. This awareness allows tc filters to be placed on -slave devices as well as bond devices and the bonding driver will simply act as -a pass-through for selecting output queues on the slave device rather than +port devices as well as bond devices and the bonding driver will simply act as +a pass-through for selecting output queues on the port device rather than output port selection. This feature first appeared in bonding driver version 3.7.0 and support for -output slave selection was limited to round-robin and active-backup modes. +output port selection was limited to round-robin and active-backup modes. -3.7 Configuring LACP for 802.3ad mode in a more secure way +3.8 Configuring LACP for 802.3ad mode in a more secure way ---------------------------------------------------------- When using 802.3ad bonding mode, the Actor (host) and Partner (switch)
@@ -1759,7 +1869,8 @@ few bonding parameters: Each bonding device has a read-only file residing in the /proc/net/bonding directory. The file contents include information -about the bonding configuration, options and state of each slave. +about the bonding configuration, options and state of each port. +However, note that the procfs interface is considered deprecated. For example, the contents of /proc/net/bonding/bond0 after the driver is loaded with parameters of mode=0 and miimon=1000 is
@@ -1788,14 +1899,14 @@ bonding configuration, state, and version of the bonding driver. ------------------------- The network configuration can be inspected using the ifconfig -command. Bonding devices will have the MASTER flag set; Bonding slave +command. Bonding devices will have the MASTER flag set; Bonding port devices will have the SLAVE flag set. The ifconfig output does not -contain information on which slaves are associated with which masters. +contain information on which ports are associated with which bonds. -In the example below, the bond0 interface is the master -(MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of +In the example below, the bond0 interface is the bond device +(MASTER) while eth0 and eth1 are ports (SLAVE). Notice all ports of bond0 have the same MAC address (HWaddr) as bond0 for all modes except -TLB and ALB that require a unique MAC address for each slave:: +TLB and ALB that require a unique MAC address for each port:: # /sbin/ifconfig bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
@@ -1868,29 +1979,29 @@ For reasons of simplicity, and to support the use of adapters that can do VLAN hardware acceleration offloading, the bonding interface declares itself as fully hardware offloading capable, it gets the add_vid/kill_vid notifications to gather the necessary -information, and it propagates those actions to the slaves. In case +information, and it propagates those actions to the ports. In case of mixed adapter types, hardware accelerated tagged packets that should go through an adapter that is not offloading capable are "un-accelerated" by the bonding driver so the VLAN tag sits in the regular location. VLAN interfaces *must* be added on top of a bonding interface -only after enslaving at least one slave. The bonding interface has a -hardware address of 00:00:00:00:00:00 until the first slave is added. -If the VLAN interface is created prior to the first enslavement, it -would pick up the all-zeroes hardware address. Once the first slave +only after enslaving at least one port. The bonding interface has a +hardware address of 00:00:00:00:00:00 until the first port is added. +If the VLAN interface is created prior to the first port binding, it +would pick up the all-zeroes hardware address. Once the first port is attached to the bond, the bond device itself will pick up the -slave's hardware address, which is then available for the VLAN device. +port's hardware address, which is then available for the VLAN device. -Also, be aware that a similar problem can occur if all slaves +Also, be aware that a similar problem can occur if all ports are released from a bond that still has one or more VLAN interfaces on -top of it. When a new slave is added, the bonding interface will -obtain its hardware address from the first slave, which might not +top of it. When a new port is added, the bonding interface will +obtain its hardware address from the first port, which might not match the hardware address of the VLAN interfaces (which was -ultimately copied from an earlier slave). +ultimately copied from an earlier port). There are two methods to insure that the VLAN device operates -with the correct hardware address if all slaves are removed from a +with the correct hardware address if all ports are removed from a bond interface: 1. Remove all VLAN interfaces then recreate them
@@ -1907,7 +2018,7 @@ mode, which might not be what you want. ================== The bonding driver at present supports two schemes for -monitoring a slave device's link state: the ARP monitor and the MII +monitoring a port device's link state: the ARP monitor and the MII monitor. At the present time, due to implementation restrictions in the
@@ -1927,8 +2038,8 @@ The ARP monitor relies on the device driver itself to verify that traffic is flowing. In particular, the driver must keep up to date the last receive time, dev->last_rx. Drivers that use NETIF_F_LLTX flag must also update netdev_queue->trans_start. If they do not, then the -ARP monitor will immediately fail any slaves using that driver, and -those slaves will stay down. If networking monitoring (tcpdump, etc) +ARP monitor will immediately fail any ports using that driver, and +those ports will stay down. If networking monitoring (tcpdump, etc) shows the ARP requests and replies on the network, then it may be that your device driver is not updating last_rx and trans_start.
@@ -1987,10 +2098,10 @@ up. 8.1 Adventures in Routing ------------------------- -When bonding is configured, it is important that the slave -devices not have routes that supersede routes of the master (or, +When bonding is configured, it is important that the port +devices not have routes that supersede routes of the bond (or, generally, not have routes at all). For example, suppose the bonding -device bond0 has two slaves, eth0 and eth1, and the routing table is +device bond0 has two ports, eth0 and eth1, and the routing table is as follows:: Kernel IP routing table
@@ -2013,9 +2124,9 @@ as an unsolicited ARP reply (because ARP matches replies on an interface basis), and is discarded. The MII monitor is not affected by the state of the routing table. -The solution here is simply to insure that slaves do not have +The solution here is simply to insure that ports do not have routes of their own, and if for some reason they must, those routes do -not supersede routes of their master. This should generally be the +not supersede routes of their bond. This should generally be the case, but unusual configurations or errant manual or automatic static route additions may cause trouble.
@@ -2037,12 +2148,12 @@ For example, given a modules.conf containing the following:: alias eth2 e1000 alias eth3 e1000 -If neither eth0 and eth1 are slaves to bond0, then when the +If neither eth0 and eth1 are ports to bond0, then when the bond0 interface comes up, the devices may end up reordered. This -happens because bonding is loaded first, then its slave device's +happens because bonding is loaded first, then its port device's drivers are loaded next. Since no other drivers have been loaded, when the e1000 driver loads, it will receive eth0 and eth1 for its -devices, but the bonding configuration tries to enslave eth2 and eth3 +devices, but the bonding configuration tries to connect eth2 and eth3 (which may later be assigned to the tg3 devices). Adding the following::
@@ -2099,7 +2210,7 @@ before any network drivers participating in a bond. This requirement is due to the interface index (ipAdEntIfIndex) being associated to the first interface found with a given IP address. That is, there is only one ipAdEntIfIndex for each IP address. For example, if eth0 and -eth1 are slaves of bond0 and the driver for eth0 is loaded before the +eth1 are ports of bond0 and the driver for eth0 is loaded before the bonding driver, the interface for the IP address will be associated with the eth0 interface. This configuration is shown below, the IP address 192.168.1.1 has an interface index of 2 which indexes to eth0
@@ -2146,25 +2257,25 @@ When running network monitoring tools, e.g., tcpdump, it is common to enable promiscuous mode on the device, so that all traffic is seen (instead of seeing only traffic destined for the local host). The bonding driver handles promiscuous mode changes to the bonding -master device (e.g., bond0), and propagates the setting to the slave +bond device (e.g., bond0), and propagates the setting to the port devices. For the balance-rr, balance-xor, broadcast, and 802.3ad modes, -the promiscuous mode setting is propagated to all slaves. +the promiscuous mode setting is propagated to all ports. For the active-backup, balance-tlb and balance-alb modes, the -promiscuous mode setting is propagated only to the active slave. +promiscuous mode setting is propagated only to the active port. -For balance-tlb mode, the active slave is the slave currently +For balance-tlb mode, the active port is the port currently receiving inbound traffic. -For balance-alb mode, the active slave is the slave used as a -"primary." This slave is used for mode-specific control traffic, for +For balance-alb mode, the active port is the port used as a +"primary." This port is used for mode-specific control traffic, for sending to peers that are unassigned or if the load is unbalanced. For the active-backup, balance-tlb and balance-alb modes, when -the active slave changes (e.g., due to a link failure), the -promiscuous setting will be propagated to the new active slave. +the active port changes (e.g., due to a link failure), the +promiscuous setting will be propagated to the new active port. 11. Configuring Bonding for High Availability =============================================
@@ -2464,7 +2575,7 @@ balance-tlb: special switch configuration is required. On the down side, in this mode all incoming traffic arrives over a single interface, this mode requires certain ethtool support in the - network device driver of the slave interfaces, and the ARP + network device driver of the port interfaces, and the ARP monitor is not available. balance-alb:
@@ -2571,7 +2682,7 @@ help. Note that when a bonding interface has no active links, the driver will immediately reuse the first link that goes up, even if the updelay parameter has been specified (the updelay is ignored in this -case). If there are slave interfaces waiting for the updelay timeout +case). If there are port interfaces waiting for the updelay timeout to expire, the interface that first went into that state will be immediately reused. This reduces down time of the network if the value of updelay has been overestimated, and since this occurs only in
@@ -2594,9 +2705,9 @@ It is not uncommon to observe a short burst of duplicated traffic when the bonding device is first used, or after it has been idle for some period of time. This is most easily observed by issuing a "ping" to some other host on the network, and noticing that the -output from ping flags duplicates (typically one per slave). +output from ping flags duplicates (typically one per port). -For example, on a bond in active-backup mode with five slaves +For example, on a bond in active-backup mode with five ports all connected to one switch, the output may appear as follows:: # ping -n 10.0.4.2
@@ -2618,7 +2729,7 @@ traffic to all ports until its MAC forwarding table is updated. Since the interfaces attached to the bond may occupy multiple ports on a single switch, when the switch (temporarily) floods the traffic to all ports, the bond device receives multiple copies of the same packet -(one per slave device). +(one per port device). The duplicated packet behavior is switch dependent, some switches exhibit this, and some do not. On switches that display this
@@ -2752,22 +2863,22 @@ Any Ethernet type cards (you can even mix cards - a Intel EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes, devices need not be of the same speed. -Starting with version 3.2.1, bonding also supports Infiniband -slaves in active-backup mode. +Starting with version 3.2.1, bonding also supports Infiniband ports, +but only in active-backup mode and with exactly 2 ports per bond. 3. How many bonding devices can I have? ---------------------------------------- There is no limit. -4. How many slaves can a bonding device have? +4. How many ports can a bonding device have? ---------------------------------------------- This is limited only by the number of network interfaces Linux supports and/or the number of network cards you can place in your -system. +system, outside of the Infiniband case. -5. What happens when a slave link dies? +5. What happens when a port link dies? ---------------------------------------- If link monitoring is enabled, then the failing device will be
@@ -2819,14 +2930,14 @@ The active-backup mode should work with any Layer-II switch. 8. Where does a bonding device get its MAC address from? --------------------------------------------------------- -When using slave devices that have fixed MAC addresses, or when +When using port devices that have fixed MAC addresses, or when the fail_over_mac option is enabled, the bonding device's MAC address is -the MAC address of the active slave. +the MAC address of the active port. For other configurations, if not explicitly configured (with ifconfig or ip link), the MAC address of the bonding device is taken from -its first slave device. This MAC address is then passed to all following -slaves and remains persistent (even if the first slave is removed) until +its first port device. This MAC address is then passed to all following +ports and remains persistent (even if the first port is removed) until the bonding device is brought down or reconfigured. If you wish to change the MAC address, you can set it with
@@ -2837,19 +2948,23 @@ ifconfig or ip link:: # ip link set bond0 address 66:77:88:99:aa:bb The MAC address can be also changed by bringing down/up the -device and then changing its slaves (or their order):: +device and then changing its ports (or their order):: # ifconfig bond0 down ; modprobe -r bonding # ifconfig bond0 .... up # ifenslave bond0 eth... + -- or -- + # ip link set bond0 down ; modprobe -r bonding + # ip link set bond0 .... up + # ip link set eth... master bond0 This method will automatically take the address from the next -slave that is added. +port that is added. -To restore your slaves' MAC addresses, you need to detach them -from the bond (``ifenslave -d bond0 eth0``). The bonding driver will -then restore the MAC addresses that the slaves had before they were -enslaved. +To restore your ports' MAC addresses, you need to detach them +from the bond (``ifenslave -d bond0 eth0`` or ``ip link set eth0 nomaster``). +The bonding driver will then restore the MAC addresses that the ports had +before they were connected. 16. Resources and Links =======================
Signature · 1 line
2.28.0
Jakub Kicinski
maintainerQuoted 7 lines · On Fri, 6 Nov 2020 15:04:31 -0500 Jarod Wilson wrote:
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
If we decide to go ahead with this, we should probably also use it as an opportunity to clean up the more egregious checkpatch warnings, WDYT?
Plan minimum - don't add new ones ;)
Quoted 10 lines · Jakub Kicinski
Quoted 7 lines · On Fri, 6 Nov 2020 15:04:31 -0500 Jarod Wilson wrote:
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
Quoted 4 lines
If we decide to go ahead with this, we should probably also use it as an opportunity to clean up the more egregious checkpatch warnings, WDYT?
Plan minimum - don't add new ones ;)
Hm. I hadn't actually looked at checkpatch output until now. It's... noisy here. But I'm pretty sure the vast majority of that is from existing issues, simply reported now due to all the renaming. I can certainly take a crack at cleanups, but I'd be worried about missing another merge window trying to sort all of these, when they're not directly related.
Signature · 2 lines
Jarod Wilson [email protected]
Jakub Kicinski
maintainerQuoted 10 lines · On Mon, 9 Nov 2020 11:47:58 -0500 Jarod Wilson wrote:
Quoted 9 lines · Jakub Kicinski
Quoted 7 lines · On Fri, 6 Nov 2020 15:04:31 -0500 Jarod Wilson wrote:
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
Quoted 8 lines
Quoted 4 lines
If we decide to go ahead with this, we should probably also use it as an opportunity to clean up the more egregious checkpatch warnings, WDYT?
Plan minimum - don't add new ones ;)
Hm. I hadn't actually looked at checkpatch output until now. It's... noisy here. But I'm pretty sure the vast majority of that is from existing issues, simply reported now due to all the renaming.
I don't think all of them:
- tx_slave = slaves->arr[hash_index %
+ tx_port = ports->arr[hash_index %
count];
It should be relatively trivial to find incremental warnings.
AFAIR checkpatch has a mode to run on a file, not on a patch, so you can run it before and after and diff.
Quoted 4 lines
I can
certainly take a crack at cleanups, but I'd be worried about missing another merge window trying to sort all of these, when they're not directly related.
TBH I haven't followed the previous discussions too closely, as much as I applaud the effort I'm not signing up for reviewing 3.5kLoC of renames, so I hope you can find someone to review this for you.
Another simple confidence booster would be a confirmation that given patches do not change the object code.
Quoted 15 lines · Jarod Wilson
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
There are a few problems with this change. First up, "port" is used in the bonding 802.3ad code, so the first step here is to rename port to
ad_port, so we can reuse port. Second, we have the issue of not wanting to break any existing userspace, which I believe this patchset accomplishes, preserving all existing sysfs and procfs interfaces, and adding module parameter aliases where necessary.
Quoted 14 lines
Third, we do still have the issue of ease of backporting fixes to -stable trees. I've not had a huge amount of time to spend on it, but brief forays into coccinelle didn't really pay off (since it's meant to operate on code, not patches), and the best solution I can come up with is providing a shell script someone could run over git-format-patch output before git-am'ing the result to a -stable tree, though scripting these changes in the first place turned out to be not the best thing to do anyway, due to subtle cases where use of master or slave can NOT yet be replaced, so a large amount of work was done by hand, inspection, trial and error, which is why this set is a lot longer in coming than I'd originally hoped. I don't expect -stable backports to be horrible to figure out one way or another though, and I don't believe that a bit of inconvenience on that front is enough to warrant not making these changes.
I think this undersells the impact a bit; this will most likely
break the majority of cherry-picks for the bonding driver to stable going forward should this patch set be committed. Yes, the volume of patches to bonding is relatively low, and the manual backports are not likely to be technically difficult. Nevertheless, I expect that most bonding backports to stable that cross this patch set will require manual intervention.
As such, I'd still like to see explicit direction from the
kernel development community leadership that change sets of this nature (not technically driven, with long term maintenance implications) are changes that should be undertaken rather than are merely permitted.
-J
Quoted 67 lines
See here for further details on Red Hat's commitment to this work:
https://www.redhat.com/en/blog/making-open-source-more-inclusive-eradicating-problematic-languageAs far as testing goes, I've manually operated on various bonds while working on this code, and have run it through multiple lnst test runs, which exercises the existing sysfs interfaces fairly extensively. As far as I can tell through testing and inspection, there is no breakage of any existing interfaces with this set.
v2: legacy module parameters are retained this time, and we're trying out bond/port instead of aggregator/link in place of master/slave. The procfs interface legacy output is also duplicated or dropped, depending on
Kconfig, rather than being replaced.v3: remove
Kconfigknob, leave sysfs and procfs interfaces entirely untouched, but update documentation to reference their deprecated nature, explain the name changes, add references to NetworkManager, include more netlink/iproute2 examples and make note of netlink being the preferred interface for userspace interaction with bonds.v4: documentation table of contents fixes
Cc Jay Vosburgh <[email protected]>Cc Veaceslav Falico <[email protected]>Cc Andy Gospodarek <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Thomas Davis <[email protected]>Jarod Wilson (5):
bonding: rename 802.3ad's struct port toad_port
bonding: replace use of the term master where possible
bonding: rename slave to port where possible
bonding: renamebonding_sysfs_slave.cto_port.c
bonding: update Documentation for port/bond terminology.clang-format | 4 +- Documentation/networking/bonding.rst | 581 ++-- drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/core/lag.c | 2 +- drivers/infiniband/core/roce_gid_mgmt.c | 10 +- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/net/bonding/Makefile | 2 +- drivers/net/bonding/bond_3ad.c | 1701 ++++++------ drivers/net/bonding/bond_alb.c | 689 ++--- drivers/net/bonding/bond_debugfs.c | 2 +- drivers/net/bonding/bond_main.c | 2341 +++++++++-------- drivers/net/bonding/bond_netlink.c | 114 +- drivers/net/bonding/bond_options.c | 258 +- drivers/net/bonding/bond_procfs.c | 86 +- drivers/net/bonding/bond_sysfs.c | 78 +- drivers/net/bonding/bond_sysfs_port.c | 185 ++ drivers/net/bonding/bond_sysfs_slave.c | 176 -- .../ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 +- .../net/ethernet/mellanox/mlx4/en_netdev.c | 14 +- .../ethernet/mellanox/mlx5/core/en/rep/bond.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../ethernet/netronome/nfp/flower/lag_conf.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 12 +- include/linux/netdevice.h | 22 +- include/net/bond_3ad.h | 42 +- include/net/bond_alb.h | 74 +- include/net/bond_options.h | 18 +- include/net/bonding.h | 362 +-- include/net/lag.h | 2 +- 29 files changed, 3482 insertions(+), 3307 deletions(-)
Quoted 6 lines
create mode 100644
drivers/net/bonding/bond_sysfs_port.cdelete mode 100644drivers/net/bonding/bond_sysfs_slave.cSignature · 1 line
2.28.0
---
-Jay Vosburgh, [email protected]
Jakub Kicinski
maintainerQuoted 40 lines · On Wed, 11 Nov 2020 12:13:56 -0800 Jay Vosburgh wrote:
Quoted 15 lines · Jarod Wilson
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
There are a few problems with this change. First up, "port" is used in the bonding 802.3ad code, so the first step here is to rename port to
ad_port, so we can reuse port. Second, we have the issue of not wanting to break any existing userspace, which I believe this patchset accomplishes, preserving all existing sysfs and procfs interfaces, and adding module parameter aliases where necessary.Quoted 14 lines
Third, we do still have the issue of ease of backporting fixes to -stable trees. I've not had a huge amount of time to spend on it, but brief forays into coccinelle didn't really pay off (since it's meant to operate on code, not patches), and the best solution I can come up with is providing a shell script someone could run over git-format-patch output before git-am'ing the result to a -stable tree, though scripting these changes in the first place turned out to be not the best thing to do anyway, due to subtle cases where use of master or slave can NOT yet be replaced, so a large amount of work was done by hand, inspection, trial and error, which is why this set is a lot longer in coming than I'd originally hoped. I don't expect -stable backports to be horrible to figure out one way or another though, and I don't believe that a bit of inconvenience on that front is enough to warrant not making these changes.
I think this undersells the impact a bit; this will most likely
break the majority of cherry-picks for the bonding driver to stable going forward should this patch set be committed. Yes, the volume of patches to bonding is relatively low, and the manual backports are not likely to be technically difficult. Nevertheless, I expect that most bonding backports to stable that cross this patch set will require manual intervention.
Quoted 4 lines
As such, I'd still like to see explicit direction from the
kernel development community leadership that change sets of this nature (not technically driven, with long term maintenance implications) are changes that should be undertaken rather than are merely permitted.
Yeah, IDK. I think it's up to you as the maintainer of this code to make a call based on the specific circumstances. All we have AFAIK is the coding style statement which discourages new uses:
For symbol names and documentation, avoid introducing new usage of 'master / slave' (or 'slave' independent of 'master') and 'blacklist / whitelist'.
Recommended replacements for 'master / slave' are:
'{primary,main} / {secondary,replica,subordinate}' '{initiator,requester} / {target,responder}' '{controller,host} / {device,worker,proxy}' 'leader / follower'
'director / performer'
Recommended replacements for 'blacklist/whitelist' are:
'denylist / allowlist'
'blocklist / passlist'
Exceptions for introducing new usage is to maintain a userspace ABI/API, or when updating code for an existing (as of 2020) hardware or protocol specification that mandates those terms. For new specifications translate specification usage of the terminology to the kernel coding standard where possible.
Quoted 66 lines · Jakub Kicinski
Quoted 40 lines · On Wed, 11 Nov 2020 12:13:56 -0800 Jay Vosburgh wrote:
Quoted 15 lines · Jarod Wilson
The bonding driver's use of master and slave, while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. This is a first full pass at replacing those phrases with more socially inclusive ones, opting for bond to replace master and port to replace slave, which is congruent with the bridge and team drivers.
There are a few problems with this change. First up, "port" is used in the bonding 802.3ad code, so the first step here is to rename port to
ad_port, so we can reuse port. Second, we have the issue of not wanting to break any existing userspace, which I believe this patchset accomplishes, preserving all existing sysfs and procfs interfaces, and adding module parameter aliases where necessary.Quoted 14 lines
Third, we do still have the issue of ease of backporting fixes to -stable trees. I've not had a huge amount of time to spend on it, but brief forays into coccinelle didn't really pay off (since it's meant to operate on code, not patches), and the best solution I can come up with is providing a shell script someone could run over git-format-patch output before git-am'ing the result to a -stable tree, though scripting these changes in the first place turned out to be not the best thing to do anyway, due to subtle cases where use of master or slave can NOT yet be replaced, so a large amount of work was done by hand, inspection, trial and error, which is why this set is a lot longer in coming than I'd originally hoped. I don't expect -stable backports to be horrible to figure out one way or another though, and I don't believe that a bit of inconvenience on that front is enough to warrant not making these changes.
I think this undersells the impact a bit; this will most likely
break the majority of cherry-picks for the bonding driver to stable going forward should this patch set be committed. Yes, the volume of patches to bonding is relatively low, and the manual backports are not likely to be technically difficult. Nevertheless, I expect that most bonding backports to stable that cross this patch set will require manual intervention.Quoted 4 lines
As such, I'd still like to see explicit direction from the
kernel development community leadership that change sets of this nature (not technically driven, with long term maintenance implications) are changes that should be undertaken rather than are merely permitted.Yeah, IDK. I think it's up to you as the maintainer of this code to make a call based on the specific circumstances. All we have AFAIK is the coding style statement which discourages new uses:
For symbol names and documentation, avoid introducing new usage of 'master / slave' (or 'slave' independent of 'master') and 'blacklist / whitelist'.
Recommended replacements for 'master / slave' are:
'{primary,main} / {secondary,replica,subordinate}' '{initiator,requester} / {target,responder}' '{controller,host} / {device,worker,proxy}' 'leader / follower'
'director / performer'Recommended replacements for 'blacklist/whitelist' are:
'denylist / allowlist'
'blocklist / passlist'
Quoted 5 lines
Exceptions for introducing new usage is to maintain a userspace ABI/API, or when updating code for an existing (as of 2020) hardware or protocol specification that mandates those terms. For new specifications translate specification usage of the terminology to the kernel coding standard where possible.
Haven't been able to put much time into this the past few weeks, too many other things going on leading into the holidays... But I think Red Hat's general stance on this is that leaving things the way they are is akin to condoning them. For change to happen, change needs to happen. I know this starts to get political in a hurry though. I'd like to see the changes made, even if there's a bit of pain involved (clearly, since I've dumped this much time and effort into it so far). :)
I'll try to address issues raised with this version, including the checkpatch bits, but it may not be until after the first of the year at this point, with assorted projects trying to get wrapped up before the holidays, then the holidays themselves, etc.
Signature · 2 lines
Jarod Wilson [email protected]