aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2009-12-13 23:06:07 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-13 23:06:07 -0500
commita4aee5c808fc5bf6889c9012217841eb3fd91a6a (patch)
tree28b2f17a9907685ab530b20d46bc9d50797ae692 /drivers
parent231d52a7bec6d141883d81dbb5516bff4a07533b (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')
-rw-r--r--drivers/net/bonding/bond_3ad.c171
-rw-r--r--drivers/net/bonding/bond_alb.c38
-rw-r--r--drivers/net/bonding/bond_ipv6.c12
-rw-r--r--drivers/net/bonding/bond_main.c607
-rw-r--r--drivers/net/bonding/bond_sysfs.c327
5 files changed, 465 insertions, 690 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index d69e6838f21e..0fb7a4964e75 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -20,6 +20,8 @@
20 * 20 *
21 */ 21 */
22 22
23#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
23#include <linux/skbuff.h> 25#include <linux/skbuff.h>
24#include <linux/if_ether.h> 26#include <linux/if_ether.h>
25#include <linux/netdevice.h> 27#include <linux/netdevice.h>
@@ -352,7 +354,8 @@ static u16 __get_link_speed(struct port *port)
352 } 354 }
353 } 355 }
354 356
355 pr_debug("Port %d Received link speed %d update from adapter\n", port->actor_port_number, speed); 357 pr_debug("Port %d Received link speed %d update from adapter\n",
358 port->actor_port_number, speed);
356 return speed; 359 return speed;
357} 360}
358 361
@@ -378,12 +381,14 @@ static u8 __get_duplex(struct port *port)
378 switch (slave->duplex) { 381 switch (slave->duplex) {
379 case DUPLEX_FULL: 382 case DUPLEX_FULL:
380 retval=0x1; 383 retval=0x1;
381 pr_debug("Port %d Received status full duplex update from adapter\n", port->actor_port_number); 384 pr_debug("Port %d Received status full duplex update from adapter\n",
385 port->actor_port_number);
382 break; 386 break;
383 case DUPLEX_HALF: 387 case DUPLEX_HALF:
384 default: 388 default:
385 retval=0x0; 389 retval=0x0;
386 pr_debug("Port %d Received status NOT full duplex update from adapter\n", port->actor_port_number); 390 pr_debug("Port %d Received status NOT full duplex update from adapter\n",
391 port->actor_port_number);
387 break; 392 break;
388 } 393 }
389 } 394 }
@@ -980,7 +985,9 @@ static void ad_mux_machine(struct port *port)
980 985
981 // check if the state machine was changed 986 // check if the state machine was changed
982 if (port->sm_mux_state != last_state) { 987 if (port->sm_mux_state != last_state) {
983 pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_mux_state); 988 pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n",
989 port->actor_port_number, last_state,
990 port->sm_mux_state);
984 switch (port->sm_mux_state) { 991 switch (port->sm_mux_state) {
985 case AD_MUX_DETACHED: 992 case AD_MUX_DETACHED:
986 __detach_bond_from_agg(port); 993 __detach_bond_from_agg(port);
@@ -1079,7 +1086,9 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
1079 1086
1080 // check if the State machine was changed or new lacpdu arrived 1087 // check if the State machine was changed or new lacpdu arrived
1081 if ((port->sm_rx_state != last_state) || (lacpdu)) { 1088 if ((port->sm_rx_state != last_state) || (lacpdu)) {
1082 pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_rx_state); 1089 pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n",
1090 port->actor_port_number, last_state,
1091 port->sm_rx_state);
1083 switch (port->sm_rx_state) { 1092 switch (port->sm_rx_state) {
1084 case AD_RX_INITIALIZE: 1093 case AD_RX_INITIALIZE:
1085 if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) { 1094 if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) {
@@ -1126,9 +1135,8 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
1126 // detect loopback situation 1135 // detect loopback situation
1127 if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) { 1136 if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) {
1128 // INFO_RECEIVED_LOOPBACK_FRAMES 1137 // INFO_RECEIVED_LOOPBACK_FRAMES
1129 pr_err(DRV_NAME ": %s: An illegal loopback occurred on " 1138 pr_err("%s: An illegal loopback occurred on adapter (%s).\n"
1130 "adapter (%s). Check the configuration to verify that all " 1139 "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n",
1131 "Adapters are connected to 802.3ad compliant switch ports\n",
1132 port->slave->dev->master->name, port->slave->dev->name); 1140 port->slave->dev->master->name, port->slave->dev->name);
1133 __release_rx_machine_lock(port); 1141 __release_rx_machine_lock(port);
1134 return; 1142 return;
@@ -1166,7 +1174,8 @@ static void ad_tx_machine(struct port *port)
1166 __update_lacpdu_from_port(port); 1174 __update_lacpdu_from_port(port);
1167 1175
1168 if (ad_lacpdu_send(port) >= 0) { 1176 if (ad_lacpdu_send(port) >= 0) {
1169 pr_debug("Sent LACPDU on port %d\n", port->actor_port_number); 1177 pr_debug("Sent LACPDU on port %d\n",
1178 port->actor_port_number);
1170 1179
1171 /* mark ntt as false, so it will not be sent again until 1180 /* mark ntt as false, so it will not be sent again until
1172 demanded */ 1181 demanded */
@@ -1241,7 +1250,9 @@ static void ad_periodic_machine(struct port *port)
1241 1250
1242 // check if the state machine was changed 1251 // check if the state machine was changed
1243 if (port->sm_periodic_state != last_state) { 1252 if (port->sm_periodic_state != last_state) {
1244 pr_debug("Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_periodic_state); 1253 pr_debug("Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n",
1254 port->actor_port_number, last_state,
1255 port->sm_periodic_state);
1245 switch (port->sm_periodic_state) { 1256 switch (port->sm_periodic_state) {
1246 case AD_NO_PERIODIC: 1257 case AD_NO_PERIODIC:
1247 port->sm_periodic_timer_counter = 0; // zero timer 1258 port->sm_periodic_timer_counter = 0; // zero timer
@@ -1298,7 +1309,9 @@ static void ad_port_selection_logic(struct port *port)
1298 port->next_port_in_aggregator=NULL; 1309 port->next_port_in_aggregator=NULL;
1299 port->actor_port_aggregator_identifier=0; 1310 port->actor_port_aggregator_identifier=0;
1300 1311
1301 pr_debug("Port %d left LAG %d\n", port->actor_port_number, temp_aggregator->aggregator_identifier); 1312 pr_debug("Port %d left LAG %d\n",
1313 port->actor_port_number,
1314 temp_aggregator->aggregator_identifier);
1302 // if the aggregator is empty, clear its parameters, and set it ready to be attached 1315 // if the aggregator is empty, clear its parameters, and set it ready to be attached
1303 if (!temp_aggregator->lag_ports) { 1316 if (!temp_aggregator->lag_ports) {
1304 ad_clear_agg(temp_aggregator); 1317 ad_clear_agg(temp_aggregator);
@@ -1307,9 +1320,7 @@ static void ad_port_selection_logic(struct port *port)
1307 } 1320 }
1308 } 1321 }
1309 if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list 1322 if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list
1310 pr_warning(DRV_NAME ": %s: Warning: Port %d (on %s) " 1323 pr_warning("%s: Warning: Port %d (on %s) was related to aggregator %d but was not on its port list\n",
1311 "was related to aggregator %d but was not "
1312 "on its port list\n",
1313 port->slave->dev->master->name, 1324 port->slave->dev->master->name,
1314 port->actor_port_number, 1325 port->actor_port_number,
1315 port->slave->dev->name, 1326 port->slave->dev->name,
@@ -1343,7 +1354,9 @@ static void ad_port_selection_logic(struct port *port)
1343 port->next_port_in_aggregator=aggregator->lag_ports; 1354 port->next_port_in_aggregator=aggregator->lag_ports;
1344 port->aggregator->num_of_ports++; 1355 port->aggregator->num_of_ports++;
1345 aggregator->lag_ports=port; 1356 aggregator->lag_ports=port;
1346 pr_debug("Port %d joined LAG %d(existing LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier); 1357 pr_debug("Port %d joined LAG %d(existing LAG)\n",
1358 port->actor_port_number,
1359 port->aggregator->aggregator_identifier);
1347 1360
1348 // mark this port as selected 1361 // mark this port as selected
1349 port->sm_vars |= AD_PORT_SELECTED; 1362 port->sm_vars |= AD_PORT_SELECTED;
@@ -1380,10 +1393,11 @@ static void ad_port_selection_logic(struct port *port)
1380 // mark this port as selected 1393 // mark this port as selected
1381 port->sm_vars |= AD_PORT_SELECTED; 1394 port->sm_vars |= AD_PORT_SELECTED;
1382 1395
1383 pr_debug("Port %d joined LAG %d(new LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier); 1396 pr_debug("Port %d joined LAG %d(new LAG)\n",
1397 port->actor_port_number,
1398 port->aggregator->aggregator_identifier);
1384 } else { 1399 } else {
1385 pr_err(DRV_NAME ": %s: Port %d (on %s) did not find " 1400 pr_err("%s: Port %d (on %s) did not find a suitable aggregator\n",
1386 "a suitable aggregator\n",
1387 port->slave->dev->master->name, 1401 port->slave->dev->master->name,
1388 port->actor_port_number, port->slave->dev->name); 1402 port->actor_port_number, port->slave->dev->name);
1389 } 1403 }
@@ -1460,8 +1474,7 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1460 break; 1474 break;
1461 1475
1462 default: 1476 default:
1463 pr_warning(DRV_NAME 1477 pr_warning("%s: Impossible agg select mode %d\n",
1464 ": %s: Impossible agg select mode %d\n",
1465 curr->slave->dev->master->name, 1478 curr->slave->dev->master->name,
1466 __get_agg_selection_mode(curr->lag_ports)); 1479 __get_agg_selection_mode(curr->lag_ports));
1467 break; 1480 break;
@@ -1546,40 +1559,38 @@ static void ad_agg_selection_logic(struct aggregator *agg)
1546 // if there is new best aggregator, activate it 1559 // if there is new best aggregator, activate it
1547 if (best) { 1560 if (best) {
1548 pr_debug("best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", 1561 pr_debug("best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
1549 best->aggregator_identifier, best->num_of_ports, 1562 best->aggregator_identifier, best->num_of_ports,
1550 best->actor_oper_aggregator_key, 1563 best->actor_oper_aggregator_key,
1551 best->partner_oper_aggregator_key, 1564 best->partner_oper_aggregator_key,
1552 best->is_individual, best->is_active); 1565 best->is_individual, best->is_active);
1553 pr_debug("best ports %p slave %p %s\n", 1566 pr_debug("best ports %p slave %p %s\n",
1554 best->lag_ports, best->slave, 1567 best->lag_ports, best->slave,
1555 best->slave ? best->slave->dev->name : "NULL"); 1568 best->slave ? best->slave->dev->name : "NULL");
1556 1569
1557 for (agg = __get_first_agg(best->lag_ports); agg; 1570 for (agg = __get_first_agg(best->lag_ports); agg;
1558 agg = __get_next_agg(agg)) { 1571 agg = __get_next_agg(agg)) {
1559 1572
1560 pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", 1573 pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
1561 agg->aggregator_identifier, agg->num_of_ports, 1574 agg->aggregator_identifier, agg->num_of_ports,
1562 agg->actor_oper_aggregator_key, 1575 agg->actor_oper_aggregator_key,
1563 agg->partner_oper_aggregator_key, 1576 agg->partner_oper_aggregator_key,
1564 agg->is_individual, agg->is_active); 1577 agg->is_individual, agg->is_active);
1565 } 1578 }
1566 1579
1567 // check if any partner replys 1580 // check if any partner replys
1568 if (best->is_individual) { 1581 if (best->is_individual) {
1569 pr_warning(DRV_NAME ": %s: Warning: No 802.3ad" 1582 pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n",
1570 " response from the link partner for any" 1583 best->slave->dev->master->name);
1571 " adapters in the bond\n",
1572 best->slave->dev->master->name);
1573 } 1584 }
1574 1585
1575 best->is_active = 1; 1586 best->is_active = 1;
1576 pr_debug("LAG %d chosen as the active LAG\n", 1587 pr_debug("LAG %d chosen as the active LAG\n",
1577 best->aggregator_identifier); 1588 best->aggregator_identifier);
1578 pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", 1589 pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
1579 best->aggregator_identifier, best->num_of_ports, 1590 best->aggregator_identifier, best->num_of_ports,
1580 best->actor_oper_aggregator_key, 1591 best->actor_oper_aggregator_key,
1581 best->partner_oper_aggregator_key, 1592 best->partner_oper_aggregator_key,
1582 best->is_individual, best->is_active); 1593 best->is_individual, best->is_active);
1583 1594
1584 // disable the ports that were related to the former active_aggregator 1595 // disable the ports that were related to the former active_aggregator
1585 if (active) { 1596 if (active) {
@@ -1633,7 +1644,8 @@ static void ad_clear_agg(struct aggregator *aggregator)
1633 aggregator->lag_ports = NULL; 1644 aggregator->lag_ports = NULL;
1634 aggregator->is_active = 0; 1645 aggregator->is_active = 0;
1635 aggregator->num_of_ports = 0; 1646 aggregator->num_of_ports = 0;
1636 pr_debug("LAG %d was cleared\n", aggregator->aggregator_identifier); 1647 pr_debug("LAG %d was cleared\n",
1648 aggregator->aggregator_identifier);
1637 } 1649 }
1638} 1650}
1639 1651
@@ -1728,7 +1740,9 @@ static void ad_initialize_port(struct port *port, int lacp_fast)
1728static void ad_enable_collecting_distributing(struct port *port) 1740static void ad_enable_collecting_distributing(struct port *port)
1729{ 1741{
1730 if (port->aggregator->is_active) { 1742 if (port->aggregator->is_active) {
1731 pr_debug("Enabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier); 1743 pr_debug("Enabling port %d(LAG %d)\n",
1744 port->actor_port_number,
1745 port->aggregator->aggregator_identifier);
1732 __enable_port(port); 1746 __enable_port(port);
1733 } 1747 }
1734} 1748}
@@ -1741,7 +1755,9 @@ static void ad_enable_collecting_distributing(struct port *port)
1741static void ad_disable_collecting_distributing(struct port *port) 1755static void ad_disable_collecting_distributing(struct port *port)
1742{ 1756{
1743 if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) { 1757 if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) {
1744 pr_debug("Disabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier); 1758 pr_debug("Disabling port %d(LAG %d)\n",
1759 port->actor_port_number,
1760 port->aggregator->aggregator_identifier);
1745 __disable_port(port); 1761 __disable_port(port);
1746 } 1762 }
1747} 1763}
@@ -1779,7 +1795,8 @@ static void ad_marker_info_send(struct port *port)
1779 1795
1780 // send the marker information 1796 // send the marker information
1781 if (ad_marker_send(port, &marker) >= 0) { 1797 if (ad_marker_send(port, &marker) >= 0) {
1782 pr_debug("Sent Marker Information on port %d\n", port->actor_port_number); 1798 pr_debug("Sent Marker Information on port %d\n",
1799 port->actor_port_number);
1783 } 1800 }
1784} 1801}
1785#endif 1802#endif
@@ -1803,7 +1820,8 @@ static void ad_marker_info_received(struct bond_marker *marker_info,
1803 // send the marker response 1820 // send the marker response
1804 1821
1805 if (ad_marker_send(port, &marker) >= 0) { 1822 if (ad_marker_send(port, &marker) >= 0) {
1806 pr_debug("Sent Marker Response on port %d\n", port->actor_port_number); 1823 pr_debug("Sent Marker Response on port %d\n",
1824 port->actor_port_number);
1807 } 1825 }
1808} 1826}
1809 1827
@@ -1889,8 +1907,7 @@ int bond_3ad_bind_slave(struct slave *slave)
1889 struct aggregator *aggregator; 1907 struct aggregator *aggregator;
1890 1908
1891 if (bond == NULL) { 1909 if (bond == NULL) {
1892 pr_err(DRV_NAME ": %s: The slave %s is not attached to " 1910 pr_err("%s: The slave %s is not attached to its bond\n",
1893 "its bond\n",
1894 slave->dev->master->name, slave->dev->name); 1911 slave->dev->master->name, slave->dev->name);
1895 return -1; 1912 return -1;
1896 } 1913 }
@@ -1966,13 +1983,13 @@ void bond_3ad_unbind_slave(struct slave *slave)
1966 1983
1967 // if slave is null, the whole port is not initialized 1984 // if slave is null, the whole port is not initialized
1968 if (!port->slave) { 1985 if (!port->slave) {
1969 pr_warning(DRV_NAME ": Warning: %s: Trying to " 1986 pr_warning("Warning: %s: Trying to unbind an uninitialized port on %s\n",
1970 "unbind an uninitialized port on %s\n",
1971 slave->dev->master->name, slave->dev->name); 1987 slave->dev->master->name, slave->dev->name);
1972 return; 1988 return;
1973 } 1989 }
1974 1990
1975 pr_debug("Unbinding Link Aggregation Group %d\n", aggregator->aggregator_identifier); 1991 pr_debug("Unbinding Link Aggregation Group %d\n",
1992 aggregator->aggregator_identifier);
1976 1993
1977 /* Tell the partner that this port is not suitable for aggregation */ 1994 /* Tell the partner that this port is not suitable for aggregation */
1978 port->actor_oper_port_state &= ~AD_STATE_AGGREGATION; 1995 port->actor_oper_port_state &= ~AD_STATE_AGGREGATION;
@@ -1996,10 +2013,12 @@ void bond_3ad_unbind_slave(struct slave *slave)
1996 // if new aggregator found, copy the aggregator's parameters 2013 // if new aggregator found, copy the aggregator's parameters
1997 // and connect the related lag_ports to the new aggregator 2014 // and connect the related lag_ports to the new aggregator
1998 if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { 2015 if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) {
1999 pr_debug("Some port(s) related to LAG %d - replaceing with LAG %d\n", aggregator->aggregator_identifier, new_aggregator->aggregator_identifier); 2016 pr_debug("Some port(s) related to LAG %d - replaceing with LAG %d\n",
2017 aggregator->aggregator_identifier,
2018 new_aggregator->aggregator_identifier);
2000 2019
2001 if ((new_aggregator->lag_ports == port) && new_aggregator->is_active) { 2020 if ((new_aggregator->lag_ports == port) && new_aggregator->is_active) {
2002 pr_info(DRV_NAME ": %s: Removing an active aggregator\n", 2021 pr_info("%s: Removing an active aggregator\n",
2003 aggregator->slave->dev->master->name); 2022 aggregator->slave->dev->master->name);
2004 // select new active aggregator 2023 // select new active aggregator
2005 select_new_active_agg = 1; 2024 select_new_active_agg = 1;
@@ -2030,8 +2049,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
2030 ad_agg_selection_logic(__get_first_agg(port)); 2049 ad_agg_selection_logic(__get_first_agg(port));
2031 } 2050 }
2032 } else { 2051 } else {
2033 pr_warning(DRV_NAME ": %s: Warning: unbinding aggregator, " 2052 pr_warning("%s: Warning: unbinding aggregator, and could not find a new aggregator for its ports\n",
2034 "and could not find a new aggregator for its ports\n",
2035 slave->dev->master->name); 2053 slave->dev->master->name);
2036 } 2054 }
2037 } else { // in case that the only port related to this aggregator is the one we want to remove 2055 } else { // in case that the only port related to this aggregator is the one we want to remove
@@ -2039,7 +2057,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
2039 // clear the aggregator 2057 // clear the aggregator
2040 ad_clear_agg(aggregator); 2058 ad_clear_agg(aggregator);
2041 if (select_new_active_agg) { 2059 if (select_new_active_agg) {
2042 pr_info(DRV_NAME ": %s: Removing an active aggregator\n", 2060 pr_info("%s: Removing an active aggregator\n",
2043 slave->dev->master->name); 2061 slave->dev->master->name);
2044 // select new active aggregator 2062 // select new active aggregator
2045 ad_agg_selection_logic(__get_first_agg(port)); 2063 ad_agg_selection_logic(__get_first_agg(port));
@@ -2066,7 +2084,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
2066 // clear the aggregator 2084 // clear the aggregator
2067 ad_clear_agg(temp_aggregator); 2085 ad_clear_agg(temp_aggregator);
2068 if (select_new_active_agg) { 2086 if (select_new_active_agg) {
2069 pr_info(DRV_NAME ": %s: Removing an active aggregator\n", 2087 pr_info("%s: Removing an active aggregator\n",
2070 slave->dev->master->name); 2088 slave->dev->master->name);
2071 // select new active aggregator 2089 // select new active aggregator
2072 ad_agg_selection_logic(__get_first_agg(port)); 2090 ad_agg_selection_logic(__get_first_agg(port));
@@ -2115,8 +2133,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
2115 // select the active aggregator for the bond 2133 // select the active aggregator for the bond
2116 if ((port = __get_first_port(bond))) { 2134 if ((port = __get_first_port(bond))) {
2117 if (!port->slave) { 2135 if (!port->slave) {
2118 pr_warning(DRV_NAME ": %s: Warning: bond's first port is " 2136 pr_warning("%s: Warning: bond's first port is uninitialized\n",
2119 "uninitialized\n", bond->dev->name); 2137 bond->dev->name);
2120 goto re_arm; 2138 goto re_arm;
2121 } 2139 }
2122 2140
@@ -2129,8 +2147,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
2129 // for each port run the state machines 2147 // for each port run the state machines
2130 for (port = __get_first_port(bond); port; port = __get_next_port(port)) { 2148 for (port = __get_first_port(bond); port; port = __get_next_port(port)) {
2131 if (!port->slave) { 2149 if (!port->slave) {
2132 pr_warning(DRV_NAME ": %s: Warning: Found an uninitialized " 2150 pr_warning("%s: Warning: Found an uninitialized port\n",
2133 "port\n", bond->dev->name); 2151 bond->dev->name);
2134 goto re_arm; 2152 goto re_arm;
2135 } 2153 }
2136 2154
@@ -2171,15 +2189,15 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2171 port = &(SLAVE_AD_INFO(slave).port); 2189 port = &(SLAVE_AD_INFO(slave).port);
2172 2190
2173 if (!port->slave) { 2191 if (!port->slave) {
2174 pr_warning(DRV_NAME ": %s: Warning: port of slave %s " 2192 pr_warning("%s: Warning: port of slave %s is uninitialized\n",
2175 "is uninitialized\n",
2176 slave->dev->name, slave->dev->master->name); 2193 slave->dev->name, slave->dev->master->name);
2177 return; 2194 return;
2178 } 2195 }
2179 2196
2180 switch (lacpdu->subtype) { 2197 switch (lacpdu->subtype) {
2181 case AD_TYPE_LACPDU: 2198 case AD_TYPE_LACPDU:
2182 pr_debug("Received LACPDU on port %d\n", port->actor_port_number); 2199 pr_debug("Received LACPDU on port %d\n",
2200 port->actor_port_number);
2183 ad_rx_machine(lacpdu, port); 2201 ad_rx_machine(lacpdu, port);
2184 break; 2202 break;
2185 2203
@@ -2188,17 +2206,20 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2188 2206
2189 switch (((struct bond_marker *)lacpdu)->tlv_type) { 2207 switch (((struct bond_marker *)lacpdu)->tlv_type) {
2190 case AD_MARKER_INFORMATION_SUBTYPE: 2208 case AD_MARKER_INFORMATION_SUBTYPE:
2191 pr_debug("Received Marker Information on port %d\n", port->actor_port_number); 2209 pr_debug("Received Marker Information on port %d\n",
2210 port->actor_port_number);
2192 ad_marker_info_received((struct bond_marker *)lacpdu, port); 2211 ad_marker_info_received((struct bond_marker *)lacpdu, port);
2193 break; 2212 break;
2194 2213
2195 case AD_MARKER_RESPONSE_SUBTYPE: 2214 case AD_MARKER_RESPONSE_SUBTYPE:
2196 pr_debug("Received Marker Response on port %d\n", port->actor_port_number); 2215 pr_debug("Received Marker Response on port %d\n",
2216 port->actor_port_number);
2197 ad_marker_response_received((struct bond_marker *)lacpdu, port); 2217 ad_marker_response_received((struct bond_marker *)lacpdu, port);
2198 break; 2218 break;
2199 2219
2200 default: 2220 default:
2201 pr_debug("Received an unknown Marker subtype on slot %d\n", port->actor_port_number); 2221 pr_debug("Received an unknown Marker subtype on slot %d\n",
2222 port->actor_port_number);
2202 } 2223 }
2203 } 2224 }
2204 } 2225 }
@@ -2218,8 +2239,7 @@ void bond_3ad_adapter_speed_changed(struct slave *slave)
2218 2239
2219 // if slave is null, the whole port is not initialized 2240 // if slave is null, the whole port is not initialized
2220 if (!port->slave) { 2241 if (!port->slave) {
2221 pr_warning(DRV_NAME ": Warning: %s: speed " 2242 pr_warning("Warning: %s: speed changed for uninitialized port on %s\n",
2222 "changed for uninitialized port on %s\n",
2223 slave->dev->master->name, slave->dev->name); 2243 slave->dev->master->name, slave->dev->name);
2224 return; 2244 return;
2225 } 2245 }
@@ -2246,8 +2266,7 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave)
2246 2266
2247 // if slave is null, the whole port is not initialized 2267 // if slave is null, the whole port is not initialized
2248 if (!port->slave) { 2268 if (!port->slave) {
2249 pr_warning(DRV_NAME ": %s: Warning: duplex changed " 2269 pr_warning("%s: Warning: duplex changed for uninitialized port on %s\n",
2250 "for uninitialized port on %s\n",
2251 slave->dev->master->name, slave->dev->name); 2270 slave->dev->master->name, slave->dev->name);
2252 return; 2271 return;
2253 } 2272 }
@@ -2275,8 +2294,7 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)
2275 2294
2276 // if slave is null, the whole port is not initialized 2295 // if slave is null, the whole port is not initialized
2277 if (!port->slave) { 2296 if (!port->slave) {
2278 pr_warning(DRV_NAME ": Warning: %s: link status changed for " 2297 pr_warning("Warning: %s: link status changed for uninitialized port on %s\n",
2279 "uninitialized port on %s\n",
2280 slave->dev->master->name, slave->dev->name); 2298 slave->dev->master->name, slave->dev->name);
2281 return; 2299 return;
2282 } 2300 }
@@ -2381,8 +2399,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2381 } 2399 }
2382 2400
2383 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { 2401 if (bond_3ad_get_active_agg_info(bond, &ad_info)) {
2384 pr_debug(DRV_NAME ": %s: Error: " 2402 pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n",
2385 "bond_3ad_get_active_agg_info failed\n", dev->name); 2403 dev->name);
2386 goto out; 2404 goto out;
2387 } 2405 }
2388 2406
@@ -2391,8 +2409,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2391 2409
2392 if (slaves_in_agg == 0) { 2410 if (slaves_in_agg == 0) {
2393 /*the aggregator is empty*/ 2411 /*the aggregator is empty*/
2394 pr_debug(DRV_NAME ": %s: Error: active aggregator is empty\n", 2412 pr_debug("%s: Error: active aggregator is empty\n", dev->name);
2395 dev->name);
2396 goto out; 2413 goto out;
2397 } 2414 }
2398 2415
@@ -2410,8 +2427,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2410 } 2427 }
2411 2428
2412 if (slave_agg_no >= 0) { 2429 if (slave_agg_no >= 0) {
2413 pr_err(DRV_NAME ": %s: Error: Couldn't find a slave to tx on " 2430 pr_err("%s: Error: Couldn't find a slave to tx on for aggregator ID %d\n",
2414 "for aggregator ID %d\n", dev->name, agg_id); 2431 dev->name, agg_id);
2415 goto out; 2432 goto out;
2416 } 2433 }
2417 2434
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 00ab51ef3129..40fdc41446cc 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -20,6 +20,8 @@
20 * 20 *
21 */ 21 */
22 22
23#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
23#include <linux/skbuff.h> 25#include <linux/skbuff.h>
24#include <linux/netdevice.h> 26#include <linux/netdevice.h>
25#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
@@ -201,8 +203,7 @@ static int tlb_initialize(struct bonding *bond)
201 203
202 new_hashtbl = kzalloc(size, GFP_KERNEL); 204 new_hashtbl = kzalloc(size, GFP_KERNEL);
203 if (!new_hashtbl) { 205 if (!new_hashtbl) {
204 pr_err(DRV_NAME 206 pr_err("%s: Error: Failed to allocate TLB hash table\n",
205 ": %s: Error: Failed to allocate TLB hash table\n",
206 bond->dev->name); 207 bond->dev->name);
207 return -1; 208 return -1;
208 } 209 }
@@ -514,8 +515,7 @@ static void rlb_update_client(struct rlb_client_info *client_info)
514 client_info->slave->dev->dev_addr, 515 client_info->slave->dev->dev_addr,
515 client_info->mac_dst); 516 client_info->mac_dst);
516 if (!skb) { 517 if (!skb) {
517 pr_err(DRV_NAME 518 pr_err("%s: Error: failed to create an ARP packet\n",
518 ": %s: Error: failed to create an ARP packet\n",
519 client_info->slave->dev->master->name); 519 client_info->slave->dev->master->name);
520 continue; 520 continue;
521 } 521 }
@@ -525,8 +525,7 @@ static void rlb_update_client(struct rlb_client_info *client_info)
525 if (client_info->tag) { 525 if (client_info->tag) {
526 skb = vlan_put_tag(skb, client_info->vlan_id); 526 skb = vlan_put_tag(skb, client_info->vlan_id);
527 if (!skb) { 527 if (!skb) {
528 pr_err(DRV_NAME 528 pr_err("%s: Error: failed to insert VLAN tag\n",
529 ": %s: Error: failed to insert VLAN tag\n",
530 client_info->slave->dev->master->name); 529 client_info->slave->dev->master->name);
531 continue; 530 continue;
532 } 531 }
@@ -609,9 +608,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip)
609 client_info = &(bond_info->rx_hashtbl[hash_index]); 608 client_info = &(bond_info->rx_hashtbl[hash_index]);
610 609
611 if (!client_info->slave) { 610 if (!client_info->slave) {
612 pr_err(DRV_NAME 611 pr_err("%s: Error: found a client with no channel in the client's hash table\n",
613 ": %s: Error: found a client with no channel in "
614 "the client's hash table\n",
615 bond->dev->name); 612 bond->dev->name);
616 continue; 613 continue;
617 } 614 }
@@ -806,8 +803,7 @@ static int rlb_initialize(struct bonding *bond)
806 803
807 new_hashtbl = kmalloc(size, GFP_KERNEL); 804 new_hashtbl = kmalloc(size, GFP_KERNEL);
808 if (!new_hashtbl) { 805 if (!new_hashtbl) {
809 pr_err(DRV_NAME 806 pr_err("%s: Error: Failed to allocate RLB hash table\n",
810 ": %s: Error: Failed to allocate RLB hash table\n",
811 bond->dev->name); 807 bond->dev->name);
812 return -1; 808 return -1;
813 } 809 }
@@ -928,8 +924,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
928 924
929 skb = vlan_put_tag(skb, vlan->vlan_id); 925 skb = vlan_put_tag(skb, vlan->vlan_id);
930 if (!skb) { 926 if (!skb) {
931 pr_err(DRV_NAME 927 pr_err("%s: Error: failed to insert VLAN tag\n",
932 ": %s: Error: failed to insert VLAN tag\n",
933 bond->dev->name); 928 bond->dev->name);
934 continue; 929 continue;
935 } 930 }
@@ -958,11 +953,8 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
958 memcpy(s_addr.sa_data, addr, dev->addr_len); 953 memcpy(s_addr.sa_data, addr, dev->addr_len);
959 s_addr.sa_family = dev->type; 954 s_addr.sa_family = dev->type;
960 if (dev_set_mac_address(dev, &s_addr)) { 955 if (dev_set_mac_address(dev, &s_addr)) {
961 pr_err(DRV_NAME 956 pr_err("%s: Error: dev_set_mac_address of dev %s failed!\n"
962 ": %s: Error: dev_set_mac_address of dev %s failed! ALB " 957 "ALB mode requires that the base driver support setting the hw address also when the network device's interface is open\n",
963 "mode requires that the base driver support setting "
964 "the hw address also when the network device's "
965 "interface is open\n",
966 dev->master->name, dev->name); 958 dev->master->name, dev->name);
967 return -EOPNOTSUPP; 959 return -EOPNOTSUPP;
968 } 960 }
@@ -1169,18 +1161,12 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1169 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr, 1161 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
1170 bond->alb_info.rlb_enabled); 1162 bond->alb_info.rlb_enabled);
1171 1163
1172 pr_warning(DRV_NAME 1164 pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
1173 ": %s: Warning: the hw address of slave %s is "
1174 "in use by the bond; giving it the hw address "
1175 "of %s\n",
1176 bond->dev->name, slave->dev->name, 1165 bond->dev->name, slave->dev->name,
1177 free_mac_slave->dev->name); 1166 free_mac_slave->dev->name);
1178 1167
1179 } else if (has_bond_addr) { 1168 } else if (has_bond_addr) {
1180 pr_err(DRV_NAME 1169 pr_err("%s: Error: the hw address of slave %s is in use by the bond; couldn't find a slave with a free hw address to give it (this should not have happened)\n",
1181 ": %s: Error: the hw address of slave %s is in use by the "
1182 "bond; couldn't find a slave with a free hw address to "
1183 "give it (this should not have happened)\n",
1184 bond->dev->name, slave->dev->name); 1170 bond->dev->name, slave->dev->name);
1185 return -EFAULT; 1171 return -EFAULT;
1186 } 1172 }
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
index b72e1dc8cf8f..6dd64cf3cb76 100644
--- a/drivers/net/bonding/bond_ipv6.c
+++ b/drivers/net/bonding/bond_ipv6.c
@@ -20,6 +20,8 @@
20 * 20 *
21 */ 21 */
22 22
23#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
23#include <linux/types.h> 25#include <linux/types.h>
24#include <linux/if_vlan.h> 26#include <linux/if_vlan.h>
25#include <net/ipv6.h> 27#include <net/ipv6.h>
@@ -74,20 +76,20 @@ static void bond_na_send(struct net_device *slave_dev,
74 addrconf_addr_solict_mult(daddr, &mcaddr); 76 addrconf_addr_solict_mult(daddr, &mcaddr);
75 77
76 pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n", 78 pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n",
77 slave_dev->name, &mcaddr, daddr); 79 slave_dev->name, &mcaddr, daddr);
78 80
79 skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr, 81 skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr,
80 ND_OPT_TARGET_LL_ADDR); 82 ND_OPT_TARGET_LL_ADDR);
81 83
82 if (!skb) { 84 if (!skb) {
83 pr_err(DRV_NAME ": NA packet allocation failed\n"); 85 pr_err("NA packet allocation failed\n");
84 return; 86 return;
85 } 87 }
86 88
87 if (vlan_id) { 89 if (vlan_id) {
88 skb = vlan_put_tag(skb, vlan_id); 90 skb = vlan_put_tag(skb, vlan_id);
89 if (!skb) { 91 if (!skb) {
90 pr_err(DRV_NAME ": failed to insert VLAN tag\n"); 92 pr_err("failed to insert VLAN tag\n");
91 return; 93 return;
92 } 94 }
93 } 95 }
@@ -109,8 +111,8 @@ void bond_send_unsolicited_na(struct bonding *bond)
109 struct inet6_dev *idev; 111 struct inet6_dev *idev;
110 int is_router; 112 int is_router;
111 113
112 pr_debug("bond_send_unsol_na: bond %s slave %s\n", bond->dev->name, 114 pr_debug("%s: bond %s slave %s\n", bond->dev->name,
113 slave ? slave->dev->name : "NULL"); 115 __func__, slave ? slave->dev->name : "NULL");
114 116
115 if (!slave || !bond->send_unsol_na || 117 if (!slave || !bond->send_unsol_na ||
116 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) 118 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index af9b9c4eb496..3f0071cfe56b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -31,6 +31,8 @@
31 * 31 *
32 */ 32 */
33 33
34#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
35
34#include <linux/kernel.h> 36#include <linux/kernel.h>
35#include <linux/module.h> 37#include <linux/module.h>
36#include <linux/types.h> 38#include <linux/types.h>
@@ -260,7 +262,7 @@ static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id)
260 struct vlan_entry *vlan; 262 struct vlan_entry *vlan;
261 263
262 pr_debug("bond: %s, vlan id %d\n", 264 pr_debug("bond: %s, vlan id %d\n",
263 (bond ? bond->dev->name : "None"), vlan_id); 265 (bond ? bond->dev->name : "None"), vlan_id);
264 266
265 vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); 267 vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL);
266 if (!vlan) 268 if (!vlan)
@@ -303,8 +305,8 @@ static int bond_del_vlan(struct bonding *bond, unsigned short vlan_id)
303 if (bond_is_lb(bond)) 305 if (bond_is_lb(bond))
304 bond_alb_clear_vlan(bond, vlan_id); 306 bond_alb_clear_vlan(bond, vlan_id);
305 307
306 pr_debug("removed VLAN ID %d from bond %s\n", vlan_id, 308 pr_debug("removed VLAN ID %d from bond %s\n",
307 bond->dev->name); 309 vlan_id, bond->dev->name);
308 310
309 kfree(vlan); 311 kfree(vlan);
310 312
@@ -323,8 +325,8 @@ static int bond_del_vlan(struct bonding *bond, unsigned short vlan_id)
323 } 325 }
324 } 326 }
325 327
326 pr_debug("couldn't find VLAN ID %d in bond %s\n", vlan_id, 328 pr_debug("couldn't find VLAN ID %d in bond %s\n",
327 bond->dev->name); 329 vlan_id, bond->dev->name);
328 330
329out: 331out:
330 write_unlock_bh(&bond->lock); 332 write_unlock_bh(&bond->lock);
@@ -348,7 +350,7 @@ static int bond_has_challenged_slaves(struct bonding *bond)
348 bond_for_each_slave(bond, slave, i) { 350 bond_for_each_slave(bond, slave, i) {
349 if (slave->dev->features & NETIF_F_VLAN_CHALLENGED) { 351 if (slave->dev->features & NETIF_F_VLAN_CHALLENGED) {
350 pr_debug("found VLAN challenged slave - %s\n", 352 pr_debug("found VLAN challenged slave - %s\n",
351 slave->dev->name); 353 slave->dev->name);
352 return 1; 354 return 1;
353 } 355 }
354 } 356 }
@@ -499,8 +501,7 @@ static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
499 501
500 res = bond_add_vlan(bond, vid); 502 res = bond_add_vlan(bond, vid);
501 if (res) { 503 if (res) {
502 pr_err(DRV_NAME 504 pr_err("%s: Error: Failed to add vlan id %d\n",
503 ": %s: Error: Failed to add vlan id %d\n",
504 bond_dev->name, vid); 505 bond_dev->name, vid);
505 } 506 }
506} 507}
@@ -534,8 +535,7 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid)
534 535
535 res = bond_del_vlan(bond, vid); 536 res = bond_del_vlan(bond, vid);
536 if (res) { 537 if (res) {
537 pr_err(DRV_NAME 538 pr_err("%s: Error: Failed to remove vlan id %d\n",
538 ": %s: Error: Failed to remove vlan id %d\n",
539 bond_dev->name, vid); 539 bond_dev->name, vid);
540 } 540 }
541} 541}
@@ -1053,8 +1053,7 @@ static void bond_do_fail_over_mac(struct bonding *bond,
1053 1053
1054 rv = dev_set_mac_address(new_active->dev, &saddr); 1054 rv = dev_set_mac_address(new_active->dev, &saddr);
1055 if (rv) { 1055 if (rv) {
1056 pr_err(DRV_NAME 1056 pr_err("%s: Error %d setting MAC of slave %s\n",
1057 ": %s: Error %d setting MAC of slave %s\n",
1058 bond->dev->name, -rv, new_active->dev->name); 1057 bond->dev->name, -rv, new_active->dev->name);
1059 goto out; 1058 goto out;
1060 } 1059 }
@@ -1067,16 +1066,14 @@ static void bond_do_fail_over_mac(struct bonding *bond,
1067 1066
1068 rv = dev_set_mac_address(old_active->dev, &saddr); 1067 rv = dev_set_mac_address(old_active->dev, &saddr);
1069 if (rv) 1068 if (rv)
1070 pr_err(DRV_NAME 1069 pr_err("%s: Error %d setting MAC of slave %s\n",
1071 ": %s: Error %d setting MAC of slave %s\n",
1072 bond->dev->name, -rv, new_active->dev->name); 1070 bond->dev->name, -rv, new_active->dev->name);
1073out: 1071out:
1074 read_lock(&bond->lock); 1072 read_lock(&bond->lock);
1075 write_lock_bh(&bond->curr_slave_lock); 1073 write_lock_bh(&bond->curr_slave_lock);
1076 break; 1074 break;
1077 default: 1075 default:
1078 pr_err(DRV_NAME 1076 pr_err("%s: bond_do_fail_over_mac impossible: bad policy %d\n",
1079 ": %s: bond_do_fail_over_mac impossible: bad policy %d\n",
1080 bond->dev->name, bond->params.fail_over_mac); 1077 bond->dev->name, bond->params.fail_over_mac);
1081 break; 1078 break;
1082 } 1079 }
@@ -1178,11 +1175,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1178 1175
1179 if (new_active->link == BOND_LINK_BACK) { 1176 if (new_active->link == BOND_LINK_BACK) {
1180 if (USES_PRIMARY(bond->params.mode)) { 1177 if (USES_PRIMARY(bond->params.mode)) {
1181 pr_info(DRV_NAME 1178 pr_info("%s: making interface %s the new active one %d ms earlier.\n",
1182 ": %s: making interface %s the new " 1179 bond->dev->name, new_active->dev->name,
1183 "active one %d ms earlier.\n", 1180 (bond->params.updelay - new_active->delay) * bond->params.miimon);
1184 bond->dev->name, new_active->dev->name,
1185 (bond->params.updelay - new_active->delay) * bond->params.miimon);
1186 } 1181 }
1187 1182
1188 new_active->delay = 0; 1183 new_active->delay = 0;
@@ -1195,10 +1190,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1195 bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); 1190 bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP);
1196 } else { 1191 } else {
1197 if (USES_PRIMARY(bond->params.mode)) { 1192 if (USES_PRIMARY(bond->params.mode)) {
1198 pr_info(DRV_NAME 1193 pr_info("%s: making interface %s the new active one.\n",
1199 ": %s: making interface %s the new " 1194 bond->dev->name, new_active->dev->name);
1200 "active one.\n",
1201 bond->dev->name, new_active->dev->name);
1202 } 1195 }
1203 } 1196 }
1204 } 1197 }
@@ -1268,13 +1261,11 @@ void bond_select_active_slave(struct bonding *bond)
1268 return; 1261 return;
1269 1262
1270 if (netif_carrier_ok(bond->dev)) { 1263 if (netif_carrier_ok(bond->dev)) {
1271 pr_info(DRV_NAME 1264 pr_info("%s: first active interface up!\n",
1272 ": %s: first active interface up!\n", 1265 bond->dev->name);
1273 bond->dev->name);
1274 } else { 1266 } else {
1275 pr_info(DRV_NAME ": %s: " 1267 pr_info("%s: now running without any active interface !\n",
1276 "now running without any active interface !\n", 1268 bond->dev->name);
1277 bond->dev->name);
1278 } 1269 }
1279 } 1270 }
1280} 1271}
@@ -1423,16 +1414,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1423 1414
1424 if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && 1415 if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL &&
1425 slave_ops->ndo_do_ioctl == NULL) { 1416 slave_ops->ndo_do_ioctl == NULL) {
1426 pr_warning(DRV_NAME 1417 pr_warning("%s: Warning: no link monitoring support for %s\n",
1427 ": %s: Warning: no link monitoring support for %s\n", 1418 bond_dev->name, slave_dev->name);
1428 bond_dev->name, slave_dev->name);
1429 } 1419 }
1430 1420
1431 /* bond must be initialized by bond_open() before enslaving */ 1421 /* bond must be initialized by bond_open() before enslaving */
1432 if (!(bond_dev->flags & IFF_UP)) { 1422 if (!(bond_dev->flags & IFF_UP)) {
1433 pr_warning(DRV_NAME 1423 pr_warning("%s: master_dev is not up in bond_enslave\n",
1434 " %s: master_dev is not up in bond_enslave\n", 1424 bond_dev->name);
1435 bond_dev->name);
1436 } 1425 }
1437 1426
1438 /* already enslaved */ 1427 /* already enslaved */
@@ -1446,19 +1435,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1446 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { 1435 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
1447 pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); 1436 pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
1448 if (!list_empty(&bond->vlan_list)) { 1437 if (!list_empty(&bond->vlan_list)) {
1449 pr_err(DRV_NAME 1438 pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
1450 ": %s: Error: cannot enslave VLAN " 1439 bond_dev->name, slave_dev->name, bond_dev->name);
1451 "challenged slave %s on VLAN enabled "
1452 "bond %s\n", bond_dev->name, slave_dev->name,
1453 bond_dev->name);
1454 return -EPERM; 1440 return -EPERM;
1455 } else { 1441 } else {
1456 pr_warning(DRV_NAME 1442 pr_warning("%s: Warning: enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n",
1457 ": %s: Warning: enslaved VLAN challenged " 1443 bond_dev->name, slave_dev->name,
1458 "slave %s. Adding VLANs will be blocked as " 1444 slave_dev->name, bond_dev->name);
1459 "long as %s is part of bond %s\n",
1460 bond_dev->name, slave_dev->name, slave_dev->name,
1461 bond_dev->name);
1462 bond_dev->features |= NETIF_F_VLAN_CHALLENGED; 1445 bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
1463 } 1446 }
1464 } else { 1447 } else {
@@ -1478,8 +1461,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1478 * enslaving it; the old ifenslave will not. 1461 * enslaving it; the old ifenslave will not.
1479 */ 1462 */
1480 if ((slave_dev->flags & IFF_UP)) { 1463 if ((slave_dev->flags & IFF_UP)) {
1481 pr_err(DRV_NAME ": %s is up. " 1464 pr_err("%s is up. This may be due to an out of date ifenslave.\n",
1482 "This may be due to an out of date ifenslave.\n",
1483 slave_dev->name); 1465 slave_dev->name);
1484 res = -EPERM; 1466 res = -EPERM;
1485 goto err_undo_flags; 1467 goto err_undo_flags;
@@ -1495,7 +1477,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1495 if (bond->slave_cnt == 0) { 1477 if (bond->slave_cnt == 0) {
1496 if (bond_dev->type != slave_dev->type) { 1478 if (bond_dev->type != slave_dev->type) {
1497 pr_debug("%s: change device type from %d to %d\n", 1479 pr_debug("%s: change device type from %d to %d\n",
1498 bond_dev->name, bond_dev->type, slave_dev->type); 1480 bond_dev->name,
1481 bond_dev->type, slave_dev->type);
1499 1482
1500 netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE); 1483 netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE);
1501 1484
@@ -1507,28 +1490,21 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1507 netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE); 1490 netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE);
1508 } 1491 }
1509 } else if (bond_dev->type != slave_dev->type) { 1492 } else if (bond_dev->type != slave_dev->type) {
1510 pr_err(DRV_NAME ": %s ether type (%d) is different " 1493 pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n",
1511 "from other slaves (%d), can not enslave it.\n", 1494 slave_dev->name,
1512 slave_dev->name, 1495 slave_dev->type, bond_dev->type);
1513 slave_dev->type, bond_dev->type); 1496 res = -EINVAL;
1514 res = -EINVAL; 1497 goto err_undo_flags;
1515 goto err_undo_flags;
1516 } 1498 }
1517 1499
1518 if (slave_ops->ndo_set_mac_address == NULL) { 1500 if (slave_ops->ndo_set_mac_address == NULL) {
1519 if (bond->slave_cnt == 0) { 1501 if (bond->slave_cnt == 0) {
1520 pr_warning(DRV_NAME 1502 pr_warning("%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.",
1521 ": %s: Warning: The first slave device " 1503 bond_dev->name);
1522 "specified does not support setting the MAC "
1523 "address. Setting fail_over_mac to active.",
1524 bond_dev->name);
1525 bond->params.fail_over_mac = BOND_FOM_ACTIVE; 1504 bond->params.fail_over_mac = BOND_FOM_ACTIVE;
1526 } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { 1505 } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) {
1527 pr_err(DRV_NAME 1506 pr_err("%s: Error: The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active.\n",
1528 ": %s: Error: The slave device specified " 1507 bond_dev->name);
1529 "does not support setting the MAC address, "
1530 "but fail_over_mac is not set to active.\n"
1531 , bond_dev->name);
1532 res = -EOPNOTSUPP; 1508 res = -EOPNOTSUPP;
1533 goto err_undo_flags; 1509 goto err_undo_flags;
1534 } 1510 }
@@ -1655,22 +1631,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1655 * supported); thus, we don't need to change 1631 * supported); thus, we don't need to change
1656 * the messages for netif_carrier. 1632 * the messages for netif_carrier.
1657 */ 1633 */
1658 pr_warning(DRV_NAME 1634 pr_warning("%s: Warning: MII and ETHTOOL support not available for interface %s, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details.\n",
1659 ": %s: Warning: MII and ETHTOOL support not "
1660 "available for interface %s, and "
1661 "arp_interval/arp_ip_target module parameters "
1662 "not specified, thus bonding will not detect "
1663 "link failures! see bonding.txt for details.\n",
1664 bond_dev->name, slave_dev->name); 1635 bond_dev->name, slave_dev->name);
1665 } else if (link_reporting == -1) { 1636 } else if (link_reporting == -1) {
1666 /* unable get link status using mii/ethtool */ 1637 /* unable get link status using mii/ethtool */
1667 pr_warning(DRV_NAME 1638 pr_warning("%s: Warning: can't get link status from interface %s; the network driver associated with this interface does not support MII or ETHTOOL link status reporting, thus miimon has no effect on this interface.\n",
1668 ": %s: Warning: can't get link status from " 1639 bond_dev->name, slave_dev->name);
1669 "interface %s; the network driver associated "
1670 "with this interface does not support MII or "
1671 "ETHTOOL link status reporting, thus miimon "
1672 "has no effect on this interface.\n",
1673 bond_dev->name, slave_dev->name);
1674 } 1640 }
1675 } 1641 }
1676 1642
@@ -1678,34 +1644,27 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1678 if (!bond->params.miimon || 1644 if (!bond->params.miimon ||
1679 (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) { 1645 (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) {
1680 if (bond->params.updelay) { 1646 if (bond->params.updelay) {
1681 pr_debug("Initial state of slave_dev is " 1647 pr_debug("Initial state of slave_dev is BOND_LINK_BACK\n");
1682 "BOND_LINK_BACK\n");
1683 new_slave->link = BOND_LINK_BACK; 1648 new_slave->link = BOND_LINK_BACK;
1684 new_slave->delay = bond->params.updelay; 1649 new_slave->delay = bond->params.updelay;
1685 } else { 1650 } else {
1686 pr_debug("Initial state of slave_dev is " 1651 pr_debug("Initial state of slave_dev is BOND_LINK_UP\n");
1687 "BOND_LINK_UP\n");
1688 new_slave->link = BOND_LINK_UP; 1652 new_slave->link = BOND_LINK_UP;
1689 } 1653 }
1690 new_slave->jiffies = jiffies; 1654 new_slave->jiffies = jiffies;
1691 } else { 1655 } else {
1692 pr_debug("Initial state of slave_dev is " 1656 pr_debug("Initial state of slave_dev is BOND_LINK_DOWN\n");
1693 "BOND_LINK_DOWN\n");
1694 new_slave->link = BOND_LINK_DOWN; 1657 new_slave->link = BOND_LINK_DOWN;
1695 } 1658 }
1696 1659
1697 if (bond_update_speed_duplex(new_slave) && 1660 if (bond_update_speed_duplex(new_slave) &&
1698 (new_slave->link != BOND_LINK_DOWN)) { 1661 (new_slave->link != BOND_LINK_DOWN)) {
1699 pr_warning(DRV_NAME 1662 pr_warning("%s: Warning: failed to get speed and duplex from %s, assumed to be 100Mb/sec and Full.\n",
1700 ": %s: Warning: failed to get speed and duplex from %s, " 1663 bond_dev->name, new_slave->dev->name);
1701 "assumed to be 100Mb/sec and Full.\n",
1702 bond_dev->name, new_slave->dev->name);
1703 1664
1704 if (bond->params.mode == BOND_MODE_8023AD) { 1665 if (bond->params.mode == BOND_MODE_8023AD) {
1705 pr_warning(DRV_NAME 1666 pr_warning("%s: Warning: Operation of 802.3ad mode requires ETHTOOL support in base driver for proper aggregator selection.\n",
1706 ": %s: Warning: Operation of 802.3ad mode requires ETHTOOL " 1667 bond_dev->name);
1707 "support in base driver for proper aggregator "
1708 "selection.\n", bond_dev->name);
1709 } 1668 }
1710 } 1669 }
1711 1670
@@ -1777,11 +1736,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1777 if (res) 1736 if (res)
1778 goto err_close; 1737 goto err_close;
1779 1738
1780 pr_info(DRV_NAME 1739 pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
1781 ": %s: enslaving %s as a%s interface with a%s link.\n", 1740 bond_dev->name, slave_dev->name,
1782 bond_dev->name, slave_dev->name, 1741 new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
1783 new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", 1742 new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
1784 new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
1785 1743
1786 /* enslave is successful */ 1744 /* enslave is successful */
1787 return 0; 1745 return 0;
@@ -1833,8 +1791,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1833 /* slave is not a slave or master is not master of this slave */ 1791 /* slave is not a slave or master is not master of this slave */
1834 if (!(slave_dev->flags & IFF_SLAVE) || 1792 if (!(slave_dev->flags & IFF_SLAVE) ||
1835 (slave_dev->master != bond_dev)) { 1793 (slave_dev->master != bond_dev)) {
1836 pr_err(DRV_NAME 1794 pr_err("%s: Error: cannot release %s.\n",
1837 ": %s: Error: cannot release %s.\n",
1838 bond_dev->name, slave_dev->name); 1795 bond_dev->name, slave_dev->name);
1839 return -EINVAL; 1796 return -EINVAL;
1840 } 1797 }
@@ -1844,9 +1801,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1844 slave = bond_get_slave_by_dev(bond, slave_dev); 1801 slave = bond_get_slave_by_dev(bond, slave_dev);
1845 if (!slave) { 1802 if (!slave) {
1846 /* not a slave of this bond */ 1803 /* not a slave of this bond */
1847 pr_info(DRV_NAME 1804 pr_info("%s: %s not enslaved\n",
1848 ": %s: %s not enslaved\n", 1805 bond_dev->name, slave_dev->name);
1849 bond_dev->name, slave_dev->name);
1850 write_unlock_bh(&bond->lock); 1806 write_unlock_bh(&bond->lock);
1851 return -EINVAL; 1807 return -EINVAL;
1852 } 1808 }
@@ -1854,14 +1810,10 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1854 if (!bond->params.fail_over_mac) { 1810 if (!bond->params.fail_over_mac) {
1855 if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) && 1811 if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) &&
1856 bond->slave_cnt > 1) 1812 bond->slave_cnt > 1)
1857 pr_warning(DRV_NAME 1813 pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n",
1858 ": %s: Warning: the permanent HWaddr of %s - " 1814 bond_dev->name, slave_dev->name,
1859 "%pM - is still in use by %s. " 1815 slave->perm_hwaddr,
1860 "Set the HWaddr of %s to a different address " 1816 bond_dev->name, slave_dev->name);
1861 "to avoid conflicts.\n",
1862 bond_dev->name, slave_dev->name,
1863 slave->perm_hwaddr,
1864 bond_dev->name, slave_dev->name);
1865 } 1817 }
1866 1818
1867 /* Inform AD package of unbinding of slave. */ 1819 /* Inform AD package of unbinding of slave. */
@@ -1872,12 +1824,10 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1872 bond_3ad_unbind_slave(slave); 1824 bond_3ad_unbind_slave(slave);
1873 } 1825 }
1874 1826
1875 pr_info(DRV_NAME 1827 pr_info("%s: releasing %s interface %s\n",
1876 ": %s: releasing %s interface %s\n", 1828 bond_dev->name,
1877 bond_dev->name, 1829 (slave->state == BOND_STATE_ACTIVE) ? "active" : "backup",
1878 (slave->state == BOND_STATE_ACTIVE) 1830 slave_dev->name);
1879 ? "active" : "backup",
1880 slave_dev->name);
1881 1831
1882 oldcurrent = bond->curr_active_slave; 1832 oldcurrent = bond->curr_active_slave;
1883 1833
@@ -1934,21 +1884,15 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1934 if (list_empty(&bond->vlan_list)) { 1884 if (list_empty(&bond->vlan_list)) {
1935 bond_dev->features |= NETIF_F_VLAN_CHALLENGED; 1885 bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
1936 } else { 1886 } else {
1937 pr_warning(DRV_NAME 1887 pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n",
1938 ": %s: Warning: clearing HW address of %s while it " 1888 bond_dev->name, bond_dev->name);
1939 "still has VLANs.\n", 1889 pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n",
1940 bond_dev->name, bond_dev->name); 1890 bond_dev->name);
1941 pr_warning(DRV_NAME
1942 ": %s: When re-adding slaves, make sure the bond's "
1943 "HW address matches its VLANs'.\n",
1944 bond_dev->name);
1945 } 1891 }
1946 } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) && 1892 } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
1947 !bond_has_challenged_slaves(bond)) { 1893 !bond_has_challenged_slaves(bond)) {
1948 pr_info(DRV_NAME 1894 pr_info("%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n",
1949 ": %s: last VLAN challenged slave %s " 1895 bond_dev->name, slave_dev->name, bond_dev->name);
1950 "left bond %s. VLAN blocking is removed\n",
1951 bond_dev->name, slave_dev->name, bond_dev->name);
1952 bond_dev->features &= ~NETIF_F_VLAN_CHALLENGED; 1896 bond_dev->features &= ~NETIF_F_VLAN_CHALLENGED;
1953 } 1897 }
1954 1898
@@ -2011,8 +1955,8 @@ int bond_release_and_destroy(struct net_device *bond_dev,
2011 1955
2012 ret = bond_release(bond_dev, slave_dev); 1956 ret = bond_release(bond_dev, slave_dev);
2013 if ((ret == 0) && (bond->slave_cnt == 0)) { 1957 if ((ret == 0) && (bond->slave_cnt == 0)) {
2014 pr_info(DRV_NAME ": %s: destroying bond %s.\n", 1958 pr_info("%s: destroying bond %s.\n",
2015 bond_dev->name, bond_dev->name); 1959 bond_dev->name, bond_dev->name);
2016 unregister_netdevice(bond_dev); 1960 unregister_netdevice(bond_dev);
2017 } 1961 }
2018 return ret; 1962 return ret;
@@ -2116,19 +2060,13 @@ static int bond_release_all(struct net_device *bond_dev)
2116 if (list_empty(&bond->vlan_list)) 2060 if (list_empty(&bond->vlan_list))
2117 bond_dev->features |= NETIF_F_VLAN_CHALLENGED; 2061 bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
2118 else { 2062 else {
2119 pr_warning(DRV_NAME 2063 pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n",
2120 ": %s: Warning: clearing HW address of %s while it " 2064 bond_dev->name, bond_dev->name);
2121 "still has VLANs.\n", 2065 pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n",
2122 bond_dev->name, bond_dev->name); 2066 bond_dev->name);
2123 pr_warning(DRV_NAME
2124 ": %s: When re-adding slaves, make sure the bond's "
2125 "HW address matches its VLANs'.\n",
2126 bond_dev->name);
2127 } 2067 }
2128 2068
2129 pr_info(DRV_NAME 2069 pr_info("%s: released all slaves\n", bond_dev->name);
2130 ": %s: released all slaves\n",
2131 bond_dev->name);
2132 2070
2133out: 2071out:
2134 write_unlock_bh(&bond->lock); 2072 write_unlock_bh(&bond->lock);
@@ -2254,16 +2192,14 @@ static int bond_miimon_inspect(struct bonding *bond)
2254 slave->link = BOND_LINK_FAIL; 2192 slave->link = BOND_LINK_FAIL;
2255 slave->delay = bond->params.downdelay; 2193 slave->delay = bond->params.downdelay;
2256 if (slave->delay) { 2194 if (slave->delay) {
2257 pr_info(DRV_NAME 2195 pr_info("%s: link status down for %sinterface %s, disabling it in %d ms.\n",
2258 ": %s: link status down for %s" 2196 bond->dev->name,
2259 "interface %s, disabling it in %d ms.\n", 2197 (bond->params.mode ==
2260 bond->dev->name, 2198 BOND_MODE_ACTIVEBACKUP) ?
2261 (bond->params.mode == 2199 ((slave->state == BOND_STATE_ACTIVE) ?
2262 BOND_MODE_ACTIVEBACKUP) ? 2200 "active " : "backup ") : "",
2263 ((slave->state == BOND_STATE_ACTIVE) ? 2201 slave->dev->name,
2264 "active " : "backup ") : "", 2202 bond->params.downdelay * bond->params.miimon);
2265 slave->dev->name,
2266 bond->params.downdelay * bond->params.miimon);
2267 } 2203 }
2268 /*FALLTHRU*/ 2204 /*FALLTHRU*/
2269 case BOND_LINK_FAIL: 2205 case BOND_LINK_FAIL:
@@ -2273,13 +2209,11 @@ static int bond_miimon_inspect(struct bonding *bond)
2273 */ 2209 */
2274 slave->link = BOND_LINK_UP; 2210 slave->link = BOND_LINK_UP;
2275 slave->jiffies = jiffies; 2211 slave->jiffies = jiffies;
2276 pr_info(DRV_NAME 2212 pr_info("%s: link status up again after %d ms for interface %s.\n",
2277 ": %s: link status up again after %d " 2213 bond->dev->name,
2278 "ms for interface %s.\n", 2214 (bond->params.downdelay - slave->delay) *
2279 bond->dev->name, 2215 bond->params.miimon,
2280 (bond->params.downdelay - slave->delay) * 2216 slave->dev->name);
2281 bond->params.miimon,
2282 slave->dev->name);
2283 continue; 2217 continue;
2284 } 2218 }
2285 2219
@@ -2300,25 +2234,21 @@ static int bond_miimon_inspect(struct bonding *bond)
2300 slave->delay = bond->params.updelay; 2234 slave->delay = bond->params.updelay;
2301 2235
2302 if (slave->delay) { 2236 if (slave->delay) {
2303 pr_info(DRV_NAME 2237 pr_info("%s: link status up for interface %s, enabling it in %d ms.\n",
2304 ": %s: link status up for " 2238 bond->dev->name, slave->dev->name,
2305 "interface %s, enabling it in %d ms.\n", 2239 ignore_updelay ? 0 :
2306 bond->dev->name, slave->dev->name, 2240 bond->params.updelay *
2307 ignore_updelay ? 0 : 2241 bond->params.miimon);
2308 bond->params.updelay *
2309 bond->params.miimon);
2310 } 2242 }
2311 /*FALLTHRU*/ 2243 /*FALLTHRU*/
2312 case BOND_LINK_BACK: 2244 case BOND_LINK_BACK:
2313 if (!link_state) { 2245 if (!link_state) {
2314 slave->link = BOND_LINK_DOWN; 2246 slave->link = BOND_LINK_DOWN;
2315 pr_info(DRV_NAME 2247 pr_info("%s: link status down again after %d ms for interface %s.\n",
2316 ": %s: link status down again after %d " 2248 bond->dev->name,
2317 "ms for interface %s.\n", 2249 (bond->params.updelay - slave->delay) *
2318 bond->dev->name, 2250 bond->params.miimon,
2319 (bond->params.updelay - slave->delay) * 2251 slave->dev->name);
2320 bond->params.miimon,
2321 slave->dev->name);
2322 2252
2323 continue; 2253 continue;
2324 } 2254 }
@@ -2366,10 +2296,8 @@ static void bond_miimon_commit(struct bonding *bond)
2366 slave->state = BOND_STATE_BACKUP; 2296 slave->state = BOND_STATE_BACKUP;
2367 } 2297 }
2368 2298
2369 pr_info(DRV_NAME 2299 pr_info("%s: link status definitely up for interface %s.\n",
2370 ": %s: link status definitely " 2300 bond->dev->name, slave->dev->name);
2371 "up for interface %s.\n",
2372 bond->dev->name, slave->dev->name);
2373 2301
2374 /* notify ad that the link status has changed */ 2302 /* notify ad that the link status has changed */
2375 if (bond->params.mode == BOND_MODE_8023AD) 2303 if (bond->params.mode == BOND_MODE_8023AD)
@@ -2395,10 +2323,8 @@ static void bond_miimon_commit(struct bonding *bond)
2395 bond->params.mode == BOND_MODE_8023AD) 2323 bond->params.mode == BOND_MODE_8023AD)
2396 bond_set_slave_inactive_flags(slave); 2324 bond_set_slave_inactive_flags(slave);
2397 2325
2398 pr_info(DRV_NAME 2326 pr_info("%s: link status definitely down for interface %s, disabling it\n",
2399 ": %s: link status definitely down for " 2327 bond->dev->name, slave->dev->name);
2400 "interface %s, disabling it\n",
2401 bond->dev->name, slave->dev->name);
2402 2328
2403 if (bond->params.mode == BOND_MODE_8023AD) 2329 if (bond->params.mode == BOND_MODE_8023AD)
2404 bond_3ad_handle_link_change(slave, 2330 bond_3ad_handle_link_change(slave,
@@ -2414,8 +2340,7 @@ static void bond_miimon_commit(struct bonding *bond)
2414 continue; 2340 continue;
2415 2341
2416 default: 2342 default:
2417 pr_err(DRV_NAME 2343 pr_err("%s: invalid new link %d on slave %s\n",
2418 ": %s: invalid new link %d on slave %s\n",
2419 bond->dev->name, slave->new_link, 2344 bond->dev->name, slave->new_link,
2420 slave->dev->name); 2345 slave->dev->name);
2421 slave->new_link = BOND_LINK_NOCHANGE; 2346 slave->new_link = BOND_LINK_NOCHANGE;
@@ -2534,19 +2459,19 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_
2534 struct sk_buff *skb; 2459 struct sk_buff *skb;
2535 2460
2536 pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, 2461 pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op,
2537 slave_dev->name, dest_ip, src_ip, vlan_id); 2462 slave_dev->name, dest_ip, src_ip, vlan_id);
2538 2463
2539 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, 2464 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip,
2540 NULL, slave_dev->dev_addr, NULL); 2465 NULL, slave_dev->dev_addr, NULL);
2541 2466
2542 if (!skb) { 2467 if (!skb) {
2543 pr_err(DRV_NAME ": ARP packet allocation failed\n"); 2468 pr_err("ARP packet allocation failed\n");
2544 return; 2469 return;
2545 } 2470 }
2546 if (vlan_id) { 2471 if (vlan_id) {
2547 skb = vlan_put_tag(skb, vlan_id); 2472 skb = vlan_put_tag(skb, vlan_id);
2548 if (!skb) { 2473 if (!skb) {
2549 pr_err(DRV_NAME ": failed to insert VLAN tag\n"); 2474 pr_err("failed to insert VLAN tag\n");
2550 return; 2475 return;
2551 } 2476 }
2552 } 2477 }
@@ -2586,9 +2511,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2586 rv = ip_route_output_key(dev_net(bond->dev), &rt, &fl); 2511 rv = ip_route_output_key(dev_net(bond->dev), &rt, &fl);
2587 if (rv) { 2512 if (rv) {
2588 if (net_ratelimit()) { 2513 if (net_ratelimit()) {
2589 pr_warning(DRV_NAME 2514 pr_warning("%s: no route to arp_ip_target %pI4\n",
2590 ": %s: no route to arp_ip_target %pI4\n", 2515 bond->dev->name, &fl.fl4_dst);
2591 bond->dev->name, &fl.fl4_dst);
2592 } 2516 }
2593 continue; 2517 continue;
2594 } 2518 }
@@ -2623,10 +2547,9 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2623 } 2547 }
2624 2548
2625 if (net_ratelimit()) { 2549 if (net_ratelimit()) {
2626 pr_warning(DRV_NAME 2550 pr_warning("%s: no path to arp_ip_target %pI4 via rt.dev %s\n",
2627 ": %s: no path to arp_ip_target %pI4 via rt.dev %s\n", 2551 bond->dev->name, &fl.fl4_dst,
2628 bond->dev->name, &fl.fl4_dst, 2552 rt->u.dst.dev ? rt->u.dst.dev->name : "NULL");
2629 rt->u.dst.dev ? rt->u.dst.dev->name : "NULL");
2630 } 2553 }
2631 ip_rt_put(rt); 2554 ip_rt_put(rt);
2632 } 2555 }
@@ -2644,8 +2567,8 @@ static void bond_send_gratuitous_arp(struct bonding *bond)
2644 struct vlan_entry *vlan; 2567 struct vlan_entry *vlan;
2645 struct net_device *vlan_dev; 2568 struct net_device *vlan_dev;
2646 2569
2647 pr_debug("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name, 2570 pr_debug("bond_send_grat_arp: bond %s slave %s\n",
2648 slave ? slave->dev->name : "NULL"); 2571 bond->dev->name, slave ? slave->dev->name : "NULL");
2649 2572
2650 if (!slave || !bond->send_grat_arp || 2573 if (!slave || !bond->send_grat_arp ||
2651 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) 2574 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
@@ -2674,7 +2597,8 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
2674 2597
2675 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { 2598 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2676 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n", 2599 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
2677 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip)); 2600 &sip, &tip, i, &targets[i],
2601 bond_has_this_ip(bond, tip));
2678 if (sip == targets[i]) { 2602 if (sip == targets[i]) {
2679 if (bond_has_this_ip(bond, tip)) 2603 if (bond_has_this_ip(bond, tip))
2680 slave->last_arp_rx = jiffies; 2604 slave->last_arp_rx = jiffies;
@@ -2698,8 +2622,8 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
2698 read_lock(&bond->lock); 2622 read_lock(&bond->lock);
2699 2623
2700 pr_debug("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n", 2624 pr_debug("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
2701 bond->dev->name, skb->dev ? skb->dev->name : "NULL", 2625 bond->dev->name, skb->dev ? skb->dev->name : "NULL",
2702 orig_dev ? orig_dev->name : "NULL"); 2626 orig_dev ? orig_dev->name : "NULL");
2703 2627
2704 slave = bond_get_slave_by_dev(bond, orig_dev); 2628 slave = bond_get_slave_by_dev(bond, orig_dev);
2705 if (!slave || !slave_do_arp_validate(bond, slave)) 2629 if (!slave || !slave_do_arp_validate(bond, slave))
@@ -2724,9 +2648,9 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
2724 memcpy(&tip, arp_ptr, 4); 2648 memcpy(&tip, arp_ptr, 4);
2725 2649
2726 pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n", 2650 pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
2727 bond->dev->name, slave->dev->name, slave->state, 2651 bond->dev->name, slave->dev->name, slave->state,
2728 bond->params.arp_validate, slave_do_arp_validate(bond, slave), 2652 bond->params.arp_validate, slave_do_arp_validate(bond, slave),
2729 &sip, &tip); 2653 &sip, &tip);
2730 2654
2731 /* 2655 /*
2732 * Backup slaves won't see the ARP reply, but do come through 2656 * Backup slaves won't see the ARP reply, but do come through
@@ -2800,17 +2724,14 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
2800 * is closed. 2724 * is closed.
2801 */ 2725 */
2802 if (!oldcurrent) { 2726 if (!oldcurrent) {
2803 pr_info(DRV_NAME 2727 pr_info("%s: link status definitely up for interface %s, ",
2804 ": %s: link status definitely " 2728 bond->dev->name,
2805 "up for interface %s, ", 2729 slave->dev->name);
2806 bond->dev->name,
2807 slave->dev->name);
2808 do_failover = 1; 2730 do_failover = 1;
2809 } else { 2731 } else {
2810 pr_info(DRV_NAME 2732 pr_info("%s: interface %s is now up\n",
2811 ": %s: interface %s is now up\n", 2733 bond->dev->name,
2812 bond->dev->name, 2734 slave->dev->name);
2813 slave->dev->name);
2814 } 2735 }
2815 } 2736 }
2816 } else { 2737 } else {
@@ -2829,10 +2750,9 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
2829 if (slave->link_failure_count < UINT_MAX) 2750 if (slave->link_failure_count < UINT_MAX)
2830 slave->link_failure_count++; 2751 slave->link_failure_count++;
2831 2752
2832 pr_info(DRV_NAME 2753 pr_info("%s: interface %s is now down.\n",
2833 ": %s: interface %s is now down.\n", 2754 bond->dev->name,
2834 bond->dev->name, 2755 slave->dev->name);
2835 slave->dev->name);
2836 2756
2837 if (slave == oldcurrent) 2757 if (slave == oldcurrent)
2838 do_failover = 1; 2758 do_failover = 1;
@@ -2965,9 +2885,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
2965 slave->link = BOND_LINK_UP; 2885 slave->link = BOND_LINK_UP;
2966 bond->current_arp_slave = NULL; 2886 bond->current_arp_slave = NULL;
2967 2887
2968 pr_info(DRV_NAME 2888 pr_info("%s: link status definitely up for interface %s.\n",
2969 ": %s: link status definitely "
2970 "up for interface %s.\n",
2971 bond->dev->name, slave->dev->name); 2889 bond->dev->name, slave->dev->name);
2972 2890
2973 if (!bond->curr_active_slave || 2891 if (!bond->curr_active_slave ||
@@ -2985,9 +2903,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
2985 slave->link = BOND_LINK_DOWN; 2903 slave->link = BOND_LINK_DOWN;
2986 bond_set_slave_inactive_flags(slave); 2904 bond_set_slave_inactive_flags(slave);
2987 2905
2988 pr_info(DRV_NAME 2906 pr_info("%s: link status definitely down for interface %s, disabling it\n",
2989 ": %s: link status definitely down for "
2990 "interface %s, disabling it\n",
2991 bond->dev->name, slave->dev->name); 2907 bond->dev->name, slave->dev->name);
2992 2908
2993 if (slave == bond->curr_active_slave) { 2909 if (slave == bond->curr_active_slave) {
@@ -2998,8 +2914,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
2998 continue; 2914 continue;
2999 2915
3000 default: 2916 default:
3001 pr_err(DRV_NAME 2917 pr_err("%s: impossible: new_link %d on slave %s\n",
3002 ": %s: impossible: new_link %d on slave %s\n",
3003 bond->dev->name, slave->new_link, 2918 bond->dev->name, slave->new_link,
3004 slave->dev->name); 2919 slave->dev->name);
3005 continue; 2920 continue;
@@ -3028,9 +2943,9 @@ static void bond_ab_arp_probe(struct bonding *bond)
3028 read_lock(&bond->curr_slave_lock); 2943 read_lock(&bond->curr_slave_lock);
3029 2944
3030 if (bond->current_arp_slave && bond->curr_active_slave) 2945 if (bond->current_arp_slave && bond->curr_active_slave)
3031 pr_info(DRV_NAME "PROBE: c_arp %s && cas %s BAD\n", 2946 pr_info("PROBE: c_arp %s && cas %s BAD\n",
3032 bond->current_arp_slave->dev->name, 2947 bond->current_arp_slave->dev->name,
3033 bond->curr_active_slave->dev->name); 2948 bond->curr_active_slave->dev->name);
3034 2949
3035 if (bond->curr_active_slave) { 2950 if (bond->curr_active_slave) {
3036 bond_arp_send_all(bond, bond->curr_active_slave); 2951 bond_arp_send_all(bond, bond->curr_active_slave);
@@ -3078,9 +2993,8 @@ static void bond_ab_arp_probe(struct bonding *bond)
3078 2993
3079 bond_set_slave_inactive_flags(slave); 2994 bond_set_slave_inactive_flags(slave);
3080 2995
3081 pr_info(DRV_NAME 2996 pr_info("%s: backup interface %s is now down.\n",
3082 ": %s: backup interface %s is now down.\n", 2997 bond->dev->name, slave->dev->name);
3083 bond->dev->name, slave->dev->name);
3084 } 2998 }
3085 } 2999 }
3086} 3000}
@@ -3360,9 +3274,8 @@ static void bond_create_proc_entry(struct bonding *bond)
3360 S_IRUGO, bn->proc_dir, 3274 S_IRUGO, bn->proc_dir,
3361 &bond_info_fops, bond); 3275 &bond_info_fops, bond);
3362 if (bond->proc_entry == NULL) 3276 if (bond->proc_entry == NULL)
3363 pr_warning(DRV_NAME 3277 pr_warning("Warning: Cannot create /proc/net/%s/%s\n",
3364 ": Warning: Cannot create /proc/net/%s/%s\n", 3278 DRV_NAME, bond_dev->name);
3365 DRV_NAME, bond_dev->name);
3366 else 3279 else
3367 memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); 3280 memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ);
3368 } 3281 }
@@ -3388,9 +3301,8 @@ static void bond_create_proc_dir(struct bond_net *bn)
3388 if (!bn->proc_dir) { 3301 if (!bn->proc_dir) {
3389 bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net); 3302 bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net);
3390 if (!bn->proc_dir) 3303 if (!bn->proc_dir)
3391 pr_warning(DRV_NAME 3304 pr_warning("Warning: cannot create /proc/net/%s\n",
3392 ": Warning: cannot create /proc/net/%s\n", 3305 DRV_NAME);
3393 DRV_NAME);
3394 } 3306 }
3395} 3307}
3396 3308
@@ -3539,8 +3451,8 @@ static int bond_netdev_event(struct notifier_block *this,
3539 struct net_device *event_dev = (struct net_device *)ptr; 3451 struct net_device *event_dev = (struct net_device *)ptr;
3540 3452
3541 pr_debug("event_dev: %s, event: %lx\n", 3453 pr_debug("event_dev: %s, event: %lx\n",
3542 (event_dev ? event_dev->name : "None"), 3454 event_dev ? event_dev->name : "None",
3543 event); 3455 event);
3544 3456
3545 if (!(event_dev->priv_flags & IFF_BONDING)) 3457 if (!(event_dev->priv_flags & IFF_BONDING))
3546 return NOTIFY_DONE; 3458 return NOTIFY_DONE;
@@ -3875,8 +3787,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3875 struct mii_ioctl_data *mii = NULL; 3787 struct mii_ioctl_data *mii = NULL;
3876 int res = 0; 3788 int res = 0;
3877 3789
3878 pr_debug("bond_ioctl: master=%s, cmd=%d\n", 3790 pr_debug("bond_ioctl: master=%s, cmd=%d\n", bond_dev->name, cmd);
3879 bond_dev->name, cmd);
3880 3791
3881 switch (cmd) { 3792 switch (cmd) {
3882 case SIOCGMIIPHY: 3793 case SIOCGMIIPHY:
@@ -3945,12 +3856,12 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3945 3856
3946 slave_dev = dev_get_by_name(dev_net(bond_dev), ifr->ifr_slave); 3857 slave_dev = dev_get_by_name(dev_net(bond_dev), ifr->ifr_slave);
3947 3858
3948 pr_debug("slave_dev=%p: \n", slave_dev); 3859 pr_debug("slave_dev=%p:\n", slave_dev);
3949 3860
3950 if (!slave_dev) 3861 if (!slave_dev)
3951 res = -ENODEV; 3862 res = -ENODEV;
3952 else { 3863 else {
3953 pr_debug("slave_dev->name=%s: \n", slave_dev->name); 3864 pr_debug("slave_dev->name=%s:\n", slave_dev->name);
3954 switch (cmd) { 3865 switch (cmd) {
3955 case BOND_ENSLAVE_OLD: 3866 case BOND_ENSLAVE_OLD:
3956 case SIOCBONDENSLAVE: 3867 case SIOCBONDENSLAVE:
@@ -4059,7 +3970,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
4059 int i; 3970 int i;
4060 3971
4061 pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond, 3972 pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond,
4062 (bond_dev ? bond_dev->name : "None"), new_mtu); 3973 (bond_dev ? bond_dev->name : "None"), new_mtu);
4063 3974
4064 /* Can't hold bond->lock with bh disabled here since 3975 /* Can't hold bond->lock with bh disabled here since
4065 * some base drivers panic. On the other hand we can't 3976 * some base drivers panic. On the other hand we can't
@@ -4077,8 +3988,10 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
4077 */ 3988 */
4078 3989
4079 bond_for_each_slave(bond, slave, i) { 3990 bond_for_each_slave(bond, slave, i) {
4080 pr_debug("s %p s->p %p c_m %p\n", slave, 3991 pr_debug("s %p s->p %p c_m %p\n",
4081 slave->prev, slave->dev->netdev_ops->ndo_change_mtu); 3992 slave,
3993 slave->prev,
3994 slave->dev->netdev_ops->ndo_change_mtu);
4082 3995
4083 res = dev_set_mtu(slave->dev, new_mtu); 3996 res = dev_set_mtu(slave->dev, new_mtu);
4084 3997
@@ -4108,8 +4021,8 @@ unwind:
4108 4021
4109 tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu); 4022 tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu);
4110 if (tmp_res) { 4023 if (tmp_res) {
4111 pr_debug("unwind err %d dev %s\n", tmp_res, 4024 pr_debug("unwind err %d dev %s\n",
4112 slave->dev->name); 4025 tmp_res, slave->dev->name);
4113 } 4026 }
4114 } 4027 }
4115 4028
@@ -4135,7 +4048,8 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
4135 return bond_alb_set_mac_address(bond_dev, addr); 4048 return bond_alb_set_mac_address(bond_dev, addr);
4136 4049
4137 4050
4138 pr_debug("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None")); 4051 pr_debug("bond=%p, name=%s\n",
4052 bond, bond_dev ? bond_dev->name : "None");
4139 4053
4140 /* 4054 /*
4141 * If fail_over_mac is set to active, do nothing and return 4055 * If fail_over_mac is set to active, do nothing and return
@@ -4200,8 +4114,8 @@ unwind:
4200 4114
4201 tmp_res = dev_set_mac_address(slave->dev, &tmp_sa); 4115 tmp_res = dev_set_mac_address(slave->dev, &tmp_sa);
4202 if (tmp_res) { 4116 if (tmp_res) {
4203 pr_debug("unwind err %d dev %s\n", tmp_res, 4117 pr_debug("unwind err %d dev %s\n",
4204 slave->dev->name); 4118 tmp_res, slave->dev->name);
4205 } 4119 }
4206 } 4120 }
4207 4121
@@ -4357,9 +4271,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
4357 if (tx_dev) { 4271 if (tx_dev) {
4358 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); 4272 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
4359 if (!skb2) { 4273 if (!skb2) {
4360 pr_err(DRV_NAME 4274 pr_err("%s: Error: bond_xmit_broadcast(): skb_clone() failed\n",
4361 ": %s: Error: bond_xmit_broadcast(): "
4362 "skb_clone() failed\n",
4363 bond_dev->name); 4275 bond_dev->name);
4364 continue; 4276 continue;
4365 } 4277 }
@@ -4425,8 +4337,8 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
4425 return bond_alb_xmit(skb, dev); 4337 return bond_alb_xmit(skb, dev);
4426 default: 4338 default:
4427 /* Should never happen, mode already checked */ 4339 /* Should never happen, mode already checked */
4428 pr_err(DRV_NAME ": %s: Error: Unknown bonding mode %d\n", 4340 pr_err("%s: Error: Unknown bonding mode %d\n",
4429 dev->name, bond->params.mode); 4341 dev->name, bond->params.mode);
4430 WARN_ON_ONCE(1); 4342 WARN_ON_ONCE(1);
4431 dev_kfree_skb(skb); 4343 dev_kfree_skb(skb);
4432 return NETDEV_TX_OK; 4344 return NETDEV_TX_OK;
@@ -4462,10 +4374,8 @@ void bond_set_mode_ops(struct bonding *bond, int mode)
4462 break; 4374 break;
4463 default: 4375 default:
4464 /* Should never happen, mode already checked */ 4376 /* Should never happen, mode already checked */
4465 pr_err(DRV_NAME 4377 pr_err("%s: Error: Unknown bonding mode %d\n",
4466 ": %s: Error: Unknown bonding mode %d\n", 4378 bond_dev->name, mode);
4467 bond_dev->name,
4468 mode);
4469 break; 4379 break;
4470 } 4380 }
4471} 4381}
@@ -4650,8 +4560,7 @@ static int bond_check_params(struct bond_params *params)
4650 if (mode) { 4560 if (mode) {
4651 bond_mode = bond_parse_parm(mode, bond_mode_tbl); 4561 bond_mode = bond_parse_parm(mode, bond_mode_tbl);
4652 if (bond_mode == -1) { 4562 if (bond_mode == -1) {
4653 pr_err(DRV_NAME 4563 pr_err("Error: Invalid bonding mode \"%s\"\n",
4654 ": Error: Invalid bonding mode \"%s\"\n",
4655 mode == NULL ? "NULL" : mode); 4564 mode == NULL ? "NULL" : mode);
4656 return -EINVAL; 4565 return -EINVAL;
4657 } 4566 }
@@ -4660,16 +4569,13 @@ static int bond_check_params(struct bond_params *params)
4660 if (xmit_hash_policy) { 4569 if (xmit_hash_policy) {
4661 if ((bond_mode != BOND_MODE_XOR) && 4570 if ((bond_mode != BOND_MODE_XOR) &&
4662 (bond_mode != BOND_MODE_8023AD)) { 4571 (bond_mode != BOND_MODE_8023AD)) {
4663 pr_info(DRV_NAME 4572 pr_info("xmit_hash_policy param is irrelevant in mode %s\n",
4664 ": xmit_hash_policy param is irrelevant in"
4665 " mode %s\n",
4666 bond_mode_name(bond_mode)); 4573 bond_mode_name(bond_mode));
4667 } else { 4574 } else {
4668 xmit_hashtype = bond_parse_parm(xmit_hash_policy, 4575 xmit_hashtype = bond_parse_parm(xmit_hash_policy,
4669 xmit_hashtype_tbl); 4576 xmit_hashtype_tbl);
4670 if (xmit_hashtype == -1) { 4577 if (xmit_hashtype == -1) {
4671 pr_err(DRV_NAME 4578 pr_err("Error: Invalid xmit_hash_policy \"%s\"\n",
4672 ": Error: Invalid xmit_hash_policy \"%s\"\n",
4673 xmit_hash_policy == NULL ? "NULL" : 4579 xmit_hash_policy == NULL ? "NULL" :
4674 xmit_hash_policy); 4580 xmit_hash_policy);
4675 return -EINVAL; 4581 return -EINVAL;
@@ -4679,14 +4585,12 @@ static int bond_check_params(struct bond_params *params)
4679 4585
4680 if (lacp_rate) { 4586 if (lacp_rate) {
4681 if (bond_mode != BOND_MODE_8023AD) { 4587 if (bond_mode != BOND_MODE_8023AD) {
4682 pr_info(DRV_NAME 4588 pr_info("lacp_rate param is irrelevant in mode %s\n",
4683 ": lacp_rate param is irrelevant in mode %s\n", 4589 bond_mode_name(bond_mode));
4684 bond_mode_name(bond_mode));
4685 } else { 4590 } else {
4686 lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); 4591 lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl);
4687 if (lacp_fast == -1) { 4592 if (lacp_fast == -1) {
4688 pr_err(DRV_NAME 4593 pr_err("Error: Invalid lacp rate \"%s\"\n",
4689 ": Error: Invalid lacp rate \"%s\"\n",
4690 lacp_rate == NULL ? "NULL" : lacp_rate); 4594 lacp_rate == NULL ? "NULL" : lacp_rate);
4691 return -EINVAL; 4595 return -EINVAL;
4692 } 4596 }
@@ -4696,82 +4600,64 @@ static int bond_check_params(struct bond_params *params)
4696 if (ad_select) { 4600 if (ad_select) {
4697 params->ad_select = bond_parse_parm(ad_select, ad_select_tbl); 4601 params->ad_select = bond_parse_parm(ad_select, ad_select_tbl);
4698 if (params->ad_select == -1) { 4602 if (params->ad_select == -1) {
4699 pr_err(DRV_NAME 4603 pr_err("Error: Invalid ad_select \"%s\"\n",
4700 ": Error: Invalid ad_select \"%s\"\n",
4701 ad_select == NULL ? "NULL" : ad_select); 4604 ad_select == NULL ? "NULL" : ad_select);
4702 return -EINVAL; 4605 return -EINVAL;
4703 } 4606 }
4704 4607
4705 if (bond_mode != BOND_MODE_8023AD) { 4608 if (bond_mode != BOND_MODE_8023AD) {
4706 pr_warning(DRV_NAME 4609 pr_warning("ad_select param only affects 802.3ad mode\n");
4707 ": ad_select param only affects 802.3ad mode\n");
4708 } 4610 }
4709 } else { 4611 } else {
4710 params->ad_select = BOND_AD_STABLE; 4612 params->ad_select = BOND_AD_STABLE;
4711 } 4613 }
4712 4614
4713 if (max_bonds < 0) { 4615 if (max_bonds < 0) {
4714 pr_warning(DRV_NAME 4616 pr_warning("Warning: max_bonds (%d) not in range %d-%d, so it was reset to BOND_DEFAULT_MAX_BONDS (%d)\n",
4715 ": Warning: max_bonds (%d) not in range %d-%d, so it " 4617 max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS);
4716 "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n",
4717 max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS);
4718 max_bonds = BOND_DEFAULT_MAX_BONDS; 4618 max_bonds = BOND_DEFAULT_MAX_BONDS;
4719 } 4619 }
4720 4620
4721 if (miimon < 0) { 4621 if (miimon < 0) {
4722 pr_warning(DRV_NAME 4622 pr_warning("Warning: miimon module parameter (%d), not in range 0-%d, so it was reset to %d\n",
4723 ": Warning: miimon module parameter (%d), " 4623 miimon, INT_MAX, BOND_LINK_MON_INTERV);
4724 "not in range 0-%d, so it was reset to %d\n",
4725 miimon, INT_MAX, BOND_LINK_MON_INTERV);
4726 miimon = BOND_LINK_MON_INTERV; 4624 miimon = BOND_LINK_MON_INTERV;
4727 } 4625 }
4728 4626
4729 if (updelay < 0) { 4627 if (updelay < 0) {
4730 pr_warning(DRV_NAME 4628 pr_warning("Warning: updelay module parameter (%d), not in range 0-%d, so it was reset to 0\n",
4731 ": Warning: updelay module parameter (%d), " 4629 updelay, INT_MAX);
4732 "not in range 0-%d, so it was reset to 0\n",
4733 updelay, INT_MAX);
4734 updelay = 0; 4630 updelay = 0;
4735 } 4631 }
4736 4632
4737 if (downdelay < 0) { 4633 if (downdelay < 0) {
4738 pr_warning(DRV_NAME 4634 pr_warning("Warning: downdelay module parameter (%d), not in range 0-%d, so it was reset to 0\n",
4739 ": Warning: downdelay module parameter (%d), " 4635 downdelay, INT_MAX);
4740 "not in range 0-%d, so it was reset to 0\n",
4741 downdelay, INT_MAX);
4742 downdelay = 0; 4636 downdelay = 0;
4743 } 4637 }
4744 4638
4745 if ((use_carrier != 0) && (use_carrier != 1)) { 4639 if ((use_carrier != 0) && (use_carrier != 1)) {
4746 pr_warning(DRV_NAME 4640 pr_warning("Warning: use_carrier module parameter (%d), not of valid value (0/1), so it was set to 1\n",
4747 ": Warning: use_carrier module parameter (%d), " 4641 use_carrier);
4748 "not of valid value (0/1), so it was set to 1\n",
4749 use_carrier);
4750 use_carrier = 1; 4642 use_carrier = 1;
4751 } 4643 }
4752 4644
4753 if (num_grat_arp < 0 || num_grat_arp > 255) { 4645 if (num_grat_arp < 0 || num_grat_arp > 255) {
4754 pr_warning(DRV_NAME 4646 pr_warning("Warning: num_grat_arp (%d) not in range 0-255 so it was reset to 1 \n",
4755 ": Warning: num_grat_arp (%d) not in range 0-255 so it " 4647 num_grat_arp);
4756 "was reset to 1 \n", num_grat_arp);
4757 num_grat_arp = 1; 4648 num_grat_arp = 1;
4758 } 4649 }
4759 4650
4760 if (num_unsol_na < 0 || num_unsol_na > 255) { 4651 if (num_unsol_na < 0 || num_unsol_na > 255) {
4761 pr_warning(DRV_NAME 4652 pr_warning("Warning: num_unsol_na (%d) not in range 0-255 so it was reset to 1 \n",
4762 ": Warning: num_unsol_na (%d) not in range 0-255 so it " 4653 num_unsol_na);
4763 "was reset to 1 \n", num_unsol_na);
4764 num_unsol_na = 1; 4654 num_unsol_na = 1;
4765 } 4655 }
4766 4656
4767 /* reset values for 802.3ad */ 4657 /* reset values for 802.3ad */
4768 if (bond_mode == BOND_MODE_8023AD) { 4658 if (bond_mode == BOND_MODE_8023AD) {
4769 if (!miimon) { 4659 if (!miimon) {
4770 pr_warning(DRV_NAME 4660 pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n");
4771 ": Warning: miimon must be specified, "
4772 "otherwise bonding will not detect link "
4773 "failure, speed and duplex which are "
4774 "essential for 802.3ad operation\n");
4775 pr_warning("Forcing miimon to 100msec\n"); 4661 pr_warning("Forcing miimon to 100msec\n");
4776 miimon = 100; 4662 miimon = 100;
4777 } 4663 }
@@ -4781,24 +4667,15 @@ static int bond_check_params(struct bond_params *params)
4781 if ((bond_mode == BOND_MODE_TLB) || 4667 if ((bond_mode == BOND_MODE_TLB) ||
4782 (bond_mode == BOND_MODE_ALB)) { 4668 (bond_mode == BOND_MODE_ALB)) {
4783 if (!miimon) { 4669 if (!miimon) {
4784 pr_warning(DRV_NAME 4670 pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n");
4785 ": Warning: miimon must be specified, "
4786 "otherwise bonding will not detect link "
4787 "failure and link speed which are essential "
4788 "for TLB/ALB load balancing\n");
4789 pr_warning("Forcing miimon to 100msec\n"); 4671 pr_warning("Forcing miimon to 100msec\n");
4790 miimon = 100; 4672 miimon = 100;
4791 } 4673 }
4792 } 4674 }
4793 4675
4794 if (bond_mode == BOND_MODE_ALB) { 4676 if (bond_mode == BOND_MODE_ALB) {
4795 pr_notice(DRV_NAME 4677 pr_notice("In ALB mode you might experience client disconnections upon reconnection of a link if the bonding module updelay parameter (%d msec) is incompatible with the forwarding delay time of the switch\n",
4796 ": In ALB mode you might experience client " 4678 updelay);
4797 "disconnections upon reconnection of a link if the "
4798 "bonding module updelay parameter (%d msec) is "
4799 "incompatible with the forwarding delay time of the "
4800 "switch\n",
4801 updelay);
4802 } 4679 }
4803 4680
4804 if (!miimon) { 4681 if (!miimon) {
@@ -4806,49 +4683,37 @@ static int bond_check_params(struct bond_params *params)
4806 /* just warn the user the up/down delay will have 4683 /* just warn the user the up/down delay will have
4807 * no effect since miimon is zero... 4684 * no effect since miimon is zero...
4808 */ 4685 */
4809 pr_warning(DRV_NAME 4686 pr_warning("Warning: miimon module parameter not set and updelay (%d) or downdelay (%d) module parameter is set; updelay and downdelay have no effect unless miimon is set\n",
4810 ": Warning: miimon module parameter not set " 4687 updelay, downdelay);
4811 "and updelay (%d) or downdelay (%d) module "
4812 "parameter is set; updelay and downdelay have "
4813 "no effect unless miimon is set\n",
4814 updelay, downdelay);
4815 } 4688 }
4816 } else { 4689 } else {
4817 /* don't allow arp monitoring */ 4690 /* don't allow arp monitoring */
4818 if (arp_interval) { 4691 if (arp_interval) {
4819 pr_warning(DRV_NAME 4692 pr_warning("Warning: miimon (%d) and arp_interval (%d) can't be used simultaneously, disabling ARP monitoring\n",
4820 ": Warning: miimon (%d) and arp_interval (%d) " 4693 miimon, arp_interval);
4821 "can't be used simultaneously, disabling ARP "
4822 "monitoring\n",
4823 miimon, arp_interval);
4824 arp_interval = 0; 4694 arp_interval = 0;
4825 } 4695 }
4826 4696
4827 if ((updelay % miimon) != 0) { 4697 if ((updelay % miimon) != 0) {
4828 pr_warning(DRV_NAME 4698 pr_warning("Warning: updelay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n",
4829 ": Warning: updelay (%d) is not a multiple " 4699 updelay, miimon,
4830 "of miimon (%d), updelay rounded to %d ms\n", 4700 (updelay / miimon) * miimon);
4831 updelay, miimon, (updelay / miimon) * miimon);
4832 } 4701 }
4833 4702
4834 updelay /= miimon; 4703 updelay /= miimon;
4835 4704
4836 if ((downdelay % miimon) != 0) { 4705 if ((downdelay % miimon) != 0) {
4837 pr_warning(DRV_NAME 4706 pr_warning("Warning: downdelay (%d) is not a multiple of miimon (%d), downdelay rounded to %d ms\n",
4838 ": Warning: downdelay (%d) is not a multiple " 4707 downdelay, miimon,
4839 "of miimon (%d), downdelay rounded to %d ms\n", 4708 (downdelay / miimon) * miimon);
4840 downdelay, miimon,
4841 (downdelay / miimon) * miimon);
4842 } 4709 }
4843 4710
4844 downdelay /= miimon; 4711 downdelay /= miimon;
4845 } 4712 }
4846 4713
4847 if (arp_interval < 0) { 4714 if (arp_interval < 0) {
4848 pr_warning(DRV_NAME 4715 pr_warning("Warning: arp_interval module parameter (%d) , not in range 0-%d, so it was reset to %d\n",
4849 ": Warning: arp_interval module parameter (%d) " 4716 arp_interval, INT_MAX, BOND_LINK_ARP_INTERV);
4850 ", not in range 0-%d, so it was reset to %d\n",
4851 arp_interval, INT_MAX, BOND_LINK_ARP_INTERV);
4852 arp_interval = BOND_LINK_ARP_INTERV; 4717 arp_interval = BOND_LINK_ARP_INTERV;
4853 } 4718 }
4854 4719
@@ -4858,10 +4723,8 @@ static int bond_check_params(struct bond_params *params)
4858 /* not complete check, but should be good enough to 4723 /* not complete check, but should be good enough to
4859 catch mistakes */ 4724 catch mistakes */
4860 if (!isdigit(arp_ip_target[arp_ip_count][0])) { 4725 if (!isdigit(arp_ip_target[arp_ip_count][0])) {
4861 pr_warning(DRV_NAME 4726 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
4862 ": Warning: bad arp_ip_target module parameter " 4727 arp_ip_target[arp_ip_count]);
4863 "(%s), ARP monitoring will not be performed\n",
4864 arp_ip_target[arp_ip_count]);
4865 arp_interval = 0; 4728 arp_interval = 0;
4866 } else { 4729 } else {
4867 __be32 ip = in_aton(arp_ip_target[arp_ip_count]); 4730 __be32 ip = in_aton(arp_ip_target[arp_ip_count]);
@@ -4871,31 +4734,25 @@ static int bond_check_params(struct bond_params *params)
4871 4734
4872 if (arp_interval && !arp_ip_count) { 4735 if (arp_interval && !arp_ip_count) {
4873 /* don't allow arping if no arp_ip_target given... */ 4736 /* don't allow arping if no arp_ip_target given... */
4874 pr_warning(DRV_NAME 4737 pr_warning("Warning: arp_interval module parameter (%d) specified without providing an arp_ip_target parameter, arp_interval was reset to 0\n",
4875 ": Warning: arp_interval module parameter (%d) " 4738 arp_interval);
4876 "specified without providing an arp_ip_target "
4877 "parameter, arp_interval was reset to 0\n",
4878 arp_interval);
4879 arp_interval = 0; 4739 arp_interval = 0;
4880 } 4740 }
4881 4741
4882 if (arp_validate) { 4742 if (arp_validate) {
4883 if (bond_mode != BOND_MODE_ACTIVEBACKUP) { 4743 if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
4884 pr_err(DRV_NAME 4744 pr_err("arp_validate only supported in active-backup mode\n");
4885 ": arp_validate only supported in active-backup mode\n");
4886 return -EINVAL; 4745 return -EINVAL;
4887 } 4746 }
4888 if (!arp_interval) { 4747 if (!arp_interval) {
4889 pr_err(DRV_NAME 4748 pr_err("arp_validate requires arp_interval\n");
4890 ": arp_validate requires arp_interval\n");
4891 return -EINVAL; 4749 return -EINVAL;
4892 } 4750 }
4893 4751
4894 arp_validate_value = bond_parse_parm(arp_validate, 4752 arp_validate_value = bond_parse_parm(arp_validate,
4895 arp_validate_tbl); 4753 arp_validate_tbl);
4896 if (arp_validate_value == -1) { 4754 if (arp_validate_value == -1) {
4897 pr_err(DRV_NAME 4755 pr_err("Error: invalid arp_validate \"%s\"\n",
4898 ": Error: invalid arp_validate \"%s\"\n",
4899 arp_validate == NULL ? "NULL" : arp_validate); 4756 arp_validate == NULL ? "NULL" : arp_validate);
4900 return -EINVAL; 4757 return -EINVAL;
4901 } 4758 }
@@ -4903,17 +4760,14 @@ static int bond_check_params(struct bond_params *params)
4903 arp_validate_value = 0; 4760 arp_validate_value = 0;
4904 4761
4905 if (miimon) { 4762 if (miimon) {
4906 pr_info(DRV_NAME 4763 pr_info("MII link monitoring set to %d ms\n", miimon);
4907 ": MII link monitoring set to %d ms\n",
4908 miimon);
4909 } else if (arp_interval) { 4764 } else if (arp_interval) {
4910 int i; 4765 int i;
4911 4766
4912 pr_info(DRV_NAME ": ARP monitoring set to %d ms," 4767 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):",
4913 " validate %s, with %d target(s):", 4768 arp_interval,
4914 arp_interval, 4769 arp_validate_tbl[arp_validate_value].modename,
4915 arp_validate_tbl[arp_validate_value].modename, 4770 arp_ip_count);
4916 arp_ip_count);
4917 4771
4918 for (i = 0; i < arp_ip_count; i++) 4772 for (i = 0; i < arp_ip_count; i++)
4919 pr_info(" %s", arp_ip_target[i]); 4773 pr_info(" %s", arp_ip_target[i]);
@@ -4924,21 +4778,15 @@ static int bond_check_params(struct bond_params *params)
4924 /* miimon and arp_interval not set, we need one so things 4778 /* miimon and arp_interval not set, we need one so things
4925 * work as expected, see bonding.txt for details 4779 * work as expected, see bonding.txt for details
4926 */ 4780 */
4927 pr_warning(DRV_NAME 4781 pr_warning("Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.\n");
4928 ": Warning: either miimon or arp_interval and "
4929 "arp_ip_target module parameters must be specified, "
4930 "otherwise bonding will not detect link failures! see "
4931 "bonding.txt for details.\n");
4932 } 4782 }
4933 4783
4934 if (primary && !USES_PRIMARY(bond_mode)) { 4784 if (primary && !USES_PRIMARY(bond_mode)) {
4935 /* currently, using a primary only makes sense 4785 /* currently, using a primary only makes sense
4936 * in active backup, TLB or ALB modes 4786 * in active backup, TLB or ALB modes
4937 */ 4787 */
4938 pr_warning(DRV_NAME 4788 pr_warning("Warning: %s primary device specified but has no effect in %s mode\n",
4939 ": Warning: %s primary device specified but has no " 4789 primary, bond_mode_name(bond_mode));
4940 "effect in %s mode\n",
4941 primary, bond_mode_name(bond_mode));
4942 primary = NULL; 4790 primary = NULL;
4943 } 4791 }
4944 4792
@@ -4946,8 +4794,7 @@ static int bond_check_params(struct bond_params *params)
4946 primary_reselect_value = bond_parse_parm(primary_reselect, 4794 primary_reselect_value = bond_parse_parm(primary_reselect,
4947 pri_reselect_tbl); 4795 pri_reselect_tbl);
4948 if (primary_reselect_value == -1) { 4796 if (primary_reselect_value == -1) {
4949 pr_err(DRV_NAME 4797 pr_err("Error: Invalid primary_reselect \"%s\"\n",
4950 ": Error: Invalid primary_reselect \"%s\"\n",
4951 primary_reselect == 4798 primary_reselect ==
4952 NULL ? "NULL" : primary_reselect); 4799 NULL ? "NULL" : primary_reselect);
4953 return -EINVAL; 4800 return -EINVAL;
@@ -4960,16 +4807,13 @@ static int bond_check_params(struct bond_params *params)
4960 fail_over_mac_value = bond_parse_parm(fail_over_mac, 4807 fail_over_mac_value = bond_parse_parm(fail_over_mac,
4961 fail_over_mac_tbl); 4808 fail_over_mac_tbl);
4962 if (fail_over_mac_value == -1) { 4809 if (fail_over_mac_value == -1) {
4963 pr_err(DRV_NAME 4810 pr_err("Error: invalid fail_over_mac \"%s\"\n",
4964 ": Error: invalid fail_over_mac \"%s\"\n",
4965 arp_validate == NULL ? "NULL" : arp_validate); 4811 arp_validate == NULL ? "NULL" : arp_validate);
4966 return -EINVAL; 4812 return -EINVAL;
4967 } 4813 }
4968 4814
4969 if (bond_mode != BOND_MODE_ACTIVEBACKUP) 4815 if (bond_mode != BOND_MODE_ACTIVEBACKUP)
4970 pr_warning(DRV_NAME 4816 pr_warning("Warning: fail_over_mac only affects active-backup mode.\n");
4971 ": Warning: fail_over_mac only affects "
4972 "active-backup mode.\n");
4973 } else { 4817 } else {
4974 fail_over_mac_value = BOND_FOM_NONE; 4818 fail_over_mac_value = BOND_FOM_NONE;
4975 } 4819 }
@@ -5076,8 +4920,7 @@ int bond_create(struct net *net, const char *name)
5076 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", 4920 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
5077 bond_setup); 4921 bond_setup);
5078 if (!bond_dev) { 4922 if (!bond_dev) {
5079 pr_err(DRV_NAME ": %s: eek! can't alloc netdev!\n", 4923 pr_err("%s: eek! can't alloc netdev!\n", name);
5080 name);
5081 res = -ENOMEM; 4924 res = -ENOMEM;
5082 goto out; 4925 goto out;
5083 } 4926 }
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
142err_no_cmd: 142err_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
334err_no_cmd: 327err_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
338out: 332out:
@@ -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 }
395out: 387out:
@@ -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
863out: 821out:
@@ -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 }
1211out: 1146out:
@@ -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 }
1309out: 1241out:
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 }