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

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: default avatarVeaceslav Falico <vfalico@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent befb903a
...@@ -3788,10 +3788,9 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev ...@@ -3788,10 +3788,9 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev
{ {
struct bonding *bond = netdev_priv(dev); struct bonding *bond = netdev_priv(dev);
if (TX_QUEUE_OVERRIDE(bond->params.mode)) { if (bond_should_override_tx_queue(bond) &&
if (!bond_slave_override(bond, skb)) !bond_slave_override(bond, skb))
return NETDEV_TX_OK; return NETDEV_TX_OK;
}
switch (bond->params.mode) { switch (bond->params.mode) {
case BOND_MODE_ROUNDROBIN: case BOND_MODE_ROUNDROBIN:
......
...@@ -65,10 +65,6 @@ ...@@ -65,10 +65,6 @@
((mode) == BOND_MODE_TLB) || \ ((mode) == BOND_MODE_TLB) || \
((mode) == BOND_MODE_ALB)) ((mode) == BOND_MODE_ALB))
#define TX_QUEUE_OVERRIDE(mode) \
(((mode) == BOND_MODE_ACTIVEBACKUP) || \
((mode) == BOND_MODE_ROUNDROBIN))
#define IS_IP_TARGET_UNUSABLE_ADDRESS(a) \ #define IS_IP_TARGET_UNUSABLE_ADDRESS(a) \
((htonl(INADDR_BROADCAST) == a) || \ ((htonl(INADDR_BROADCAST) == a) || \
ipv4_is_zeronet(a)) ipv4_is_zeronet(a))
...@@ -284,6 +280,12 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) ...@@ -284,6 +280,12 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
return slave->bond; return slave->bond;
} }
static inline bool bond_should_override_tx_queue(struct bonding *bond)
{
return bond->params.mode == BOND_MODE_ACTIVEBACKUP ||
bond->params.mode == BOND_MODE_ROUNDROBIN;
}
static inline bool bond_is_lb(const struct bonding *bond) static inline bool bond_is_lb(const struct bonding *bond)
{ {
return bond->params.mode == BOND_MODE_TLB || return bond->params.mode == BOND_MODE_TLB ||
......
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