[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200922133731.33478-3-jarod@redhat.com>
Date: Tue, 22 Sep 2020 09:37:28 -0400
From: Jarod Wilson <jarod@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Jarod Wilson <jarod@...hat.com>,
Jay Vosburgh <j.vosburgh@...il.com>,
Veaceslav Falico <vfalico@...il.com>,
Andy Gospodarek <andy@...yhouse.net>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Thomas Davis <tadavis@....gov>, netdev@...r.kernel.org
Subject: [PATCH net-next 2/5] bonding: rename slave to link where possible
Getting rid of as much usage of "slave" as we can here, without breaking
any user-facing API.
Cc: Jay Vosburgh <j.vosburgh@...il.com>
Cc: Veaceslav Falico <vfalico@...il.com>
Cc: Andy Gospodarek <andy@...yhouse.net>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Thomas Davis <tadavis@....gov>
Cc: netdev@...r.kernel.org
Signed-off-by: Jarod Wilson <jarod@...hat.com>
---
.clang-format | 4 +-
drivers/infiniband/core/roce_gid_mgmt.c | 4 +-
drivers/infiniband/hw/mlx4/main.c | 2 +-
drivers/net/bonding/Makefile | 2 +-
drivers/net/bonding/bond_3ad.c | 598 ++---
drivers/net/bonding/bond_alb.c | 682 ++---
drivers/net/bonding/bond_debugfs.c | 2 +-
drivers/net/bonding/bond_main.c | 2304 ++++++++---------
drivers/net/bonding/bond_netlink.c | 104 +-
drivers/net/bonding/bond_options.c | 255 +-
drivers/net/bonding/bond_procfs.c | 48 +-
drivers/net/bonding/bond_sysfs.c | 104 +-
drivers/net/bonding/bond_sysfs_link.c | 189 ++
drivers/net/bonding/bond_sysfs_slave.c | 176 --
.../ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 +-
.../net/ethernet/mellanox/mlx4/en_netdev.c | 4 +-
.../ethernet/mellanox/mlx5/core/en/rep/bond.c | 2 +-
.../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 | 20 +-
include/net/bond_alb.h | 30 +-
include/net/bond_options.h | 19 +-
include/net/bonding.h | 342 +--
include/net/lag.h | 2 +-
25 files changed, 2497 insertions(+), 2420 deletions(-)
create mode 100644 drivers/net/bonding/bond_sysfs_link.c
delete mode 100644 drivers/net/bonding/bond_sysfs_slave.c
diff --git a/.clang-format b/.clang-format
index a0a96088c74f..ba3654ff2762 100644
--- a/.clang-format
+++ b/.clang-format
@@ -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_link'
+ - 'bond_for_each_link_rcu'
- 'bpf_for_each_spilled_reg'
- 'btree_for_each_safe128'
- 'btree_for_each_safe32'
diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c
index 2860def84f4d..d0ada1756564 100644
--- a/drivers/infiniband/core/roce_gid_mgmt.c
+++ b/drivers/infiniband/core/roce_gid_mgmt.c
@@ -131,7 +131,7 @@ static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu(struct net_de
{
if (upper && netif_is_bond_master(upper)) {
struct net_device *pdev =
- bond_option_active_slave_get_rcu(netdev_priv(upper));
+ bond_option_active_link_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_link(rdma_ndev)) ||
(netif_is_bond_master(cookie_ndev) &&
rdma_is_upper_dev_rcu(rdma_ndev, cookie_ndev)));
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 5e7910a517da..7a75bebd5b74 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -145,7 +145,7 @@ static struct net_device *mlx4_ib_get_netdev(struct ib_device *device, u8 port_n
if (upper) {
struct net_device *active;
- active = bond_option_active_slave_get_rcu(netdev_priv(upper));
+ active = bond_option_active_link_get_rcu(netdev_priv(upper));
if (active)
dev = active;
}
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 30e8ae3da2da..6ee96eda41a6 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -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_link.o bond_debugfs.o bond_netlink.o bond_options.o
proc-$(CONFIG_PROC_FS) += bond_procfs.o
bonding-objs += $(proc-y)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index e55b73aa3043..aec4cd6918b9 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -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 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_mux_machine(struct port *port, bool *update_link_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 void ad_port_selection_logic(struct port *port, bool *update_link_arr);
static void ad_agg_selection_logic(struct aggregator *aggregator,
- bool *update_slave_arr);
+ bool *update_link_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,
- bool *update_slave_arr);
+ bool *update_link_arr);
static void ad_disable_collecting_distributing(struct port *port,
- bool *update_slave_arr);
+ bool *update_link_arr);
static void ad_marker_info_received(struct bond_marker *marker_info,
struct port *port);
static void ad_marker_response_received(struct bond_marker *marker,
@@ -122,33 +122,33 @@ static void ad_update_actor_keys(struct port *port, bool reset);
*/
static inline struct bonding *__get_bond_by_port(struct port *port)
{
- if (port->slave == NULL)
+ if (port->link == NULL)
return NULL;
- return bond_get_bond_by_slave(port->slave);
+ return bond_get_bond_by_link(port->link);
}
/**
* __get_first_agg - get the first aggregator in the bond
* @port: the 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 link 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)
{
struct bonding *bond = __get_bond_by_port(port);
- struct slave *first_slave;
+ struct link *first_link;
struct aggregator *agg;
- /* If there's no bond for this port, or bond has no slaves */
+ /* If there's no bond for this port, or bond has no links */
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_link = bond_first_link_rcu(bond);
+ agg = first_link ? &(LINK_AD_INFO(first_link)->aggregator) : NULL;
rcu_read_unlock();
return agg;
@@ -167,33 +167,33 @@ static inline int __agg_has_partner(struct aggregator *agg)
}
/**
- * __disable_port - disable the port's slave
+ * __disable_port - disable the port's link
* @port: the port we're looking at
*/
static inline void __disable_port(struct port *port)
{
- bond_set_slave_inactive_flags(port->slave, BOND_SLAVE_NOTIFY_LATER);
+ bond_set_link_inactive_flags(port->link, BOND_LINK_NOTIFY_LATER);
}
/**
- * __enable_port - enable the port's slave, if it's up
+ * __enable_port - enable the port's link, if it's up
* @port: the port we're looking at
*/
static inline void __enable_port(struct port *port)
{
- struct slave *slave = port->slave;
+ struct link *link = port->link;
- if ((slave->link_state == BOND_LINK_UP) && bond_slave_is_up(slave))
- bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER);
+ if ((link->link_state == BOND_LINK_UP) && bond_link_is_up(link))
+ bond_set_link_active_flags(link, BOND_LINK_NOTIFY_LATER);
}
/**
- * __port_is_enabled - check if the port's slave is in active state
+ * __port_is_enabled - check if the port's link is in active state
* @port: the port we're looking at
*/
static inline int __port_is_enabled(struct port *port)
{
- return bond_is_active_slave(port->slave);
+ return bond_is_active_link(port->link);
}
/**
@@ -248,7 +248,7 @@ static inline int __check_agg_selection_timer(struct port *port)
*/
static u16 __get_link_speed(struct port *port)
{
- struct slave *slave = port->slave;
+ struct link *link = port->link;
u16 speed;
/* this if covers only a special case: when the configuration starts
@@ -256,10 +256,10 @@ static u16 __get_link_speed(struct port *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_state != BOND_LINK_UP)
+ if (link->link_state != BOND_LINK_UP)
speed = 0;
else {
- switch (slave->speed) {
+ switch (link->speed) {
case SPEED_10:
speed = AD_LINK_SPEED_10MBPS;
break;
@@ -314,18 +314,18 @@ static u16 __get_link_speed(struct port *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 (link->speed != SPEED_UNKNOWN)
+ pr_warn_once("%s: (link %s): unknown ethtool speed (%d) for port %d (set it to 0)\n",
+ link->bond->dev->name,
+ link->dev->name, link->speed,
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);
+ link_dbg(link->bond->dev, link->dev, "Port %d Received link speed %d update from adapter\n",
+ port->actor_port_number, speed);
return speed;
}
@@ -339,24 +339,24 @@ static u16 __get_link_speed(struct port *port)
*/
static u8 __get_duplex(struct port *port)
{
- struct slave *slave = port->slave;
+ struct link *link = port->link;
u8 retval = 0x0;
/* handling a special case: when the configuration starts with
* link down, it sets the duplex to 0.
*/
- if (slave->link_state == BOND_LINK_UP) {
- switch (slave->duplex) {
+ if (link->link_state == BOND_LINK_UP) {
+ switch (link->duplex) {
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);
+ link_dbg(link->bond->dev, link->dev, "Port %d Received status full duplex update from adapter\n",
+ 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);
+ link_dbg(link->bond->dev, link->dev, "Port %d Received status NOT full duplex update from adapter\n",
+ port->actor_port_number);
break;
}
}
@@ -365,7 +365,7 @@ static u8 __get_duplex(struct port *port)
static void __ad_actor_update_port(struct port *port)
{
- const struct bonding *bond = bond_get_bond_by_slave(port->slave);
+ const struct bonding *bond = bond_get_bond_by_link(port->link);
port->actor_system = BOND_AD_INFO(bond).system.sys_mac_addr;
port->actor_system_priority = BOND_AD_INFO(bond).system.sys_priority;
@@ -490,12 +490,12 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port)
if ((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,
- "partner sync=1\n");
+ link_dbg(port->link->bond->dev, port->link->dev,
+ "partner sync=1\n");
} else {
partner->port_state &= ~LACP_STATE_SYNCHRONIZATION;
- slave_dbg(port->slave->bond->dev, port->slave->dev,
- "partner sync=0\n");
+ link_dbg(port->link->bond->dev, port->link->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->link->bond;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
- 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_link_rcu(bond, link, iter)
+ if (LINK_AD_INFO(link)->aggregator.is_active)
+ return &(LINK_AD_INFO(link)->aggregator);
return NULL;
}
@@ -781,9 +781,9 @@ static inline void __update_lacpdu_from_port(struct port *port)
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);
+ link_dbg(port->link->bond->dev, port->link->dev,
+ "update lacpdu: actor port state %x\n",
+ 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_port(struct port *port)
*/
static int ad_lacpdu_send(struct port *port)
{
- struct slave *slave = port->slave;
+ struct link *link = port->link;
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 port *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(&LINK_AD_INFO(link)->stats.lacpdu_tx);
+ atomic64_inc(&BOND_AD_INFO(link->bond).stats.lacpdu_tx);
- skb->dev = slave->dev;
+ skb->dev = link->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 port *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, link->perm_hwaddr);
lacpdu_header->hdr.h_proto = PKT_TYPE_LACPDU;
lacpdu_header->lacpdu = port->lacpdu;
@@ -863,7 +863,7 @@ static int ad_lacpdu_send(struct port *port)
*/
static int ad_marker_send(struct port *port, struct bond_marker *marker)
{
- struct slave *slave = port->slave;
+ struct link *link = port->link;
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 port *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(&LINK_AD_INFO(link)->stats.marker_tx);
+ atomic64_inc(&BOND_AD_INFO(link->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(&LINK_AD_INFO(link)->stats.marker_resp_tx);
+ atomic64_inc(&BOND_AD_INFO(link->bond).stats.marker_resp_tx);
break;
}
skb_reserve(skb, 16);
- skb->dev = slave->dev;
+ skb->dev = link->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 port *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, link->perm_hwaddr);
marker_header->hdr.h_proto = PKT_TYPE_LACPDU;
marker_header->marker = *marker;
@@ -909,9 +909,9 @@ 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
- * @update_slave_arr: Does slave array need update?
+ * @update_link_arr: Does link array need update?
*/
-static void ad_mux_machine(struct port *port, bool *update_slave_arr)
+static void ad_mux_machine(struct port *port, bool *update_link_arr)
{
mux_states_t last_state;
@@ -1015,16 +1015,16 @@ 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,
- "Mux Machine: Port=%d, Last State=%d, Curr State=%d\n",
- port->actor_port_number,
- last_state,
- port->sm_mux_state);
+ link_dbg(port->link->bond->dev, port->link->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) {
case AD_MUX_DETACHED:
port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION;
ad_disable_collecting_distributing(port,
- update_slave_arr);
+ update_link_arr);
port->actor_oper_port_state &= ~LACP_STATE_COLLECTING;
port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING;
port->ntt = true;
@@ -1042,7 +1042,7 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
port->actor_oper_port_state &= ~LACP_STATE_COLLECTING;
port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING;
ad_disable_collecting_distributing(port,
- update_slave_arr);
+ update_link_arr);
port->ntt = true;
break;
case AD_MUX_COLLECTING_DISTRIBUTING:
@@ -1050,7 +1050,7 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
port->actor_oper_port_state |= LACP_STATE_DISTRIBUTING;
port->actor_oper_port_state |= LACP_STATE_SYNCHRONIZATION;
ad_enable_collecting_distributing(port,
- update_slave_arr);
+ update_link_arr);
port->ntt = true;
break;
default:
@@ -1078,8 +1078,8 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
last_state = 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(&LINK_AD_INFO(port->link)->stats.lacpdu_rx);
+ atomic64_inc(&BOND_AD_INFO(port->link->bond).stats.lacpdu_rx);
}
/* check if state machine should change state */
@@ -1133,11 +1133,11 @@ 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,
- "Rx Machine: Port=%d, Last State=%d, Curr State=%d\n",
- port->actor_port_number,
- last_state,
- port->sm_rx_state);
+ link_dbg(port->link->bond->dev, port->link->dev,
+ "Rx Machine: Port=%d, Last State=%d, Curr State=%d\n",
+ port->actor_port_number,
+ last_state,
+ port->sm_rx_state);
switch (port->sm_rx_state) {
case AD_RX_INITIALIZE:
if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_MASKS))
@@ -1185,8 +1185,8 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
/* 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"
- "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n");
+ link_err(port->link->bond->dev, port->link->dev, "An illegal loopback occurred on link\n"
+ "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n");
return;
}
__update_selected(lacpdu, port);
@@ -1255,10 +1255,10 @@ static void ad_tx_machine(struct port *port)
__update_lacpdu_from_port(port);
if (ad_lacpdu_send(port) >= 0) {
- slave_dbg(port->slave->bond->dev,
- port->slave->dev,
- "Sent LACPDU on port %d\n",
- port->actor_port_number);
+ link_dbg(port->link->bond->dev,
+ port->link->dev,
+ "Sent LACPDU on port %d\n",
+ port->actor_port_number);
/* mark ntt as false, so it will not be sent
* again until demanded
@@ -1337,10 +1337,10 @@ 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,
- "Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n",
- port->actor_port_number, last_state,
- port->sm_periodic_state);
+ link_dbg(port->link->bond->dev, port->link->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) {
case AD_NO_PERIODIC:
port->sm_periodic_timer_counter = 0;
@@ -1365,19 +1365,19 @@ static void ad_periodic_machine(struct port *port)
/**
* ad_port_selection_logic - select aggregation groups
* @port: the port we're looking at
- * @update_slave_arr: Does slave array need update?
+ * @update_link_arr: Does link array need update?
*
* Select aggregation groups, and assign each 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 port *port, bool *update_link_arr)
{
struct aggregator *aggregator, *free_aggregator = NULL, *temp_aggregator;
struct port *last_port = NULL, *curr_port;
struct list_head *iter;
struct bonding *bond;
- struct slave *slave;
+ struct link *link;
int found = 0;
/* if the port is already Selected, do nothing */
@@ -1416,9 +1416,9 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
port->next_port_in_aggregator = NULL;
port->actor_port_aggregator_identifier = 0;
- slave_dbg(bond->dev, port->slave->dev, "Port %d left LAG %d\n",
- port->actor_port_number,
- temp_aggregator->aggregator_identifier);
+ link_dbg(bond->dev, port->link->dev, "Port %d left LAG %d\n",
+ port->actor_port_number,
+ temp_aggregator->aggregator_identifier);
/* if the aggregator is empty, clear its
* parameters, and set it ready to be attached
*/
@@ -1431,16 +1431,16 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
/* meaning: the port was related to an aggregator
* but was not on the aggregator 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,
+ net_warn_ratelimited("%s: (link %s): Warning: Port %d was related to aggregator %d but was not on its port list\n",
+ port->link->bond->dev->name,
+ port->link->dev->name,
port->actor_port_number,
port->aggregator->aggregator_identifier);
}
}
/* search on all aggregators for a suitable aggregator for this port */
- bond_for_each_slave(bond, slave, iter) {
- aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
+ bond_for_each_link(bond, link, iter) {
+ aggregator = &(LINK_AD_INFO(link)->aggregator);
/* keep a free aggregator for later use(if needed) */
if (!aggregator->lag_ports) {
@@ -1465,9 +1465,9 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
port->next_port_in_aggregator = aggregator->lag_ports;
port->aggregator->num_of_ports++;
aggregator->lag_ports = port;
- slave_dbg(bond->dev, slave->dev, "Port %d joined LAG %d (existing LAG)\n",
- port->actor_port_number,
- port->aggregator->aggregator_identifier);
+ link_dbg(bond->dev, link->dev, "Port %d joined LAG %d (existing LAG)\n",
+ port->actor_port_number,
+ port->aggregator->aggregator_identifier);
/* mark this port as selected */
port->sm_vars |= AD_PORT_SELECTED;
@@ -1512,13 +1512,13 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
/* mark this port as selected */
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);
+ link_dbg(bond->dev, port->link->dev, "Port %d joined LAG %d (new LAG)\n",
+ port->actor_port_number,
+ port->aggregator->aggregator_identifier);
} else {
- slave_err(bond->dev, port->slave->dev,
- "Port %d did not find a suitable aggregator\n",
- port->actor_port_number);
+ link_err(bond->dev, port->link->dev,
+ "Port %d did not find a suitable aggregator\n",
+ port->actor_port_number);
}
}
/* if all aggregator's ports are READY_N == TRUE, set ready=TRUE
@@ -1529,7 +1529,7 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
__agg_ports_are_ready(port->aggregator));
aggregator = __get_first_agg(port);
- ad_agg_selection_logic(aggregator, update_slave_arr);
+ ad_agg_selection_logic(aggregator, update_link_arr);
if (!port->aggregator->is_active)
port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION;
@@ -1597,9 +1597,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: (link %s): Impossible agg select mode %d\n",
+ curr->link->bond->dev->name,
+ curr->link->dev->name,
__get_agg_selection_mode(curr->lag_ports));
break;
}
@@ -1616,8 +1616,8 @@ static int agg_device_up(const struct aggregator *agg)
for (port = agg->lag_ports; port;
port = port->next_port_in_aggregator) {
- if (netif_running(port->slave->dev) &&
- netif_carrier_ok(port->slave->dev))
+ if (netif_running(port->link->dev) &&
+ netif_carrier_ok(port->link->dev))
return 1;
}
@@ -1627,7 +1627,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_link_arr: Does link array need update?
*
* It is assumed that only one aggregator may be selected for a team.
*
@@ -1640,23 +1640,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 links in the bond changes.
*
* BOND_AD_COUNT: select the aggregator with largest number of ports
- * (slaves), and reselect whenever a link state change takes place or the
- * set of slaves in the bond changes.
+ * (links), and reselect whenever a link state change takes place or the
+ * set of links 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_link_arr)
{
struct aggregator *best, *active, *origin;
- struct bonding *bond = agg->slave->bond;
+ struct bonding *bond = agg->link->bond;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
struct port *port;
rcu_read_lock();
@@ -1664,8 +1664,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_link_rcu(bond, link, iter) {
+ agg = &(LINK_AD_INFO(link)->aggregator);
agg->is_active = 0;
@@ -1700,24 +1700,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, "(link %s): best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
+ best->link ? best->link->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, "(link %s): best ports %p link %p\n",
+ best->link ? best->link->dev->name : "NULL",
+ best->lag_ports, best->link);
+
+ bond_for_each_link_rcu(bond, link, iter) {
+ agg = &(LINK_AD_INFO(link)->aggregator);
+
+ link_dbg(bond->dev, link->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 */
@@ -1726,11 +1726,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, "(link %s): LAG %d chosen as the active LAG\n",
+ best->link ? best->link->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, "(link %s): Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
+ best->link ? best->link->dev->name : "NULL",
best->aggregator_identifier, best->num_of_ports,
best->actor_oper_aggregator_key,
best->partner_oper_aggregator_key,
@@ -1745,8 +1745,8 @@ static void ad_agg_selection_logic(struct aggregator *agg,
__disable_port(port);
}
}
- /* Slave array needs update. */
- *update_slave_arr = true;
+ /* Link array needs update. */
+ *update_link_arr = true;
}
/* if the selected aggregator is of join individuals
@@ -1787,8 +1787,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->link ?
+ aggregator->link->dev->name : "NULL",
aggregator->aggregator_identifier);
}
}
@@ -1804,7 +1804,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->link = NULL;
}
}
@@ -1877,42 +1877,42 @@ static void ad_initialize_port(struct port *port, int lacp_fast)
/**
* ad_enable_collecting_distributing - enable a port's transmit/receive
* @port: the port we're looking at
- * @update_slave_arr: Does slave array need update?
+ * @update_link_arr: Does link array need update?
*
* Enable @port if it's in an active aggregator
*/
static void ad_enable_collecting_distributing(struct port *port,
- bool *update_slave_arr)
+ bool *update_link_arr)
{
if (port->aggregator->is_active) {
- slave_dbg(port->slave->bond->dev, port->slave->dev,
- "Enabling port %d (LAG %d)\n",
- port->actor_port_number,
- port->aggregator->aggregator_identifier);
+ link_dbg(port->link->bond->dev, port->link->dev,
+ "Enabling port %d (LAG %d)\n",
+ port->actor_port_number,
+ port->aggregator->aggregator_identifier);
__enable_port(port);
- /* Slave array needs update */
- *update_slave_arr = true;
+ /* Link array needs update */
+ *update_link_arr = true;
}
}
/**
* ad_disable_collecting_distributing - disable a port's transmit/receive
* @port: the port we're looking at
- * @update_slave_arr: Does slave array need update?
+ * @update_link_arr: Does link array need update?
*/
static void ad_disable_collecting_distributing(struct port *port,
- bool *update_slave_arr)
+ bool *update_link_arr)
{
if (port->aggregator &&
!MAC_ADDRESS_EQUAL(&(port->aggregator->partner_system),
&(null_mac_addr))) {
- slave_dbg(port->slave->bond->dev, port->slave->dev,
- "Disabling port %d (LAG %d)\n",
- port->actor_port_number,
- port->aggregator->aggregator_identifier);
+ link_dbg(port->link->bond->dev, port->link->dev,
+ "Disabling port %d (LAG %d)\n",
+ port->actor_port_number,
+ port->aggregator->aggregator_identifier);
__disable_port(port);
- /* Slave array needs an update */
- *update_slave_arr = true;
+ /* Link array needs an update */
+ *update_link_arr = true;
}
}
@@ -1926,8 +1926,8 @@ static void ad_marker_info_received(struct bond_marker *marker_info,
{
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(&LINK_AD_INFO(port->link)->stats.marker_rx);
+ atomic64_inc(&BOND_AD_INFO(port->link->bond).stats.marker_rx);
/* copy the received marker data to the response marker */
memcpy(&marker, marker_info, sizeof(struct bond_marker));
@@ -1936,9 +1936,9 @@ static void ad_marker_info_received(struct bond_marker *marker_info,
/* send the marker response */
if (ad_marker_send(port, &marker) >= 0)
- slave_dbg(port->slave->bond->dev, port->slave->dev,
- "Sent Marker Response on port %d\n",
- port->actor_port_number);
+ link_dbg(port->link->bond->dev, port->link->dev,
+ "Sent Marker Response on port %d\n",
+ port->actor_port_number);
}
/**
@@ -1953,8 +1953,8 @@ static void ad_marker_info_received(struct bond_marker *marker_info,
static void ad_marker_response_received(struct bond_marker *marker,
struct port *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(&LINK_AD_INFO(port->link)->stats.marker_resp_rx);
+ atomic64_inc(&BOND_AD_INFO(port->link->bond).stats.marker_resp_rx);
/* DO NOTHING, SINCE WE DECIDED NOT TO IMPLEMENT THIS FEATURE FOR NOW */
}
@@ -2014,28 +2014,28 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
}
/**
- * bond_3ad_bind_slave - initialize a slave's port
- * @slave: slave struct to work on
+ * bond_3ad_bind_link - initialize a link's port
+ * @link: link struct to work on
*
* Returns: 0 on success
* < 0 on error
*/
-void bond_3ad_bind_slave(struct slave *slave)
+void bond_3ad_bind_link(struct link *link)
{
- struct bonding *bond = bond_get_bond_by_slave(slave);
+ struct bonding *bond = bond_get_bond_by_link(link);
struct port *port;
struct aggregator *aggregator;
- /* check that the slave has not been initialized yet. */
- if (SLAVE_AD_INFO(slave)->port.slave != slave) {
+ /* check that the link has not been initialized yet. */
+ if (LINK_AD_INFO(link)->port.link != link) {
/* port initialization */
- port = &(SLAVE_AD_INFO(slave)->port);
+ port = &(LINK_AD_INFO(link)->port);
ad_initialize_port(port, bond->params.lacp_fast);
- port->slave = slave;
- port->actor_port_number = SLAVE_AD_INFO(slave)->id;
+ port->link = link;
+ port->actor_port_number = LINK_AD_INFO(link)->id;
/* key is determined according to the link speed, duplex and
* user key
*/
@@ -2051,49 +2051,49 @@ void bond_3ad_bind_slave(struct slave *slave)
__disable_port(port);
/* aggregator initialization */
- aggregator = &(SLAVE_AD_INFO(slave)->aggregator);
+ aggregator = &(LINK_AD_INFO(link)->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->link = link;
aggregator->is_active = 0;
aggregator->num_of_ports = 0;
}
}
/**
- * bond_3ad_unbind_slave - deinitialize a slave's port
- * @slave: slave struct to work on
+ * bond_3ad_unbind_link - deinitialize a link's port
+ * @link: link 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.
*/
-void bond_3ad_unbind_slave(struct slave *slave)
+void bond_3ad_unbind_link(struct link *link)
{
struct port *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 = link->bond;
+ struct link *link_iter;
struct list_head *iter;
- bool dummy_slave_update; /* Ignore this value as caller updates array */
+ bool dummy_link_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);
- port = &(SLAVE_AD_INFO(slave)->port);
+ aggregator = &(LINK_AD_INFO(link)->aggregator);
+ port = &(LINK_AD_INFO(link)->port);
- /* if slave is null, the whole port is not initialized */
- if (!port->slave) {
- slave_warn(bond->dev, slave->dev, "Trying to unbind an uninitialized port\n");
+ /* if link is null, the whole port is not initialized */
+ if (!port->link) {
+ link_warn(bond->dev, link->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);
+ link_dbg(bond->dev, link->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;
@@ -2106,15 +2106,15 @@ void bond_3ad_unbind_slave(struct slave *slave)
/* 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
+ * except the port related to this link(thats ensure us that
* there is a reason to search for new aggregator, and that we
* will find one
*/
if ((aggregator->lag_ports != port) ||
(aggregator->lag_ports->next_port_in_aggregator)) {
/* find new aggregator for the related port(s) */
- bond_for_each_slave(bond, slave_iter, iter) {
- new_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator);
+ bond_for_each_link(bond, link_iter, iter) {
+ new_aggregator = &(LINK_AD_INFO(link_iter)->aggregator);
/* if the new aggregator is empty, or it is
* connected to our port only
*/
@@ -2123,7 +2123,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
!new_aggregator->lag_ports->next_port_in_aggregator))
break;
}
- if (!slave_iter)
+ if (!link_iter)
new_aggregator = NULL;
/* if new aggregator found, copy the aggregator's
@@ -2131,13 +2131,13 @@ void bond_3ad_unbind_slave(struct slave *slave)
* new aggregator
*/
if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == 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);
+ link_dbg(bond->dev, link->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) &&
new_aggregator->is_active) {
- slave_info(bond->dev, slave->dev, "Removing an active aggregator\n");
+ link_info(bond->dev, link->dev, "Removing an active aggregator\n");
select_new_active_agg = 1;
}
@@ -2166,9 +2166,9 @@ void bond_3ad_unbind_slave(struct slave *slave)
if (select_new_active_agg)
ad_agg_selection_logic(__get_first_agg(port),
- &dummy_slave_update);
+ &dummy_link_update);
} else {
- slave_warn(bond->dev, slave->dev, "unbinding aggregator, and could not find a new aggregator for its ports\n");
+ link_warn(bond->dev, link->dev, "unbinding aggregator, and could not find a new aggregator for its ports\n");
}
} else {
/* in case that the only port related to this
@@ -2177,21 +2177,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");
+ link_info(bond->dev, link->dev, "Removing an active aggregator\n");
/* select new active aggregator */
temp_aggregator = __get_first_agg(port);
if (temp_aggregator)
ad_agg_selection_logic(temp_aggregator,
- &dummy_slave_update);
+ &dummy_link_update);
}
}
}
- slave_dbg(bond->dev, slave->dev, "Unbinding port %d\n", port->actor_port_number);
+ link_dbg(bond->dev, link->dev, "Unbinding port %d\n", port->actor_port_number);
/* find the aggregator that this port is connected to */
- bond_for_each_slave(bond, slave_iter, iter) {
- temp_aggregator = &(SLAVE_AD_INFO(slave_iter)->aggregator);
+ bond_for_each_link(bond, link_iter, iter) {
+ temp_aggregator = &(LINK_AD_INFO(link_iter)->aggregator);
prev_port = NULL;
/* search the port in the aggregator's related ports */
for (temp_port = temp_aggregator->lag_ports; temp_port;
@@ -2210,17 +2210,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");
+ link_info(bond->dev, link->dev, "Removing an active aggregator\n");
/* select new active aggregator */
ad_agg_selection_logic(__get_first_agg(port),
- &dummy_slave_update);
+ &dummy_link_update);
}
}
break;
}
}
}
- port->slave = NULL;
+ port->link = NULL;
out:
spin_unlock_bh(&bond->mode_lock);
@@ -2236,7 +2236,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 link *link;
ASSERT_RTNL();
@@ -2249,8 +2249,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 port *port = &(SLAVE_AD_INFO(slave))->port;
+ bond_for_each_link(bond, link, iter) {
+ struct port *port = &(LINK_AD_INFO(link))->port;
__ad_actor_update_port(port);
port->ntt = true;
@@ -2277,46 +2277,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 link *link;
struct port *port;
- bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;
- bool update_slave_arr = false;
+ bool should_notify_rtnl = BOND_LINK_NOTIFY_LATER;
+ bool update_link_arr = false;
/* Lock to protect data accessed by all (e.g., port->sm_vars) and
- * against running with bond_3ad_unbind_slave. ad_rx_machine may run
+ * against running with bond_3ad_unbind_link. 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 links */
+ if (!bond_has_links(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);
- port = slave ? &(SLAVE_AD_INFO(slave)->port) : NULL;
+ link = bond_first_link_rcu(bond);
+ port = link ? &(LINK_AD_INFO(link)->port) : NULL;
/* select the active aggregator for the bond */
if (port) {
- if (!port->slave) {
+ if (!port->link) {
net_warn_ratelimited("%s: Warning: bond's first port is uninitialized\n",
bond->dev->name);
goto re_arm;
}
aggregator = __get_first_agg(port);
- ad_agg_selection_logic(aggregator, &update_slave_arr);
+ ad_agg_selection_logic(aggregator, &update_link_arr);
}
bond_3ad_set_carrier(bond);
}
/* for each port run the state machines */
- bond_for_each_slave_rcu(bond, slave, iter) {
- port = &(SLAVE_AD_INFO(slave)->port);
- if (!port->slave) {
+ bond_for_each_link_rcu(bond, link, iter) {
+ port = &(LINK_AD_INFO(link)->port);
+ if (!port->link) {
net_warn_ratelimited("%s: Warning: Found an uninitialized port\n",
bond->dev->name);
goto re_arm;
@@ -2324,8 +2324,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
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_port_selection_logic(port, &update_link_arr);
+ ad_mux_machine(port, &update_link_arr);
ad_tx_machine(port);
ad_churn_machine(port);
@@ -2335,20 +2335,20 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
}
re_arm:
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (slave->should_notify) {
- should_notify_rtnl = BOND_SLAVE_NOTIFY_NOW;
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (link->should_notify) {
+ should_notify_rtnl = BOND_LINK_NOTIFY_NOW;
break;
}
}
rcu_read_unlock();
spin_unlock_bh(&bond->mode_lock);
- if (update_slave_arr)
- bond_slave_arr_work_rearm(bond, 0);
+ if (update_link_arr)
+ bond_link_arr_work_rearm(bond, 0);
if (should_notify_rtnl && rtnl_trylock()) {
- bond_slave_state_notify(bond);
+ bond_link_state_notify(bond);
rtnl_unlock();
}
queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks);
@@ -2357,37 +2357,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
+ * @link: link 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 link *link)
{
- struct bonding *bond = slave->bond;
+ struct bonding *bond = link->bond;
int ret = RX_HANDLER_ANOTHER;
struct bond_marker *marker;
struct port *port;
atomic64_t *stat;
- port = &(SLAVE_AD_INFO(slave)->port);
- if (!port->slave) {
- net_warn_ratelimited("%s: Warning: port of slave %s is uninitialized\n",
- slave->dev->name, slave->bond->dev->name);
+ port = &(LINK_AD_INFO(link)->port);
+ if (!port->link) {
+ net_warn_ratelimited("%s: Warning: port of link %s is uninitialized\n",
+ link->dev->name, link->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",
- port->actor_port_number);
+ link_dbg(link->bond->dev, link->dev,
+ "Received LACPDU on port %d\n",
+ port->actor_port_number);
/* Protect against concurrent state machines */
- spin_lock(&slave->bond->mode_lock);
+ spin_lock(&link->bond->mode_lock);
ad_rx_machine(lacpdu, port);
- spin_unlock(&slave->bond->mode_lock);
+ spin_unlock(&link->bond->mode_lock);
break;
case AD_TYPE_MARKER:
ret = RX_HANDLER_CONSUMED;
@@ -2397,26 +2397,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",
- port->actor_port_number);
+ link_dbg(link->bond->dev, link->dev, "Received Marker Information on port %d\n",
+ port->actor_port_number);
ad_marker_info_received(marker, 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);
+ link_dbg(link->bond->dev, link->dev, "Received Marker Response on port %d\n",
+ port->actor_port_number);
ad_marker_response_received(marker, port);
break;
default:
- slave_dbg(slave->bond->dev, slave->dev, "Received an unknown Marker subtype on port %d\n",
- port->actor_port_number);
- stat = &SLAVE_AD_INFO(slave)->stats.marker_unknown_rx;
+ link_dbg(link->bond->dev, link->dev, "Received an unknown Marker subtype on port %d\n",
+ port->actor_port_number);
+ stat = &LINK_AD_INFO(link)->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(&LINK_AD_INFO(link)->stats.lacpdu_unknown_rx);
atomic64_inc(&BOND_AD_INFO(bond).stats.lacpdu_unknown_rx);
}
@@ -2458,10 +2458,10 @@ static void ad_update_actor_keys(struct port *port, bool reset)
if (!reset) {
if (!speed) {
- slave_err(port->slave->bond->dev,
- port->slave->dev,
- "speed changed to 0 on port %d\n",
- port->actor_port_number);
+ link_err(port->link->bond->dev,
+ port->link->dev,
+ "speed changed to 0 on port %d\n",
+ port->actor_port_number);
} else if (duplex && ospeed != speed) {
/* Speed change restarts LACP state-machine */
port->sm_vars |= AD_PORT_BEGIN;
@@ -2471,36 +2471,36 @@ static void ad_update_actor_keys(struct port *port, bool reset)
}
/**
- * bond_3ad_adapter_speed_duplex_changed - handle a slave's speed / duplex
+ * bond_3ad_adapter_speed_duplex_changed - handle a link's speed / duplex
* change indication
*
- * @slave: slave struct to work on
+ * @link: link struct to work on
*
* Handle reselection of aggregator (if needed) for this port.
*/
-void bond_3ad_adapter_speed_duplex_changed(struct slave *slave)
+void bond_3ad_adapter_speed_duplex_changed(struct link *link)
{
struct port *port;
- port = &(SLAVE_AD_INFO(slave)->port);
+ port = &(LINK_AD_INFO(link)->port);
- /* if slave is null, the whole port is not initialized */
- if (!port->slave) {
- slave_warn(slave->bond->dev, slave->dev,
- "speed/duplex changed for uninitialized port\n");
+ /* if link is null, the whole port is not initialized */
+ if (!port->link) {
+ link_warn(link->bond->dev, link->dev,
+ "speed/duplex changed for uninitialized port\n");
return;
}
- spin_lock_bh(&slave->bond->mode_lock);
+ spin_lock_bh(&link->bond->mode_lock);
ad_update_actor_keys(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);
+ spin_unlock_bh(&link->bond->mode_lock);
+ link_dbg(link->bond->dev, link->dev, "Port %d changed speed/duplex\n",
+ 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 link's link status change indication
+ * @link: link struct to work on
* @link: whether the link is now up or down
*
* Handle reselection of aggregator (if needed) for this port.
@@ -2511,15 +2511,15 @@ void bond_3ad_handle_link_change(struct link *link, char link_state)
struct port *port;
bool dummy;
- port = &(SLAVE_AD_INFO(slave)->port);
+ port = &(LINK_AD_INFO(link)->port);
- /* if slave is null, the whole port is not initialized */
- if (!port->slave) {
- slave_warn(slave->bond->dev, slave->dev, "link status changed for uninitialized port\n");
+ /* if link is null, the whole port is not initialized */
+ if (!port->link) {
+ link_warn(link->bond->dev, link->dev, "link status changed for uninitialized port\n");
return;
}
- spin_lock_bh(&slave->bond->mode_lock);
+ spin_lock_bh(&link->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).
@@ -2538,16 +2538,16 @@ void bond_3ad_handle_link_change(struct link *link, char link_state)
agg = __get_first_agg(port);
ad_agg_selection_logic(agg, &dummy);
- spin_unlock_bh(&slave->bond->mode_lock);
+ spin_unlock_bh(&link->bond->mode_lock);
- slave_dbg(slave->bond->dev, slave->dev, "Port %d changed link status to %s\n",
- port->actor_port_number,
- link_state == BOND_LINK_UP ? "UP" : "DOWN");
+ link_dbg(link->bond->dev, link->dev, "Port %d changed link status to %s\n",
+ port->actor_port_number,
+ link_state == BOND_LINK_UP ? "UP" : "DOWN");
/* RTNL is held and mode_lock is released so it's safe
- * to update slave_array here.
+ * to update link_array here.
*/
- bond_update_slave_arr(slave->bond, NULL);
+ bond_update_link_arr(link->bond, NULL);
}
/**
@@ -2556,7 +2556,7 @@ void bond_3ad_handle_link_change(struct link *link, char link_state)
*
* 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 links with link up.
*
* This behavior complies with IEEE 802.3 section 43.3.9.
*
@@ -2566,18 +2566,18 @@ void bond_3ad_handle_link_change(struct link *link, char link_state)
int bond_3ad_set_carrier(struct bonding *bond)
{
struct aggregator *active;
- struct slave *first_slave;
+ struct link *first_link;
int ret = 1;
rcu_read_lock();
- first_slave = bond_first_slave_rcu(bond);
- if (!first_slave) {
+ first_link = bond_first_link_rcu(bond);
+ if (!first_link) {
ret = 0;
goto out;
}
- active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator));
+ active = __get_active_agg(&(LINK_AD_INFO(first_link)->aggregator));
if (active) {
- /* are enough slaves available to consider link up? */
+ /* are enough links available to consider link up? */
if (__agg_active_ports(active) < bond->params.min_links) {
if (netif_carrier_ok(bond->dev)) {
netif_carrier_off(bond->dev);
@@ -2608,11 +2608,11 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond,
{
struct aggregator *aggregator = NULL;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
struct port *port;
- bond_for_each_slave_rcu(bond, slave, iter) {
- port = &(SLAVE_AD_INFO(slave)->port);
+ bond_for_each_link_rcu(bond, link, iter) {
+ port = &(LINK_AD_INFO(link)->port);
if (port->aggregator && port->aggregator->is_active) {
aggregator = port->aggregator;
break;
@@ -2643,7 +2643,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 link *link)
{
struct lacpdu *lacpdu, _lacpdu;
@@ -2655,12 +2655,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(&LINK_AD_INFO(link)->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, link);
}
/**
@@ -2678,13 +2678,13 @@ void bond_3ad_update_lacp_rate(struct bonding *bond)
{
struct port *port = NULL;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
int lacp_fast;
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);
+ bond_for_each_link(bond, link, iter) {
+ port = &(LINK_AD_INFO(link)->port);
if (lacp_fast)
port->actor_oper_port_state |= LACP_STATE_LACP_TIMEOUT;
else
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 9e6f80d8ef8c..8585f42eaa41 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -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 link *link, 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_link = 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_link(struct link *link)
{
- SLAVE_TLB_INFO(slave).load = 0;
- SLAVE_TLB_INFO(slave).head = TLB_NULL_INDEX;
+ LINK_TLB_INFO(link).load = 0;
+ LINK_TLB_INFO(link).head = TLB_NULL_INDEX;
}
-static void __tlb_clear_slave(struct bonding *bond, struct slave *slave,
+static void __tlb_clear_link(struct bonding *bond, struct link *link,
int save_load)
{
struct tlb_client_info *tx_hash_table;
u32 index;
- /* clear slave from tx_hashtbl */
+ /* clear link 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 = LINK_TLB_INFO(link).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_link(link);
}
-static void tlb_clear_slave(struct bonding *bond, struct slave *slave,
+static void tlb_clear_link(struct bonding *bond, struct link *link,
int save_load)
{
spin_lock_bh(&bond->mode_lock);
- __tlb_clear_slave(bond, slave, save_load);
+ __tlb_clear_link(bond, link, 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 links 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 link *link)
{
- return (s64) (slave->speed << 20) - /* Convert to Megabit per sec */
- (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */
+ return (s64) (link->speed << 20) - /* Convert to Megabit per sec */
+ (s64) (LINK_TLB_INFO(link).load << 3); /* Bytes to bits */
}
-static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
+static struct link *tlb_get_least_loaded_link(struct bonding *bond)
{
- struct slave *slave, *least_loaded;
+ struct link *link, *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 link with the largest gap */
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (bond_link_can_tx(link)) {
+ long long gap = compute_gap(link);
if (max_gap < gap) {
- least_loaded = slave;
+ least_loaded = link;
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 link *__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 link *assigned_link;
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_link = hash_table[hash_index].tx_link;
+ if (!assigned_link) {
+ assigned_link = tlb_get_least_loaded_link(bond);
- if (assigned_slave) {
- struct tlb_slave_info *slave_info =
- &(SLAVE_TLB_INFO(assigned_slave));
- u32 next_index = slave_info->head;
+ if (assigned_link) {
+ struct tlb_link_info *link_info =
+ &(LINK_TLB_INFO(assigned_link));
+ u32 next_index = link_info->head;
- hash_table[hash_index].tx_slave = assigned_slave;
+ hash_table[hash_index].tx_link = assigned_link;
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 +=
+ link_info->head = hash_index;
+ link_info->load +=
hash_table[hash_index].load_history;
}
}
- if (assigned_slave)
+ if (assigned_link)
hash_table[hash_index].tx_bytes += skb_len;
- return assigned_slave;
+ return assigned_link;
}
-static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index,
+static struct link *tlb_choose_channel(struct bonding *bond, u32 hash_index,
u32 skb_len)
{
- struct slave *tx_slave;
+ struct link *tx_link;
/* 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_link = __tlb_choose_channel(bond, hash_index, skb_len);
spin_unlock(&bond->mode_lock);
- return tx_slave;
+ return tx_link;
}
/*********************** 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 link *link)
{
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");
+ link_dbg(bond->dev, link->dev, "Server received an ARP Reply from client\n");
}
out:
return RX_HANDLER_ANOTHER;
}
/* Caller must hold rcu_read_lock() */
-static struct slave *__rlb_next_rx_slave(struct bonding *bond)
+static struct link *__rlb_next_rx_link(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
- struct slave *before = NULL, *rx_slave = NULL, *slave;
+ struct link *before = NULL, *rx_link = NULL, *link;
struct list_head *iter;
bool found = false;
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (!bond_slave_can_tx(slave))
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (!bond_link_can_tx(link))
continue;
if (!found) {
- if (!before || before->speed < slave->speed)
- before = slave;
+ if (!before || before->speed < link->speed)
+ before = link;
} else {
- if (!rx_slave || rx_slave->speed < slave->speed)
- rx_slave = slave;
+ if (!rx_link || rx_link->speed < link->speed)
+ rx_link = link;
}
- if (slave == bond_info->rx_slave)
+ if (link == bond_info->rx_link)
found = true;
}
/* we didn't find anything after the current or we have something
- * better before and up to the current slave
+ * better before and up to the current link
*/
- if (!rx_slave || (before && rx_slave->speed < before->speed))
- rx_slave = before;
+ if (!rx_link || (before && rx_link->speed < before->speed))
+ rx_link = before;
- if (rx_slave)
- bond_info->rx_slave = rx_slave;
+ if (rx_link)
+ bond_info->rx_link = rx_link;
- return rx_slave;
+ return rx_link;
}
/* Caller must hold RTNL, rcu_read_lock is obtained only to silence checkers */
-static struct slave *rlb_next_rx_slave(struct bonding *bond)
+static struct link *rlb_next_rx_link(struct bonding *bond)
{
- struct slave *rx_slave;
+ struct link *rx_link;
ASSERT_RTNL();
rcu_read_lock();
- rx_slave = __rlb_next_rx_slave(bond);
+ rx_link = __rlb_next_rx_link(bond);
rcu_read_unlock();
- return rx_slave;
+ return rx_link;
}
-/* teach the switch the mac of a disabled slave
+/* teach the switch the mac of a disabled link
* on the primary for fault tolerance
*
* Caller must hold RTNL
*/
static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
{
- struct slave *curr_active = rtnl_dereference(bond->curr_active_slave);
+ struct link *curr_active = rtnl_dereference(bond->curr_active_link);
if (!curr_active)
return;
@@ -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
+/* link 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_link(struct bonding *bond, struct link *link)
{
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 link 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].link == link) {
+ struct link *assigned_link = rlb_next_rx_link(bond);
- if (assigned_slave) {
- rx_hash_table[index].slave = assigned_slave;
+ if (assigned_link) {
+ rx_hash_table[index].link = assigned_link;
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 link 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 link */
+ rx_hash_table[index].link = 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 (link != rtnl_dereference(bond->curr_active_link))
+ rlb_teach_disabled_mac_on_primary(bond, link->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->link || !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->link->dev,
client_info->ip_src,
client_info->mac_dst,
- client_info->slave->dev->dev_addr,
+ client_info->link->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");
+ link_err(client_info->link->bond->dev,
+ client_info->link->dev,
+ "failed to create an ARP packet\n");
continue;
}
- skb->dev = client_info->slave->dev;
+ skb->dev = client_info->link->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 link was assigned a new mac address - update the clients */
+static void rlb_req_update_link_clients(struct bonding *bond, struct link *link)
{
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->link == link) &&
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->link) {
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_link) 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->link->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 link *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 link *assigned_link, *curr_active_link;
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_link = rcu_dereference(bond->curr_active_link);
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_link = client_info->link;
+ if (assigned_link) {
spin_unlock(&bond->mode_lock);
- return assigned_slave;
+ return assigned_link;
}
} 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_link) 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_link &&
+ client_info->link != curr_active_link) {
+ client_info->link = curr_active_link;
rlb_update_client(client_info);
}
}
}
- /* assign a new slave */
- assigned_slave = __rlb_next_rx_slave(bond);
+ /* assign a new link */
+ assigned_link = __rlb_next_rx_link(bond);
- if (assigned_slave) {
+ if (assigned_link) {
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->link = assigned_link;
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_link;
}
/* 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_link
*/
-static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
+static struct link *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
{
- struct slave *tx_slave = NULL;
+ struct link *tx_link = 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_link_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_link = rlb_choose_channel(skb, bond, arp);
+ if (tx_link)
+ bond_hw_addr_copy(arp->mac_src, tx_link->dev->dev_addr,
+ tx_link->dev->addr_len);
+ netdev_dbg(bond->dev, "(link %s): Server sent ARP Reply packet\n",
+ tx_link ? tx_link->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_link = 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 link. 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, "(link %s): Server sent ARP Request packet\n",
+ tx_link ? tx_link->dev->name : "NULL");
}
- return tx_slave;
+ return tx_link;
}
static void rlb_rebalance(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
- struct slave *assigned_slave;
+ struct link *assigned_link;
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_link = __rlb_next_rx_link(bond);
+ if (assigned_link && (client_info->link != assigned_link)) {
+ client_info->link = assigned_link;
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->link = 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 link *link, 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 = link->dev;
- slave_dbg(slave->bond->dev, slave->dev,
- "Send learning packet: mac %pM vlan %d\n", mac_addr, vid);
+ link_dbg(link->bond->dev, link->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 link *link;
u8 *mac_addr;
bool strict_match;
};
@@ -947,18 +947,18 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)
struct alb_walk_data *data = _data;
bool strict_match = data->strict_match;
struct bonding *bond = data->bond;
- struct slave *slave = data->slave;
+ struct link *link = data->link;
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(link, 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(link, upper->dev_addr,
vlan_dev_vlan_proto(upper),
vlan_dev_vlan_id(upper));
}
@@ -971,7 +971,7 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)
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(link, upper->dev_addr,
tags[0].vlan_proto, tags[0].vlan_id);
kfree(tags);
}
@@ -979,19 +979,19 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)
return 0;
}
-static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
+static void alb_send_learning_packets(struct link *link, u8 mac_addr[],
bool strict_match)
{
- struct bonding *bond = bond_get_bond_by_slave(slave);
+ struct bonding *bond = bond_get_bond_by_link(link);
struct alb_walk_data data = {
.strict_match = strict_match,
.mac_addr = mac_addr,
- .slave = slave,
+ .link = link,
.bond = bond,
};
/* send untagged */
- alb_send_lp_vid(slave, mac_addr, 0, 0);
+ alb_send_lp_vid(link, mac_addr, 0, 0);
/* loop through all devices and see if we need to send a packet
* for that device.
@@ -1001,43 +1001,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_link_mac_addr(struct link *link, u8 addr[],
unsigned int len)
{
- struct net_device *dev = slave->dev;
+ struct net_device *dev = link->dev;
struct sockaddr_storage ss;
- if (BOND_MODE(slave->bond) == BOND_MODE_TLB) {
+ if (BOND_MODE(link->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 link must have a unique hw mac addresses so that
+ * each link 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");
+ link_err(link->bond->dev, dev, "dev_set_mac_address on link 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 links.
*
* 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 link *link1, struct link *link2)
{
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, link1->dev->dev_addr,
+ link1->dev->addr_len);
+ alb_set_link_mac_addr(link1, link2->dev->dev_addr,
+ link2->dev->addr_len);
+ alb_set_link_mac_addr(link2, tmp_mac_addr,
+ link1->dev->addr_len);
}
@@ -1045,77 +1045,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 link *link1,
+ struct link *link2)
{
- int slaves_state_differ = (bond_slave_can_tx(slave1) != bond_slave_can_tx(slave2));
- struct slave *disabled_slave = NULL;
+ int links_state_differ = (bond_link_can_tx(link1) != bond_link_can_tx(link2));
+ struct link *disabled_link = 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_link_can_tx(link1)) {
+ alb_send_learning_packets(link1, link1->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_link_clients(bond, link1);
}
} else {
- disabled_slave = slave1;
+ disabled_link = link1;
}
- if (bond_slave_can_tx(slave2)) {
- alb_send_learning_packets(slave2, slave2->dev->dev_addr, false);
+ if (bond_link_can_tx(link2)) {
+ alb_send_learning_packets(link2, link2->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_link_clients(bond, link2);
}
} else {
- disabled_slave = slave2;
+ disabled_link = link2;
}
- if (bond->alb_info.rlb_enabled && slaves_state_differ) {
- /* A disabled slave was assigned an active mac addr */
+ if (bond->alb_info.rlb_enabled && links_state_differ) {
+ /* A disabled link was assigned an active mac addr */
rlb_teach_disabled_mac_on_primary(bond,
- disabled_slave->dev->dev_addr);
+ disabled_link->dev->dev_addr);
}
}
/**
* alb_change_hw_addr_on_detach
* @bond: bonding we're working on
- * @slave: the slave that was just detached
+ * @link: the link that was just detached
*
- * We assume that @slave was already detached from the slave list.
+ * We assume that @link was already detached from the link list.
*
- * If @slave's permanent hw address is different both from its current
+ * If @link'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 link that has @link's permanet address as its current address.
+ * We'll make sure that that link no longer uses @link'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 link *link)
{
int perm_curr_diff;
int perm_bond_diff;
- struct slave *found_slave;
+ struct link *found_link;
- 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(link->perm_hwaddr,
+ link->dev->dev_addr);
+ perm_bond_diff = !ether_addr_equal_64bits(link->perm_hwaddr,
bond->dev->dev_addr);
if (perm_curr_diff && perm_bond_diff) {
- found_slave = bond_slave_has_mac(bond, slave->perm_hwaddr);
+ found_link = bond_link_has_mac(bond, link->perm_hwaddr);
- if (found_slave) {
- alb_swap_mac_addr(slave, found_slave);
- alb_fasten_mac_swap(bond, slave, found_slave);
+ if (found_link) {
+ alb_swap_mac_addr(link, found_link);
+ alb_fasten_mac_swap(bond, link, found_link);
}
}
}
@@ -1123,81 +1123,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
+ * @link: the link 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 link's mac address and handles the case the
+ * new link 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 @link is @bond's hw address, we need to
+ * find a different hw address to give @link, that isn't in use by any other
+ * link in the bond. This address must be, of course, one of the permanent
+ * addresses of the other links.
*
- * 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 link list, and for each link there we compare its
+ * permanent hw address with the current address of all the other links.
+ * If no match was found, then we've found a link with a permanent address
+ * that isn't used by any other link in the bond, so we can assign it to
+ * @link.
*
- * assumption: this function is called before @slave is attached to the
- * bond slave list.
+ * assumption: this function is called before @link is attached to the
+ * bond link 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 link *link)
{
- struct slave *has_bond_addr = rcu_access_pointer(bond->curr_active_slave);
- struct slave *tmp_slave1, *free_mac_slave = NULL;
+ struct link *has_bond_addr = rcu_access_pointer(bond->curr_active_link);
+ struct link *tmp_link1, *free_mac_link = NULL;
struct list_head *iter;
- if (!bond_has_slaves(bond)) {
- /* this is the first slave */
+ if (!bond_has_links(bond)) {
+ /* this is the first link */
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 link's mac address differs from bond's mac address
+ * check uniqueness of link's mac address against the other
+ * links 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(link->perm_hwaddr, bond->dev->dev_addr)) {
+ if (!bond_link_has_mac(bond, link->dev->dev_addr))
return 0;
- /* Try setting slave mac to bond address and fall-through
+ /* Try setting link 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_link_mac_addr(link, 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 link's address is equal to the address of the bond.
+ * Search for a spare address in the bond for this link.
*/
- 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_link(bond, tmp_link1, iter) {
+ if (!bond_link_has_mac(bond, tmp_link1->perm_hwaddr)) {
+ /* no link has tmp_link1's perm addr
* as its curr addr
*/
- free_mac_slave = tmp_slave1;
+ free_mac_link = tmp_link1;
break;
}
if (!has_bond_addr) {
- if (ether_addr_equal_64bits(tmp_slave1->dev->dev_addr,
+ if (ether_addr_equal_64bits(tmp_link1->dev->dev_addr,
bond->dev->dev_addr)) {
- has_bond_addr = tmp_slave1;
+ has_bond_addr = tmp_link1;
}
}
}
- if (free_mac_slave) {
- alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
- free_mac_slave->dev->addr_len);
+ if (free_mac_link) {
+ alb_set_link_mac_addr(link, free_mac_link->perm_hwaddr,
+ free_mac_link->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);
+ link_warn(bond->dev, link->dev, "the link hw address is in use by the bond; giving it the hw address of %s\n",
+ free_mac_link->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");
+ link_err(bond->dev, link->dev, "the link hw address is in use by the bond; couldn't find a link with a free hw address to give it (this should not have happened)\n");
return -EFAULT;
}
@@ -1209,18 +1209,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 links 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 link, 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 link *link, *rollback_link;
struct list_head *iter;
struct sockaddr_storage ss;
char tmp_addr[MAX_ADDR_LEN];
@@ -1229,16 +1229,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_link(bond, link, 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, link->dev->dev_addr,
+ link->dev->addr_len);
- res = dev_set_mac_address(slave->dev, addr, NULL);
+ res = dev_set_mac_address(link->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(link->dev->dev_addr, tmp_addr,
+ link->dev->addr_len);
if (res)
goto unwind;
@@ -1250,16 +1250,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 link that failed */
+ bond_for_each_link(bond, rollback_link, iter) {
+ if (rollback_link == link)
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_link->dev->dev_addr,
+ rollback_link->dev->addr_len);
+ dev_set_mac_address(rollback_link->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_link->dev->dev_addr, tmp_addr,
+ rollback_link->dev->addr_len);
}
return res;
@@ -1300,30 +1300,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 link *tx_link)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct ethhdr *eth_data = eth_hdr(skb);
- if (!tx_slave) {
+ if (!tx_link) {
/* unbalanced or unassigned, send through primary */
- tx_slave = rcu_dereference(bond->curr_active_slave);
+ tx_link = rcu_dereference(bond->curr_active_link);
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_link && bond_link_can_tx(tx_link)) {
+ if (tx_link != rcu_access_pointer(bond->curr_active_link)) {
ether_addr_copy(eth_data->h_source,
- tx_slave->dev->dev_addr);
+ tx_link->dev->dev_addr);
}
- return bond_dev_queue_xmit(bond, skb, tx_slave->dev);
+ return bond_dev_queue_xmit(bond, skb, tx_link->dev);
}
- if (tx_slave && bond->params.tlb_dynamic_lb) {
+ if (tx_link && bond->params.tlb_dynamic_lb) {
spin_lock(&bond->mode_lock);
- __tlb_clear_slave(bond, tx_slave, 0);
+ __tlb_clear_link(bond, tx_link, 0);
spin_unlock(&bond->mode_lock);
}
@@ -1331,10 +1331,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 link *bond_xmit_tlb_link_get(struct bonding *bond,
struct sk_buff *skb)
{
- struct slave *tx_slave = NULL;
+ struct link *tx_link = NULL;
struct ethhdr *eth_data;
u32 hash_index;
@@ -1350,40 +1350,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_link = tlb_choose_channel(bond,
hash_index & 0xFF,
skb->len);
} else {
- struct bond_up_slave *slaves;
+ struct bond_up_link *links;
unsigned int count;
- slaves = rcu_dereference(bond->usable_slaves);
- count = slaves ? READ_ONCE(slaves->count) : 0;
+ links = rcu_dereference(bond->usable_links);
+ count = links ? READ_ONCE(links->count) : 0;
if (likely(count))
- tx_slave = slaves->arr[hash_index %
+ tx_link = links->arr[hash_index %
count];
}
break;
}
}
- return tx_slave;
+ return tx_link;
}
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 link *tx_link;
- tx_slave = bond_xmit_tlb_slave_get(bond, skb);
- return bond_do_alb_xmit(skb, bond, tx_slave);
+ tx_link = bond_xmit_tlb_link_get(bond, skb);
+ return bond_do_alb_xmit(skb, bond, tx_link);
}
-struct slave *bond_xmit_alb_slave_get(struct bonding *bond,
+struct link *bond_xmit_alb_link_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 link *tx_link = NULL;
const u8 *hash_start = NULL;
bool do_tx_balance = true;
struct ethhdr *eth_data;
@@ -1480,7 +1480,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_link = rlb_arp_xmit(skb, bond);
break;
default:
do_tx_balance = false;
@@ -1490,33 +1490,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_link = 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_link
* So we do exactly what tlb would do for hash selection
*/
- struct bond_up_slave *slaves;
+ struct bond_up_link *links;
unsigned int count;
- slaves = rcu_dereference(bond->usable_slaves);
- count = slaves ? READ_ONCE(slaves->count) : 0;
+ links = rcu_dereference(bond->usable_links);
+ count = links ? READ_ONCE(links->count) : 0;
if (likely(count))
- tx_slave = slaves->arr[bond_xmit_hash(bond, skb) %
+ tx_link = links->arr[bond_xmit_hash(bond, skb) %
count];
}
}
- return tx_slave;
+ return tx_link;
}
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 link *tx_link = NULL;
- tx_slave = bond_xmit_alb_slave_get(bond, skb);
- return bond_do_alb_xmit(skb, bond, tx_slave);
+ tx_link = bond_xmit_alb_link_get(bond, skb);
+ return bond_do_alb_xmit(skb, bond, tx_link);
}
void bond_alb_monitor(struct work_struct *work)
@@ -1525,9 +1525,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 link *link;
- if (!bond_has_slaves(bond)) {
+ if (!bond_has_links(bond)) {
bond_info->tx_rebalance_counter = 0;
bond_info->lp_counter = 0;
goto re_arm;
@@ -1542,15 +1542,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_link_rcu(bond, link, 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 link device.
* In RLB mode, we always use strict matches.
*/
- strict_match = (slave != rcu_access_pointer(bond->curr_active_slave) ||
+ strict_match = (link != rcu_access_pointer(bond->curr_active_link) ||
bond_info->rlb_enabled);
- alb_send_learning_packets(slave, slave->dev->dev_addr,
+ alb_send_learning_packets(link, link->dev->dev_addr,
strict_match);
}
bond_info->lp_counter = 0;
@@ -1558,10 +1558,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_link_rcu(bond, link, iter) {
+ tlb_clear_link(bond, link, 1);
+ if (link == rcu_access_pointer(bond->curr_active_link)) {
+ LINK_TLB_INFO(link).load =
bond_info->unbalanced_load /
BOND_TLB_REBALANCE_INTERVAL;
bond_info->unbalanced_load = 0;
@@ -1584,10 +1584,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 link 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_link)->dev,
-1);
bond_info->primary_is_promisc = 0;
@@ -1618,23 +1618,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 link 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_link(struct bonding *bond, struct link *link)
{
int res;
- res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr,
- slave->dev->addr_len);
+ res = alb_set_link_mac_addr(link, link->perm_hwaddr,
+ link->dev->addr_len);
if (res)
return res;
- res = alb_handle_addr_collision_on_attach(bond, slave);
+ res = alb_handle_addr_collision_on_attach(bond, link);
if (res)
return res;
- tlb_init_slave(slave);
+ tlb_init_link(link);
/* order a rebalance ASAP */
bond->alb_info.tx_rebalance_counter = BOND_TLB_REBALANCE_TICKS;
@@ -1645,34 +1645,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 link 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_link(struct bonding *bond, struct link *link)
{
- if (bond_has_slaves(bond))
- alb_change_hw_addr_on_detach(bond, slave);
+ if (bond_has_links(bond))
+ alb_change_hw_addr_on_detach(bond, link);
- tlb_clear_slave(bond, slave, 0);
+ tlb_clear_link(bond, link, 0);
if (bond->alb_info.rlb_enabled) {
- bond->alb_info.rx_slave = NULL;
- rlb_clear_slave(bond, slave);
+ bond->alb_info.rx_link = NULL;
+ rlb_clear_link(bond, link);
}
}
-void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave,
+void bond_alb_handle_link_change(struct bonding *bond, struct link *link,
char link_state)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
if (link_state == BOND_LINK_DOWN) {
- tlb_clear_slave(bond, slave, 0);
+ tlb_clear_link(bond, link, 0);
if (bond->alb_info.rlb_enabled)
- rlb_clear_slave(bond, slave);
+ rlb_clear_link(bond, link);
} else if (link_state == BOND_LINK_UP) {
/* order a rebalance ASAP */
bond_info->tx_rebalance_counter = BOND_TLB_REBALANCE_TICKS;
@@ -1687,28 +1687,28 @@ void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave,
}
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_link_arr(bond, NULL))
+ pr_err("Failed to build link-array for TLB mode.\n");
}
}
/**
- * bond_alb_handle_active_change - assign new curr_active_slave
+ * bond_alb_handle_active_change - assign new curr_active_link
* @bond: our bonding struct
- * @new_slave: new slave to assign
+ * @new_link: new link to assign
*
- * Set the bond->curr_active_slave to @new_slave and handle
+ * Set the bond->curr_active_link to @new_link 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 link *new_link)
{
- struct slave *swap_slave;
- struct slave *curr_active;
+ struct link *swap_link;
+ struct link *curr_active;
- curr_active = rtnl_dereference(bond->curr_active_slave);
- if (curr_active == new_slave)
+ curr_active = rtnl_dereference(bond->curr_active_link);
+ if (curr_active == new_link)
return;
if (curr_active && bond->alb_info.primary_is_promisc) {
@@ -1717,57 +1717,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_link = curr_active;
+ rcu_assign_pointer(bond->curr_active_link, new_link);
- if (!new_slave || !bond_has_slaves(bond))
+ if (!new_link || !bond_has_links(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_link to the bonds mac address
+ * i.e. swap mac addresses of old curr_active_link and new curr_active_link
*/
- if (!swap_slave)
- swap_slave = bond_slave_has_mac(bond, bond->dev->dev_addr);
+ if (!swap_link)
+ swap_link = bond_link_has_mac(bond, bond->dev->dev_addr);
- /* Arrange for swap_slave and new_slave to temporarily be
+ /* Arrange for swap_link and new_link 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_link)
+ tlb_clear_link(bond, swap_link, 1);
+ tlb_clear_link(bond, new_link, 1);
- /* in TLB mode, the slave might flip down/up with the old dev_addr,
+ /* in TLB mode, the link 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_link->dev->dev_addr,
+ new_link->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_link->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_link->dev->dev_addr, tmp_addr,
+ new_link->dev->addr_len);
}
- /* curr_active_slave must be set before calling alb_swap_mac_addr */
- if (swap_slave) {
+ /* curr_active_link must be set before calling alb_swap_mac_addr */
+ if (swap_link) {
/* 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_link, new_link);
+ alb_fasten_mac_swap(bond, swap_link, new_link);
} else {
- /* set the new_slave to the bond mac address */
- alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr,
+ /* set the new_link to the bond mac address */
+ alb_set_link_mac_addr(new_link, bond->dev->dev_addr,
bond->dev->addr_len);
- alb_send_learning_packets(new_slave, bond->dev->dev_addr,
+ alb_send_learning_packets(new_link, bond->dev->dev_addr,
false);
}
}
@@ -1777,8 +1777,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 link *curr_active;
+ struct link *swap_link;
int res;
if (!is_valid_ether_addr(ss->__data))
@@ -1790,28 +1790,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_link 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_link);
if (!curr_active)
return 0;
- swap_slave = bond_slave_has_mac(bond, bond_dev->dev_addr);
+ swap_link = bond_link_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_link) {
+ alb_swap_mac_addr(swap_link, curr_active);
+ alb_fasten_mac_swap(bond, swap_link, curr_active);
} else {
- alb_set_slave_mac_addr(curr_active, bond_dev->dev_addr,
+ alb_set_link_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_link_clients(bond, curr_active);
}
}
diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c
index f3f86ef68ae0..3f70ae319d65 100644
--- a/drivers/net/bonding/bond_debugfs.c
+++ b/drivers/net/bonding/bond_debugfs.c
@@ -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->link->dev->name);
}
spin_unlock_bh(&bond->mode_lock);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 1f602bcf10bd..8e2edebeb61a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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 link bonded to the channel. All links will then use
* this hw mac address.
*
* ifconfig bond0 down
- * will release all slaves, marking them as down.
+ * will release all links, 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 link. 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 all_links_active;
static struct bond_params bonding_defaults;
static int resend_igmp = BOND_DEFAULT_RESEND_IGMP;
-static int packets_per_slave = 1;
+static int packets_per_link = 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 link "
"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 link "
"failure");
module_param(lacp_rate, charp, 0);
MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; "
@@ -176,24 +176,24 @@ 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 "
+MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all links 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(all_links_active, int, 0);
+MODULE_PARM_DESC(all_links_active, "Keep all frames received on an interface "
+ "by setting active flag for all links; "
"0 for never (default), 1 for always.");
module_param(resend_igmp, int, 0);
MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on "
"link failure");
-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(packets_per_link, int, 0);
+MODULE_PARM_DESC(packets_per_link, "Packets to send per link in balance-rr "
+ "mode; 0 for a random link, 1 packet per "
+ "link (default), >1 packets per link.");
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 "
- "each slaves peer switch. The default is 1.");
+ "each links peer switch. The default is 1.");
/*----------------------------- Global variables ----------------------------*/
@@ -254,7 +254,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_link_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 +284,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
+ * @link_dev: link 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 *link_dev)
{
- skb->dev = slave_dev;
+ skb->dev = link_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_link_by_dev(bond, link_dev), skb);
return dev_queue_xmit(skb);
}
@@ -304,7 +304,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 link 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 +320,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 links
* @bond_dev: bonding net device that got called
* @proto: network protocol ID
* @vid: vlan id being added
@@ -329,12 +329,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 link *link, *rollback_link;
struct list_head *iter;
int res;
- bond_for_each_slave(bond, slave, iter) {
- res = vlan_vid_add(slave->dev, proto, vid);
+ bond_for_each_link(bond, link, iter) {
+ res = vlan_vid_add(link->dev, proto, vid);
if (res)
goto unwind;
}
@@ -342,19 +342,19 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev,
return 0;
unwind:
- /* unwind to the slave that failed */
- bond_for_each_slave(bond, rollback_slave, iter) {
- if (rollback_slave == slave)
+ /* unwind to the link that failed */
+ bond_for_each_link(bond, rollback_link, iter) {
+ if (rollback_link == link)
break;
- vlan_vid_del(rollback_slave->dev, proto, vid);
+ vlan_vid_del(rollback_link->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 links
* @bond_dev: bonding net device that got called
* @proto: network protocol ID
* @vid: vlan id being removed
@@ -364,10 +364,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 link *link;
- bond_for_each_slave(bond, slave, iter)
- vlan_vid_del(slave->dev, proto, vid);
+ bond_for_each_link(bond, link, iter)
+ vlan_vid_del(link->dev, proto, vid);
if (bond_is_lb(bond))
bond_alb_clear_vlan(bond, vid);
@@ -386,23 +386,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 link *link;
if (!bond_dev)
return -EINVAL;
bond = netdev_priv(bond_dev);
- slave = rcu_dereference(bond->curr_active_slave);
- xs->xso.real_dev = slave->dev;
+ link = rcu_dereference(bond->curr_active_link);
+ xs->xso.real_dev = link->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 (!(link->dev->xfrmdev_ops
+ && link->dev->xfrmdev_ops->xdo_dev_state_add)) {
+ link_warn(bond_dev, link->dev, "Link does not support ipsec offload\n");
return -EINVAL;
}
- return slave->dev->xfrmdev_ops->xdo_dev_state_add(xs);
+ return link->dev->xfrmdev_ops->xdo_dev_state_add(xs);
}
/**
@@ -413,26 +413,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 link *link;
if (!bond_dev)
return;
bond = netdev_priv(bond_dev);
- slave = rcu_dereference(bond->curr_active_slave);
+ link = rcu_dereference(bond->curr_active_link);
- if (!slave)
+ if (!link)
return;
- xs->xso.real_dev = slave->dev;
+ xs->xso.real_dev = link->dev;
- if (!(slave->dev->xfrmdev_ops
- && slave->dev->xfrmdev_ops->xdo_dev_state_delete)) {
- slave_warn(bond_dev, slave->dev, "%s: no slave xdo_dev_state_delete\n", __func__);
+ if (!(link->dev->xfrmdev_ops
+ && link->dev->xfrmdev_ops->xdo_dev_state_delete)) {
+ link_warn(bond_dev, link->dev, "%s: no link xdo_dev_state_delete\n", __func__);
return;
}
- slave->dev->xfrmdev_ops->xdo_dev_state_delete(xs);
+ link->dev->xfrmdev_ops->xdo_dev_state_delete(xs);
}
/**
@@ -444,20 +444,20 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
{
struct net_device *bond_dev = xs->xso.dev;
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *curr_active = rcu_dereference(bond->curr_active_slave);
- struct net_device *slave_dev = curr_active->dev;
+ struct link *curr_active = rcu_dereference(bond->curr_active_link);
+ struct net_device *link_dev = curr_active->dev;
if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)
return true;
- if (!(slave_dev->xfrmdev_ops
- && slave_dev->xfrmdev_ops->xdo_dev_offload_ok)) {
- slave_warn(bond_dev, slave_dev, "%s: no slave xdo_dev_offload_ok\n", __func__);
+ if (!(link_dev->xfrmdev_ops
+ && link_dev->xfrmdev_ops->xdo_dev_offload_ok)) {
+ link_warn(bond_dev, link_dev, "%s: no link xdo_dev_offload_ok\n", __func__);
return false;
}
- xs->xso.real_dev = slave_dev;
- return slave_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs);
+ xs->xso.real_dev = link_dev;
+ return link_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs);
}
static const struct xfrmdev_ops bond_xfrmdev_ops = {
@@ -470,7 +470,7 @@ 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,
+ * links. If any links are up, the master is up. In 802.3ad mode,
* do special 802.3ad magic.
*
* Returns zero if carrier state does not change, nonzero if it does.
@@ -478,16 +478,16 @@ static const struct xfrmdev_ops bond_xfrmdev_ops = {
int bond_set_carrier(struct bonding *bond)
{
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
- if (!bond_has_slaves(bond))
+ if (!bond_has_links(bond))
goto down;
if (BOND_MODE(bond) == BOND_MODE_8023AD)
return bond_3ad_set_carrier(bond);
- bond_for_each_slave(bond, slave, iter) {
- if (slave->link_state == BOND_LINK_UP) {
+ bond_for_each_link(bond, link, iter) {
+ if (link->link_state == BOND_LINK_UP) {
if (!netif_carrier_ok(bond->dev)) {
netif_carrier_on(bond->dev);
return 1;
@@ -504,22 +504,22 @@ int bond_set_carrier(struct bonding *bond)
return 0;
}
-/* Get link speed and duplex from the slave's base driver
+/* Get link speed and duplex from the link's base driver
* using ethtool. If for some reason the call fails or the
* values are invalid, set speed and duplex to -1,
* and return. Return 1 if speed or duplex settings are
* UNKNOWN; 0 otherwise.
*/
-static int bond_update_speed_duplex(struct slave *slave)
+static int bond_update_speed_duplex(struct link *link)
{
- struct net_device *slave_dev = slave->dev;
+ struct net_device *link_dev = link->dev;
struct ethtool_link_ksettings ecmd;
int res;
- slave->speed = SPEED_UNKNOWN;
- slave->duplex = DUPLEX_UNKNOWN;
+ link->speed = SPEED_UNKNOWN;
+ link->duplex = DUPLEX_UNKNOWN;
- res = __ethtool_get_link_ksettings(slave_dev, &ecmd);
+ res = __ethtool_get_link_ksettings(link_dev, &ecmd);
if (res < 0)
return 1;
if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1))
@@ -532,13 +532,13 @@ static int bond_update_speed_duplex(struct slave *slave)
return 1;
}
- slave->speed = ecmd.base.speed;
- slave->duplex = ecmd.base.duplex;
+ link->speed = ecmd.base.speed;
+ link->duplex = ecmd.base.duplex;
return 0;
}
-const char *bond_slave_link_status(s8 link_state)
+const char *bond_link_status(s8 link_state)
{
switch (link_state) {
case BOND_LINK_UP:
@@ -570,26 +570,26 @@ const char *bond_slave_link_status(s8 link_state)
* netif_carrier, but there really isn't.
*/
static int bond_check_dev_link(struct bonding *bond,
- struct net_device *slave_dev, int reporting)
+ struct net_device *link_dev, int reporting)
{
- const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
+ const struct net_device_ops *link_ops = link_dev->netdev_ops;
int (*ioctl)(struct net_device *, struct ifreq *, int);
struct ifreq ifr;
struct mii_ioctl_data *mii;
- if (!reporting && !netif_running(slave_dev))
+ if (!reporting && !netif_running(link_dev))
return 0;
if (bond->params.use_carrier)
- return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
+ return netif_carrier_ok(link_dev) ? BMSR_LSTATUS : 0;
/* Try to get link status using Ethtool first. */
- if (slave_dev->ethtool_ops->get_link)
- return slave_dev->ethtool_ops->get_link(slave_dev) ?
+ if (link_dev->ethtool_ops->get_link)
+ return link_dev->ethtool_ops->get_link(link_dev) ?
BMSR_LSTATUS : 0;
/* Ethtool can't be used, fallback to MII ioctls. */
- ioctl = slave_ops->ndo_do_ioctl;
+ ioctl = link_ops->ndo_do_ioctl;
if (ioctl) {
/* TODO: set pointer to correct ioctl on a per team member
* bases to make this more efficient. that is, once
@@ -604,11 +604,11 @@ static int bond_check_dev_link(struct bonding *bond,
*/
/* Yes, the mii is overlaid on the ifreq.ifr_ifru */
- strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
+ strncpy(ifr.ifr_name, link_dev->name, IFNAMSIZ);
mii = if_mii(&ifr);
- if (ioctl(slave_dev, &ifr, SIOCGMIIPHY) == 0) {
+ if (ioctl(link_dev, &ifr, SIOCGMIIPHY) == 0) {
mii->reg_num = MII_BMSR;
- if (ioctl(slave_dev, &ifr, SIOCGMIIREG) == 0)
+ if (ioctl(link_dev, &ifr, SIOCGMIIREG) == 0)
return mii->val_out & BMSR_LSTATUS;
}
}
@@ -623,22 +623,22 @@ static int bond_check_dev_link(struct bonding *bond,
/*----------------------------- Multicast list ------------------------------*/
-/* Push the promiscuity flag down to appropriate slaves */
+/* Push the promiscuity flag down to appropriate links */
static int bond_set_promiscuity(struct bonding *bond, int inc)
{
struct list_head *iter;
int err = 0;
if (bond_uses_primary(bond)) {
- struct slave *curr_active = rtnl_dereference(bond->curr_active_slave);
+ struct link *curr_active = rtnl_dereference(bond->curr_active_link);
if (curr_active)
err = dev_set_promiscuity(curr_active->dev, inc);
} else {
- struct slave *slave;
+ struct link *link;
- bond_for_each_slave(bond, slave, iter) {
- err = dev_set_promiscuity(slave->dev, inc);
+ bond_for_each_link(bond, link, iter) {
+ err = dev_set_promiscuity(link->dev, inc);
if (err)
return err;
}
@@ -646,22 +646,22 @@ static int bond_set_promiscuity(struct bonding *bond, int inc)
return err;
}
-/* Push the allmulti flag down to all slaves */
+/* Push the allmulti flag down to all links */
static int bond_set_allmulti(struct bonding *bond, int inc)
{
struct list_head *iter;
int err = 0;
if (bond_uses_primary(bond)) {
- struct slave *curr_active = rtnl_dereference(bond->curr_active_slave);
+ struct link *curr_active = rtnl_dereference(bond->curr_active_link);
if (curr_active)
err = dev_set_allmulti(curr_active->dev, inc);
} else {
- struct slave *slave;
+ struct link *link;
- bond_for_each_slave(bond, slave, iter) {
- err = dev_set_allmulti(slave->dev, inc);
+ bond_for_each_link(bond, link, iter) {
+ err = dev_set_allmulti(link->dev, inc);
if (err)
return err;
}
@@ -671,7 +671,7 @@ static int bond_set_allmulti(struct bonding *bond, int inc)
/* Retrieve the list of registered multicast addresses for the bonding
* device and retransmit an IGMP JOIN request to the current active
- * slave.
+ * link.
*/
static void bond_resend_igmp_join_requests_delayed(struct work_struct *work)
{
@@ -691,32 +691,32 @@ static void bond_resend_igmp_join_requests_delayed(struct work_struct *work)
rtnl_unlock();
}
-/* Flush bond's hardware addresses from slave */
+/* Flush bond's hardware addresses from link */
static void bond_hw_addr_flush(struct net_device *bond_dev,
- struct net_device *slave_dev)
+ struct net_device *link_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- dev_uc_unsync(slave_dev, bond_dev);
- dev_mc_unsync(slave_dev, bond_dev);
+ dev_uc_unsync(link_dev, bond_dev);
+ dev_mc_unsync(link_dev, bond_dev);
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
/* del lacpdu mc addr from mc list */
u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
- dev_mc_del(slave_dev, lacpdu_multicast);
+ dev_mc_del(link_dev, lacpdu_multicast);
}
}
-/*--------------------------- Active slave change ---------------------------*/
+/*--------------------------- Active link change ---------------------------*/
/* Update the hardware address list and promisc/allmulti for the new and
- * old active slaves (if any). Modes that are not using primary keep all
- * slaves up date at all times; only the modes that use primary need to call
+ * old active links (if any). Modes that are not using primary keep all
+ * links up date at all times; only the modes that use primary need to call
* this function to swap these settings during a failover.
*/
-static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
- struct slave *old_active)
+static void bond_hw_addr_swap(struct bonding *bond, struct link *new_active,
+ struct link *old_active)
{
if (old_active) {
if (bond->dev->flags & IFF_PROMISC)
@@ -744,41 +744,41 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
}
/**
- * bond_set_dev_addr - clone slave's address to bond
+ * bond_set_dev_addr - clone link's address to bond
* @bond_dev: bond net device
- * @slave_dev: slave net device
+ * @link_dev: link net device
*
* Should be called with RTNL held.
*/
static int bond_set_dev_addr(struct net_device *bond_dev,
- struct net_device *slave_dev)
+ struct net_device *link_dev)
{
int err;
- slave_dbg(bond_dev, slave_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n",
- bond_dev, slave_dev, slave_dev->addr_len);
- err = dev_pre_changeaddr_notify(bond_dev, slave_dev->dev_addr, NULL);
+ link_dbg(bond_dev, link_dev, "bond_dev=%p link_dev=%p link_dev->addr_len=%d\n",
+ bond_dev, link_dev, link_dev->addr_len);
+ err = dev_pre_changeaddr_notify(bond_dev, link_dev->dev_addr, NULL);
if (err)
return err;
- memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len);
+ memcpy(bond_dev->dev_addr, link_dev->dev_addr, link_dev->addr_len);
bond_dev->addr_assign_type = NET_ADDR_STOLEN;
call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
return 0;
}
-static struct slave *bond_get_old_active(struct bonding *bond,
- struct slave *new_active)
+static struct link *bond_get_old_active(struct bonding *bond,
+ struct link *new_active)
{
- struct slave *slave;
+ struct link *link;
struct list_head *iter;
- bond_for_each_slave(bond, slave, iter) {
- if (slave == new_active)
+ bond_for_each_link(bond, link, iter) {
+ if (link == new_active)
continue;
- if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr))
- return slave;
+ if (ether_addr_equal(bond->dev->dev_addr, link->dev->dev_addr))
+ return link;
}
return NULL;
@@ -791,8 +791,8 @@ static struct slave *bond_get_old_active(struct bonding *bond,
* Called with RTNL
*/
static void bond_do_fail_over_mac(struct bonding *bond,
- struct slave *new_active,
- struct slave *old_active)
+ struct link *new_active,
+ struct link *old_active)
{
u8 tmp_mac[MAX_ADDR_LEN];
struct sockaddr_storage ss;
@@ -803,13 +803,13 @@ static void bond_do_fail_over_mac(struct bonding *bond,
if (new_active) {
rv = bond_set_dev_addr(bond->dev, new_active->dev);
if (rv)
- slave_err(bond->dev, new_active->dev, "Error %d setting bond MAC from slave\n",
- -rv);
+ link_err(bond->dev, new_active->dev, "Error %d setting bond MAC from link\n",
+ -rv);
}
break;
case BOND_FOM_FOLLOW:
/* if new_active && old_active, swap them
- * if just old_active, do nothing (going to no active slave)
+ * if just old_active, do nothing (going to no active link)
* if just new_active, set new_active to bond's MAC
*/
if (!new_active)
@@ -834,8 +834,8 @@ static void bond_do_fail_over_mac(struct bonding *bond,
rv = dev_set_mac_address(new_active->dev,
(struct sockaddr *)&ss, NULL);
if (rv) {
- slave_err(bond->dev, new_active->dev, "Error %d setting MAC of new active slave\n",
- -rv);
+ link_err(bond->dev, new_active->dev, "Error %d setting MAC of new active link\n",
+ -rv);
goto out;
}
@@ -849,8 +849,8 @@ static void bond_do_fail_over_mac(struct bonding *bond,
rv = dev_set_mac_address(old_active->dev,
(struct sockaddr *)&ss, NULL);
if (rv)
- slave_err(bond->dev, old_active->dev, "Error %d setting MAC of old active slave\n",
- -rv);
+ link_err(bond->dev, old_active->dev, "Error %d setting MAC of old active link\n",
+ -rv);
out:
break;
default:
@@ -861,10 +861,10 @@ static void bond_do_fail_over_mac(struct bonding *bond,
}
-static struct slave *bond_choose_primary_or_current(struct bonding *bond)
+static struct link *bond_choose_primary_or_current(struct bonding *bond)
{
- struct slave *prim = rtnl_dereference(bond->primary_slave);
- struct slave *curr = rtnl_dereference(bond->curr_active_slave);
+ struct link *prim = rtnl_dereference(bond->primary_link);
+ struct link *curr = rtnl_dereference(bond->curr_active_link);
if (!prim || prim->link_state != BOND_LINK_UP) {
if (!curr || curr->link_state != BOND_LINK_UP)
@@ -900,75 +900,75 @@ static struct slave *bond_choose_primary_or_current(struct bonding *bond)
}
/**
- * bond_find_best_slave - select the best available slave to be the active one
+ * bond_find_best_link - select the best available link to be the active one
* @bond: our bonding struct
*/
-static struct slave *bond_find_best_slave(struct bonding *bond)
+static struct link *bond_find_best_link(struct bonding *bond)
{
- struct slave *slave, *bestslave = NULL;
+ struct link *link, *bestlink = NULL;
struct list_head *iter;
int mintime = bond->params.updelay;
- slave = bond_choose_primary_or_current(bond);
- if (slave)
- return slave;
-
- bond_for_each_slave(bond, slave, iter) {
- if (slave->link_state == BOND_LINK_UP)
- return slave;
- if (slave->link_state == BOND_LINK_BACK &&
- bond_slave_is_up(slave) && slave->delay < mintime) {
- mintime = slave->delay;
- bestslave = slave;
+ link = bond_choose_primary_or_current(bond);
+ if (link)
+ return link;
+
+ bond_for_each_link(bond, link, iter) {
+ if (link->link_state == BOND_LINK_UP)
+ return link;
+ if (link->link_state == BOND_LINK_BACK &&
+ bond_link_is_up(link) && link->delay < mintime) {
+ mintime = link->delay;
+ bestlink = link;
}
}
- return bestslave;
+ return bestlink;
}
static bool bond_should_notify_peers(struct bonding *bond)
{
- struct slave *slave;
+ struct link *link;
rcu_read_lock();
- slave = rcu_dereference(bond->curr_active_slave);
+ link = rcu_dereference(bond->curr_active_link);
rcu_read_unlock();
- netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n",
- slave ? slave->dev->name : "NULL");
+ netdev_dbg(bond->dev, "bond_should_notify_peers: link %s\n",
+ link ? link->dev->name : "NULL");
- if (!slave || !bond->send_peer_notif ||
+ if (!link || !bond->send_peer_notif ||
bond->send_peer_notif %
max(1, bond->params.peer_notif_delay) != 0 ||
!netif_carrier_ok(bond->dev) ||
- test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
+ test_bit(__LINK_STATE_LINKWATCH_PENDING, &link->dev->state))
return false;
return true;
}
/**
- * change_active_interface - change the active slave into the specified one
+ * change_active_interface - change the active link into the specified one
* @bond: our bonding struct
- * @new_active: the new slave to make the active one
+ * @new_active: the new link to make the active one
*
- * Set the new slave to the bond's settings and unset them on the old
- * curr_active_slave.
+ * Set the new link to the bond's settings and unset them on the old
+ * curr_active_link.
* Setting include flags, mc-list, promiscuity, allmulti, etc.
*
* If @new's link state is %BOND_LINK_BACK we'll set it to %BOND_LINK_UP,
- * because it is apparently the best available slave we have, even though its
+ * because it is apparently the best available link we have, even though its
* updelay hasn't timed out yet.
*
* Caller must hold RTNL.
*/
-void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
+void bond_change_active_link(struct bonding *bond, struct link *new_active)
{
- struct slave *old_active;
+ struct link *old_active;
ASSERT_RTNL();
- old_active = rtnl_dereference(bond->curr_active_slave);
+ old_active = rtnl_dereference(bond->curr_active_link);
if (old_active == new_active)
return;
@@ -983,13 +983,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
if (new_active->link_state == BOND_LINK_BACK) {
if (bond_uses_primary(bond)) {
- slave_info(bond->dev, new_active->dev, "making interface the new active one %d ms earlier\n",
- (bond->params.updelay - new_active->delay) * bond->params.miimon);
+ link_info(bond->dev, new_active->dev, "making interface the new active one %d ms earlier\n",
+ (bond->params.updelay - new_active->delay) * bond->params.miimon);
}
new_active->delay = 0;
- bond_set_slave_link_state(new_active, BOND_LINK_UP,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(new_active, BOND_LINK_UP,
+ BOND_LINK_NOTIFY_NOW);
if (BOND_MODE(bond) == BOND_MODE_8023AD)
bond_3ad_handle_link_change(new_active, BOND_LINK_UP);
@@ -998,7 +998,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP);
} else {
if (bond_uses_primary(bond)) {
- slave_info(bond->dev, new_active->dev, "making interface the new active one\n");
+ link_info(bond->dev, new_active->dev, "making interface the new active one\n");
}
}
}
@@ -1009,25 +1009,25 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
if (bond_is_lb(bond)) {
bond_alb_handle_active_change(bond, new_active);
if (old_active)
- bond_set_slave_inactive_flags(old_active,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_inactive_flags(old_active,
+ BOND_LINK_NOTIFY_NOW);
if (new_active)
- bond_set_slave_active_flags(new_active,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_active_flags(new_active,
+ BOND_LINK_NOTIFY_NOW);
} else {
- rcu_assign_pointer(bond->curr_active_slave, new_active);
+ rcu_assign_pointer(bond->curr_active_link, new_active);
}
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) {
if (old_active)
- bond_set_slave_inactive_flags(old_active,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_inactive_flags(old_active,
+ BOND_LINK_NOTIFY_NOW);
if (new_active) {
bool should_notify_peers = false;
- bond_set_slave_active_flags(new_active,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_active_flags(new_active,
+ BOND_LINK_NOTIFY_NOW);
if (bond->params.fail_over_mac)
bond_do_fail_over_mac(bond, new_active,
@@ -1057,8 +1057,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
}
#endif /* CONFIG_XFRM_OFFLOAD */
- /* resend IGMP joins since active slave has changed or
- * all were sent on curr_active_slave.
+ /* resend IGMP joins since active link has changed or
+ * all were sent on curr_active_link.
* resend only if bond is brought up with the affected
* bonding modes and the retransmission is enabled
*/
@@ -1071,26 +1071,26 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
}
/**
- * bond_select_active_slave - select a new active slave, if needed
+ * bond_select_active_link - select a new active link, if needed
* @bond: our bonding struct
*
* This functions should be called when one of the following occurs:
- * - The old curr_active_slave has been released or lost its link.
- * - The primary_slave has got its link back.
- * - A slave has got its link back and there's no old curr_active_slave.
+ * - The old curr_active_link has been released or lost its link.
+ * - The primary_link has got its link back.
+ * - A link has got its link back and there's no old curr_active_link.
*
* Caller must hold RTNL.
*/
-void bond_select_active_slave(struct bonding *bond)
+void bond_select_active_link(struct bonding *bond)
{
- struct slave *best_slave;
+ struct link *best_link;
int rv;
ASSERT_RTNL();
- best_slave = bond_find_best_slave(bond);
- if (best_slave != rtnl_dereference(bond->curr_active_slave)) {
- bond_change_active_slave(bond, best_slave);
+ best_link = bond_find_best_link(bond);
+ if (best_link != rtnl_dereference(bond->curr_active_link)) {
+ bond_change_active_link(bond, best_link);
rv = bond_set_carrier(bond);
if (!rv)
return;
@@ -1103,7 +1103,7 @@ void bond_select_active_slave(struct bonding *bond)
}
#ifdef CONFIG_NET_POLL_CONTROLLER
-static inline int slave_enable_netpoll(struct slave *slave)
+static inline int link_enable_netpoll(struct link *link)
{
struct netpoll *np;
int err = 0;
@@ -1113,23 +1113,23 @@ static inline int slave_enable_netpoll(struct slave *slave)
if (!np)
goto out;
- err = __netpoll_setup(np, slave->dev);
+ err = __netpoll_setup(np, link->dev);
if (err) {
kfree(np);
goto out;
}
- slave->np = np;
+ link->np = np;
out:
return err;
}
-static inline void slave_disable_netpoll(struct slave *slave)
+static inline void link_disable_netpoll(struct link *link)
{
- struct netpoll *np = slave->np;
+ struct netpoll *np = link->np;
if (!np)
return;
- slave->np = NULL;
+ link->np = NULL;
__netpoll_free(np);
}
@@ -1137,7 +1137,7 @@ static inline void slave_disable_netpoll(struct slave *slave)
static void bond_poll_controller(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave = NULL;
+ struct link *link = NULL;
struct list_head *iter;
struct ad_info ad_info;
@@ -1145,20 +1145,20 @@ static void bond_poll_controller(struct net_device *bond_dev)
if (bond_3ad_get_active_agg_info(bond, &ad_info))
return;
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (!bond_slave_is_up(slave))
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (!bond_link_is_up(link))
continue;
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
struct aggregator *agg =
- SLAVE_AD_INFO(slave)->port.aggregator;
+ LINK_AD_INFO(link)->port.aggregator;
if (agg &&
agg->aggregator_identifier != ad_info.aggregator_id)
continue;
}
- netpoll_poll_dev(slave->dev);
+ netpoll_poll_dev(link->dev);
}
}
@@ -1166,22 +1166,22 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
- bond_for_each_slave(bond, slave, iter)
- if (bond_slave_is_up(slave))
- slave_disable_netpoll(slave);
+ bond_for_each_link(bond, link, iter)
+ if (bond_link_is_up(link))
+ link_disable_netpoll(link);
}
static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
{
struct bonding *bond = netdev_priv(dev);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
int err = 0;
- bond_for_each_slave(bond, slave, iter) {
- err = slave_enable_netpoll(slave);
+ bond_for_each_link(bond, link, iter) {
+ err = link_enable_netpoll(link);
if (err) {
bond_netpoll_cleanup(dev);
break;
@@ -1190,11 +1190,11 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
return err;
}
#else
-static inline int slave_enable_netpoll(struct slave *slave)
+static inline int link_enable_netpoll(struct link *link)
{
return 0;
}
-static inline void slave_disable_netpoll(struct slave *slave)
+static inline void link_disable_netpoll(struct link *link)
{
}
static void bond_netpoll_cleanup(struct net_device *bond_dev)
@@ -1210,16 +1210,16 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
struct bonding *bond = netdev_priv(dev);
struct list_head *iter;
netdev_features_t mask;
- struct slave *slave;
+ struct link *link;
mask = features;
features &= ~NETIF_F_ONE_FOR_ALL;
features |= NETIF_F_ALL_FOR_ALL;
- bond_for_each_slave(bond, slave, iter) {
+ bond_for_each_link(bond, link, iter) {
features = netdev_increment_features(features,
- slave->dev->features,
+ link->dev->features,
mask);
}
features = netdev_add_tso_features(features, mask);
@@ -1250,40 +1250,40 @@ static void bond_compute_features(struct bonding *bond)
netdev_features_t mpls_features = BOND_MPLS_FEATURES;
struct net_device *bond_dev = bond->dev;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
unsigned short max_hard_header_len = ETH_HLEN;
unsigned int gso_max_size = GSO_MAX_SIZE;
u16 gso_max_segs = GSO_MAX_SEGS;
- if (!bond_has_slaves(bond))
+ if (!bond_has_links(bond))
goto done;
vlan_features &= NETIF_F_ALL_FOR_ALL;
mpls_features &= NETIF_F_ALL_FOR_ALL;
- bond_for_each_slave(bond, slave, iter) {
+ bond_for_each_link(bond, link, iter) {
vlan_features = netdev_increment_features(vlan_features,
- slave->dev->vlan_features, BOND_VLAN_FEATURES);
+ link->dev->vlan_features, BOND_VLAN_FEATURES);
enc_features = netdev_increment_features(enc_features,
- slave->dev->hw_enc_features,
+ link->dev->hw_enc_features,
BOND_ENC_FEATURES);
#ifdef CONFIG_XFRM_OFFLOAD
xfrm_features = netdev_increment_features(xfrm_features,
- slave->dev->hw_enc_features,
+ link->dev->hw_enc_features,
BOND_XFRM_FEATURES);
#endif /* CONFIG_XFRM_OFFLOAD */
mpls_features = netdev_increment_features(mpls_features,
- slave->dev->mpls_features,
+ link->dev->mpls_features,
BOND_MPLS_FEATURES);
- dst_release_flag &= slave->dev->priv_flags;
- if (slave->dev->hard_header_len > max_hard_header_len)
- max_hard_header_len = slave->dev->hard_header_len;
+ dst_release_flag &= link->dev->priv_flags;
+ if (link->dev->hard_header_len > max_hard_header_len)
+ max_hard_header_len = link->dev->hard_header_len;
- gso_max_size = min(gso_max_size, slave->dev->gso_max_size);
- gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs);
+ gso_max_size = min(gso_max_size, link->dev->gso_max_size);
+ gso_max_segs = min(gso_max_segs, link->dev->gso_max_segs);
}
bond_dev->hard_header_len = max_hard_header_len;
@@ -1308,27 +1308,27 @@ static void bond_compute_features(struct bonding *bond)
netdev_change_features(bond_dev);
}
-static void bond_setup_by_slave(struct net_device *bond_dev,
- struct net_device *slave_dev)
+static void bond_setup_by_link(struct net_device *bond_dev,
+ struct net_device *link_dev)
{
- bond_dev->header_ops = slave_dev->header_ops;
+ bond_dev->header_ops = link_dev->header_ops;
- bond_dev->type = slave_dev->type;
- bond_dev->hard_header_len = slave_dev->hard_header_len;
- bond_dev->addr_len = slave_dev->addr_len;
+ bond_dev->type = link_dev->type;
+ bond_dev->hard_header_len = link_dev->hard_header_len;
+ bond_dev->addr_len = link_dev->addr_len;
- memcpy(bond_dev->broadcast, slave_dev->broadcast,
- slave_dev->addr_len);
+ memcpy(bond_dev->broadcast, link_dev->broadcast,
+ link_dev->addr_len);
}
-/* On bonding slaves other than the currently active slave, suppress
+/* On bonding links other than the currently active link, suppress
* duplicates except for alb non-mcast/bcast.
*/
static bool bond_should_deliver_exact_match(struct sk_buff *skb,
- struct slave *slave,
+ struct link *link,
struct bonding *bond)
{
- if (bond_is_slave_inactive(slave)) {
+ if (bond_is_link_inactive(link)) {
if (BOND_MODE(bond) == BOND_MODE_ALB &&
skb->pkt_type != PACKET_BROADCAST &&
skb->pkt_type != PACKET_MULTICAST)
@@ -1341,10 +1341,10 @@ static bool bond_should_deliver_exact_match(struct sk_buff *skb,
static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
{
struct sk_buff *skb = *pskb;
- struct slave *slave;
+ struct link *link;
struct bonding *bond;
int (*recv_probe)(const struct sk_buff *, struct bonding *,
- struct slave *);
+ struct link *);
int ret = RX_HANDLER_ANOTHER;
skb = skb_share_check(skb, GFP_ATOMIC);
@@ -1353,12 +1353,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
*pskb = skb;
- slave = bond_slave_get_rcu(skb->dev);
- bond = slave->bond;
+ link = bond_link_get_rcu(skb->dev);
+ bond = link->bond;
recv_probe = READ_ONCE(bond->recv_probe);
if (recv_probe) {
- ret = recv_probe(skb, bond, slave);
+ ret = recv_probe(skb, bond, link);
if (ret == RX_HANDLER_CONSUMED) {
consume_skb(skb);
return ret;
@@ -1369,14 +1369,14 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
* For packets determined by bond_should_deliver_exact_match() call to
* be suppressed we want to make an exception for link-local packets.
* This is necessary for e.g. LLDP daemons to be able to monitor
- * inactive slave links without being forced to bind to them
+ * inactive link links without being forced to bind to them
* explicitly.
*
* At the same time, packets that are passed to the bonding master
* (including link-local ones) can have their originating interface
* determined via PACKET_ORIGDEV socket option.
*/
- if (bond_should_deliver_exact_match(skb, slave, bond)) {
+ if (bond_should_deliver_exact_match(skb, link, bond)) {
if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
return RX_HANDLER_PASS;
return RX_HANDLER_EXACT;
@@ -1439,7 +1439,7 @@ 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,
+static int bond_master_upper_dev_link(struct bonding *bond, struct link *link,
struct netlink_ext_ack *extack)
{
struct netdev_lag_upper_info lag_upper_info;
@@ -1449,172 +1449,172 @@ static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave,
lag_upper_info.tx_type = type;
lag_upper_info.hash_type = bond_lag_hash_type(bond, type);
- return netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
+ return netdev_master_upper_dev_link(link->dev, bond->dev, link,
&lag_upper_info, extack);
}
-static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave)
+static void bond_upper_dev_unlink(struct bonding *bond, struct link *link)
{
- netdev_upper_dev_unlink(slave->dev, bond->dev);
- slave->dev->flags &= ~IFF_SLAVE;
+ netdev_upper_dev_unlink(link->dev, bond->dev);
+ link->dev->flags &= ~IFF_SLAVE;
}
-static struct slave *bond_alloc_slave(struct bonding *bond)
+static struct link *bond_alloc_link(struct bonding *bond)
{
- struct slave *slave = NULL;
+ struct link *link = NULL;
- slave = kzalloc(sizeof(*slave), GFP_KERNEL);
- if (!slave)
+ link = kzalloc(sizeof(*link), GFP_KERNEL);
+ if (!link)
return NULL;
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
- SLAVE_AD_INFO(slave) = kzalloc(sizeof(struct ad_slave_info),
+ LINK_AD_INFO(link) = kzalloc(sizeof(struct ad_link_info),
GFP_KERNEL);
- if (!SLAVE_AD_INFO(slave)) {
- kfree(slave);
+ if (!LINK_AD_INFO(link)) {
+ kfree(link);
return NULL;
}
}
- INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);
+ INIT_DELAYED_WORK(&link->notify_work, bond_netdev_notify_work);
- return slave;
+ return link;
}
-static void bond_free_slave(struct slave *slave)
+static void bond_free_link(struct link *link)
{
- struct bonding *bond = bond_get_bond_by_slave(slave);
+ struct bonding *bond = bond_get_bond_by_link(link);
- cancel_delayed_work_sync(&slave->notify_work);
+ cancel_delayed_work_sync(&link->notify_work);
if (BOND_MODE(bond) == BOND_MODE_8023AD)
- kfree(SLAVE_AD_INFO(slave));
+ kfree(LINK_AD_INFO(link));
- kfree(slave);
+ kfree(link);
}
static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info)
{
info->bond_mode = BOND_MODE(bond);
info->miimon = bond->params.miimon;
- info->num_slaves = bond->slave_cnt;
+ info->num_slaves = bond->link_cnt;
}
-static void bond_fill_ifslave(struct slave *slave, struct ifslave *info)
+static void bond_fill_ifslave(struct link *link, struct ifslave *info)
{
- strcpy(info->slave_name, slave->dev->name);
- info->slave = slave->link_state;
- info->state = bond_slave_state(slave);
- info->link_failure_count = slave->link_failure_count;
+ strcpy(info->slave_name, link->dev->name);
+ info->link = link->link_state;
+ info->state = bond_link_state(link);
+ info->link_failure_count = link->link_failure_count;
}
static void bond_netdev_notify_work(struct work_struct *_work)
{
- struct slave *slave = container_of(_work, struct slave,
+ struct link *link = container_of(_work, struct link,
notify_work.work);
if (rtnl_trylock()) {
struct netdev_bonding_info binfo;
- bond_fill_ifslave(slave, &binfo.slave);
- bond_fill_ifbond(slave->bond, &binfo.master);
- netdev_bonding_info_change(slave->dev, &binfo);
+ bond_fill_ifslave(link, &binfo.link);
+ bond_fill_ifbond(link->bond, &binfo.master);
+ netdev_bonding_info_change(link->dev, &binfo);
rtnl_unlock();
} else {
- queue_delayed_work(slave->bond->wq, &slave->notify_work, 1);
+ queue_delayed_work(link->bond->wq, &link->notify_work, 1);
}
}
-void bond_queue_slave_event(struct slave *slave)
+void bond_queue_link_event(struct link *link)
{
- queue_delayed_work(slave->bond->wq, &slave->notify_work, 0);
+ queue_delayed_work(link->bond->wq, &link->notify_work, 0);
}
-void bond_lower_state_changed(struct slave *slave)
+void bond_lower_state_changed(struct link *link)
{
struct netdev_lag_lower_state_info info;
- info.link_up = slave->link_state == BOND_LINK_UP ||
- slave->link_state == BOND_LINK_FAIL;
- info.tx_enabled = bond_is_active_slave(slave);
- netdev_lower_state_changed(slave->dev, &info);
+ info.link_up = link->link_state == BOND_LINK_UP ||
+ link->link_state == BOND_LINK_FAIL;
+ info.tx_enabled = bond_is_active_link(link);
+ netdev_lower_state_changed(link->dev, &info);
}
-/* enslave device <slave> to bond device <master> */
-int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
+/* connect device <link> to bond device <master> */
+int bond_connect(struct net_device *bond_dev, struct net_device *link_dev,
struct netlink_ext_ack *extack)
{
struct bonding *bond = netdev_priv(bond_dev);
- const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
- struct slave *new_slave = NULL, *prev_slave;
+ const struct net_device_ops *link_ops = link_dev->netdev_ops;
+ struct link *new_link = NULL, *prev_link;
struct sockaddr_storage ss;
int link_reporting;
int res = 0, i;
if (!bond->params.use_carrier &&
- slave_dev->ethtool_ops->get_link == NULL &&
- slave_ops->ndo_do_ioctl == NULL) {
- slave_warn(bond_dev, slave_dev, "no link monitoring support\n");
+ link_dev->ethtool_ops->get_link == NULL &&
+ link_ops->ndo_do_ioctl == NULL) {
+ link_warn(bond_dev, link_dev, "no link monitoring support\n");
}
/* already in-use? */
- if (netdev_is_rx_handler_busy(slave_dev)) {
- NL_SET_ERR_MSG(extack, "Device is in use and cannot be enslaved");
- slave_err(bond_dev, slave_dev,
- "Error: Device is in use and cannot be enslaved\n");
+ if (netdev_is_rx_handler_busy(link_dev)) {
+ NL_SET_ERR_MSG(extack, "Device is in use and cannot be connected");
+ link_err(bond_dev, link_dev,
+ "Error: Device is in use and cannot be connected\n");
return -EBUSY;
}
- if (bond_dev == slave_dev) {
- NL_SET_ERR_MSG(extack, "Cannot enslave bond to itself.");
- netdev_err(bond_dev, "cannot enslave bond to itself.\n");
+ if (bond_dev == link_dev) {
+ NL_SET_ERR_MSG(extack, "Cannot connect bond to itself.");
+ netdev_err(bond_dev, "cannot connect bond to itself.\n");
return -EPERM;
}
/* vlan challenged mutual exclusion */
/* no need to lock since we're protected by rtnl_lock */
- if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
- slave_dbg(bond_dev, slave_dev, "is NETIF_F_VLAN_CHALLENGED\n");
+ if (link_dev->features & NETIF_F_VLAN_CHALLENGED) {
+ link_dbg(bond_dev, link_dev, "is NETIF_F_VLAN_CHALLENGED\n");
if (vlan_uses_dev(bond_dev)) {
- NL_SET_ERR_MSG(extack, "Can not enslave VLAN challenged device to VLAN enabled bond");
- slave_err(bond_dev, slave_dev, "Error: cannot enslave VLAN challenged slave on VLAN enabled bond\n");
+ NL_SET_ERR_MSG(extack, "Can not connect VLAN challenged device to VLAN enabled bond");
+ link_err(bond_dev, link_dev, "Error: cannot connect VLAN challenged link on VLAN enabled bond\n");
return -EPERM;
} else {
- slave_warn(bond_dev, slave_dev, "enslaved VLAN challenged slave. Adding VLANs will be blocked as long as it is part of bond.\n");
+ link_warn(bond_dev, link_dev, "connected VLAN challenged link. Adding VLANs will be blocked as long as it is part of bond.\n");
}
} else {
- slave_dbg(bond_dev, slave_dev, "is !NETIF_F_VLAN_CHALLENGED\n");
+ link_dbg(bond_dev, link_dev, "is !NETIF_F_VLAN_CHALLENGED\n");
}
- if (slave_dev->features & NETIF_F_HW_ESP)
- slave_dbg(bond_dev, slave_dev, "is esp-hw-offload capable\n");
+ if (link_dev->features & NETIF_F_HW_ESP)
+ link_dbg(bond_dev, link_dev, "is esp-hw-offload capable\n");
/* Old ifenslave binaries are no longer supported. These can
- * be identified with moderate accuracy by the state of the slave:
+ * be identified with moderate accuracy by the state of the link:
* the current ifenslave will set the interface down prior to
* enslaving it; the old ifenslave will not.
*/
- if (slave_dev->flags & IFF_UP) {
- NL_SET_ERR_MSG(extack, "Device can not be enslaved while up");
- slave_err(bond_dev, slave_dev, "slave is up - this may be due to an out of date ifenslave\n");
+ if (link_dev->flags & IFF_UP) {
+ NL_SET_ERR_MSG(extack, "Device can not be connected while up");
+ link_err(bond_dev, link_dev, "link is up - this may be due to an out of date ifenslave\n");
return -EPERM;
}
- /* set bonding device ether type by slave - bonding netdevices are
- * created with ether_setup, so when the slave type is not ARPHRD_ETHER
+ /* set bonding device ether type by link - bonding netdevices are
+ * created with ether_setup, so when the link type is not ARPHRD_ETHER
* there is a need to override some of the type dependent attribs/funcs.
*
- * bond ether type mutual exclusion - don't allow slaves of dissimilar
+ * bond ether type mutual exclusion - don't allow links of dissimilar
* ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same bond
*/
- if (!bond_has_slaves(bond)) {
- if (bond_dev->type != slave_dev->type) {
- slave_dbg(bond_dev, slave_dev, "change device type from %d to %d\n",
- bond_dev->type, slave_dev->type);
+ if (!bond_has_links(bond)) {
+ if (bond_dev->type != link_dev->type) {
+ link_dbg(bond_dev, link_dev, "change device type from %d to %d\n",
+ bond_dev->type, link_dev->type);
res = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
bond_dev);
res = notifier_to_errno(res);
if (res) {
- slave_err(bond_dev, slave_dev, "refused to change device type\n");
+ link_err(bond_dev, link_dev, "refused to change device type\n");
return -EBUSY;
}
@@ -1622,8 +1622,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
dev_uc_flush(bond_dev);
dev_mc_flush(bond_dev);
- if (slave_dev->type != ARPHRD_ETHER)
- bond_setup_by_slave(bond_dev, slave_dev);
+ if (link_dev->type != ARPHRD_ETHER)
+ bond_setup_by_link(bond_dev, link_dev);
else {
ether_setup(bond_dev);
bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
@@ -1632,139 +1632,139 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
bond_dev);
}
- } else if (bond_dev->type != slave_dev->type) {
- NL_SET_ERR_MSG(extack, "Device type is different from other slaves");
- slave_err(bond_dev, slave_dev, "ether type (%d) is different from other slaves (%d), can not enslave it\n",
- slave_dev->type, bond_dev->type);
+ } else if (bond_dev->type != link_dev->type) {
+ NL_SET_ERR_MSG(extack, "Device type is different from other links");
+ link_err(bond_dev, link_dev, "ether type (%d) is different from other links (%d), can not connect it\n",
+ link_dev->type, bond_dev->type);
return -EINVAL;
}
- if (slave_dev->type == ARPHRD_INFINIBAND &&
+ if (link_dev->type == ARPHRD_INFINIBAND &&
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
- NL_SET_ERR_MSG(extack, "Only active-backup mode is supported for infiniband slaves");
- slave_warn(bond_dev, slave_dev, "Type (%d) supports only active-backup mode\n",
- slave_dev->type);
+ NL_SET_ERR_MSG(extack, "Only active-backup mode is supported for infiniband links");
+ link_warn(bond_dev, link_dev, "Type (%d) supports only active-backup mode\n",
+ link_dev->type);
res = -EOPNOTSUPP;
goto err_undo_flags;
}
- if (!slave_ops->ndo_set_mac_address ||
- slave_dev->type == ARPHRD_INFINIBAND) {
- slave_warn(bond_dev, slave_dev, "The slave device specified does not support setting the MAC address\n");
+ if (!link_ops->ndo_set_mac_address ||
+ link_dev->type == ARPHRD_INFINIBAND) {
+ link_warn(bond_dev, link_dev, "The link device specified does not support setting the MAC address\n");
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP &&
bond->params.fail_over_mac != BOND_FOM_ACTIVE) {
- if (!bond_has_slaves(bond)) {
+ if (!bond_has_links(bond)) {
bond->params.fail_over_mac = BOND_FOM_ACTIVE;
- slave_warn(bond_dev, slave_dev, "Setting fail_over_mac to active for active-backup mode\n");
+ link_warn(bond_dev, link_dev, "Setting fail_over_mac to active for active-backup mode\n");
} else {
- NL_SET_ERR_MSG(extack, "Slave device does not support setting the MAC address, but fail_over_mac is not set to active");
- slave_err(bond_dev, slave_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");
+ NL_SET_ERR_MSG(extack, "Link device does not support setting the MAC address, but fail_over_mac is not set to active");
+ link_err(bond_dev, link_dev, "The link device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");
res = -EOPNOTSUPP;
goto err_undo_flags;
}
}
}
- call_netdevice_notifiers(NETDEV_JOIN, slave_dev);
+ call_netdevice_notifiers(NETDEV_JOIN, link_dev);
- /* If this is the first slave, then we need to set the master's hardware
- * address to be the same as the slave's.
+ /* If this is the first link, then we need to set the master's hardware
+ * address to be the same as the link's.
*/
- if (!bond_has_slaves(bond) &&
+ if (!bond_has_links(bond) &&
bond->dev->addr_assign_type == NET_ADDR_RANDOM) {
- res = bond_set_dev_addr(bond->dev, slave_dev);
+ res = bond_set_dev_addr(bond->dev, link_dev);
if (res)
goto err_undo_flags;
}
- new_slave = bond_alloc_slave(bond);
- if (!new_slave) {
+ new_link = bond_alloc_link(bond);
+ if (!new_link) {
res = -ENOMEM;
goto err_undo_flags;
}
- new_slave->bond = bond;
- new_slave->dev = slave_dev;
- /* Set the new_slave's queue_id to be zero. Queue ID mapping
+ new_link->bond = bond;
+ new_link->dev = link_dev;
+ /* Set the new_link's queue_id to be zero. Queue ID mapping
* is set via sysfs or module option if desired.
*/
- new_slave->queue_id = 0;
+ new_link->queue_id = 0;
- /* Save slave's original mtu and then set it to match the bond */
- new_slave->original_mtu = slave_dev->mtu;
- res = dev_set_mtu(slave_dev, bond->dev->mtu);
+ /* Save link's original mtu and then set it to match the bond */
+ new_link->original_mtu = link_dev->mtu;
+ res = dev_set_mtu(link_dev, bond->dev->mtu);
if (res) {
- slave_err(bond_dev, slave_dev, "Error %d calling dev_set_mtu\n", res);
+ link_err(bond_dev, link_dev, "Error %d calling dev_set_mtu\n", res);
goto err_free;
}
- /* Save slave's original ("permanent") mac address for modes
+ /* Save link'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
*/
- bond_hw_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr,
- slave_dev->addr_len);
+ bond_hw_addr_copy(new_link->perm_hwaddr, link_dev->dev_addr,
+ link_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 link to master's mac address. The application already
+ * set the master's mac address to that of the first link
*/
memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
- ss.ss_family = slave_dev->type;
- res = dev_set_mac_address(slave_dev, (struct sockaddr *)&ss,
+ ss.ss_family = link_dev->type;
+ res = dev_set_mac_address(link_dev, (struct sockaddr *)&ss,
extack);
if (res) {
- slave_err(bond_dev, slave_dev, "Error %d calling set_mac_address\n", res);
+ link_err(bond_dev, link_dev, "Error %d calling set_mac_address\n", res);
goto err_restore_mtu;
}
}
- /* set slave flag before open to prevent IPv6 addrconf */
- slave_dev->flags |= IFF_SLAVE;
+ /* set link flag before open to prevent IPv6 addrconf */
+ link_dev->flags |= IFF_SLAVE;
- /* open the slave since the application closed it */
- res = dev_open(slave_dev, extack);
+ /* open the link since the application closed it */
+ res = dev_open(link_dev, extack);
if (res) {
- slave_err(bond_dev, slave_dev, "Opening slave failed\n");
+ link_err(bond_dev, link_dev, "Opening link failed\n");
goto err_restore_mac;
}
- slave_dev->priv_flags |= IFF_BONDING;
- /* initialize slave stats */
- dev_get_stats(new_slave->dev, &new_slave->slave_stats);
+ link_dev->priv_flags |= IFF_BONDING;
+ /* initialize link stats */
+ dev_get_stats(new_link->dev, &new_link->link_stats);
if (bond_is_lb(bond)) {
- /* bond_alb_init_slave() must be called before all other stages since
+ /* bond_alb_init_link() must be called before all other stages since
* it might fail and we do not want to have to undo everything
*/
- res = bond_alb_init_slave(bond, new_slave);
+ res = bond_alb_init_link(bond, new_link);
if (res)
goto err_close;
}
- res = vlan_vids_add_by_dev(slave_dev, bond_dev);
+ res = vlan_vids_add_by_dev(link_dev, bond_dev);
if (res) {
- slave_err(bond_dev, slave_dev, "Couldn't add bond vlan ids\n");
+ link_err(bond_dev, link_dev, "Couldn't add bond vlan ids\n");
goto err_close;
}
- prev_slave = bond_last_slave(bond);
+ prev_link = bond_last_link(bond);
- new_slave->delay = 0;
- new_slave->link_failure_count = 0;
+ new_link->delay = 0;
+ new_link->link_failure_count = 0;
- if (bond_update_speed_duplex(new_slave) &&
+ if (bond_update_speed_duplex(new_link) &&
bond_needs_speed_duplex(bond))
- new_slave->link_state = BOND_LINK_DOWN;
+ new_link->link_state = BOND_LINK_DOWN;
- new_slave->last_rx = jiffies -
+ new_link->last_rx = jiffies -
(msecs_to_jiffies(bond->params.arp_interval) + 1);
for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
- new_slave->target_last_arp_rx[i] = new_slave->last_rx;
+ new_link->target_last_arp_rx[i] = new_link->last_rx;
if (bond->params.miimon && !bond->params.use_carrier) {
- link_reporting = bond_check_dev_link(bond, slave_dev, 1);
+ link_reporting = bond_check_dev_link(bond, link_dev, 1);
if ((link_reporting == -1) && !bond->params.arp_interval) {
/* miimon is set but a bonded network driver
@@ -1775,106 +1775,103 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
* supported); thus, we don't need to change
* the messages for netif_carrier.
*/
- slave_warn(bond_dev, slave_dev, "MII and ETHTOOL support not available for slave, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details\n");
+ link_warn(bond_dev, link_dev, "MII and ETHTOOL support not available for link, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details\n");
} else if (link_reporting == -1) {
/* unable get link status using mii/ethtool */
- slave_warn(bond_dev, slave_dev, "can't get link status from slave; the network driver associated with this interface does not support MII or ETHTOOL link status reporting, thus miimon has no effect on this interface\n");
+ link_warn(bond_dev, link_dev, "can't get link status from link; the network driver associated with this interface does not support MII or ETHTOOL link status reporting, thus miimon has no effect on this interface\n");
}
}
/* check for initial state */
- new_slave->link_state = BOND_LINK_NOCHANGE;
+ new_link->link_state = BOND_LINK_NOCHANGE;
if (bond->params.miimon) {
- if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) {
+ if (bond_check_dev_link(bond, link_dev, 0) == BMSR_LSTATUS) {
if (bond->params.updelay) {
- bond_set_slave_link_state(new_slave,
- BOND_LINK_BACK,
- BOND_SLAVE_NOTIFY_NOW);
- new_slave->delay = bond->params.updelay;
+ bond_set_link_state(new_link, BOND_LINK_BACK,
+ BOND_LINK_NOTIFY_NOW);
+ new_link->delay = bond->params.updelay;
} else {
- bond_set_slave_link_state(new_slave,
- BOND_LINK_UP,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(new_link, BOND_LINK_UP,
+ BOND_LINK_NOTIFY_NOW);
}
} else {
- bond_set_slave_link_state(new_slave, BOND_LINK_DOWN,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(new_link, BOND_LINK_DOWN,
+ BOND_LINK_NOTIFY_NOW);
}
} else if (bond->params.arp_interval) {
- bond_set_slave_link_state(new_slave,
- (netif_carrier_ok(slave_dev) ?
- BOND_LINK_UP : BOND_LINK_DOWN),
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(new_link, (netif_carrier_ok(link_dev) ?
+ BOND_LINK_UP : BOND_LINK_DOWN),
+ BOND_LINK_NOTIFY_NOW);
} else {
- bond_set_slave_link_state(new_slave, BOND_LINK_UP,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(new_link, BOND_LINK_UP,
+ BOND_LINK_NOTIFY_NOW);
}
- if (new_slave->link_state != BOND_LINK_DOWN)
- new_slave->last_link_up = jiffies;
- slave_dbg(bond_dev, slave_dev, "Initial state of slave is BOND_LINK_%s\n",
- new_slave->link_state == BOND_LINK_DOWN ? "DOWN" :
- (new_slave->link_state == BOND_LINK_UP ? "UP" : "BACK"));
+ if (new_link->link_state != BOND_LINK_DOWN)
+ new_link->last_link_up = jiffies;
+ link_dbg(bond_dev, link_dev, "Initial state of link is BOND_LINK_%s\n",
+ new_link->link_state == BOND_LINK_DOWN ? "DOWN" :
+ (new_link->link_state == BOND_LINK_UP ? "UP" : "BACK"));
if (bond_uses_primary(bond) && bond->params.primary[0]) {
- /* if there is a primary slave, remember it */
- if (strcmp(bond->params.primary, new_slave->dev->name) == 0) {
- rcu_assign_pointer(bond->primary_slave, new_slave);
+ /* if there is a primary link, remember it */
+ if (strcmp(bond->params.primary, new_link->dev->name) == 0) {
+ rcu_assign_pointer(bond->primary_link, new_link);
bond->force_primary = true;
}
}
switch (BOND_MODE(bond)) {
case BOND_MODE_ACTIVEBACKUP:
- bond_set_slave_inactive_flags(new_slave,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_inactive_flags(new_link,
+ BOND_LINK_NOTIFY_NOW);
break;
case BOND_MODE_8023AD:
/* in 802.3ad mode, the internal mechanism
- * will activate the slaves in the selected
+ * will activate the links in the selected
* aggregator
*/
- bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW);
- /* if this is the first slave */
- if (!prev_slave) {
- SLAVE_AD_INFO(new_slave)->id = 1;
+ bond_set_link_inactive_flags(new_link, BOND_LINK_NOTIFY_NOW);
+ /* if this is the first link */
+ if (!prev_link) {
+ LINK_AD_INFO(new_link)->id = 1;
/* Initialize AD with the number of times that the AD timer is called in 1 second
* can be called only after the mac address of the bond is set
*/
bond_3ad_initialize(bond, 1000/AD_TIMER_INTERVAL);
} else {
- SLAVE_AD_INFO(new_slave)->id =
- SLAVE_AD_INFO(prev_slave)->id + 1;
+ LINK_AD_INFO(new_link)->id =
+ LINK_AD_INFO(prev_link)->id + 1;
}
- bond_3ad_bind_slave(new_slave);
+ bond_3ad_bind_link(new_link);
break;
case BOND_MODE_TLB:
case BOND_MODE_ALB:
- bond_set_active_slave(new_slave);
- bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW);
+ bond_set_active_link(new_link);
+ bond_set_link_inactive_flags(new_link, BOND_LINK_NOTIFY_NOW);
break;
default:
- slave_dbg(bond_dev, slave_dev, "This slave is always active in trunk mode\n");
+ link_dbg(bond_dev, link_dev, "This link is always active in trunk mode\n");
/* always active in trunk mode */
- bond_set_active_slave(new_slave);
+ bond_set_active_link(new_link);
- /* In trunking mode there is little meaning to curr_active_slave
+ /* In trunking mode there is little meaning to curr_active_link
* anyway (it holds no special properties of the bond device),
* so we can change it without calling change_active_interface()
*/
- if (!rcu_access_pointer(bond->curr_active_slave) &&
- new_slave->link_state == BOND_LINK_UP)
- rcu_assign_pointer(bond->curr_active_slave, new_slave);
+ if (!rcu_access_pointer(bond->curr_active_link) &&
+ new_link->link_state == BOND_LINK_UP)
+ rcu_assign_pointer(bond->curr_active_link, new_link);
break;
} /* switch(bond_mode) */
#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");
+ if (link_enable_netpoll(new_link)) {
+ link_info(bond_dev, link_dev, "master_dev is using netpoll, but new link device does not support netpoll\n");
res = -EBUSY;
goto err_detach;
}
@@ -1882,137 +1879,137 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
#endif
if (!(bond_dev->features & NETIF_F_LRO))
- dev_disable_lro(slave_dev);
+ dev_disable_lro(link_dev);
- res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
- new_slave);
+ res = netdev_rx_handler_register(link_dev, bond_handle_frame,
+ new_link);
if (res) {
- slave_dbg(bond_dev, slave_dev, "Error %d calling netdev_rx_handler_register\n", res);
+ link_dbg(bond_dev, link_dev, "Error %d calling netdev_rx_handler_register\n", res);
goto err_detach;
}
- res = bond_master_upper_dev_link(bond, new_slave, extack);
+ res = bond_master_upper_dev_link(bond, new_link, extack);
if (res) {
- slave_dbg(bond_dev, slave_dev, "Error %d calling bond_master_upper_dev_link\n", res);
+ link_dbg(bond_dev, link_dev, "Error %d calling bond_master_upper_dev_link\n", res);
goto err_unregister;
}
- res = bond_sysfs_slave_add(new_slave);
+ res = bond_sysfs_link_add(new_link);
if (res) {
- slave_dbg(bond_dev, slave_dev, "Error %d calling bond_sysfs_slave_add\n", res);
+ link_dbg(bond_dev, link_dev, "Error %d calling bond_sysfs_link_add\n", res);
goto err_upper_unlink;
}
/* If the mode uses primary, then the following is handled by
- * bond_change_active_slave().
+ * bond_change_active_link().
*/
if (!bond_uses_primary(bond)) {
- /* set promiscuity level to new slave */
+ /* set promiscuity level to new link */
if (bond_dev->flags & IFF_PROMISC) {
- res = dev_set_promiscuity(slave_dev, 1);
+ res = dev_set_promiscuity(link_dev, 1);
if (res)
goto err_sysfs_del;
}
- /* set allmulti level to new slave */
+ /* set allmulti level to new link */
if (bond_dev->flags & IFF_ALLMULTI) {
- res = dev_set_allmulti(slave_dev, 1);
+ res = dev_set_allmulti(link_dev, 1);
if (res) {
if (bond_dev->flags & IFF_PROMISC)
- dev_set_promiscuity(slave_dev, -1);
+ dev_set_promiscuity(link_dev, -1);
goto err_sysfs_del;
}
}
netif_addr_lock_bh(bond_dev);
- dev_mc_sync_multiple(slave_dev, bond_dev);
- dev_uc_sync_multiple(slave_dev, bond_dev);
+ dev_mc_sync_multiple(link_dev, bond_dev);
+ dev_uc_sync_multiple(link_dev, bond_dev);
netif_addr_unlock_bh(bond_dev);
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
/* add lacpdu mc addr to mc list */
u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
- dev_mc_add(slave_dev, lacpdu_multicast);
+ dev_mc_add(link_dev, lacpdu_multicast);
}
}
- bond->slave_cnt++;
+ bond->link_cnt++;
bond_compute_features(bond);
bond_set_carrier(bond);
if (bond_uses_primary(bond)) {
block_netpoll_tx();
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
}
if (bond_mode_can_use_xmit_hash(bond))
- bond_update_slave_arr(bond, NULL);
+ bond_update_link_arr(bond, NULL);
- slave_info(bond_dev, slave_dev, "Enslaving as %s interface with %s link\n",
- bond_is_active_slave(new_slave) ? "an active" : "a backup",
- new_slave->link_state != BOND_LINK_DOWN ? "an up" : "a down");
+ link_info(bond_dev, link_dev, "Connecting as %s interface with %s link\n",
+ bond_is_active_link(new_link) ? "an active" : "a backup",
+ new_link->link_state != BOND_LINK_DOWN ? "an up" : "a down");
- /* enslave is successful */
- bond_queue_slave_event(new_slave);
+ /* connect is successful */
+ bond_queue_link_event(new_link);
return 0;
/* Undo stages on error */
err_sysfs_del:
- bond_sysfs_slave_del(new_slave);
+ bond_sysfs_link_del(new_link);
err_upper_unlink:
- bond_upper_dev_unlink(bond, new_slave);
+ bond_upper_dev_unlink(bond, new_link);
err_unregister:
- netdev_rx_handler_unregister(slave_dev);
+ netdev_rx_handler_unregister(link_dev);
err_detach:
- vlan_vids_del_by_dev(slave_dev, bond_dev);
- if (rcu_access_pointer(bond->primary_slave) == new_slave)
- RCU_INIT_POINTER(bond->primary_slave, NULL);
- if (rcu_access_pointer(bond->curr_active_slave) == new_slave) {
+ vlan_vids_del_by_dev(link_dev, bond_dev);
+ if (rcu_access_pointer(bond->primary_link) == new_link)
+ RCU_INIT_POINTER(bond->primary_link, NULL);
+ if (rcu_access_pointer(bond->curr_active_link) == new_link) {
block_netpoll_tx();
- bond_change_active_slave(bond, NULL);
- bond_select_active_slave(bond);
+ bond_change_active_link(bond, NULL);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
}
- /* either primary_slave or curr_active_slave might've changed */
+ /* either primary_link or curr_active_link might've changed */
synchronize_rcu();
- slave_disable_netpoll(new_slave);
+ link_disable_netpoll(new_link);
err_close:
- if (!netif_is_bond_master(slave_dev))
- slave_dev->priv_flags &= ~IFF_BONDING;
- dev_close(slave_dev);
+ if (!netif_is_bond_master(link_dev))
+ link_dev->priv_flags &= ~IFF_BONDING;
+ dev_close(link_dev);
err_restore_mac:
- slave_dev->flags &= ~IFF_SLAVE;
+ link_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
- * MAC if this slave's MAC is in use by the bond, or at
+ * MAC if this link's MAC is in use by the bond, or at
* least print a warning.
*/
- bond_hw_addr_copy(ss.__data, new_slave->perm_hwaddr,
- new_slave->dev->addr_len);
- ss.ss_family = slave_dev->type;
- dev_set_mac_address(slave_dev, (struct sockaddr *)&ss, NULL);
+ bond_hw_addr_copy(ss.__data, new_link->perm_hwaddr,
+ new_link->dev->addr_len);
+ ss.ss_family = link_dev->type;
+ dev_set_mac_address(link_dev, (struct sockaddr *)&ss, NULL);
}
err_restore_mtu:
- dev_set_mtu(slave_dev, new_slave->original_mtu);
+ dev_set_mtu(link_dev, new_link->original_mtu);
err_free:
- bond_free_slave(new_slave);
+ bond_free_link(new_link);
err_undo_flags:
- /* Enslave of first slave has failed and we need to fix master's mac */
- if (!bond_has_slaves(bond)) {
+ /* Bringing up first link has failed and we need to fix master's mac */
+ if (!bond_has_links(bond)) {
if (ether_addr_equal_64bits(bond_dev->dev_addr,
- slave_dev->dev_addr))
+ link_dev->dev_addr))
eth_hw_addr_random(bond_dev);
if (bond_dev->type != ARPHRD_ETHER) {
dev_close(bond_dev);
@@ -2025,113 +2022,113 @@ 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>
- * It is legal to access curr_active_slave without a lock because all the function
+/* Try to release the link device <link> from the bond device <master>
+ * It is legal to access curr_active_link 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.
+ * while destroying a bond interface and all links are being released.
*
- * The rules for slave state should be:
+ * The rules for link state should be:
* for Active/Backup:
* Active stays on all backups go down
* for Bonded connections:
* The first up interface should be left on and all others downed.
*/
static int __bond_release_one(struct net_device *bond_dev,
- struct net_device *slave_dev,
+ struct net_device *link_dev,
bool all, bool unregister)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave, *oldcurrent;
+ struct link *link, *oldcurrent;
struct sockaddr_storage ss;
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 */
- if (!(slave_dev->flags & IFF_SLAVE) ||
- !netdev_has_upper_dev(slave_dev, bond_dev)) {
- slave_dbg(bond_dev, slave_dev, "cannot release slave\n");
+ /* link is not a link or master is not master of this link */
+ if (!(link_dev->flags & IFF_SLAVE) ||
+ !netdev_has_upper_dev(link_dev, bond_dev)) {
+ link_dbg(bond_dev, link_dev, "cannot release link\n");
return -EINVAL;
}
block_netpoll_tx();
- slave = bond_get_slave_by_dev(bond, slave_dev);
- if (!slave) {
- /* not a slave of this bond */
- slave_info(bond_dev, slave_dev, "interface not enslaved\n");
+ link = bond_get_link_by_dev(bond, link_dev);
+ if (!link) {
+ /* not a link of this bond */
+ link_info(bond_dev, link_dev, "interface not connected\n");
unblock_netpoll_tx();
return -EINVAL;
}
- bond_set_slave_inactive_flags(slave, BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_inactive_flags(link, BOND_LINK_NOTIFY_NOW);
- bond_sysfs_slave_del(slave);
+ bond_sysfs_link_del(link);
- /* recompute stats just before removing the slave */
+ /* recompute stats just before removing the link */
bond_get_stats(bond->dev, &bond->bond_stats);
- bond_upper_dev_unlink(bond, slave);
+ bond_upper_dev_unlink(bond, link);
/* unregister rx_handler early so bond_handle_frame wouldn't be called
- * for this slave anymore.
+ * for this link anymore.
*/
- netdev_rx_handler_unregister(slave_dev);
+ netdev_rx_handler_unregister(link_dev);
if (BOND_MODE(bond) == BOND_MODE_8023AD)
- bond_3ad_unbind_slave(slave);
+ bond_3ad_unbind_link(link);
if (bond_mode_can_use_xmit_hash(bond))
- bond_update_slave_arr(bond, slave);
+ bond_update_link_arr(bond, link);
- slave_info(bond_dev, slave_dev, "Releasing %s interface\n",
- bond_is_active_slave(slave) ? "active" : "backup");
+ link_info(bond_dev, link_dev, "Releasing %s interface\n",
+ bond_is_active_link(link) ? "active" : "backup");
- oldcurrent = rcu_access_pointer(bond->curr_active_slave);
+ oldcurrent = rcu_access_pointer(bond->curr_active_link);
- RCU_INIT_POINTER(bond->current_arp_slave, NULL);
+ RCU_INIT_POINTER(bond->current_arp_link, NULL);
if (!all && (!bond->params.fail_over_mac ||
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)) {
- if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
- bond_has_slaves(bond))
- slave_warn(bond_dev, slave_dev, "the permanent HWaddr of slave - %pM - is still in use by bond - set the HWaddr of slave to a different address to avoid conflicts\n",
- slave->perm_hwaddr);
+ if (ether_addr_equal_64bits(bond_dev->dev_addr, link->perm_hwaddr) &&
+ bond_has_links(bond))
+ link_warn(bond_dev, link_dev, "the permanent HWaddr of link - %pM - is still in use by bond - set the HWaddr of link to a different address to avoid conflicts\n",
+ link->perm_hwaddr);
}
- if (rtnl_dereference(bond->primary_slave) == slave)
- RCU_INIT_POINTER(bond->primary_slave, NULL);
+ if (rtnl_dereference(bond->primary_link) == link)
+ RCU_INIT_POINTER(bond->primary_link, NULL);
- if (oldcurrent == slave)
- bond_change_active_slave(bond, NULL);
+ if (oldcurrent == link)
+ bond_change_active_link(bond, NULL);
if (bond_is_lb(bond)) {
- /* Must be called only after the slave has been
- * detached from the list and the curr_active_slave
- * has been cleared (if our_slave == old_current),
- * but before a new active slave is selected.
+ /* Must be called only after the link has been
+ * detached from the list and the curr_active_link
+ * has been cleared (if our_link == old_current),
+ * but before a new active link is selected.
*/
- bond_alb_deinit_slave(bond, slave);
+ bond_alb_deinit_link(bond, link);
}
if (all) {
- RCU_INIT_POINTER(bond->curr_active_slave, NULL);
- } else if (oldcurrent == slave) {
+ RCU_INIT_POINTER(bond->curr_active_link, NULL);
+ } else if (oldcurrent == link) {
/* Note that we hold RTNL over this sequence, so there
- * is no concern that another slave add/remove event
+ * is no concern that another link add/remove event
* will interfere.
*/
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
}
- if (!bond_has_slaves(bond)) {
+ if (!bond_has_links(bond)) {
bond_set_carrier(bond);
eth_hw_addr_random(bond_dev);
}
unblock_netpoll_tx();
synchronize_rcu();
- bond->slave_cnt--;
+ bond->link_cnt--;
- if (!bond_has_slaves(bond)) {
+ if (!bond_has_links(bond)) {
call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
call_netdevice_notifiers(NETDEV_RELEASE, bond->dev);
}
@@ -2139,75 +2136,75 @@ static int __bond_release_one(struct net_device *bond_dev,
bond_compute_features(bond);
if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
(old_features & NETIF_F_VLAN_CHALLENGED))
- slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - VLAN blocking is removed\n");
+ link_info(bond_dev, link_dev, "last VLAN challenged link left bond - VLAN blocking is removed\n");
- vlan_vids_del_by_dev(slave_dev, bond_dev);
+ vlan_vids_del_by_dev(link_dev, bond_dev);
/* If the mode uses primary, then this case was handled above by
- * bond_change_active_slave(..., NULL)
+ * bond_change_active_link(..., NULL)
*/
if (!bond_uses_primary(bond)) {
- /* unset promiscuity level from slave
+ /* unset promiscuity level from link
* NOTE: The NETDEV_CHANGEADDR call above may change the value
* of the IFF_PROMISC flag in the bond_dev, but we need the
* value of that flag before that change, as that was the value
- * when this slave was attached, so we cache at the start of the
+ * when this link was attached, so we cache at the start of the
* function and use it here. Same goes for ALLMULTI below
*/
if (old_flags & IFF_PROMISC)
- dev_set_promiscuity(slave_dev, -1);
+ dev_set_promiscuity(link_dev, -1);
- /* unset allmulti level from slave */
+ /* unset allmulti level from link */
if (old_flags & IFF_ALLMULTI)
- dev_set_allmulti(slave_dev, -1);
+ dev_set_allmulti(link_dev, -1);
- bond_hw_addr_flush(bond_dev, slave_dev);
+ bond_hw_addr_flush(bond_dev, link_dev);
}
- slave_disable_netpoll(slave);
+ link_disable_netpoll(link);
- /* close slave before restoring its mac address */
- dev_close(slave_dev);
+ /* close link before restoring its mac address */
+ dev_close(link_dev);
if (bond->params.fail_over_mac != BOND_FOM_ACTIVE ||
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
/* restore original ("permanent") mac address */
- bond_hw_addr_copy(ss.__data, slave->perm_hwaddr,
- slave->dev->addr_len);
- ss.ss_family = slave_dev->type;
- dev_set_mac_address(slave_dev, (struct sockaddr *)&ss, NULL);
+ bond_hw_addr_copy(ss.__data, link->perm_hwaddr,
+ link->dev->addr_len);
+ ss.ss_family = link_dev->type;
+ dev_set_mac_address(link_dev, (struct sockaddr *)&ss, NULL);
}
if (unregister)
- __dev_set_mtu(slave_dev, slave->original_mtu);
+ __dev_set_mtu(link_dev, link->original_mtu);
else
- dev_set_mtu(slave_dev, slave->original_mtu);
+ dev_set_mtu(link_dev, link->original_mtu);
- if (!netif_is_bond_master(slave_dev))
- slave_dev->priv_flags &= ~IFF_BONDING;
+ if (!netif_is_bond_master(link_dev))
+ link_dev->priv_flags &= ~IFF_BONDING;
- bond_free_slave(slave);
+ bond_free_link(link);
return 0;
}
/* A wrapper used because of ndo_del_link */
-int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
+int bond_release(struct net_device *bond_dev, struct net_device *link_dev)
{
- return __bond_release_one(bond_dev, slave_dev, false, false);
+ return __bond_release_one(bond_dev, link_dev, false, false);
}
-/* First release a slave and then destroy the bond if no more slaves are left.
+/* First release a link and then destroy the bond if no more links are left.
* Must be under rtnl_lock when this function is called.
*/
static int bond_release_and_destroy(struct net_device *bond_dev,
- struct net_device *slave_dev)
+ struct net_device *link_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
int ret;
- ret = __bond_release_one(bond_dev, slave_dev, false, true);
- if (ret == 0 && !bond_has_slaves(bond) &&
+ ret = __bond_release_one(bond_dev, link_dev, false, true);
+ if (ret == 0 && !bond_has_links(bond) &&
bond_dev->reg_state != NETREG_UNREGISTERING) {
bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
netdev_info(bond_dev, "Destroying bond\n");
@@ -2223,17 +2220,17 @@ static void bond_info_query(struct net_device *bond_dev, struct ifbond *info)
bond_fill_ifbond(bond, info);
}
-static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info)
+static int bond_link_info_query(struct net_device *bond_dev, struct ifslave *info)
{
struct bonding *bond = netdev_priv(bond_dev);
struct list_head *iter;
int i = 0, res = -ENODEV;
- struct slave *slave;
+ struct link *link;
- bond_for_each_slave(bond, slave, iter) {
+ bond_for_each_link(bond, link, iter) {
if (i++ == (int)info->slave_id) {
res = 0;
- bond_fill_ifslave(slave, info);
+ bond_fill_ifslave(link, info);
break;
}
}
@@ -2248,90 +2245,90 @@ static int bond_miimon_inspect(struct bonding *bond)
{
int link_state, commit = 0;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
bool ignore_updelay;
- ignore_updelay = !rcu_dereference(bond->curr_active_slave);
+ ignore_updelay = !rcu_dereference(bond->curr_active_link);
- bond_for_each_slave_rcu(bond, slave, iter) {
- bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
+ bond_for_each_link_rcu(bond, link, iter) {
+ bond_propose_link_state(link, BOND_LINK_NOCHANGE);
- link_state = bond_check_dev_link(bond, slave->dev, 0);
+ link_state = bond_check_dev_link(bond, link->dev, 0);
- switch (slave->link_state) {
+ switch (link->link_state) {
case BOND_LINK_UP:
if (link_state)
continue;
- bond_propose_link_state(slave, BOND_LINK_FAIL);
+ bond_propose_link_state(link, BOND_LINK_FAIL);
commit++;
- slave->delay = bond->params.downdelay;
- if (slave->delay) {
- slave_info(bond->dev, slave->dev, "link status down for %sinterface, disabling it in %d ms\n",
- (BOND_MODE(bond) ==
- BOND_MODE_ACTIVEBACKUP) ?
- (bond_is_active_slave(slave) ?
- "active " : "backup ") : "",
- bond->params.downdelay * bond->params.miimon);
+ link->delay = bond->params.downdelay;
+ if (link->delay) {
+ link_info(bond->dev, link->dev, "link status down for %sinterface, disabling it in %d ms\n",
+ (BOND_MODE(bond) ==
+ BOND_MODE_ACTIVEBACKUP) ?
+ (bond_is_active_link(link) ?
+ "active " : "backup ") : "",
+ bond->params.downdelay * bond->params.miimon);
}
fallthrough;
case BOND_LINK_FAIL:
if (link_state) {
/* recovered before downdelay expired */
- bond_propose_link_state(slave, BOND_LINK_UP);
- slave->last_link_up = jiffies;
- slave_info(bond->dev, slave->dev, "link status up again after %d ms\n",
- (bond->params.downdelay - slave->delay) *
- bond->params.miimon);
+ bond_propose_link_state(link, BOND_LINK_UP);
+ link->last_link_up = jiffies;
+ link_info(bond->dev, link->dev, "link status up again after %d ms\n",
+ (bond->params.downdelay - link->delay) *
+ bond->params.miimon);
commit++;
continue;
}
- if (slave->delay <= 0) {
- bond_propose_link_state(slave, BOND_LINK_DOWN);
+ if (link->delay <= 0) {
+ bond_propose_link_state(link, BOND_LINK_DOWN);
commit++;
continue;
}
- slave->delay--;
+ link->delay--;
break;
case BOND_LINK_DOWN:
if (!link_state)
continue;
- bond_propose_link_state(slave, BOND_LINK_BACK);
+ bond_propose_link_state(link, BOND_LINK_BACK);
commit++;
- slave->delay = bond->params.updelay;
+ link->delay = bond->params.updelay;
- if (slave->delay) {
- slave_info(bond->dev, slave->dev, "link status up, enabling it in %d ms\n",
- ignore_updelay ? 0 :
- bond->params.updelay *
- bond->params.miimon);
+ if (link->delay) {
+ link_info(bond->dev, link->dev, "link status up, enabling it in %d ms\n",
+ ignore_updelay ? 0 :
+ bond->params.updelay *
+ bond->params.miimon);
}
fallthrough;
case BOND_LINK_BACK:
if (!link_state) {
- bond_propose_link_state(slave, BOND_LINK_DOWN);
- slave_info(bond->dev, slave->dev, "link status down again after %d ms\n",
- (bond->params.updelay - slave->delay) *
- bond->params.miimon);
+ bond_propose_link_state(link, BOND_LINK_DOWN);
+ link_info(bond->dev, link->dev, "link status down again after %d ms\n",
+ (bond->params.updelay - link->delay) *
+ bond->params.miimon);
commit++;
continue;
}
if (ignore_updelay)
- slave->delay = 0;
+ link->delay = 0;
- if (slave->delay <= 0) {
- bond_propose_link_state(slave, BOND_LINK_UP);
+ if (link->delay <= 0) {
+ bond_propose_link_state(link, BOND_LINK_UP);
commit++;
ignore_updelay = false;
continue;
}
- slave->delay--;
+ link->delay--;
break;
}
}
@@ -2340,19 +2337,19 @@ static int bond_miimon_inspect(struct bonding *bond)
}
static void bond_miimon_link_change(struct bonding *bond,
- struct slave *slave,
+ struct link *link,
char link_state)
{
switch (BOND_MODE(bond)) {
case BOND_MODE_8023AD:
- bond_3ad_handle_link_change(slave, link_state);
+ bond_3ad_handle_link_change(link, link_state);
break;
case BOND_MODE_TLB:
case BOND_MODE_ALB:
- bond_alb_handle_link_change(bond, slave, link_state);
+ bond_alb_handle_link_change(bond, link, link_state);
break;
case BOND_MODE_XOR:
- bond_update_slave_arr(bond, NULL);
+ bond_update_link_arr(bond, NULL);
break;
}
}
@@ -2360,87 +2357,87 @@ static void bond_miimon_link_change(struct bonding *bond,
static void bond_miimon_commit(struct bonding *bond)
{
struct list_head *iter;
- struct slave *slave, *primary;
+ struct link *link, *primary;
- bond_for_each_slave(bond, slave, iter) {
- switch (slave->link_new_state) {
+ bond_for_each_link(bond, link, iter) {
+ switch (link->link_new_state) {
case BOND_LINK_NOCHANGE:
- /* For 802.3ad mode, check current slave speed and
+ /* For 802.3ad mode, check current link speed and
* duplex again in case its port was disabled after
* invalid speed/duplex reporting but recovered before
* link monitoring could make a decision on the actual
* link status
*/
if (BOND_MODE(bond) == BOND_MODE_8023AD &&
- slave->link_state == BOND_LINK_UP)
- bond_3ad_adapter_speed_duplex_changed(slave);
+ link->link_state == BOND_LINK_UP)
+ bond_3ad_adapter_speed_duplex_changed(link);
continue;
case BOND_LINK_UP:
- if (bond_update_speed_duplex(slave) &&
+ if (bond_update_speed_duplex(link) &&
bond_needs_speed_duplex(bond)) {
- slave->link_state = BOND_LINK_DOWN;
+ link->link_state = BOND_LINK_DOWN;
if (net_ratelimit())
- slave_warn(bond->dev, slave->dev,
- "failed to get link speed/duplex\n");
+ link_warn(bond->dev, link->dev,
+ "failed to get link speed/duplex\n");
continue;
}
- bond_set_slave_link_state(slave, BOND_LINK_UP,
- BOND_SLAVE_NOTIFY_NOW);
- slave->last_link_up = jiffies;
+ bond_set_link_state(link, BOND_LINK_UP,
+ BOND_LINK_NOTIFY_NOW);
+ link->last_link_up = jiffies;
- primary = rtnl_dereference(bond->primary_slave);
+ primary = rtnl_dereference(bond->primary_link);
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
/* prevent it from being the active one */
- bond_set_backup_slave(slave);
+ bond_set_backup_link(link);
} else if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
/* make it immediately active */
- bond_set_active_slave(slave);
+ bond_set_active_link(link);
}
- slave_info(bond->dev, slave->dev, "link status definitely up, %u Mbps %s duplex\n",
- slave->speed == SPEED_UNKNOWN ? 0 : slave->speed,
- slave->duplex ? "full" : "half");
+ link_info(bond->dev, link->dev, "link status definitely up, %u Mbps %s duplex\n",
+ link->speed == SPEED_UNKNOWN ? 0 : link->speed,
+ link->duplex ? "full" : "half");
- bond_miimon_link_change(bond, slave, BOND_LINK_UP);
+ bond_miimon_link_change(bond, link, BOND_LINK_UP);
- if (!bond->curr_active_slave || slave == primary)
+ if (!bond->curr_active_link || link == primary)
goto do_failover;
continue;
case BOND_LINK_DOWN:
- if (slave->link_failure_count < UINT_MAX)
- slave->link_failure_count++;
+ if (link->link_failure_count < UINT_MAX)
+ link->link_failure_count++;
- bond_set_slave_link_state(slave, BOND_LINK_DOWN,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(link, BOND_LINK_DOWN,
+ BOND_LINK_NOTIFY_NOW);
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
BOND_MODE(bond) == BOND_MODE_8023AD)
- bond_set_slave_inactive_flags(slave,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_inactive_flags(link,
+ BOND_LINK_NOTIFY_NOW);
- slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n");
+ link_info(bond->dev, link->dev, "link status definitely down, disabling link\n");
- bond_miimon_link_change(bond, slave, BOND_LINK_DOWN);
+ bond_miimon_link_change(bond, link, BOND_LINK_DOWN);
- if (slave == rcu_access_pointer(bond->curr_active_slave))
+ if (link == rcu_access_pointer(bond->curr_active_link))
goto do_failover;
continue;
default:
- slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n",
- slave->link_new_state);
- bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
+ link_err(bond->dev, link->dev, "invalid new link %d on link\n",
+ link->link_new_state);
+ bond_propose_link_state(link, BOND_LINK_NOCHANGE);
continue;
}
do_failover:
block_netpoll_tx();
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
}
@@ -2461,12 +2458,12 @@ static void bond_mii_monitor(struct work_struct *work)
bool should_notify_peers = false;
bool commit;
unsigned long delay;
- struct slave *slave;
+ struct link *link;
struct list_head *iter;
delay = msecs_to_jiffies(bond->params.miimon);
- if (!bond_has_slaves(bond))
+ if (!bond_has_links(bond))
goto re_arm;
rcu_read_lock();
@@ -2490,8 +2487,8 @@ static void bond_mii_monitor(struct work_struct *work)
goto re_arm;
}
- bond_for_each_slave(bond, slave, iter) {
- bond_commit_link_state(slave, BOND_SLAVE_NOTIFY_LATER);
+ bond_for_each_link(bond, link, iter) {
+ bond_commit_link_state(link, BOND_LINK_NOTIFY_LATER);
}
bond_miimon_commit(bond);
@@ -2536,19 +2533,19 @@ static bool bond_has_this_ip(struct bonding *bond, __be32 ip)
* switches in VLAN mode (especially if ports are configured as
* "native" to a VLAN) might not pass non-tagged frames.
*/
-static void bond_arp_send(struct slave *slave, int arp_op, __be32 dest_ip,
+static void bond_arp_send(struct link *link, int arp_op, __be32 dest_ip,
__be32 src_ip, struct bond_vlan_tag *tags)
{
struct sk_buff *skb;
struct bond_vlan_tag *outer_tag = tags;
- struct net_device *slave_dev = slave->dev;
- struct net_device *bond_dev = slave->bond->dev;
+ struct net_device *link_dev = link->dev;
+ struct net_device *bond_dev = link->bond->dev;
- slave_dbg(bond_dev, slave_dev, "arp %d on slave: dst %pI4 src %pI4\n",
- arp_op, &dest_ip, &src_ip);
+ link_dbg(bond_dev, link_dev, "arp %d on link: dst %pI4 src %pI4\n",
+ arp_op, &dest_ip, &src_ip);
- skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip,
- NULL, slave_dev->dev_addr, NULL);
+ skb = arp_create(arp_op, ETH_P_ARP, dest_ip, link_dev, src_ip,
+ NULL, link_dev->dev_addr, NULL);
if (!skb) {
net_err_ratelimited("ARP packet allocation failed\n");
@@ -2567,8 +2564,8 @@ static void bond_arp_send(struct slave *slave, int arp_op, __be32 dest_ip,
continue;
}
- slave_dbg(bond_dev, slave_dev, "inner tag: proto %X vid %X\n",
- ntohs(outer_tag->vlan_proto), tags->vlan_id);
+ link_dbg(bond_dev, link_dev, "inner tag: proto %X vid %X\n",
+ ntohs(outer_tag->vlan_proto), tags->vlan_id);
skb = vlan_insert_tag_set_proto(skb, tags->vlan_proto,
tags->vlan_id);
if (!skb) {
@@ -2580,8 +2577,8 @@ static void bond_arp_send(struct slave *slave, int arp_op, __be32 dest_ip,
}
/* Set the outer tag */
if (outer_tag->vlan_id) {
- slave_dbg(bond_dev, slave_dev, "outer tag: proto %X vid %X\n",
- ntohs(outer_tag->vlan_proto), outer_tag->vlan_id);
+ link_dbg(bond_dev, link_dev, "outer tag: proto %X vid %X\n",
+ ntohs(outer_tag->vlan_proto), outer_tag->vlan_id);
__vlan_hwaccel_put_tag(skb, outer_tag->vlan_proto,
outer_tag->vlan_id);
}
@@ -2630,7 +2627,7 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
return NULL;
}
-static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
+static void bond_arp_send_all(struct bonding *bond, struct link *link)
{
struct rtable *rt;
struct bond_vlan_tag *tags;
@@ -2638,8 +2635,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
int i;
for (i = 0; i < BOND_MAX_ARP_TARGETS && targets[i]; i++) {
- slave_dbg(bond->dev, slave->dev, "%s: target %pI4\n",
- __func__, &targets[i]);
+ link_dbg(bond->dev, link->dev, "%s: target %pI4\n",
+ __func__, &targets[i]);
tags = NULL;
/* Find out through which dev should the packet go */
@@ -2653,7 +2650,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
net_warn_ratelimited("%s: no route to arp_ip_target %pI4 and arp_validate is set\n",
bond->dev->name,
&targets[i]);
- bond_arp_send(slave, ARPOP_REQUEST, targets[i],
+ bond_arp_send(link, ARPOP_REQUEST, targets[i],
0, tags);
continue;
}
@@ -2670,8 +2667,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
goto found;
/* Not our device - skip */
- slave_dbg(bond->dev, slave->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n",
- &targets[i], rt->dst.dev ? rt->dst.dev->name : "NULL");
+ link_dbg(bond->dev, link->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n",
+ &targets[i], rt->dst.dev ? rt->dst.dev->name : "NULL");
ip_rt_put(rt);
continue;
@@ -2679,45 +2676,45 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
found:
addr = bond_confirm_addr(rt->dst.dev, targets[i], 0);
ip_rt_put(rt);
- bond_arp_send(slave, ARPOP_REQUEST, targets[i], addr, tags);
+ bond_arp_send(link, ARPOP_REQUEST, targets[i], addr, tags);
kfree(tags);
}
}
-static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip)
+static void bond_validate_arp(struct bonding *bond, struct link *link, __be32 sip, __be32 tip)
{
int i;
if (!sip || !bond_has_this_ip(bond, tip)) {
- slave_dbg(bond->dev, slave->dev, "%s: sip %pI4 tip %pI4 not found\n",
- __func__, &sip, &tip);
+ link_dbg(bond->dev, link->dev, "%s: sip %pI4 tip %pI4 not found\n",
+ __func__, &sip, &tip);
return;
}
i = bond_get_targets_ip(bond->params.arp_targets, sip);
if (i == -1) {
- slave_dbg(bond->dev, slave->dev, "%s: sip %pI4 not found in targets\n",
- __func__, &sip);
+ link_dbg(bond->dev, link->dev, "%s: sip %pI4 not found in targets\n",
+ __func__, &sip);
return;
}
- slave->last_rx = jiffies;
- slave->target_last_arp_rx[i] = jiffies;
+ link->last_rx = jiffies;
+ link->target_last_arp_rx[i] = jiffies;
}
int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
- struct slave *slave)
+ struct link *link)
{
struct arphdr *arp = (struct arphdr *)skb->data;
- struct slave *curr_active_slave, *curr_arp_slave;
+ struct link *curr_active_link, *curr_arp_link;
unsigned char *arp_ptr;
__be32 sip, tip;
int is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP);
unsigned int alen;
- if (!slave_do_arp_validate(bond, slave)) {
- if ((slave_do_arp_validate_only(bond) && is_arp) ||
- !slave_do_arp_validate_only(bond))
- slave->last_rx = jiffies;
+ if (!link_do_arp_validate(bond, link)) {
+ if ((link_do_arp_validate_only(bond) && is_arp) ||
+ !link_do_arp_validate_only(bond))
+ link->last_rx = jiffies;
return RX_HANDLER_ANOTHER;
} else if (!is_arp) {
return RX_HANDLER_ANOTHER;
@@ -2725,8 +2722,8 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
alen = arp_hdr_len(bond->dev);
- slave_dbg(bond->dev, slave->dev, "%s: skb->dev %s\n",
- __func__, skb->dev->name);
+ link_dbg(bond->dev, link->dev, "%s: skb->dev %s\n",
+ __func__, skb->dev->name);
if (alen > skb_headlen(skb)) {
arp = kmalloc(alen, GFP_ATOMIC);
@@ -2750,47 +2747,47 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
arp_ptr += 4 + bond->dev->addr_len;
memcpy(&tip, arp_ptr, 4);
- slave_dbg(bond->dev, slave->dev, "%s: %s/%d av %d sv %d sip %pI4 tip %pI4\n",
- __func__, slave->dev->name, bond_slave_state(slave),
- bond->params.arp_validate, slave_do_arp_validate(bond, slave),
- &sip, &tip);
+ link_dbg(bond->dev, link->dev, "%s: %s/%d av %d sv %d sip %pI4 tip %pI4\n",
+ __func__, link->dev->name, bond_link_state(link),
+ bond->params.arp_validate, link_do_arp_validate(bond, link),
+ &sip, &tip);
- curr_active_slave = rcu_dereference(bond->curr_active_slave);
- curr_arp_slave = rcu_dereference(bond->current_arp_slave);
+ curr_active_link = rcu_dereference(bond->curr_active_link);
+ curr_arp_link = rcu_dereference(bond->current_arp_link);
/* We 'trust' the received ARP enough to validate it if:
*
- * (a) the slave receiving the ARP is active (which includes the
- * current ARP slave, if any), or
+ * (a) the link receiving the ARP is active (which includes the
+ * current ARP link, if any), or
*
- * (b) the receiving slave isn't active, but there is a currently
- * active slave and it received valid arp reply(s) after it became
- * the currently active slave, or
+ * (b) the receiving link isn't active, but there is a currently
+ * active link and it received valid arp reply(s) after it became
+ * the currently active link, or
*
- * (c) there is an ARP slave that sent an ARP during the prior ARP
- * interval, and we receive an ARP reply on any slave. We accept
+ * (c) there is an ARP link that sent an ARP during the prior ARP
+ * interval, and we receive an ARP reply on any link. We accept
* these because switch FDB update delays may deliver the ARP
- * reply to a slave other than the sender of the ARP request.
+ * reply to a link other than the sender of the ARP request.
*
- * Note: for (b), backup slaves are receiving the broadcast ARP
+ * Note: for (b), backup links are receiving the broadcast ARP
* request, not a reply. This request passes from the sending
- * slave through the L2 switch(es) to the receiving slave. Since
+ * link through the L2 switch(es) to the receiving link. Since
* this is checking the request, sip/tip are swapped for
* validation.
*
* This is done to avoid endless looping when we can't reach the
* arp_ip_target and fool ourselves with our own arp requests.
*/
- if (bond_is_active_slave(slave))
- bond_validate_arp(bond, slave, sip, tip);
- else if (curr_active_slave &&
- time_after(slave_last_rx(bond, curr_active_slave),
- curr_active_slave->last_link_up))
- bond_validate_arp(bond, slave, tip, sip);
- else if (curr_arp_slave && (arp->ar_op == htons(ARPOP_REPLY)) &&
+ if (bond_is_active_link(link))
+ bond_validate_arp(bond, link, sip, tip);
+ else if (curr_active_link &&
+ time_after(link_last_rx(bond, curr_active_link),
+ curr_active_link->last_link_up))
+ bond_validate_arp(bond, link, tip, sip);
+ else if (curr_arp_link && (arp->ar_op == htons(ARPOP_REPLY)) &&
bond_time_in_interval(bond,
- dev_trans_start(curr_arp_slave->dev), 1))
- bond_validate_arp(bond, slave, sip, tip);
+ dev_trans_start(curr_arp_link->dev), 1))
+ bond_validate_arp(bond, link, sip, tip);
out_unlock:
if (arp != (struct arphdr *)skb->data)
@@ -2812,7 +2809,7 @@ static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,
last_act + mod * delta_in_ticks + delta_in_ticks/2);
}
-/* This function is called regularly to monitor each slave's link
+/* This function is called regularly to monitor each link's link
* ensuring that traffic is being sent and received when arp monitoring
* is used in load-balancing mode. if the adapter has been dormant, then an
* arp is transmitted to generate traffic. see activebackup_arp_monitor for
@@ -2820,67 +2817,67 @@ static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,
*/
static void bond_loadbalance_arp_mon(struct bonding *bond)
{
- struct slave *slave, *oldcurrent;
+ struct link *link, *oldcurrent;
struct list_head *iter;
- int do_failover = 0, slave_state_changed = 0;
+ int do_failover = 0, link_state_changed = 0;
- if (!bond_has_slaves(bond))
+ if (!bond_has_links(bond))
goto re_arm;
rcu_read_lock();
- oldcurrent = rcu_dereference(bond->curr_active_slave);
+ oldcurrent = rcu_dereference(bond->curr_active_link);
/* see if any of the previous devices are up now (i.e. they have
- * xmt and rcv traffic). the curr_active_slave does not come into
- * the picture unless it is null. also, slave->last_link_up is not
- * needed here because we send an arp on each slave and give a slave
+ * xmt and rcv traffic). the curr_active_link does not come into
+ * the picture unless it is null. also, link->last_link_up is not
+ * needed here because we send an arp on each link and give a link
* as long as it needs to get the tx/rx within the delta.
* TODO: what about up/down delay in arp mode? it wasn't here before
* so it can wait
*/
- bond_for_each_slave_rcu(bond, slave, iter) {
- unsigned long trans_start = dev_trans_start(slave->dev);
+ bond_for_each_link_rcu(bond, link, iter) {
+ unsigned long trans_start = dev_trans_start(link->dev);
- bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
+ bond_propose_link_state(link, BOND_LINK_NOCHANGE);
- if (slave->link_state != BOND_LINK_UP) {
+ if (link->link_state != BOND_LINK_UP) {
if (bond_time_in_interval(bond, trans_start, 1) &&
- bond_time_in_interval(bond, slave->last_rx, 1)) {
+ bond_time_in_interval(bond, link->last_rx, 1)) {
- bond_propose_link_state(slave, BOND_LINK_UP);
- slave_state_changed = 1;
+ bond_propose_link_state(link, BOND_LINK_UP);
+ link_state_changed = 1;
- /* primary_slave has no meaning in round-robin
- * mode. the window of a slave being up and
- * curr_active_slave being null after enslaving
+ /* primary_link has no meaning in round-robin
+ * mode. the window of a link being up and
+ * curr_active_link being null after enslaving
* is closed.
*/
if (!oldcurrent) {
- slave_info(bond->dev, slave->dev, "link status definitely up\n");
+ link_info(bond->dev, link->dev, "link status definitely up\n");
do_failover = 1;
} else {
- slave_info(bond->dev, slave->dev, "interface is now up\n");
+ link_info(bond->dev, link->dev, "interface is now up\n");
}
}
} else {
- /* slave->link_state == BOND_LINK_UP */
+ /* link->link_state == BOND_LINK_UP */
/* not all switches will respond to an arp request
* when the source ip is 0, so don't take the link down
* if we don't know our ip yet
*/
if (!bond_time_in_interval(bond, trans_start, 2) ||
- !bond_time_in_interval(bond, slave->last_rx, 2)) {
+ !bond_time_in_interval(bond, link->last_rx, 2)) {
- bond_propose_link_state(slave, BOND_LINK_DOWN);
- slave_state_changed = 1;
+ bond_propose_link_state(link, BOND_LINK_DOWN);
+ link_state_changed = 1;
- if (slave->link_failure_count < UINT_MAX)
- slave->link_failure_count++;
+ if (link->link_failure_count < UINT_MAX)
+ link->link_failure_count++;
- slave_info(bond->dev, slave->dev, "interface is now down\n");
+ link_info(bond->dev, link->dev, "interface is now down\n");
- if (slave == oldcurrent)
+ if (link == oldcurrent)
do_failover = 1;
}
}
@@ -2889,32 +2886,32 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
* must tx arp to ensure all links rx an arp - otherwise
* links may oscillate or not come up at all; if switch is
* in something like xor mode, there is nothing we can
- * do - all replies will be rx'ed on same link causing slaves
+ * do - all replies will be rx'ed on same link causing links
* to be unstable during low/no traffic periods
*/
- if (bond_slave_is_up(slave))
- bond_arp_send_all(bond, slave);
+ if (bond_link_is_up(link))
+ bond_arp_send_all(bond, link);
}
rcu_read_unlock();
- if (do_failover || slave_state_changed) {
+ if (do_failover || link_state_changed) {
if (!rtnl_trylock())
goto re_arm;
- bond_for_each_slave(bond, slave, iter) {
- if (slave->link_new_state != BOND_LINK_NOCHANGE)
- slave->link_state = slave->link_new_state;
+ bond_for_each_link(bond, link, iter) {
+ if (link->link_new_state != BOND_LINK_NOCHANGE)
+ link->link_state = link->link_new_state;
}
- if (slave_state_changed) {
- bond_slave_state_change(bond);
+ if (link_state_changed) {
+ bond_link_state_change(bond);
if (BOND_MODE(bond) == BOND_MODE_XOR)
- bond_update_slave_arr(bond, NULL);
+ bond_update_link_arr(bond, NULL);
}
if (do_failover) {
block_netpoll_tx();
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
}
rtnl_unlock();
@@ -2926,9 +2923,9 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
msecs_to_jiffies(bond->params.arp_interval));
}
-/* Called to inspect slaves for active-backup mode ARP monitor link state
- * changes. Sets proposed link state in slaves to specify what action
- * should take place for the slave. Returns 0 if no changes are found, >0
+/* Called to inspect links for active-backup mode ARP monitor link state
+ * changes. Sets proposed link state in links to specify what action
+ * should take place for the link. Returns 0 if no changes are found, >0
* if changes to link states must be committed.
*
* Called with rcu_read_lock held.
@@ -2937,60 +2934,60 @@ static int bond_ab_arp_inspect(struct bonding *bond)
{
unsigned long trans_start, last_rx;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
int commit = 0;
- bond_for_each_slave_rcu(bond, slave, iter) {
- bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
- last_rx = slave_last_rx(bond, slave);
+ bond_for_each_link_rcu(bond, link, iter) {
+ bond_propose_link_state(link, BOND_LINK_NOCHANGE);
+ last_rx = link_last_rx(bond, link);
- if (slave->link_state != BOND_LINK_UP) {
+ if (link->link_state != BOND_LINK_UP) {
if (bond_time_in_interval(bond, last_rx, 1)) {
- bond_propose_link_state(slave, BOND_LINK_UP);
+ bond_propose_link_state(link, BOND_LINK_UP);
commit++;
- } else if (slave->link_state == BOND_LINK_BACK) {
- bond_propose_link_state(slave, BOND_LINK_FAIL);
+ } else if (link->link_state == BOND_LINK_BACK) {
+ bond_propose_link_state(link, BOND_LINK_FAIL);
commit++;
}
continue;
}
- /* Give slaves 2*delta after being enslaved or made
+ /* Give links 2*delta after being connected or made
* active. This avoids bouncing, as the last receive
* times need a full ARP monitor cycle to be updated.
*/
- if (bond_time_in_interval(bond, slave->last_link_up, 2))
+ if (bond_time_in_interval(bond, link->last_link_up, 2))
continue;
- /* Backup slave is down if:
- * - No current_arp_slave AND
+ /* Backup link is down if:
+ * - No current_arp_link AND
* - more than 3*delta since last receive AND
* - the bond has an IP address
*
- * Note: a non-null current_arp_slave indicates
- * the curr_active_slave went down and we are
+ * Note: a non-null current_arp_link indicates
+ * the curr_active_link went down and we are
* searching for a new one; under this condition
- * we only take the curr_active_slave down - this
- * gives each slave a chance to tx/rx traffic
+ * we only take the curr_active_link down - this
+ * gives each link a chance to tx/rx traffic
* before being taken out
*/
- if (!bond_is_active_slave(slave) &&
- !rcu_access_pointer(bond->current_arp_slave) &&
+ if (!bond_is_active_link(link) &&
+ !rcu_access_pointer(bond->current_arp_link) &&
!bond_time_in_interval(bond, last_rx, 3)) {
- bond_propose_link_state(slave, BOND_LINK_DOWN);
+ bond_propose_link_state(link, BOND_LINK_DOWN);
commit++;
}
- /* Active slave is down if:
+ /* Active link is down if:
* - more than 2*delta since transmitting OR
* - (more than 2*delta since receive AND
* the bond has an IP address)
*/
- trans_start = dev_trans_start(slave->dev);
- if (bond_is_active_slave(slave) &&
+ trans_start = dev_trans_start(link->dev);
+ if (bond_is_active_link(link) &&
(!bond_time_in_interval(bond, trans_start, 2) ||
!bond_time_in_interval(bond, last_rx, 2))) {
- bond_propose_link_state(slave, BOND_LINK_DOWN);
+ bond_propose_link_state(link, BOND_LINK_DOWN);
commit++;
}
}
@@ -3007,34 +3004,34 @@ static void bond_ab_arp_commit(struct bonding *bond)
{
unsigned long trans_start;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
- bond_for_each_slave(bond, slave, iter) {
- switch (slave->link_new_state) {
+ bond_for_each_link(bond, link, iter) {
+ switch (link->link_new_state) {
case BOND_LINK_NOCHANGE:
continue;
case BOND_LINK_UP:
- trans_start = dev_trans_start(slave->dev);
- if (rtnl_dereference(bond->curr_active_slave) != slave ||
- (!rtnl_dereference(bond->curr_active_slave) &&
+ trans_start = dev_trans_start(link->dev);
+ if (rtnl_dereference(bond->curr_active_link) != link ||
+ (!rtnl_dereference(bond->curr_active_link) &&
bond_time_in_interval(bond, trans_start, 1))) {
- struct slave *current_arp_slave;
-
- current_arp_slave = rtnl_dereference(bond->current_arp_slave);
- bond_set_slave_link_state(slave, BOND_LINK_UP,
- BOND_SLAVE_NOTIFY_NOW);
- if (current_arp_slave) {
- bond_set_slave_inactive_flags(
- current_arp_slave,
- BOND_SLAVE_NOTIFY_NOW);
- RCU_INIT_POINTER(bond->current_arp_slave, NULL);
+ struct link *current_arp_link;
+
+ current_arp_link = rtnl_dereference(bond->current_arp_link);
+ bond_set_link_state(link, BOND_LINK_UP,
+ BOND_LINK_NOTIFY_NOW);
+ if (current_arp_link) {
+ bond_set_link_inactive_flags(
+ current_arp_link,
+ BOND_LINK_NOTIFY_NOW);
+ RCU_INIT_POINTER(bond->current_arp_link, NULL);
}
- slave_info(bond->dev, slave->dev, "link status definitely up\n");
+ link_info(bond->dev, link->dev, "link status definitely up\n");
- if (!rtnl_dereference(bond->curr_active_slave) ||
- slave == rtnl_dereference(bond->primary_slave))
+ if (!rtnl_dereference(bond->curr_active_link) ||
+ link == rtnl_dereference(bond->primary_link))
goto do_failover;
}
@@ -3042,46 +3039,46 @@ static void bond_ab_arp_commit(struct bonding *bond)
continue;
case BOND_LINK_DOWN:
- if (slave->link_failure_count < UINT_MAX)
- slave->link_failure_count++;
+ if (link->link_failure_count < UINT_MAX)
+ link->link_failure_count++;
- bond_set_slave_link_state(slave, BOND_LINK_DOWN,
- BOND_SLAVE_NOTIFY_NOW);
- bond_set_slave_inactive_flags(slave,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(link, BOND_LINK_DOWN,
+ BOND_LINK_NOTIFY_NOW);
+ bond_set_link_inactive_flags(link,
+ BOND_LINK_NOTIFY_NOW);
- slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n");
+ link_info(bond->dev, link->dev, "link status definitely down, disabling link\n");
- if (slave == rtnl_dereference(bond->curr_active_slave)) {
- RCU_INIT_POINTER(bond->current_arp_slave, NULL);
+ if (link == rtnl_dereference(bond->curr_active_link)) {
+ RCU_INIT_POINTER(bond->current_arp_link, NULL);
goto do_failover;
}
continue;
case BOND_LINK_FAIL:
- bond_set_slave_link_state(slave, BOND_LINK_FAIL,
- BOND_SLAVE_NOTIFY_NOW);
- bond_set_slave_inactive_flags(slave,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_state(link, BOND_LINK_FAIL,
+ BOND_LINK_NOTIFY_NOW);
+ bond_set_link_inactive_flags(link,
+ BOND_LINK_NOTIFY_NOW);
- /* A slave has just been enslaved and has become
- * the current active slave.
+ /* A link has just been connected and has become
+ * the current active link.
*/
- if (rtnl_dereference(bond->curr_active_slave))
- RCU_INIT_POINTER(bond->current_arp_slave, NULL);
+ if (rtnl_dereference(bond->curr_active_link))
+ RCU_INIT_POINTER(bond->current_arp_link, NULL);
continue;
default:
- slave_err(bond->dev, slave->dev,
- "impossible: link_new_state %d on slave\n",
- slave->link_new_state);
+ link_err(bond->dev, link->dev,
+ "impossible: link_new_state %d on link\n",
+ link->link_new_state);
continue;
}
do_failover:
block_netpoll_tx();
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
}
@@ -3094,80 +3091,79 @@ static void bond_ab_arp_commit(struct bonding *bond)
*/
static bool bond_ab_arp_probe(struct bonding *bond)
{
- struct slave *slave, *before = NULL, *new_slave = NULL,
- *curr_arp_slave = rcu_dereference(bond->current_arp_slave),
- *curr_active_slave = rcu_dereference(bond->curr_active_slave);
+ struct link *link, *before = NULL, *new_link = NULL,
+ *curr_arp_link = rcu_dereference(bond->current_arp_link),
+ *curr_active_link = rcu_dereference(bond->curr_active_link);
struct list_head *iter;
bool found = false;
- bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;
+ bool should_notify_rtnl = BOND_LINK_NOTIFY_LATER;
- if (curr_arp_slave && curr_active_slave)
+ if (curr_arp_link && curr_active_link)
netdev_info(bond->dev, "PROBE: c_arp %s && cas %s BAD\n",
- curr_arp_slave->dev->name,
- curr_active_slave->dev->name);
+ curr_arp_link->dev->name,
+ curr_active_link->dev->name);
- if (curr_active_slave) {
- bond_arp_send_all(bond, curr_active_slave);
+ if (curr_active_link) {
+ bond_arp_send_all(bond, curr_active_link);
return should_notify_rtnl;
}
- /* if we don't have a curr_active_slave, search for the next available
- * backup slave from the current_arp_slave and make it the candidate
- * for becoming the curr_active_slave
+ /* if we don't have a curr_active_link, search for the next available
+ * backup link from the current_arp_link and make it the candidate
+ * for becoming the curr_active_link
*/
- if (!curr_arp_slave) {
- curr_arp_slave = bond_first_slave_rcu(bond);
- if (!curr_arp_slave)
+ if (!curr_arp_link) {
+ curr_arp_link = bond_first_link_rcu(bond);
+ if (!curr_arp_link)
return should_notify_rtnl;
}
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (!found && !before && bond_slave_is_up(slave))
- before = slave;
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (!found && !before && bond_link_is_up(link))
+ before = link;
- if (found && !new_slave && bond_slave_is_up(slave))
- new_slave = slave;
+ if (found && !new_link && bond_link_is_up(link))
+ new_link = link;
/* if the link state is up at this point, we
* mark it down - this can happen if we have
* simultaneous link failures and
* reselect_active_interface doesn't make this
- * one the current slave so it is still marked
+ * one the current link so it is still marked
* up when it is actually down
*/
- if (!bond_slave_is_up(slave) &&
- slave->link_state == BOND_LINK_UP) {
- bond_set_slave_link_state(slave, BOND_LINK_DOWN,
- BOND_SLAVE_NOTIFY_LATER);
- if (slave->link_failure_count < UINT_MAX)
- slave->link_failure_count++;
+ if (!bond_link_is_up(link) &&
+ link->link_state == BOND_LINK_UP) {
+ bond_set_link_state(link, BOND_LINK_DOWN,
+ BOND_LINK_NOTIFY_LATER);
+ if (link->link_failure_count < UINT_MAX)
+ link->link_failure_count++;
- bond_set_slave_inactive_flags(slave,
- BOND_SLAVE_NOTIFY_LATER);
+ bond_set_link_inactive_flags(link,
+ BOND_LINK_NOTIFY_LATER);
- slave_info(bond->dev, slave->dev, "backup interface is now down\n");
+ link_info(bond->dev, link->dev, "backup interface is now down\n");
}
- if (slave == curr_arp_slave)
+ if (link == curr_arp_link)
found = true;
}
- if (!new_slave && before)
- new_slave = before;
+ if (!new_link && before)
+ new_link = before;
- if (!new_slave)
+ if (!new_link)
goto check_state;
- bond_set_slave_link_state(new_slave, BOND_LINK_BACK,
- BOND_SLAVE_NOTIFY_LATER);
- bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER);
- bond_arp_send_all(bond, new_slave);
- new_slave->last_link_up = jiffies;
- rcu_assign_pointer(bond->current_arp_slave, new_slave);
+ bond_set_link_state(new_link, BOND_LINK_BACK, BOND_LINK_NOTIFY_LATER);
+ bond_set_link_active_flags(new_link, BOND_LINK_NOTIFY_LATER);
+ bond_arp_send_all(bond, new_link);
+ new_link->last_link_up = jiffies;
+ rcu_assign_pointer(bond->current_arp_link, new_link);
check_state:
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (slave->should_notify || slave->should_notify_link) {
- should_notify_rtnl = BOND_SLAVE_NOTIFY_NOW;
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (link->should_notify || link->should_notify_link) {
+ should_notify_rtnl = BOND_LINK_NOTIFY_NOW;
break;
}
}
@@ -3182,7 +3178,7 @@ static void bond_activebackup_arp_mon(struct bonding *bond)
delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);
- if (!bond_has_slaves(bond))
+ if (!bond_has_links(bond))
goto re_arm;
rcu_read_lock();
@@ -3220,8 +3216,8 @@ static void bond_activebackup_arp_mon(struct bonding *bond)
call_netdevice_notifiers(NETDEV_NOTIFY_PEERS,
bond->dev);
if (should_notify_rtnl) {
- bond_slave_state_notify(bond);
- bond_slave_link_notify(bond);
+ bond_link_state_notify(bond);
+ bond_link_notify(bond);
}
rtnl_unlock();
@@ -3275,76 +3271,76 @@ static int bond_master_netdev_event(unsigned long event,
return NOTIFY_DONE;
}
-static int bond_slave_netdev_event(unsigned long event,
- struct net_device *slave_dev)
+static int bond_link_netdev_event(unsigned long event,
+ struct net_device *link_dev)
{
- struct slave *slave = bond_slave_get_rtnl(slave_dev), *primary;
+ struct link *link = bond_link_get_rtnl(link_dev), *primary;
struct bonding *bond;
struct net_device *bond_dev;
/* A netdev event can be generated while enslaving a device
* before netdev_rx_handler_register is called in which case
- * slave will be NULL
+ * link will be NULL
*/
- if (!slave) {
- netdev_dbg(slave_dev, "%s called on NULL slave\n", __func__);
+ if (!link) {
+ netdev_dbg(link_dev, "%s called on NULL link\n", __func__);
return NOTIFY_DONE;
}
- bond_dev = slave->bond->dev;
- bond = slave->bond;
- primary = rtnl_dereference(bond->primary_slave);
+ bond_dev = link->bond->dev;
+ bond = link->bond;
+ primary = rtnl_dereference(bond->primary_link);
- slave_dbg(bond_dev, slave_dev, "%s called\n", __func__);
+ link_dbg(bond_dev, link_dev, "%s called\n", __func__);
switch (event) {
case NETDEV_UNREGISTER:
if (bond_dev->type != ARPHRD_ETHER)
- bond_release_and_destroy(bond_dev, slave_dev);
+ bond_release_and_destroy(bond_dev, link_dev);
else
- __bond_release_one(bond_dev, slave_dev, false, true);
+ __bond_release_one(bond_dev, link_dev, false, true);
break;
case NETDEV_UP:
case NETDEV_CHANGE:
/* For 802.3ad mode only:
- * Getting invalid Speed/Duplex values here will put slave
+ * Getting invalid Speed/Duplex values here will put link
* in weird state. Mark it as link-fail if the link was
* previously up or link-down if it hasn't yet come up, and
* let link-monitoring (miimon) set it right when correct
* speeds/duplex are available.
*/
- if (bond_update_speed_duplex(slave) &&
+ if (bond_update_speed_duplex(link) &&
BOND_MODE(bond) == BOND_MODE_8023AD) {
- if (slave->last_link_up)
- slave->link_state = BOND_LINK_FAIL;
+ if (link->last_link_up)
+ link->link_state = BOND_LINK_FAIL;
else
- slave->link_state = BOND_LINK_DOWN;
+ link->link_state = BOND_LINK_DOWN;
}
if (BOND_MODE(bond) == BOND_MODE_8023AD)
- bond_3ad_adapter_speed_duplex_changed(slave);
+ bond_3ad_adapter_speed_duplex_changed(link);
fallthrough;
case NETDEV_DOWN:
- /* Refresh slave-array if applicable!
+ /* Refresh link-array if applicable!
* If the setup does not use miimon or arpmon (mode-specific!),
- * then these events will not cause the slave-array to be
- * refreshed. This will cause xmit to use a slave that is not
+ * then these events will not cause the link-array to be
+ * refreshed. This will cause xmit to use a link that is not
* usable. Avoid such situation by refeshing the array at these
* events. If these (miimon/arpmon) parameters are configured
* then array gets refreshed twice and that should be fine!
*/
if (bond_mode_can_use_xmit_hash(bond))
- bond_update_slave_arr(bond, NULL);
+ bond_update_link_arr(bond, NULL);
break;
case NETDEV_CHANGEMTU:
- /* TODO: Should slaves be allowed to
+ /* TODO: Should links be allowed to
* independently alter their MTU? For
- * an active-backup bond, slaves need
+ * an active-backup bond, links need
* not be the same type of device, so
* MTUs may vary. For other modes,
- * slaves arguably should have the
+ * links arguably should have the
* same MTUs. To do this, we'd need to
- * take over the slave's change_mtu
+ * take over the link's change_mtu
* function for the duration of their
* servitude.
*/
@@ -3355,21 +3351,21 @@ static int bond_slave_netdev_event(unsigned long event,
!bond->params.primary[0])
break;
- if (slave == primary) {
- /* slave's name changed - he's no longer primary */
- RCU_INIT_POINTER(bond->primary_slave, NULL);
- } else if (!strcmp(slave_dev->name, bond->params.primary)) {
- /* we have a new primary slave */
- rcu_assign_pointer(bond->primary_slave, slave);
+ if (link == primary) {
+ /* link's name changed - he's no longer primary */
+ RCU_INIT_POINTER(bond->primary_link, NULL);
+ } else if (!strcmp(link_dev->name, bond->params.primary)) {
+ /* we have a new primary link */
+ rcu_assign_pointer(bond->primary_link, link);
} else { /* we didn't change primary - exit */
break;
}
- netdev_info(bond->dev, "Primary slave changed to %s, reselecting active slave\n",
- primary ? slave_dev->name : "none");
+ netdev_info(bond->dev, "Primary link changed to %s, reselecting active link\n",
+ primary ? link_dev->name : "none");
block_netpoll_tx();
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
break;
case NETDEV_FEAT_CHANGE:
@@ -3377,7 +3373,7 @@ static int bond_slave_netdev_event(unsigned long event,
break;
case NETDEV_RESEND_IGMP:
/* Propagate to master device */
- call_netdevice_notifiers(event, slave->bond->dev);
+ call_netdevice_notifiers(event, link->bond->dev);
break;
default:
break;
@@ -3390,7 +3386,7 @@ static int bond_slave_netdev_event(unsigned long event,
*
* This function receives events for the netdev chain. The caller (an
* ioctl handler calling blocking_notifier_call_chain) holds the necessary
- * locks for us to safely manipulate the slave devices (RTNL lock,
+ * locks for us to safely manipulate the link devices (RTNL lock,
* dev_probe_lock).
*/
static int bond_netdev_event(struct notifier_block *this,
@@ -3413,7 +3409,7 @@ static int bond_netdev_event(struct notifier_block *this,
}
if (event_dev->flags & IFF_SLAVE)
- return bond_slave_netdev_event(event, event_dev);
+ return bond_link_netdev_event(event, event_dev);
return NOTIFY_DONE;
}
@@ -3559,7 +3555,7 @@ void bond_work_init_all(struct bonding *bond)
INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor);
INIT_DELAYED_WORK(&bond->arp_work, bond_arp_monitor);
INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler);
- INIT_DELAYED_WORK(&bond->slave_arr_work, bond_slave_arr_handler);
+ INIT_DELAYED_WORK(&bond->link_arr_work, bond_link_arr_handler);
}
static void bond_work_cancel_all(struct bonding *bond)
@@ -3569,25 +3565,25 @@ static void bond_work_cancel_all(struct bonding *bond)
cancel_delayed_work_sync(&bond->alb_work);
cancel_delayed_work_sync(&bond->ad_work);
cancel_delayed_work_sync(&bond->mcast_work);
- cancel_delayed_work_sync(&bond->slave_arr_work);
+ cancel_delayed_work_sync(&bond->link_arr_work);
}
static int bond_open(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
- /* reset slave->backup and slave->inactive */
- if (bond_has_slaves(bond)) {
- bond_for_each_slave(bond, slave, iter) {
+ /* reset link->backup and link->inactive */
+ if (bond_has_links(bond)) {
+ bond_for_each_link(bond, link, iter) {
if (bond_uses_primary(bond) &&
- slave != rcu_access_pointer(bond->curr_active_slave)) {
- bond_set_slave_inactive_flags(slave,
- BOND_SLAVE_NOTIFY_NOW);
+ link != rcu_access_pointer(bond->curr_active_link)) {
+ bond_set_link_inactive_flags(link,
+ BOND_LINK_NOTIFY_NOW);
} else if (BOND_MODE(bond) != BOND_MODE_8023AD) {
- bond_set_slave_active_flags(slave,
- BOND_SLAVE_NOTIFY_NOW);
+ bond_set_link_active_flags(link,
+ BOND_LINK_NOTIFY_NOW);
}
}
}
@@ -3618,7 +3614,7 @@ static int bond_open(struct net_device *bond_dev)
}
if (bond_mode_can_use_xmit_hash(bond))
- bond_update_slave_arr(bond, NULL);
+ bond_update_link_arr(bond, NULL);
return 0;
}
@@ -3712,7 +3708,7 @@ static void bond_get_stats(struct net_device *bond_dev,
struct bonding *bond = netdev_priv(bond_dev);
struct rtnl_link_stats64 temp;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
int nest_level = 0;
@@ -3724,14 +3720,14 @@ static void bond_get_stats(struct net_device *bond_dev,
spin_lock_nested(&bond->stats_lock, nest_level);
memcpy(stats, &bond->bond_stats, sizeof(*stats));
- bond_for_each_slave_rcu(bond, slave, iter) {
+ bond_for_each_link_rcu(bond, link, iter) {
const struct rtnl_link_stats64 *new =
- dev_get_stats(slave->dev, &temp);
+ dev_get_stats(link->dev, &temp);
- bond_fold_stats(stats, new, &slave->slave_stats);
+ bond_fold_stats(stats, new, &link->link_stats);
- /* save off the slave stats for the next run */
- memcpy(&slave->slave_stats, new, sizeof(*new));
+ /* save off the link stats for the next run */
+ memcpy(&link->link_stats, new, sizeof(*new));
}
memcpy(&bond->bond_stats, stats, sizeof(*stats));
@@ -3742,7 +3738,7 @@ static void bond_get_stats(struct net_device *bond_dev,
static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct net_device *slave_dev = NULL;
+ struct net_device *link_dev = NULL;
struct ifbond k_binfo;
struct ifbond __user *u_binfo = NULL;
struct ifslave k_sinfo;
@@ -3796,7 +3792,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave)))
return -EFAULT;
- res = bond_slave_info_query(bond_dev, &k_sinfo);
+ res = bond_link_info_query(bond_dev, &k_sinfo);
if (res == 0 &&
copy_to_user(u_sinfo, &k_sinfo, sizeof(ifslave)))
return -EFAULT;
@@ -3811,30 +3807,30 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;
- slave_dev = __dev_get_by_name(net, ifr->ifr_slave);
+ link_dev = __dev_get_by_name(net, ifr->ifr_slave);
- slave_dbg(bond_dev, slave_dev, "slave_dev=%p:\n", slave_dev);
+ link_dbg(bond_dev, link_dev, "link_dev=%p:\n", link_dev);
- if (!slave_dev)
+ if (!link_dev)
return -ENODEV;
switch (cmd) {
case BOND_ENSLAVE_OLD:
case SIOCBONDENSLAVE:
- res = bond_enslave(bond_dev, slave_dev, NULL);
+ res = bond_connect(bond_dev, link_dev, NULL);
break;
case BOND_RELEASE_OLD:
case SIOCBONDRELEASE:
- res = bond_release(bond_dev, slave_dev);
+ res = bond_release(bond_dev, link_dev);
break;
case BOND_SETHWADDR_OLD:
case SIOCBONDSETHWADDR:
- res = bond_set_dev_addr(bond_dev, slave_dev);
+ res = bond_set_dev_addr(bond_dev, link_dev);
break;
case BOND_CHANGE_ACTIVE_OLD:
case SIOCBONDCHANGEACTIVE:
- bond_opt_initstr(&newval, slave_dev->name);
- res = __bond_opt_set_notify(bond, BOND_OPT_ACTIVE_SLAVE,
+ bond_opt_initstr(&newval, link_dev->name);
+ res = __bond_opt_set_notify(bond, BOND_OPT_ACTIVE_LINK,
&newval);
break;
default:
@@ -3861,19 +3857,19 @@ static void bond_set_rx_mode(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
rcu_read_lock();
if (bond_uses_primary(bond)) {
- slave = rcu_dereference(bond->curr_active_slave);
- if (slave) {
- dev_uc_sync(slave->dev, bond_dev);
- dev_mc_sync(slave->dev, bond_dev);
+ link = rcu_dereference(bond->curr_active_link);
+ if (link) {
+ dev_uc_sync(link->dev, bond_dev);
+ dev_mc_sync(link->dev, bond_dev);
}
} else {
- bond_for_each_slave_rcu(bond, slave, iter) {
- dev_uc_sync_multiple(slave->dev, bond_dev);
- dev_mc_sync_multiple(slave->dev, bond_dev);
+ bond_for_each_link_rcu(bond, link, iter) {
+ dev_uc_sync_multiple(link->dev, bond_dev);
+ dev_mc_sync_multiple(link->dev, bond_dev);
}
}
rcu_read_unlock();
@@ -3882,17 +3878,17 @@ static void bond_set_rx_mode(struct net_device *bond_dev)
static int bond_neigh_init(struct neighbour *n)
{
struct bonding *bond = netdev_priv(n->dev);
- const struct net_device_ops *slave_ops;
+ const struct net_device_ops *link_ops;
struct neigh_parms parms;
- struct slave *slave;
+ struct link *link;
int ret = 0;
rcu_read_lock();
- slave = bond_first_slave_rcu(bond);
- if (!slave)
+ link = bond_first_link_rcu(bond);
+ if (!link)
goto out;
- slave_ops = slave->dev->netdev_ops;
- if (!slave_ops->ndo_neigh_setup)
+ link_ops = link->dev->netdev_ops;
+ if (!link_ops->ndo_neigh_setup)
goto out;
/* TODO: find another way [1] to implement this.
@@ -3904,7 +3900,7 @@ static int bond_neigh_init(struct neighbour *n)
* back to ___neigh_create() / neigh_parms_alloc()
*/
memset(&parms, 0, sizeof(parms));
- ret = slave_ops->ndo_neigh_setup(slave->dev, &parms);
+ ret = link_ops->ndo_neigh_setup(link->dev, &parms);
if (ret)
goto out;
@@ -3917,8 +3913,8 @@ static int bond_neigh_init(struct neighbour *n)
}
/* The bonding ndo_neigh_setup is called at init time beofre any
- * slave exists. So we must declare proxy setup function which will
- * be used at run time to resolve the actual slave neigh param setup.
+ * link exists. So we must declare proxy setup function which will
+ * be used at run time to resolve the actual link neigh param setup.
*
* It's also called by master devices (such as vlans) to setup their
* underlying devices. In that case - do nothing, we're already set up from
@@ -3934,33 +3930,33 @@ 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 master's links to match the master */
static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave, *rollback_slave;
+ struct link *link, *rollback_link;
struct list_head *iter;
int res = 0;
netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu);
- bond_for_each_slave(bond, slave, iter) {
- slave_dbg(bond_dev, slave->dev, "s %p c_m %p\n",
- slave, slave->dev->netdev_ops->ndo_change_mtu);
+ bond_for_each_link(bond, link, iter) {
+ link_dbg(bond_dev, link->dev, "s %p c_m %p\n",
+ link, link->dev->netdev_ops->ndo_change_mtu);
- res = dev_set_mtu(slave->dev, new_mtu);
+ res = dev_set_mtu(link->dev, new_mtu);
if (res) {
- /* If we failed to set the slave's mtu to the new value
+ /* If we failed to set the link's mtu to the new value
* we must abort the operation even in ACTIVE_BACKUP
- * mode, because if we allow the backup slaves to have
- * different mtu values than the active slave we'll
+ * mode, because if we allow the backup links to have
+ * different mtu values than the active link we'll
* need to change their mtu when doing a failover. That
* means changing their mtu from timer context, which
* is probably not a good idea.
*/
- slave_dbg(bond_dev, slave->dev, "err %d setting mtu to %d\n",
- res, new_mtu);
+ link_dbg(bond_dev, link->dev, "err %d setting mtu to %d\n",
+ res, new_mtu);
goto unwind;
}
}
@@ -3970,17 +3966,17 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
return 0;
unwind:
- /* unwind from head to the slave that failed */
- bond_for_each_slave(bond, rollback_slave, iter) {
+ /* unwind from head to the link that failed */
+ bond_for_each_link(bond, rollback_link, iter) {
int tmp_res;
- if (rollback_slave == slave)
+ if (rollback_link == link)
break;
- tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu);
+ tmp_res = dev_set_mtu(rollback_link->dev, bond_dev->mtu);
if (tmp_res)
- slave_dbg(bond_dev, rollback_slave->dev, "unwind err %d\n",
- tmp_res);
+ link_dbg(bond_dev, rollback_link->dev, "unwind err %d\n",
+ tmp_res);
}
return res;
@@ -3989,13 +3985,13 @@ 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 master releases all links. 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)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave, *rollback_slave;
+ struct link *link, *rollback_link;
struct sockaddr_storage *ss = addr, tmp_ss;
struct list_head *iter;
int res = 0;
@@ -4016,19 +4012,19 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
if (!is_valid_ether_addr(ss->__data))
return -EADDRNOTAVAIL;
- bond_for_each_slave(bond, slave, iter) {
- slave_dbg(bond_dev, slave->dev, "%s: slave=%p\n",
- __func__, slave);
- res = dev_set_mac_address(slave->dev, addr, NULL);
+ bond_for_each_link(bond, link, iter) {
+ link_dbg(bond_dev, link->dev, "%s: link=%p\n",
+ __func__, link);
+ res = dev_set_mac_address(link->dev, addr, NULL);
if (res) {
- /* TODO: consider downing the slave
+ /* TODO: consider downing the link
* and retry ?
* User should expect communications
* breakage anyway until ARP finish
* updating, so...
*/
- slave_dbg(bond_dev, slave->dev, "%s: err %d\n",
- __func__, res);
+ link_dbg(bond_dev, link->dev, "%s: err %d\n",
+ __func__, res);
goto unwind;
}
}
@@ -4041,18 +4037,18 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
memcpy(tmp_ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
tmp_ss.ss_family = bond_dev->type;
- /* unwind from head to the slave that failed */
- bond_for_each_slave(bond, rollback_slave, iter) {
+ /* unwind from head to the link that failed */
+ bond_for_each_link(bond, rollback_link, iter) {
int tmp_res;
- if (rollback_slave == slave)
+ if (rollback_link == link)
break;
- tmp_res = dev_set_mac_address(rollback_slave->dev,
+ tmp_res = dev_set_mac_address(rollback_link->dev,
(struct sockaddr *)&tmp_ss, NULL);
if (tmp_res) {
- slave_dbg(bond_dev, rollback_slave->dev, "%s: unwind err %d\n",
- __func__, tmp_res);
+ link_dbg(bond_dev, rollback_link->dev, "%s: unwind err %d\n",
+ __func__, tmp_res);
}
}
@@ -4060,84 +4056,84 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
}
/**
- * bond_get_slave_by_id - get xmit slave with slave_id
+ * bond_get_link_by_id - get xmit link with link_id
* @bond: bonding device that is transmitting
- * @slave_id: slave id up to slave_cnt-1 through which to transmit
+ * @link_id: link id up to link_cnt-1 through which to transmit
*
- * This function tries to get slave with slave_id but in case
- * it fails, it tries to find the first available slave for transmission.
+ * This function tries to get link with link_id but in case
+ * it fails, it tries to find the first available link for transmission.
*/
-static struct slave *bond_get_slave_by_id(struct bonding *bond,
- int slave_id)
+static struct link *bond_get_link_by_id(struct bonding *bond,
+ int link_id)
{
struct list_head *iter;
- struct slave *slave;
- int i = slave_id;
+ struct link *link;
+ int i = link_id;
- /* Here we start from the slave with slave_id */
- bond_for_each_slave_rcu(bond, slave, iter) {
+ /* Here we start from the link with link_id */
+ bond_for_each_link_rcu(bond, link, iter) {
if (--i < 0) {
- if (bond_slave_can_tx(slave))
- return slave;
+ if (bond_link_can_tx(link))
+ return link;
}
}
- /* Here we start from the first slave up to slave_id */
- i = slave_id;
- bond_for_each_slave_rcu(bond, slave, iter) {
+ /* Here we start from the first link up to link_id */
+ i = link_id;
+ bond_for_each_link_rcu(bond, link, iter) {
if (--i < 0)
break;
- if (bond_slave_can_tx(slave))
- return slave;
+ if (bond_link_can_tx(link))
+ return link;
}
- /* no slave that can tx has been found */
+ /* no link that can tx has been found */
return NULL;
}
/**
- * bond_rr_gen_slave_id - generate slave id based on packets_per_slave
+ * bond_rr_gen_link_id - generate link id based on packets_per_link
* @bond: bonding device to use
*
- * Based on the value of the bonding device's packets_per_slave parameter
- * this function generates a slave id, which is usually used as the next
- * slave to transmit through.
+ * Based on the value of the bonding device's packets_per_link parameter
+ * this function generates a link id, which is usually used as the next
+ * link to transmit through.
*/
-static u32 bond_rr_gen_slave_id(struct bonding *bond)
+static u32 bond_rr_gen_link_id(struct bonding *bond)
{
- u32 slave_id;
- struct reciprocal_value reciprocal_packets_per_slave;
- int packets_per_slave = bond->params.packets_per_slave;
+ u32 link_id;
+ struct reciprocal_value reciprocal_packets_per_link;
+ int packets_per_link = bond->params.packets_per_link;
- switch (packets_per_slave) {
+ switch (packets_per_link) {
case 0:
- slave_id = prandom_u32();
+ link_id = prandom_u32();
break;
case 1:
- slave_id = bond->rr_tx_counter;
+ link_id = bond->rr_tx_counter;
break;
default:
- reciprocal_packets_per_slave =
- bond->params.reciprocal_packets_per_slave;
- slave_id = reciprocal_divide(bond->rr_tx_counter,
- reciprocal_packets_per_slave);
+ reciprocal_packets_per_link =
+ bond->params.reciprocal_packets_per_link;
+ link_id = reciprocal_divide(bond->rr_tx_counter,
+ reciprocal_packets_per_link);
break;
}
bond->rr_tx_counter++;
- return slave_id;
+ return link_id;
}
-static struct slave *bond_xmit_roundrobin_slave_get(struct bonding *bond,
+static struct link *bond_xmit_roundrobin_link_get(struct bonding *bond,
struct sk_buff *skb)
{
- struct slave *slave;
- int slave_cnt;
- u32 slave_id;
+ struct link *link;
+ int link_cnt;
+ u32 link_id;
- /* Start with the curr_active_slave that joined the bond as the
+ /* Start with the curr_active_link that joined the bond as the
* default for sending IGMP traffic. For failover purposes one
* needs to maintain some consistency for the interface that will
- * send the join/membership reports. The curr_active_slave found
+ * send the join/membership reports. The curr_active_link found
* will send all of this type of traffic.
*/
if (skb->protocol == htons(ETH_P_IP)) {
@@ -4149,18 +4145,18 @@ static struct slave *bond_xmit_roundrobin_slave_get(struct bonding *bond,
iph = ip_hdr(skb);
if (iph->protocol == IPPROTO_IGMP) {
- slave = rcu_dereference(bond->curr_active_slave);
- if (slave)
- return slave;
- return bond_get_slave_by_id(bond, 0);
+ link = rcu_dereference(bond->curr_active_link);
+ if (link)
+ return link;
+ return bond_get_link_by_id(bond, 0);
}
}
non_igmp:
- slave_cnt = READ_ONCE(bond->slave_cnt);
- if (likely(slave_cnt)) {
- slave_id = bond_rr_gen_slave_id(bond) % slave_cnt;
- return bond_get_slave_by_id(bond, slave_id);
+ link_cnt = READ_ONCE(bond->link_cnt);
+ if (likely(link_cnt)) {
+ link_id = bond_rr_gen_link_id(bond) % link_cnt;
+ return bond_get_link_by_id(bond, link_id);
}
return NULL;
}
@@ -4169,135 +4165,135 @@ static netdev_tx_t bond_xmit_roundrobin(struct sk_buff *skb,
struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave;
+ struct link *link;
- slave = bond_xmit_roundrobin_slave_get(bond, skb);
- if (likely(slave))
- return bond_dev_queue_xmit(bond, skb, slave->dev);
+ link = bond_xmit_roundrobin_link_get(bond, skb);
+ if (likely(link))
+ return bond_dev_queue_xmit(bond, skb, link->dev);
return bond_tx_drop(bond_dev, skb);
}
-static struct slave *bond_xmit_activebackup_slave_get(struct bonding *bond,
+static struct link *bond_xmit_activebackup_link_get(struct bonding *bond,
struct sk_buff *skb)
{
- return rcu_dereference(bond->curr_active_slave);
+ return rcu_dereference(bond->curr_active_link);
}
-/* In active-backup mode, we know that bond->curr_active_slave is always valid if
+/* In active-backup mode, we know that bond->curr_active_link is always valid if
* the bond has a usable interface.
*/
static netdev_tx_t bond_xmit_activebackup(struct sk_buff *skb,
struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave;
+ struct link *link;
- slave = bond_xmit_activebackup_slave_get(bond, skb);
- if (slave)
- return bond_dev_queue_xmit(bond, skb, slave->dev);
+ link = bond_xmit_activebackup_link_get(bond, skb);
+ if (link)
+ return bond_dev_queue_xmit(bond, skb, link->dev);
return bond_tx_drop(bond_dev, skb);
}
-/* Use this to update slave_array when (a) it's not appropriate to update
- * slave_array right away (note that update_slave_array() may sleep)
+/* Use this to update link_array when (a) it's not appropriate to update
+ * link_array right away (note that update_link_array() may sleep)
* and / or (b) RTNL is not held.
*/
-void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay)
+void bond_link_arr_work_rearm(struct bonding *bond, unsigned long delay)
{
- queue_delayed_work(bond->wq, &bond->slave_arr_work, delay);
+ queue_delayed_work(bond->wq, &bond->link_arr_work, delay);
}
-/* Slave array work handler. Holds only RTNL */
-static void bond_slave_arr_handler(struct work_struct *work)
+/* link array work handler. Holds only RTNL */
+static void bond_link_arr_handler(struct work_struct *work)
{
struct bonding *bond = container_of(work, struct bonding,
- slave_arr_work.work);
+ link_arr_work.work);
int ret;
if (!rtnl_trylock())
goto err;
- ret = bond_update_slave_arr(bond, NULL);
+ ret = bond_update_link_arr(bond, NULL);
rtnl_unlock();
if (ret) {
- pr_warn_ratelimited("Failed to update slave array from WT\n");
+ pr_warn_ratelimited("Failed to update link array from WT\n");
goto err;
}
return;
err:
- bond_slave_arr_work_rearm(bond, 1);
+ bond_link_arr_work_rearm(bond, 1);
}
-static void bond_skip_slave(struct bond_up_slave *slaves,
- struct slave *skipslave)
+static void bond_skip_link(struct bond_up_link *links,
+ struct link *skiplink)
{
int idx;
/* Rare situation where caller has asked to skip a specific
- * slave but allocation failed (most likely!). BTW this is
+ * link but allocation failed (most likely!). BTW this is
* only possible when the call is initiated from
* __bond_release_one(). In this situation; overwrite the
- * skipslave entry in the array with the last entry from the
+ * skiplink entry in the array with the last entry from the
* array to avoid a situation where the xmit path may choose
- * this to-be-skipped slave to send a packet out.
+ * this to-be-skipped link to send a packet out.
*/
- for (idx = 0; slaves && idx < slaves->count; idx++) {
- if (skipslave == slaves->arr[idx]) {
- slaves->arr[idx] =
- slaves->arr[slaves->count - 1];
- slaves->count--;
+ for (idx = 0; links && idx < links->count; idx++) {
+ if (skiplink == links->arr[idx]) {
+ links->arr[idx] =
+ links->arr[links->count - 1];
+ links->count--;
break;
}
}
}
-static void bond_set_slave_arr(struct bonding *bond,
- struct bond_up_slave *usable_slaves,
- struct bond_up_slave *all_slaves)
+static void bond_set_link_arr(struct bonding *bond,
+ struct bond_up_link *usable_links,
+ struct bond_up_link *all_links)
{
- struct bond_up_slave *usable, *all;
+ struct bond_up_link *usable, *all;
- usable = rtnl_dereference(bond->usable_slaves);
- rcu_assign_pointer(bond->usable_slaves, usable_slaves);
+ usable = rtnl_dereference(bond->usable_links);
+ rcu_assign_pointer(bond->usable_links, usable_links);
kfree_rcu(usable, rcu);
- all = rtnl_dereference(bond->all_slaves);
- rcu_assign_pointer(bond->all_slaves, all_slaves);
+ all = rtnl_dereference(bond->all_links);
+ rcu_assign_pointer(bond->all_links, all_links);
kfree_rcu(all, rcu);
}
-static void bond_reset_slave_arr(struct bonding *bond)
+static void bond_reset_link_arr(struct bonding *bond)
{
- struct bond_up_slave *usable, *all;
+ struct bond_up_link *usable, *all;
- usable = rtnl_dereference(bond->usable_slaves);
+ usable = rtnl_dereference(bond->usable_links);
if (usable) {
- RCU_INIT_POINTER(bond->usable_slaves, NULL);
+ RCU_INIT_POINTER(bond->usable_links, NULL);
kfree_rcu(usable, rcu);
}
- all = rtnl_dereference(bond->all_slaves);
+ all = rtnl_dereference(bond->all_links);
if (all) {
- RCU_INIT_POINTER(bond->all_slaves, NULL);
+ RCU_INIT_POINTER(bond->all_links, NULL);
kfree_rcu(all, rcu);
}
}
-/* Build the usable slaves array in control path for modes that use xmit-hash
- * to determine the slave interface -
+/* Build the usable links array in control path for modes that use xmit-hash
+ * to determine the link interface -
* (a) BOND_MODE_8023AD
* (b) BOND_MODE_XOR
* (c) (BOND_MODE_TLB || BOND_MODE_ALB) && tlb_dynamic_lb == 0
*
* The caller is expected to hold RTNL only and NO other lock!
*/
-int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)
+int bond_update_link_arr(struct bonding *bond, struct link *skiplink)
{
- struct bond_up_slave *usable_slaves = NULL, *all_slaves = NULL;
- struct slave *slave;
+ struct bond_up_link *usable_links = NULL, *all_links = NULL;
+ struct link *link;
struct list_head *iter;
int agg_id = 0;
int ret = 0;
@@ -4306,11 +4302,11 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)
WARN_ON(lockdep_is_held(&bond->mode_lock));
#endif
- usable_slaves = kzalloc(struct_size(usable_slaves, arr,
- bond->slave_cnt), GFP_KERNEL);
- all_slaves = kzalloc(struct_size(all_slaves, arr,
- bond->slave_cnt), GFP_KERNEL);
- if (!usable_slaves || !all_slaves) {
+ usable_links = kzalloc(struct_size(usable_links, arr,
+ bond->link_cnt), GFP_KERNEL);
+ all_links = kzalloc(struct_size(all_links, arr,
+ bond->link_cnt), GFP_KERNEL);
+ if (!usable_links || !all_links) {
ret = -ENOMEM;
goto out;
}
@@ -4322,79 +4318,79 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)
/* No active aggragator means it's not safe to use
* the previous array.
*/
- bond_reset_slave_arr(bond);
+ bond_reset_link_arr(bond);
goto out;
}
agg_id = ad_info.aggregator_id;
}
- bond_for_each_slave(bond, slave, iter) {
- if (skipslave == slave)
+ bond_for_each_link(bond, link, iter) {
+ if (skiplink == link)
continue;
- all_slaves->arr[all_slaves->count++] = slave;
+ all_links->arr[all_links->count++] = link;
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
struct aggregator *agg;
- agg = SLAVE_AD_INFO(slave)->port.aggregator;
+ agg = LINK_AD_INFO(link)->port.aggregator;
if (!agg || agg->aggregator_identifier != agg_id)
continue;
}
- if (!bond_slave_can_tx(slave))
+ if (!bond_link_can_tx(link))
continue;
- slave_dbg(bond->dev, slave->dev, "Adding slave to tx hash array[%d]\n",
- usable_slaves->count);
+ link_dbg(bond->dev, link->dev, "Adding link to tx hash array[%d]\n",
+ usable_links->count);
- usable_slaves->arr[usable_slaves->count++] = slave;
+ usable_links->arr[usable_links->count++] = link;
}
- bond_set_slave_arr(bond, usable_slaves, all_slaves);
+ bond_set_link_arr(bond, usable_links, all_links);
return ret;
out:
- if (ret != 0 && skipslave) {
- bond_skip_slave(rtnl_dereference(bond->all_slaves),
- skipslave);
- bond_skip_slave(rtnl_dereference(bond->usable_slaves),
- skipslave);
+ if (ret != 0 && skiplink) {
+ bond_skip_link(rtnl_dereference(bond->all_links),
+ skiplink);
+ bond_skip_link(rtnl_dereference(bond->usable_links),
+ skiplink);
}
- kfree_rcu(all_slaves, rcu);
- kfree_rcu(usable_slaves, rcu);
+ kfree_rcu(all_links, rcu);
+ kfree_rcu(usable_links, rcu);
return ret;
}
-static struct slave *bond_xmit_3ad_xor_slave_get(struct bonding *bond,
+static struct link *bond_xmit_3ad_xor_link_get(struct bonding *bond,
struct sk_buff *skb,
- struct bond_up_slave *slaves)
+ struct bond_up_link *links)
{
- struct slave *slave;
+ struct link *link;
unsigned int count;
u32 hash;
hash = bond_xmit_hash(bond, skb);
- count = slaves ? READ_ONCE(slaves->count) : 0;
+ count = links ? READ_ONCE(links->count) : 0;
if (unlikely(!count))
return NULL;
- slave = slaves->arr[hash % count];
- return slave;
+ link = links->arr[hash % count];
+ return link;
}
/* 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 link array is formed in the control path. The xmit function
* just calculates hash and sends the packet out.
*/
static netdev_tx_t bond_3ad_xor_xmit(struct sk_buff *skb,
struct net_device *dev)
{
struct bonding *bond = netdev_priv(dev);
- struct bond_up_slave *slaves;
- struct slave *slave;
+ struct bond_up_link *links;
+ struct link *link;
- slaves = rcu_dereference(bond->usable_slaves);
- slave = bond_xmit_3ad_xor_slave_get(bond, skb, slaves);
- if (likely(slave))
- return bond_dev_queue_xmit(bond, skb, slave->dev);
+ links = rcu_dereference(bond->usable_links);
+ link = bond_xmit_3ad_xor_link_get(bond, skb, links);
+ if (likely(link))
+ return bond_dev_queue_xmit(bond, skb, link->dev);
return bond_tx_drop(dev, skb);
}
@@ -4404,14 +4400,14 @@ static netdev_tx_t bond_xmit_broadcast(struct sk_buff *skb,
struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave = NULL;
+ struct link *link = NULL;
struct list_head *iter;
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (bond_is_last_slave(bond, slave))
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (bond_is_last_link(bond, link))
break;
- if (bond_slave_is_up(slave) &&
- slave->link_state == BOND_LINK_UP) {
+ if (bond_link_is_up(link) &&
+ link->link_state == BOND_LINK_UP) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
if (!skb2) {
@@ -4419,37 +4415,37 @@ static netdev_tx_t bond_xmit_broadcast(struct sk_buff *skb,
bond_dev->name, __func__);
continue;
}
- bond_dev_queue_xmit(bond, skb2, slave->dev);
+ bond_dev_queue_xmit(bond, skb2, link->dev);
}
}
- if (slave && bond_slave_is_up(slave) &&
- slave->link_state == BOND_LINK_UP)
- return bond_dev_queue_xmit(bond, skb, slave->dev);
+ if (link && bond_link_is_up(link) &&
+ link->link_state == BOND_LINK_UP)
+ return bond_dev_queue_xmit(bond, skb, link->dev);
return bond_tx_drop(bond_dev, skb);
}
/*------------------------- Device initialization ---------------------------*/
-/* Lookup the slave that corresponds to a qid */
-static inline int bond_slave_override(struct bonding *bond,
+/* Lookup the link that corresponds to a qid */
+static inline int bond_link_override(struct bonding *bond,
struct sk_buff *skb)
{
- struct slave *slave = NULL;
+ struct link *link = NULL;
struct list_head *iter;
if (!skb_rx_queue_recorded(skb))
return 1;
- /* Find out if any slaves have the same mapping as this skb. */
- bond_for_each_slave_rcu(bond, slave, iter) {
- if (slave->queue_id == skb_get_queue_mapping(skb)) {
- if (bond_slave_is_up(slave) &&
- slave->link_state == BOND_LINK_UP) {
- bond_dev_queue_xmit(bond, skb, slave->dev);
+ /* Find out if any links have the same mapping as this skb. */
+ bond_for_each_link_rcu(bond, link, iter) {
+ if (link->queue_id == skb_get_queue_mapping(skb)) {
+ if (bond_link_is_up(link) &&
+ link->link_state == BOND_LINK_UP) {
+ bond_dev_queue_xmit(bond, skb, link->dev);
return 0;
}
- /* If the slave isn't UP, use default transmit policy. */
+ /* If the link isn't UP, use default transmit policy. */
break;
}
}
@@ -4479,36 +4475,36 @@ 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,
- struct sk_buff *skb,
- bool all_slaves)
+static struct net_device *bond_xmit_get_link(struct net_device *agg_dev,
+ struct sk_buff *skb,
+ bool all_links)
{
struct bonding *bond = netdev_priv(master_dev);
- struct bond_up_slave *slaves;
- struct slave *slave = NULL;
+ struct bond_up_link *links;
+ struct link *link = NULL;
switch (BOND_MODE(bond)) {
case BOND_MODE_ROUNDROBIN:
- slave = bond_xmit_roundrobin_slave_get(bond, skb);
+ link = bond_xmit_roundrobin_link_get(bond, skb);
break;
case BOND_MODE_ACTIVEBACKUP:
- slave = bond_xmit_activebackup_slave_get(bond, skb);
+ link = bond_xmit_activebackup_link_get(bond, skb);
break;
case BOND_MODE_8023AD:
case BOND_MODE_XOR:
- if (all_slaves)
- slaves = rcu_dereference(bond->all_slaves);
+ if (all_links)
+ links = rcu_dereference(bond->all_links);
else
- slaves = rcu_dereference(bond->usable_slaves);
- slave = bond_xmit_3ad_xor_slave_get(bond, skb, slaves);
+ links = rcu_dereference(bond->usable_links);
+ link = bond_xmit_3ad_xor_link_get(bond, skb, links);
break;
case BOND_MODE_BROADCAST:
break;
case BOND_MODE_ALB:
- slave = bond_xmit_alb_slave_get(bond, skb);
+ link = bond_xmit_alb_link_get(bond, skb);
break;
case BOND_MODE_TLB:
- slave = bond_xmit_tlb_slave_get(bond, skb);
+ link = bond_xmit_tlb_link_get(bond, skb);
break;
default:
/* Should never happen, mode already checked */
@@ -4516,8 +4512,8 @@ static struct net_device *bond_xmit_get_slave(struct net_device *master_dev,
break;
}
- if (slave)
- return slave->dev;
+ if (link)
+ return link->dev;
return NULL;
}
@@ -4526,7 +4522,7 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev
struct bonding *bond = netdev_priv(dev);
if (bond_should_override_tx_queue(bond) &&
- !bond_slave_override(bond, skb))
+ !bond_link_override(bond, skb))
return NETDEV_TX_OK;
switch (BOND_MODE(bond)) {
@@ -4563,7 +4559,7 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_BUSY;
rcu_read_lock();
- if (bond_has_slaves(bond))
+ if (bond_has_links(bond))
ret = __bond_start_xmit(skb, dev);
else
ret = bond_tx_drop(dev, skb);
@@ -4572,12 +4568,12 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
return ret;
}
-static u32 bond_mode_bcast_speed(struct slave *slave, u32 speed)
+static u32 bond_mode_bcast_speed(struct link *link, u32 speed)
{
if (speed == 0 || speed == SPEED_UNKNOWN)
- speed = slave->speed;
+ speed = link->speed;
else
- speed = min(speed, slave->speed);
+ speed = min(speed, link->speed);
return speed;
}
@@ -4587,29 +4583,29 @@ static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
{
struct bonding *bond = netdev_priv(bond_dev);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
u32 speed = 0;
cmd->base.duplex = DUPLEX_UNKNOWN;
cmd->base.port = PORT_OTHER;
- /* Since bond_slave_can_tx returns false for all inactive or down slaves, we
+ /* Since bond_link_can_tx returns false for all inactive or down links, we
* do not need to check mode. Though link speed might not represent
* the true receive or transmit bandwidth (not all modes are symmetric)
* this is an accurate maximum.
*/
- bond_for_each_slave(bond, slave, iter) {
- if (bond_slave_can_tx(slave)) {
- if (slave->speed != SPEED_UNKNOWN) {
+ bond_for_each_link(bond, link, iter) {
+ if (bond_link_can_tx(link)) {
+ if (link->speed != SPEED_UNKNOWN) {
if (BOND_MODE(bond) == BOND_MODE_BROADCAST)
- speed = bond_mode_bcast_speed(slave,
+ speed = bond_mode_bcast_speed(link,
speed);
else
- speed += slave->speed;
+ speed += link->speed;
}
if (cmd->base.duplex == DUPLEX_UNKNOWN &&
- slave->duplex != DUPLEX_UNKNOWN)
- cmd->base.duplex = slave->duplex;
+ link->duplex != DUPLEX_UNKNOWN)
+ cmd->base.duplex = link->duplex;
}
}
cmd->base.speed = speed ? : SPEED_UNKNOWN;
@@ -4652,11 +4648,11 @@ static const struct net_device_ops bond_netdev_ops = {
.ndo_netpoll_cleanup = bond_netpoll_cleanup,
.ndo_poll_controller = bond_poll_controller,
#endif
- .ndo_add_slave = bond_enslave,
+ .ndo_add_slave = bond_connect,
.ndo_del_slave = bond_release,
.ndo_fix_features = bond_fix_features,
.ndo_features_check = passthru_features_check,
- .ndo_get_xmit_slave = bond_xmit_get_slave,
+ .ndo_get_xmit_slave = bond_xmit_get_link,
};
static const struct device_type bond_type = {
@@ -4708,7 +4704,7 @@ void bond_setup(struct net_device *bond_dev)
/* By default, we declare the bond to be fully
* VLAN hardware accelerated capable. Special
* care is taken in the various xmit functions
- * when there are slaves that are not hw accel
+ * when there are links that are not hw accel
* capable
*/
@@ -4738,26 +4734,26 @@ void bond_setup(struct net_device *bond_dev)
static void bond_uninit(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- struct bond_up_slave *usable, *all;
+ struct bond_up_link *usable, *all;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
bond_netpoll_cleanup(bond_dev);
- /* Release the bonded slaves */
- bond_for_each_slave(bond, slave, iter)
- __bond_release_one(bond_dev, slave->dev, true, true);
- netdev_info(bond_dev, "Released all slaves\n");
+ /* Release the bonded links */
+ bond_for_each_link(bond, link, iter)
+ __bond_release_one(bond_dev, link->dev, true, true);
+ netdev_info(bond_dev, "Released all links\n");
- usable = rtnl_dereference(bond->usable_slaves);
+ usable = rtnl_dereference(bond->usable_links);
if (usable) {
- RCU_INIT_POINTER(bond->usable_slaves, NULL);
+ RCU_INIT_POINTER(bond->usable_links, NULL);
kfree_rcu(usable, rcu);
}
- all = rtnl_dereference(bond->all_slaves);
+ all = rtnl_dereference(bond->all_links);
if (all) {
- RCU_INIT_POINTER(bond->all_slaves, NULL);
+ RCU_INIT_POINTER(bond->all_links, NULL);
kfree_rcu(all, rcu);
}
@@ -4896,10 +4892,10 @@ static int bond_check_params(struct bond_params *params)
tx_queues = BOND_DEFAULT_TX_QUEUES;
}
- if ((all_slaves_active != 0) && (all_slaves_active != 1)) {
- pr_warn("Warning: all_slaves_active module parameter (%d), not of valid value (0/1), so it was set to 0\n",
- all_slaves_active);
- all_slaves_active = 0;
+ if ((all_links_active != 0) && (all_links_active != 1)) {
+ pr_warn("Warning: all_links_active module parameter (%d), not of valid value (0/1), so it was set to 0\n",
+ all_links_active);
+ all_links_active = 0;
}
if (resend_igmp < 0 || resend_igmp > 255) {
@@ -4908,11 +4904,11 @@ static int bond_check_params(struct bond_params *params)
resend_igmp = BOND_DEFAULT_RESEND_IGMP;
}
- bond_opt_initval(&newval, packets_per_slave);
- if (!bond_opt_parse(bond_opt_get(BOND_OPT_PACKETS_PER_SLAVE), &newval)) {
- pr_warn("Warning: packets_per_slave (%d) should be between 0 and %u resetting to 1\n",
- packets_per_slave, USHRT_MAX);
- packets_per_slave = 1;
+ bond_opt_initval(&newval, packets_per_link);
+ if (!bond_opt_parse(bond_opt_get(BOND_OPT_PACKETS_PER_LINK), &newval)) {
+ pr_warn("Warning: packets_per_link (%d) should be between 0 and %u resetting to 1\n",
+ packets_per_link, USHRT_MAX);
+ packets_per_link = 1;
}
if (bond_mode == BOND_MODE_ALB) {
@@ -5124,23 +5120,23 @@ static int bond_check_params(struct bond_params *params)
params->primary_reselect = primary_reselect_value;
params->fail_over_mac = fail_over_mac_value;
params->tx_queues = tx_queues;
- params->all_slaves_active = all_slaves_active;
+ params->all_links_active = all_links_active;
params->resend_igmp = resend_igmp;
params->min_links = min_links;
params->lp_interval = lp_interval;
- params->packets_per_slave = packets_per_slave;
+ params->packets_per_link = packets_per_link;
params->tlb_dynamic_lb = tlb_dynamic_lb;
params->ad_actor_sys_prio = ad_actor_sys_prio;
eth_zero_addr(params->ad_actor_system);
params->ad_user_port_key = ad_user_port_key;
- if (packets_per_slave > 0) {
- params->reciprocal_packets_per_slave =
- reciprocal_value(packets_per_slave);
+ if (packets_per_link > 0) {
+ params->reciprocal_packets_per_link =
+ reciprocal_value(packets_per_link);
} else {
- /* reciprocal_packets_per_slave is unused if
- * packets_per_slave is 0 or 1, just initialize it
+ /* reciprocal_packets_per_link is unused if
+ * packets_per_link is 0 or 1, just initialize it
*/
- params->reciprocal_packets_per_slave =
+ params->reciprocal_packets_per_link =
(struct reciprocal_value) { 0 };
}
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index f9cee93b71f4..ca9651f113a1 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -15,8 +15,8 @@
#include <net/rtnetlink.h>
#include <net/bonding.h>
-static size_t bond_get_slave_size(const struct net_device *bond_dev,
- const struct net_device *slave_dev)
+static size_t bond_get_link_size(const struct net_device *bond_dev,
+ const struct net_device *link_dev)
{
return nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_STATE */
nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_MII_STATUS */
@@ -29,35 +29,35 @@ static size_t bond_get_slave_size(const struct net_device *bond_dev,
0;
}
-static int bond_fill_slave_info(struct sk_buff *skb,
+static int bond_fill_link_info(struct sk_buff *skb,
const struct net_device *bond_dev,
- const struct net_device *slave_dev)
+ const struct net_device *link_dev)
{
- struct slave *slave = bond_slave_get_rtnl(slave_dev);
+ struct link *link = bond_link_get_rtnl(link_dev);
- if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_slave_state(slave)))
+ if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_link_state(link)))
goto nla_put_failure;
- if (nla_put_u8(skb, IFLA_BOND_SLAVE_MII_STATUS, slave->link_state))
+ if (nla_put_u8(skb, IFLA_BOND_SLAVE_MII_STATUS, link->link_state))
goto nla_put_failure;
if (nla_put_u32(skb, IFLA_BOND_SLAVE_LINK_FAILURE_COUNT,
- slave->link_failure_count))
+ link->link_failure_count))
goto nla_put_failure;
if (nla_put(skb, IFLA_BOND_SLAVE_PERM_HWADDR,
- slave_dev->addr_len, slave->perm_hwaddr))
+ link_dev->addr_len, link->perm_hwaddr))
goto nla_put_failure;
- if (nla_put_u16(skb, IFLA_BOND_SLAVE_QUEUE_ID, slave->queue_id))
+ if (nla_put_u16(skb, IFLA_BOND_SLAVE_QUEUE_ID, link->queue_id))
goto nla_put_failure;
- if (BOND_MODE(slave->bond) == BOND_MODE_8023AD) {
+ if (BOND_MODE(link->bond) == BOND_MODE_8023AD) {
const struct aggregator *agg;
const struct port *ad_port;
- ad_port = &SLAVE_AD_INFO(slave)->port;
- agg = SLAVE_AD_INFO(slave)->port.aggregator;
+ ad_port = &LINK_AD_INFO(link)->port;
+ agg = LINK_AD_INFO(link)->port.aggregator;
if (agg) {
if (nla_put_u16(skb, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
agg->aggregator_identifier))
@@ -111,7 +111,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
[IFLA_BOND_PEER_NOTIF_DELAY] = { .type = NLA_U32 },
};
-static const struct nla_policy bond_slave_policy[IFLA_BOND_SLAVE_MAX + 1] = {
+static const struct nla_policy bond_link_policy[IFLA_BOND_SLAVE_MAX + 1] = {
[IFLA_BOND_SLAVE_QUEUE_ID] = { .type = NLA_U16 },
};
@@ -127,8 +127,8 @@ static int bond_validate(struct nlattr *tb[], struct nlattr *data[],
return 0;
}
-static int bond_slave_changelink(struct net_device *bond_dev,
- struct net_device *slave_dev,
+static int bond_link_changelink(struct net_device *bond_dev,
+ struct net_device *link_dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{
@@ -143,9 +143,9 @@ static int bond_slave_changelink(struct net_device *bond_dev,
u16 queue_id = nla_get_u16(data[IFLA_BOND_SLAVE_QUEUE_ID]);
char queue_id_str[IFNAMSIZ + 7];
- /* queue_id option setting expects slave_name:queue_id */
+ /* queue_id option setting expects link_name:queue_id */
snprintf(queue_id_str, sizeof(queue_id_str), "%s:%u\n",
- slave_dev->name, queue_id);
+ link_dev->name, queue_id);
bond_opt_initstr(&newval, queue_id_str);
err = __bond_opt_set(bond, BOND_OPT_QUEUE_ID, &newval);
if (err)
@@ -177,18 +177,18 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],
}
if (data[IFLA_BOND_ACTIVE_SLAVE]) {
int ifindex = nla_get_u32(data[IFLA_BOND_ACTIVE_SLAVE]);
- struct net_device *slave_dev;
- char *active_slave = "";
+ struct net_device *link_dev;
+ char *active_link = "";
if (ifindex != 0) {
- slave_dev = __dev_get_by_index(dev_net(bond_dev),
+ link_dev = __dev_get_by_index(dev_net(bond_dev),
ifindex);
- if (!slave_dev)
+ if (!link_dev)
return -ENODEV;
- active_slave = slave_dev->name;
+ active_link = link_dev->name;
}
- bond_opt_initstr(&newval, active_slave);
- err = __bond_opt_set(bond, BOND_OPT_ACTIVE_SLAVE, &newval);
+ bond_opt_initstr(&newval, active_link);
+ err = __bond_opt_set(bond, BOND_OPT_ACTIVE_LINK, &newval);
if (err)
return err;
}
@@ -352,11 +352,11 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],
return err;
}
if (data[IFLA_BOND_ALL_SLAVES_ACTIVE]) {
- int all_slaves_active =
+ int all_links_active =
nla_get_u8(data[IFLA_BOND_ALL_SLAVES_ACTIVE]);
- bond_opt_initval(&newval, all_slaves_active);
- err = __bond_opt_set(bond, BOND_OPT_ALL_SLAVES_ACTIVE, &newval);
+ bond_opt_initval(&newval, all_links_active);
+ err = __bond_opt_set(bond, BOND_OPT_ALL_LINKS_ACTIVE, &newval);
if (err)
return err;
}
@@ -379,11 +379,11 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],
return err;
}
if (data[IFLA_BOND_PACKETS_PER_SLAVE]) {
- int packets_per_slave =
+ int packets_per_link =
nla_get_u32(data[IFLA_BOND_PACKETS_PER_SLAVE]);
- bond_opt_initval(&newval, packets_per_slave);
- err = __bond_opt_set(bond, BOND_OPT_PACKETS_PER_SLAVE, &newval);
+ bond_opt_initval(&newval, packets_per_link);
+ err = __bond_opt_set(bond, BOND_OPT_PACKETS_PER_LINK, &newval);
if (err)
return err;
}
@@ -506,14 +506,14 @@ static size_t bond_get_size(const struct net_device *bond_dev)
0;
}
-static int bond_option_active_slave_get_ifindex(struct bonding *bond)
+static int bond_option_active_link_get_ifindex(struct bonding *bond)
{
- const struct net_device *slave;
+ const struct net_device *link;
int ifindex;
rcu_read_lock();
- slave = bond_option_active_slave_get_rcu(bond);
- ifindex = slave ? slave->ifindex : 0;
+ link = bond_option_active_link_get_rcu(bond);
+ ifindex = link ? link->ifindex : 0;
rcu_read_unlock();
return ifindex;
}
@@ -522,15 +522,15 @@ static int bond_fill_info(struct sk_buff *skb,
const struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- unsigned int packets_per_slave;
+ unsigned int packets_per_link;
int ifindex, i, targets_added;
struct nlattr *targets;
- struct slave *primary;
+ struct link *primary;
if (nla_put_u8(skb, IFLA_BOND_MODE, BOND_MODE(bond)))
goto nla_put_failure;
- ifindex = bond_option_active_slave_get_ifindex(bond);
+ ifindex = bond_option_active_link_get_ifindex(bond);
if (ifindex && nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, ifindex))
goto nla_put_failure;
@@ -580,7 +580,7 @@ static int bond_fill_info(struct sk_buff *skb,
bond->params.arp_all_targets))
goto nla_put_failure;
- primary = rtnl_dereference(bond->primary_slave);
+ primary = rtnl_dereference(bond->primary_link);
if (primary &&
nla_put_u32(skb, IFLA_BOND_PRIMARY, primary->dev->ifindex))
goto nla_put_failure;
@@ -606,7 +606,7 @@ static int bond_fill_info(struct sk_buff *skb,
goto nla_put_failure;
if (nla_put_u8(skb, IFLA_BOND_ALL_SLAVES_ACTIVE,
- bond->params.all_slaves_active))
+ bond->params.all_links_active))
goto nla_put_failure;
if (nla_put_u32(skb, IFLA_BOND_MIN_LINKS,
@@ -617,9 +617,9 @@ static int bond_fill_info(struct sk_buff *skb,
bond->params.lp_interval))
goto nla_put_failure;
- packets_per_slave = bond->params.packets_per_slave;
+ packets_per_link = bond->params.packets_per_link;
if (nla_put_u32(skb, IFLA_BOND_PACKETS_PER_SLAVE,
- packets_per_slave))
+ packets_per_link))
goto nla_put_failure;
if (nla_put_u8(skb, IFLA_BOND_AD_LACP_RATE,
@@ -702,7 +702,7 @@ static int bond_fill_linkxstats(struct sk_buff *skb,
int *prividx, int attr)
{
struct nlattr *nla __maybe_unused;
- struct slave *slave = NULL;
+ struct link *link = NULL;
struct nlattr *nest, *nest2;
struct bonding *bond;
@@ -711,10 +711,10 @@ static int bond_fill_linkxstats(struct sk_buff *skb,
bond = netdev_priv(dev);
break;
case IFLA_STATS_LINK_XSTATS_SLAVE:
- slave = bond_slave_get_rtnl(dev);
- if (!slave)
+ link = bond_link_get_rtnl(dev);
+ if (!link)
return 0;
- bond = slave->bond;
+ bond = link->bond;
break;
default:
return -EINVAL;
@@ -726,8 +726,8 @@ static int bond_fill_linkxstats(struct sk_buff *skb,
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
struct bond_3ad_stats *stats;
- if (slave)
- stats = &SLAVE_AD_INFO(slave)->stats;
+ if (link)
+ stats = &LINK_AD_INFO(link)->stats;
else
stats = &BOND_AD_INFO(bond).stats;
@@ -766,10 +766,10 @@ struct rtnl_link_ops bond_link_ops __read_mostly = {
.fill_linkxstats = bond_fill_linkxstats,
.get_linkxstats_size = bond_get_linkxstats_size,
.slave_maxtype = IFLA_BOND_SLAVE_MAX,
- .slave_policy = bond_slave_policy,
- .slave_changelink = bond_slave_changelink,
- .get_slave_size = bond_get_slave_size,
- .fill_slave_info = bond_fill_slave_info,
+ .slave_policy = bond_link_policy,
+ .slave_changelink = bond_link_changelink,
+ .get_slave_size = bond_get_link_size,
+ .fill_slave_info = bond_fill_link_info,
};
int __init bond_netlink_init(void)
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 72b136e52f9f..437df9a207a6 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -16,7 +16,7 @@
#include <net/bonding.h>
-static int bond_option_active_slave_set(struct bonding *bond,
+static int bond_option_active_link_set(struct bonding *bond,
const struct bond_opt_value *newval);
static int bond_option_miimon_set(struct bonding *bond,
const struct bond_opt_value *newval);
@@ -50,7 +50,7 @@ static int bond_option_resend_igmp_set(struct bonding *bond,
const struct bond_opt_value *newval);
static int bond_option_num_peer_notif_set(struct bonding *bond,
const struct bond_opt_value *newval);
-static int bond_option_all_slaves_active_set(struct bonding *bond,
+static int bond_option_all_links_active_set(struct bonding *bond,
const struct bond_opt_value *newval);
static int bond_option_min_links_set(struct bonding *bond,
const struct bond_opt_value *newval);
@@ -66,7 +66,7 @@ static int bond_option_queue_id_set(struct bonding *bond,
const struct bond_opt_value *newval);
static int bond_option_mode_set(struct bonding *bond,
const struct bond_opt_value *newval);
-static int bond_option_slaves_set(struct bonding *bond,
+static int bond_option_links_set(struct bonding *bond,
const struct bond_opt_value *newval);
static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
const struct bond_opt_value *newval);
@@ -167,7 +167,7 @@ static const struct bond_opt_value bond_use_carrier_tbl[] = {
{ NULL, -1, 0}
};
-static const struct bond_opt_value bond_all_slaves_active_tbl[] = {
+static const struct bond_opt_value bond_all_links_active_tbl[] = {
{ "off", 0, BOND_VALFLAG_DEFAULT},
{ "on", 1, 0},
{ NULL, -1, 0}
@@ -209,14 +209,14 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
.id = BOND_OPT_MODE,
.name = "mode",
.desc = "bond device mode",
- .flags = BOND_OPTFLAG_NOSLAVES | BOND_OPTFLAG_IFDOWN,
+ .flags = BOND_OPTFLAG_NOLINKS | BOND_OPTFLAG_IFDOWN,
.values = bond_mode_tbl,
.set = bond_option_mode_set
},
- [BOND_OPT_PACKETS_PER_SLAVE] = {
- .id = BOND_OPT_PACKETS_PER_SLAVE,
- .name = "packets_per_slave",
- .desc = "Packets to send per slave in RR mode",
+ [BOND_OPT_PACKETS_PER_LINK] = {
+ .id = BOND_OPT_PACKETS_PER_LINK,
+ .name = "packets_per_link",
+ .desc = "Packets to send per link in RR mode",
.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ROUNDROBIN)),
.values = bond_pps_tbl,
.set = bond_option_pps_set
@@ -247,8 +247,8 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
[BOND_OPT_FAIL_OVER_MAC] = {
.id = BOND_OPT_FAIL_OVER_MAC,
.name = "fail_over_mac",
- .desc = "For active-backup, do not set all slaves to the same MAC",
- .flags = BOND_OPTFLAG_NOSLAVES,
+ .desc = "For active-backup, do not set all links to the same MAC",
+ .flags = BOND_OPTFLAG_NOLINKS,
.values = bond_fail_over_mac_tbl,
.set = bond_option_fail_over_mac_set
},
@@ -333,7 +333,7 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
[BOND_OPT_PRIMARY_RESELECT] = {
.id = BOND_OPT_PRIMARY_RESELECT,
.name = "primary_reselect",
- .desc = "Reselect primary slave once it comes up",
+ .desc = "Reselect primary link once it comes up",
.values = bond_primary_reselect_tbl,
.set = bond_option_primary_reselect_set
},
@@ -344,29 +344,29 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
.values = bond_use_carrier_tbl,
.set = bond_option_use_carrier_set
},
- [BOND_OPT_ACTIVE_SLAVE] = {
- .id = BOND_OPT_ACTIVE_SLAVE,
- .name = "active_slave",
- .desc = "Currently active slave",
+ [BOND_OPT_ACTIVE_LINK] = {
+ .id = BOND_OPT_ACTIVE_LINK,
+ .name = "active_link",
+ .desc = "Currently active link",
.flags = BOND_OPTFLAG_RAWVAL,
.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP) |
BIT(BOND_MODE_TLB) |
BIT(BOND_MODE_ALB)),
- .set = bond_option_active_slave_set
+ .set = bond_option_active_link_set
},
[BOND_OPT_QUEUE_ID] = {
.id = BOND_OPT_QUEUE_ID,
.name = "queue_id",
- .desc = "Set queue id of a slave",
+ .desc = "Set queue id of a link",
.flags = BOND_OPTFLAG_RAWVAL,
.set = bond_option_queue_id_set
},
- [BOND_OPT_ALL_SLAVES_ACTIVE] = {
- .id = BOND_OPT_ALL_SLAVES_ACTIVE,
- .name = "all_slaves_active",
- .desc = "Keep all frames received on an interface by setting active flag for all slaves",
- .values = bond_all_slaves_active_tbl,
- .set = bond_option_all_slaves_active_set
+ [BOND_OPT_ALL_LINKS_ACTIVE] = {
+ .id = BOND_OPT_ALL_LINKS_ACTIVE,
+ .name = "all_links_active",
+ .desc = "Keep all frames received on an interface by setting active flag for all links",
+ .values = bond_all_links_active_tbl,
+ .set = bond_option_all_links_active_set
},
[BOND_OPT_RESEND_IGMP] = {
.id = BOND_OPT_RESEND_IGMP,
@@ -378,16 +378,16 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
[BOND_OPT_LP_INTERVAL] = {
.id = BOND_OPT_LP_INTERVAL,
.name = "lp_interval",
- .desc = "The number of seconds between instances where the bonding driver sends learning packets to each slave's peer switch",
+ .desc = "The number of seconds between instances where the bonding driver sends learning packets to each link's peer switch",
.values = bond_lp_interval_tbl,
.set = bond_option_lp_interval_set
},
- [BOND_OPT_SLAVES] = {
- .id = BOND_OPT_SLAVES,
- .name = "slaves",
- .desc = "Slave membership management",
+ [BOND_OPT_LINKS] = {
+ .id = BOND_OPT_LINKS,
+ .name = "links",
+ .desc = "Link membership management",
.flags = BOND_OPTFLAG_RAWVAL,
- .set = bond_option_slaves_set
+ .set = bond_option_links_set
},
[BOND_OPT_TLB_DYNAMIC_LB] = {
.id = BOND_OPT_TLB_DYNAMIC_LB,
@@ -433,7 +433,48 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
.desc = "Delay between each peer notification on failover event, in milliseconds",
.values = bond_intmax_tbl,
.set = bond_option_peer_notif_delay_set
- }
+ },
+/* legacy sysfs interface names */
+ [BOND_OPT_PACKETS_PER_SLAVE] = {
+ .id = BOND_OPT_PACKETS_PER_SLAVE,
+ .name = "packets_per_slave",
+ .desc = "Packets to send per slave in RR mode",
+ .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ROUNDROBIN)),
+ .values = bond_pps_tbl,
+ .set = bond_option_pps_set
+ },
+ [BOND_OPT_MINSLAVES] = {
+ .id = BOND_OPT_MINSLAVES,
+ .name = "min_slaves",
+ .desc = "Minimum number of available slaves before turning on carrier",
+ .values = bond_intmax_tbl,
+ .set = bond_option_min_links_set
+ },
+ [BOND_OPT_ACTIVE_SLAVE] = {
+ .id = BOND_OPT_ACTIVE_SLAVE,
+ .name = "active_slave",
+ .desc = "Currently active slave",
+ .flags = BOND_OPTFLAG_RAWVAL,
+ .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP) |
+ BIT(BOND_MODE_TLB) |
+ BIT(BOND_MODE_ALB)),
+ .set = bond_option_active_link_set
+ },
+ [BOND_OPT_ALL_SLAVES_ACTIVE] = {
+ .id = BOND_OPT_ALL_SLAVES_ACTIVE,
+ .name = "all_slaves_active",
+ .desc = "Keep all frames received on an interface by setting active flag for all slaves",
+ .values = bond_all_links_active_tbl,
+ .set = bond_option_all_links_active_set
+ },
+ [BOND_OPT_SLAVES] = {
+ .id = BOND_OPT_SLAVES,
+ .name = "slaves",
+ .desc = "Slave membership management",
+ .flags = BOND_OPTFLAG_RAWVAL,
+ .set = bond_option_links_set
+ },
+/* end legacy sysfs interface names */
};
/* Searches for an option by name */
@@ -578,7 +619,7 @@ static int bond_opt_check_deps(struct bonding *bond,
if (test_bit(params->mode, &opt->unsuppmodes))
return -EACCES;
- if ((opt->flags & BOND_OPTFLAG_NOSLAVES) && bond_has_slaves(bond))
+ if ((opt->flags & BOND_OPTFLAG_NOLINKS) && bond_has_links(bond))
return -ENOTEMPTY;
if ((opt->flags & BOND_OPTFLAG_IFDOWN) && (bond->dev->flags & IFF_UP))
return -EBUSY;
@@ -632,7 +673,7 @@ static void bond_opt_error_interpret(struct bonding *bond,
bond_opt_dep_print(bond, opt);
break;
case -ENOTEMPTY:
- netdev_err(bond->dev, "option %s: unable to set because the bond device has slaves\n",
+ netdev_err(bond->dev, "option %s: unable to set because the bond device has links\n",
opt->name);
break;
case -EBUSY:
@@ -782,58 +823,58 @@ static int bond_option_mode_set(struct bonding *bond,
return 0;
}
-static int bond_option_active_slave_set(struct bonding *bond,
+static int bond_option_active_link_set(struct bonding *bond,
const struct bond_opt_value *newval)
{
char ifname[IFNAMSIZ] = { 0, };
- struct net_device *slave_dev;
+ struct net_device *link_dev;
int ret = 0;
sscanf(newval->string, "%15s", ifname); /* IFNAMSIZ */
if (!strlen(ifname) || newval->string[0] == '\n') {
- slave_dev = NULL;
+ link_dev = NULL;
} else {
- slave_dev = __dev_get_by_name(dev_net(bond->dev), ifname);
- if (!slave_dev)
+ link_dev = __dev_get_by_name(dev_net(bond->dev), ifname);
+ if (!link_dev)
return -ENODEV;
}
- if (slave_dev) {
- if (!netif_is_bond_slave(slave_dev)) {
- slave_err(bond->dev, slave_dev, "Device is not bonding slave\n");
+ if (link_dev) {
+ if (!netif_is_bond_link(link_dev)) {
+ link_err(bond->dev, link_dev, "Device is not bonding link\n");
return -EINVAL;
}
- if (bond->dev != netdev_master_upper_dev_get(slave_dev)) {
- slave_err(bond->dev, slave_dev, "Device is not our slave\n");
+ if (bond->dev != netdev_master_upper_dev_get(link_dev)) {
+ link_err(bond->dev, link_dev, "Device is not our link\n");
return -EINVAL;
}
}
block_netpoll_tx();
/* check to see if we are clearing active */
- if (!slave_dev) {
- netdev_dbg(bond->dev, "Clearing current active slave\n");
- RCU_INIT_POINTER(bond->curr_active_slave, NULL);
- bond_select_active_slave(bond);
+ if (!link_dev) {
+ netdev_dbg(bond->dev, "Clearing current active link\n");
+ RCU_INIT_POINTER(bond->curr_active_link, NULL);
+ bond_select_active_link(bond);
} else {
- struct slave *old_active = rtnl_dereference(bond->curr_active_slave);
- struct slave *new_active = bond_slave_get_rtnl(slave_dev);
+ struct link *old_active = rtnl_dereference(bond->curr_active_link);
+ struct link *new_active = bond_link_get_rtnl(link_dev);
BUG_ON(!new_active);
if (new_active == old_active) {
/* do nothing */
- slave_dbg(bond->dev, new_active->dev, "is already the current active slave\n");
+ link_dbg(bond->dev, new_active->dev, "is already the current active link\n");
} else {
if (old_active &&
(new_active->link_state == BOND_LINK_UP) &&
- bond_slave_is_up(new_active)) {
- slave_dbg(bond->dev, new_active->dev, "Setting as active slave\n");
- bond_change_active_slave(bond, new_active);
+ bond_link_is_up(new_active)) {
+ link_dbg(bond->dev, new_active->dev, "Setting as active link\n");
+ bond_change_active_link(bond, new_active);
} else {
- slave_err(bond->dev, new_active->dev, "Could not set as active slave; either %s is down or the link is down\n",
- new_active->dev->name);
+ link_err(bond->dev, new_active->dev, "Could not set as active link; either %s is down or the link is down\n",
+ new_active->dev->name);
ret = -EINVAL;
}
}
@@ -995,11 +1036,11 @@ static void _bond_options_arp_ip_target_set(struct bonding *bond, int slot,
{
__be32 *targets = bond->params.arp_targets;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
if (slot >= 0 && slot < BOND_MAX_ARP_TARGETS) {
- bond_for_each_slave(bond, slave, iter)
- slave->target_last_arp_rx[slot] = last_rx;
+ bond_for_each_link(bond, link, iter)
+ link->target_last_arp_rx[slot] = last_rx;
targets[slot] = target;
}
}
@@ -1043,7 +1084,7 @@ static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
{
__be32 *targets = bond->params.arp_targets;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
unsigned long *targets_rx;
int ind, i;
@@ -1065,8 +1106,8 @@ static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
netdev_dbg(bond->dev, "Removing ARP target %pI4\n", &target);
- bond_for_each_slave(bond, slave, iter) {
- targets_rx = slave->target_last_arp_rx;
+ bond_for_each_link(bond, link, iter) {
+ targets_rx = link->target_last_arp_rx;
for (i = ind; (i < BOND_MAX_ARP_TARGETS-1) && targets[i+1]; i++)
targets_rx[i] = targets_rx[i+1];
targets_rx[i] = 0;
@@ -1137,7 +1178,7 @@ static int bond_option_primary_set(struct bonding *bond,
{
char *p, *primary = newval->string;
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
block_netpoll_tx();
@@ -1146,33 +1187,33 @@ static int bond_option_primary_set(struct bonding *bond,
*p = '\0';
/* check to see if we are clearing primary */
if (!strlen(primary)) {
- netdev_dbg(bond->dev, "Setting primary slave to None\n");
- RCU_INIT_POINTER(bond->primary_slave, NULL);
+ netdev_dbg(bond->dev, "Setting primary link to None\n");
+ RCU_INIT_POINTER(bond->primary_link, NULL);
memset(bond->params.primary, 0, sizeof(bond->params.primary));
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
goto out;
}
- bond_for_each_slave(bond, slave, iter) {
- if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) {
- slave_dbg(bond->dev, slave->dev, "Setting as primary slave\n");
- rcu_assign_pointer(bond->primary_slave, slave);
- strcpy(bond->params.primary, slave->dev->name);
+ bond_for_each_link(bond, link, iter) {
+ if (strncmp(link->dev->name, primary, IFNAMSIZ) == 0) {
+ link_dbg(bond->dev, link->dev, "Setting as primary link\n");
+ rcu_assign_pointer(bond->primary_link, link);
+ strcpy(bond->params.primary, link->dev->name);
bond->force_primary = true;
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
goto out;
}
}
- if (rtnl_dereference(bond->primary_slave)) {
- netdev_dbg(bond->dev, "Setting primary slave to None\n");
- RCU_INIT_POINTER(bond->primary_slave, NULL);
- bond_select_active_slave(bond);
+ if (rtnl_dereference(bond->primary_link)) {
+ netdev_dbg(bond->dev, "Setting primary link to None\n");
+ RCU_INIT_POINTER(bond->primary_link, NULL);
+ bond_select_active_link(bond);
}
strncpy(bond->params.primary, primary, IFNAMSIZ);
bond->params.primary[IFNAMSIZ - 1] = 0;
- netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved yet\n",
+ netdev_dbg(bond->dev, "Recording %s as primary, but it has not been connected yet\n",
primary);
out:
@@ -1189,7 +1230,7 @@ static int bond_option_primary_reselect_set(struct bonding *bond,
bond->params.primary_reselect = newval->value;
block_netpoll_tx();
- bond_select_active_slave(bond);
+ bond_select_active_link(bond);
unblock_netpoll_tx();
return 0;
@@ -1233,21 +1274,21 @@ static int bond_option_num_peer_notif_set(struct bonding *bond,
return 0;
}
-static int bond_option_all_slaves_active_set(struct bonding *bond,
+static int bond_option_all_links_active_set(struct bonding *bond,
const struct bond_opt_value *newval)
{
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
- if (newval->value == bond->params.all_slaves_active)
+ if (newval->value == bond->params.all_links_active)
return 0;
- bond->params.all_slaves_active = newval->value;
- bond_for_each_slave(bond, slave, iter) {
- if (!bond_is_active_slave(slave)) {
+ bond->params.all_links_active = newval->value;
+ bond_for_each_link(bond, link, iter) {
+ if (!bond_is_active_link(link)) {
if (newval->value)
- slave->inactive = 0;
+ link->inactive = 0;
else
- slave->inactive = 1;
+ link->inactive = 1;
}
}
@@ -1276,17 +1317,17 @@ static int bond_option_lp_interval_set(struct bonding *bond,
static int bond_option_pps_set(struct bonding *bond,
const struct bond_opt_value *newval)
{
- netdev_dbg(bond->dev, "Setting packets per slave to %llu\n",
+ netdev_dbg(bond->dev, "Setting packets per link to %llu\n",
newval->value);
- bond->params.packets_per_slave = newval->value;
+ bond->params.packets_per_link = newval->value;
if (newval->value > 0) {
- bond->params.reciprocal_packets_per_slave =
+ bond->params.reciprocal_packets_per_link =
reciprocal_value(newval->value);
} else {
- /* reciprocal_packets_per_slave is unused if
- * packets_per_slave is 0 or 1, just initialize it
+ /* reciprocal_packets_per_link is unused if
+ * packets_per_link is 0 or 1, just initialize it
*/
- bond->params.reciprocal_packets_per_slave =
+ bond->params.reciprocal_packets_per_link =
(struct reciprocal_value) { 0 };
}
@@ -1317,7 +1358,7 @@ static int bond_option_ad_select_set(struct bonding *bond,
static int bond_option_queue_id_set(struct bonding *bond,
const struct bond_opt_value *newval)
{
- struct slave *slave, *update_slave;
+ struct link *link, *update_link;
struct net_device *sdev;
struct list_head *iter;
char *delim;
@@ -1346,24 +1387,24 @@ static int bond_option_queue_id_set(struct bonding *bond,
if (!sdev)
goto err_no_cmd;
- /* Search for thes slave and check for duplicate qids */
- update_slave = NULL;
- bond_for_each_slave(bond, slave, iter) {
- if (sdev == slave->dev)
+ /* Search for thes link and check for duplicate qids */
+ update_link = NULL;
+ bond_for_each_link(bond, link, iter) {
+ if (sdev == link->dev)
/* We don't need to check the matching
- * slave for dups, since we're overwriting it
+ * link for dups, since we're overwriting it
*/
- update_slave = slave;
- else if (qid && qid == slave->queue_id) {
+ update_link = link;
+ else if (qid && qid == link->queue_id) {
goto err_no_cmd;
}
}
- if (!update_slave)
+ if (!update_link)
goto err_no_cmd;
- /* Actually set the qids for the slave */
- update_slave->queue_id = qid;
+ /* Actually set the qids for the link */
+ update_link->queue_id = qid;
out:
return ret;
@@ -1375,7 +1416,7 @@ static int bond_option_queue_id_set(struct bonding *bond,
}
-static int bond_option_slaves_set(struct bonding *bond,
+static int bond_option_links_set(struct bonding *bond,
const struct bond_opt_value *newval)
{
char command[IFNAMSIZ + 1] = { 0, };
@@ -1400,12 +1441,12 @@ static int bond_option_slaves_set(struct bonding *bond,
switch (command[0]) {
case '+':
- slave_dbg(bond->dev, dev, "Enslaving interface\n");
- ret = bond_enslave(bond->dev, dev, NULL);
+ link_dbg(bond->dev, dev, "Connecting interface\n");
+ ret = bond_connect(bond->dev, dev, NULL);
break;
case '-':
- slave_dbg(bond->dev, dev, "Releasing interface\n");
+ link_dbg(bond->dev, dev, "Releasing interface\n");
ret = bond_release(bond->dev, dev);
break;
@@ -1418,7 +1459,7 @@ static int bond_option_slaves_set(struct bonding *bond,
return ret;
err_no_cmd:
- netdev_err(bond->dev, "no command found in slaves file - use +ifname or -ifname\n");
+ netdev_err(bond->dev, "no command found in links file - use +ifname or -ifname\n");
ret = -EPERM;
goto out;
}
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 710e57bff90a..413b942c170c 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -12,7 +12,7 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
{
struct bonding *bond = PDE_DATA(file_inode(seq->file));
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
loff_t off = 0;
rcu_read_lock();
@@ -20,9 +20,9 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
if (*pos == 0)
return SEQ_START_TOKEN;
- bond_for_each_slave_rcu(bond, slave, iter)
+ bond_for_each_link_rcu(bond, link, iter)
if (++off == *pos)
- return slave;
+ return link;
return NULL;
}
@@ -31,17 +31,17 @@ static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct bonding *bond = PDE_DATA(file_inode(seq->file));
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
bool found = false;
++*pos;
if (v == SEQ_START_TOKEN)
- return bond_first_slave_rcu(bond);
+ return bond_first_link_rcu(bond);
- bond_for_each_slave_rcu(bond, slave, iter) {
+ bond_for_each_link_rcu(bond, link, iter) {
if (found)
- return slave;
- if (slave == v)
+ return link;
+ if (link == v)
found = true;
}
@@ -58,10 +58,10 @@ static void bond_info_show_master(struct seq_file *seq)
{
struct bonding *bond = PDE_DATA(file_inode(seq->file));
const struct bond_opt_value *optval;
- struct slave *curr, *primary;
+ struct link *curr, *primary;
int i;
- curr = rcu_dereference(bond->curr_active_slave);
+ curr = rcu_dereference(bond->curr_active_link);
seq_printf(seq, "Bonding Mode: %s",
bond_mode_name(BOND_MODE(bond)));
@@ -83,7 +83,7 @@ static void bond_info_show_master(struct seq_file *seq)
}
if (bond_uses_primary(bond)) {
- primary = rcu_dereference(bond->primary_slave);
+ primary = rcu_dereference(bond->primary_link);
seq_printf(seq, "Primary Slave: %s",
primary ? primary->dev->name : "None");
if (primary) {
@@ -166,33 +166,33 @@ static void bond_info_show_master(struct seq_file *seq)
}
}
-static void bond_info_show_slave(struct seq_file *seq,
- const struct slave *slave)
+static void bond_info_show_link(struct seq_file *seq,
+ const struct link *link)
{
struct bonding *bond = PDE_DATA(file_inode(seq->file));
- seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
+ seq_printf(seq, "\nSlave Interface: %s\n", link->dev->name);
seq_printf(seq, "MII Status: %s\n",
- bond_slave_link_status(slave->link_state));
- if (slave->speed == SPEED_UNKNOWN)
+ bond_link_status(link->link_state));
+ if (link->speed == SPEED_UNKNOWN)
seq_printf(seq, "Speed: %s\n", "Unknown");
else
- seq_printf(seq, "Speed: %d Mbps\n", slave->speed);
+ seq_printf(seq, "Speed: %d Mbps\n", link->speed);
- if (slave->duplex == DUPLEX_UNKNOWN)
+ if (link->duplex == DUPLEX_UNKNOWN)
seq_printf(seq, "Duplex: %s\n", "Unknown");
else
- seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half");
+ seq_printf(seq, "Duplex: %s\n", link->duplex ? "full" : "half");
seq_printf(seq, "Link Failure Count: %u\n",
- slave->link_failure_count);
+ link->link_failure_count);
seq_printf(seq, "Permanent HW addr: %*phC\n",
- slave->dev->addr_len, slave->perm_hwaddr);
- seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id);
+ link->dev->addr_len, link->perm_hwaddr);
+ seq_printf(seq, "Slave queue ID: %d\n", link->queue_id);
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
- const struct port *port = &SLAVE_AD_INFO(slave)->port;
+ const struct port *port = &LINK_AD_INFO(link)->port;
const struct aggregator *agg = port->aggregator;
if (agg) {
@@ -248,7 +248,7 @@ static int bond_info_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, "%s\n", bond_version);
bond_info_show_master(seq);
} else
- bond_info_show_slave(seq, v);
+ bond_info_show_link(seq, v);
return 0;
}
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 2d615a93685e..2b0715c6a7a4 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -161,19 +161,19 @@ static ssize_t bonding_sysfs_store_option(struct device *d,
return ret;
}
-/* Show the slaves in the current bond. */
-static ssize_t bonding_show_slaves(struct device *d,
- struct device_attribute *attr, char *buf)
+/* Show the links in the current bond. */
+static ssize_t bonding_show_links(struct device *d,
+ struct device_attribute *attr, char *buf)
{
struct bonding *bond = to_bond(d);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
int res = 0;
if (!rtnl_trylock())
return restart_syscall();
- bond_for_each_slave(bond, slave, iter) {
+ bond_for_each_link(bond, link, iter) {
if (res > (PAGE_SIZE - IFNAMSIZ)) {
/* not enough space for another interface name */
if ((PAGE_SIZE - res) > 10)
@@ -181,7 +181,7 @@ static ssize_t bonding_show_slaves(struct device *d,
res += sprintf(buf + res, "++more++ ");
break;
}
- res += sprintf(buf + res, "%s ", slave->dev->name);
+ res += sprintf(buf + res, "%s ", link->dev->name);
}
rtnl_unlock();
@@ -191,7 +191,7 @@ static ssize_t bonding_show_slaves(struct device *d,
return res;
}
-static DEVICE_ATTR(slaves, 0644, bonding_show_slaves,
+static DEVICE_ATTR(links, 0644, bonding_show_links,
bonding_sysfs_store_option);
/* Show the bonding mode. */
@@ -404,17 +404,17 @@ static ssize_t bonding_show_miimon(struct device *d,
static DEVICE_ATTR(miimon, 0644,
bonding_show_miimon, bonding_sysfs_store_option);
-/* Show the primary slave. */
+/* Show the primary link. */
static ssize_t bonding_show_primary(struct device *d,
struct device_attribute *attr,
char *buf)
{
struct bonding *bond = to_bond(d);
- struct slave *primary;
+ struct link *primary;
int count = 0;
rcu_read_lock();
- primary = rcu_dereference(bond->primary_slave);
+ primary = rcu_dereference(bond->primary_link);
if (primary)
count = sprintf(buf, "%s\n", primary->dev->name);
rcu_read_unlock();
@@ -454,25 +454,25 @@ static DEVICE_ATTR(use_carrier, 0644,
bonding_show_carrier, bonding_sysfs_store_option);
-/* Show currently active_slave. */
-static ssize_t bonding_show_active_slave(struct device *d,
- struct device_attribute *attr,
- char *buf)
+/* Show currently active_link. */
+static ssize_t bonding_show_active_link(struct device *d,
+ struct device_attribute *attr,
+ char *buf)
{
struct bonding *bond = to_bond(d);
- struct net_device *slave_dev;
+ struct net_device *link_dev;
int count = 0;
rcu_read_lock();
- slave_dev = bond_option_active_slave_get_rcu(bond);
- if (slave_dev)
- count = sprintf(buf, "%s\n", slave_dev->name);
+ link_dev = bond_option_active_link_get_rcu(bond);
+ if (link_dev)
+ count = sprintf(buf, "%s\n", link_dev->name);
rcu_read_unlock();
return count;
}
-static DEVICE_ATTR(active_slave, 0644,
- bonding_show_active_slave, bonding_sysfs_store_option);
+static DEVICE_ATTR(active_link, 0644,
+ bonding_show_active_link, bonding_sysfs_store_option);
/* Show link status of the bond interface. */
static ssize_t bonding_show_mii_status(struct device *d,
@@ -584,20 +584,20 @@ static ssize_t bonding_show_ad_partner_mac(struct device *d,
}
static DEVICE_ATTR(ad_partner_mac, 0444, bonding_show_ad_partner_mac, NULL);
-/* Show the queue_ids of the slaves in the current bond. */
+/* Show the queue_ids of the links in the current bond. */
static ssize_t bonding_show_queue_id(struct device *d,
struct device_attribute *attr,
char *buf)
{
struct bonding *bond = to_bond(d);
struct list_head *iter;
- struct slave *slave;
+ struct link *link;
int res = 0;
if (!rtnl_trylock())
return restart_syscall();
- bond_for_each_slave(bond, slave, iter) {
+ bond_for_each_link(bond, link, iter) {
if (res > (PAGE_SIZE - IFNAMSIZ - 6)) {
/* not enough space for another interface_name:queue_id pair */
if ((PAGE_SIZE - res) > 10)
@@ -606,7 +606,7 @@ static ssize_t bonding_show_queue_id(struct device *d,
break;
}
res += sprintf(buf + res, "%s:%d ",
- slave->dev->name, slave->queue_id);
+ link->dev->name, link->queue_id);
}
if (res)
buf[res-1] = '\n'; /* eat the leftover space */
@@ -619,17 +619,17 @@ static DEVICE_ATTR(queue_id, 0644, bonding_show_queue_id,
bonding_sysfs_store_option);
-/* Show the all_slaves_active flag. */
-static ssize_t bonding_show_slaves_active(struct device *d,
- struct device_attribute *attr,
- char *buf)
+/* Show the all_links_active flag. */
+static ssize_t bonding_show_links_active(struct device *d,
+ struct device_attribute *attr,
+ char *buf)
{
struct bonding *bond = to_bond(d);
- return sprintf(buf, "%d\n", bond->params.all_slaves_active);
+ return sprintf(buf, "%d\n", bond->params.all_links_active);
}
-static DEVICE_ATTR(all_slaves_active, 0644,
- bonding_show_slaves_active, bonding_sysfs_store_option);
+static DEVICE_ATTR(all_links_active, 0644,
+ bonding_show_links_active, bonding_sysfs_store_option);
/* Show the number of IGMP membership reports to send on link failure */
static ssize_t bonding_show_resend_igmp(struct device *d,
@@ -665,17 +665,17 @@ static ssize_t bonding_show_tlb_dynamic_lb(struct device *d,
static DEVICE_ATTR(tlb_dynamic_lb, 0644,
bonding_show_tlb_dynamic_lb, bonding_sysfs_store_option);
-static ssize_t bonding_show_packets_per_slave(struct device *d,
- struct device_attribute *attr,
- char *buf)
+static ssize_t bonding_show_packets_per_link(struct device *d,
+ struct device_attribute *attr,
+ char *buf)
{
struct bonding *bond = to_bond(d);
- unsigned int packets_per_slave = bond->params.packets_per_slave;
+ unsigned int packets_per_link = bond->params.packets_per_link;
- return sprintf(buf, "%u\n", packets_per_slave);
+ return sprintf(buf, "%u\n", packets_per_link);
}
-static DEVICE_ATTR(packets_per_slave, 0644,
- bonding_show_packets_per_slave, bonding_sysfs_store_option);
+static DEVICE_ATTR(packets_per_link, 0644,
+ bonding_show_packets_per_link, bonding_sysfs_store_option);
static ssize_t bonding_show_ad_actor_sys_prio(struct device *d,
struct device_attribute *attr,
@@ -720,8 +720,21 @@ static ssize_t bonding_show_ad_user_port_key(struct device *d,
static DEVICE_ATTR(ad_user_port_key, 0644,
bonding_show_ad_user_port_key, bonding_sysfs_store_option);
+/* legacy sysfs interface names */
+static DEVICE_ATTR(slaves, 0644, bonding_show_links,
+ bonding_sysfs_store_option);
+static DEVICE_ATTR(min_slaves, 0644,
+ bonding_show_min_links, bonding_sysfs_store_option);
+static DEVICE_ATTR(active_slave, 0644,
+ bonding_show_active_link, bonding_sysfs_store_option);
+static DEVICE_ATTR(all_slaves_active, 0644,
+ bonding_show_links_active, bonding_sysfs_store_option);
+static DEVICE_ATTR(packets_per_slave, 0644,
+ bonding_show_packets_per_link, bonding_sysfs_store_option);
+/* end legacy sysfs interface names */
+
static struct attribute *per_bond_attrs[] = {
- &dev_attr_slaves.attr,
+ &dev_attr_links.attr,
&dev_attr_mode.attr,
&dev_attr_fail_over_mac.attr,
&dev_attr_arp_validate.attr,
@@ -740,7 +753,7 @@ static struct attribute *per_bond_attrs[] = {
&dev_attr_primary.attr,
&dev_attr_primary_reselect.attr,
&dev_attr_use_carrier.attr,
- &dev_attr_active_slave.attr,
+ &dev_attr_active_link.attr,
&dev_attr_mii_status.attr,
&dev_attr_ad_aggregator.attr,
&dev_attr_ad_num_ports.attr,
@@ -748,15 +761,22 @@ static struct attribute *per_bond_attrs[] = {
&dev_attr_ad_partner_key.attr,
&dev_attr_ad_partner_mac.attr,
&dev_attr_queue_id.attr,
- &dev_attr_all_slaves_active.attr,
+ &dev_attr_all_links_active.attr,
&dev_attr_resend_igmp.attr,
&dev_attr_min_links.attr,
&dev_attr_lp_interval.attr,
- &dev_attr_packets_per_slave.attr,
+ &dev_attr_packets_per_link.attr,
&dev_attr_tlb_dynamic_lb.attr,
&dev_attr_ad_actor_sys_prio.attr,
&dev_attr_ad_actor_system.attr,
&dev_attr_ad_user_port_key.attr,
+/* legacy sysfs interface names */
+ &dev_attr_slaves.attr,
+ &dev_attr_active_slave.attr,
+ &dev_attr_all_slaves_active.attr,
+ &dev_attr_min_slaves.attr,
+ &dev_attr_packets_per_slave.attr,
+/* end legacy sysfs interface names */
NULL,
};
diff --git a/drivers/net/bonding/bond_sysfs_link.c b/drivers/net/bonding/bond_sysfs_link.c
new file mode 100644
index 000000000000..595db312df10
--- /dev/null
+++ b/drivers/net/bonding/bond_sysfs_link.c
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Sysfs attributes of bond links
+ *
+ * Copyright (c) 2014 Scott Feldman <sfeldma@...ulusnetworks.com>
+ */
+
+#include <linux/capability.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+
+#include <net/bonding.h>
+
+struct link_attribute {
+ struct attribute attr;
+ ssize_t (*show)(struct link *, char *);
+};
+
+#define LINK_ATTR(_name, _mode, _show) \
+const struct link_attribute link_attr_##_name = { \
+ .attr = {.name = __stringify(_name), \
+ .mode = _mode }, \
+ .show = _show, \
+};
+#define LINK_ATTR_RO(_name) \
+ LINK_ATTR(_name, 0444, _name##_show)
+
+static ssize_t state_show(struct link *link, char *buf)
+{
+ switch (bond_link_state(link)) {
+ case BOND_STATE_ACTIVE:
+ return sprintf(buf, "active\n");
+ case BOND_STATE_BACKUP:
+ return sprintf(buf, "backup\n");
+ default:
+ return sprintf(buf, "UNKNOWN\n");
+ }
+}
+static LINK_ATTR_RO(state);
+
+static ssize_t mii_status_show(struct link *link, char *buf)
+{
+ return sprintf(buf, "%s\n", bond_link_status(link->link_state));
+}
+static LINK_ATTR_RO(mii_status);
+
+static ssize_t link_failure_count_show(struct link *link, char *buf)
+{
+ return sprintf(buf, "%d\n", link->link_failure_count);
+}
+static LINK_ATTR_RO(link_failure_count);
+/* legacy sysfs interface */
+static LINK_ATTR(slave_failure_count, 0444, link_failure_count_show);
+
+static ssize_t perm_hwaddr_show(struct link *link, char *buf)
+{
+ return sprintf(buf, "%*phC\n",
+ link->dev->addr_len,
+ link->perm_hwaddr);
+}
+static LINK_ATTR_RO(perm_hwaddr);
+
+static ssize_t queue_id_show(struct link *link, char *buf)
+{
+ return sprintf(buf, "%d\n", link->queue_id);
+}
+static LINK_ATTR_RO(queue_id);
+
+static ssize_t ad_aggregator_id_show(struct link *link, char *buf)
+{
+ const struct aggregator *agg;
+
+ if (BOND_MODE(link->bond) == BOND_MODE_8023AD) {
+ agg = LINK_AD_INFO(link)->port.aggregator;
+ if (agg)
+ return sprintf(buf, "%d\n",
+ agg->aggregator_identifier);
+ }
+
+ return sprintf(buf, "N/A\n");
+}
+static LINK_ATTR_RO(ad_aggregator_id);
+
+static ssize_t ad_actor_oper_port_state_show(struct link *link, char *buf)
+{
+ const struct port *ad_port;
+
+ if (BOND_MODE(link->bond) == BOND_MODE_8023AD) {
+ ad_port = &LINK_AD_INFO(link)->port;
+ if (ad_port->aggregator)
+ return sprintf(buf, "%u\n",
+ ad_port->actor_oper_port_state);
+ }
+
+ return sprintf(buf, "N/A\n");
+}
+static LINK_ATTR_RO(ad_actor_oper_port_state);
+
+static ssize_t ad_partner_oper_port_state_show(struct link *link, char *buf)
+{
+ const struct port *ad_port;
+
+ if (BOND_MODE(link->bond) == BOND_MODE_8023AD) {
+ ad_port = &LINK_AD_INFO(link)->port;
+ if (ad_port->aggregator)
+ return sprintf(buf, "%u\n",
+ ad_port->partner_oper.port_state);
+ }
+
+ return sprintf(buf, "N/A\n");
+}
+static LINK_ATTR_RO(ad_partner_oper_port_state);
+
+static const struct link_attribute *link_attrs[] = {
+ &link_attr_state,
+ &link_attr_mii_status,
+ &link_attr_link_failure_count,
+ &link_attr_perm_hwaddr,
+ &link_attr_queue_id,
+ &link_attr_ad_aggregator_id,
+ &link_attr_ad_actor_oper_port_state,
+ &link_attr_ad_partner_oper_port_state,
+/* legacy sysfs interface */
+ &link_attr_slave_failure_count,
+ NULL
+};
+
+#define to_link_attr(_at) container_of(_at, struct link_attribute, attr)
+#define to_link(obj) container_of(obj, struct link, kobj)
+
+static ssize_t link_show(struct kobject *kobj,
+ struct attribute *attr, char *buf)
+{
+ struct link_attribute *link_attr = to_link_attr(attr);
+ struct link *link = to_link(kobj);
+
+ return link_attr->show(link, buf);
+}
+
+static const struct sysfs_ops link_sysfs_ops = {
+ .show = link_show,
+};
+
+static struct kobj_type link_ktype = {
+#ifdef CONFIG_SYSFS
+ .sysfs_ops = &link_sysfs_ops,
+#endif
+};
+
+int bond_sysfs_link_add(struct link *link)
+{
+ const struct link_attribute **a;
+ int err;
+
+ err = kobject_init_and_add(&link->kobj, &link_ktype,
+ &(link->dev->dev.kobj), "bonding_link");
+ if (err)
+ goto err_kobject_put;
+
+/* legacy sysfs interface */
+ err = sysfs_create_link(&(link->dev->dev.kobj), &link->kobj,
+ "bonding_slave");
+ if (err)
+ goto err_kobject_put;
+
+ for (a = link_attrs; *a; ++a) {
+ err = sysfs_create_file(&link->kobj, &((*a)->attr));
+ if (err)
+ goto err_kobject_put;
+ }
+
+ return 0;
+
+err_kobject_put:
+ kobject_put(&link->kobj);
+ return err;
+}
+
+void bond_sysfs_link_del(struct link *link)
+{
+ const struct link_attribute **a;
+
+ for (a = link_attrs; *a; ++a)
+ sysfs_remove_file(&link->kobj, &((*a)->attr));
+
+/* legacy sysfs interface */
+ sysfs_remove_link(&(link->dev->dev.kobj), "bonding_slave");
+
+ kobject_put(&link->kobj);
+}
diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
deleted file mode 100644
index d462c0ea6da8..000000000000
--- a/drivers/net/bonding/bond_sysfs_slave.c
+++ /dev/null
@@ -1,176 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Sysfs attributes of bond slaves
- *
- * Copyright (c) 2014 Scott Feldman <sfeldma@...ulusnetworks.com>
- */
-
-#include <linux/capability.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-
-#include <net/bonding.h>
-
-struct slave_attribute {
- struct attribute attr;
- ssize_t (*show)(struct slave *, char *);
-};
-
-#define SLAVE_ATTR(_name, _mode, _show) \
-const struct slave_attribute slave_attr_##_name = { \
- .attr = {.name = __stringify(_name), \
- .mode = _mode }, \
- .show = _show, \
-};
-#define SLAVE_ATTR_RO(_name) \
- SLAVE_ATTR(_name, 0444, _name##_show)
-
-static ssize_t state_show(struct slave *slave, char *buf)
-{
- switch (bond_slave_state(slave)) {
- case BOND_STATE_ACTIVE:
- return sprintf(buf, "active\n");
- case BOND_STATE_BACKUP:
- return sprintf(buf, "backup\n");
- default:
- return sprintf(buf, "UNKNOWN\n");
- }
-}
-static SLAVE_ATTR_RO(state);
-
-static ssize_t mii_status_show(struct slave *slave, char *buf)
-{
- return sprintf(buf, "%s\n", bond_slave_link_status(slave->link_state));
-}
-static SLAVE_ATTR_RO(mii_status);
-
-static ssize_t link_failure_count_show(struct slave *slave, char *buf)
-{
- return sprintf(buf, "%d\n", slave->link_failure_count);
-}
-static SLAVE_ATTR_RO(link_failure_count);
-
-static ssize_t perm_hwaddr_show(struct slave *slave, char *buf)
-{
- return sprintf(buf, "%*phC\n",
- slave->dev->addr_len,
- slave->perm_hwaddr);
-}
-static SLAVE_ATTR_RO(perm_hwaddr);
-
-static ssize_t queue_id_show(struct slave *slave, char *buf)
-{
- return sprintf(buf, "%d\n", slave->queue_id);
-}
-static SLAVE_ATTR_RO(queue_id);
-
-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;
- if (agg)
- return sprintf(buf, "%d\n",
- agg->aggregator_identifier);
- }
-
- return sprintf(buf, "N/A\n");
-}
-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;
-
- if (BOND_MODE(slave->bond) == BOND_MODE_8023AD) {
- ad_port = &SLAVE_AD_INFO(slave)->port;
- if (ad_port->aggregator)
- return sprintf(buf, "%u\n",
- ad_port->actor_oper_port_state);
- }
-
- return sprintf(buf, "N/A\n");
-}
-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;
-
- if (BOND_MODE(slave->bond) == BOND_MODE_8023AD) {
- ad_port = &SLAVE_AD_INFO(slave)->port;
- if (ad_port->aggregator)
- return sprintf(buf, "%u\n",
- ad_port->partner_oper.port_state);
- }
-
- return sprintf(buf, "N/A\n");
-}
-static SLAVE_ATTR_RO(ad_partner_oper_port_state);
-
-static const struct slave_attribute *slave_attrs[] = {
- &slave_attr_state,
- &slave_attr_mii_status,
- &slave_attr_link_failure_count,
- &slave_attr_perm_hwaddr,
- &slave_attr_queue_id,
- &slave_attr_ad_aggregator_id,
- &slave_attr_ad_actor_oper_port_state,
- &slave_attr_ad_partner_oper_port_state,
- NULL
-};
-
-#define to_slave_attr(_at) container_of(_at, struct slave_attribute, attr)
-#define to_slave(obj) container_of(obj, struct slave, kobj)
-
-static ssize_t slave_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
-{
- struct slave_attribute *slave_attr = to_slave_attr(attr);
- struct slave *slave = to_slave(kobj);
-
- return slave_attr->show(slave, buf);
-}
-
-static const struct sysfs_ops slave_sysfs_ops = {
- .show = slave_show,
-};
-
-static struct kobj_type slave_ktype = {
-#ifdef CONFIG_SYSFS
- .sysfs_ops = &slave_sysfs_ops,
-#endif
-};
-
-int bond_sysfs_slave_add(struct slave *slave)
-{
- const struct slave_attribute **a;
- int err;
-
- err = kobject_init_and_add(&slave->kobj, &slave_ktype,
- &(slave->dev->dev.kobj), "bonding_slave");
- if (err) {
- kobject_put(&slave->kobj);
- return err;
- }
-
- for (a = slave_attrs; *a; ++a) {
- err = sysfs_create_file(&slave->kobj, &((*a)->attr));
- if (err) {
- kobject_put(&slave->kobj);
- return err;
- }
- }
-
- return 0;
-}
-
-void bond_sysfs_slave_del(struct slave *slave)
-{
- const struct slave_attribute **a;
-
- for (a = slave_attrs; *a; ++a)
- sysfs_remove_file(&slave->kobj, &((*a)->attr));
-
- kobject_put(&slave->kobj);
-}
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
index 84604aff53ce..cc665bb7b601 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
@@ -186,7 +186,7 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,
rcu_read_lock();
if (vlan && vlan != VLAN_VID_MASK) {
dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), vlan);
- } else if (netif_is_bond_slave(dev)) {
+ } else if (netif_is_bond_link(dev)) {
struct net_device *upper_dev;
while ((upper_dev =
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 106513f772c3..4b020be00b89 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2998,7 +2998,7 @@ int mlx4_en_netdev_event(struct notifier_block *this,
/* in active-backup mode virtual ports are
* mapped to the physical port of the active
* slave */
- if (bonding_info->slave.state ==
+ if (bonding_info->link.state ==
BOND_STATE_BACKUP) {
if (port == 1) {
v2p_port1 = 2;
@@ -3020,7 +3020,7 @@ int mlx4_en_netdev_event(struct notifier_block *this,
/* in active-active mode a virtual port is
* mapped to the native physical port if and only
* if the physical port is up */
- __s8 link = bonding_info->slave.link;
+ __s8 link = bonding_info->link.link;
if (port == 1)
v2p_port2 = 2;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c
index 3e44e4d820c5..a240aaeed3f8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c
@@ -187,7 +187,7 @@ static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev)
struct mlx5e_priv *priv;
/* A given netdev is not a representor or not a slave of LAG configuration */
- if (!mlx5e_eswitch_rep(netdev) || !bond_slave_get_rtnl(netdev))
+ if (!mlx5e_eswitch_rep(netdev) || !bond_link_get_rtnl(netdev))
return false;
priv = netdev_priv(netdev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 817c503693fc..f884a41c55ec 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -3723,7 +3723,7 @@ static struct net_device *get_fdb_out_dev(struct net_device *uplink_dev,
uplink_upper == out_dev) {
fdb_out_dev = uplink_dev;
} else if (netif_is_lag_master(out_dev)) {
- fdb_out_dev = bond_option_active_slave_get_rcu(netdev_priv(out_dev));
+ fdb_out_dev = bond_option_active_link_get_rcu(netdev_priv(out_dev));
if (fdb_out_dev &&
(!mlx5e_eswitch_rep(fdb_out_dev) ||
!netdev_port_same_parent_id(fdb_out_dev, uplink_dev)))
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index f21847739ef1..8b7fc71dc9c7 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -3318,12 +3318,12 @@ static void netxen_config_master(struct net_device *dev, unsigned long event)
master = netdev_master_upper_dev_get_rcu(dev);
/*
* This is the case where the netxen nic is being
- * enslaved and is dev_open()ed in bond_enslave()
+ * enslaved and is dev_open()ed in bond_connect()
* Now we should program the bond's (and its vlans')
* addresses in the netxen NIC.
*/
if (master && netif_is_bond_master(master) &&
- !netif_is_bond_slave(dev)) {
+ !netif_is_bond_link(dev)) {
netxen_config_indev_addr(adapter, master, event);
for_each_netdev_rcu(&init_net, slave)
if (is_vlan_dev(slave) &&
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 909b1fbb0481..c55dc38709f6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1497,7 +1497,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 master or link
* @IFF_ISATAP: ISATAP interface (RFC4214)
* @IFF_WAN_HDLC: WAN HDLC device
* @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
@@ -1623,7 +1623,7 @@ enum netdev_priv_flags {
* @ptype_all: Device-specific packet handlers for all protocols
* @ptype_specific: Device-specific, protocol-specific packet handlers
*
- * @adj_list: Directly linked devices, like slaves for bonding
+ * @adj_list: Directly linked devices, like links for bonding
* @features: Currently active device features
* @hw_features: User-changeable features
*
@@ -2717,9 +2717,9 @@ extern rwlock_t dev_base_lock; /* Device list lock */
dev_list)
#define for_each_netdev_continue_rcu(net, d) \
list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
-#define for_each_netdev_in_bond_rcu(bond, slave) \
- for_each_netdev_rcu(&init_net, slave) \
- if (netdev_master_upper_dev_get_rcu(slave) == (bond))
+#define for_each_netdev_in_bond_rcu(bond, link) \
+ for_each_netdev_rcu(&init_net, link) \
+ if (netdev_master_upper_dev_get_rcu(link) == (bond))
#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
static inline struct net_device *next_net_device(struct net_device *dev)
@@ -4577,7 +4577,7 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
netdev_features_t features);
struct netdev_bonding_info {
- ifslave slave;
+ ifslave link;
ifbond master;
};
@@ -4807,7 +4807,7 @@ static inline bool netif_is_bond_master(const struct net_device *dev)
return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
}
-static inline bool netif_is_bond_slave(const struct net_device *dev)
+static inline bool netif_is_bond_link(const struct net_device *dev)
{
return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
}
@@ -4874,7 +4874,7 @@ static inline bool netif_is_lag_master(const struct net_device *dev)
static inline bool netif_is_lag_port(const struct net_device *dev)
{
- return netif_is_bond_slave(dev) || netif_is_team_port(dev);
+ return netif_is_bond_link(dev) || netif_is_team_port(dev);
}
static inline bool netif_is_rxfh_configured(const struct net_device *dev)
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
index 7a3e79f106a7..a8b26716a681 100644
--- a/include/net/bond_3ad.h
+++ b/include/net/bond_3ad.h
@@ -154,7 +154,7 @@ typedef struct bond_marker_header {
#pragma pack()
-struct slave;
+struct link;
struct bonding;
struct ad_info;
struct port;
@@ -190,7 +190,7 @@ typedef struct aggregator {
u16 transmit_state; /* BOOLEAN */
struct port *lag_ports;
/* ****** PRIVATE PARAMETERS ****** */
- struct slave *slave; /* pointer to the bond slave that this aggregator belongs to */
+ struct link *link; /* pointer to the bond link that this aggregator belongs to */
u16 is_active; /* BOOLEAN. Indicates if this aggregator is active */
u16 num_of_ports;
} aggregator_t;
@@ -238,7 +238,7 @@ typedef struct port {
u32 churn_partner_count;
churn_state_t sm_churn_actor_state;
churn_state_t sm_churn_partner_state;
- struct slave *slave; /* pointer to the bond slave that this port belongs to */
+ struct link *link; /* pointer to the bond link 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 */
u32 transaction_id; /* continuous number for identification of Marker PDU's; */
@@ -257,7 +257,7 @@ struct ad_system {
/* ========== AD Exported structures to the main bonding code ========== */
#define BOND_AD_INFO(bond) ((bond)->ad_info)
-#define SLAVE_AD_INFO(slave) ((slave)->ad_info)
+#define LINK_AD_INFO(link) ((link)->ad_info)
struct ad_bond_info {
struct ad_system system; /* 802.3ad system structure */
@@ -266,7 +266,7 @@ struct ad_bond_info {
u16 aggregator_identifier;
};
-struct ad_slave_info {
+struct ad_link_info {
struct aggregator aggregator; /* 802.3ad aggregator structure */
struct port port; /* 802.3ad port structure */
struct bond_3ad_stats stats;
@@ -291,17 +291,17 @@ static inline const char *bond_3ad_churn_desc(churn_state_t state)
/* ========== AD Exported functions to the main bonding code ========== */
void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution);
-void bond_3ad_bind_slave(struct slave *slave);
-void bond_3ad_unbind_slave(struct slave *slave);
+void bond_3ad_bind_link(struct link *link);
+void bond_3ad_unbind_link(struct link *link);
void bond_3ad_state_machine_handler(struct work_struct *);
void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout);
-void bond_3ad_adapter_speed_duplex_changed(struct slave *slave);
-void bond_3ad_handle_link_change(struct slave *slave, char link_state);
+void bond_3ad_adapter_speed_duplex_changed(struct link *link);
+void bond_3ad_handle_link_change(struct link *link, char link_state);
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
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 link *link);
int bond_3ad_set_carrier(struct bonding *bond);
void bond_3ad_update_lacp_rate(struct bonding *bond);
void bond_3ad_update_ad_actor_settings(struct bonding *bond);
diff --git a/include/net/bond_alb.h b/include/net/bond_alb.h
index 665037f421f5..e5fdad063e0b 100644
--- a/include/net/bond_alb.h
+++ b/include/net/bond_alb.h
@@ -9,10 +9,10 @@
#include <linux/if_ether.h>
struct bonding;
-struct slave;
+struct link;
#define BOND_ALB_INFO(bond) ((bond)->alb_info)
-#define SLAVE_TLB_INFO(slave) ((slave)->tlb_info)
+#define LINK_TLB_INFO(link) ((link)->tlb_info)
#define ALB_TIMER_TICKS_PER_SEC 10 /* should be a divisor of HZ */
#define BOND_TLB_REBALANCE_INTERVAL 10 /* In seconds, periodic re-balancing.
@@ -46,14 +46,14 @@ struct slave;
#define RLB_UPDATE_RETRY 3 /* 3-ticks - must be smaller than the rlb
* rebalance interval (5 min).
*/
-/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
+/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current link is
* promiscuous after failover
*/
#define RLB_PROMISC_TIMEOUT (10*ALB_TIMER_TICKS_PER_SEC)
struct tlb_client_info {
- struct slave *tx_slave; /* A pointer to slave used for transmiting
+ struct link *tx_link; /* A pointer to link used for transmiting
* packets to a Client that the Hash function
* gave this entry index.
*/
@@ -108,17 +108,17 @@ struct rlb_client_info {
u8 assigned; /* checking whether this entry is assigned */
u8 ntt; /* flag - need to transmit client info */
- struct slave *slave; /* the slave assigned to this client */
+ struct link *link; /* the link assigned to this client */
unsigned short vlan_id; /* VLAN tag associated with IP address */
};
-struct tlb_slave_info {
+struct tlb_link_info {
u32 head; /* Index to the head of the bi-directional clients
* hash table entries list. The entries in the list
* are the entries that were assigned to use this
- * slave for transmit.
+ * link for transmit.
*/
- u32 load; /* Each slave sums the loadHistory of all clients
+ u32 load; /* Each link sums the loadHistory of all clients
* assigned to it
*/
};
@@ -135,7 +135,7 @@ struct alb_bond_info {
u8 rx_ntt; /* flag - need to transmit
* to all rx clients
*/
- struct slave *rx_slave;/* last slave to xmit from */
+ struct link *rx_link;/* last link to xmit from */
u8 primary_is_promisc; /* boolean */
u32 rlb_promisc_timeout_counter;/* counts primary
* promiscuity time
@@ -152,16 +152,16 @@ struct alb_bond_info {
int bond_alb_initialize(struct bonding *bond, int rlb_enabled);
void bond_alb_deinitialize(struct bonding *bond);
-int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
-void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
-void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave,
+int bond_alb_init_link(struct bonding *bond, struct link *link);
+void bond_alb_deinit_link(struct bonding *bond, struct link *link);
+void bond_alb_handle_link_change(struct bonding *bond, struct link *link,
char link_state);
-void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave);
+void bond_alb_handle_active_change(struct bonding *bond, struct link *new_link);
int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
int bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
-struct slave *bond_xmit_alb_slave_get(struct bonding *bond,
+struct link *bond_xmit_alb_link_get(struct bonding *bond,
struct sk_buff *skb);
-struct slave *bond_xmit_tlb_slave_get(struct bonding *bond,
+struct link *bond_xmit_tlb_link_get(struct bonding *bond,
struct sk_buff *skb);
void bond_alb_monitor(struct work_struct *);
int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr);
diff --git a/include/net/bond_options.h b/include/net/bond_options.h
index 9d382f2f0bc5..2c2e4a94bdc2 100644
--- a/include/net/bond_options.h
+++ b/include/net/bond_options.h
@@ -12,12 +12,12 @@
#define BOND_MODE_ALL_EX(x) (~(x))
/* Option flags:
- * BOND_OPTFLAG_NOSLAVES - check if the bond device is empty before setting
+ * BOND_OPTFLAG_NOLINKS - check if the bond device is empty before setting
* BOND_OPTFLAG_IFDOWN - check if the bond device is down before setting
* BOND_OPTFLAG_RAWVAL - the option parses the value itself
*/
enum {
- BOND_OPTFLAG_NOSLAVES = BIT(0),
+ BOND_OPTFLAG_NOLINKS = BIT(0),
BOND_OPTFLAG_IFDOWN = BIT(1),
BOND_OPTFLAG_RAWVAL = BIT(2)
};
@@ -35,7 +35,7 @@ enum {
/* Option IDs, their bit positions correspond to their IDs */
enum {
BOND_OPT_MODE,
- BOND_OPT_PACKETS_PER_SLAVE,
+ BOND_OPT_PACKETS_PER_LINK,
BOND_OPT_XMIT_HASH,
BOND_OPT_ARP_VALIDATE,
BOND_OPT_ARP_ALL_TARGETS,
@@ -52,18 +52,25 @@ enum {
BOND_OPT_PRIMARY,
BOND_OPT_PRIMARY_RESELECT,
BOND_OPT_USE_CARRIER,
- BOND_OPT_ACTIVE_SLAVE,
+ BOND_OPT_ACTIVE_LINK,
BOND_OPT_QUEUE_ID,
- BOND_OPT_ALL_SLAVES_ACTIVE,
+ BOND_OPT_ALL_LINKS_ACTIVE,
BOND_OPT_RESEND_IGMP,
BOND_OPT_LP_INTERVAL,
- BOND_OPT_SLAVES,
+ BOND_OPT_LINKS,
BOND_OPT_TLB_DYNAMIC_LB,
BOND_OPT_AD_ACTOR_SYS_PRIO,
BOND_OPT_AD_ACTOR_SYSTEM,
BOND_OPT_AD_USER_PORT_KEY,
BOND_OPT_NUM_PEER_NOTIF_ALIAS,
BOND_OPT_PEER_NOTIF_DELAY,
+/* legacy sysfs interface names */
+ BOND_OPT_PACKETS_PER_SLAVE,
+ BOND_OPT_MINSLAVES,
+ BOND_OPT_ACTIVE_SLAVE,
+ BOND_OPT_ALL_SLAVES_ACTIVE,
+ BOND_OPT_SLAVES,
+/* end legacy sysfs interface names */
BOND_OPT_LAST
};
diff --git a/include/net/bonding.h b/include/net/bonding.h
index a753f0282d73..a23f6e5a6d87 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -38,52 +38,52 @@
#define __long_aligned __attribute__((aligned((sizeof(long)))))
#endif
-#define slave_info(bond_dev, slave_dev, fmt, ...) \
- netdev_info(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
-#define slave_warn(bond_dev, slave_dev, fmt, ...) \
- netdev_warn(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
-#define slave_dbg(bond_dev, slave_dev, fmt, ...) \
- netdev_dbg(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
-#define slave_err(bond_dev, slave_dev, fmt, ...) \
- netdev_err(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
+#define link_info(bond_dev, link_dev, fmt, ...) \
+ netdev_info(bond_dev, "(link %s): " fmt, (link_dev)->name, ##__VA_ARGS__)
+#define link_warn(bond_dev, link_dev, fmt, ...) \
+ netdev_warn(bond_dev, "(link %s): " fmt, (link_dev)->name, ##__VA_ARGS__)
+#define link_dbg(bond_dev, link_dev, fmt, ...) \
+ netdev_dbg(bond_dev, "(link %s): " fmt, (link_dev)->name, ##__VA_ARGS__)
+#define link_err(bond_dev, link_dev, fmt, ...) \
+ netdev_err(bond_dev, "(link %s): " fmt, (link_dev)->name, ##__VA_ARGS__)
#define BOND_MODE(bond) ((bond)->params.mode)
-/* slave list primitives */
-#define bond_slave_list(bond) (&(bond)->dev->adj_list.lower)
+/* link list primitives */
+#define bond_link_list(bond) (&(bond)->dev->adj_list.lower)
-#define bond_has_slaves(bond) !list_empty(bond_slave_list(bond))
+#define bond_has_links(bond) !list_empty(bond_link_list(bond))
-/* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */
-#define bond_first_slave(bond) \
- (bond_has_slaves(bond) ? \
- netdev_adjacent_get_private(bond_slave_list(bond)->next) : \
+/* IMPORTANT: bond_first/last_link can return NULL in case of an empty list */
+#define bond_first_link(bond) \
+ (bond_has_links(bond) ? \
+ netdev_adjacent_get_private(bond_link_list(bond)->next) : \
NULL)
-#define bond_last_slave(bond) \
- (bond_has_slaves(bond) ? \
- netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \
+#define bond_last_link(bond) \
+ (bond_has_links(bond) ? \
+ netdev_adjacent_get_private(bond_link_list(bond)->prev) : \
NULL)
/* Caller must have rcu_read_lock */
-#define bond_first_slave_rcu(bond) \
+#define bond_first_link_rcu(bond) \
netdev_lower_get_first_private_rcu(bond->dev)
-#define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond))
-#define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond))
+#define bond_is_first_link(bond, pos) (pos == bond_first_link(bond))
+#define bond_is_last_link(bond, pos) (pos == bond_last_link(bond))
/**
- * bond_for_each_slave - iterate over all slaves
+ * bond_for_each_link - iterate over all links
* @bond: the bond holding this list
- * @pos: current slave
+ * @pos: current link
* @iter: list_head * iterator
*
* Caller must hold RTNL
*/
-#define bond_for_each_slave(bond, pos, iter) \
+#define bond_for_each_link(bond, pos, iter) \
netdev_for_each_lower_private((bond)->dev, pos, iter)
/* Caller must have rcu_read_lock */
-#define bond_for_each_slave_rcu(bond, pos, iter) \
+#define bond_for_each_link_rcu(bond, pos, iter) \
netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
#ifdef CONFIG_XFRM_OFFLOAD
@@ -136,12 +136,12 @@ struct bond_params {
int primary_reselect;
__be32 arp_targets[BOND_MAX_ARP_TARGETS];
int tx_queues;
- int all_slaves_active;
+ int all_links_active;
int resend_igmp;
int lp_interval;
- int packets_per_slave;
+ int packets_per_link;
int tlb_dynamic_lb;
- struct reciprocal_value reciprocal_packets_per_slave;
+ struct reciprocal_value reciprocal_packets_per_link;
u16 ad_actor_sys_prio;
u16 ad_user_port_key;
@@ -154,7 +154,7 @@ struct bond_parm_tbl {
int mode;
};
-struct slave {
+struct link {
struct net_device *dev; /* first - useful for panic debug */
struct bonding *bond; /* our master */
int delay;
@@ -164,9 +164,9 @@ struct slave {
unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
s8 link_state; /* one of BOND_LINK_XXXX */
s8 link_new_state; /* one of BOND_LINK_XXXX */
- u8 backup:1, /* indicates backup slave. Value corresponds with
+ u8 backup:1, /* indicates backup link. Value corresponds with
BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
- inactive:1, /* indicates inactive slave */
+ inactive:1, /* indicates inactive link */
should_notify:1, /* indicates whether the state changed */
should_notify_link:1; /* indicates whether the link changed */
u8 duplex;
@@ -175,20 +175,20 @@ struct slave {
u32 speed;
u16 queue_id;
u8 perm_hwaddr[MAX_ADDR_LEN];
- struct ad_slave_info *ad_info;
- struct tlb_slave_info tlb_info;
+ struct ad_link_info *ad_info;
+ struct tlb_link_info tlb_info;
#ifdef CONFIG_NET_POLL_CONTROLLER
struct netpoll *np;
#endif
struct delayed_work notify_work;
struct kobject kobj;
- struct rtnl_link_stats64 slave_stats;
+ struct rtnl_link_stats64 link_stats;
};
-struct bond_up_slave {
+struct bond_up_link {
unsigned int count;
struct rcu_head rcu;
- struct slave *arr[];
+ struct link *arr[];
};
/*
@@ -198,21 +198,21 @@ struct bond_up_slave {
/*
* Here are the locking policies for the two bonding locks:
- * Get rcu_read_lock when reading or RTNL when writing slave list.
+ * Get rcu_read_lock when reading or RTNL when writing link list.
*/
struct bonding {
struct net_device *dev; /* first - useful for panic debug */
- struct slave __rcu *curr_active_slave;
- struct slave __rcu *current_arp_slave;
- struct slave __rcu *primary_slave;
- struct bond_up_slave __rcu *usable_slaves;
- struct bond_up_slave __rcu *all_slaves;
+ struct link __rcu *curr_active_link;
+ struct link __rcu *current_arp_link;
+ struct link __rcu *primary_link;
+ struct bond_up_link __rcu *usable_links;
+ struct bond_up_link __rcu *all_links;
bool force_primary;
- s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
+ s32 link_cnt; /* never change this value outside the attach/detach wrappers */
int (*recv_probe)(const struct sk_buff *, struct bonding *,
- struct slave *);
+ struct link *);
/* mode_lock is used for mode-specific locking needs, currently used by:
- * 3ad mode (4) - protect against running bond_3ad_unbind_slave() and
+ * 3ad mode (4) - protect against running bond_3ad_unbind_link() and
* bond_3ad_state_machine_handler() concurrently and also
* the access to the state machine shared variables.
* TLB mode (5) - to sync the use and modifications of its hash table
@@ -237,7 +237,7 @@ struct bonding {
struct delayed_work alb_work;
struct delayed_work ad_work;
struct delayed_work mcast_work;
- struct delayed_work slave_arr_work;
+ struct delayed_work link_arr_work;
#ifdef CONFIG_DEBUG_FS
/* debugging support via debugfs */
struct dentry *debug_dir;
@@ -248,14 +248,14 @@ struct bonding {
#endif /* CONFIG_XFRM_OFFLOAD */
};
-#define bond_slave_get_rcu(dev) \
- ((struct slave *) rcu_dereference(dev->rx_handler_data))
+#define bond_link_get_rcu(dev) \
+ ((struct link *) rcu_dereference(dev->rx_handler_data))
-#define bond_slave_get_rtnl(dev) \
- ((struct slave *) rtnl_dereference(dev->rx_handler_data))
+#define bond_link_get_rtnl(dev) \
+ ((struct link *) rtnl_dereference(dev->rx_handler_data))
-void bond_queue_slave_event(struct slave *slave);
-void bond_lower_state_changed(struct slave *slave);
+void bond_queue_link_event(struct link *link);
+void bond_lower_state_changed(struct link *link);
struct bond_vlan_tag {
__be16 vlan_proto;
@@ -263,19 +263,19 @@ struct bond_vlan_tag {
};
/**
- * Returns NULL if the net_device does not belong to any of the bond's slaves
+ * Returns NULL if the net_device does not belong to any of the bond's links
*
* Caller must hold bond lock for read
*/
-static inline struct slave *bond_get_slave_by_dev(struct bonding *bond,
- struct net_device *slave_dev)
+static inline struct link *bond_get_link_by_dev(struct bonding *bond,
+ struct net_device *link_dev)
{
- return netdev_lower_dev_get_private(bond->dev, slave_dev);
+ return netdev_lower_dev_get_private(bond->dev, link_dev);
}
-static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
+static inline struct bonding *bond_get_bond_by_link(struct link *link)
{
- return slave->bond;
+ return link->bond;
}
static inline bool bond_should_override_tx_queue(struct bonding *bond)
@@ -332,74 +332,74 @@ static inline bool bond_uses_primary(struct bonding *bond)
return bond_mode_uses_primary(BOND_MODE(bond));
}
-static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond)
+static inline struct net_device *bond_option_active_link_get_rcu(struct bonding *bond)
{
- struct slave *slave = rcu_dereference(bond->curr_active_slave);
+ struct link *link = rcu_dereference(bond->curr_active_link);
- return bond_uses_primary(bond) && slave ? slave->dev : NULL;
+ return bond_uses_primary(bond) && link ? link->dev : NULL;
}
-static inline bool bond_slave_is_up(struct slave *slave)
+static inline bool bond_link_is_up(struct link *link)
{
- return netif_running(slave->dev) && netif_carrier_ok(slave->dev);
+ return netif_running(link->dev) && netif_carrier_ok(link->dev);
}
-static inline void bond_set_active_slave(struct slave *slave)
+static inline void bond_set_active_link(struct link *link)
{
- if (slave->backup) {
- slave->backup = 0;
- bond_queue_slave_event(slave);
- bond_lower_state_changed(slave);
+ if (link->backup) {
+ link->backup = 0;
+ bond_queue_link_event(link);
+ bond_lower_state_changed(link);
}
}
-static inline void bond_set_backup_slave(struct slave *slave)
+static inline void bond_set_backup_link(struct link *link)
{
- if (!slave->backup) {
- slave->backup = 1;
- bond_queue_slave_event(slave);
- bond_lower_state_changed(slave);
+ if (!link->backup) {
+ link->backup = 1;
+ bond_queue_link_event(link);
+ bond_lower_state_changed(link);
}
}
-static inline void bond_set_slave_state(struct slave *slave,
- int slave_state, bool notify)
+static inline void bond_set_active_link_state(struct link *link,
+ int link_state, bool notify)
{
- if (slave->backup == slave_state)
+ if (link->backup == link_state)
return;
- slave->backup = slave_state;
+ link->backup = link_state;
if (notify) {
- bond_lower_state_changed(slave);
- bond_queue_slave_event(slave);
- slave->should_notify = 0;
+ bond_lower_state_changed(link);
+ bond_queue_link_event(link);
+ link->should_notify = 0;
} else {
- if (slave->should_notify)
- slave->should_notify = 0;
+ if (link->should_notify)
+ link->should_notify = 0;
else
- slave->should_notify = 1;
+ link->should_notify = 1;
}
}
-static inline void bond_slave_state_change(struct bonding *bond)
+static inline void bond_link_state_change(struct bonding *bond)
{
struct list_head *iter;
- struct slave *tmp;
+ struct link *tmp;
- bond_for_each_slave(bond, tmp, iter) {
+ bond_for_each_link(bond, tmp, iter) {
if (tmp->link_state == BOND_LINK_UP)
- bond_set_active_slave(tmp);
+ bond_set_active_link(tmp);
else if (tmp->link_state == BOND_LINK_DOWN)
- bond_set_backup_slave(tmp);
+ bond_set_backup_link(tmp);
}
}
-static inline void bond_slave_state_notify(struct bonding *bond)
+static inline void bond_link_state_notify(struct bonding *bond)
{
struct list_head *iter;
- struct slave *tmp;
+ struct link *tmp;
- bond_for_each_slave(bond, tmp, iter) {
+ bond_for_each_link(bond, tmp, iter) {
if (tmp->should_notify) {
bond_lower_state_changed(tmp);
tmp->should_notify = 0;
@@ -407,30 +407,30 @@ static inline void bond_slave_state_notify(struct bonding *bond)
}
}
-static inline int bond_slave_state(struct slave *slave)
+static inline int bond_link_state(struct link *link)
{
- return slave->backup;
+ return link->backup;
}
-static inline bool bond_is_active_slave(struct slave *slave)
+static inline bool bond_is_active_link(struct link *link)
{
- return !bond_slave_state(slave);
+ return !bond_link_state(link);
}
-static inline bool bond_slave_can_tx(struct slave *slave)
+static inline bool bond_link_can_tx(struct link *link)
{
- return bond_slave_is_up(slave) && slave->link_state == BOND_LINK_UP &&
- bond_is_active_slave(slave);
+ return bond_link_is_up(link) && link->link_state == BOND_LINK_UP &&
+ bond_is_active_link(link);
}
-static inline bool bond_is_active_slave_dev(const struct net_device *slave_dev)
+static inline bool bond_is_active_link_dev(const struct net_device *link_dev)
{
- struct slave *slave;
+ struct link *link;
bool active;
rcu_read_lock();
- slave = bond_slave_get_rcu(slave_dev);
- active = bond_is_active_slave(slave);
+ link = bond_link_get_rcu(link_dev);
+ active = bond_is_active_link(link);
rcu_read_unlock();
return active;
@@ -468,16 +468,16 @@ static inline void bond_hw_addr_copy(u8 *dst, const u8 *src, unsigned int len)
#define BOND_ARP_FILTER_BACKUP (BOND_ARP_VALIDATE_BACKUP | \
BOND_ARP_FILTER)
-#define BOND_SLAVE_NOTIFY_NOW true
-#define BOND_SLAVE_NOTIFY_LATER false
+#define BOND_LINK_NOTIFY_NOW true
+#define BOND_LINK_NOTIFY_LATER false
-static inline int slave_do_arp_validate(struct bonding *bond,
- struct slave *slave)
+static inline int link_do_arp_validate(struct bonding *bond,
+ struct link *link)
{
- return bond->params.arp_validate & (1 << bond_slave_state(slave));
+ return bond->params.arp_validate & (1 << bond_link_state(link));
}
-static inline int slave_do_arp_validate_only(struct bonding *bond)
+static inline int link_do_arp_validate_only(struct bonding *bond)
{
return bond->params.arp_validate & BOND_ARP_FILTER;
}
@@ -487,39 +487,39 @@ static inline int bond_is_ip_target_ok(__be32 addr)
return !ipv4_is_lbcast(addr) && !ipv4_is_zeronet(addr);
}
-/* Get the oldest arp which we've received on this slave for bond's
+/* Get the oldest arp which we've received on this link for bond's
* arp_targets.
*/
-static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
- struct slave *slave)
+static inline unsigned long link_oldest_target_arp_rx(struct bonding *bond,
+ struct link *link)
{
int i = 1;
- unsigned long ret = slave->target_last_arp_rx[0];
+ unsigned long ret = link->target_last_arp_rx[0];
for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++)
- if (time_before(slave->target_last_arp_rx[i], ret))
- ret = slave->target_last_arp_rx[i];
+ if (time_before(link->target_last_arp_rx[i], ret))
+ ret = link->target_last_arp_rx[i];
return ret;
}
-static inline unsigned long slave_last_rx(struct bonding *bond,
- struct slave *slave)
+static inline unsigned long link_last_rx(struct bonding *bond,
+ struct link *link)
{
if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
- return slave_oldest_target_arp_rx(bond, slave);
+ return link_oldest_target_arp_rx(bond, link);
- return slave->last_rx;
+ return link->last_rx;
}
#ifdef CONFIG_NET_POLL_CONTROLLER
-static inline netdev_tx_t bond_netpoll_send_skb(const struct slave *slave,
+static inline netdev_tx_t bond_netpoll_send_skb(const struct link *link,
struct sk_buff *skb)
{
- return netpoll_send_skb(slave->np, skb);
+ return netpoll_send_skb(link->np, skb);
}
#else
-static inline netdev_tx_t bond_netpoll_send_skb(const struct slave *slave,
+static inline netdev_tx_t bond_netpoll_send_skb(const struct link *link,
struct sk_buff *skb)
{
BUG();
@@ -527,65 +527,65 @@ static inline netdev_tx_t bond_netpoll_send_skb(const struct slave *slave,
}
#endif
-static inline void bond_set_slave_inactive_flags(struct slave *slave,
+static inline void bond_set_link_inactive_flags(struct link *link,
bool notify)
{
- if (!bond_is_lb(slave->bond))
- bond_set_slave_state(slave, BOND_STATE_BACKUP, notify);
- if (!slave->bond->params.all_slaves_active)
- slave->inactive = 1;
+ if (!bond_is_lb(link->bond))
+ bond_set_active_link_state(link, BOND_STATE_BACKUP, notify);
+ if (!link->bond->params.all_links_active)
+ link->inactive = 1;
}
-static inline void bond_set_slave_active_flags(struct slave *slave,
+static inline void bond_set_link_active_flags(struct link *link,
bool notify)
{
- bond_set_slave_state(slave, BOND_STATE_ACTIVE, notify);
- slave->inactive = 0;
+ bond_set_active_link_state(link, BOND_STATE_ACTIVE, notify);
+ link->inactive = 0;
}
-static inline bool bond_is_slave_inactive(struct slave *slave)
+static inline bool bond_is_link_inactive(struct link *link)
{
- return slave->inactive;
+ return link->inactive;
}
-static inline void bond_propose_link_state(struct slave *slave, int state)
+static inline void bond_propose_link_state(struct link *link, int state)
{
- slave->link_new_state = state;
+ link->link_new_state = state;
}
-static inline void bond_commit_link_state(struct slave *slave, bool notify)
+static inline void bond_commit_link_state(struct link *link, bool notify)
{
- if (slave->link_new_state == BOND_LINK_NOCHANGE)
+ if (link->link_new_state == BOND_LINK_NOCHANGE)
return;
- slave->link_state = slave->link_new_state;
+ link->link_state = link->link_new_state;
if (notify) {
- bond_queue_slave_event(slave);
- bond_lower_state_changed(slave);
- slave->should_notify_link = 0;
+ bond_queue_link_event(link);
+ bond_lower_state_changed(link);
+ link->should_notify_link = 0;
} else {
- if (slave->should_notify_link)
- slave->should_notify_link = 0;
+ if (link->should_notify_link)
+ link->should_notify_link = 0;
else
- slave->should_notify_link = 1;
+ link->should_notify_link = 1;
}
}
-static inline void bond_set_slave_link_state(struct slave *slave, int state,
- bool notify)
+static inline void bond_set_link_state(struct link *link, int state,
+ bool notify)
{
- bond_propose_link_state(slave, state);
- bond_commit_link_state(slave, notify);
+ bond_propose_link_state(link, state);
+ bond_commit_link_state(link, notify);
}
-static inline void bond_slave_link_notify(struct bonding *bond)
+static inline void bond_link_notify(struct bonding *bond)
{
struct list_head *iter;
- struct slave *tmp;
+ struct link *tmp;
- bond_for_each_slave(bond, tmp, iter) {
+ bond_for_each_link(bond, tmp, iter) {
if (tmp->should_notify_link) {
- bond_queue_slave_event(tmp);
+ bond_queue_link_event(tmp);
bond_lower_state_changed(tmp);
tmp->should_notify_link = 0;
}
@@ -616,21 +616,21 @@ struct bond_net {
struct class_attribute class_attr_bonding_masters;
};
-int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
-netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
+int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct link *link);
+netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *link_dev);
int bond_create(struct net *net, const char *name);
int bond_create_sysfs(struct bond_net *net);
void bond_destroy_sysfs(struct bond_net *net);
void bond_prepare_sysfs_group(struct bonding *bond);
-int bond_sysfs_slave_add(struct slave *slave);
-void bond_sysfs_slave_del(struct slave *slave);
-int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
+int bond_sysfs_link_add(struct link *link);
+void bond_sysfs_link_del(struct link *link);
+int bond_connect(struct net_device *bond_dev, struct net_device *link_dev,
struct netlink_ext_ack *extack);
-int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
+int bond_release(struct net_device *bond_dev, struct net_device *link_dev);
u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb);
int bond_set_carrier(struct bonding *bond);
-void bond_select_active_slave(struct bonding *bond);
-void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
+void bond_select_active_link(struct bonding *bond);
+void bond_change_active_link(struct bonding *bond, struct link *new_active);
void bond_create_debugfs(void);
void bond_destroy_debugfs(void);
void bond_debug_register(struct bonding *bond);
@@ -641,13 +641,13 @@ void bond_setup(struct net_device *bond_dev);
unsigned int bond_get_num_tx_queues(void);
int bond_netlink_init(void);
void bond_netlink_fini(void);
-struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
-const char *bond_slave_link_status(s8 link);
+struct net_device *bond_option_active_link_get_rcu(struct bonding *bond);
+const char *bond_link_status(s8 link);
struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
struct net_device *end_dev,
int level);
-int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave);
-void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay);
+int bond_update_link_arr(struct bonding *bond, struct link *skiplink);
+void bond_link_arr_work_rearm(struct bonding *bond, unsigned long delay);
void bond_work_init_all(struct bonding *bond);
#ifdef CONFIG_PROC_FS
@@ -673,13 +673,13 @@ static inline void bond_destroy_proc_dir(struct bond_net *bn)
}
#endif
-static inline struct slave *bond_slave_has_mac(struct bonding *bond,
+static inline struct link *bond_link_has_mac(struct bonding *bond,
const u8 *mac)
{
struct list_head *iter;
- struct slave *tmp;
+ struct link *tmp;
- bond_for_each_slave(bond, tmp, iter)
+ bond_for_each_link(bond, tmp, iter)
if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
return tmp;
@@ -687,13 +687,13 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond,
}
/* Caller must hold rcu_read_lock() for read */
-static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond,
+static inline struct link *bond_link_has_mac_rcu(struct bonding *bond,
const u8 *mac)
{
struct list_head *iter;
- struct slave *tmp;
+ struct link *tmp;
- bond_for_each_slave_rcu(bond, tmp, iter)
+ bond_for_each_link_rcu(bond, tmp, iter)
if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
return tmp;
@@ -701,13 +701,13 @@ static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond,
}
/* Caller must hold rcu_read_lock() for read */
-static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac)
+static inline bool bond_link_has_mac_rx(struct bonding *bond, const u8 *mac)
{
struct list_head *iter;
- struct slave *tmp;
+ struct link *tmp;
struct netdev_hw_addr *ha;
- bond_for_each_slave_rcu(bond, tmp, iter)
+ bond_for_each_link_rcu(bond, tmp, iter)
if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
return true;
diff --git a/include/net/lag.h b/include/net/lag.h
index 95b880e6fdde..204e38584f98 100644
--- a/include/net/lag.h
+++ b/include/net/lag.h
@@ -11,7 +11,7 @@ static inline bool net_lag_port_dev_txable(const struct net_device *port_dev)
if (netif_is_team_port(port_dev))
return team_port_dev_txable(port_dev);
else
- return bond_is_active_slave_dev(port_dev);
+ return bond_is_active_link_dev(port_dev);
}
#endif /* _LINUX_IF_LAG_H */
--
2.27.0
Powered by blists - more mailing lists