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

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: default avatarVeaceslav Falico <vfalico@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b6adc610
...@@ -3588,7 +3588,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl ...@@ -3588,7 +3588,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl
/* Here we start from the slave with slave_id */ /* Here we start from the slave with slave_id */
bond_for_each_slave_rcu(bond, slave, iter) { bond_for_each_slave_rcu(bond, slave, iter) {
if (--i < 0) { if (--i < 0) {
if (slave_can_tx(slave)) { if (bond_slave_can_tx(slave)) {
bond_dev_queue_xmit(bond, skb, slave->dev); bond_dev_queue_xmit(bond, skb, slave->dev);
return; return;
} }
...@@ -3600,7 +3600,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl ...@@ -3600,7 +3600,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl
bond_for_each_slave_rcu(bond, slave, iter) { bond_for_each_slave_rcu(bond, slave, iter) {
if (--i < 0) if (--i < 0)
break; break;
if (slave_can_tx(slave)) { if (bond_slave_can_tx(slave)) {
bond_dev_queue_xmit(bond, skb, slave->dev); bond_dev_queue_xmit(bond, skb, slave->dev);
return; return;
} }
...@@ -3657,7 +3657,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev ...@@ -3657,7 +3657,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
*/ */
if (iph->protocol == IPPROTO_IGMP && skb->protocol == htons(ETH_P_IP)) { if (iph->protocol == IPPROTO_IGMP && skb->protocol == htons(ETH_P_IP)) {
slave = rcu_dereference(bond->curr_active_slave); slave = rcu_dereference(bond->curr_active_slave);
if (slave && slave_can_tx(slave)) if (slave && bond_slave_can_tx(slave))
bond_dev_queue_xmit(bond, skb, slave->dev); bond_dev_queue_xmit(bond, skb, slave->dev);
else else
bond_xmit_slave_id(bond, skb, 0); bond_xmit_slave_id(bond, skb, 0);
...@@ -3747,7 +3747,7 @@ static inline int bond_slave_override(struct bonding *bond, ...@@ -3747,7 +3747,7 @@ static inline int bond_slave_override(struct bonding *bond,
/* Find out if any slaves have the same mapping as this skb. */ /* Find out if any slaves have the same mapping as this skb. */
bond_for_each_slave_rcu(bond, slave, iter) { bond_for_each_slave_rcu(bond, slave, iter) {
if (slave->queue_id == skb->queue_mapping) { if (slave->queue_id == skb->queue_mapping) {
if (slave_can_tx(slave)) { if (bond_slave_can_tx(slave)) {
bond_dev_queue_xmit(bond, skb, slave->dev); bond_dev_queue_xmit(bond, skb, slave->dev);
return 0; return 0;
} }
......
...@@ -367,6 +367,12 @@ static inline bool bond_is_active_slave(struct slave *slave) ...@@ -367,6 +367,12 @@ static inline bool bond_is_active_slave(struct slave *slave)
return !bond_slave_state(slave); return !bond_slave_state(slave);
} }
static inline bool bond_slave_can_tx(struct slave *slave)
{
return bond_slave_is_up(slave) && slave->link == BOND_LINK_UP &&
bond_is_active_slave(slave);
}
#define BOND_PRI_RESELECT_ALWAYS 0 #define BOND_PRI_RESELECT_ALWAYS 0
#define BOND_PRI_RESELECT_BETTER 1 #define BOND_PRI_RESELECT_BETTER 1
#define BOND_PRI_RESELECT_FAILURE 2 #define BOND_PRI_RESELECT_FAILURE 2
...@@ -485,15 +491,6 @@ static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be3 ...@@ -485,15 +491,6 @@ static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be3
return addr; return addr;
} }
static inline bool slave_can_tx(struct slave *slave)
{
if (bond_slave_is_up(slave) && slave->link == BOND_LINK_UP &&
bond_is_active_slave(slave))
return true;
else
return false;
}
struct bond_net { struct bond_net {
struct net *net; /* Associated network namespace */ struct net *net; /* Associated network namespace */
struct list_head dev_list; struct list_head dev_list;
......
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