summaryrefslogtreecommitdiff
path: root/drivers/net/bonding/bonding.h
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@gmail.com>2014-05-15 23:39:55 +0400
committerDavid S. Miller <davem@davemloft.net>2014-05-17 00:34:32 +0400
commit01844098ecd9564cd5f903e3ff6c1ea96355772d (patch)
tree4bf2bb8089248698ec1380d8c4e9cd018141466f /drivers/net/bonding/bonding.h
parentec0865a94991d1819d4f99866a2492af8df5c882 (diff)
downloadlinux-01844098ecd9564cd5f903e3ff6c1ea96355772d.tar.xz
bonding: create a macro for bond mode and use it
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/bonding.h')
-rw-r--r--drivers/net/bonding/bonding.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 1a27c18be21c..bb663a4db137 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -70,6 +70,8 @@
set_fs(fs); \
res; })
+#define BOND_MODE(bond) ((bond)->params.mode)
+
/* slave list primitives */
#define bond_slave_list(bond) (&(bond)->dev->adj_list.lower)
@@ -271,14 +273,14 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
static inline bool bond_should_override_tx_queue(struct bonding *bond)
{
- return bond->params.mode == BOND_MODE_ACTIVEBACKUP ||
- bond->params.mode == BOND_MODE_ROUNDROBIN;
+ return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
+ BOND_MODE(bond) == BOND_MODE_ROUNDROBIN;
}
static inline bool bond_is_lb(const struct bonding *bond)
{
- return bond->params.mode == BOND_MODE_TLB ||
- bond->params.mode == BOND_MODE_ALB;
+ return BOND_MODE(bond) == BOND_MODE_TLB ||
+ BOND_MODE(bond) == BOND_MODE_ALB;
}
static inline bool bond_mode_uses_arp(int mode)
@@ -295,7 +297,7 @@ static inline bool bond_mode_uses_primary(int mode)
static inline bool bond_uses_primary(struct bonding *bond)
{
- return bond_mode_uses_primary(bond->params.mode);
+ return bond_mode_uses_primary(BOND_MODE(bond));
}
static inline void bond_set_active_slave(struct slave *slave)