Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bonding/main: convert to using slave printk macros

All of these printk instances benefit from having both master and slave
device information included, so convert to using a standardized macro
format and remove redundant information.

Suggested-by: Joe Perches <joe@perches.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jarod Wilson and committed by
David S. Miller
e2a7420d 5237ff79

+139 -167
+139 -167
drivers/net/bonding/bond_main.c
··· 613 613 { 614 614 int err; 615 615 616 - netdev_dbg(bond_dev, "bond_dev=%p slave_dev=%p slave_dev->name=%s slave_dev->addr_len=%d\n", 617 - bond_dev, slave_dev, slave_dev->name, slave_dev->addr_len); 616 + slave_dbg(bond_dev, slave_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n", 617 + bond_dev, slave_dev, slave_dev->addr_len); 618 618 err = dev_pre_changeaddr_notify(bond_dev, slave_dev->dev_addr, NULL); 619 619 if (err) 620 620 return err; ··· 661 661 if (new_active) { 662 662 rv = bond_set_dev_addr(bond->dev, new_active->dev); 663 663 if (rv) 664 - netdev_err(bond->dev, "Error %d setting bond MAC from slave %s\n", 665 - -rv, new_active->dev->name); 664 + slave_err(bond->dev, new_active->dev, "Error %d setting bond MAC from slave\n", 665 + -rv); 666 666 } 667 667 break; 668 668 case BOND_FOM_FOLLOW: ··· 692 692 rv = dev_set_mac_address(new_active->dev, 693 693 (struct sockaddr *)&ss, NULL); 694 694 if (rv) { 695 - netdev_err(bond->dev, "Error %d setting MAC of new active slave %s\n", 696 - -rv, new_active->dev->name); 695 + slave_err(bond->dev, new_active->dev, "Error %d setting MAC of new active slave\n", 696 + -rv); 697 697 goto out; 698 698 } 699 699 ··· 707 707 rv = dev_set_mac_address(old_active->dev, 708 708 (struct sockaddr *)&ss, NULL); 709 709 if (rv) 710 - netdev_err(bond->dev, "Error %d setting MAC of old active slave %s\n", 711 - -rv, old_active->dev->name); 710 + slave_err(bond->dev, old_active->dev, "Error %d setting MAC of old active slave\n", 711 + -rv); 712 712 out: 713 713 break; 714 714 default: ··· 834 834 835 835 if (new_active->link == BOND_LINK_BACK) { 836 836 if (bond_uses_primary(bond)) { 837 - netdev_info(bond->dev, "making interface %s the new active one %d ms earlier\n", 838 - new_active->dev->name, 839 - (bond->params.updelay - new_active->delay) * bond->params.miimon); 837 + slave_info(bond->dev, new_active->dev, "making interface the new active one %d ms earlier\n", 838 + (bond->params.updelay - new_active->delay) * bond->params.miimon); 840 839 } 841 840 842 841 new_active->delay = 0; ··· 849 850 bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); 850 851 } else { 851 852 if (bond_uses_primary(bond)) { 852 - netdev_info(bond->dev, "making interface %s the new active one\n", 853 - new_active->dev->name); 853 + slave_info(bond->dev, new_active->dev, "making interface the new active one\n"); 854 854 } 855 855 } 856 856 } ··· 937 939 return; 938 940 939 941 if (netif_carrier_ok(bond->dev)) 940 - netdev_info(bond->dev, "first active interface up!\n"); 942 + slave_info(bond->dev, best_slave->dev, "active interface up!\n"); 941 943 else 942 944 netdev_info(bond->dev, "now running without any active interface!\n"); 943 945 } ··· 1378 1380 if (!bond->params.use_carrier && 1379 1381 slave_dev->ethtool_ops->get_link == NULL && 1380 1382 slave_ops->ndo_do_ioctl == NULL) { 1381 - netdev_warn(bond_dev, "no link monitoring support for %s\n", 1382 - slave_dev->name); 1383 + slave_warn(bond_dev, slave_dev, "no link monitoring support\n"); 1383 1384 } 1384 1385 1385 1386 /* already in-use? */ 1386 1387 if (netdev_is_rx_handler_busy(slave_dev)) { 1387 1388 NL_SET_ERR_MSG(extack, "Device is in use and cannot be enslaved"); 1388 - netdev_err(bond_dev, 1389 - "Error: Device is in use and cannot be enslaved\n"); 1389 + slave_err(bond_dev, slave_dev, 1390 + "Error: Device is in use and cannot be enslaved\n"); 1390 1391 return -EBUSY; 1391 1392 } 1392 1393 ··· 1398 1401 /* vlan challenged mutual exclusion */ 1399 1402 /* no need to lock since we're protected by rtnl_lock */ 1400 1403 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { 1401 - netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n", 1402 - slave_dev->name); 1404 + slave_dbg(bond_dev, slave_dev, "is NETIF_F_VLAN_CHALLENGED\n"); 1403 1405 if (vlan_uses_dev(bond_dev)) { 1404 1406 NL_SET_ERR_MSG(extack, "Can not enslave VLAN challenged device to VLAN enabled bond"); 1405 - netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", 1406 - slave_dev->name, bond_dev->name); 1407 + slave_err(bond_dev, slave_dev, "Error: cannot enslave VLAN challenged slave on VLAN enabled bond\n"); 1407 1408 return -EPERM; 1408 1409 } else { 1409 - netdev_warn(bond_dev, "enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n", 1410 - slave_dev->name, slave_dev->name, 1411 - bond_dev->name); 1410 + slave_warn(bond_dev, slave_dev, "enslaved VLAN challenged slave. Adding VLANs will be blocked as long as it is part of bond.\n"); 1412 1411 } 1413 1412 } else { 1414 - netdev_dbg(bond_dev, "%s is !NETIF_F_VLAN_CHALLENGED\n", 1415 - slave_dev->name); 1413 + slave_dbg(bond_dev, slave_dev, "is !NETIF_F_VLAN_CHALLENGED\n"); 1416 1414 } 1417 1415 1418 1416 /* Old ifenslave binaries are no longer supported. These can ··· 1417 1425 */ 1418 1426 if (slave_dev->flags & IFF_UP) { 1419 1427 NL_SET_ERR_MSG(extack, "Device can not be enslaved while up"); 1420 - netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n", 1421 - slave_dev->name); 1428 + slave_err(bond_dev, slave_dev, "slave is up - this may be due to an out of date ifenslave\n"); 1422 1429 return -EPERM; 1423 1430 } 1424 1431 ··· 1430 1439 */ 1431 1440 if (!bond_has_slaves(bond)) { 1432 1441 if (bond_dev->type != slave_dev->type) { 1433 - netdev_dbg(bond_dev, "change device type from %d to %d\n", 1434 - bond_dev->type, slave_dev->type); 1442 + slave_dbg(bond_dev, slave_dev, "change device type from %d to %d\n", 1443 + bond_dev->type, slave_dev->type); 1435 1444 1436 1445 res = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, 1437 1446 bond_dev); 1438 1447 res = notifier_to_errno(res); 1439 1448 if (res) { 1440 - netdev_err(bond_dev, "refused to change device type\n"); 1449 + slave_err(bond_dev, slave_dev, "refused to change device type\n"); 1441 1450 return -EBUSY; 1442 1451 } 1443 1452 ··· 1457 1466 } 1458 1467 } else if (bond_dev->type != slave_dev->type) { 1459 1468 NL_SET_ERR_MSG(extack, "Device type is different from other slaves"); 1460 - netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n", 1461 - slave_dev->name, slave_dev->type, bond_dev->type); 1469 + slave_err(bond_dev, slave_dev, "ether type (%d) is different from other slaves (%d), can not enslave it\n", 1470 + slave_dev->type, bond_dev->type); 1462 1471 return -EINVAL; 1463 1472 } 1464 1473 1465 1474 if (slave_dev->type == ARPHRD_INFINIBAND && 1466 1475 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { 1467 1476 NL_SET_ERR_MSG(extack, "Only active-backup mode is supported for infiniband slaves"); 1468 - netdev_warn(bond_dev, "Type (%d) supports only active-backup mode\n", 1469 - slave_dev->type); 1477 + slave_warn(bond_dev, slave_dev, "Type (%d) supports only active-backup mode\n", 1478 + slave_dev->type); 1470 1479 res = -EOPNOTSUPP; 1471 1480 goto err_undo_flags; 1472 1481 } 1473 1482 1474 1483 if (!slave_ops->ndo_set_mac_address || 1475 1484 slave_dev->type == ARPHRD_INFINIBAND) { 1476 - netdev_warn(bond_dev, "The slave device specified does not support setting the MAC address\n"); 1485 + slave_warn(bond_dev, slave_dev, "The slave device specified does not support setting the MAC address\n"); 1477 1486 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP && 1478 1487 bond->params.fail_over_mac != BOND_FOM_ACTIVE) { 1479 1488 if (!bond_has_slaves(bond)) { 1480 1489 bond->params.fail_over_mac = BOND_FOM_ACTIVE; 1481 - netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n"); 1490 + slave_warn(bond_dev, slave_dev, "Setting fail_over_mac to active for active-backup mode\n"); 1482 1491 } else { 1483 1492 NL_SET_ERR_MSG(extack, "Slave device does not support setting the MAC address, but fail_over_mac is not set to active"); 1484 - netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n"); 1493 + slave_err(bond_dev, slave_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n"); 1485 1494 res = -EOPNOTSUPP; 1486 1495 goto err_undo_flags; 1487 1496 } ··· 1517 1526 new_slave->original_mtu = slave_dev->mtu; 1518 1527 res = dev_set_mtu(slave_dev, bond->dev->mtu); 1519 1528 if (res) { 1520 - netdev_dbg(bond_dev, "Error %d calling dev_set_mtu\n", res); 1529 + slave_err(bond_dev, slave_dev, "Error %d calling dev_set_mtu\n", res); 1521 1530 goto err_free; 1522 1531 } 1523 1532 ··· 1538 1547 res = dev_set_mac_address(slave_dev, (struct sockaddr *)&ss, 1539 1548 extack); 1540 1549 if (res) { 1541 - netdev_dbg(bond_dev, "Error %d calling set_mac_address\n", res); 1550 + slave_err(bond_dev, slave_dev, "Error %d calling set_mac_address\n", res); 1542 1551 goto err_restore_mtu; 1543 1552 } 1544 1553 } ··· 1549 1558 /* open the slave since the application closed it */ 1550 1559 res = dev_open(slave_dev, extack); 1551 1560 if (res) { 1552 - netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name); 1561 + slave_err(bond_dev, slave_dev, "Opening slave failed\n"); 1553 1562 goto err_restore_mac; 1554 1563 } 1555 1564 ··· 1568 1577 1569 1578 res = vlan_vids_add_by_dev(slave_dev, bond_dev); 1570 1579 if (res) { 1571 - netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", 1572 - slave_dev->name); 1580 + slave_err(bond_dev, slave_dev, "Couldn't add bond vlan ids\n"); 1573 1581 goto err_close; 1574 1582 } 1575 1583 ··· 1598 1608 * supported); thus, we don't need to change 1599 1609 * the messages for netif_carrier. 1600 1610 */ 1601 - netdev_warn(bond_dev, "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", 1602 - slave_dev->name); 1611 + slave_warn(bond_dev, slave_dev, "MII and ETHTOOL support not available for slave, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details\n"); 1603 1612 } else if (link_reporting == -1) { 1604 1613 /* unable get link status using mii/ethtool */ 1605 - netdev_warn(bond_dev, "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", 1606 - slave_dev->name); 1614 + slave_warn(bond_dev, slave_dev, "can't get link status from slave; 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"); 1607 1615 } 1608 1616 } 1609 1617 ··· 1635 1647 1636 1648 if (new_slave->link != BOND_LINK_DOWN) 1637 1649 new_slave->last_link_up = jiffies; 1638 - netdev_dbg(bond_dev, "Initial state of slave_dev is BOND_LINK_%s\n", 1639 - new_slave->link == BOND_LINK_DOWN ? "DOWN" : 1640 - (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); 1650 + slave_dbg(bond_dev, slave_dev, "Initial state of slave is BOND_LINK_%s\n", 1651 + new_slave->link == BOND_LINK_DOWN ? "DOWN" : 1652 + (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); 1641 1653 1642 1654 if (bond_uses_primary(bond) && bond->params.primary[0]) { 1643 1655 /* if there is a primary slave, remember it */ ··· 1678 1690 bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW); 1679 1691 break; 1680 1692 default: 1681 - netdev_dbg(bond_dev, "This slave is always active in trunk mode\n"); 1693 + slave_dbg(bond_dev, slave_dev, "This slave is always active in trunk mode\n"); 1682 1694 1683 1695 /* always active in trunk mode */ 1684 1696 bond_set_active_slave(new_slave); ··· 1697 1709 #ifdef CONFIG_NET_POLL_CONTROLLER 1698 1710 if (bond->dev->npinfo) { 1699 1711 if (slave_enable_netpoll(new_slave)) { 1700 - netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\n"); 1712 + slave_info(bond_dev, slave_dev, "master_dev is using netpoll, but new slave device does not support netpoll\n"); 1701 1713 res = -EBUSY; 1702 1714 goto err_detach; 1703 1715 } ··· 1710 1722 res = netdev_rx_handler_register(slave_dev, bond_handle_frame, 1711 1723 new_slave); 1712 1724 if (res) { 1713 - netdev_dbg(bond_dev, "Error %d calling netdev_rx_handler_register\n", res); 1725 + slave_dbg(bond_dev, slave_dev, "Error %d calling netdev_rx_handler_register\n", res); 1714 1726 goto err_detach; 1715 1727 } 1716 1728 1717 1729 res = bond_master_upper_dev_link(bond, new_slave, extack); 1718 1730 if (res) { 1719 - netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res); 1731 + slave_dbg(bond_dev, slave_dev, "Error %d calling bond_master_upper_dev_link\n", res); 1720 1732 goto err_unregister; 1721 1733 } 1722 1734 1723 1735 res = bond_sysfs_slave_add(new_slave); 1724 1736 if (res) { 1725 - netdev_dbg(bond_dev, "Error %d calling bond_sysfs_slave_add\n", res); 1737 + slave_dbg(bond_dev, slave_dev, "Error %d calling bond_sysfs_slave_add\n", res); 1726 1738 goto err_upper_unlink; 1727 1739 } 1728 1740 ··· 1776 1788 bond_update_slave_arr(bond, NULL); 1777 1789 1778 1790 1779 - netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n", 1780 - slave_dev->name, 1781 - bond_is_active_slave(new_slave) ? "an active" : "a backup", 1782 - new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); 1791 + slave_info(bond_dev, slave_dev, "Enslaving as %s interface with %s link\n", 1792 + bond_is_active_slave(new_slave) ? "an active" : "a backup", 1793 + new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); 1783 1794 1784 1795 /* enslave is successful */ 1785 1796 bond_queue_slave_event(new_slave); ··· 1873 1886 /* slave is not a slave or master is not master of this slave */ 1874 1887 if (!(slave_dev->flags & IFF_SLAVE) || 1875 1888 !netdev_has_upper_dev(slave_dev, bond_dev)) { 1876 - netdev_dbg(bond_dev, "cannot release %s\n", 1877 - slave_dev->name); 1889 + slave_dbg(bond_dev, slave_dev, "cannot release slave\n"); 1878 1890 return -EINVAL; 1879 1891 } 1880 1892 ··· 1882 1896 slave = bond_get_slave_by_dev(bond, slave_dev); 1883 1897 if (!slave) { 1884 1898 /* not a slave of this bond */ 1885 - netdev_info(bond_dev, "%s not enslaved\n", 1886 - slave_dev->name); 1899 + slave_info(bond_dev, slave_dev, "interface not enslaved\n"); 1887 1900 unblock_netpoll_tx(); 1888 1901 return -EINVAL; 1889 1902 } ··· 1906 1921 if (bond_mode_can_use_xmit_hash(bond)) 1907 1922 bond_update_slave_arr(bond, slave); 1908 1923 1909 - netdev_info(bond_dev, "Releasing %s interface %s\n", 1910 - bond_is_active_slave(slave) ? "active" : "backup", 1911 - slave_dev->name); 1924 + slave_info(bond_dev, slave_dev, "Releasing %s interface\n", 1925 + bond_is_active_slave(slave) ? "active" : "backup"); 1912 1926 1913 1927 oldcurrent = rcu_access_pointer(bond->curr_active_slave); 1914 1928 ··· 1917 1933 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)) { 1918 1934 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && 1919 1935 bond_has_slaves(bond)) 1920 - netdev_warn(bond_dev, "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", 1921 - slave_dev->name, slave->perm_hwaddr, 1922 - bond_dev->name, slave_dev->name); 1936 + slave_warn(bond_dev, slave_dev, "the permanent HWaddr of slave - %pM - is still in use by bond - set the HWaddr of slave to a different address to avoid conflicts\n", 1937 + slave->perm_hwaddr); 1923 1938 } 1924 1939 1925 1940 if (rtnl_dereference(bond->primary_slave) == slave) ··· 1966 1983 bond_compute_features(bond); 1967 1984 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && 1968 1985 (old_features & NETIF_F_VLAN_CHALLENGED)) 1969 - netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", 1970 - slave_dev->name, bond_dev->name); 1986 + slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - VLAN blocking is removed\n"); 1971 1987 1972 1988 vlan_vids_del_by_dev(slave_dev, bond_dev); 1973 1989 ··· 2026 2044 /* First release a slave and then destroy the bond if no more slaves are left. 2027 2045 * Must be under rtnl_lock when this function is called. 2028 2046 */ 2029 - static int bond_release_and_destroy(struct net_device *bond_dev, 2030 - struct net_device *slave_dev) 2047 + static int bond_release_and_destroy(struct net_device *bond_dev, 2048 + struct net_device *slave_dev) 2031 2049 { 2032 2050 struct bonding *bond = netdev_priv(bond_dev); 2033 2051 int ret; ··· 2035 2053 ret = __bond_release_one(bond_dev, slave_dev, false, true); 2036 2054 if (ret == 0 && !bond_has_slaves(bond)) { 2037 2055 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; 2038 - netdev_info(bond_dev, "Destroying bond %s\n", 2039 - bond_dev->name); 2056 + netdev_info(bond_dev, "Destroying bond\n"); 2040 2057 bond_remove_proc_entry(bond); 2041 2058 unregister_netdevice(bond_dev); 2042 2059 } ··· 2093 2112 commit++; 2094 2113 slave->delay = bond->params.downdelay; 2095 2114 if (slave->delay) { 2096 - netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n", 2097 - (BOND_MODE(bond) == 2098 - BOND_MODE_ACTIVEBACKUP) ? 2099 - (bond_is_active_slave(slave) ? 2100 - "active " : "backup ") : "", 2101 - slave->dev->name, 2102 - bond->params.downdelay * bond->params.miimon); 2115 + slave_info(bond->dev, slave->dev, "link status down for %sinterface, disabling it in %d ms\n", 2116 + (BOND_MODE(bond) == 2117 + BOND_MODE_ACTIVEBACKUP) ? 2118 + (bond_is_active_slave(slave) ? 2119 + "active " : "backup ") : "", 2120 + bond->params.downdelay * bond->params.miimon); 2103 2121 } 2104 2122 /*FALLTHRU*/ 2105 2123 case BOND_LINK_FAIL: ··· 2106 2126 /* recovered before downdelay expired */ 2107 2127 bond_propose_link_state(slave, BOND_LINK_UP); 2108 2128 slave->last_link_up = jiffies; 2109 - netdev_info(bond->dev, "link status up again after %d ms for interface %s\n", 2110 - (bond->params.downdelay - slave->delay) * 2111 - bond->params.miimon, 2112 - slave->dev->name); 2129 + slave_info(bond->dev, slave->dev, "link status up again after %d ms\n", 2130 + (bond->params.downdelay - slave->delay) * 2131 + bond->params.miimon); 2113 2132 commit++; 2114 2133 continue; 2115 2134 } ··· 2131 2152 slave->delay = bond->params.updelay; 2132 2153 2133 2154 if (slave->delay) { 2134 - netdev_info(bond->dev, "link status up for interface %s, enabling it in %d ms\n", 2135 - slave->dev->name, 2136 - ignore_updelay ? 0 : 2137 - bond->params.updelay * 2138 - bond->params.miimon); 2155 + slave_info(bond->dev, slave->dev, "link status up, enabling it in %d ms\n", 2156 + ignore_updelay ? 0 : 2157 + bond->params.updelay * 2158 + bond->params.miimon); 2139 2159 } 2140 2160 /*FALLTHRU*/ 2141 2161 case BOND_LINK_BACK: 2142 2162 if (!link_state) { 2143 2163 bond_propose_link_state(slave, BOND_LINK_DOWN); 2144 - netdev_info(bond->dev, "link status down again after %d ms for interface %s\n", 2145 - (bond->params.updelay - slave->delay) * 2146 - bond->params.miimon, 2147 - slave->dev->name); 2164 + slave_info(bond->dev, slave->dev, "link status down again after %d ms\n", 2165 + (bond->params.updelay - slave->delay) * 2166 + bond->params.miimon); 2148 2167 commit++; 2149 2168 continue; 2150 2169 } ··· 2198 2221 bond_needs_speed_duplex(bond)) { 2199 2222 slave->link = BOND_LINK_DOWN; 2200 2223 if (net_ratelimit()) 2201 - netdev_warn(bond->dev, 2202 - "failed to get link speed/duplex for %s\n", 2203 - slave->dev->name); 2224 + slave_warn(bond->dev, slave->dev, 2225 + "failed to get link speed/duplex\n"); 2204 2226 continue; 2205 2227 } 2206 2228 bond_set_slave_link_state(slave, BOND_LINK_UP, ··· 2218 2242 bond_set_backup_slave(slave); 2219 2243 } 2220 2244 2221 - netdev_info(bond->dev, "link status definitely up for interface %s, %u Mbps %s duplex\n", 2222 - slave->dev->name, 2223 - slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, 2224 - slave->duplex ? "full" : "half"); 2245 + slave_info(bond->dev, slave->dev, "link status definitely up, %u Mbps %s duplex\n", 2246 + slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, 2247 + slave->duplex ? "full" : "half"); 2225 2248 2226 2249 bond_miimon_link_change(bond, slave, BOND_LINK_UP); 2227 2250 ··· 2241 2266 bond_set_slave_inactive_flags(slave, 2242 2267 BOND_SLAVE_NOTIFY_NOW); 2243 2268 2244 - netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", 2245 - slave->dev->name); 2269 + slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n"); 2246 2270 2247 2271 bond_miimon_link_change(bond, slave, BOND_LINK_DOWN); 2248 2272 ··· 2251 2277 continue; 2252 2278 2253 2279 default: 2254 - netdev_err(bond->dev, "invalid new link %d on slave %s\n", 2255 - slave->new_link, slave->dev->name); 2280 + slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n", 2281 + slave->new_link); 2256 2282 slave->new_link = BOND_LINK_NOCHANGE; 2257 2283 2258 2284 continue; ··· 2349 2375 * switches in VLAN mode (especially if ports are configured as 2350 2376 * "native" to a VLAN) might not pass non-tagged frames. 2351 2377 */ 2352 - static void bond_arp_send(struct net_device *slave_dev, int arp_op, 2353 - __be32 dest_ip, __be32 src_ip, 2354 - struct bond_vlan_tag *tags) 2378 + static void bond_arp_send(struct slave *slave, int arp_op, __be32 dest_ip, 2379 + __be32 src_ip, struct bond_vlan_tag *tags) 2355 2380 { 2356 2381 struct sk_buff *skb; 2357 2382 struct bond_vlan_tag *outer_tag = tags; 2383 + struct net_device *slave_dev = slave->dev; 2384 + struct net_device *bond_dev = slave->bond->dev; 2358 2385 2359 - netdev_dbg(slave_dev, "arp %d on slave %s: dst %pI4 src %pI4\n", 2360 - arp_op, slave_dev->name, &dest_ip, &src_ip); 2386 + slave_dbg(bond_dev, slave_dev, "arp %d on slave: dst %pI4 src %pI4\n", 2387 + arp_op, &dest_ip, &src_ip); 2361 2388 2362 2389 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, 2363 2390 NULL, slave_dev->dev_addr, NULL); ··· 2380 2405 continue; 2381 2406 } 2382 2407 2383 - netdev_dbg(slave_dev, "inner tag: proto %X vid %X\n", 2384 - ntohs(outer_tag->vlan_proto), tags->vlan_id); 2408 + slave_dbg(bond_dev, slave_dev, "inner tag: proto %X vid %X\n", 2409 + ntohs(outer_tag->vlan_proto), tags->vlan_id); 2385 2410 skb = vlan_insert_tag_set_proto(skb, tags->vlan_proto, 2386 2411 tags->vlan_id); 2387 2412 if (!skb) { ··· 2393 2418 } 2394 2419 /* Set the outer tag */ 2395 2420 if (outer_tag->vlan_id) { 2396 - netdev_dbg(slave_dev, "outer tag: proto %X vid %X\n", 2397 - ntohs(outer_tag->vlan_proto), outer_tag->vlan_id); 2421 + slave_dbg(bond_dev, slave_dev, "outer tag: proto %X vid %X\n", 2422 + ntohs(outer_tag->vlan_proto), outer_tag->vlan_id); 2398 2423 __vlan_hwaccel_put_tag(skb, outer_tag->vlan_proto, 2399 2424 outer_tag->vlan_id); 2400 2425 } ··· 2451 2476 int i; 2452 2477 2453 2478 for (i = 0; i < BOND_MAX_ARP_TARGETS && targets[i]; i++) { 2454 - netdev_dbg(bond->dev, "basa: target %pI4\n", &targets[i]); 2479 + slave_dbg(bond->dev, slave->dev, "%s: target %pI4\n", 2480 + __func__, &targets[i]); 2455 2481 tags = NULL; 2456 2482 2457 2483 /* Find out through which dev should the packet go */ ··· 2466 2490 net_warn_ratelimited("%s: no route to arp_ip_target %pI4 and arp_validate is set\n", 2467 2491 bond->dev->name, 2468 2492 &targets[i]); 2469 - bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 2493 + bond_arp_send(slave, ARPOP_REQUEST, targets[i], 2470 2494 0, tags); 2471 2495 continue; 2472 2496 } ··· 2483 2507 goto found; 2484 2508 2485 2509 /* Not our device - skip */ 2486 - netdev_dbg(bond->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n", 2510 + slave_dbg(bond->dev, slave->dev, "no path to arp_ip_target %pI4 via rt.dev %s\n", 2487 2511 &targets[i], rt->dst.dev ? rt->dst.dev->name : "NULL"); 2488 2512 2489 2513 ip_rt_put(rt); ··· 2492 2516 found: 2493 2517 addr = bond_confirm_addr(rt->dst.dev, targets[i], 0); 2494 2518 ip_rt_put(rt); 2495 - bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 2496 - addr, tags); 2519 + bond_arp_send(slave, ARPOP_REQUEST, targets[i], addr, tags); 2497 2520 kfree(tags); 2498 2521 } 2499 2522 } ··· 2502 2527 int i; 2503 2528 2504 2529 if (!sip || !bond_has_this_ip(bond, tip)) { 2505 - netdev_dbg(bond->dev, "bva: sip %pI4 tip %pI4 not found\n", 2506 - &sip, &tip); 2530 + slave_dbg(bond->dev, slave->dev, "%s: sip %pI4 tip %pI4 not found\n", 2531 + __func__, &sip, &tip); 2507 2532 return; 2508 2533 } 2509 2534 2510 2535 i = bond_get_targets_ip(bond->params.arp_targets, sip); 2511 2536 if (i == -1) { 2512 - netdev_dbg(bond->dev, "bva: sip %pI4 not found in targets\n", 2513 - &sip); 2537 + slave_dbg(bond->dev, slave->dev, "%s: sip %pI4 not found in targets\n", 2538 + __func__, &sip); 2514 2539 return; 2515 2540 } 2516 2541 slave->last_rx = jiffies; ··· 2538 2563 2539 2564 alen = arp_hdr_len(bond->dev); 2540 2565 2541 - netdev_dbg(bond->dev, "bond_arp_rcv: skb->dev %s\n", 2542 - skb->dev->name); 2566 + slave_dbg(bond->dev, slave->dev, "%s: skb->dev %s\n", 2567 + __func__, skb->dev->name); 2543 2568 2544 2569 if (alen > skb_headlen(skb)) { 2545 2570 arp = kmalloc(alen, GFP_ATOMIC); ··· 2563 2588 arp_ptr += 4 + bond->dev->addr_len; 2564 2589 memcpy(&tip, arp_ptr, 4); 2565 2590 2566 - netdev_dbg(bond->dev, "bond_arp_rcv: %s/%d av %d sv %d sip %pI4 tip %pI4\n", 2567 - slave->dev->name, bond_slave_state(slave), 2568 - bond->params.arp_validate, slave_do_arp_validate(bond, slave), 2569 - &sip, &tip); 2591 + slave_dbg(bond->dev, slave->dev, "%s: %s/%d av %d sv %d sip %pI4 tip %pI4\n", 2592 + __func__, slave->dev->name, bond_slave_state(slave), 2593 + bond->params.arp_validate, slave_do_arp_validate(bond, slave), 2594 + &sip, &tip); 2570 2595 2571 2596 curr_active_slave = rcu_dereference(bond->curr_active_slave); 2572 2597 curr_arp_slave = rcu_dereference(bond->current_arp_slave); ··· 2669 2694 * is closed. 2670 2695 */ 2671 2696 if (!oldcurrent) { 2672 - netdev_info(bond->dev, "link status definitely up for interface %s\n", 2673 - slave->dev->name); 2697 + slave_info(bond->dev, slave->dev, "link status definitely up\n"); 2674 2698 do_failover = 1; 2675 2699 } else { 2676 - netdev_info(bond->dev, "interface %s is now up\n", 2677 - slave->dev->name); 2700 + slave_info(bond->dev, slave->dev, "interface is now up\n"); 2678 2701 } 2679 2702 } 2680 2703 } else { ··· 2691 2718 if (slave->link_failure_count < UINT_MAX) 2692 2719 slave->link_failure_count++; 2693 2720 2694 - netdev_info(bond->dev, "interface %s is now down\n", 2695 - slave->dev->name); 2721 + slave_info(bond->dev, slave->dev, "interface is now down\n"); 2696 2722 2697 2723 if (slave == oldcurrent) 2698 2724 do_failover = 1; ··· 2841 2869 RCU_INIT_POINTER(bond->current_arp_slave, NULL); 2842 2870 } 2843 2871 2844 - netdev_info(bond->dev, "link status definitely up for interface %s\n", 2845 - slave->dev->name); 2872 + slave_info(bond->dev, slave->dev, "link status definitely up\n"); 2846 2873 2847 2874 if (!rtnl_dereference(bond->curr_active_slave) || 2848 2875 slave == rtnl_dereference(bond->primary_slave)) ··· 2860 2889 bond_set_slave_inactive_flags(slave, 2861 2890 BOND_SLAVE_NOTIFY_NOW); 2862 2891 2863 - netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n", 2864 - slave->dev->name); 2892 + slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n"); 2865 2893 2866 2894 if (slave == rtnl_dereference(bond->curr_active_slave)) { 2867 2895 RCU_INIT_POINTER(bond->current_arp_slave, NULL); ··· 2870 2900 continue; 2871 2901 2872 2902 default: 2873 - netdev_err(bond->dev, "impossible: new_link %d on slave %s\n", 2874 - slave->new_link, slave->dev->name); 2903 + slave_err(bond->dev, slave->dev, "impossible: new_link %d on slave\n", 2904 + slave->new_link); 2875 2905 continue; 2876 2906 } 2877 2907 ··· 2942 2972 bond_set_slave_inactive_flags(slave, 2943 2973 BOND_SLAVE_NOTIFY_LATER); 2944 2974 2945 - netdev_info(bond->dev, "backup interface %s is now down\n", 2946 - slave->dev->name); 2975 + slave_info(bond->dev, slave->dev, "backup interface is now down\n"); 2947 2976 } 2948 2977 if (slave == curr_arp_slave) 2949 2978 found = true; ··· 3054 3085 { 3055 3086 struct bonding *event_bond = netdev_priv(bond_dev); 3056 3087 3088 + netdev_dbg(bond_dev, "%s called\n", __func__); 3089 + 3057 3090 switch (event) { 3058 3091 case NETDEV_CHANGENAME: 3059 3092 return bond_event_changename(event_bond); ··· 3087 3116 * before netdev_rx_handler_register is called in which case 3088 3117 * slave will be NULL 3089 3118 */ 3090 - if (!slave) 3119 + if (!slave) { 3120 + netdev_dbg(slave_dev, "%s called on NULL slave\n", __func__); 3091 3121 return NOTIFY_DONE; 3122 + } 3123 + 3092 3124 bond_dev = slave->bond->dev; 3093 3125 bond = slave->bond; 3094 3126 primary = rtnl_dereference(bond->primary_slave); 3127 + 3128 + slave_dbg(bond_dev, slave_dev, "%s called\n", __func__); 3095 3129 3096 3130 switch (event) { 3097 3131 case NETDEV_UNREGISTER: ··· 3208 3232 if (event_dev->flags & IFF_MASTER) { 3209 3233 int ret; 3210 3234 3211 - netdev_dbg(event_dev, "IFF_MASTER\n"); 3212 3235 ret = bond_master_netdev_event(event, event_dev); 3213 3236 if (ret != NOTIFY_DONE) 3214 3237 return ret; 3215 3238 } 3216 3239 3217 - if (event_dev->flags & IFF_SLAVE) { 3218 - netdev_dbg(event_dev, "IFF_SLAVE\n"); 3240 + if (event_dev->flags & IFF_SLAVE) 3219 3241 return bond_slave_netdev_event(event, event_dev); 3220 - } 3221 3242 3222 3243 return NOTIFY_DONE; 3223 3244 } ··· 3531 3558 3532 3559 slave_dev = __dev_get_by_name(net, ifr->ifr_slave); 3533 3560 3534 - netdev_dbg(bond_dev, "slave_dev=%p:\n", slave_dev); 3561 + slave_dbg(bond_dev, slave_dev, "slave_dev=%p:\n", slave_dev); 3535 3562 3536 3563 if (!slave_dev) 3537 3564 return -ENODEV; 3538 3565 3539 - netdev_dbg(bond_dev, "slave_dev->name=%s:\n", slave_dev->name); 3540 3566 switch (cmd) { 3541 3567 case BOND_ENSLAVE_OLD: 3542 3568 case SIOCBONDENSLAVE: ··· 3660 3688 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu); 3661 3689 3662 3690 bond_for_each_slave(bond, slave, iter) { 3663 - netdev_dbg(bond_dev, "s %p c_m %p\n", 3691 + slave_dbg(bond_dev, slave->dev, "s %p c_m %p\n", 3664 3692 slave, slave->dev->netdev_ops->ndo_change_mtu); 3665 3693 3666 3694 res = dev_set_mtu(slave->dev, new_mtu); ··· 3674 3702 * means changing their mtu from timer context, which 3675 3703 * is probably not a good idea. 3676 3704 */ 3677 - netdev_dbg(bond_dev, "err %d %s\n", res, 3678 - slave->dev->name); 3705 + slave_dbg(bond_dev, slave->dev, "err %d setting mtu to %d\n", 3706 + res, new_mtu); 3679 3707 goto unwind; 3680 3708 } 3681 3709 } ··· 3693 3721 break; 3694 3722 3695 3723 tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu); 3696 - if (tmp_res) { 3697 - netdev_dbg(bond_dev, "unwind err %d dev %s\n", 3698 - tmp_res, rollback_slave->dev->name); 3699 - } 3724 + if (tmp_res) 3725 + slave_dbg(bond_dev, rollback_slave->dev, "unwind err %d\n", 3726 + tmp_res); 3700 3727 } 3701 3728 3702 3729 return res; ··· 3719 3748 return bond_alb_set_mac_address(bond_dev, addr); 3720 3749 3721 3750 3722 - netdev_dbg(bond_dev, "bond=%p\n", bond); 3751 + netdev_dbg(bond_dev, "%s: bond=%p\n", __func__, bond); 3723 3752 3724 3753 /* If fail_over_mac is enabled, do nothing and return success. 3725 3754 * Returning an error causes ifenslave to fail. ··· 3732 3761 return -EADDRNOTAVAIL; 3733 3762 3734 3763 bond_for_each_slave(bond, slave, iter) { 3735 - netdev_dbg(bond_dev, "slave %p %s\n", slave, slave->dev->name); 3764 + slave_dbg(bond_dev, slave->dev, "%s: slave=%p\n", 3765 + __func__, slave); 3736 3766 res = dev_set_mac_address(slave->dev, addr, NULL); 3737 3767 if (res) { 3738 3768 /* TODO: consider downing the slave ··· 3742 3770 * breakage anyway until ARP finish 3743 3771 * updating, so... 3744 3772 */ 3745 - netdev_dbg(bond_dev, "err %d %s\n", res, slave->dev->name); 3773 + slave_dbg(bond_dev, slave->dev, "%s: err %d\n", 3774 + __func__, res); 3746 3775 goto unwind; 3747 3776 } 3748 3777 } ··· 3766 3793 tmp_res = dev_set_mac_address(rollback_slave->dev, 3767 3794 (struct sockaddr *)&tmp_ss, NULL); 3768 3795 if (tmp_res) { 3769 - netdev_dbg(bond_dev, "unwind err %d dev %s\n", 3770 - tmp_res, rollback_slave->dev->name); 3796 + slave_dbg(bond_dev, rollback_slave->dev, "%s: unwind err %d\n", 3797 + __func__, tmp_res); 3771 3798 } 3772 3799 } 3773 3800 ··· 3988 4015 if (skipslave == slave) 3989 4016 continue; 3990 4017 3991 - netdev_dbg(bond->dev, 3992 - "Adding slave dev %s to tx hash array[%d]\n", 3993 - slave->dev->name, new_arr->count); 4018 + slave_dbg(bond->dev, slave->dev, "Adding slave to tx hash array[%d]\n", 4019 + new_arr->count); 3994 4020 3995 4021 new_arr->arr[new_arr->count++] = slave; 3996 4022 }