Skip to content

Commit bd50806

Browse files
committed
Merge branch 'bonding-next'
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>
2 parents 31ff6aa + 8557cd7 commit bd50806

10 files changed

Lines changed: 150 additions & 154 deletions

File tree

‎drivers/net/bonding/bond_3ad.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static inline void __enable_port(struct port *port)
192192
{
193193
struct slave *slave = port->slave;
194194

195-
if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev))
195+
if ((slave->link == BOND_LINK_UP) && bond_slave_is_up(slave))
196196
bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER);
197197
}
198198

@@ -2449,13 +2449,13 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
24492449
continue;
24502450

24512451
if (slave_agg_no >= 0) {
2452-
if (!first_ok_slave && SLAVE_IS_OK(slave))
2452+
if (!first_ok_slave && bond_slave_can_tx(slave))
24532453
first_ok_slave = slave;
24542454
slave_agg_no--;
24552455
continue;
24562456
}
24572457

2458-
if (SLAVE_IS_OK(slave)) {
2458+
if (bond_slave_can_tx(slave)) {
24592459
bond_dev_queue_xmit(bond, skb, slave->dev);
24602460
goto out;
24612461
}

‎drivers/net/bonding/bond_alb.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
228228

229229
/* Find the slave with the largest gap */
230230
bond_for_each_slave_rcu(bond, slave, iter) {
231-
if (SLAVE_IS_OK(slave)) {
231+
if (bond_slave_can_tx(slave)) {
232232
long long gap = compute_gap(slave);
233233

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

385385
bond_for_each_slave(bond, slave, iter) {
386-
if (!SLAVE_IS_OK(slave))
386+
if (!bond_slave_can_tx(slave))
387387
continue;
388388
if (!found) {
389389
if (!before || before->speed < slave->speed)
@@ -416,7 +416,7 @@ static struct slave *__rlb_next_rx_slave(struct bonding *bond)
416416
bool found = false;
417417

418418
bond_for_each_slave_rcu(bond, slave, iter) {
419-
if (!SLAVE_IS_OK(slave))
419+
if (!bond_slave_can_tx(slave))
420420
continue;
421421
if (!found) {
422422
if (!before || before->speed < slave->speed)
@@ -1057,7 +1057,7 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
10571057
struct net_device *dev = slave->dev;
10581058
struct sockaddr s_addr;
10591059

1060-
if (slave->bond->params.mode == BOND_MODE_TLB) {
1060+
if (BOND_MODE(slave->bond) == BOND_MODE_TLB) {
10611061
memcpy(dev->dev_addr, addr, dev->addr_len);
10621062
return 0;
10631063
}
@@ -1100,13 +1100,13 @@ static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
11001100
static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
11011101
struct slave *slave2)
11021102
{
1103-
int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
1103+
int slaves_state_differ = (bond_slave_can_tx(slave1) != bond_slave_can_tx(slave2));
11041104
struct slave *disabled_slave = NULL;
11051105

11061106
ASSERT_RTNL();
11071107

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

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

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

‎drivers/net/bonding/bond_debugfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v)
2323
struct rlb_client_info *client_info;
2424
u32 hash_index;
2525

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

2929
seq_printf(m, "SourceIP DestinationIP "

0 commit comments

Comments
 (0)