compat: Added support for ib_core from kernel 4.8 on RHEL7.2
[~tnikolova/compat/.git] / include / net / bonding.h
1 #ifndef LINUX_BONDING_H
2 #define LINUX_BONDING_H
3
4 #include "../../compat/config.h"
5
6 #ifdef HAVE_BONDING_H
7 #include_next <net/bonding.h>
8
9 #define MLX_USES_PRIMARY(mode)                          \
10                 (((mode) == BOND_MODE_ACTIVEBACKUP) ||  \
11                  ((mode) == BOND_MODE_TLB)          ||  \
12                  ((mode) == BOND_MODE_ALB))
13
14 #define bond_option_active_slave_get_rcu LINUX_BACKPORT(bond_option_active_slave_get_rcu)
15 static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding
16                                                                   *bond)
17 {
18         struct slave *slave = rcu_dereference(bond->curr_active_slave);
19
20         return MLX_USES_PRIMARY(bond->params.mode) && slave ? slave->dev : NULL;
21 }
22 #endif /* HAVE_BONDING_H */
23
24 #endif /* LINUX_BONDING_H */