diff options
author | Joe Perches <joe@perches.com> | 2009-12-13 23:06:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-13 23:06:07 -0500 |
commit | a4aee5c808fc5bf6889c9012217841eb3fd91a6a (patch) | |
tree | 28b2f17a9907685ab530b20d46bc9d50797ae692 /drivers/net/bonding/bond_sysfs.c | |
parent | 231d52a7bec6d141883d81dbb5516bff4a07533b (diff) |
drivers/net/bonding/: : use pr_fmt
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Remove DRV_NAME from pr_<level>s
Consolidate long format strings
Remove some extra tab indents
Remove some unnecessary ()s from pr_<level>s arguments
Align pr_<level> arguments
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 327 |
1 files changed, 127 insertions, 200 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 4e00b4f83641..5acd557cea9b 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -19,6 +19,9 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | |||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
22 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
23 | #include <linux/module.h> | 26 | #include <linux/module.h> |
24 | #include <linux/device.h> | 27 | #include <linux/device.h> |
@@ -109,11 +112,10 @@ static ssize_t bonding_store_bonds(struct class *cls, | |||
109 | goto err_no_cmd; | 112 | goto err_no_cmd; |
110 | 113 | ||
111 | if (command[0] == '+') { | 114 | if (command[0] == '+') { |
112 | pr_info(DRV_NAME | 115 | pr_info("%s is being created...\n", ifname); |
113 | ": %s is being created...\n", ifname); | ||
114 | rv = bond_create(net, ifname); | 116 | rv = bond_create(net, ifname); |
115 | if (rv) { | 117 | if (rv) { |
116 | pr_info(DRV_NAME ": Bond creation failed.\n"); | 118 | pr_info("Bond creation failed.\n"); |
117 | res = rv; | 119 | res = rv; |
118 | } | 120 | } |
119 | } else if (command[0] == '-') { | 121 | } else if (command[0] == '-') { |
@@ -122,12 +124,10 @@ static ssize_t bonding_store_bonds(struct class *cls, | |||
122 | rtnl_lock(); | 124 | rtnl_lock(); |
123 | bond_dev = bond_get_by_name(net, ifname); | 125 | bond_dev = bond_get_by_name(net, ifname); |
124 | if (bond_dev) { | 126 | if (bond_dev) { |
125 | pr_info(DRV_NAME ": %s is being deleted...\n", | 127 | pr_info("%s is being deleted...\n", ifname); |
126 | ifname); | ||
127 | unregister_netdevice(bond_dev); | 128 | unregister_netdevice(bond_dev); |
128 | } else { | 129 | } else { |
129 | pr_err(DRV_NAME ": unable to delete non-existent %s\n", | 130 | pr_err("unable to delete non-existent %s\n", ifname); |
130 | ifname); | ||
131 | res = -ENODEV; | 131 | res = -ENODEV; |
132 | } | 132 | } |
133 | rtnl_unlock(); | 133 | rtnl_unlock(); |
@@ -140,8 +140,7 @@ static ssize_t bonding_store_bonds(struct class *cls, | |||
140 | return res; | 140 | return res; |
141 | 141 | ||
142 | err_no_cmd: | 142 | err_no_cmd: |
143 | pr_err(DRV_NAME ": no command found in bonding_masters." | 143 | pr_err("no command found in bonding_masters. Use +ifname or -ifname.\n"); |
144 | " Use +ifname or -ifname.\n"); | ||
145 | return -EPERM; | 144 | return -EPERM; |
146 | } | 145 | } |
147 | 146 | ||
@@ -225,8 +224,8 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
225 | 224 | ||
226 | /* Quick sanity check -- is the bond interface up? */ | 225 | /* Quick sanity check -- is the bond interface up? */ |
227 | if (!(bond->dev->flags & IFF_UP)) { | 226 | if (!(bond->dev->flags & IFF_UP)) { |
228 | pr_warning(DRV_NAME ": %s: doing slave updates when " | 227 | pr_warning("%s: doing slave updates when interface is down.\n", |
229 | "interface is down.\n", bond->dev->name); | 228 | bond->dev->name); |
230 | } | 229 | } |
231 | 230 | ||
232 | /* Note: We can't hold bond->lock here, as bond_create grabs it. */ | 231 | /* Note: We can't hold bond->lock here, as bond_create grabs it. */ |
@@ -247,17 +246,14 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
247 | 246 | ||
248 | dev = __dev_get_by_name(dev_net(bond->dev), ifname); | 247 | dev = __dev_get_by_name(dev_net(bond->dev), ifname); |
249 | if (!dev) { | 248 | if (!dev) { |
250 | pr_info(DRV_NAME | 249 | pr_info("%s: Interface %s does not exist!\n", |
251 | ": %s: Interface %s does not exist!\n", | 250 | bond->dev->name, ifname); |
252 | bond->dev->name, ifname); | ||
253 | ret = -ENODEV; | 251 | ret = -ENODEV; |
254 | goto out; | 252 | goto out; |
255 | } | 253 | } |
256 | 254 | ||
257 | if (dev->flags & IFF_UP) { | 255 | if (dev->flags & IFF_UP) { |
258 | pr_err(DRV_NAME | 256 | pr_err("%s: Error: Unable to enslave %s because it is already up.\n", |
259 | ": %s: Error: Unable to enslave %s " | ||
260 | "because it is already up.\n", | ||
261 | bond->dev->name, dev->name); | 257 | bond->dev->name, dev->name); |
262 | ret = -EPERM; | 258 | ret = -EPERM; |
263 | goto out; | 259 | goto out; |
@@ -266,8 +262,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
266 | read_lock(&bond->lock); | 262 | read_lock(&bond->lock); |
267 | bond_for_each_slave(bond, slave, i) | 263 | bond_for_each_slave(bond, slave, i) |
268 | if (slave->dev == dev) { | 264 | if (slave->dev == dev) { |
269 | pr_err(DRV_NAME | 265 | pr_err("%s: Interface %s is already enslaved!\n", |
270 | ": %s: Interface %s is already enslaved!\n", | ||
271 | bond->dev->name, ifname); | 266 | bond->dev->name, ifname); |
272 | ret = -EPERM; | 267 | ret = -EPERM; |
273 | read_unlock(&bond->lock); | 268 | read_unlock(&bond->lock); |
@@ -275,8 +270,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
275 | } | 270 | } |
276 | read_unlock(&bond->lock); | 271 | read_unlock(&bond->lock); |
277 | 272 | ||
278 | pr_info(DRV_NAME ": %s: Adding slave %s.\n", | 273 | pr_info("%s: Adding slave %s.\n", bond->dev->name, ifname); |
279 | bond->dev->name, ifname); | ||
280 | 274 | ||
281 | /* If this is the first slave, then we need to set | 275 | /* If this is the first slave, then we need to set |
282 | the master's hardware address to be the same as the | 276 | the master's hardware address to be the same as the |
@@ -313,7 +307,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
313 | break; | 307 | break; |
314 | } | 308 | } |
315 | if (dev) { | 309 | if (dev) { |
316 | pr_info(DRV_NAME ": %s: Removing slave %s\n", | 310 | pr_info("%s: Removing slave %s\n", |
317 | bond->dev->name, dev->name); | 311 | bond->dev->name, dev->name); |
318 | res = bond_release(bond->dev, dev); | 312 | res = bond_release(bond->dev, dev); |
319 | if (res) { | 313 | if (res) { |
@@ -323,16 +317,16 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
323 | /* set the slave MTU to the default */ | 317 | /* set the slave MTU to the default */ |
324 | dev_set_mtu(dev, original_mtu); | 318 | dev_set_mtu(dev, original_mtu); |
325 | } else { | 319 | } else { |
326 | pr_err(DRV_NAME ": unable to remove non-existent" | 320 | pr_err("unable to remove non-existent slave %s for bond %s.\n", |
327 | " slave %s for bond %s.\n", | 321 | ifname, bond->dev->name); |
328 | ifname, bond->dev->name); | ||
329 | ret = -ENODEV; | 322 | ret = -ENODEV; |
330 | } | 323 | } |
331 | goto out; | 324 | goto out; |
332 | } | 325 | } |
333 | 326 | ||
334 | err_no_cmd: | 327 | err_no_cmd: |
335 | pr_err(DRV_NAME ": no command found in slaves file for bond %s. Use +ifname or -ifname.\n", bond->dev->name); | 328 | pr_err("no command found in slaves file for bond %s. Use +ifname or -ifname.\n", |
329 | bond->dev->name); | ||
336 | ret = -EPERM; | 330 | ret = -EPERM; |
337 | 331 | ||
338 | out: | 332 | out: |
@@ -365,18 +359,16 @@ static ssize_t bonding_store_mode(struct device *d, | |||
365 | struct bonding *bond = to_bond(d); | 359 | struct bonding *bond = to_bond(d); |
366 | 360 | ||
367 | if (bond->dev->flags & IFF_UP) { | 361 | if (bond->dev->flags & IFF_UP) { |
368 | pr_err(DRV_NAME ": unable to update mode of %s" | 362 | pr_err("unable to update mode of %s because interface is up.\n", |
369 | " because interface is up.\n", bond->dev->name); | 363 | bond->dev->name); |
370 | ret = -EPERM; | 364 | ret = -EPERM; |
371 | goto out; | 365 | goto out; |
372 | } | 366 | } |
373 | 367 | ||
374 | new_value = bond_parse_parm(buf, bond_mode_tbl); | 368 | new_value = bond_parse_parm(buf, bond_mode_tbl); |
375 | if (new_value < 0) { | 369 | if (new_value < 0) { |
376 | pr_err(DRV_NAME | 370 | pr_err("%s: Ignoring invalid mode value %.*s.\n", |
377 | ": %s: Ignoring invalid mode value %.*s.\n", | 371 | bond->dev->name, (int)strlen(buf) - 1, buf); |
378 | bond->dev->name, | ||
379 | (int)strlen(buf) - 1, buf); | ||
380 | ret = -EINVAL; | 372 | ret = -EINVAL; |
381 | goto out; | 373 | goto out; |
382 | } else { | 374 | } else { |
@@ -388,8 +380,8 @@ static ssize_t bonding_store_mode(struct device *d, | |||
388 | 380 | ||
389 | bond->params.mode = new_value; | 381 | bond->params.mode = new_value; |
390 | bond_set_mode_ops(bond, bond->params.mode); | 382 | bond_set_mode_ops(bond, bond->params.mode); |
391 | pr_info(DRV_NAME ": %s: setting mode to %s (%d).\n", | 383 | pr_info("%s: setting mode to %s (%d).\n", |
392 | bond->dev->name, bond_mode_tbl[new_value].modename, | 384 | bond->dev->name, bond_mode_tbl[new_value].modename, |
393 | new_value); | 385 | new_value); |
394 | } | 386 | } |
395 | out: | 387 | out: |
@@ -421,8 +413,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
421 | struct bonding *bond = to_bond(d); | 413 | struct bonding *bond = to_bond(d); |
422 | 414 | ||
423 | if (bond->dev->flags & IFF_UP) { | 415 | if (bond->dev->flags & IFF_UP) { |
424 | pr_err(DRV_NAME | 416 | pr_err("%s: Interface is up. Unable to update xmit policy.\n", |
425 | "%s: Interface is up. Unable to update xmit policy.\n", | ||
426 | bond->dev->name); | 417 | bond->dev->name); |
427 | ret = -EPERM; | 418 | ret = -EPERM; |
428 | goto out; | 419 | goto out; |
@@ -430,8 +421,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
430 | 421 | ||
431 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); | 422 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); |
432 | if (new_value < 0) { | 423 | if (new_value < 0) { |
433 | pr_err(DRV_NAME | 424 | pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n", |
434 | ": %s: Ignoring invalid xmit hash policy value %.*s.\n", | ||
435 | bond->dev->name, | 425 | bond->dev->name, |
436 | (int)strlen(buf) - 1, buf); | 426 | (int)strlen(buf) - 1, buf); |
437 | ret = -EINVAL; | 427 | ret = -EINVAL; |
@@ -439,7 +429,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
439 | } else { | 429 | } else { |
440 | bond->params.xmit_policy = new_value; | 430 | bond->params.xmit_policy = new_value; |
441 | bond_set_mode_ops(bond, bond->params.mode); | 431 | bond_set_mode_ops(bond, bond->params.mode); |
442 | pr_info(DRV_NAME ": %s: setting xmit hash policy to %s (%d).\n", | 432 | pr_info("%s: setting xmit hash policy to %s (%d).\n", |
443 | bond->dev->name, | 433 | bond->dev->name, |
444 | xmit_hashtype_tbl[new_value].modename, new_value); | 434 | xmit_hashtype_tbl[new_value].modename, new_value); |
445 | } | 435 | } |
@@ -472,20 +462,18 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
472 | 462 | ||
473 | new_value = bond_parse_parm(buf, arp_validate_tbl); | 463 | new_value = bond_parse_parm(buf, arp_validate_tbl); |
474 | if (new_value < 0) { | 464 | if (new_value < 0) { |
475 | pr_err(DRV_NAME | 465 | pr_err("%s: Ignoring invalid arp_validate value %s\n", |
476 | ": %s: Ignoring invalid arp_validate value %s\n", | ||
477 | bond->dev->name, buf); | 466 | bond->dev->name, buf); |
478 | return -EINVAL; | 467 | return -EINVAL; |
479 | } | 468 | } |
480 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | 469 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { |
481 | pr_err(DRV_NAME | 470 | pr_err("%s: arp_validate only supported in active-backup mode.\n", |
482 | ": %s: arp_validate only supported in active-backup mode.\n", | ||
483 | bond->dev->name); | 471 | bond->dev->name); |
484 | return -EINVAL; | 472 | return -EINVAL; |
485 | } | 473 | } |
486 | pr_info(DRV_NAME ": %s: setting arp_validate to %s (%d).\n", | 474 | pr_info("%s: setting arp_validate to %s (%d).\n", |
487 | bond->dev->name, arp_validate_tbl[new_value].modename, | 475 | bond->dev->name, arp_validate_tbl[new_value].modename, |
488 | new_value); | 476 | new_value); |
489 | 477 | ||
490 | if (!bond->params.arp_validate && new_value) | 478 | if (!bond->params.arp_validate && new_value) |
491 | bond_register_arp(bond); | 479 | bond_register_arp(bond); |
@@ -523,24 +511,22 @@ static ssize_t bonding_store_fail_over_mac(struct device *d, | |||
523 | struct bonding *bond = to_bond(d); | 511 | struct bonding *bond = to_bond(d); |
524 | 512 | ||
525 | if (bond->slave_cnt != 0) { | 513 | if (bond->slave_cnt != 0) { |
526 | pr_err(DRV_NAME | 514 | pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n", |
527 | ": %s: Can't alter fail_over_mac with slaves in bond.\n", | ||
528 | bond->dev->name); | 515 | bond->dev->name); |
529 | return -EPERM; | 516 | return -EPERM; |
530 | } | 517 | } |
531 | 518 | ||
532 | new_value = bond_parse_parm(buf, fail_over_mac_tbl); | 519 | new_value = bond_parse_parm(buf, fail_over_mac_tbl); |
533 | if (new_value < 0) { | 520 | if (new_value < 0) { |
534 | pr_err(DRV_NAME | 521 | pr_err("%s: Ignoring invalid fail_over_mac value %s.\n", |
535 | ": %s: Ignoring invalid fail_over_mac value %s.\n", | ||
536 | bond->dev->name, buf); | 522 | bond->dev->name, buf); |
537 | return -EINVAL; | 523 | return -EINVAL; |
538 | } | 524 | } |
539 | 525 | ||
540 | bond->params.fail_over_mac = new_value; | 526 | bond->params.fail_over_mac = new_value; |
541 | pr_info(DRV_NAME ": %s: Setting fail_over_mac to %s (%d).\n", | 527 | pr_info("%s: Setting fail_over_mac to %s (%d).\n", |
542 | bond->dev->name, fail_over_mac_tbl[new_value].modename, | 528 | bond->dev->name, fail_over_mac_tbl[new_value].modename, |
543 | new_value); | 529 | new_value); |
544 | 530 | ||
545 | return count; | 531 | return count; |
546 | } | 532 | } |
@@ -571,31 +557,26 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
571 | struct bonding *bond = to_bond(d); | 557 | struct bonding *bond = to_bond(d); |
572 | 558 | ||
573 | if (sscanf(buf, "%d", &new_value) != 1) { | 559 | if (sscanf(buf, "%d", &new_value) != 1) { |
574 | pr_err(DRV_NAME | 560 | pr_err("%s: no arp_interval value specified.\n", |
575 | ": %s: no arp_interval value specified.\n", | ||
576 | bond->dev->name); | 561 | bond->dev->name); |
577 | ret = -EINVAL; | 562 | ret = -EINVAL; |
578 | goto out; | 563 | goto out; |
579 | } | 564 | } |
580 | if (new_value < 0) { | 565 | if (new_value < 0) { |
581 | pr_err(DRV_NAME | 566 | pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", |
582 | ": %s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | ||
583 | bond->dev->name, new_value, INT_MAX); | 567 | bond->dev->name, new_value, INT_MAX); |
584 | ret = -EINVAL; | 568 | ret = -EINVAL; |
585 | goto out; | 569 | goto out; |
586 | } | 570 | } |
587 | 571 | ||
588 | pr_info(DRV_NAME | 572 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
589 | ": %s: Setting ARP monitoring interval to %d.\n", | 573 | bond->dev->name, new_value); |
590 | bond->dev->name, new_value); | ||
591 | bond->params.arp_interval = new_value; | 574 | bond->params.arp_interval = new_value; |
592 | if (bond->params.arp_interval) | 575 | if (bond->params.arp_interval) |
593 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; | 576 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; |
594 | if (bond->params.miimon) { | 577 | if (bond->params.miimon) { |
595 | pr_info(DRV_NAME | 578 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
596 | ": %s: ARP monitoring cannot be used with MII monitoring. " | 579 | bond->dev->name, bond->dev->name); |
597 | "%s Disabling MII monitoring.\n", | ||
598 | bond->dev->name, bond->dev->name); | ||
599 | bond->params.miimon = 0; | 580 | bond->params.miimon = 0; |
600 | if (delayed_work_pending(&bond->mii_work)) { | 581 | if (delayed_work_pending(&bond->mii_work)) { |
601 | cancel_delayed_work(&bond->mii_work); | 582 | cancel_delayed_work(&bond->mii_work); |
@@ -603,10 +584,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
603 | } | 584 | } |
604 | } | 585 | } |
605 | if (!bond->params.arp_targets[0]) { | 586 | if (!bond->params.arp_targets[0]) { |
606 | pr_info(DRV_NAME | 587 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
607 | ": %s: ARP monitoring has been set up, " | 588 | bond->dev->name); |
608 | "but no ARP targets have been specified.\n", | ||
609 | bond->dev->name); | ||
610 | } | 589 | } |
611 | if (bond->dev->flags & IFF_UP) { | 590 | if (bond->dev->flags & IFF_UP) { |
612 | /* If the interface is up, we may need to fire off | 591 | /* If the interface is up, we may need to fire off |
@@ -666,8 +645,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
666 | /* look for adds */ | 645 | /* look for adds */ |
667 | if (buf[0] == '+') { | 646 | if (buf[0] == '+') { |
668 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | 647 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { |
669 | pr_err(DRV_NAME | 648 | pr_err("%s: invalid ARP target %pI4 specified for addition\n", |
670 | ": %s: invalid ARP target %pI4 specified for addition\n", | ||
671 | bond->dev->name, &newtarget); | 649 | bond->dev->name, &newtarget); |
672 | ret = -EINVAL; | 650 | ret = -EINVAL; |
673 | goto out; | 651 | goto out; |
@@ -675,23 +653,20 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
675 | /* look for an empty slot to put the target in, and check for dupes */ | 653 | /* look for an empty slot to put the target in, and check for dupes */ |
676 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { | 654 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { |
677 | if (targets[i] == newtarget) { /* duplicate */ | 655 | if (targets[i] == newtarget) { /* duplicate */ |
678 | pr_err(DRV_NAME | 656 | pr_err("%s: ARP target %pI4 is already present\n", |
679 | ": %s: ARP target %pI4 is already present\n", | ||
680 | bond->dev->name, &newtarget); | 657 | bond->dev->name, &newtarget); |
681 | ret = -EINVAL; | 658 | ret = -EINVAL; |
682 | goto out; | 659 | goto out; |
683 | } | 660 | } |
684 | if (targets[i] == 0) { | 661 | if (targets[i] == 0) { |
685 | pr_info(DRV_NAME | 662 | pr_info("%s: adding ARP target %pI4.\n", |
686 | ": %s: adding ARP target %pI4.\n", | 663 | bond->dev->name, &newtarget); |
687 | bond->dev->name, &newtarget); | ||
688 | done = 1; | 664 | done = 1; |
689 | targets[i] = newtarget; | 665 | targets[i] = newtarget; |
690 | } | 666 | } |
691 | } | 667 | } |
692 | if (!done) { | 668 | if (!done) { |
693 | pr_err(DRV_NAME | 669 | pr_err("%s: ARP target table is full!\n", |
694 | ": %s: ARP target table is full!\n", | ||
695 | bond->dev->name); | 670 | bond->dev->name); |
696 | ret = -EINVAL; | 671 | ret = -EINVAL; |
697 | goto out; | 672 | goto out; |
@@ -699,8 +674,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
699 | 674 | ||
700 | } else if (buf[0] == '-') { | 675 | } else if (buf[0] == '-') { |
701 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | 676 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { |
702 | pr_err(DRV_NAME | 677 | pr_err("%s: invalid ARP target %pI4 specified for removal\n", |
703 | ": %s: invalid ARP target %pI4 specified for removal\n", | ||
704 | bond->dev->name, &newtarget); | 678 | bond->dev->name, &newtarget); |
705 | ret = -EINVAL; | 679 | ret = -EINVAL; |
706 | goto out; | 680 | goto out; |
@@ -709,9 +683,8 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
709 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { | 683 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { |
710 | if (targets[i] == newtarget) { | 684 | if (targets[i] == newtarget) { |
711 | int j; | 685 | int j; |
712 | pr_info(DRV_NAME | 686 | pr_info("%s: removing ARP target %pI4.\n", |
713 | ": %s: removing ARP target %pI4.\n", | 687 | bond->dev->name, &newtarget); |
714 | bond->dev->name, &newtarget); | ||
715 | for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++) | 688 | for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++) |
716 | targets[j] = targets[j+1]; | 689 | targets[j] = targets[j+1]; |
717 | 690 | ||
@@ -720,16 +693,14 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
720 | } | 693 | } |
721 | } | 694 | } |
722 | if (!done) { | 695 | if (!done) { |
723 | pr_info(DRV_NAME | 696 | pr_info("%s: unable to remove nonexistent ARP target %pI4.\n", |
724 | ": %s: unable to remove nonexistent ARP target %pI4.\n", | 697 | bond->dev->name, &newtarget); |
725 | bond->dev->name, &newtarget); | ||
726 | ret = -EINVAL; | 698 | ret = -EINVAL; |
727 | goto out; | 699 | goto out; |
728 | } | 700 | } |
729 | } else { | 701 | } else { |
730 | pr_err(DRV_NAME ": no command found in arp_ip_targets file" | 702 | pr_err("no command found in arp_ip_targets file for bond %s. Use +<addr> or -<addr>.\n", |
731 | " for bond %s. Use +<addr> or -<addr>.\n", | 703 | bond->dev->name); |
732 | bond->dev->name); | ||
733 | ret = -EPERM; | 704 | ret = -EPERM; |
734 | goto out; | 705 | goto out; |
735 | } | 706 | } |
@@ -761,41 +732,34 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
761 | struct bonding *bond = to_bond(d); | 732 | struct bonding *bond = to_bond(d); |
762 | 733 | ||
763 | if (!(bond->params.miimon)) { | 734 | if (!(bond->params.miimon)) { |
764 | pr_err(DRV_NAME | 735 | pr_err("%s: Unable to set down delay as MII monitoring is disabled\n", |
765 | ": %s: Unable to set down delay as MII monitoring is disabled\n", | ||
766 | bond->dev->name); | 736 | bond->dev->name); |
767 | ret = -EPERM; | 737 | ret = -EPERM; |
768 | goto out; | 738 | goto out; |
769 | } | 739 | } |
770 | 740 | ||
771 | if (sscanf(buf, "%d", &new_value) != 1) { | 741 | if (sscanf(buf, "%d", &new_value) != 1) { |
772 | pr_err(DRV_NAME | 742 | pr_err("%s: no down delay value specified.\n", bond->dev->name); |
773 | ": %s: no down delay value specified.\n", | ||
774 | bond->dev->name); | ||
775 | ret = -EINVAL; | 743 | ret = -EINVAL; |
776 | goto out; | 744 | goto out; |
777 | } | 745 | } |
778 | if (new_value < 0) { | 746 | if (new_value < 0) { |
779 | pr_err(DRV_NAME | 747 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
780 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", | ||
781 | bond->dev->name, new_value, 1, INT_MAX); | 748 | bond->dev->name, new_value, 1, INT_MAX); |
782 | ret = -EINVAL; | 749 | ret = -EINVAL; |
783 | goto out; | 750 | goto out; |
784 | } else { | 751 | } else { |
785 | if ((new_value % bond->params.miimon) != 0) { | 752 | if ((new_value % bond->params.miimon) != 0) { |
786 | pr_warning(DRV_NAME | 753 | pr_warning("%s: Warning: down delay (%d) is not a multiple of miimon (%d), delay rounded to %d ms\n", |
787 | ": %s: Warning: down delay (%d) is not a " | ||
788 | "multiple of miimon (%d), delay rounded " | ||
789 | "to %d ms\n", | ||
790 | bond->dev->name, new_value, | 754 | bond->dev->name, new_value, |
791 | bond->params.miimon, | 755 | bond->params.miimon, |
792 | (new_value / bond->params.miimon) * | 756 | (new_value / bond->params.miimon) * |
793 | bond->params.miimon); | 757 | bond->params.miimon); |
794 | } | 758 | } |
795 | bond->params.downdelay = new_value / bond->params.miimon; | 759 | bond->params.downdelay = new_value / bond->params.miimon; |
796 | pr_info(DRV_NAME ": %s: Setting down delay to %d.\n", | 760 | pr_info("%s: Setting down delay to %d.\n", |
797 | bond->dev->name, | 761 | bond->dev->name, |
798 | bond->params.downdelay * bond->params.miimon); | 762 | bond->params.downdelay * bond->params.miimon); |
799 | 763 | ||
800 | } | 764 | } |
801 | 765 | ||
@@ -823,41 +787,35 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
823 | struct bonding *bond = to_bond(d); | 787 | struct bonding *bond = to_bond(d); |
824 | 788 | ||
825 | if (!(bond->params.miimon)) { | 789 | if (!(bond->params.miimon)) { |
826 | pr_err(DRV_NAME | 790 | pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", |
827 | ": %s: Unable to set up delay as MII monitoring is disabled\n", | ||
828 | bond->dev->name); | 791 | bond->dev->name); |
829 | ret = -EPERM; | 792 | ret = -EPERM; |
830 | goto out; | 793 | goto out; |
831 | } | 794 | } |
832 | 795 | ||
833 | if (sscanf(buf, "%d", &new_value) != 1) { | 796 | if (sscanf(buf, "%d", &new_value) != 1) { |
834 | pr_err(DRV_NAME | 797 | pr_err("%s: no up delay value specified.\n", |
835 | ": %s: no up delay value specified.\n", | ||
836 | bond->dev->name); | 798 | bond->dev->name); |
837 | ret = -EINVAL; | 799 | ret = -EINVAL; |
838 | goto out; | 800 | goto out; |
839 | } | 801 | } |
840 | if (new_value < 0) { | 802 | if (new_value < 0) { |
841 | pr_err(DRV_NAME | 803 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
842 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", | ||
843 | bond->dev->name, new_value, 1, INT_MAX); | 804 | bond->dev->name, new_value, 1, INT_MAX); |
844 | ret = -EINVAL; | 805 | ret = -EINVAL; |
845 | goto out; | 806 | goto out; |
846 | } else { | 807 | } else { |
847 | if ((new_value % bond->params.miimon) != 0) { | 808 | if ((new_value % bond->params.miimon) != 0) { |
848 | pr_warning(DRV_NAME | 809 | pr_warning("%s: Warning: up delay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", |
849 | ": %s: Warning: up delay (%d) is not a " | ||
850 | "multiple of miimon (%d), updelay rounded " | ||
851 | "to %d ms\n", | ||
852 | bond->dev->name, new_value, | 810 | bond->dev->name, new_value, |
853 | bond->params.miimon, | 811 | bond->params.miimon, |
854 | (new_value / bond->params.miimon) * | 812 | (new_value / bond->params.miimon) * |
855 | bond->params.miimon); | 813 | bond->params.miimon); |
856 | } | 814 | } |
857 | bond->params.updelay = new_value / bond->params.miimon; | 815 | bond->params.updelay = new_value / bond->params.miimon; |
858 | pr_info(DRV_NAME ": %s: Setting up delay to %d.\n", | 816 | pr_info("%s: Setting up delay to %d.\n", |
859 | bond->dev->name, bond->params.updelay * bond->params.miimon); | 817 | bond->dev->name, |
860 | 818 | bond->params.updelay * bond->params.miimon); | |
861 | } | 819 | } |
862 | 820 | ||
863 | out: | 821 | out: |
@@ -889,16 +847,14 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
889 | struct bonding *bond = to_bond(d); | 847 | struct bonding *bond = to_bond(d); |
890 | 848 | ||
891 | if (bond->dev->flags & IFF_UP) { | 849 | if (bond->dev->flags & IFF_UP) { |
892 | pr_err(DRV_NAME | 850 | pr_err("%s: Unable to update LACP rate because interface is up.\n", |
893 | ": %s: Unable to update LACP rate because interface is up.\n", | ||
894 | bond->dev->name); | 851 | bond->dev->name); |
895 | ret = -EPERM; | 852 | ret = -EPERM; |
896 | goto out; | 853 | goto out; |
897 | } | 854 | } |
898 | 855 | ||
899 | if (bond->params.mode != BOND_MODE_8023AD) { | 856 | if (bond->params.mode != BOND_MODE_8023AD) { |
900 | pr_err(DRV_NAME | 857 | pr_err("%s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", |
901 | ": %s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", | ||
902 | bond->dev->name); | 858 | bond->dev->name); |
903 | ret = -EPERM; | 859 | ret = -EPERM; |
904 | goto out; | 860 | goto out; |
@@ -908,12 +864,11 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
908 | 864 | ||
909 | if ((new_value == 1) || (new_value == 0)) { | 865 | if ((new_value == 1) || (new_value == 0)) { |
910 | bond->params.lacp_fast = new_value; | 866 | bond->params.lacp_fast = new_value; |
911 | pr_info(DRV_NAME ": %s: Setting LACP rate to %s (%d).\n", | 867 | pr_info("%s: Setting LACP rate to %s (%d).\n", |
912 | bond->dev->name, bond_lacp_tbl[new_value].modename, | 868 | bond->dev->name, bond_lacp_tbl[new_value].modename, |
913 | new_value); | 869 | new_value); |
914 | } else { | 870 | } else { |
915 | pr_err(DRV_NAME | 871 | pr_err("%s: Ignoring invalid LACP rate value %.*s.\n", |
916 | ": %s: Ignoring invalid LACP rate value %.*s.\n", | ||
917 | bond->dev->name, (int)strlen(buf) - 1, buf); | 872 | bond->dev->name, (int)strlen(buf) - 1, buf); |
918 | ret = -EINVAL; | 873 | ret = -EINVAL; |
919 | } | 874 | } |
@@ -943,9 +898,8 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
943 | struct bonding *bond = to_bond(d); | 898 | struct bonding *bond = to_bond(d); |
944 | 899 | ||
945 | if (bond->dev->flags & IFF_UP) { | 900 | if (bond->dev->flags & IFF_UP) { |
946 | pr_err(DRV_NAME | 901 | pr_err("%s: Unable to update ad_select because interface is up.\n", |
947 | ": %s: Unable to update ad_select because interface " | 902 | bond->dev->name); |
948 | "is up.\n", bond->dev->name); | ||
949 | ret = -EPERM; | 903 | ret = -EPERM; |
950 | goto out; | 904 | goto out; |
951 | } | 905 | } |
@@ -954,13 +908,11 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
954 | 908 | ||
955 | if (new_value != -1) { | 909 | if (new_value != -1) { |
956 | bond->params.ad_select = new_value; | 910 | bond->params.ad_select = new_value; |
957 | pr_info(DRV_NAME | 911 | pr_info("%s: Setting ad_select to %s (%d).\n", |
958 | ": %s: Setting ad_select to %s (%d).\n", | 912 | bond->dev->name, ad_select_tbl[new_value].modename, |
959 | bond->dev->name, ad_select_tbl[new_value].modename, | 913 | new_value); |
960 | new_value); | ||
961 | } else { | 914 | } else { |
962 | pr_err(DRV_NAME | 915 | pr_err("%s: Ignoring invalid ad_select value %.*s.\n", |
963 | ": %s: Ignoring invalid ad_select value %.*s.\n", | ||
964 | bond->dev->name, (int)strlen(buf) - 1, buf); | 916 | bond->dev->name, (int)strlen(buf) - 1, buf); |
965 | ret = -EINVAL; | 917 | ret = -EINVAL; |
966 | } | 918 | } |
@@ -990,15 +942,13 @@ static ssize_t bonding_store_n_grat_arp(struct device *d, | |||
990 | struct bonding *bond = to_bond(d); | 942 | struct bonding *bond = to_bond(d); |
991 | 943 | ||
992 | if (sscanf(buf, "%d", &new_value) != 1) { | 944 | if (sscanf(buf, "%d", &new_value) != 1) { |
993 | pr_err(DRV_NAME | 945 | pr_err("%s: no num_grat_arp value specified.\n", |
994 | ": %s: no num_grat_arp value specified.\n", | ||
995 | bond->dev->name); | 946 | bond->dev->name); |
996 | ret = -EINVAL; | 947 | ret = -EINVAL; |
997 | goto out; | 948 | goto out; |
998 | } | 949 | } |
999 | if (new_value < 0 || new_value > 255) { | 950 | if (new_value < 0 || new_value > 255) { |
1000 | pr_err(DRV_NAME | 951 | pr_err("%s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", |
1001 | ": %s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", | ||
1002 | bond->dev->name, new_value); | 952 | bond->dev->name, new_value); |
1003 | ret = -EINVAL; | 953 | ret = -EINVAL; |
1004 | goto out; | 954 | goto out; |
@@ -1031,16 +981,14 @@ static ssize_t bonding_store_n_unsol_na(struct device *d, | |||
1031 | struct bonding *bond = to_bond(d); | 981 | struct bonding *bond = to_bond(d); |
1032 | 982 | ||
1033 | if (sscanf(buf, "%d", &new_value) != 1) { | 983 | if (sscanf(buf, "%d", &new_value) != 1) { |
1034 | pr_err(DRV_NAME | 984 | pr_err("%s: no num_unsol_na value specified.\n", |
1035 | ": %s: no num_unsol_na value specified.\n", | ||
1036 | bond->dev->name); | 985 | bond->dev->name); |
1037 | ret = -EINVAL; | 986 | ret = -EINVAL; |
1038 | goto out; | 987 | goto out; |
1039 | } | 988 | } |
1040 | 989 | ||
1041 | if (new_value < 0 || new_value > 255) { | 990 | if (new_value < 0 || new_value > 255) { |
1042 | pr_err(DRV_NAME | 991 | pr_err("%s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", |
1043 | ": %s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", | ||
1044 | bond->dev->name, new_value); | 992 | bond->dev->name, new_value); |
1045 | ret = -EINVAL; | 993 | ret = -EINVAL; |
1046 | goto out; | 994 | goto out; |
@@ -1075,40 +1023,31 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1075 | struct bonding *bond = to_bond(d); | 1023 | struct bonding *bond = to_bond(d); |
1076 | 1024 | ||
1077 | if (sscanf(buf, "%d", &new_value) != 1) { | 1025 | if (sscanf(buf, "%d", &new_value) != 1) { |
1078 | pr_err(DRV_NAME | 1026 | pr_err("%s: no miimon value specified.\n", |
1079 | ": %s: no miimon value specified.\n", | ||
1080 | bond->dev->name); | 1027 | bond->dev->name); |
1081 | ret = -EINVAL; | 1028 | ret = -EINVAL; |
1082 | goto out; | 1029 | goto out; |
1083 | } | 1030 | } |
1084 | if (new_value < 0) { | 1031 | if (new_value < 0) { |
1085 | pr_err(DRV_NAME | 1032 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
1086 | ": %s: Invalid miimon value %d not in range %d-%d; rejected.\n", | ||
1087 | bond->dev->name, new_value, 1, INT_MAX); | 1033 | bond->dev->name, new_value, 1, INT_MAX); |
1088 | ret = -EINVAL; | 1034 | ret = -EINVAL; |
1089 | goto out; | 1035 | goto out; |
1090 | } else { | 1036 | } else { |
1091 | pr_info(DRV_NAME | 1037 | pr_info("%s: Setting MII monitoring interval to %d.\n", |
1092 | ": %s: Setting MII monitoring interval to %d.\n", | 1038 | bond->dev->name, new_value); |
1093 | bond->dev->name, new_value); | ||
1094 | bond->params.miimon = new_value; | 1039 | bond->params.miimon = new_value; |
1095 | if (bond->params.updelay) | 1040 | if (bond->params.updelay) |
1096 | pr_info(DRV_NAME | 1041 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", |
1097 | ": %s: Note: Updating updelay (to %d) " | 1042 | bond->dev->name, |
1098 | "since it is a multiple of the miimon value.\n", | 1043 | bond->params.updelay * bond->params.miimon); |
1099 | bond->dev->name, | ||
1100 | bond->params.updelay * bond->params.miimon); | ||
1101 | if (bond->params.downdelay) | 1044 | if (bond->params.downdelay) |
1102 | pr_info(DRV_NAME | 1045 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", |
1103 | ": %s: Note: Updating downdelay (to %d) " | 1046 | bond->dev->name, |
1104 | "since it is a multiple of the miimon value.\n", | 1047 | bond->params.downdelay * bond->params.miimon); |
1105 | bond->dev->name, | ||
1106 | bond->params.downdelay * bond->params.miimon); | ||
1107 | if (bond->params.arp_interval) { | 1048 | if (bond->params.arp_interval) { |
1108 | pr_info(DRV_NAME | 1049 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
1109 | ": %s: MII monitoring cannot be used with " | 1050 | bond->dev->name); |
1110 | "ARP monitoring. Disabling ARP monitoring...\n", | ||
1111 | bond->dev->name); | ||
1112 | bond->params.arp_interval = 0; | 1051 | bond->params.arp_interval = 0; |
1113 | bond->dev->priv_flags &= ~IFF_MASTER_ARPMON; | 1052 | bond->dev->priv_flags &= ~IFF_MASTER_ARPMON; |
1114 | if (bond->params.arp_validate) { | 1053 | if (bond->params.arp_validate) { |
@@ -1176,17 +1115,15 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1176 | write_lock_bh(&bond->curr_slave_lock); | 1115 | write_lock_bh(&bond->curr_slave_lock); |
1177 | 1116 | ||
1178 | if (!USES_PRIMARY(bond->params.mode)) { | 1117 | if (!USES_PRIMARY(bond->params.mode)) { |
1179 | pr_info(DRV_NAME | 1118 | pr_info("%s: Unable to set primary slave; %s is in mode %d\n", |
1180 | ": %s: Unable to set primary slave; %s is in mode %d\n", | 1119 | bond->dev->name, bond->dev->name, bond->params.mode); |
1181 | bond->dev->name, bond->dev->name, bond->params.mode); | ||
1182 | } else { | 1120 | } else { |
1183 | bond_for_each_slave(bond, slave, i) { | 1121 | bond_for_each_slave(bond, slave, i) { |
1184 | if (strnicmp | 1122 | if (strnicmp |
1185 | (slave->dev->name, buf, | 1123 | (slave->dev->name, buf, |
1186 | strlen(slave->dev->name)) == 0) { | 1124 | strlen(slave->dev->name)) == 0) { |
1187 | pr_info(DRV_NAME | 1125 | pr_info("%s: Setting %s as primary slave.\n", |
1188 | ": %s: Setting %s as primary slave.\n", | 1126 | bond->dev->name, slave->dev->name); |
1189 | bond->dev->name, slave->dev->name); | ||
1190 | bond->primary_slave = slave; | 1127 | bond->primary_slave = slave; |
1191 | strcpy(bond->params.primary, slave->dev->name); | 1128 | strcpy(bond->params.primary, slave->dev->name); |
1192 | bond_select_active_slave(bond); | 1129 | bond_select_active_slave(bond); |
@@ -1197,15 +1134,13 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1197 | /* if we got here, then we didn't match the name of any slave */ | 1134 | /* if we got here, then we didn't match the name of any slave */ |
1198 | 1135 | ||
1199 | if (strlen(buf) == 0 || buf[0] == '\n') { | 1136 | if (strlen(buf) == 0 || buf[0] == '\n') { |
1200 | pr_info(DRV_NAME | 1137 | pr_info("%s: Setting primary slave to None.\n", |
1201 | ": %s: Setting primary slave to None.\n", | 1138 | bond->dev->name); |
1202 | bond->dev->name); | ||
1203 | bond->primary_slave = NULL; | 1139 | bond->primary_slave = NULL; |
1204 | bond_select_active_slave(bond); | 1140 | bond_select_active_slave(bond); |
1205 | } else { | 1141 | } else { |
1206 | pr_info(DRV_NAME | 1142 | pr_info("%s: Unable to set %.*s as primary slave as it is not a slave.\n", |
1207 | ": %s: Unable to set %.*s as primary slave as it is not a slave.\n", | 1143 | bond->dev->name, (int)strlen(buf) - 1, buf); |
1208 | bond->dev->name, (int)strlen(buf) - 1, buf); | ||
1209 | } | 1144 | } |
1210 | } | 1145 | } |
1211 | out: | 1146 | out: |
@@ -1244,8 +1179,7 @@ static ssize_t bonding_store_primary_reselect(struct device *d, | |||
1244 | 1179 | ||
1245 | new_value = bond_parse_parm(buf, pri_reselect_tbl); | 1180 | new_value = bond_parse_parm(buf, pri_reselect_tbl); |
1246 | if (new_value < 0) { | 1181 | if (new_value < 0) { |
1247 | pr_err(DRV_NAME | 1182 | pr_err("%s: Ignoring invalid primary_reselect value %.*s.\n", |
1248 | ": %s: Ignoring invalid primary_reselect value %.*s.\n", | ||
1249 | bond->dev->name, | 1183 | bond->dev->name, |
1250 | (int) strlen(buf) - 1, buf); | 1184 | (int) strlen(buf) - 1, buf); |
1251 | ret = -EINVAL; | 1185 | ret = -EINVAL; |
@@ -1253,7 +1187,7 @@ static ssize_t bonding_store_primary_reselect(struct device *d, | |||
1253 | } | 1187 | } |
1254 | 1188 | ||
1255 | bond->params.primary_reselect = new_value; | 1189 | bond->params.primary_reselect = new_value; |
1256 | pr_info(DRV_NAME ": %s: setting primary_reselect to %s (%d).\n", | 1190 | pr_info("%s: setting primary_reselect to %s (%d).\n", |
1257 | bond->dev->name, pri_reselect_tbl[new_value].modename, | 1191 | bond->dev->name, pri_reselect_tbl[new_value].modename, |
1258 | new_value); | 1192 | new_value); |
1259 | 1193 | ||
@@ -1291,20 +1225,18 @@ static ssize_t bonding_store_carrier(struct device *d, | |||
1291 | 1225 | ||
1292 | 1226 | ||
1293 | if (sscanf(buf, "%d", &new_value) != 1) { | 1227 | if (sscanf(buf, "%d", &new_value) != 1) { |
1294 | pr_err(DRV_NAME | 1228 | pr_err("%s: no use_carrier value specified.\n", |
1295 | ": %s: no use_carrier value specified.\n", | ||
1296 | bond->dev->name); | 1229 | bond->dev->name); |
1297 | ret = -EINVAL; | 1230 | ret = -EINVAL; |
1298 | goto out; | 1231 | goto out; |
1299 | } | 1232 | } |
1300 | if ((new_value == 0) || (new_value == 1)) { | 1233 | if ((new_value == 0) || (new_value == 1)) { |
1301 | bond->params.use_carrier = new_value; | 1234 | bond->params.use_carrier = new_value; |
1302 | pr_info(DRV_NAME ": %s: Setting use_carrier to %d.\n", | 1235 | pr_info("%s: Setting use_carrier to %d.\n", |
1303 | bond->dev->name, new_value); | 1236 | bond->dev->name, new_value); |
1304 | } else { | 1237 | } else { |
1305 | pr_info(DRV_NAME | 1238 | pr_info("%s: Ignoring invalid use_carrier value %d.\n", |
1306 | ": %s: Ignoring invalid use_carrier value %d.\n", | 1239 | bond->dev->name, new_value); |
1307 | bond->dev->name, new_value); | ||
1308 | } | 1240 | } |
1309 | out: | 1241 | out: |
1310 | return count; | 1242 | return count; |
@@ -1349,8 +1281,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1349 | write_lock_bh(&bond->curr_slave_lock); | 1281 | write_lock_bh(&bond->curr_slave_lock); |
1350 | 1282 | ||
1351 | if (!USES_PRIMARY(bond->params.mode)) | 1283 | if (!USES_PRIMARY(bond->params.mode)) |
1352 | pr_info(DRV_NAME ": %s: Unable to change active slave;" | 1284 | pr_info("%s: Unable to change active slave; %s is in mode %d\n", |
1353 | " %s is in mode %d\n", | ||
1354 | bond->dev->name, bond->dev->name, bond->params.mode); | 1285 | bond->dev->name, bond->dev->name, bond->params.mode); |
1355 | else { | 1286 | else { |
1356 | bond_for_each_slave(bond, slave, i) { | 1287 | bond_for_each_slave(bond, slave, i) { |
@@ -1361,9 +1292,9 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1361 | new_active = slave; | 1292 | new_active = slave; |
1362 | if (new_active == old_active) { | 1293 | if (new_active == old_active) { |
1363 | /* do nothing */ | 1294 | /* do nothing */ |
1364 | pr_info(DRV_NAME | 1295 | pr_info("%s: %s is already the current active slave.\n", |
1365 | ": %s: %s is already the current active slave.\n", | 1296 | bond->dev->name, |
1366 | bond->dev->name, slave->dev->name); | 1297 | slave->dev->name); |
1367 | goto out; | 1298 | goto out; |
1368 | } | 1299 | } |
1369 | else { | 1300 | else { |
@@ -1371,16 +1302,15 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1371 | (old_active) && | 1302 | (old_active) && |
1372 | (new_active->link == BOND_LINK_UP) && | 1303 | (new_active->link == BOND_LINK_UP) && |
1373 | IS_UP(new_active->dev)) { | 1304 | IS_UP(new_active->dev)) { |
1374 | pr_info(DRV_NAME | 1305 | pr_info("%s: Setting %s as active slave.\n", |
1375 | ": %s: Setting %s as active slave.\n", | 1306 | bond->dev->name, |
1376 | bond->dev->name, slave->dev->name); | 1307 | slave->dev->name); |
1377 | bond_change_active_slave(bond, new_active); | 1308 | bond_change_active_slave(bond, new_active); |
1378 | } | 1309 | } |
1379 | else { | 1310 | else { |
1380 | pr_info(DRV_NAME | 1311 | pr_info("%s: Could not set %s as active slave; either %s is down or the link is down.\n", |
1381 | ": %s: Could not set %s as active slave; " | 1312 | bond->dev->name, |
1382 | "either %s is down or the link is down.\n", | 1313 | slave->dev->name, |
1383 | bond->dev->name, slave->dev->name, | ||
1384 | slave->dev->name); | 1314 | slave->dev->name); |
1385 | } | 1315 | } |
1386 | goto out; | 1316 | goto out; |
@@ -1391,14 +1321,12 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1391 | /* if we got here, then we didn't match the name of any slave */ | 1321 | /* if we got here, then we didn't match the name of any slave */ |
1392 | 1322 | ||
1393 | if (strlen(buf) == 0 || buf[0] == '\n') { | 1323 | if (strlen(buf) == 0 || buf[0] == '\n') { |
1394 | pr_info(DRV_NAME | 1324 | pr_info("%s: Setting active slave to None.\n", |
1395 | ": %s: Setting active slave to None.\n", | ||
1396 | bond->dev->name); | 1325 | bond->dev->name); |
1397 | bond->primary_slave = NULL; | 1326 | bond->primary_slave = NULL; |
1398 | bond_select_active_slave(bond); | 1327 | bond_select_active_slave(bond); |
1399 | } else { | 1328 | } else { |
1400 | pr_info(DRV_NAME ": %s: Unable to set %.*s" | 1329 | pr_info("%s: Unable to set %.*s as active slave as it is not a slave.\n", |
1401 | " as active slave as it is not a slave.\n", | ||
1402 | bond->dev->name, (int)strlen(buf) - 1, buf); | 1330 | bond->dev->name, (int)strlen(buf) - 1, buf); |
1403 | } | 1331 | } |
1404 | } | 1332 | } |
@@ -1600,8 +1528,7 @@ int bond_create_sysfs(void) | |||
1600 | /* Is someone being kinky and naming a device bonding_master? */ | 1528 | /* Is someone being kinky and naming a device bonding_master? */ |
1601 | if (__dev_get_by_name(&init_net, | 1529 | if (__dev_get_by_name(&init_net, |
1602 | class_attr_bonding_masters.attr.name)) | 1530 | class_attr_bonding_masters.attr.name)) |
1603 | pr_err("network device named %s already " | 1531 | pr_err("network device named %s already exists in sysfs", |
1604 | "exists in sysfs", | ||
1605 | class_attr_bonding_masters.attr.name); | 1532 | class_attr_bonding_masters.attr.name); |
1606 | ret = 0; | 1533 | ret = 0; |
1607 | } | 1534 | } |