diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-06-08 15:56:17 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-06-08 15:56:17 -0400 |
| commit | cac925a4aab1b7233d3beb591f53498816058a08 (patch) | |
| tree | a800537068aa05fd426ff44b8efd52d66e6d2051 | |
| parent | bcd618e4eac6fbf82de05d23c15ecb694c62b8af (diff) | |
| parent | 6224e01dccf2543a8f8b4d825baf1510c79c2878 (diff) | |
Merge branch 'upstream' of git://lost.foo-projects.org/~ahkok/git/netdev-2.6 into tmp
| -rw-r--r-- | Documentation/networking/bonding.txt | 323 | ||||
| -rw-r--r-- | drivers/net/e100.c | 75 | ||||
| -rw-r--r-- | drivers/net/e1000/e1000_main.c | 114 |
3 files changed, 417 insertions, 95 deletions
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 8d8b4e5ea184..afac780445cd 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | Linux Ethernet Bonding Driver HOWTO | 2 | Linux Ethernet Bonding Driver HOWTO |
| 3 | 3 | ||
| 4 | Latest update: 21 June 2005 | 4 | Latest update: 24 April 2006 |
| 5 | 5 | ||
| 6 | Initial release : Thomas Davis <tadavis at lbl.gov> | 6 | Initial release : Thomas Davis <tadavis at lbl.gov> |
| 7 | Corrections, HA extensions : 2000/10/03-15 : | 7 | Corrections, HA extensions : 2000/10/03-15 : |
| @@ -12,6 +12,8 @@ Corrections, HA extensions : 2000/10/03-15 : | |||
| 12 | - Jay Vosburgh <fubar at us dot ibm dot com> | 12 | - Jay Vosburgh <fubar at us dot ibm dot com> |
| 13 | 13 | ||
| 14 | Reorganized and updated Feb 2005 by Jay Vosburgh | 14 | Reorganized and updated Feb 2005 by Jay Vosburgh |
| 15 | Added Sysfs information: 2006/04/24 | ||
| 16 | - Mitch Williams <mitch.a.williams at intel.com> | ||
| 15 | 17 | ||
| 16 | Introduction | 18 | Introduction |
| 17 | ============ | 19 | ============ |
| @@ -38,61 +40,62 @@ Table of Contents | |||
| 38 | 2. Bonding Driver Options | 40 | 2. Bonding Driver Options |
| 39 | 41 | ||
| 40 | 3. Configuring Bonding Devices | 42 | 3. Configuring Bonding Devices |
| 41 | 3.1 Configuration with sysconfig support | 43 | 3.1 Configuration with Sysconfig Support |
| 42 | 3.1.1 Using DHCP with sysconfig | 44 | 3.1.1 Using DHCP with Sysconfig |
| 43 | 3.1.2 Configuring Multiple Bonds with sysconfig | 45 | 3.1.2 Configuring Multiple Bonds with Sysconfig |
| 44 | 3.2 Configuration with initscripts support | 46 | 3.2 Configuration with Initscripts Support |
| 45 | 3.2.1 Using DHCP with initscripts | 47 | 3.2.1 Using DHCP with Initscripts |
| 46 | 3.2.2 Configuring Multiple Bonds with initscripts | 48 | 3.2.2 Configuring Multiple Bonds with Initscripts |
| 47 | 3.3 Configuring Bonding Manually | 49 | 3.3 Configuring Bonding Manually with Ifenslave |
| 48 | 3.3.1 Configuring Multiple Bonds Manually | 50 | 3.3.1 Configuring Multiple Bonds Manually |
| 51 | 3.4 Configuring Bonding Manually via Sysfs | ||
| 49 | 52 | ||
| 50 | 5. Querying Bonding Configuration | 53 | 4. Querying Bonding Configuration |
| 51 | 5.1 Bonding Configuration | 54 | 4.1 Bonding Configuration |
| 52 | 5.2 Network Configuration | 55 | 4.2 Network Configuration |
| 53 | 56 | ||
| 54 | 6. Switch Configuration | 57 | 5. Switch Configuration |
| 55 | 58 | ||
| 56 | 7. 802.1q VLAN Support | 59 | 6. 802.1q VLAN Support |
| 57 | 60 | ||
| 58 | 8. Link Monitoring | 61 | 7. Link Monitoring |
| 59 | 8.1 ARP Monitor Operation | 62 | 7.1 ARP Monitor Operation |
| 60 | 8.2 Configuring Multiple ARP Targets | 63 | 7.2 Configuring Multiple ARP Targets |
| 61 | 8.3 MII Monitor Operation | 64 | 7.3 MII Monitor Operation |
| 62 | 65 | ||
| 63 | 9. Potential Trouble Sources | 66 | 8. Potential Trouble Sources |
| 64 | 9.1 Adventures in Routing | 67 | 8.1 Adventures in Routing |
| 65 | 9.2 Ethernet Device Renaming | 68 | 8.2 Ethernet Device Renaming |
| 66 | 9.3 Painfully Slow Or No Failed Link Detection By Miimon | 69 | 8.3 Painfully Slow Or No Failed Link Detection By Miimon |
| 67 | 70 | ||
| 68 | 10. SNMP agents | 71 | 9. SNMP agents |
| 69 | 72 | ||
| 70 | 11. Promiscuous mode | 73 | 10. Promiscuous mode |
| 71 | 74 | ||
| 72 | 12. Configuring Bonding for High Availability | 75 | 11. Configuring Bonding for High Availability |
| 73 | 12.1 High Availability in a Single Switch Topology | 76 | 11.1 High Availability in a Single Switch Topology |
| 74 | 12.2 High Availability in a Multiple Switch Topology | 77 | 11.2 High Availability in a Multiple Switch Topology |
| 75 | 12.2.1 HA Bonding Mode Selection for Multiple Switch Topology | 78 | 11.2.1 HA Bonding Mode Selection for Multiple Switch Topology |
| 76 | 12.2.2 HA Link Monitoring for Multiple Switch Topology | 79 | 11.2.2 HA Link Monitoring for Multiple Switch Topology |
| 77 | 80 | ||
| 78 | 13. Configuring Bonding for Maximum Throughput | 81 | 12. Configuring Bonding for Maximum Throughput |
| 79 | 13.1 Maximum Throughput in a Single Switch Topology | 82 | 12.1 Maximum Throughput in a Single Switch Topology |
| 80 | 13.1.1 MT Bonding Mode Selection for Single Switch Topology | 83 | 12.1.1 MT Bonding Mode Selection for Single Switch Topology |
| 81 | 13.1.2 MT Link Monitoring for Single Switch Topology | 84 | 12.1.2 MT Link Monitoring for Single Switch Topology |
| 82 | 13.2 Maximum Throughput in a Multiple Switch Topology | 85 | 12.2 Maximum Throughput in a Multiple Switch Topology |
| 83 | 13.2.1 MT Bonding Mode Selection for Multiple Switch Topology | 86 | 12.2.1 MT Bonding Mode Selection for Multiple Switch Topology |
| 84 | 13.2.2 MT Link Monitoring for Multiple Switch Topology | 87 | 12.2.2 MT Link Monitoring for Multiple Switch Topology |
| 85 | 88 | ||
| 86 | 14. Switch Behavior Issues | 89 | 13. Switch Behavior Issues |
| 87 | 14.1 Link Establishment and Failover Delays | 90 | 13.1 Link Establishment and Failover Delays |
| 88 | 14.2 Duplicated Incoming Packets | 91 | 13.2 Duplicated Incoming Packets |
| 89 | 92 | ||
| 90 | 15. Hardware Specific Considerations | 93 | 14. Hardware Specific Considerations |
| 91 | 15.1 IBM BladeCenter | 94 | 14.1 IBM BladeCenter |
| 92 | 95 | ||
| 93 | 16. Frequently Asked Questions | 96 | 15. Frequently Asked Questions |
| 94 | 97 | ||
| 95 | 17. Resources and Links | 98 | 16. Resources and Links |
| 96 | 99 | ||
| 97 | 100 | ||
| 98 | 1. Bonding Driver Installation | 101 | 1. Bonding Driver Installation |
| @@ -156,6 +159,9 @@ you're trying to build it for. Some distros (e.g., Red Hat from 7.1 | |||
| 156 | onwards) do not have /usr/include/linux symbolically linked to the | 159 | onwards) do not have /usr/include/linux symbolically linked to the |
| 157 | default kernel source include directory. | 160 | default kernel source include directory. |
| 158 | 161 | ||
| 162 | SECOND IMPORTANT NOTE: | ||
| 163 | If you plan to configure bonding using sysfs, you do not need | ||
| 164 | to use ifenslave. | ||
| 159 | 165 | ||
| 160 | 2. Bonding Driver Options | 166 | 2. Bonding Driver Options |
| 161 | ========================= | 167 | ========================= |
| @@ -270,7 +276,7 @@ mode | |||
| 270 | In bonding version 2.6.2 or later, when a failover | 276 | In bonding version 2.6.2 or later, when a failover |
| 271 | occurs in active-backup mode, bonding will issue one | 277 | occurs in active-backup mode, bonding will issue one |
| 272 | or more gratuitous ARPs on the newly active slave. | 278 | or more gratuitous ARPs on the newly active slave. |
| 273 | One gratutious ARP is issued for the bonding master | 279 | One gratuitous ARP is issued for the bonding master |
| 274 | interface and each VLAN interfaces configured above | 280 | interface and each VLAN interfaces configured above |
| 275 | it, provided that the interface has at least one IP | 281 | it, provided that the interface has at least one IP |
| 276 | address configured. Gratuitous ARPs issued for VLAN | 282 | address configured. Gratuitous ARPs issued for VLAN |
| @@ -377,7 +383,7 @@ mode | |||
| 377 | When a link is reconnected or a new slave joins the | 383 | When a link is reconnected or a new slave joins the |
| 378 | bond the receive traffic is redistributed among all | 384 | bond the receive traffic is redistributed among all |
| 379 | active slaves in the bond by initiating ARP Replies | 385 | active slaves in the bond by initiating ARP Replies |
| 380 | with the selected mac address to each of the | 386 | with the selected MAC address to each of the |
| 381 | clients. The updelay parameter (detailed below) must | 387 | clients. The updelay parameter (detailed below) must |
| 382 | be set to a value equal or greater than the switch's | 388 | be set to a value equal or greater than the switch's |
| 383 | forwarding delay so that the ARP Replies sent to the | 389 | forwarding delay so that the ARP Replies sent to the |
| @@ -498,11 +504,12 @@ not exist, and the layer2 policy is the only policy. | |||
| 498 | 3. Configuring Bonding Devices | 504 | 3. Configuring Bonding Devices |
| 499 | ============================== | 505 | ============================== |
| 500 | 506 | ||
| 501 | There are, essentially, two methods for configuring bonding: | 507 | You can configure bonding using either your distro's network |
| 502 | with support from the distro's network initialization scripts, and | 508 | initialization scripts, or manually using either ifenslave or the |
| 503 | without. Distros generally use one of two packages for the network | 509 | sysfs interface. Distros generally use one of two packages for the |
| 504 | initialization scripts: initscripts or sysconfig. Recent versions of | 510 | network initialization scripts: initscripts or sysconfig. Recent |
| 505 | these packages have support for bonding, while older versions do not. | 511 | versions of these packages have support for bonding, while older |
| 512 | versions do not. | ||
| 506 | 513 | ||
| 507 | We will first describe the options for configuring bonding for | 514 | We will first describe the options for configuring bonding for |
| 508 | distros using versions of initscripts and sysconfig with full or | 515 | distros using versions of initscripts and sysconfig with full or |
| @@ -530,7 +537,7 @@ $ grep ifenslave /sbin/ifup | |||
| 530 | If this returns any matches, then your initscripts or | 537 | If this returns any matches, then your initscripts or |
| 531 | sysconfig has support for bonding. | 538 | sysconfig has support for bonding. |
| 532 | 539 | ||
| 533 | 3.1 Configuration with sysconfig support | 540 | 3.1 Configuration with Sysconfig Support |
| 534 | ---------------------------------------- | 541 | ---------------------------------------- |
| 535 | 542 | ||
| 536 | This section applies to distros using a version of sysconfig | 543 | This section applies to distros using a version of sysconfig |
| @@ -538,7 +545,7 @@ with bonding support, for example, SuSE Linux Enterprise Server 9. | |||
| 538 | 545 | ||
| 539 | SuSE SLES 9's networking configuration system does support | 546 | SuSE SLES 9's networking configuration system does support |
| 540 | bonding, however, at this writing, the YaST system configuration | 547 | bonding, however, at this writing, the YaST system configuration |
| 541 | frontend does not provide any means to work with bonding devices. | 548 | front end does not provide any means to work with bonding devices. |
| 542 | Bonding devices can be managed by hand, however, as follows. | 549 | Bonding devices can be managed by hand, however, as follows. |
| 543 | 550 | ||
| 544 | First, if they have not already been configured, configure the | 551 | First, if they have not already been configured, configure the |
| @@ -660,7 +667,7 @@ format can be found in an example ifcfg template file: | |||
| 660 | Note that the template does not document the various BONDING_ | 667 | Note that the template does not document the various BONDING_ |
| 661 | settings described above, but does describe many of the other options. | 668 | settings described above, but does describe many of the other options. |
| 662 | 669 | ||
| 663 | 3.1.1 Using DHCP with sysconfig | 670 | 3.1.1 Using DHCP with Sysconfig |
| 664 | ------------------------------- | 671 | ------------------------------- |
| 665 | 672 | ||
| 666 | Under sysconfig, configuring a device with BOOTPROTO='dhcp' | 673 | Under sysconfig, configuring a device with BOOTPROTO='dhcp' |
| @@ -670,7 +677,7 @@ attempt to obtain the device address from DHCP prior to adding any of | |||
| 670 | the slave devices. Without active slaves, the DHCP requests are not | 677 | the slave devices. Without active slaves, the DHCP requests are not |
| 671 | sent to the network. | 678 | sent to the network. |
| 672 | 679 | ||
| 673 | 3.1.2 Configuring Multiple Bonds with sysconfig | 680 | 3.1.2 Configuring Multiple Bonds with Sysconfig |
| 674 | ----------------------------------------------- | 681 | ----------------------------------------------- |
| 675 | 682 | ||
| 676 | The sysconfig network initialization system is capable of | 683 | The sysconfig network initialization system is capable of |
| @@ -685,7 +692,7 @@ ifcfg-bondX files. | |||
| 685 | options in the ifcfg-bondX file, it is not necessary to add them to | 692 | options in the ifcfg-bondX file, it is not necessary to add them to |
| 686 | the system /etc/modules.conf or /etc/modprobe.conf configuration file. | 693 | the system /etc/modules.conf or /etc/modprobe.conf configuration file. |
| 687 | 694 | ||
| 688 | 3.2 Configuration with initscripts support | 695 | 3.2 Configuration with Initscripts Support |
| 689 | ------------------------------------------ | 696 | ------------------------------------------ |
| 690 | 697 | ||
| 691 | This section applies to distros using a version of initscripts | 698 | This section applies to distros using a version of initscripts |
| @@ -756,7 +763,7 @@ options for your configuration. | |||
| 756 | will restart the networking subsystem and your bond link should be now | 763 | will restart the networking subsystem and your bond link should be now |
| 757 | up and running. | 764 | up and running. |
| 758 | 765 | ||
| 759 | 3.2.1 Using DHCP with initscripts | 766 | 3.2.1 Using DHCP with Initscripts |
| 760 | --------------------------------- | 767 | --------------------------------- |
| 761 | 768 | ||
| 762 | Recent versions of initscripts (the version supplied with | 769 | Recent versions of initscripts (the version supplied with |
| @@ -768,7 +775,7 @@ above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp" | |||
| 768 | and add a line consisting of "TYPE=Bonding". Note that the TYPE value | 775 | and add a line consisting of "TYPE=Bonding". Note that the TYPE value |
| 769 | is case sensitive. | 776 | is case sensitive. |
| 770 | 777 | ||
| 771 | 3.2.2 Configuring Multiple Bonds with initscripts | 778 | 3.2.2 Configuring Multiple Bonds with Initscripts |
| 772 | ------------------------------------------------- | 779 | ------------------------------------------------- |
| 773 | 780 | ||
| 774 | At this writing, the initscripts package does not directly | 781 | At this writing, the initscripts package does not directly |
| @@ -784,8 +791,8 @@ Fedora Core kernels, and has been seen on RHEL 4 as well. On kernels | |||
| 784 | exhibiting this problem, it will be impossible to configure multiple | 791 | exhibiting this problem, it will be impossible to configure multiple |
| 785 | bonds with differing parameters. | 792 | bonds with differing parameters. |
| 786 | 793 | ||
| 787 | 3.3 Configuring Bonding Manually | 794 | 3.3 Configuring Bonding Manually with Ifenslave |
| 788 | -------------------------------- | 795 | ----------------------------------------------- |
| 789 | 796 | ||
| 790 | This section applies to distros whose network initialization | 797 | This section applies to distros whose network initialization |
| 791 | scripts (the sysconfig or initscripts package) do not have specific | 798 | scripts (the sysconfig or initscripts package) do not have specific |
| @@ -889,11 +896,139 @@ install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \ | |||
| 889 | This may be repeated any number of times, specifying a new and | 896 | This may be repeated any number of times, specifying a new and |
| 890 | unique name in place of bond1 for each subsequent instance. | 897 | unique name in place of bond1 for each subsequent instance. |
| 891 | 898 | ||
| 899 | 3.4 Configuring Bonding Manually via Sysfs | ||
| 900 | ------------------------------------------ | ||
| 901 | |||
| 902 | Starting with version 3.0, Channel Bonding may be configured | ||
| 903 | via the sysfs interface. This interface allows dynamic configuration | ||
| 904 | of all bonds in the system without unloading the module. It also | ||
| 905 | allows for adding and removing bonds at runtime. Ifenslave is no | ||
| 906 | longer required, though it is still supported. | ||
| 907 | |||
| 908 | Use of the sysfs interface allows you to use multiple bonds | ||
| 909 | with different configurations without having to reload the module. | ||
| 910 | It also allows you to use multiple, differently configured bonds when | ||
| 911 | bonding is compiled into the kernel. | ||
| 912 | |||
| 913 | You must have the sysfs filesystem mounted to configure | ||
| 914 | bonding this way. The examples in this document assume that you | ||
| 915 | are using the standard mount point for sysfs, e.g. /sys. If your | ||
| 916 | sysfs filesystem is mounted elsewhere, you will need to adjust the | ||
| 917 | example paths accordingly. | ||
| 918 | |||
| 919 | Creating and Destroying Bonds | ||
| 920 | ----------------------------- | ||
| 921 | To add a new bond foo: | ||
| 922 | # echo +foo > /sys/class/net/bonding_masters | ||
| 923 | |||
| 924 | To remove an existing bond bar: | ||
| 925 | # echo -bar > /sys/class/net/bonding_masters | ||
| 926 | |||
| 927 | To show all existing bonds: | ||
| 928 | # cat /sys/class/net/bonding_masters | ||
| 929 | |||
| 930 | NOTE: due to 4K size limitation of sysfs files, this list may be | ||
| 931 | truncated if you have more than a few hundred bonds. This is unlikely | ||
| 932 | to occur under normal operating conditions. | ||
| 933 | |||
| 934 | Adding and Removing Slaves | ||
| 935 | -------------------------- | ||
| 936 | Interfaces may be enslaved to a bond using the file | ||
| 937 | /sys/class/net/<bond>/bonding/slaves. The semantics for this file | ||
| 938 | are the same as for the bonding_masters file. | ||
| 939 | |||
| 940 | To enslave interface eth0 to bond bond0: | ||
| 941 | # ifconfig bond0 up | ||
| 942 | # echo +eth0 > /sys/class/net/bond0/bonding/slaves | ||
| 943 | |||
| 944 | To free slave eth0 from bond bond0: | ||
| 945 | # echo -eth0 > /sys/class/net/bond0/bonding/slaves | ||
| 946 | |||
| 947 | NOTE: The bond must be up before slaves can be added. All | ||
| 948 | slaves are freed when the interface is brought down. | ||
| 949 | |||
| 950 | When an interface is enslaved to a bond, symlinks between the | ||
| 951 | two are created in the sysfs filesystem. In this case, you would get | ||
| 952 | /sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and | ||
| 953 | /sys/class/net/eth0/master pointing to /sys/class/net/bond0. | ||
| 954 | |||
| 955 | This means that you can tell quickly whether or not an | ||
| 956 | interface is enslaved by looking for the master symlink. Thus: | ||
| 957 | # echo -eth0 > /sys/class/net/eth0/master/bonding/slaves | ||
| 958 | will free eth0 from whatever bond it is enslaved to, regardless of | ||
| 959 | the name of the bond interface. | ||
| 960 | |||
| 961 | Changing a Bond's Configuration | ||
| 962 | ------------------------------- | ||
| 963 | Each bond may be configured individually by manipulating the | ||
| 964 | files located in /sys/class/net/<bond name>/bonding | ||
| 965 | |||
| 966 | The names of these files correspond directly with the command- | ||
| 967 | line parameters described elsewhere in in this file, and, with the | ||
| 968 | exception of arp_ip_target, they accept the same values. To see the | ||
| 969 | current setting, simply cat the appropriate file. | ||
| 970 | |||
| 971 | A few examples will be given here; for specific usage | ||
| 972 | guidelines for each parameter, see the appropriate section in this | ||
| 973 | document. | ||
| 974 | |||
| 975 | To configure bond0 for balance-alb mode: | ||
| 976 | # ifconfig bond0 down | ||
| 977 | # echo 6 > /sys/class/net/bond0/bonding/mode | ||
| 978 | - or - | ||
| 979 | # echo balance-alb > /sys/class/net/bond0/bonding/mode | ||
| 980 | NOTE: The bond interface must be down before the mode can be | ||
| 981 | changed. | ||
| 982 | |||
| 983 | To enable MII monitoring on bond0 with a 1 second interval: | ||
| 984 | # echo 1000 > /sys/class/net/bond0/bonding/miimon | ||
| 985 | NOTE: If ARP monitoring is enabled, it will disabled when MII | ||
| 986 | monitoring is enabled, and vice-versa. | ||
| 987 | |||
| 988 | To add ARP targets: | ||
| 989 | # echo +192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target | ||
| 990 | # echo +192.168.0.101 > /sys/class/net/bond0/bonding/arp_ip_target | ||
| 991 | NOTE: up to 10 target addresses may be specified. | ||
| 992 | |||
| 993 | To remove an ARP target: | ||
| 994 | # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target | ||
| 995 | |||
| 996 | Example Configuration | ||
| 997 | --------------------- | ||
| 998 | We begin with the same example that is shown in section 3.3, | ||
| 999 | executed with sysfs, and without using ifenslave. | ||
| 1000 | |||
| 1001 | To make a simple bond of two e100 devices (presumed to be eth0 | ||
| 1002 | and eth1), and have it persist across reboots, edit the appropriate | ||
| 1003 | file (/etc/init.d/boot.local or /etc/rc.d/rc.local), and add the | ||
| 1004 | following: | ||
| 1005 | |||
| 1006 | modprobe bonding | ||
| 1007 | modprobe e100 | ||
| 1008 | echo balance-alb > /sys/class/net/bond0/bonding/mode | ||
| 1009 | ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up | ||
| 1010 | echo 100 > /sys/class/net/bond0/bonding/miimon | ||
| 1011 | echo +eth0 > /sys/class/net/bond0/bonding/slaves | ||
| 1012 | echo +eth1 > /sys/class/net/bond0/bonding/slaves | ||
| 1013 | |||
| 1014 | To add a second bond, with two e1000 interfaces in | ||
| 1015 | active-backup mode, using ARP monitoring, add the following lines to | ||
| 1016 | your init script: | ||
| 1017 | |||
| 1018 | modprobe e1000 | ||
| 1019 | echo +bond1 > /sys/class/net/bonding_masters | ||
| 1020 | echo active-backup > /sys/class/net/bond1/bonding/mode | ||
| 1021 | ifconfig bond1 192.168.2.1 netmask 255.255.255.0 up | ||
| 1022 | echo +192.168.2.100 /sys/class/net/bond1/bonding/arp_ip_target | ||
| 1023 | echo 2000 > /sys/class/net/bond1/bonding/arp_interval | ||
| 1024 | echo +eth2 > /sys/class/net/bond1/bonding/slaves | ||
| 1025 | echo +eth3 > /sys/class/net/bond1/bonding/slaves | ||
| 1026 | |||
| 892 | 1027 | ||
| 893 | 5. Querying Bonding Configuration | 1028 | 4. Querying Bonding Configuration |
| 894 | ================================= | 1029 | ================================= |
| 895 | 1030 | ||
| 896 | 5.1 Bonding Configuration | 1031 | 4.1 Bonding Configuration |
| 897 | ------------------------- | 1032 | ------------------------- |
| 898 | 1033 | ||
| 899 | Each bonding device has a read-only file residing in the | 1034 | Each bonding device has a read-only file residing in the |
| @@ -923,7 +1058,7 @@ generally as follows: | |||
| 923 | The precise format and contents will change depending upon the | 1058 | The precise format and contents will change depending upon the |
| 924 | bonding configuration, state, and version of the bonding driver. | 1059 | bonding configuration, state, and version of the bonding driver. |
| 925 | 1060 | ||
| 926 | 5.2 Network configuration | 1061 | 4.2 Network configuration |
| 927 | ------------------------- | 1062 | ------------------------- |
| 928 | 1063 | ||
| 929 | The network configuration can be inspected using the ifconfig | 1064 | The network configuration can be inspected using the ifconfig |
| @@ -958,7 +1093,7 @@ eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 | |||
| 958 | collisions:0 txqueuelen:100 | 1093 | collisions:0 txqueuelen:100 |
| 959 | Interrupt:9 Base address:0x1400 | 1094 | Interrupt:9 Base address:0x1400 |
| 960 | 1095 | ||
| 961 | 6. Switch Configuration | 1096 | 5. Switch Configuration |
| 962 | ======================= | 1097 | ======================= |
| 963 | 1098 | ||
| 964 | For this section, "switch" refers to whatever system the | 1099 | For this section, "switch" refers to whatever system the |
| @@ -991,7 +1126,7 @@ transmit policy for an EtherChannel group; all three will interoperate | |||
| 991 | with another EtherChannel group. | 1126 | with another EtherChannel group. |
| 992 | 1127 | ||
| 993 | 1128 | ||
| 994 | 7. 802.1q VLAN Support | 1129 | 6. 802.1q VLAN Support |
| 995 | ====================== | 1130 | ====================== |
| 996 | 1131 | ||
| 997 | It is possible to configure VLAN devices over a bond interface | 1132 | It is possible to configure VLAN devices over a bond interface |
| @@ -1042,7 +1177,7 @@ underlying device -- i.e. the bonding interface -- to promiscuous | |||
| 1042 | mode, which might not be what you want. | 1177 | mode, which might not be what you want. |
| 1043 | 1178 | ||
| 1044 | 1179 | ||
| 1045 | 8. Link Monitoring | 1180 | 7. Link Monitoring |
| 1046 | ================== | 1181 | ================== |
| 1047 | 1182 | ||
| 1048 | The bonding driver at present supports two schemes for | 1183 | The bonding driver at present supports two schemes for |
| @@ -1053,7 +1188,7 @@ monitor. | |||
| 1053 | bonding driver itself, it is not possible to enable both ARP and MII | 1188 | bonding driver itself, it is not possible to enable both ARP and MII |
| 1054 | monitoring simultaneously. | 1189 | monitoring simultaneously. |
| 1055 | 1190 | ||
| 1056 | 8.1 ARP Monitor Operation | 1191 | 7.1 ARP Monitor Operation |
| 1057 | ------------------------- | 1192 | ------------------------- |
| 1058 | 1193 | ||
| 1059 | The ARP monitor operates as its name suggests: it sends ARP | 1194 | The ARP monitor operates as its name suggests: it sends ARP |
| @@ -1071,7 +1206,7 @@ those slaves will stay down. If networking monitoring (tcpdump, etc) | |||
| 1071 | shows the ARP requests and replies on the network, then it may be that | 1206 | shows the ARP requests and replies on the network, then it may be that |
| 1072 | your device driver is not updating last_rx and trans_start. | 1207 | your device driver is not updating last_rx and trans_start. |
| 1073 | 1208 | ||
| 1074 | 8.2 Configuring Multiple ARP Targets | 1209 | 7.2 Configuring Multiple ARP Targets |
| 1075 | ------------------------------------ | 1210 | ------------------------------------ |
| 1076 | 1211 | ||
| 1077 | While ARP monitoring can be done with just one target, it can | 1212 | While ARP monitoring can be done with just one target, it can |
| @@ -1094,7 +1229,7 @@ alias bond0 bonding | |||
| 1094 | options bond0 arp_interval=60 arp_ip_target=192.168.0.100 | 1229 | options bond0 arp_interval=60 arp_ip_target=192.168.0.100 |
| 1095 | 1230 | ||
| 1096 | 1231 | ||
| 1097 | 8.3 MII Monitor Operation | 1232 | 7.3 MII Monitor Operation |
| 1098 | ------------------------- | 1233 | ------------------------- |
| 1099 | 1234 | ||
| 1100 | The MII monitor monitors only the carrier state of the local | 1235 | The MII monitor monitors only the carrier state of the local |
| @@ -1120,14 +1255,14 @@ does not support or had some error in processing both the MII register | |||
| 1120 | and ethtool requests), then the MII monitor will assume the link is | 1255 | and ethtool requests), then the MII monitor will assume the link is |
| 1121 | up. | 1256 | up. |
| 1122 | 1257 | ||
| 1123 | 9. Potential Sources of Trouble | 1258 | 8. Potential Sources of Trouble |
| 1124 | =============================== | 1259 | =============================== |
| 1125 | 1260 | ||
| 1126 | 9.1 Adventures in Routing | 1261 | 8.1 Adventures in Routing |
| 1127 | ------------------------- | 1262 | ------------------------- |
| 1128 | 1263 | ||
| 1129 | When bonding is configured, it is important that the slave | 1264 | When bonding is configured, it is important that the slave |
| 1130 | devices not have routes that supercede routes of the master (or, | 1265 | devices not have routes that supersede routes of the master (or, |
| 1131 | generally, not have routes at all). For example, suppose the bonding | 1266 | generally, not have routes at all). For example, suppose the bonding |
| 1132 | device bond0 has two slaves, eth0 and eth1, and the routing table is | 1267 | device bond0 has two slaves, eth0 and eth1, and the routing table is |
| 1133 | as follows: | 1268 | as follows: |
| @@ -1154,11 +1289,11 @@ by the state of the routing table. | |||
| 1154 | 1289 | ||
| 1155 | The solution here is simply to insure that slaves do not have | 1290 | The solution here is simply to insure that slaves do not have |
| 1156 | routes of their own, and if for some reason they must, those routes do | 1291 | routes of their own, and if for some reason they must, those routes do |
| 1157 | not supercede routes of their master. This should generally be the | 1292 | not supersede routes of their master. This should generally be the |
| 1158 | case, but unusual configurations or errant manual or automatic static | 1293 | case, but unusual configurations or errant manual or automatic static |
| 1159 | route additions may cause trouble. | 1294 | route additions may cause trouble. |
| 1160 | 1295 | ||
| 1161 | 9.2 Ethernet Device Renaming | 1296 | 8.2 Ethernet Device Renaming |
| 1162 | ---------------------------- | 1297 | ---------------------------- |
| 1163 | 1298 | ||
| 1164 | On systems with network configuration scripts that do not | 1299 | On systems with network configuration scripts that do not |
| @@ -1207,7 +1342,7 @@ modprobe with --ignore-install to cause the normal action to then take | |||
| 1207 | place. Full documentation on this can be found in the modprobe.conf | 1342 | place. Full documentation on this can be found in the modprobe.conf |
| 1208 | and modprobe manual pages. | 1343 | and modprobe manual pages. |
| 1209 | 1344 | ||
| 1210 | 9.3. Painfully Slow Or No Failed Link Detection By Miimon | 1345 | 8.3. Painfully Slow Or No Failed Link Detection By Miimon |
| 1211 | --------------------------------------------------------- | 1346 | --------------------------------------------------------- |
| 1212 | 1347 | ||
| 1213 | By default, bonding enables the use_carrier option, which | 1348 | By default, bonding enables the use_carrier option, which |
| @@ -1235,7 +1370,7 @@ carrier state. It has no way to determine the state of devices on or | |||
| 1235 | beyond other ports of a switch, or if a switch is refusing to pass | 1370 | beyond other ports of a switch, or if a switch is refusing to pass |
| 1236 | traffic while still maintaining carrier on. | 1371 | traffic while still maintaining carrier on. |
| 1237 | 1372 | ||
| 1238 | 10. SNMP agents | 1373 | 9. SNMP agents |
| 1239 | =============== | 1374 | =============== |
| 1240 | 1375 | ||
| 1241 | If running SNMP agents, the bonding driver should be loaded | 1376 | If running SNMP agents, the bonding driver should be loaded |
| @@ -1281,7 +1416,7 @@ ifDescr, the association between the IP address and IfIndex remains | |||
| 1281 | and SNMP functions such as Interface_Scan_Next will report that | 1416 | and SNMP functions such as Interface_Scan_Next will report that |
| 1282 | association. | 1417 | association. |
| 1283 | 1418 | ||
| 1284 | 11. Promiscuous mode | 1419 | 10. Promiscuous mode |
| 1285 | ==================== | 1420 | ==================== |
| 1286 | 1421 | ||
| 1287 | When running network monitoring tools, e.g., tcpdump, it is | 1422 | When running network monitoring tools, e.g., tcpdump, it is |
| @@ -1308,7 +1443,7 @@ sending to peers that are unassigned or if the load is unbalanced. | |||
| 1308 | the active slave changes (e.g., due to a link failure), the | 1443 | the active slave changes (e.g., due to a link failure), the |
| 1309 | promiscuous setting will be propagated to the new active slave. | 1444 | promiscuous setting will be propagated to the new active slave. |
| 1310 | 1445 | ||
| 1311 | 12. Configuring Bonding for High Availability | 1446 | 11. Configuring Bonding for High Availability |
| 1312 | ============================================= | 1447 | ============================================= |
| 1313 | 1448 | ||
| 1314 | High Availability refers to configurations that provide | 1449 | High Availability refers to configurations that provide |
| @@ -1318,7 +1453,7 @@ goal is to provide the maximum availability of network connectivity | |||
| 1318 | (i.e., the network always works), even though other configurations | 1453 | (i.e., the network always works), even though other configurations |
| 1319 | could provide higher throughput. | 1454 | could provide higher throughput. |
| 1320 | 1455 | ||
| 1321 | 12.1 High Availability in a Single Switch Topology | 1456 | 11.1 High Availability in a Single Switch Topology |
| 1322 | -------------------------------------------------- | 1457 | -------------------------------------------------- |
| 1323 | 1458 | ||
| 1324 | If two hosts (or a host and a single switch) are directly | 1459 | If two hosts (or a host and a single switch) are directly |
| @@ -1332,7 +1467,7 @@ the load will be rebalanced across the remaining devices. | |||
| 1332 | See Section 13, "Configuring Bonding for Maximum Throughput" | 1467 | See Section 13, "Configuring Bonding for Maximum Throughput" |
| 1333 | for information on configuring bonding with one peer device. | 1468 | for information on configuring bonding with one peer device. |
| 1334 | 1469 | ||
| 1335 | 12.2 High Availability in a Multiple Switch Topology | 1470 | 11.2 High Availability in a Multiple Switch Topology |
| 1336 | ---------------------------------------------------- | 1471 | ---------------------------------------------------- |
| 1337 | 1472 | ||
| 1338 | With multiple switches, the configuration of bonding and the | 1473 | With multiple switches, the configuration of bonding and the |
| @@ -1359,7 +1494,7 @@ switches (ISL, or inter switch link), and multiple ports connecting to | |||
| 1359 | the outside world ("port3" on each switch). There is no technical | 1494 | the outside world ("port3" on each switch). There is no technical |
| 1360 | reason that this could not be extended to a third switch. | 1495 | reason that this could not be extended to a third switch. |
| 1361 | 1496 | ||
| 1362 | 12.2.1 HA Bonding Mode Selection for Multiple Switch Topology | 1497 | 11.2.1 HA Bonding Mode Selection for Multiple Switch Topology |
| 1363 | ------------------------------------------------------------- | 1498 | ------------------------------------------------------------- |
| 1364 | 1499 | ||
| 1365 | In a topology such as the example above, the active-backup and | 1500 | In a topology such as the example above, the active-backup and |
| @@ -1381,7 +1516,7 @@ broadcast: This mode is really a special purpose mode, and is suitable | |||
| 1381 | necessary for some specific one-way traffic to reach both | 1516 | necessary for some specific one-way traffic to reach both |
| 1382 | independent networks, then the broadcast mode may be suitable. | 1517 | independent networks, then the broadcast mode may be suitable. |
| 1383 | 1518 | ||
| 1384 | 12.2.2 HA Link Monitoring Selection for Multiple Switch Topology | 1519 | 11.2.2 HA Link Monitoring Selection for Multiple Switch Topology |
| 1385 | ---------------------------------------------------------------- | 1520 | ---------------------------------------------------------------- |
| 1386 | 1521 | ||
| 1387 | The choice of link monitoring ultimately depends upon your | 1522 | The choice of link monitoring ultimately depends upon your |
| @@ -1402,10 +1537,10 @@ regardless of which switch is active, the ARP monitor has a suitable | |||
| 1402 | target to query. | 1537 | target to query. |
| 1403 | 1538 | ||
| 1404 | 1539 | ||
| 1405 | 13. Configuring Bonding for Maximum Throughput | 1540 | 12. Configuring Bonding for Maximum Throughput |
| 1406 | ============================================== | 1541 | ============================================== |
| 1407 | 1542 | ||
| 1408 | 13.1 Maximizing Throughput in a Single Switch Topology | 1543 | 12.1 Maximizing Throughput in a Single Switch Topology |
| 1409 | ------------------------------------------------------ | 1544 | ------------------------------------------------------ |
| 1410 | 1545 | ||
| 1411 | In a single switch configuration, the best method to maximize | 1546 | In a single switch configuration, the best method to maximize |
| @@ -1476,7 +1611,7 @@ destination to make load balancing decisions. The behavior of each | |||
| 1476 | mode is described below. | 1611 | mode is described below. |
| 1477 | 1612 | ||
| 1478 | 1613 | ||
| 1479 | 13.1.1 MT Bonding Mode Selection for Single Switch Topology | 1614 | 12.1.1 MT Bonding Mode Selection for Single Switch Topology |
| 1480 | ----------------------------------------------------------- | 1615 | ----------------------------------------------------------- |
| 1481 | 1616 | ||
| 1482 | This configuration is the easiest to set up and to understand, | 1617 | This configuration is the easiest to set up and to understand, |
| @@ -1607,7 +1742,7 @@ balance-alb: This mode is everything that balance-tlb is, and more. | |||
| 1607 | device driver must support changing the hardware address while | 1742 | device driver must support changing the hardware address while |
| 1608 | the device is open. | 1743 | the device is open. |
| 1609 | 1744 | ||
| 1610 | 13.1.2 MT Link Monitoring for Single Switch Topology | 1745 | 12.1.2 MT Link Monitoring for Single Switch Topology |
| 1611 | ---------------------------------------------------- | 1746 | ---------------------------------------------------- |
| 1612 | 1747 | ||
| 1613 | The choice of link monitoring may largely depend upon which | 1748 | The choice of link monitoring may largely depend upon which |
| @@ -1616,7 +1751,7 @@ support the use of the ARP monitor, and are thus restricted to using | |||
| 1616 | the MII monitor (which does not provide as high a level of end to end | 1751 | the MII monitor (which does not provide as high a level of end to end |
| 1617 | assurance as the ARP monitor). | 1752 | assurance as the ARP monitor). |
| 1618 | 1753 | ||
| 1619 | 13.2 Maximum Throughput in a Multiple Switch Topology | 1754 | 12.2 Maximum Throughput in a Multiple Switch Topology |
| 1620 | ----------------------------------------------------- | 1755 | ----------------------------------------------------- |
| 1621 | 1756 | ||
| 1622 | Multiple switches may be utilized to optimize for throughput | 1757 | Multiple switches may be utilized to optimize for throughput |
| @@ -1651,7 +1786,7 @@ a single 72 port switch. | |||
| 1651 | can be equipped with an additional network device connected to an | 1786 | can be equipped with an additional network device connected to an |
| 1652 | external network; this host then additionally acts as a gateway. | 1787 | external network; this host then additionally acts as a gateway. |
| 1653 | 1788 | ||
| 1654 | 13.2.1 MT Bonding Mode Selection for Multiple Switch Topology | 1789 | 12.2.1 MT Bonding Mode Selection for Multiple Switch Topology |
| 1655 | ------------------------------------------------------------- | 1790 | ------------------------------------------------------------- |
| 1656 | 1791 | ||
| 1657 | In actual practice, the bonding mode typically employed in | 1792 | In actual practice, the bonding mode typically employed in |
| @@ -1664,7 +1799,7 @@ packets has arrived). When employed in this fashion, the balance-rr | |||
| 1664 | mode allows individual connections between two hosts to effectively | 1799 | mode allows individual connections between two hosts to effectively |
| 1665 | utilize greater than one interface's bandwidth. | 1800 | utilize greater than one interface's bandwidth. |
| 1666 | 1801 | ||
| 1667 | 13.2.2 MT Link Monitoring for Multiple Switch Topology | 1802 | 12.2.2 MT Link Monitoring for Multiple Switch Topology |
| 1668 | ------------------------------------------------------ | 1803 | ------------------------------------------------------ |
| 1669 | 1804 | ||
| 1670 | Again, in actual practice, the MII monitor is most often used | 1805 | Again, in actual practice, the MII monitor is most often used |
| @@ -1674,10 +1809,10 @@ advantages over the MII monitor are mitigated by the volume of probes | |||
| 1674 | needed as the number of systems involved grows (remember that each | 1809 | needed as the number of systems involved grows (remember that each |
| 1675 | host in the network is configured with bonding). | 1810 | host in the network is configured with bonding). |
| 1676 | 1811 | ||
| 1677 | 14. Switch Behavior Issues | 1812 | 13. Switch Behavior Issues |
| 1678 | ========================== | 1813 | ========================== |
| 1679 | 1814 | ||
| 1680 | 14.1 Link Establishment and Failover Delays | 1815 | 13.1 Link Establishment and Failover Delays |
| 1681 | ------------------------------------------- | 1816 | ------------------------------------------- |
| 1682 | 1817 | ||
| 1683 | Some switches exhibit undesirable behavior with regard to the | 1818 | Some switches exhibit undesirable behavior with regard to the |
| @@ -1712,7 +1847,7 @@ switches take a long time to go into backup mode, it may be desirable | |||
| 1712 | to not activate a backup interface immediately after a link goes down. | 1847 | to not activate a backup interface immediately after a link goes down. |
| 1713 | Failover may be delayed via the downdelay bonding module option. | 1848 | Failover may be delayed via the downdelay bonding module option. |
| 1714 | 1849 | ||
| 1715 | 14.2 Duplicated Incoming Packets | 1850 | 13.2 Duplicated Incoming Packets |
| 1716 | -------------------------------- | 1851 | -------------------------------- |
| 1717 | 1852 | ||
| 1718 | It is not uncommon to observe a short burst of duplicated | 1853 | It is not uncommon to observe a short burst of duplicated |
| @@ -1751,14 +1886,14 @@ behavior, it can be induced by clearing the MAC forwarding table (on | |||
| 1751 | most Cisco switches, the privileged command "clear mac address-table | 1886 | most Cisco switches, the privileged command "clear mac address-table |
| 1752 | dynamic" will accomplish this). | 1887 | dynamic" will accomplish this). |
| 1753 | 1888 | ||
| 1754 | 15. Hardware Specific Considerations | 1889 | 14. Hardware Specific Considerations |
| 1755 | ==================================== | 1890 | ==================================== |
| 1756 | 1891 | ||
| 1757 | This section contains additional information for configuring | 1892 | This section contains additional information for configuring |
| 1758 | bonding on specific hardware platforms, or for interfacing bonding | 1893 | bonding on specific hardware platforms, or for interfacing bonding |
| 1759 | with particular switches or other devices. | 1894 | with particular switches or other devices. |
| 1760 | 1895 | ||
| 1761 | 15.1 IBM BladeCenter | 1896 | 14.1 IBM BladeCenter |
| 1762 | -------------------- | 1897 | -------------------- |
| 1763 | 1898 | ||
| 1764 | This applies to the JS20 and similar systems. | 1899 | This applies to the JS20 and similar systems. |
| @@ -1861,7 +1996,7 @@ bonding driver. | |||
| 1861 | avoid fail-over delay issues when using bonding. | 1996 | avoid fail-over delay issues when using bonding. |
| 1862 | 1997 | ||
| 1863 | 1998 | ||
| 1864 | 16. Frequently Asked Questions | 1999 | 15. Frequently Asked Questions |
| 1865 | ============================== | 2000 | ============================== |
| 1866 | 2001 | ||
| 1867 | 1. Is it SMP safe? | 2002 | 1. Is it SMP safe? |
| @@ -1925,7 +2060,7 @@ not have special switch requirements, but do need device drivers that | |||
| 1925 | support specific features (described in the appropriate section under | 2060 | support specific features (described in the appropriate section under |
| 1926 | module parameters, above). | 2061 | module parameters, above). |
| 1927 | 2062 | ||
| 1928 | In 802.3ad mode, it works with with systems that support IEEE | 2063 | In 802.3ad mode, it works with systems that support IEEE |
| 1929 | 802.3ad Dynamic Link Aggregation. Most managed and many unmanaged | 2064 | 802.3ad Dynamic Link Aggregation. Most managed and many unmanaged |
| 1930 | switches currently available support 802.3ad. | 2065 | switches currently available support 802.3ad. |
| 1931 | 2066 | ||
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 31ac001f5517..f37170cc1a37 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
| @@ -2780,6 +2780,80 @@ static void e100_shutdown(struct pci_dev *pdev) | |||
| 2780 | DPRINTK(PROBE,ERR, "Error enabling wake\n"); | 2780 | DPRINTK(PROBE,ERR, "Error enabling wake\n"); |
| 2781 | } | 2781 | } |
| 2782 | 2782 | ||
| 2783 | /* ------------------ PCI Error Recovery infrastructure -------------- */ | ||
| 2784 | /** | ||
| 2785 | * e100_io_error_detected - called when PCI error is detected. | ||
| 2786 | * @pdev: Pointer to PCI device | ||
| 2787 | * @state: The current pci conneection state | ||
| 2788 | */ | ||
| 2789 | static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | ||
| 2790 | { | ||
| 2791 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 2792 | |||
| 2793 | /* Similar to calling e100_down(), but avoids adpater I/O. */ | ||
| 2794 | netdev->stop(netdev); | ||
| 2795 | |||
| 2796 | /* Detach; put netif into state similar to hotplug unplug. */ | ||
| 2797 | netif_poll_enable(netdev); | ||
| 2798 | netif_device_detach(netdev); | ||
| 2799 | |||
| 2800 | /* Request a slot reset. */ | ||
| 2801 | return PCI_ERS_RESULT_NEED_RESET; | ||
| 2802 | } | ||
| 2803 | |||
| 2804 | /** | ||
| 2805 | * e100_io_slot_reset - called after the pci bus has been reset. | ||
| 2806 | * @pdev: Pointer to PCI device | ||
| 2807 | * | ||
| 2808 | * Restart the card from scratch. | ||
| 2809 | */ | ||
| 2810 | static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev) | ||
| 2811 | { | ||
| 2812 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 2813 | struct nic *nic = netdev_priv(netdev); | ||
| 2814 | |||
| 2815 | if (pci_enable_device(pdev)) { | ||
| 2816 | printk(KERN_ERR "e100: Cannot re-enable PCI device after reset.\n"); | ||
| 2817 | return PCI_ERS_RESULT_DISCONNECT; | ||
| 2818 | } | ||
| 2819 | pci_set_master(pdev); | ||
| 2820 | |||
| 2821 | /* Only one device per card can do a reset */ | ||
| 2822 | if (0 != PCI_FUNC(pdev->devfn)) | ||
| 2823 | return PCI_ERS_RESULT_RECOVERED; | ||
| 2824 | e100_hw_reset(nic); | ||
| 2825 | e100_phy_init(nic); | ||
| 2826 | |||
| 2827 | return PCI_ERS_RESULT_RECOVERED; | ||
| 2828 | } | ||
| 2829 | |||
| 2830 | /** | ||
| 2831 | * e100_io_resume - resume normal operations | ||
| 2832 | * @pdev: Pointer to PCI device | ||
| 2833 | * | ||
| 2834 | * Resume normal operations after an error recovery | ||
| 2835 | * sequence has been completed. | ||
| 2836 | */ | ||
| 2837 | static void e100_io_resume(struct pci_dev *pdev) | ||
| 2838 | { | ||
| 2839 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 2840 | struct nic *nic = netdev_priv(netdev); | ||
| 2841 | |||
| 2842 | /* ack any pending wake events, disable PME */ | ||
| 2843 | pci_enable_wake(pdev, 0, 0); | ||
| 2844 | |||
| 2845 | netif_device_attach(netdev); | ||
| 2846 | if (netif_running(netdev)) { | ||
| 2847 | e100_open(netdev); | ||
| 2848 | mod_timer(&nic->watchdog, jiffies); | ||
| 2849 | } | ||
| 2850 | } | ||
| 2851 | |||
| 2852 | static struct pci_error_handlers e100_err_handler = { | ||
| 2853 | .error_detected = e100_io_error_detected, | ||
| 2854 | .slot_reset = e100_io_slot_reset, | ||
| 2855 | .resume = e100_io_resume, | ||
| 2856 | }; | ||
| 2783 | 2857 | ||
| 2784 | static struct pci_driver e100_driver = { | 2858 | static struct pci_driver e100_driver = { |
| 2785 | .name = DRV_NAME, | 2859 | .name = DRV_NAME, |
| @@ -2791,6 +2865,7 @@ static struct pci_driver e100_driver = { | |||
| 2791 | .resume = e100_resume, | 2865 | .resume = e100_resume, |
| 2792 | #endif | 2866 | #endif |
| 2793 | .shutdown = e100_shutdown, | 2867 | .shutdown = e100_shutdown, |
| 2868 | .err_handler = &e100_err_handler, | ||
| 2794 | }; | 2869 | }; |
| 2795 | 2870 | ||
| 2796 | static int __init e100_init_module(void) | 2871 | static int __init e100_init_module(void) |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 115eff25d8c1..56c7492e3e91 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
| @@ -189,6 +189,16 @@ static void e1000_shutdown(struct pci_dev *pdev); | |||
| 189 | static void e1000_netpoll (struct net_device *netdev); | 189 | static void e1000_netpoll (struct net_device *netdev); |
| 190 | #endif | 190 | #endif |
| 191 | 191 | ||
| 192 | static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, | ||
| 193 | pci_channel_state_t state); | ||
| 194 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev); | ||
| 195 | static void e1000_io_resume(struct pci_dev *pdev); | ||
| 196 | |||
| 197 | static struct pci_error_handlers e1000_err_handler = { | ||
| 198 | .error_detected = e1000_io_error_detected, | ||
| 199 | .slot_reset = e1000_io_slot_reset, | ||
| 200 | .resume = e1000_io_resume, | ||
| 201 | }; | ||
| 192 | 202 | ||
| 193 | static struct pci_driver e1000_driver = { | 203 | static struct pci_driver e1000_driver = { |
| 194 | .name = e1000_driver_name, | 204 | .name = e1000_driver_name, |
| @@ -200,7 +210,8 @@ static struct pci_driver e1000_driver = { | |||
| 200 | .suspend = e1000_suspend, | 210 | .suspend = e1000_suspend, |
| 201 | .resume = e1000_resume, | 211 | .resume = e1000_resume, |
| 202 | #endif | 212 | #endif |
| 203 | .shutdown = e1000_shutdown | 213 | .shutdown = e1000_shutdown, |
| 214 | .err_handler = &e1000_err_handler | ||
| 204 | }; | 215 | }; |
| 205 | 216 | ||
| 206 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); | 217 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
| @@ -3039,6 +3050,10 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
| 3039 | 3050 | ||
| 3040 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF | 3051 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF |
| 3041 | 3052 | ||
| 3053 | /* Prevent stats update while adapter is being reset */ | ||
| 3054 | if (adapter->link_speed == 0) | ||
| 3055 | return; | ||
| 3056 | |||
| 3042 | spin_lock_irqsave(&adapter->stats_lock, flags); | 3057 | spin_lock_irqsave(&adapter->stats_lock, flags); |
| 3043 | 3058 | ||
| 3044 | /* these counters are modified from e1000_adjust_tbi_stats, | 3059 | /* these counters are modified from e1000_adjust_tbi_stats, |
| @@ -4590,4 +4605,101 @@ e1000_netpoll(struct net_device *netdev) | |||
| 4590 | } | 4605 | } |
| 4591 | #endif | 4606 | #endif |
| 4592 | 4607 | ||
| 4608 | /** | ||
| 4609 | * e1000_io_error_detected - called when PCI error is detected | ||
| 4610 | * @pdev: Pointer to PCI device | ||
| 4611 | * @state: The current pci conneection state | ||
| 4612 | * | ||
| 4613 | * This function is called after a PCI bus error affecting | ||
| 4614 | * this device has been detected. | ||
| 4615 | */ | ||
| 4616 | static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | ||
| 4617 | { | ||
| 4618 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 4619 | struct e1000_adapter *adapter = netdev->priv; | ||
| 4620 | |||
| 4621 | netif_device_detach(netdev); | ||
| 4622 | |||
| 4623 | if (netif_running(netdev)) | ||
| 4624 | e1000_down(adapter); | ||
| 4625 | |||
| 4626 | /* Request a slot slot reset. */ | ||
| 4627 | return PCI_ERS_RESULT_NEED_RESET; | ||
| 4628 | } | ||
| 4629 | |||
| 4630 | /** | ||
| 4631 | * e1000_io_slot_reset - called after the pci bus has been reset. | ||
| 4632 | * @pdev: Pointer to PCI device | ||
| 4633 | * | ||
| 4634 | * Restart the card from scratch, as if from a cold-boot. Implementation | ||
| 4635 | * resembles the first-half of the e1000_resume routine. | ||
| 4636 | */ | ||
| 4637 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | ||
| 4638 | { | ||
| 4639 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 4640 | struct e1000_adapter *adapter = netdev->priv; | ||
| 4641 | |||
| 4642 | if (pci_enable_device(pdev)) { | ||
| 4643 | printk(KERN_ERR "e1000: Cannot re-enable PCI device after reset.\n"); | ||
| 4644 | return PCI_ERS_RESULT_DISCONNECT; | ||
| 4645 | } | ||
| 4646 | pci_set_master(pdev); | ||
| 4647 | |||
| 4648 | pci_enable_wake(pdev, 3, 0); | ||
| 4649 | pci_enable_wake(pdev, 4, 0); /* 4 == D3 cold */ | ||
| 4650 | |||
| 4651 | /* Perform card reset only on one instance of the card */ | ||
| 4652 | if (PCI_FUNC (pdev->devfn) != 0) | ||
| 4653 | return PCI_ERS_RESULT_RECOVERED; | ||
| 4654 | |||
| 4655 | e1000_reset(adapter); | ||
| 4656 | E1000_WRITE_REG(&adapter->hw, WUS, ~0); | ||
| 4657 | |||
| 4658 | return PCI_ERS_RESULT_RECOVERED; | ||
| 4659 | } | ||
| 4660 | |||
| 4661 | /** | ||
| 4662 | * e1000_io_resume - called when traffic can start flowing again. | ||
| 4663 | * @pdev: Pointer to PCI device | ||
| 4664 | * | ||
| 4665 | * This callback is called when the error recovery driver tells us that | ||
| 4666 | * its OK to resume normal operation. Implementation resembles the | ||
| 4667 | * second-half of the e1000_resume routine. | ||
| 4668 | */ | ||
| 4669 | static void e1000_io_resume(struct pci_dev *pdev) | ||
| 4670 | { | ||
| 4671 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 4672 | struct e1000_adapter *adapter = netdev->priv; | ||
| 4673 | uint32_t manc, swsm; | ||
| 4674 | |||
| 4675 | if (netif_running(netdev)) { | ||
| 4676 | if (e1000_up(adapter)) { | ||
| 4677 | printk("e1000: can't bring device back up after reset\n"); | ||
| 4678 | return; | ||
| 4679 | } | ||
| 4680 | } | ||
| 4681 | |||
| 4682 | netif_device_attach(netdev); | ||
| 4683 | |||
| 4684 | if (adapter->hw.mac_type >= e1000_82540 && | ||
| 4685 | adapter->hw.media_type == e1000_media_type_copper) { | ||
| 4686 | manc = E1000_READ_REG(&adapter->hw, MANC); | ||
| 4687 | manc &= ~(E1000_MANC_ARP_EN); | ||
| 4688 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
| 4689 | } | ||
| 4690 | |||
| 4691 | switch (adapter->hw.mac_type) { | ||
| 4692 | case e1000_82573: | ||
| 4693 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | ||
| 4694 | E1000_WRITE_REG(&adapter->hw, SWSM, | ||
| 4695 | swsm | E1000_SWSM_DRV_LOAD); | ||
| 4696 | break; | ||
| 4697 | default: | ||
| 4698 | break; | ||
| 4699 | } | ||
| 4700 | |||
| 4701 | if (netif_running(netdev)) | ||
| 4702 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
| 4703 | } | ||
| 4704 | |||
| 4593 | /* e1000_main.c */ | 4705 | /* e1000_main.c */ |
