From 2d2fc4992aa1c986fea1bb147d815d3de0483819 Mon Sep 17 00:00:00 2001 From: jfv Date: Wed, 30 May 2007 23:32:21 +0000 Subject: [PATCH] A few small but significant fixes: - Coverity Prevent(tm) CID 1906 a bogus use of bzero where unneeded. - ICH8 systems autoneg to 100 rather than 1000, this can also be seen in 82573, the logic was backwards. - On new 82575 quadports half duplex tx speed is slow... this was due to overwriting TCTL reg rather than adding bits. --- sys/dev/em/README | 74 +++++++++++++++++++--------------------------- sys/dev/em/if_em.c | 43 ++++++++++++++------------- 2 files changed, 54 insertions(+), 63 deletions(-) diff --git a/sys/dev/em/README b/sys/dev/em/README index b6ff5a67af33..f0816f0309a5 100644 --- a/sys/dev/em/README +++ b/sys/dev/em/README @@ -1,8 +1,8 @@ $FreeBSD$ -FreeBSD Driver for the Gigabit Family of Adapters -============================================================ +FreeBSD* Driver for Intel Network Connection +============================================= -April 18, 2007 +May 30, 2007 Contents @@ -21,8 +21,8 @@ Contents Overview ======== -This file describes the FreeBSD* driver for the Gigabit Family of -Adapters. This driver has been developed for use with FreeBSD, Release 6.x. +This file describes the FreeBSD* driver for Intel Network Connection. +This driver has been developed for use with FreeBSD, Release 7.x. For questions related to hardware requirements, refer to the documentation supplied with your Gigabit adapter. All hardware requirements listed @@ -88,13 +88,6 @@ name of the driver tar file. cd em-x.x.x/src cp *.[ch] /usr/src/sys/dev/em - cp Makefile.kernel /usr/src/sys/modules/em/Makefile - - NOTE: At this point you MUST install a patch, kernbuild.patch, which is - located in the patches directory. This is applied as shown below where - "$PATH_TO_KERNBUILD_PATCH" is the location of the kernbuild.patch: - - cd /usr/src/sys; patch -p1 < $PATH_TO_KERNBUILD_PATCH Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in /usr/src/sys/i386/conf, and ensure the following line is present: @@ -211,6 +204,8 @@ Identifying Your Adapter section. Intel(R) PRO/1000 PT Network Connection Intel(R) PRO/1000 PT Dual Port Server Adapter Intel(R) PRO/1000 PT Dual Port Network Connection + Intel(R) PRO/1000 PT Quad Port Server Adapter + Intel(R) PRO/1000 PF Quad Port Server Adapter Intel(R) PRO/1000 PF Server Adapter Intel(R) PRO/1000 PF Network Connection Intel(R) PRO/1000 PF Dual Port Server Adapter @@ -262,16 +257,11 @@ Identifying Your Adapter section. To remove a VLAN interface: - ifconfig destroy + Intel Network Connection ifconfig destroy Polling ------- - NOTES: Device Polling is only valid for non-SMP (Symmetric MultiProcessing) - kernels. - - The driver has to be compiled into the kernel for Device Polling to be - enabled in the driver. To enable polling in the driver, add the following options to the kernel configuration, and then recompile the kernel: @@ -280,9 +270,9 @@ Identifying Your Adapter section. options HZ=1000 At runtime use: - sysctl kern.polling.enable=1 to turn polling on - Use: - sysctl kern.polling.enable=0 to turn polling off + ifconfig emX polling (to turn polling on) + and: + ifconfig emX -polling (to turn it off) Checksum Offload @@ -317,20 +307,25 @@ Identifying Your Adapter section. TSO --- - The FreeBSD driver now offers support for TSO (TCP Segmentation Offload). - To enable this support perform the following: + The FreeBSD driver offers support for TSO (TCP Segmentation Offload). - Patch the kernel with the patch supplied in the tarball. - Rebuild and install the kernel. - Recompile the driver. You must alter the Makefile to build the driver with - E1000_TSO defined. + You can enable/disable it in two ways/places: - Enable or disable TSO: - sysctl net.inet.tcp.tso=1 or 0 - 0=disabled, 1=enabled (TSO is enabled by default). + - sysctl net.inet.tcp.tso=0 (or 1 to enable it) - NOTE: TSO is not supported on 82547 and 82544-based adapters, as well as - older adapters. + Doing this disables TSO in the stack and will affect all adapters. + + - ifconfig emX -tso + + Doing this will disable TSO only for this adapter. + + To enable: + + - ifconfig emX tso + + NOTES: By default only PCI-Express adapters are ENABLED to do TSO. Others + can be enabled by the user at their own risk + TSO is not supported on 82547 and 82544-based adapters, as well as older adapters. Known Limitations @@ -346,13 +341,6 @@ Known Limitations check your system's BIOS by downloading the Linux Firmware Developer Kit that can be obtained at http://www.linuxfirmwarekit.org/ - FreeBSD version 4.x with Symmetric MultiProcessing (SMP) - -------------------------------------------------------- - - In FreeBSD version 4.x with Symmetric MultiProcessing (SMP), there is a known - issue on some newer hardware. The problem is kernel generic and only in SMP - mode. The workaround is to either use FreeBSD version 4.x in single processor - mode, or use FreeBSD 5.4 or later. There are known performance issues with this driver when running UDP traffic with Jumbo Frames. @@ -369,12 +357,12 @@ Known Limitations The driver can be compiled with the following changes: - Edit ./em.x.x.x/src/if_em.h to uncomment the #define E1000_MASTER_SLAVE - from within the comments. For example, change from: + Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE + For example, change from: - /* #define E1000_MASTER_SLAVE 2 */ + #define EM_MASTER_SLAVE e1000_ms_hw_default to: - #define E1000_MASTER_SLAVE 2 + #define EM_MASTER_SLAVE 2 Use one of the following options: 1 = Master mode diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index 07eeec5fb5e4..3db569d1b1a1 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -89,7 +89,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "Version - 6.5.2"; +char em_driver_version[] = "Version - 6.5.3"; /********************************************************************* @@ -720,10 +720,10 @@ em_attach(device_t dev) adapter->pcix_82544 = FALSE; /* Get control from any management/hw control */ - if (((adapter->hw.mac.type != e1000_82573) && - (adapter->hw.mac.type != e1000_ich8lan) && - (adapter->hw.mac.type != e1000_ich9lan)) || - !e1000_check_mng_mode(&adapter->hw)) + if (((adapter->hw.mac.type == e1000_82573) || + (adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_ich9lan)) && + e1000_check_mng_mode(&adapter->hw)) em_get_hw_control(adapter); /* Tell the stack that the interface is not active */ @@ -779,11 +779,13 @@ em_detach(device_t dev) e1000_phy_hw_reset(&adapter->hw); em_release_manageability(adapter); - if (((adapter->hw.mac.type != e1000_82573) && - (adapter->hw.mac.type != e1000_ich8lan) && - (adapter->hw.mac.type != e1000_ich9lan)) || - !e1000_check_mng_mode(&adapter->hw)) + + if (((adapter->hw.mac.type == e1000_82573) || + (adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_ich9lan)) && + e1000_check_mng_mode(&adapter->hw)) em_release_hw_control(adapter); + if (adapter->wol) { E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); @@ -845,11 +847,13 @@ em_suspend(device_t dev) em_stop(adapter); em_release_manageability(adapter); - if (((adapter->hw.mac.type != e1000_82573) && - (adapter->hw.mac.type != e1000_ich8lan) && - (adapter->hw.mac.type != e1000_ich9lan)) || - !e1000_check_mng_mode(&adapter->hw)) + + if (((adapter->hw.mac.type == e1000_82573) || + (adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_ich9lan)) && + e1000_check_mng_mode(&adapter->hw)) em_release_hw_control(adapter); + if (adapter->wol) { E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); @@ -871,10 +875,10 @@ em_resume(device_t dev) em_init_locked(adapter); /* Get control from any management/hw control */ - if (((adapter->hw.mac.type != e1000_82573) && - (adapter->hw.mac.type != e1000_ich8lan) && - (adapter->hw.mac.type != e1000_ich9lan)) || - !e1000_check_mng_mode(&adapter->hw)) + if (((adapter->hw.mac.type == e1000_82573) || + (adapter->hw.mac.type == e1000_ich8lan) || + (adapter->hw.mac.type == e1000_ich9lan)) && + e1000_check_mng_mode(&adapter->hw)) em_get_hw_control(adapter); em_init_manageability(adapter); @@ -3151,8 +3155,8 @@ em_initialize_transmit_unit(struct adapter *adapter) /* Program the Transmit Control Register */ tctl = E1000_READ_REG(&adapter->hw, E1000_TCTL); tctl &= ~E1000_TCTL_CT; - tctl = E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN | - (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); + tctl |= (E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN | + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT)); if (adapter->hw.mac.type >= e1000_82571) tctl |= E1000_TCTL_MULR; @@ -4628,7 +4632,6 @@ e1000_alloc_zeroed_dev_spec_struct(struct e1000_hw *hw, uint32_t size) hw->dev_spec = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); if (hw->dev_spec == NULL) error = ENOMEM; - bzero(hw->dev_spec, size); return (error); }