Commit def4460c authored by Veaceslav Falico's avatar Veaceslav Falico Committed by David S. Miller

bonding: call slave_last_rx() only once per slave

Simple cleanup to not call slave_last_rx() on every time function. It won't
give any measurable boost - but looks cleaner and easier to understand.

There are no time-consuming functions in between these calls, so it's safe
to call it in the beginning only once.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarVeaceslav Falico <vfalico@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1155e964
...@@ -2764,7 +2764,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work) ...@@ -2764,7 +2764,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
*/ */
static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
{ {
unsigned long trans_start; unsigned long trans_start, last_rx;
struct slave *slave; struct slave *slave;
int extra_ticks; int extra_ticks;
int commit = 0; int commit = 0;
...@@ -2778,11 +2778,12 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) ...@@ -2778,11 +2778,12 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
bond_for_each_slave(bond, slave) { bond_for_each_slave(bond, slave) {
slave->new_link = BOND_LINK_NOCHANGE; slave->new_link = BOND_LINK_NOCHANGE;
last_rx = slave_last_rx(bond, slave);
if (slave->link != BOND_LINK_UP) { if (slave->link != BOND_LINK_UP) {
if (time_in_range(jiffies, if (time_in_range(jiffies,
slave_last_rx(bond, slave) - delta_in_ticks, last_rx - delta_in_ticks,
slave_last_rx(bond, slave) + delta_in_ticks + extra_ticks)) { last_rx + delta_in_ticks + extra_ticks)) {
slave->new_link = BOND_LINK_UP; slave->new_link = BOND_LINK_UP;
commit++; commit++;
...@@ -2817,8 +2818,8 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) ...@@ -2817,8 +2818,8 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
if (!bond_is_active_slave(slave) && if (!bond_is_active_slave(slave) &&
!bond->current_arp_slave && !bond->current_arp_slave &&
!time_in_range(jiffies, !time_in_range(jiffies,
slave_last_rx(bond, slave) - delta_in_ticks, last_rx - delta_in_ticks,
slave_last_rx(bond, slave) + 3 * delta_in_ticks + extra_ticks)) { last_rx + 3 * delta_in_ticks + extra_ticks)) {
slave->new_link = BOND_LINK_DOWN; slave->new_link = BOND_LINK_DOWN;
commit++; commit++;
...@@ -2836,8 +2837,8 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) ...@@ -2836,8 +2837,8 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
trans_start - delta_in_ticks, trans_start - delta_in_ticks,
trans_start + 2 * delta_in_ticks + extra_ticks) || trans_start + 2 * delta_in_ticks + extra_ticks) ||
!time_in_range(jiffies, !time_in_range(jiffies,
slave_last_rx(bond, slave) - delta_in_ticks, last_rx - delta_in_ticks,
slave_last_rx(bond, slave) + 2 * delta_in_ticks + extra_ticks))) { last_rx + 2 * delta_in_ticks + extra_ticks))) {
slave->new_link = BOND_LINK_DOWN; slave->new_link = BOND_LINK_DOWN;
commit++; commit++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment