aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@gmail.com>2014-05-15 15:39:52 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-16 16:34:31 -0400
commitd1e2e5cd4f8ed2ac7c43ce44feeb9ebc7d27cb4b (patch)
tree18608ed63549df537e39ce0c3933939aacbb5012
parentbefb903ae64ad09ba7e4aabb6e1707896c7c5d56 (diff)
bonding: make TX_QUEUE_OVERRIDE() macro an inline function
Also, make it accept bonding as a parameter and change the name a bit to better reflect its scope. 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>
-rw-r--r--drivers/net/bonding/bond_main.c7
-rw-r--r--drivers/net/bonding/bonding.h10
2 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 90ebed6b3df6..5c88c11a3ddd 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3788,10 +3788,9 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev
3788{ 3788{
3789 struct bonding *bond = netdev_priv(dev); 3789 struct bonding *bond = netdev_priv(dev);
3790 3790
3791 if (TX_QUEUE_OVERRIDE(bond->params.mode)) { 3791 if (bond_should_override_tx_queue(bond) &&
3792 if (!bond_slave_override(bond, skb)) 3792 !bond_slave_override(bond, skb))
3793 return NETDEV_TX_OK; 3793 return NETDEV_TX_OK;
3794 }
3795 3794
3796 switch (bond->params.mode) { 3795 switch (bond->params.mode) {
3797 case BOND_MODE_ROUNDROBIN: 3796 case BOND_MODE_ROUNDROBIN:
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 16e57a14e58c..dca3dfdf42d3 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -65,10 +65,6 @@
65 ((mode) == BOND_MODE_TLB) || \ 65 ((mode) == BOND_MODE_TLB) || \
66 ((mode) == BOND_MODE_ALB)) 66 ((mode) == BOND_MODE_ALB))
67 67
68#define TX_QUEUE_OVERRIDE(mode) \
69 (((mode) == BOND_MODE_ACTIVEBACKUP) || \
70 ((mode) == BOND_MODE_ROUNDROBIN))
71
72#define IS_IP_TARGET_UNUSABLE_ADDRESS(a) \ 68#define IS_IP_TARGET_UNUSABLE_ADDRESS(a) \
73 ((htonl(INADDR_BROADCAST) == a) || \ 69 ((htonl(INADDR_BROADCAST) == a) || \
74 ipv4_is_zeronet(a)) 70 ipv4_is_zeronet(a))
@@ -284,6 +280,12 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
284 return slave->bond; 280 return slave->bond;
285} 281}
286 282
283static inline bool bond_should_override_tx_queue(struct bonding *bond)
284{
285 return bond->params.mode == BOND_MODE_ACTIVEBACKUP ||
286 bond->params.mode == BOND_MODE_ROUNDROBIN;
287}
288
287static inline bool bond_is_lb(const struct bonding *bond) 289static inline bool bond_is_lb(const struct bonding *bond)
288{ 290{
289 return bond->params.mode == BOND_MODE_TLB || 291 return bond->params.mode == BOND_MODE_TLB ||