From owner-svn-src-all@FreeBSD.ORG Thu Jun 2 00:34:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41056106566C; Thu, 2 Jun 2011 00:34:58 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31F9E8FC08; Thu, 2 Jun 2011 00:34:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p520YwJ4093290; Thu, 2 Jun 2011 00:34:58 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p520YwBu093285; Thu, 2 Jun 2011 00:34:58 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201106020034.p520YwBu093285@svn.freebsd.org> From: Jack F Vogel Date: Thu, 2 Jun 2011 00:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222588 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 00:34:58 -0000 Author: jfv Date: Thu Jun 2 00:34:57 2011 New Revision: 222588 URL: http://svn.freebsd.org/changeset/base/222588 Log: First off: update the driver README, the old one was horribly crusty, and this still isn't perfect, but its at least a bit more recent. Secondly, a few improvements to the driver from Andrew Boyer, support hint to allow devices to not attach, add VLAN_HWTSO capability so vlans can use TSO, fix in the interrupt handler to make sure the stack TX queue is processed. Oh, and also make sure IPv6 does not cause a re-init in the ioctl routine. Thanks for your efforts Andrew! Thanks to Claudio Jeker for noticing the ixgbe_xmit() routine was not correctly swapping the dma map from the first to the last descriptor in a multi-descriptor transmission, corrected this. Modified: head/sys/dev/ixgbe/LICENSE head/sys/dev/ixgbe/README head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c Modified: head/sys/dev/ixgbe/LICENSE ============================================================================== --- head/sys/dev/ixgbe/LICENSE Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/LICENSE Thu Jun 2 00:34:57 2011 (r222588) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/ixgbe/README ============================================================================== --- head/sys/dev/ixgbe/README Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/README Thu Jun 2 00:34:57 2011 (r222588) @@ -1,8 +1,8 @@ -FreeBSD Driver for 10 Gigabit PCI Express Server Adapters -============================================= +FreeBSD Driver for Intel(R) Ethernet 10 Gigabit PCI Express Server Adapters +============================================================================ /*$FreeBSD$*/ -May 14, 2008 +November 12, 2010 Contents @@ -11,15 +11,15 @@ Contents - Overview - Supported Adapters - Building and Installation -- Additional Configurations +- Additional Configurations and Tuning - Known Limitations Overview ======== -This file describes the FreeBSD* driver for the 10 Gigabit PCIE Family of -Adapters. Drivers has been developed for use with FreeBSD 7 or later. +This file describes the FreeBSD* driver for the Intel(R) Ethernet 10 Gigabit +Family of Adapters. Driver has been developed for use with FreeBSD 7.2 or later. For questions related to hardware requirements, refer to the documentation supplied with your Intel 10GbE adapter. All hardware requirements listed @@ -29,100 +29,98 @@ apply to use with FreeBSD. Supported Adapters ================== -The following Intel network adapters are compatible with the drivers in this -release: - -Controller Adapter Name Physical Layer ----------- ------------ -------------- -82598EB Intel(R) 10 Gigabit XF SR/AF 10G Base -LR (850 nm optical fiber) - Dual Port Server Adapter 10G Base -SR (1310 nm optical fiber) -82598EB Intel(R) 10 Gigabit XF SR/LR - Server Adapter - Intel(R) 82598EB 10 Gigabit AF - Network Connection - Intel(R) 82598EB 10 Gigabit AT - CX4 Network Connection +The driver in this release is compatible with 82598 and 82599-based Intel +Network Connections. +SFP+ Devices with Pluggable Optics +---------------------------------- -Building and Installation -========================= - -NOTE: You must have kernel sources installed in order to compile the driver - module. - - In the instructions below, x.x.x is the driver version as indicated in - the name of the driver tar. - -1. Move the base driver tar file to the directory of your choice. For - example, use /home/username/ixgbe or /usr/local/src/ixgbe. - -2. Untar/unzip the archive: - tar xfz ixgbe-x.x.x.tar.gz - -3. To install man page: - cd ixgbe-x.x.x - gzip -c ixgbe.4 > /usr/share/man/man4/ixgbee.4.gz - -4. To load the driver onto a running system: - cd ixgbe-x.x.x/src - make load - -5. To assign an IP address to the interface, enter the following: - ifconfig ix - -6. Verify that the interface works. Enter the following, where - is the IP address for another machine on the same subnet as the interface - that is being tested: - ping - -7. If you want the driver to load automatically when the system is booted: - - cd ixgbe-x.x.x/src - make - make install - - Edit /boot/loader.conf, and add the following line: - ixgbe_load="YES" - - OR - - compile the driver into the kernel (see item 8). - - - Edit /etc/rc.conf, and create the appropriate ifconfig_ixgbe - entry: - - ifconfig_ix="" - - Example usage: - - ifconfig_ix0="inet 192.168.10.1 netmask 255.255.255.0" - - NOTE: For assistance, see the ifconfig man page. - -8. If you want to compile the driver into the kernel, enter: +82599-BASED ADAPTERS - FreeBSD 7 or later: +NOTE: If your 82599-based Intel(R) Ethernet Network Adapter came with Intel +optics, or is an Intel(R) Ethernet Server Adapter X520-2, then it only supports +Intel optics and/or the direct attach cables listed below. - cd ixgbe-x.x.x/src - - cp *.[ch] /usr/src/sys/dev/ixgbe - - cp Makefile.kernel /usr/src/sys/modules/ixgbe/Makefile - - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in - /usr/src/sys/i386/conf (replace "i386" with the appropriate system - architecture if necessary), and ensure the following line is present: - - device ixgbe - - Compile and install the kernel. The system must be reboot for the kernel - updates to take affect. For additional information on compiling the kernel, - consult the FreeBSD operating system documentation. +When 82599-based SFP+ devices are connected back to back, they should be set to +the same Speed setting via Ethtool. Results may vary if you mix speed settings. + +Supplier Type Part Numbers +SR Modules +Intel DUAL RATE 1G/10G SFP+ SR (bailed) FTLX8571D3BCV-IT +Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDZ-IN2 +Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDDZ-IN1 +LR Modules +Intel DUAL RATE 1G/10G SFP+ LR (bailed) FTLX1471D3BCV-IT +Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDZ-IN2 +Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDDZ-IN1 + +The following is a list of 3rd party SFP+ modules and direct attach cables that +have received some testing. Not all modules are applicable to all devices. + +Supplier Type Part Numbers + +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ +Finisar SFP+ LR bailed, 10g single rate FTLX8571D3BCV-IT + +Finisar DUAL RATE 1G/10G SFP+ SR (No Bail) FTLX8571D3QCV-IT +Avago DUAL RATE 1G/10G SFP+ SR (No Bail) AFBR-703SDZ-IN1 +Finisar DUAL RATE 1G/10G SFP+ LR (No Bail) FTLX1471D3QCV-IT +Avago DUAL RATE 1G/10G SFP+ LR (No Bail) AFCT-701SDZ-IN1 +Finistar 1000BASE-T SFP FCLF8522P2BTL +Avago 1000BASE-T SFP ABCU-5710RZ + +82599-based adapters support all passive and active limiting direct attach +cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. + +Laser turns off for SFP+ when ifconfig down +-------------------------------------------------------- +"ifconfig down" turns off the laser for 82599-based SFP+ fiber adapters. +"ifconfig up" turns on the later. + +82598-BASED ADAPTERS + +NOTES for 82598-Based Adapters: +- Intel(R) Ethernet Network Adapters that support removable optical modules + only support their original module type (i.e., the Intel(R) 10 Gigabit SR + Dual Port Express Module only supports SR optical modules). If you plug + in a different type of module, the driver will not load. +- Hot Swapping/hot plugging optical modules is not supported. +- Only single speed, 10 gigabit modules are supported. +- LAN on Motherboard (LOMs) may support DA, SR, or LR modules. Other module + types are not supported. Please see your system documentation for details. + +The following is a list of 3rd party SFP+ modules and direct attach cables that have +received some testing. Not all modules are applicable to all devices. + +Supplier Type Part Numbers + +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ +Finisar SFP+ LR bailed, 10g single rate FTLX1471D3BCL + +82598-based adapters support all passive direct attach cables that comply +with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. Active direct attach +cables are not supported. + +Third party optic modules and cables referred to above are listed only for the +purpose of highlighting third party specifications and potential compatibility, +and are not recommendations or endorsements or sponsorship of any third party's +product by Intel. Intel is not endorsing or promoting products made by any +third party and the third party reference is provided only to share information +regarding certain optic modules and cables with the above specifications. There +may be other manufacturers or suppliers, producing or supplying optic modules +and cables with similar or matching descriptions. Customers must use their own +discretion and diligence to purchase optic modules and cables from any third +party of their choice. Customer are solely responsible for assessing the +suitability of the product and/or devices and for the selection of the vendor +for purchasing any product. INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL +DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF +SUCH THIRD PARTY PRODUCTS OR SELECTION OF VENDOR BY CUSTOMERS. Configuration and Tuning -========================= +======================== The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on all 10 Gigabit adapters. @@ -143,7 +141,7 @@ all 10 Gigabit adapters. The Jumbo Frames MTU range for Intel Adapters is 1500 to 16114. The default MTU range is 1500. To modify the setting, enter the following: - ifconfig ix mtu 9000 + ifconfig ix mtu 9000 To confirm an interface's MTU value, use the ifconfig command. To confirm the MTU used between two specific devices, use: @@ -200,6 +198,8 @@ all 10 Gigabit adapters. TSO --- + TSO is enabled by default. + To disable: ifconfig -tso @@ -209,23 +209,21 @@ all 10 Gigabit adapters. ifconfig tso LRO - ___ + --- - Large Receive Offload is available in version 1.4.4, it is on - by default. It can be toggled off and on by using: - sysctl dev.ix.X.enable_lro=[0,1] - - NOTE: when changing this feature you MUST be sure the interface - is reinitialized, it is easy to do this with ifconfig down/up. - The LRO code will ultimately move into the kernel stack code, - but for this first release it was included with the driver. + Large Receive Offload is available in the driver; it is on by default. + It can be disabled by using: + ifconfig -lro + To enable: + ifconfig lro + Important system configuration changes: --------------------------------------- - When there is a choice run on a 64bit OS rather than 32, it makes - a significant difference in improvement. - + When there is a choice run on a 64bit OS rather than 32, it makes a + significant difference in improvement. + The default scheduler SCHED_4BSD is not smart about SMP locality issues. Significant improvement can be achieved by switching to the ULE scheduler. @@ -233,34 +231,79 @@ all 10 Gigabit adapters. SCHED_ULE. Note that this is only advisable on FreeBSD 7, on 6.X there have been stability problems with ULE. - Change the file /etc/sysctl.conf, add the line: + The interface can generate high number of interrupts. To avoid running + into the limit set by the kernel, adjust hw.intr_storm_threshold + setting using sysctl: - hw.intr_storm_threshold: 8000 (the default is 1000) + sysctl hw.intr_storm_threshold=9000 (the default is 1000) + + For this change to take effect on boot, edit /etc/sysctl.conf and add the + line: + hw.intr_storm_threshold=9000 + + If you still see Interrupt Storm detected messages, increase the limit to a + higher number. Best throughput results are seen with a large MTU; use 9000 if possible. - The default number of descriptors is 256, increasing this to 1024 or even - 2048 may improve performance. + The default number of descriptors is 1024, increasing this to 2K or even + 4K may improve performance in some workloads, but change carefully. Known Limitations ================= + +For known hardware and troubleshooting issues, refer to the following website. + + http://support.intel.com/support/go/network/adapter/home.htm + +Either select the link for your adapter or perform a search for the adapter +number. The adapter's page lists many issues. For a complete list of hardware +issues download your adapter's user guide and read the Release Notes. + + UDP stress test with 10GbE driver + --------------------------------- Under small packets UDP stress test with 10GbE driver, the FreeBSD system will drop UDP packets due to the fullness of socket buffers. You may want to change the driver's Flow Control variables to the minimum value for controlling packet reception. + Attempting to configure larger MTUs with a large numbers of processors may + generate the error message "ix0:could not setup receive structures" + -------------------------------------------------------------------------- + When using the ixgbe driver with RSS autoconfigured based on the number of + cores (the default setting) and that number is larger than 4, increase the + memory resources allocated for the mbuf pool as follows: + + Add to the sysctl.conf file for the system: + + kern.ipc.nmbclusters=262144 + kern.ipc.nmbjumbop=262144 + + Lower than expected performance on dual port 10GbE devices + ---------------------------------------------------------- + Some PCI-E x8 slots are actually configured as x4 slots. These slots have + insufficient bandwidth for full 10Gbe line rate with dual port 10GbE devices. + The driver can detect this situation and will write the following message in + the system log: "PCI-Express bandwidth available for this card is not + sufficient for optimal performance. For optimal performance a x8 PCI-Express + slot is required." + + If this error occurs, moving your adapter to a true x8 slot will resolve the + issue. + + Support ======= For general information and support, go to the Intel support website at: - http://support.intel.com + www.intel.com/support/ If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to -the issue to freebsd@intel.com. +the issue to freebsd@intel.com Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 2 00:34:57 2011 (r222588) @@ -34,6 +34,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_inet.h" +#include "opt_inet6.h" #endif #include "ixgbe.h" @@ -46,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.3.10"; +char ixgbe_driver_version[] = "2.3.11"; /********************************************************************* * PCI Device ID Table @@ -318,7 +319,7 @@ static int fdir_pballoc = 1; * ixgbe_probe determines if the driver should be loaded on * adapter based on PCI vendor/device id of the adapter. * - * return 0 on success, positive on failure + * return BUS_PROBE_DEFAULT on success, positive on failure *********************************************************************/ static int @@ -357,7 +358,7 @@ ixgbe_probe(device_t dev) ixgbe_driver_version); device_set_desc_copy(dev, adapter_name); ++ixgbe_total_ports; - return (0); + return (BUS_PROBE_DEFAULT); } ent++; } @@ -385,6 +386,11 @@ ixgbe_attach(device_t dev) INIT_DEBUGOUT("ixgbe_attach: begin"); + if (resource_disabled("ixgbe", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + /* Allocate, clear, and link in our adapter structure */ adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; @@ -862,8 +868,9 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; -#ifdef INET +#if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; + bool avoid_reset = FALSE; #endif int error = 0; @@ -871,26 +878,28 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif +#if defined(INET) || defined(INET6) + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - IXGBE_CORE_LOCK(adapter); - ixgbe_init_locked(adapter); - IXGBE_CORE_UNLOCK(adapter); - } + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + ixgbe_init(adapter); if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); } else -#endif error = ether_ioctl(ifp, command, data); break; - +#endif case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) { @@ -951,6 +960,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (mask & IFCAP_VLAN_HWFILTER) ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IXGBE_CORE_LOCK(adapter); ixgbe_init_locked(adapter); @@ -1338,7 +1349,7 @@ ixgbe_legacy_irq(void *arg) /********************************************************************* * - * MSI Queue Interrupt Service routine + * MSIX Queue Interrupt Service routine * **********************************************************************/ void @@ -1357,6 +1368,17 @@ ixgbe_msix_que(void *arg) IXGBE_TX_LOCK(txr); more_tx = ixgbe_txeof(txr); + /* + ** Make certain that if the stack + ** has anything queued the task gets + ** scheduled to handle it. + */ +#if __FreeBSD_version < 800000 + if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) +#else + if (!drbr_empty(adapter->ifp, txr->br)) +#endif + more_tx = 1; IXGBE_TX_UNLOCK(txr); /* Do AIM now? */ @@ -1570,7 +1592,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m struct mbuf *m_head; bus_dma_segment_t segs[adapter->num_segs]; bus_dmamap_t map; - struct ixgbe_tx_buf *txbuf, *txbuf_mapped; + struct ixgbe_tx_buf *txbuf; union ixgbe_adv_tx_desc *txd = NULL; m_head = *m_headp; @@ -1589,7 +1611,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m */ first = txr->next_avail_desc; txbuf = &txr->tx_buffers[first]; - txbuf_mapped = txbuf; map = txbuf->map; /* @@ -1708,6 +1729,8 @@ ixgbe_xmit(struct tx_ring *txr, struct m txr->next_avail_desc = i; txbuf->m_head = m_head; + /* Swap the dma map between the first and last descriptor */ + txr->tx_buffers[first].map = txbuf->map; txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -2265,7 +2288,9 @@ ixgbe_setup_msix(struct adapter *adapter msi: msgs = pci_msi_count(dev); if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); + device_printf(adapter->dev,"Using an MSI interrupt\n"); + else + device_printf(adapter->dev,"Using a Legacy interrupt\n"); return (msgs); } @@ -2412,19 +2437,21 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; /* Don't enable LRO by default */ ifp->if_capabilities |= IFCAP_LRO; /* - ** Dont turn this on by default, if vlans are + ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking ** operation, but with HW FILTER off it works. If - ** using vlans directly on the em driver you can + ** using vlans directly on the ixgbe driver you can ** enable this and get full hardware tag filtering. */ ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; @@ -5333,7 +5360,7 @@ ixgbe_add_rx_process_limit(struct adapte static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) { - int error; + int error = 0; struct adapter *adapter; struct ixgbe_hw *hw; ixgbe_link_speed speed, last; Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/ixv.c Thu Jun 2 00:34:57 2011 (r222588) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -33,7 +33,8 @@ /*$FreeBSD$*/ #ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_device_polling.h" +#include "opt_inet.h" +#include "opt_inet6.h" #endif #include "ixv.h" @@ -41,7 +42,7 @@ /********************************************************************* * Driver version *********************************************************************/ -char ixv_driver_version[] = "1.0.0"; +char ixv_driver_version[] = "1.0.1"; /********************************************************************* * PCI Device ID Table @@ -234,7 +235,7 @@ static u32 ixv_shadow_vfta[VFTA_SIZE]; * ixv_probe determines if the driver should be loaded on * adapter based on PCI vendor/device id of the adapter. * - * return 0 on success, positive on failure + * return BUS_PROBE_DEFAULT on success, positive on failure *********************************************************************/ static int @@ -271,7 +272,7 @@ ixv_probe(device_t dev) ixv_strings[ent->index], ixv_driver_version); device_set_desc_copy(dev, adapter_name); - return (0); + return (BUS_PROBE_DEFAULT); } ent++; } @@ -297,6 +298,11 @@ ixv_attach(device_t dev) INIT_DEBUGOUT("ixv_attach: begin"); + if (resource_disabled("ixgbe", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + /* Allocate, clear, and link in our adapter structure */ adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; @@ -690,10 +696,38 @@ ixv_ioctl(struct ifnet * ifp, u_long com { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; +#if defined(INET) || defined(INET6) + struct ifreq *ifa = (struct ifaddr *) data; + bool avoid_reset = FALSE; +#endif int error = 0; switch (command) { + case SIOCSIFADDR: +#ifdef INET + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif +#if defined(INET) || defined(INET6) + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { + ifp->if_flags |= IFF_UP; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + ixv_init(adapter); + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); + } else + error = ether_ioctl(ifp, command, data); + break; +#endif case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu > IXV_MAX_FRAME_SIZE - ETHER_HDR_LEN) { @@ -1161,7 +1195,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu struct mbuf *m_head; bus_dma_segment_t segs[32]; bus_dmamap_t map; - struct ixv_tx_buf *txbuf, *txbuf_mapped; + struct ixv_tx_buf *txbuf; union ixgbe_adv_tx_desc *txd = NULL; m_head = *m_headp; @@ -1180,7 +1214,6 @@ ixv_xmit(struct tx_ring *txr, struct mbu */ first = txr->next_avail_desc; txbuf = &txr->tx_buffers[first]; - txbuf_mapped = txbuf; map = txbuf->map; /* @@ -1283,6 +1316,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu txr->next_avail_desc = i; txbuf->m_head = m_head; + txr->tx_buffers[first].map = txbuf->map; txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -1820,11 +1854,15 @@ ixv_setup_interface(device_t dev, struct ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_LRO; - + ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; + /* Don't enable LRO by default */ + ifp->if_capabilities |= IFCAP_LRO; + /* * Specify the media types supported by this adapter and register * callbacks to update media and link information