aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@gmail.com>2014-05-15 15:39:58 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-16 16:34:32 -0400
commit891ab54d6636b7aa0da48b5a5dd738af8b75cafe (patch)
tree58c82f873060ed0e0507329d848d0a6e9130d66b /drivers/net/bonding
parentb6adc610f183061bd607d965857870e618d229a6 (diff)
bonding: rename {, bond_}slave_can_tx and clean it up
CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c8
-rw-r--r--drivers/net/bonding/bonding.h15
2 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index db323e6cb314..5a1e7b779cbe 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3588,7 +3588,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl
3588 /* Here we start from the slave with slave_id */ 3588 /* Here we start from the slave with slave_id */
3589 bond_for_each_slave_rcu(bond, slave, iter) { 3589 bond_for_each_slave_rcu(bond, slave, iter) {
3590 if (--i < 0) { 3590 if (--i < 0) {
3591 if (slave_can_tx(slave)) { 3591 if (bond_slave_can_tx(slave)) {
3592 bond_dev_queue_xmit(bond, skb, slave->dev); 3592 bond_dev_queue_xmit(bond, skb, slave->dev);
3593 return; 3593 return;
3594 } 3594 }
@@ -3600,7 +3600,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl
3600 bond_for_each_slave_rcu(bond, slave, iter) { 3600 bond_for_each_slave_rcu(bond, slave, iter) {
3601 if (--i < 0) 3601 if (--i < 0)
3602 break; 3602 break;
3603 if (slave_can_tx(slave)) { 3603 if (bond_slave_can_tx(slave)) {
3604 bond_dev_queue_xmit(bond, skb, slave->dev); 3604 bond_dev_queue_xmit(bond, skb, slave->dev);
3605 return; 3605 return;
3606 } 3606 }
@@ -3657,7 +3657,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
3657 */ 3657 */
3658 if (iph->protocol == IPPROTO_IGMP && skb->protocol == htons(ETH_P_IP)) { 3658 if (iph->protocol == IPPROTO_IGMP && skb->protocol == htons(ETH_P_IP)) {
3659 slave = rcu_dereference(bond->curr_active_slave); 3659 slave = rcu_dereference(bond->curr_active_slave);
3660 if (slave && slave_can_tx(slave)) 3660 if (slave && bond_slave_can_tx(slave))
3661 bond_dev_queue_xmit(bond, skb, slave->dev); 3661 bond_dev_queue_xmit(bond, skb, slave->dev);
3662 else 3662 else
3663 bond_xmit_slave_id(bond, skb, 0); 3663 bond_xmit_slave_id(bond, skb, 0);
@@ -3747,7 +3747,7 @@ static inline int bond_slave_override(struct bonding *bond,
3747 /* Find out if any slaves have the same mapping as this skb. */ 3747 /* Find out if any slaves have the same mapping as this skb. */
3748 bond_for_each_slave_rcu(bond, slave, iter) { 3748 bond_for_each_slave_rcu(bond, slave, iter) {
3749 if (slave->queue_id == skb->queue_mapping) { 3749 if (slave->queue_id == skb->queue_mapping) {
3750 if (slave_can_tx(slave)) { 3750 if (bond_slave_can_tx(slave)) {
3751 bond_dev_queue_xmit(bond, skb, slave->dev); 3751 bond_dev_queue_xmit(bond, skb, slave->dev);
3752 return 0; 3752 return 0;
3753 } 3753 }
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 6a5393b52ae0..60ffd57cf625 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -367,6 +367,12 @@ static inline bool bond_is_active_slave(struct slave *slave)
367 return !bond_slave_state(slave); 367 return !bond_slave_state(slave);
368} 368}
369 369
370static inline bool bond_slave_can_tx(struct slave *slave)
371{
372 return bond_slave_is_up(slave) && slave->link == BOND_LINK_UP &&
373 bond_is_active_slave(slave);
374}
375
370#define BOND_PRI_RESELECT_ALWAYS 0 376#define BOND_PRI_RESELECT_ALWAYS 0
371#define BOND_PRI_RESELECT_BETTER 1 377#define BOND_PRI_RESELECT_BETTER 1
372#define BOND_PRI_RESELECT_FAILURE 2 378#define BOND_PRI_RESELECT_FAILURE 2
@@ -485,15 +491,6 @@ static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be3
485 return addr; 491 return addr;
486} 492}
487 493
488static inline bool slave_can_tx(struct slave *slave)
489{
490 if (bond_slave_is_up(slave) && slave->link == BOND_LINK_UP &&
491 bond_is_active_slave(slave))
492 return true;
493 else
494 return false;
495}
496
497struct bond_net { 494struct bond_net {
498 struct net *net; /* Associated network namespace */ 495 struct net *net; /* Associated network namespace */
499 struct list_head dev_list; 496 struct list_head dev_list;