summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorDebabrata Banerjee <dbanerje@akamai.com>2018-05-14 20:48:10 +0200
committerDavid S. Miller <davem@davemloft.net>2018-05-16 18:15:11 +0200
commit1386c36b30388f46a95100924bfcae75160db715 (patch)
treedb9d63a1cb1d8afe910fc0bbf24ad16dd3fdf887 /drivers/net/bonding/bond_main.c
parentbonding: allow use of tx hashing in balance-alb (diff)
downloadlinux-1386c36b30388f46a95100924bfcae75160db715.tar.xz
linux-1386c36b30388f46a95100924bfcae75160db715.zip
bonding: allow carrier and link status to determine link state
In a mixed environment it may be difficult to tell if your hardware support carrier, if it does not it can always report true. With a new use_carrier option of 2, we can check both carrier and link status sequentially, instead of one or the other Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index a4cd7f6bfd4d..e4c253dc7dfb 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -132,7 +132,7 @@ MODULE_PARM_DESC(downdelay, "Delay before considering link down, "
"in milliseconds");
module_param(use_carrier, int, 0);
MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; "
- "0 for off, 1 for on (default)");
+ "0 for off, 1 for on (default), 2 for carrier then legacy checks");
module_param(mode, charp, 0);
MODULE_PARM_DESC(mode, "Mode of operation; 0 for balance-rr, "
"1 for active-backup, 2 for balance-xor, "
@@ -434,12 +434,16 @@ static int bond_check_dev_link(struct bonding *bond,
int (*ioctl)(struct net_device *, struct ifreq *, int);
struct ifreq ifr;
struct mii_ioctl_data *mii;
+ bool carrier = true;
if (!reporting && !netif_running(slave_dev))
return 0;
if (bond->params.use_carrier)
- return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
+ carrier = netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
+
+ if (!carrier)
+ return carrier;
/* Try to get link status using Ethtool first. */
if (slave_dev->ethtool_ops->get_link)
@@ -4403,8 +4407,8 @@ static int bond_check_params(struct bond_params *params)
downdelay = 0;
}
- if ((use_carrier != 0) && (use_carrier != 1)) {
- pr_warn("Warning: use_carrier module parameter (%d), not of valid value (0/1), so it was set to 1\n",
+ if (use_carrier < 0 || use_carrier > 2) {
+ pr_warn("Warning: use_carrier module parameter (%d), not of valid value (0-2), so it was set to 1\n",
use_carrier);
use_carrier = 1;
}