diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 389 |
1 files changed, 158 insertions, 231 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index e5628fc725c3..e717db301d46 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -673,12 +673,12 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
673 | write_unlock_bh(&bond->curr_slave_lock); | 673 | write_unlock_bh(&bond->curr_slave_lock); |
674 | 674 | ||
675 | if (old_active) { | 675 | if (old_active) { |
676 | memcpy(tmp_mac, new_active->dev->dev_addr, ETH_ALEN); | 676 | ether_addr_copy(tmp_mac, new_active->dev->dev_addr); |
677 | memcpy(saddr.sa_data, old_active->dev->dev_addr, | 677 | ether_addr_copy(saddr.sa_data, |
678 | ETH_ALEN); | 678 | old_active->dev->dev_addr); |
679 | saddr.sa_family = new_active->dev->type; | 679 | saddr.sa_family = new_active->dev->type; |
680 | } else { | 680 | } else { |
681 | memcpy(saddr.sa_data, bond->dev->dev_addr, ETH_ALEN); | 681 | ether_addr_copy(saddr.sa_data, bond->dev->dev_addr); |
682 | saddr.sa_family = bond->dev->type; | 682 | saddr.sa_family = bond->dev->type; |
683 | } | 683 | } |
684 | 684 | ||
@@ -692,7 +692,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
692 | if (!old_active) | 692 | if (!old_active) |
693 | goto out; | 693 | goto out; |
694 | 694 | ||
695 | memcpy(saddr.sa_data, tmp_mac, ETH_ALEN); | 695 | ether_addr_copy(saddr.sa_data, tmp_mac); |
696 | saddr.sa_family = old_active->dev->type; | 696 | saddr.sa_family = old_active->dev->type; |
697 | 697 | ||
698 | rv = dev_set_mac_address(old_active->dev, &saddr); | 698 | rv = dev_set_mac_address(old_active->dev, &saddr); |
@@ -798,11 +798,11 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
798 | return; | 798 | return; |
799 | 799 | ||
800 | if (new_active) { | 800 | if (new_active) { |
801 | new_active->jiffies = jiffies; | 801 | new_active->last_link_up = jiffies; |
802 | 802 | ||
803 | if (new_active->link == BOND_LINK_BACK) { | 803 | if (new_active->link == BOND_LINK_BACK) { |
804 | if (USES_PRIMARY(bond->params.mode)) { | 804 | if (USES_PRIMARY(bond->params.mode)) { |
805 | pr_info("%s: making interface %s the new active one %d ms earlier.\n", | 805 | pr_info("%s: making interface %s the new active one %d ms earlier\n", |
806 | bond->dev->name, new_active->dev->name, | 806 | bond->dev->name, new_active->dev->name, |
807 | (bond->params.updelay - new_active->delay) * bond->params.miimon); | 807 | (bond->params.updelay - new_active->delay) * bond->params.miimon); |
808 | } | 808 | } |
@@ -817,7 +817,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
817 | bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); | 817 | bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); |
818 | } else { | 818 | } else { |
819 | if (USES_PRIMARY(bond->params.mode)) { | 819 | if (USES_PRIMARY(bond->params.mode)) { |
820 | pr_info("%s: making interface %s the new active one.\n", | 820 | pr_info("%s: making interface %s the new active one\n", |
821 | bond->dev->name, new_active->dev->name); | 821 | bond->dev->name, new_active->dev->name); |
822 | } | 822 | } |
823 | } | 823 | } |
@@ -910,7 +910,7 @@ void bond_select_active_slave(struct bonding *bond) | |||
910 | pr_info("%s: first active interface up!\n", | 910 | pr_info("%s: first active interface up!\n", |
911 | bond->dev->name); | 911 | bond->dev->name); |
912 | } else { | 912 | } else { |
913 | pr_info("%s: now running without any active interface !\n", | 913 | pr_info("%s: now running without any active interface!\n", |
914 | bond->dev->name); | 914 | bond->dev->name); |
915 | } | 915 | } |
916 | } | 916 | } |
@@ -946,14 +946,6 @@ static inline void slave_disable_netpoll(struct slave *slave) | |||
946 | slave->np = NULL; | 946 | slave->np = NULL; |
947 | __netpoll_free_async(np); | 947 | __netpoll_free_async(np); |
948 | } | 948 | } |
949 | static inline bool slave_dev_support_netpoll(struct net_device *slave_dev) | ||
950 | { | ||
951 | if (slave_dev->priv_flags & IFF_DISABLE_NETPOLL) | ||
952 | return false; | ||
953 | if (!slave_dev->netdev_ops->ndo_poll_controller) | ||
954 | return false; | ||
955 | return true; | ||
956 | } | ||
957 | 949 | ||
958 | static void bond_poll_controller(struct net_device *bond_dev) | 950 | static void bond_poll_controller(struct net_device *bond_dev) |
959 | { | 951 | { |
@@ -1119,9 +1111,6 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
1119 | slave = bond_slave_get_rcu(skb->dev); | 1111 | slave = bond_slave_get_rcu(skb->dev); |
1120 | bond = slave->bond; | 1112 | bond = slave->bond; |
1121 | 1113 | ||
1122 | if (bond->params.arp_interval) | ||
1123 | slave->dev->last_rx = jiffies; | ||
1124 | |||
1125 | recv_probe = ACCESS_ONCE(bond->recv_probe); | 1114 | recv_probe = ACCESS_ONCE(bond->recv_probe); |
1126 | if (recv_probe) { | 1115 | if (recv_probe) { |
1127 | ret = recv_probe(skb, bond, slave); | 1116 | ret = recv_probe(skb, bond, slave); |
@@ -1146,7 +1135,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
1146 | kfree_skb(skb); | 1135 | kfree_skb(skb); |
1147 | return RX_HANDLER_CONSUMED; | 1136 | return RX_HANDLER_CONSUMED; |
1148 | } | 1137 | } |
1149 | memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN); | 1138 | ether_addr_copy(eth_hdr(skb)->h_dest, bond->dev->dev_addr); |
1150 | } | 1139 | } |
1151 | 1140 | ||
1152 | return ret; | 1141 | return ret; |
@@ -1187,13 +1176,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1187 | if (!bond->params.use_carrier && | 1176 | if (!bond->params.use_carrier && |
1188 | slave_dev->ethtool_ops->get_link == NULL && | 1177 | slave_dev->ethtool_ops->get_link == NULL && |
1189 | slave_ops->ndo_do_ioctl == NULL) { | 1178 | slave_ops->ndo_do_ioctl == NULL) { |
1190 | pr_warning("%s: Warning: no link monitoring support for %s\n", | 1179 | pr_warn("%s: Warning: no link monitoring support for %s\n", |
1191 | bond_dev->name, slave_dev->name); | 1180 | bond_dev->name, slave_dev->name); |
1192 | } | 1181 | } |
1193 | 1182 | ||
1194 | /* already enslaved */ | 1183 | /* already enslaved */ |
1195 | if (slave_dev->flags & IFF_SLAVE) { | 1184 | if (slave_dev->flags & IFF_SLAVE) { |
1196 | pr_debug("Error, Device was already enslaved\n"); | 1185 | pr_debug("Error: Device was already enslaved\n"); |
1197 | return -EBUSY; | 1186 | return -EBUSY; |
1198 | } | 1187 | } |
1199 | 1188 | ||
@@ -1211,9 +1200,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1211 | bond_dev->name, slave_dev->name, bond_dev->name); | 1200 | bond_dev->name, slave_dev->name, bond_dev->name); |
1212 | return -EPERM; | 1201 | return -EPERM; |
1213 | } else { | 1202 | } else { |
1214 | pr_warning("%s: Warning: enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n", | 1203 | pr_warn("%s: Warning: enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n", |
1215 | bond_dev->name, slave_dev->name, | 1204 | bond_dev->name, slave_dev->name, |
1216 | slave_dev->name, bond_dev->name); | 1205 | slave_dev->name, bond_dev->name); |
1217 | } | 1206 | } |
1218 | } else { | 1207 | } else { |
1219 | pr_debug("%s: ! NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); | 1208 | pr_debug("%s: ! NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); |
@@ -1226,7 +1215,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1226 | * enslaving it; the old ifenslave will not. | 1215 | * enslaving it; the old ifenslave will not. |
1227 | */ | 1216 | */ |
1228 | if ((slave_dev->flags & IFF_UP)) { | 1217 | if ((slave_dev->flags & IFF_UP)) { |
1229 | pr_err("%s is up. This may be due to an out of date ifenslave.\n", | 1218 | pr_err("%s is up - this may be due to an out of date ifenslave\n", |
1230 | slave_dev->name); | 1219 | slave_dev->name); |
1231 | res = -EPERM; | 1220 | res = -EPERM; |
1232 | goto err_undo_flags; | 1221 | goto err_undo_flags; |
@@ -1270,24 +1259,23 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1270 | bond_dev); | 1259 | bond_dev); |
1271 | } | 1260 | } |
1272 | } else if (bond_dev->type != slave_dev->type) { | 1261 | } else if (bond_dev->type != slave_dev->type) { |
1273 | pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n", | 1262 | pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it\n", |
1274 | slave_dev->name, | 1263 | slave_dev->name, slave_dev->type, bond_dev->type); |
1275 | slave_dev->type, bond_dev->type); | ||
1276 | res = -EINVAL; | 1264 | res = -EINVAL; |
1277 | goto err_undo_flags; | 1265 | goto err_undo_flags; |
1278 | } | 1266 | } |
1279 | 1267 | ||
1280 | if (slave_ops->ndo_set_mac_address == NULL) { | 1268 | if (slave_ops->ndo_set_mac_address == NULL) { |
1281 | if (!bond_has_slaves(bond)) { | 1269 | if (!bond_has_slaves(bond)) { |
1282 | pr_warn("%s: Warning: The first slave device specified does not support setting the MAC address.\n", | 1270 | pr_warn("%s: Warning: The first slave device specified does not support setting the MAC address\n", |
1283 | bond_dev->name); | 1271 | bond_dev->name); |
1284 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { | 1272 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { |
1285 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; | 1273 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; |
1286 | pr_warn("%s: Setting fail_over_mac to active for active-backup mode.\n", | 1274 | pr_warn("%s: Setting fail_over_mac to active for active-backup mode\n", |
1287 | bond_dev->name); | 1275 | bond_dev->name); |
1288 | } | 1276 | } |
1289 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { | 1277 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { |
1290 | 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", | 1278 | 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", |
1291 | bond_dev->name); | 1279 | bond_dev->name); |
1292 | res = -EOPNOTSUPP; | 1280 | res = -EOPNOTSUPP; |
1293 | goto err_undo_flags; | 1281 | goto err_undo_flags; |
@@ -1326,7 +1314,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1326 | * that need it, and for restoring it upon release, and then | 1314 | * that need it, and for restoring it upon release, and then |
1327 | * set it to the master's address | 1315 | * set it to the master's address |
1328 | */ | 1316 | */ |
1329 | memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); | 1317 | ether_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr); |
1330 | 1318 | ||
1331 | if (!bond->params.fail_over_mac || | 1319 | if (!bond->params.fail_over_mac || |
1332 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { | 1320 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { |
@@ -1410,10 +1398,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1410 | 1398 | ||
1411 | bond_update_speed_duplex(new_slave); | 1399 | bond_update_speed_duplex(new_slave); |
1412 | 1400 | ||
1413 | new_slave->last_arp_rx = jiffies - | 1401 | new_slave->last_rx = jiffies - |
1414 | (msecs_to_jiffies(bond->params.arp_interval) + 1); | 1402 | (msecs_to_jiffies(bond->params.arp_interval) + 1); |
1415 | for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) | 1403 | for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) |
1416 | new_slave->target_last_arp_rx[i] = new_slave->last_arp_rx; | 1404 | new_slave->target_last_arp_rx[i] = new_slave->last_rx; |
1417 | 1405 | ||
1418 | if (bond->params.miimon && !bond->params.use_carrier) { | 1406 | if (bond->params.miimon && !bond->params.use_carrier) { |
1419 | link_reporting = bond_check_dev_link(bond, slave_dev, 1); | 1407 | link_reporting = bond_check_dev_link(bond, slave_dev, 1); |
@@ -1428,12 +1416,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1428 | * supported); thus, we don't need to change | 1416 | * supported); thus, we don't need to change |
1429 | * the messages for netif_carrier. | 1417 | * the messages for netif_carrier. |
1430 | */ | 1418 | */ |
1431 | 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", | 1419 | pr_warn("%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", |
1432 | bond_dev->name, slave_dev->name); | 1420 | bond_dev->name, slave_dev->name); |
1433 | } else if (link_reporting == -1) { | 1421 | } else if (link_reporting == -1) { |
1434 | /* unable get link status using mii/ethtool */ | 1422 | /* unable get link status using mii/ethtool */ |
1435 | 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", | 1423 | pr_warn("%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", |
1436 | bond_dev->name, slave_dev->name); | 1424 | bond_dev->name, slave_dev->name); |
1437 | } | 1425 | } |
1438 | } | 1426 | } |
1439 | 1427 | ||
@@ -1457,10 +1445,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1457 | } | 1445 | } |
1458 | 1446 | ||
1459 | if (new_slave->link != BOND_LINK_DOWN) | 1447 | if (new_slave->link != BOND_LINK_DOWN) |
1460 | new_slave->jiffies = jiffies; | 1448 | new_slave->last_link_up = jiffies; |
1461 | pr_debug("Initial state of slave_dev is BOND_LINK_%s\n", | 1449 | pr_debug("Initial state of slave_dev is BOND_LINK_%s\n", |
1462 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : | 1450 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : |
1463 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); | 1451 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); |
1464 | 1452 | ||
1465 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1453 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
1466 | /* if there is a primary slave, remember it */ | 1454 | /* if there is a primary slave, remember it */ |
@@ -1520,9 +1508,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1520 | slave_dev->npinfo = bond->dev->npinfo; | 1508 | slave_dev->npinfo = bond->dev->npinfo; |
1521 | if (slave_dev->npinfo) { | 1509 | if (slave_dev->npinfo) { |
1522 | if (slave_enable_netpoll(new_slave)) { | 1510 | if (slave_enable_netpoll(new_slave)) { |
1523 | pr_info("Error, %s: master_dev is using netpoll, " | 1511 | pr_info("Error, %s: master_dev is using netpoll, but new slave device does not support netpoll\n", |
1524 | "but new slave device does not support netpoll.\n", | 1512 | bond_dev->name); |
1525 | bond_dev->name); | ||
1526 | res = -EBUSY; | 1513 | res = -EBUSY; |
1527 | goto err_detach; | 1514 | goto err_detach; |
1528 | } | 1515 | } |
@@ -1560,10 +1547,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1560 | unblock_netpoll_tx(); | 1547 | unblock_netpoll_tx(); |
1561 | } | 1548 | } |
1562 | 1549 | ||
1563 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", | 1550 | pr_info("%s: Enslaving %s as %s interface with %s link\n", |
1564 | bond_dev->name, slave_dev->name, | 1551 | bond_dev->name, slave_dev->name, |
1565 | bond_is_active_slave(new_slave) ? "n active" : " backup", | 1552 | bond_is_active_slave(new_slave) ? "an active" : "a backup", |
1566 | new_slave->link != BOND_LINK_DOWN ? "n up" : " down"); | 1553 | new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); |
1567 | 1554 | ||
1568 | /* enslave is successful */ | 1555 | /* enslave is successful */ |
1569 | return 0; | 1556 | return 0; |
@@ -1603,7 +1590,7 @@ err_restore_mac: | |||
1603 | * MAC if this slave's MAC is in use by the bond, or at | 1590 | * MAC if this slave's MAC is in use by the bond, or at |
1604 | * least print a warning. | 1591 | * least print a warning. |
1605 | */ | 1592 | */ |
1606 | memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); | 1593 | ether_addr_copy(addr.sa_data, new_slave->perm_hwaddr); |
1607 | addr.sa_family = slave_dev->type; | 1594 | addr.sa_family = slave_dev->type; |
1608 | dev_set_mac_address(slave_dev, &addr); | 1595 | dev_set_mac_address(slave_dev, &addr); |
1609 | } | 1596 | } |
@@ -1648,7 +1635,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1648 | /* slave is not a slave or master is not master of this slave */ | 1635 | /* slave is not a slave or master is not master of this slave */ |
1649 | if (!(slave_dev->flags & IFF_SLAVE) || | 1636 | if (!(slave_dev->flags & IFF_SLAVE) || |
1650 | !netdev_has_upper_dev(slave_dev, bond_dev)) { | 1637 | !netdev_has_upper_dev(slave_dev, bond_dev)) { |
1651 | pr_err("%s: Error: cannot release %s.\n", | 1638 | pr_err("%s: Error: cannot release %s\n", |
1652 | bond_dev->name, slave_dev->name); | 1639 | bond_dev->name, slave_dev->name); |
1653 | return -EINVAL; | 1640 | return -EINVAL; |
1654 | } | 1641 | } |
@@ -1679,7 +1666,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1679 | 1666 | ||
1680 | write_unlock_bh(&bond->lock); | 1667 | write_unlock_bh(&bond->lock); |
1681 | 1668 | ||
1682 | pr_info("%s: releasing %s interface %s\n", | 1669 | pr_info("%s: Releasing %s interface %s\n", |
1683 | bond_dev->name, | 1670 | bond_dev->name, |
1684 | bond_is_active_slave(slave) ? "active" : "backup", | 1671 | bond_is_active_slave(slave) ? "active" : "backup", |
1685 | slave_dev->name); | 1672 | slave_dev->name); |
@@ -1692,10 +1679,10 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1692 | bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | 1679 | bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { |
1693 | if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && | 1680 | if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && |
1694 | bond_has_slaves(bond)) | 1681 | bond_has_slaves(bond)) |
1695 | pr_warn("%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", | 1682 | pr_warn("%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", |
1696 | bond_dev->name, slave_dev->name, | 1683 | bond_dev->name, slave_dev->name, |
1697 | slave->perm_hwaddr, | 1684 | slave->perm_hwaddr, |
1698 | bond_dev->name, slave_dev->name); | 1685 | bond_dev->name, slave_dev->name); |
1699 | } | 1686 | } |
1700 | 1687 | ||
1701 | if (bond->primary_slave == slave) | 1688 | if (bond->primary_slave == slave) |
@@ -1736,10 +1723,10 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1736 | eth_hw_addr_random(bond_dev); | 1723 | eth_hw_addr_random(bond_dev); |
1737 | 1724 | ||
1738 | if (vlan_uses_dev(bond_dev)) { | 1725 | if (vlan_uses_dev(bond_dev)) { |
1739 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", | 1726 | pr_warn("%s: Warning: clearing HW address of %s while it still has VLANs\n", |
1740 | bond_dev->name, bond_dev->name); | 1727 | bond_dev->name, bond_dev->name); |
1741 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", | 1728 | pr_warn("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs\n", |
1742 | bond_dev->name); | 1729 | bond_dev->name); |
1743 | } | 1730 | } |
1744 | } | 1731 | } |
1745 | 1732 | ||
@@ -1755,7 +1742,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1755 | bond_compute_features(bond); | 1742 | bond_compute_features(bond); |
1756 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && | 1743 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && |
1757 | (old_features & NETIF_F_VLAN_CHALLENGED)) | 1744 | (old_features & NETIF_F_VLAN_CHALLENGED)) |
1758 | pr_info("%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n", | 1745 | pr_info("%s: last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", |
1759 | bond_dev->name, slave_dev->name, bond_dev->name); | 1746 | bond_dev->name, slave_dev->name, bond_dev->name); |
1760 | 1747 | ||
1761 | /* must do this from outside any spinlocks */ | 1748 | /* must do this from outside any spinlocks */ |
@@ -1790,7 +1777,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1790 | if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || | 1777 | if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || |
1791 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { | 1778 | bond->params.mode != BOND_MODE_ACTIVEBACKUP) { |
1792 | /* restore original ("permanent") mac address */ | 1779 | /* restore original ("permanent") mac address */ |
1793 | memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); | 1780 | ether_addr_copy(addr.sa_data, slave->perm_hwaddr); |
1794 | addr.sa_family = slave_dev->type; | 1781 | addr.sa_family = slave_dev->type; |
1795 | dev_set_mac_address(slave_dev, &addr); | 1782 | dev_set_mac_address(slave_dev, &addr); |
1796 | } | 1783 | } |
@@ -1823,7 +1810,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, | |||
1823 | ret = bond_release(bond_dev, slave_dev); | 1810 | ret = bond_release(bond_dev, slave_dev); |
1824 | if (ret == 0 && !bond_has_slaves(bond)) { | 1811 | if (ret == 0 && !bond_has_slaves(bond)) { |
1825 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; | 1812 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; |
1826 | pr_info("%s: destroying bond %s.\n", | 1813 | pr_info("%s: Destroying bond %s\n", |
1827 | bond_dev->name, bond_dev->name); | 1814 | bond_dev->name, bond_dev->name); |
1828 | unregister_netdevice(bond_dev); | 1815 | unregister_netdevice(bond_dev); |
1829 | } | 1816 | } |
@@ -1837,9 +1824,7 @@ static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) | |||
1837 | info->bond_mode = bond->params.mode; | 1824 | info->bond_mode = bond->params.mode; |
1838 | info->miimon = bond->params.miimon; | 1825 | info->miimon = bond->params.miimon; |
1839 | 1826 | ||
1840 | read_lock(&bond->lock); | ||
1841 | info->num_slaves = bond->slave_cnt; | 1827 | info->num_slaves = bond->slave_cnt; |
1842 | read_unlock(&bond->lock); | ||
1843 | 1828 | ||
1844 | return 0; | 1829 | return 0; |
1845 | } | 1830 | } |
@@ -1851,7 +1836,6 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in | |||
1851 | int i = 0, res = -ENODEV; | 1836 | int i = 0, res = -ENODEV; |
1852 | struct slave *slave; | 1837 | struct slave *slave; |
1853 | 1838 | ||
1854 | read_lock(&bond->lock); | ||
1855 | bond_for_each_slave(bond, slave, iter) { | 1839 | bond_for_each_slave(bond, slave, iter) { |
1856 | if (i++ == (int)info->slave_id) { | 1840 | if (i++ == (int)info->slave_id) { |
1857 | res = 0; | 1841 | res = 0; |
@@ -1862,7 +1846,6 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in | |||
1862 | break; | 1846 | break; |
1863 | } | 1847 | } |
1864 | } | 1848 | } |
1865 | read_unlock(&bond->lock); | ||
1866 | 1849 | ||
1867 | return res; | 1850 | return res; |
1868 | } | 1851 | } |
@@ -1892,7 +1875,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
1892 | slave->link = BOND_LINK_FAIL; | 1875 | slave->link = BOND_LINK_FAIL; |
1893 | slave->delay = bond->params.downdelay; | 1876 | slave->delay = bond->params.downdelay; |
1894 | if (slave->delay) { | 1877 | if (slave->delay) { |
1895 | pr_info("%s: link status down for %sinterface %s, disabling it in %d ms.\n", | 1878 | pr_info("%s: link status down for %sinterface %s, disabling it in %d ms\n", |
1896 | bond->dev->name, | 1879 | bond->dev->name, |
1897 | (bond->params.mode == | 1880 | (bond->params.mode == |
1898 | BOND_MODE_ACTIVEBACKUP) ? | 1881 | BOND_MODE_ACTIVEBACKUP) ? |
@@ -1908,8 +1891,8 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
1908 | * recovered before downdelay expired | 1891 | * recovered before downdelay expired |
1909 | */ | 1892 | */ |
1910 | slave->link = BOND_LINK_UP; | 1893 | slave->link = BOND_LINK_UP; |
1911 | slave->jiffies = jiffies; | 1894 | slave->last_link_up = jiffies; |
1912 | pr_info("%s: link status up again after %d ms for interface %s.\n", | 1895 | pr_info("%s: link status up again after %d ms for interface %s\n", |
1913 | bond->dev->name, | 1896 | bond->dev->name, |
1914 | (bond->params.downdelay - slave->delay) * | 1897 | (bond->params.downdelay - slave->delay) * |
1915 | bond->params.miimon, | 1898 | bond->params.miimon, |
@@ -1934,7 +1917,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
1934 | slave->delay = bond->params.updelay; | 1917 | slave->delay = bond->params.updelay; |
1935 | 1918 | ||
1936 | if (slave->delay) { | 1919 | if (slave->delay) { |
1937 | pr_info("%s: link status up for interface %s, enabling it in %d ms.\n", | 1920 | pr_info("%s: link status up for interface %s, enabling it in %d ms\n", |
1938 | bond->dev->name, slave->dev->name, | 1921 | bond->dev->name, slave->dev->name, |
1939 | ignore_updelay ? 0 : | 1922 | ignore_updelay ? 0 : |
1940 | bond->params.updelay * | 1923 | bond->params.updelay * |
@@ -1944,7 +1927,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
1944 | case BOND_LINK_BACK: | 1927 | case BOND_LINK_BACK: |
1945 | if (!link_state) { | 1928 | if (!link_state) { |
1946 | slave->link = BOND_LINK_DOWN; | 1929 | slave->link = BOND_LINK_DOWN; |
1947 | pr_info("%s: link status down again after %d ms for interface %s.\n", | 1930 | pr_info("%s: link status down again after %d ms for interface %s\n", |
1948 | bond->dev->name, | 1931 | bond->dev->name, |
1949 | (bond->params.updelay - slave->delay) * | 1932 | (bond->params.updelay - slave->delay) * |
1950 | bond->params.miimon, | 1933 | bond->params.miimon, |
@@ -1983,7 +1966,7 @@ static void bond_miimon_commit(struct bonding *bond) | |||
1983 | 1966 | ||
1984 | case BOND_LINK_UP: | 1967 | case BOND_LINK_UP: |
1985 | slave->link = BOND_LINK_UP; | 1968 | slave->link = BOND_LINK_UP; |
1986 | slave->jiffies = jiffies; | 1969 | slave->last_link_up = jiffies; |
1987 | 1970 | ||
1988 | if (bond->params.mode == BOND_MODE_8023AD) { | 1971 | if (bond->params.mode == BOND_MODE_8023AD) { |
1989 | /* prevent it from being the active one */ | 1972 | /* prevent it from being the active one */ |
@@ -1996,7 +1979,7 @@ static void bond_miimon_commit(struct bonding *bond) | |||
1996 | bond_set_backup_slave(slave); | 1979 | bond_set_backup_slave(slave); |
1997 | } | 1980 | } |
1998 | 1981 | ||
1999 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", | 1982 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex\n", |
2000 | bond->dev->name, slave->dev->name, | 1983 | bond->dev->name, slave->dev->name, |
2001 | slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, | 1984 | slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, |
2002 | slave->duplex ? "full" : "half"); | 1985 | slave->duplex ? "full" : "half"); |
@@ -2145,8 +2128,8 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ | |||
2145 | { | 2128 | { |
2146 | struct sk_buff *skb; | 2129 | struct sk_buff *skb; |
2147 | 2130 | ||
2148 | pr_debug("arp %d on slave %s: dst %pI4 src %pI4 vid %d\n", arp_op, | 2131 | pr_debug("arp %d on slave %s: dst %pI4 src %pI4 vid %d\n", |
2149 | slave_dev->name, &dest_ip, &src_ip, vlan_id); | 2132 | arp_op, slave_dev->name, &dest_ip, &src_ip, vlan_id); |
2150 | 2133 | ||
2151 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, | 2134 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, |
2152 | NULL, slave_dev->dev_addr, NULL); | 2135 | NULL, slave_dev->dev_addr, NULL); |
@@ -2181,8 +2164,13 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2181 | rt = ip_route_output(dev_net(bond->dev), targets[i], 0, | 2164 | rt = ip_route_output(dev_net(bond->dev), targets[i], 0, |
2182 | RTO_ONLINK, 0); | 2165 | RTO_ONLINK, 0); |
2183 | if (IS_ERR(rt)) { | 2166 | if (IS_ERR(rt)) { |
2184 | pr_debug("%s: no route to arp_ip_target %pI4\n", | 2167 | /* there's no route to target - try to send arp |
2185 | bond->dev->name, &targets[i]); | 2168 | * probe to generate any traffic (arp_validate=0) |
2169 | */ | ||
2170 | if (bond->params.arp_validate && net_ratelimit()) | ||
2171 | pr_warn("%s: no route to arp_ip_target %pI4 and arp_validate is set\n", | ||
2172 | bond->dev->name, &targets[i]); | ||
2173 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 0, 0); | ||
2186 | continue; | 2174 | continue; |
2187 | } | 2175 | } |
2188 | 2176 | ||
@@ -2260,7 +2248,7 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 | |||
2260 | pr_debug("bva: sip %pI4 not found in targets\n", &sip); | 2248 | pr_debug("bva: sip %pI4 not found in targets\n", &sip); |
2261 | return; | 2249 | return; |
2262 | } | 2250 | } |
2263 | slave->last_arp_rx = jiffies; | 2251 | slave->last_rx = jiffies; |
2264 | slave->target_last_arp_rx[i] = jiffies; | 2252 | slave->target_last_arp_rx[i] = jiffies; |
2265 | } | 2253 | } |
2266 | 2254 | ||
@@ -2268,17 +2256,19 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, | |||
2268 | struct slave *slave) | 2256 | struct slave *slave) |
2269 | { | 2257 | { |
2270 | struct arphdr *arp = (struct arphdr *)skb->data; | 2258 | struct arphdr *arp = (struct arphdr *)skb->data; |
2259 | struct slave *curr_active_slave; | ||
2271 | unsigned char *arp_ptr; | 2260 | unsigned char *arp_ptr; |
2272 | __be32 sip, tip; | 2261 | __be32 sip, tip; |
2273 | int alen; | 2262 | int alen, is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP); |
2274 | 2263 | ||
2275 | if (skb->protocol != __cpu_to_be16(ETH_P_ARP)) | 2264 | if (!slave_do_arp_validate(bond, slave)) { |
2265 | if ((slave_do_arp_validate_only(bond, slave) && is_arp) || | ||
2266 | !slave_do_arp_validate_only(bond, slave)) | ||
2267 | slave->last_rx = jiffies; | ||
2276 | return RX_HANDLER_ANOTHER; | 2268 | return RX_HANDLER_ANOTHER; |
2277 | 2269 | } else if (!is_arp) { | |
2278 | read_lock(&bond->lock); | 2270 | return RX_HANDLER_ANOTHER; |
2279 | 2271 | } | |
2280 | if (!slave_do_arp_validate(bond, slave)) | ||
2281 | goto out_unlock; | ||
2282 | 2272 | ||
2283 | alen = arp_hdr_len(bond->dev); | 2273 | alen = arp_hdr_len(bond->dev); |
2284 | 2274 | ||
@@ -2312,6 +2302,8 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, | |||
2312 | bond->params.arp_validate, slave_do_arp_validate(bond, slave), | 2302 | bond->params.arp_validate, slave_do_arp_validate(bond, slave), |
2313 | &sip, &tip); | 2303 | &sip, &tip); |
2314 | 2304 | ||
2305 | curr_active_slave = rcu_dereference(bond->curr_active_slave); | ||
2306 | |||
2315 | /* | 2307 | /* |
2316 | * Backup slaves won't see the ARP reply, but do come through | 2308 | * Backup slaves won't see the ARP reply, but do come through |
2317 | * here for each ARP probe (so we swap the sip/tip to validate | 2309 | * here for each ARP probe (so we swap the sip/tip to validate |
@@ -2325,15 +2317,15 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, | |||
2325 | * is done to avoid endless looping when we can't reach the | 2317 | * is done to avoid endless looping when we can't reach the |
2326 | * arp_ip_target and fool ourselves with our own arp requests. | 2318 | * arp_ip_target and fool ourselves with our own arp requests. |
2327 | */ | 2319 | */ |
2320 | |||
2328 | if (bond_is_active_slave(slave)) | 2321 | if (bond_is_active_slave(slave)) |
2329 | bond_validate_arp(bond, slave, sip, tip); | 2322 | bond_validate_arp(bond, slave, sip, tip); |
2330 | else if (bond->curr_active_slave && | 2323 | else if (curr_active_slave && |
2331 | time_after(slave_last_rx(bond, bond->curr_active_slave), | 2324 | time_after(slave_last_rx(bond, curr_active_slave), |
2332 | bond->curr_active_slave->jiffies)) | 2325 | curr_active_slave->last_link_up)) |
2333 | bond_validate_arp(bond, slave, tip, sip); | 2326 | bond_validate_arp(bond, slave, tip, sip); |
2334 | 2327 | ||
2335 | out_unlock: | 2328 | out_unlock: |
2336 | read_unlock(&bond->lock); | ||
2337 | if (arp != (struct arphdr *)skb->data) | 2329 | if (arp != (struct arphdr *)skb->data) |
2338 | kfree(arp); | 2330 | kfree(arp); |
2339 | return RX_HANDLER_ANOTHER; | 2331 | return RX_HANDLER_ANOTHER; |
@@ -2376,9 +2368,9 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2376 | oldcurrent = ACCESS_ONCE(bond->curr_active_slave); | 2368 | oldcurrent = ACCESS_ONCE(bond->curr_active_slave); |
2377 | /* see if any of the previous devices are up now (i.e. they have | 2369 | /* see if any of the previous devices are up now (i.e. they have |
2378 | * xmt and rcv traffic). the curr_active_slave does not come into | 2370 | * xmt and rcv traffic). the curr_active_slave does not come into |
2379 | * the picture unless it is null. also, slave->jiffies is not needed | 2371 | * the picture unless it is null. also, slave->last_link_up is not |
2380 | * here because we send an arp on each slave and give a slave as | 2372 | * needed here because we send an arp on each slave and give a slave |
2381 | * long as it needs to get the tx/rx within the delta. | 2373 | * as long as it needs to get the tx/rx within the delta. |
2382 | * TODO: what about up/down delay in arp mode? it wasn't here before | 2374 | * TODO: what about up/down delay in arp mode? it wasn't here before |
2383 | * so it can wait | 2375 | * so it can wait |
2384 | */ | 2376 | */ |
@@ -2387,7 +2379,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2387 | 2379 | ||
2388 | if (slave->link != BOND_LINK_UP) { | 2380 | if (slave->link != BOND_LINK_UP) { |
2389 | if (bond_time_in_interval(bond, trans_start, 1) && | 2381 | if (bond_time_in_interval(bond, trans_start, 1) && |
2390 | bond_time_in_interval(bond, slave->dev->last_rx, 1)) { | 2382 | bond_time_in_interval(bond, slave->last_rx, 1)) { |
2391 | 2383 | ||
2392 | slave->link = BOND_LINK_UP; | 2384 | slave->link = BOND_LINK_UP; |
2393 | slave_state_changed = 1; | 2385 | slave_state_changed = 1; |
@@ -2398,7 +2390,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2398 | * is closed. | 2390 | * is closed. |
2399 | */ | 2391 | */ |
2400 | if (!oldcurrent) { | 2392 | if (!oldcurrent) { |
2401 | pr_info("%s: link status definitely up for interface %s, ", | 2393 | pr_info("%s: link status definitely up for interface %s\n", |
2402 | bond->dev->name, | 2394 | bond->dev->name, |
2403 | slave->dev->name); | 2395 | slave->dev->name); |
2404 | do_failover = 1; | 2396 | do_failover = 1; |
@@ -2416,7 +2408,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2416 | * if we don't know our ip yet | 2408 | * if we don't know our ip yet |
2417 | */ | 2409 | */ |
2418 | if (!bond_time_in_interval(bond, trans_start, 2) || | 2410 | if (!bond_time_in_interval(bond, trans_start, 2) || |
2419 | !bond_time_in_interval(bond, slave->dev->last_rx, 2)) { | 2411 | !bond_time_in_interval(bond, slave->last_rx, 2)) { |
2420 | 2412 | ||
2421 | slave->link = BOND_LINK_DOWN; | 2413 | slave->link = BOND_LINK_DOWN; |
2422 | slave_state_changed = 1; | 2414 | slave_state_changed = 1; |
@@ -2424,9 +2416,8 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2424 | if (slave->link_failure_count < UINT_MAX) | 2416 | if (slave->link_failure_count < UINT_MAX) |
2425 | slave->link_failure_count++; | 2417 | slave->link_failure_count++; |
2426 | 2418 | ||
2427 | pr_info("%s: interface %s is now down.\n", | 2419 | pr_info("%s: interface %s is now down\n", |
2428 | bond->dev->name, | 2420 | bond->dev->name, slave->dev->name); |
2429 | slave->dev->name); | ||
2430 | 2421 | ||
2431 | if (slave == oldcurrent) | 2422 | if (slave == oldcurrent) |
2432 | do_failover = 1; | 2423 | do_failover = 1; |
@@ -2505,7 +2496,7 @@ static int bond_ab_arp_inspect(struct bonding *bond) | |||
2505 | * active. This avoids bouncing, as the last receive | 2496 | * active. This avoids bouncing, as the last receive |
2506 | * times need a full ARP monitor cycle to be updated. | 2497 | * times need a full ARP monitor cycle to be updated. |
2507 | */ | 2498 | */ |
2508 | if (bond_time_in_interval(bond, slave->jiffies, 2)) | 2499 | if (bond_time_in_interval(bond, slave->last_link_up, 2)) |
2509 | continue; | 2500 | continue; |
2510 | 2501 | ||
2511 | /* | 2502 | /* |
@@ -2576,7 +2567,7 @@ static void bond_ab_arp_commit(struct bonding *bond) | |||
2576 | bond->current_arp_slave = NULL; | 2567 | bond->current_arp_slave = NULL; |
2577 | } | 2568 | } |
2578 | 2569 | ||
2579 | pr_info("%s: link status definitely up for interface %s.\n", | 2570 | pr_info("%s: link status definitely up for interface %s\n", |
2580 | bond->dev->name, slave->dev->name); | 2571 | bond->dev->name, slave->dev->name); |
2581 | 2572 | ||
2582 | if (!bond->curr_active_slave || | 2573 | if (!bond->curr_active_slave || |
@@ -2682,7 +2673,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2682 | bond_set_slave_inactive_flags(slave, | 2673 | bond_set_slave_inactive_flags(slave, |
2683 | BOND_SLAVE_NOTIFY_LATER); | 2674 | BOND_SLAVE_NOTIFY_LATER); |
2684 | 2675 | ||
2685 | pr_info("%s: backup interface %s is now down.\n", | 2676 | pr_info("%s: backup interface %s is now down\n", |
2686 | bond->dev->name, slave->dev->name); | 2677 | bond->dev->name, slave->dev->name); |
2687 | } | 2678 | } |
2688 | if (slave == curr_arp_slave) | 2679 | if (slave == curr_arp_slave) |
@@ -2698,7 +2689,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2698 | new_slave->link = BOND_LINK_BACK; | 2689 | new_slave->link = BOND_LINK_BACK; |
2699 | bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER); | 2690 | bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER); |
2700 | bond_arp_send_all(bond, new_slave); | 2691 | bond_arp_send_all(bond, new_slave); |
2701 | new_slave->jiffies = jiffies; | 2692 | new_slave->last_link_up = jiffies; |
2702 | rcu_assign_pointer(bond->current_arp_slave, new_slave); | 2693 | rcu_assign_pointer(bond->current_arp_slave, new_slave); |
2703 | 2694 | ||
2704 | check_state: | 2695 | check_state: |
@@ -2879,9 +2870,9 @@ static int bond_slave_netdev_event(unsigned long event, | |||
2879 | break; | 2870 | break; |
2880 | } | 2871 | } |
2881 | 2872 | ||
2882 | pr_info("%s: Primary slave changed to %s, reselecting active slave.\n", | 2873 | pr_info("%s: Primary slave changed to %s, reselecting active slave\n", |
2883 | bond->dev->name, bond->primary_slave ? slave_dev->name : | 2874 | bond->dev->name, |
2884 | "none"); | 2875 | bond->primary_slave ? slave_dev->name : "none"); |
2885 | 2876 | ||
2886 | block_netpoll_tx(); | 2877 | block_netpoll_tx(); |
2887 | write_lock_bh(&bond->curr_slave_lock); | 2878 | write_lock_bh(&bond->curr_slave_lock); |
@@ -2917,8 +2908,7 @@ static int bond_netdev_event(struct notifier_block *this, | |||
2917 | struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); | 2908 | struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); |
2918 | 2909 | ||
2919 | pr_debug("event_dev: %s, event: %lx\n", | 2910 | pr_debug("event_dev: %s, event: %lx\n", |
2920 | event_dev ? event_dev->name : "None", | 2911 | event_dev ? event_dev->name : "None", event); |
2921 | event); | ||
2922 | 2912 | ||
2923 | if (!(event_dev->priv_flags & IFF_BONDING)) | 2913 | if (!(event_dev->priv_flags & IFF_BONDING)) |
2924 | return NOTIFY_DONE; | 2914 | return NOTIFY_DONE; |
@@ -3087,8 +3077,7 @@ static int bond_open(struct net_device *bond_dev) | |||
3087 | 3077 | ||
3088 | if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ | 3078 | if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ |
3089 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | 3079 | queue_delayed_work(bond->wq, &bond->arp_work, 0); |
3090 | if (bond->params.arp_validate) | 3080 | bond->recv_probe = bond_arp_rcv; |
3091 | bond->recv_probe = bond_arp_rcv; | ||
3092 | } | 3081 | } |
3093 | 3082 | ||
3094 | if (bond->params.mode == BOND_MODE_8023AD) { | 3083 | if (bond->params.mode == BOND_MODE_8023AD) { |
@@ -3375,8 +3364,8 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | |||
3375 | struct list_head *iter; | 3364 | struct list_head *iter; |
3376 | int res = 0; | 3365 | int res = 0; |
3377 | 3366 | ||
3378 | pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond, | 3367 | pr_debug("bond=%p, name=%s, new_mtu=%d\n", |
3379 | (bond_dev ? bond_dev->name : "None"), new_mtu); | 3368 | bond, bond_dev ? bond_dev->name : "None", new_mtu); |
3380 | 3369 | ||
3381 | /* Can't hold bond->lock with bh disabled here since | 3370 | /* Can't hold bond->lock with bh disabled here since |
3382 | * some base drivers panic. On the other hand we can't | 3371 | * some base drivers panic. On the other hand we can't |
@@ -3395,8 +3384,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | |||
3395 | 3384 | ||
3396 | bond_for_each_slave(bond, slave, iter) { | 3385 | bond_for_each_slave(bond, slave, iter) { |
3397 | pr_debug("s %p c_m %p\n", | 3386 | pr_debug("s %p c_m %p\n", |
3398 | slave, | 3387 | slave, slave->dev->netdev_ops->ndo_change_mtu); |
3399 | slave->dev->netdev_ops->ndo_change_mtu); | ||
3400 | 3388 | ||
3401 | res = dev_set_mtu(slave->dev, new_mtu); | 3389 | res = dev_set_mtu(slave->dev, new_mtu); |
3402 | 3390 | ||
@@ -3484,15 +3472,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) | |||
3484 | */ | 3472 | */ |
3485 | 3473 | ||
3486 | bond_for_each_slave(bond, slave, iter) { | 3474 | bond_for_each_slave(bond, slave, iter) { |
3487 | const struct net_device_ops *slave_ops = slave->dev->netdev_ops; | ||
3488 | pr_debug("slave %p %s\n", slave, slave->dev->name); | 3475 | pr_debug("slave %p %s\n", slave, slave->dev->name); |
3489 | |||
3490 | if (slave_ops->ndo_set_mac_address == NULL) { | ||
3491 | res = -EOPNOTSUPP; | ||
3492 | pr_debug("EOPNOTSUPP %s\n", slave->dev->name); | ||
3493 | goto unwind; | ||
3494 | } | ||
3495 | |||
3496 | res = dev_set_mac_address(slave->dev, addr); | 3476 | res = dev_set_mac_address(slave->dev, addr); |
3497 | if (res) { | 3477 | if (res) { |
3498 | /* TODO: consider downing the slave | 3478 | /* TODO: consider downing the slave |
@@ -3568,7 +3548,7 @@ static void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int sl | |||
3568 | } | 3548 | } |
3569 | } | 3549 | } |
3570 | /* no slave that can tx has been found */ | 3550 | /* no slave that can tx has been found */ |
3571 | kfree_skb(skb); | 3551 | dev_kfree_skb_any(skb); |
3572 | } | 3552 | } |
3573 | 3553 | ||
3574 | /** | 3554 | /** |
@@ -3644,7 +3624,7 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
3644 | if (slave) | 3624 | if (slave) |
3645 | bond_dev_queue_xmit(bond, skb, slave->dev); | 3625 | bond_dev_queue_xmit(bond, skb, slave->dev); |
3646 | else | 3626 | else |
3647 | kfree_skb(skb); | 3627 | dev_kfree_skb_any(skb); |
3648 | 3628 | ||
3649 | return NETDEV_TX_OK; | 3629 | return NETDEV_TX_OK; |
3650 | } | 3630 | } |
@@ -3687,7 +3667,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
3687 | if (slave && IS_UP(slave->dev) && slave->link == BOND_LINK_UP) | 3667 | if (slave && IS_UP(slave->dev) && slave->link == BOND_LINK_UP) |
3688 | bond_dev_queue_xmit(bond, skb, slave->dev); | 3668 | bond_dev_queue_xmit(bond, skb, slave->dev); |
3689 | else | 3669 | else |
3690 | kfree_skb(skb); | 3670 | dev_kfree_skb_any(skb); |
3691 | 3671 | ||
3692 | return NETDEV_TX_OK; | 3672 | return NETDEV_TX_OK; |
3693 | } | 3673 | } |
@@ -3774,7 +3754,7 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev | |||
3774 | pr_err("%s: Error: Unknown bonding mode %d\n", | 3754 | pr_err("%s: Error: Unknown bonding mode %d\n", |
3775 | dev->name, bond->params.mode); | 3755 | dev->name, bond->params.mode); |
3776 | WARN_ON_ONCE(1); | 3756 | WARN_ON_ONCE(1); |
3777 | kfree_skb(skb); | 3757 | dev_kfree_skb_any(skb); |
3778 | return NETDEV_TX_OK; | 3758 | return NETDEV_TX_OK; |
3779 | } | 3759 | } |
3780 | } | 3760 | } |
@@ -3795,7 +3775,7 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3795 | if (bond_has_slaves(bond)) | 3775 | if (bond_has_slaves(bond)) |
3796 | ret = __bond_start_xmit(skb, dev); | 3776 | ret = __bond_start_xmit(skb, dev); |
3797 | else | 3777 | else |
3798 | kfree_skb(skb); | 3778 | dev_kfree_skb_any(skb); |
3799 | rcu_read_unlock(); | 3779 | rcu_read_unlock(); |
3800 | 3780 | ||
3801 | return ret; | 3781 | return ret; |
@@ -3958,7 +3938,7 @@ static void bond_uninit(struct net_device *bond_dev) | |||
3958 | /* Release the bonded slaves */ | 3938 | /* Release the bonded slaves */ |
3959 | bond_for_each_slave(bond, slave, iter) | 3939 | bond_for_each_slave(bond, slave, iter) |
3960 | __bond_release_one(bond_dev, slave->dev, true); | 3940 | __bond_release_one(bond_dev, slave->dev, true); |
3961 | pr_info("%s: released all slaves\n", bond_dev->name); | 3941 | pr_info("%s: Released all slaves\n", bond_dev->name); |
3962 | 3942 | ||
3963 | list_del(&bond->bond_list); | 3943 | list_del(&bond->bond_list); |
3964 | 3944 | ||
@@ -3967,56 +3947,11 @@ static void bond_uninit(struct net_device *bond_dev) | |||
3967 | 3947 | ||
3968 | /*------------------------- Module initialization ---------------------------*/ | 3948 | /*------------------------- Module initialization ---------------------------*/ |
3969 | 3949 | ||
3970 | int bond_parm_tbl_lookup(int mode, const struct bond_parm_tbl *tbl) | ||
3971 | { | ||
3972 | int i; | ||
3973 | |||
3974 | for (i = 0; tbl[i].modename; i++) | ||
3975 | if (mode == tbl[i].mode) | ||
3976 | return tbl[i].mode; | ||
3977 | |||
3978 | return -1; | ||
3979 | } | ||
3980 | |||
3981 | static int bond_parm_tbl_lookup_name(const char *modename, | ||
3982 | const struct bond_parm_tbl *tbl) | ||
3983 | { | ||
3984 | int i; | ||
3985 | |||
3986 | for (i = 0; tbl[i].modename; i++) | ||
3987 | if (strcmp(modename, tbl[i].modename) == 0) | ||
3988 | return tbl[i].mode; | ||
3989 | |||
3990 | return -1; | ||
3991 | } | ||
3992 | |||
3993 | /* | ||
3994 | * Convert string input module parms. Accept either the | ||
3995 | * number of the mode or its string name. A bit complicated because | ||
3996 | * some mode names are substrings of other names, and calls from sysfs | ||
3997 | * may have whitespace in the name (trailing newlines, for example). | ||
3998 | */ | ||
3999 | int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl) | ||
4000 | { | ||
4001 | int modeint; | ||
4002 | char *p, modestr[BOND_MAX_MODENAME_LEN + 1]; | ||
4003 | |||
4004 | for (p = (char *)buf; *p; p++) | ||
4005 | if (!(isdigit(*p) || isspace(*p))) | ||
4006 | break; | ||
4007 | |||
4008 | if (*p && sscanf(buf, "%20s", modestr) != 0) | ||
4009 | return bond_parm_tbl_lookup_name(modestr, tbl); | ||
4010 | else if (sscanf(buf, "%d", &modeint) != 0) | ||
4011 | return bond_parm_tbl_lookup(modeint, tbl); | ||
4012 | |||
4013 | return -1; | ||
4014 | } | ||
4015 | |||
4016 | static int bond_check_params(struct bond_params *params) | 3950 | static int bond_check_params(struct bond_params *params) |
4017 | { | 3951 | { |
4018 | int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; | 3952 | int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; |
4019 | struct bond_opt_value newval, *valptr; | 3953 | struct bond_opt_value newval; |
3954 | const struct bond_opt_value *valptr; | ||
4020 | int arp_all_targets_value; | 3955 | int arp_all_targets_value; |
4021 | 3956 | ||
4022 | /* | 3957 | /* |
@@ -4036,7 +3971,7 @@ static int bond_check_params(struct bond_params *params) | |||
4036 | if ((bond_mode != BOND_MODE_XOR) && | 3971 | if ((bond_mode != BOND_MODE_XOR) && |
4037 | (bond_mode != BOND_MODE_8023AD)) { | 3972 | (bond_mode != BOND_MODE_8023AD)) { |
4038 | pr_info("xmit_hash_policy param is irrelevant in mode %s\n", | 3973 | pr_info("xmit_hash_policy param is irrelevant in mode %s\n", |
4039 | bond_mode_name(bond_mode)); | 3974 | bond_mode_name(bond_mode)); |
4040 | } else { | 3975 | } else { |
4041 | bond_opt_initstr(&newval, xmit_hash_policy); | 3976 | bond_opt_initstr(&newval, xmit_hash_policy); |
4042 | valptr = bond_opt_parse(bond_opt_get(BOND_OPT_XMIT_HASH), | 3977 | valptr = bond_opt_parse(bond_opt_get(BOND_OPT_XMIT_HASH), |
@@ -4077,74 +4012,71 @@ static int bond_check_params(struct bond_params *params) | |||
4077 | } | 4012 | } |
4078 | params->ad_select = valptr->value; | 4013 | params->ad_select = valptr->value; |
4079 | if (bond_mode != BOND_MODE_8023AD) | 4014 | if (bond_mode != BOND_MODE_8023AD) |
4080 | pr_warning("ad_select param only affects 802.3ad mode\n"); | 4015 | pr_warn("ad_select param only affects 802.3ad mode\n"); |
4081 | } else { | 4016 | } else { |
4082 | params->ad_select = BOND_AD_STABLE; | 4017 | params->ad_select = BOND_AD_STABLE; |
4083 | } | 4018 | } |
4084 | 4019 | ||
4085 | if (max_bonds < 0) { | 4020 | if (max_bonds < 0) { |
4086 | pr_warning("Warning: max_bonds (%d) not in range %d-%d, so it was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", | 4021 | pr_warn("Warning: max_bonds (%d) not in range %d-%d, so it was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", |
4087 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); | 4022 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); |
4088 | max_bonds = BOND_DEFAULT_MAX_BONDS; | 4023 | max_bonds = BOND_DEFAULT_MAX_BONDS; |
4089 | } | 4024 | } |
4090 | 4025 | ||
4091 | if (miimon < 0) { | 4026 | if (miimon < 0) { |
4092 | pr_warning("Warning: miimon module parameter (%d), not in range 0-%d, so it was reset to 0\n", | 4027 | pr_warn("Warning: miimon module parameter (%d), not in range 0-%d, so it was reset to 0\n", |
4093 | miimon, INT_MAX); | 4028 | miimon, INT_MAX); |
4094 | miimon = 0; | 4029 | miimon = 0; |
4095 | } | 4030 | } |
4096 | 4031 | ||
4097 | if (updelay < 0) { | 4032 | if (updelay < 0) { |
4098 | pr_warning("Warning: updelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", | 4033 | pr_warn("Warning: updelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", |
4099 | updelay, INT_MAX); | 4034 | updelay, INT_MAX); |
4100 | updelay = 0; | 4035 | updelay = 0; |
4101 | } | 4036 | } |
4102 | 4037 | ||
4103 | if (downdelay < 0) { | 4038 | if (downdelay < 0) { |
4104 | pr_warning("Warning: downdelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", | 4039 | pr_warn("Warning: downdelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", |
4105 | downdelay, INT_MAX); | 4040 | downdelay, INT_MAX); |
4106 | downdelay = 0; | 4041 | downdelay = 0; |
4107 | } | 4042 | } |
4108 | 4043 | ||
4109 | if ((use_carrier != 0) && (use_carrier != 1)) { | 4044 | if ((use_carrier != 0) && (use_carrier != 1)) { |
4110 | pr_warning("Warning: use_carrier module parameter (%d), not of valid value (0/1), so it was set to 1\n", | 4045 | pr_warn("Warning: use_carrier module parameter (%d), not of valid value (0/1), so it was set to 1\n", |
4111 | use_carrier); | 4046 | use_carrier); |
4112 | use_carrier = 1; | 4047 | use_carrier = 1; |
4113 | } | 4048 | } |
4114 | 4049 | ||
4115 | if (num_peer_notif < 0 || num_peer_notif > 255) { | 4050 | if (num_peer_notif < 0 || num_peer_notif > 255) { |
4116 | pr_warning("Warning: num_grat_arp/num_unsol_na (%d) not in range 0-255 so it was reset to 1\n", | 4051 | pr_warn("Warning: num_grat_arp/num_unsol_na (%d) not in range 0-255 so it was reset to 1\n", |
4117 | num_peer_notif); | 4052 | num_peer_notif); |
4118 | num_peer_notif = 1; | 4053 | num_peer_notif = 1; |
4119 | } | 4054 | } |
4120 | 4055 | ||
4121 | /* reset values for 802.3ad/TLB/ALB */ | 4056 | /* reset values for 802.3ad/TLB/ALB */ |
4122 | if (BOND_NO_USES_ARP(bond_mode)) { | 4057 | if (BOND_NO_USES_ARP(bond_mode)) { |
4123 | if (!miimon) { | 4058 | if (!miimon) { |
4124 | 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"); | 4059 | pr_warn("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n"); |
4125 | pr_warning("Forcing miimon to 100msec\n"); | 4060 | pr_warn("Forcing miimon to 100msec\n"); |
4126 | miimon = BOND_DEFAULT_MIIMON; | 4061 | miimon = BOND_DEFAULT_MIIMON; |
4127 | } | 4062 | } |
4128 | } | 4063 | } |
4129 | 4064 | ||
4130 | if (tx_queues < 1 || tx_queues > 255) { | 4065 | if (tx_queues < 1 || tx_queues > 255) { |
4131 | pr_warning("Warning: tx_queues (%d) should be between " | 4066 | pr_warn("Warning: tx_queues (%d) should be between 1 and 255, resetting to %d\n", |
4132 | "1 and 255, resetting to %d\n", | 4067 | tx_queues, BOND_DEFAULT_TX_QUEUES); |
4133 | tx_queues, BOND_DEFAULT_TX_QUEUES); | ||
4134 | tx_queues = BOND_DEFAULT_TX_QUEUES; | 4068 | tx_queues = BOND_DEFAULT_TX_QUEUES; |
4135 | } | 4069 | } |
4136 | 4070 | ||
4137 | if ((all_slaves_active != 0) && (all_slaves_active != 1)) { | 4071 | if ((all_slaves_active != 0) && (all_slaves_active != 1)) { |
4138 | pr_warning("Warning: all_slaves_active module parameter (%d), " | 4072 | pr_warn("Warning: all_slaves_active module parameter (%d), not of valid value (0/1), so it was set to 0\n", |
4139 | "not of valid value (0/1), so it was set to " | 4073 | all_slaves_active); |
4140 | "0\n", all_slaves_active); | ||
4141 | all_slaves_active = 0; | 4074 | all_slaves_active = 0; |
4142 | } | 4075 | } |
4143 | 4076 | ||
4144 | if (resend_igmp < 0 || resend_igmp > 255) { | 4077 | if (resend_igmp < 0 || resend_igmp > 255) { |
4145 | pr_warning("Warning: resend_igmp (%d) should be between " | 4078 | pr_warn("Warning: resend_igmp (%d) should be between 0 and 255, resetting to %d\n", |
4146 | "0 and 255, resetting to %d\n", | 4079 | resend_igmp, BOND_DEFAULT_RESEND_IGMP); |
4147 | resend_igmp, BOND_DEFAULT_RESEND_IGMP); | ||
4148 | resend_igmp = BOND_DEFAULT_RESEND_IGMP; | 4080 | resend_igmp = BOND_DEFAULT_RESEND_IGMP; |
4149 | } | 4081 | } |
4150 | 4082 | ||
@@ -4165,37 +4097,36 @@ static int bond_check_params(struct bond_params *params) | |||
4165 | /* just warn the user the up/down delay will have | 4097 | /* just warn the user the up/down delay will have |
4166 | * no effect since miimon is zero... | 4098 | * no effect since miimon is zero... |
4167 | */ | 4099 | */ |
4168 | 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", | 4100 | pr_warn("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", |
4169 | updelay, downdelay); | 4101 | updelay, downdelay); |
4170 | } | 4102 | } |
4171 | } else { | 4103 | } else { |
4172 | /* don't allow arp monitoring */ | 4104 | /* don't allow arp monitoring */ |
4173 | if (arp_interval) { | 4105 | if (arp_interval) { |
4174 | pr_warning("Warning: miimon (%d) and arp_interval (%d) can't be used simultaneously, disabling ARP monitoring\n", | 4106 | pr_warn("Warning: miimon (%d) and arp_interval (%d) can't be used simultaneously, disabling ARP monitoring\n", |
4175 | miimon, arp_interval); | 4107 | miimon, arp_interval); |
4176 | arp_interval = 0; | 4108 | arp_interval = 0; |
4177 | } | 4109 | } |
4178 | 4110 | ||
4179 | if ((updelay % miimon) != 0) { | 4111 | if ((updelay % miimon) != 0) { |
4180 | pr_warning("Warning: updelay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", | 4112 | pr_warn("Warning: updelay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", |
4181 | updelay, miimon, | 4113 | updelay, miimon, (updelay / miimon) * miimon); |
4182 | (updelay / miimon) * miimon); | ||
4183 | } | 4114 | } |
4184 | 4115 | ||
4185 | updelay /= miimon; | 4116 | updelay /= miimon; |
4186 | 4117 | ||
4187 | if ((downdelay % miimon) != 0) { | 4118 | if ((downdelay % miimon) != 0) { |
4188 | pr_warning("Warning: downdelay (%d) is not a multiple of miimon (%d), downdelay rounded to %d ms\n", | 4119 | pr_warn("Warning: downdelay (%d) is not a multiple of miimon (%d), downdelay rounded to %d ms\n", |
4189 | downdelay, miimon, | 4120 | downdelay, miimon, |
4190 | (downdelay / miimon) * miimon); | 4121 | (downdelay / miimon) * miimon); |
4191 | } | 4122 | } |
4192 | 4123 | ||
4193 | downdelay /= miimon; | 4124 | downdelay /= miimon; |
4194 | } | 4125 | } |
4195 | 4126 | ||
4196 | if (arp_interval < 0) { | 4127 | if (arp_interval < 0) { |
4197 | pr_warning("Warning: arp_interval module parameter (%d) , not in range 0-%d, so it was reset to 0\n", | 4128 | pr_warn("Warning: arp_interval module parameter (%d), not in range 0-%d, so it was reset to 0\n", |
4198 | arp_interval, INT_MAX); | 4129 | arp_interval, INT_MAX); |
4199 | arp_interval = 0; | 4130 | arp_interval = 0; |
4200 | } | 4131 | } |
4201 | 4132 | ||
@@ -4206,30 +4137,26 @@ static int bond_check_params(struct bond_params *params) | |||
4206 | __be32 ip; | 4137 | __be32 ip; |
4207 | if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) || | 4138 | if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) || |
4208 | IS_IP_TARGET_UNUSABLE_ADDRESS(ip)) { | 4139 | IS_IP_TARGET_UNUSABLE_ADDRESS(ip)) { |
4209 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", | 4140 | pr_warn("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", |
4210 | arp_ip_target[i]); | 4141 | arp_ip_target[i]); |
4211 | arp_interval = 0; | 4142 | arp_interval = 0; |
4212 | } else { | 4143 | } else { |
4213 | if (bond_get_targets_ip(arp_target, ip) == -1) | 4144 | if (bond_get_targets_ip(arp_target, ip) == -1) |
4214 | arp_target[arp_ip_count++] = ip; | 4145 | arp_target[arp_ip_count++] = ip; |
4215 | else | 4146 | else |
4216 | pr_warning("Warning: duplicate address %pI4 in arp_ip_target, skipping\n", | 4147 | pr_warn("Warning: duplicate address %pI4 in arp_ip_target, skipping\n", |
4217 | &ip); | 4148 | &ip); |
4218 | } | 4149 | } |
4219 | } | 4150 | } |
4220 | 4151 | ||
4221 | if (arp_interval && !arp_ip_count) { | 4152 | if (arp_interval && !arp_ip_count) { |
4222 | /* don't allow arping if no arp_ip_target given... */ | 4153 | /* don't allow arping if no arp_ip_target given... */ |
4223 | pr_warning("Warning: arp_interval module parameter (%d) specified without providing an arp_ip_target parameter, arp_interval was reset to 0\n", | 4154 | pr_warn("Warning: arp_interval module parameter (%d) specified without providing an arp_ip_target parameter, arp_interval was reset to 0\n", |
4224 | arp_interval); | 4155 | arp_interval); |
4225 | arp_interval = 0; | 4156 | arp_interval = 0; |
4226 | } | 4157 | } |
4227 | 4158 | ||
4228 | if (arp_validate) { | 4159 | if (arp_validate) { |
4229 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) { | ||
4230 | pr_err("arp_validate only supported in active-backup mode\n"); | ||
4231 | return -EINVAL; | ||
4232 | } | ||
4233 | if (!arp_interval) { | 4160 | if (!arp_interval) { |
4234 | pr_err("arp_validate requires arp_interval\n"); | 4161 | pr_err("arp_validate requires arp_interval\n"); |
4235 | return -EINVAL; | 4162 | return -EINVAL; |
@@ -4271,23 +4198,23 @@ static int bond_check_params(struct bond_params *params) | |||
4271 | arp_interval, valptr->string, arp_ip_count); | 4198 | arp_interval, valptr->string, arp_ip_count); |
4272 | 4199 | ||
4273 | for (i = 0; i < arp_ip_count; i++) | 4200 | for (i = 0; i < arp_ip_count; i++) |
4274 | pr_info(" %s", arp_ip_target[i]); | 4201 | pr_cont(" %s", arp_ip_target[i]); |
4275 | 4202 | ||
4276 | pr_info("\n"); | 4203 | pr_cont("\n"); |
4277 | 4204 | ||
4278 | } else if (max_bonds) { | 4205 | } else if (max_bonds) { |
4279 | /* miimon and arp_interval not set, we need one so things | 4206 | /* miimon and arp_interval not set, we need one so things |
4280 | * work as expected, see bonding.txt for details | 4207 | * work as expected, see bonding.txt for details |
4281 | */ | 4208 | */ |
4282 | pr_debug("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"); | 4209 | pr_debug("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"); |
4283 | } | 4210 | } |
4284 | 4211 | ||
4285 | if (primary && !USES_PRIMARY(bond_mode)) { | 4212 | if (primary && !USES_PRIMARY(bond_mode)) { |
4286 | /* currently, using a primary only makes sense | 4213 | /* currently, using a primary only makes sense |
4287 | * in active backup, TLB or ALB modes | 4214 | * in active backup, TLB or ALB modes |
4288 | */ | 4215 | */ |
4289 | pr_warning("Warning: %s primary device specified but has no effect in %s mode\n", | 4216 | pr_warn("Warning: %s primary device specified but has no effect in %s mode\n", |
4290 | primary, bond_mode_name(bond_mode)); | 4217 | primary, bond_mode_name(bond_mode)); |
4291 | primary = NULL; | 4218 | primary = NULL; |
4292 | } | 4219 | } |
4293 | 4220 | ||
@@ -4316,14 +4243,14 @@ static int bond_check_params(struct bond_params *params) | |||
4316 | } | 4243 | } |
4317 | fail_over_mac_value = valptr->value; | 4244 | fail_over_mac_value = valptr->value; |
4318 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) | 4245 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) |
4319 | pr_warning("Warning: fail_over_mac only affects active-backup mode.\n"); | 4246 | pr_warn("Warning: fail_over_mac only affects active-backup mode\n"); |
4320 | } else { | 4247 | } else { |
4321 | fail_over_mac_value = BOND_FOM_NONE; | 4248 | fail_over_mac_value = BOND_FOM_NONE; |
4322 | } | 4249 | } |
4323 | 4250 | ||
4324 | if (lp_interval == 0) { | 4251 | if (lp_interval == 0) { |
4325 | pr_warning("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n", | 4252 | pr_warn("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n", |
4326 | INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL); | 4253 | INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL); |
4327 | lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; | 4254 | lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; |
4328 | } | 4255 | } |
4329 | 4256 | ||