diff options
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1a9976487099..c311aed9bd02 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -313,19 +313,26 @@ static ssize_t bonding_store_mode(struct device *d, | |||
313 | bond->dev->name, (int)strlen(buf) - 1, buf); | 313 | bond->dev->name, (int)strlen(buf) - 1, buf); |
314 | ret = -EINVAL; | 314 | ret = -EINVAL; |
315 | goto out; | 315 | goto out; |
316 | } else { | 316 | } |
317 | if (bond->params.mode == BOND_MODE_8023AD) | 317 | if ((new_value == BOND_MODE_ALB || |
318 | bond_unset_master_3ad_flags(bond); | 318 | new_value == BOND_MODE_TLB) && |
319 | bond->params.arp_interval) { | ||
320 | pr_err("%s: %s mode is incompatible with arp monitoring.\n", | ||
321 | bond->dev->name, bond_mode_tbl[new_value].modename); | ||
322 | ret = -EINVAL; | ||
323 | goto out; | ||
324 | } | ||
325 | if (bond->params.mode == BOND_MODE_8023AD) | ||
326 | bond_unset_master_3ad_flags(bond); | ||
319 | 327 | ||
320 | if (bond->params.mode == BOND_MODE_ALB) | 328 | if (bond->params.mode == BOND_MODE_ALB) |
321 | bond_unset_master_alb_flags(bond); | 329 | bond_unset_master_alb_flags(bond); |
322 | 330 | ||
323 | bond->params.mode = new_value; | 331 | bond->params.mode = new_value; |
324 | bond_set_mode_ops(bond, bond->params.mode); | 332 | bond_set_mode_ops(bond, bond->params.mode); |
325 | pr_info("%s: setting mode to %s (%d).\n", | 333 | pr_info("%s: setting mode to %s (%d).\n", |
326 | bond->dev->name, bond_mode_tbl[new_value].modename, | 334 | bond->dev->name, bond_mode_tbl[new_value].modename, |
327 | new_value); | 335 | new_value); |
328 | } | ||
329 | out: | 336 | out: |
330 | return ret; | 337 | return ret; |
331 | } | 338 | } |
@@ -510,7 +517,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
510 | ret = -EINVAL; | 517 | ret = -EINVAL; |
511 | goto out; | 518 | goto out; |
512 | } | 519 | } |
513 | 520 | if (bond->params.mode == BOND_MODE_ALB || | |
521 | bond->params.mode == BOND_MODE_TLB) { | ||
522 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB. Only MII monitoring is supported on %s.\n", | ||
523 | bond->dev->name, bond->dev->name); | ||
524 | ret = -EINVAL; | ||
525 | goto out; | ||
526 | } | ||
514 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 527 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
515 | bond->dev->name, new_value); | 528 | bond->dev->name, new_value); |
516 | bond->params.arp_interval = new_value; | 529 | bond->params.arp_interval = new_value; |