Skip to content

Commit

Permalink
Merge branch 'bonding-next'
Browse files Browse the repository at this point in the history
Veaceslav Falico says:

====================
bonding: simple macro cleanup

Trivial patchset that converts most of the bonding's macros into inline
functions. It introduces only one macro, BOND_MODE(), which is just
bond->params.mode, better to write/understand/remember.

The only real change is the removal of IFF_UP verification, which always
came in pair with && netif_running(), and is though useless, as it's always
IFF_UP when LINK_STATE_RUNNING.

v2->v3: fix 3/9 to actually invert bond_mode_uses_arp() and add
	bond_uses_arp() alongside bond_mode_uses_arp()
v1->v2: use inlined functions instead of macros.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 16, 2014
2 parents 31ff6aa + 8557cd7 commit bd50806
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 154 deletions.
6 changes: 3 additions & 3 deletions drivers/net/bonding/bond_3ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static inline void __enable_port(struct port *port)
{
struct slave *slave = port->slave;

if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev))
if ((slave->link == BOND_LINK_UP) && bond_slave_is_up(slave))
bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER);
}

Expand Down Expand Up @@ -2449,13 +2449,13 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
continue;

if (slave_agg_no >= 0) {
if (!first_ok_slave && SLAVE_IS_OK(slave))
if (!first_ok_slave && bond_slave_can_tx(slave))
first_ok_slave = slave;
slave_agg_no--;
continue;
}

if (SLAVE_IS_OK(slave)) {
if (bond_slave_can_tx(slave)) {
bond_dev_queue_xmit(bond, skb, slave->dev);
goto out;
}
Expand Down
18 changes: 9 additions & 9 deletions drivers/net/bonding/bond_alb.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)

/* Find the slave with the largest gap */
bond_for_each_slave_rcu(bond, slave, iter) {
if (SLAVE_IS_OK(slave)) {
if (bond_slave_can_tx(slave)) {
long long gap = compute_gap(slave);

if (max_gap < gap) {
Expand Down Expand Up @@ -383,7 +383,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
bool found = false;

bond_for_each_slave(bond, slave, iter) {
if (!SLAVE_IS_OK(slave))
if (!bond_slave_can_tx(slave))
continue;
if (!found) {
if (!before || before->speed < slave->speed)
Expand Down Expand Up @@ -416,7 +416,7 @@ static struct slave *__rlb_next_rx_slave(struct bonding *bond)
bool found = false;

bond_for_each_slave_rcu(bond, slave, iter) {
if (!SLAVE_IS_OK(slave))
if (!bond_slave_can_tx(slave))
continue;
if (!found) {
if (!before || before->speed < slave->speed)
Expand Down Expand Up @@ -1057,7 +1057,7 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
struct net_device *dev = slave->dev;
struct sockaddr s_addr;

if (slave->bond->params.mode == BOND_MODE_TLB) {
if (BOND_MODE(slave->bond) == BOND_MODE_TLB) {
memcpy(dev->dev_addr, addr, dev->addr_len);
return 0;
}
Expand Down Expand Up @@ -1100,13 +1100,13 @@ static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
struct slave *slave2)
{
int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
int slaves_state_differ = (bond_slave_can_tx(slave1) != bond_slave_can_tx(slave2));
struct slave *disabled_slave = NULL;

ASSERT_RTNL();

/* fasten the change in the switch */
if (SLAVE_IS_OK(slave1)) {
if (bond_slave_can_tx(slave1)) {
alb_send_learning_packets(slave1, slave1->dev->dev_addr);
if (bond->alb_info.rlb_enabled) {
/* inform the clients that the mac address
Expand All @@ -1118,7 +1118,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
disabled_slave = slave1;
}

if (SLAVE_IS_OK(slave2)) {
if (bond_slave_can_tx(slave2)) {
alb_send_learning_packets(slave2, slave2->dev->dev_addr);
if (bond->alb_info.rlb_enabled) {
/* inform the clients that the mac address
Expand Down Expand Up @@ -1360,7 +1360,7 @@ static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond,
bond_info->unbalanced_load += skb->len;
}

if (tx_slave && SLAVE_IS_OK(tx_slave)) {
if (tx_slave && bond_slave_can_tx(tx_slave)) {
if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
ether_addr_copy(eth_data->h_source,
tx_slave->dev->dev_addr);
Expand Down Expand Up @@ -1745,7 +1745,7 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
/* in TLB mode, the slave might flip down/up with the old dev_addr,
* and thus filter bond->dev_addr's packets, so force bond's mac
*/
if (bond->params.mode == BOND_MODE_TLB) {
if (BOND_MODE(bond) == BOND_MODE_TLB) {
struct sockaddr sa;
u8 tmp_addr[ETH_ALEN];

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v)
struct rlb_client_info *client_info;
u32 hash_index;

if (bond->params.mode != BOND_MODE_ALB)
if (BOND_MODE(bond) != BOND_MODE_ALB)
return 0;

seq_printf(m, "SourceIP DestinationIP "
Expand Down
Loading

0 comments on commit bd50806

Please sign in to comment.