summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bonding.h
diff options
context:
space:
mode:
authorVeaceslav Falico2014-05-15 21:39:55 +0200
committerDavid S. Miller2014-05-16 22:34:32 +0200
commit01844098ecd9564cd5f903e3ff6c1ea96355772d (patch)
tree4bf2bb8089248698ec1380d8c4e9cd018141466f /drivers/net/bonding/bonding.h
parentbonding: make USES_PRIMARY inline functions (diff)
downloadkernel-qcow2-linux-01844098ecd9564cd5f903e3ff6c1ea96355772d.tar.gz
kernel-qcow2-linux-01844098ecd9564cd5f903e3ff6c1ea96355772d.tar.xz
kernel-qcow2-linux-01844098ecd9564cd5f903e3ff6c1ea96355772d.zip
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)