Skip to content

Commit f307668

Browse files
Mahesh Bandewardavem330
authored andcommitted
bonding: split bond_set_slave_link_state into two parts
Split the function into two (a) propose (b) commit phase without changing the semantics for the original API. Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 205ed44 commit f307668

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

‎include/net/bonding.h‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ struct slave {
153153
unsigned long last_link_up;
154154
unsigned long last_rx;
155155
unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
156-
s8 link; /* one of BOND_LINK_XXXX */
156+
s8 link; /* one of BOND_LINK_XXXX */
157+
s8 link_new_state; /* one of BOND_LINK_XXXX */
157158
s8 new_link;
158159
u8 backup:1, /* indicates backup slave. Value corresponds with
159160
BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
@@ -504,13 +505,17 @@ static inline bool bond_is_slave_inactive(struct slave *slave)
504505
return slave->inactive;
505506
}
506507

507-
static inline void bond_set_slave_link_state(struct slave *slave, int state,
508-
bool notify)
508+
static inline void bond_propose_link_state(struct slave *slave, int state)
509+
{
510+
slave->link_new_state = state;
511+
}
512+
513+
static inline void bond_commit_link_state(struct slave *slave, bool notify)
509514
{
510-
if (slave->link == state)
515+
if (slave->link == slave->link_new_state)
511516
return;
512517

513-
slave->link = state;
518+
slave->link = slave->link_new_state;
514519
if (notify) {
515520
bond_queue_slave_event(slave);
516521
bond_lower_state_changed(slave);
@@ -523,6 +528,13 @@ static inline void bond_set_slave_link_state(struct slave *slave, int state,
523528
}
524529
}
525530

531+
static inline void bond_set_slave_link_state(struct slave *slave, int state,
532+
bool notify)
533+
{
534+
bond_propose_link_state(slave, state);
535+
bond_commit_link_state(slave, notify);
536+
}
537+
526538
static inline void bond_slave_link_notify(struct bonding *bond)
527539
{
528540
struct list_head *iter;

0 commit comments

Comments
 (0)