Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/dev/pci Apply patch (requested by msaitoh in ticket #...



details:   https://anonhg.NetBSD.org/src/rev/9a74ea859922
branches:  netbsd-7
changeset: 799226:9a74ea859922
user:      riz <riz%NetBSD.org@localhost>
date:      Sun Apr 19 06:45:17 2015 +0000

description:
Apply patch (requested by msaitoh in ticket #697):
sys/dev/pci/files.pci                           1.375 via patch
sys/dev/pci/ixgbe/ixgbe.c                       1.24-1.27 via patch
sys/dev/pci/ixgbe/ixgbe.h                       1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c                 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_82598.h                 1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_82599.c                 1.6-1.8 via patch
sys/dev/pci/ixgbe/ixgbe_82599.h                 1.1 via patch
sys/dev/pci/ixgbe/ixgbe_api.c                   1.5-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_api.h                   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_common.c                1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_common.h                1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c                   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.h                   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_osdep.h                 1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_phy.c                   1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_phy.h                   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_type.h                  1.8-1.9 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c                    1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_vf.h                    1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_x540.c                  1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_x540.h                  1.1 via patch
sys/dev/pci/ixgbe/ixv.c                         1.5-1.7 via patch
sys/dev/pci/ixgbe/ixv.h                         1.4-1.5 via patch

        Synchronize our ixg(4) driver up to FreeBSD r243716:
         - Add X540 support.
         - Add TSO6 support.
         - Add 100BaseTX support.
         - The max size in dma tag is changed from 65535 to 262140 (IXGBE_TSO_SIZE).
           The value is the same as other *BSDs. The change might cause a address
           space shortage (ixgbe_dmamap_create() might fail) on some machines.
         - Show 1000Base-SX correctly.
         - Fix if_baudrate from 1G to 10G.
         - Fix a bug that ifconfig -z (SOICZIFDATA) doesn't work.
         - Fix a lot of bugs.
         - Improve performance.
        [msaitoh, ticket #697]

diffstat:

 sys/dev/pci/files.pci            |     3 +-
 sys/dev/pci/ixgbe/ixgbe.c        |  1086 ++++++++++---------
 sys/dev/pci/ixgbe/ixgbe.h        |    49 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c  |   348 +++---
 sys/dev/pci/ixgbe/ixgbe_82599.c  |  1052 ++++++++++--------
 sys/dev/pci/ixgbe/ixgbe_api.c    |   316 +++-
 sys/dev/pci/ixgbe/ixgbe_api.h    |    95 +-
 sys/dev/pci/ixgbe/ixgbe_common.c |  2078 ++++++++++++++++++++++++-------------
 sys/dev/pci/ixgbe/ixgbe_common.h |    55 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c    |    39 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h    |    91 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h  |    42 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c    |   414 ++++---
 sys/dev/pci/ixgbe/ixgbe_phy.h    |   128 +-
 sys/dev/pci/ixgbe/ixgbe_type.h   |   422 ++++++-
 sys/dev/pci/ixgbe/ixgbe_vf.c     |   167 +-
 sys/dev/pci/ixgbe/ixgbe_vf.h     |   112 +-
 sys/dev/pci/ixgbe/ixv.c          |    95 +-
 sys/dev/pci/ixgbe/ixv.h          |    20 +-
 19 files changed, 4042 insertions(+), 2570 deletions(-)

diffs (truncated from 11826 to 300 lines):

diff -r fb3b26eab012 -r 9a74ea859922 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Sun Apr 19 05:27:29 2015 +0000
+++ b/sys/dev/pci/files.pci     Sun Apr 19 06:45:17 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.371.4.2 2015/03/26 13:39:34 martin Exp $
+#      $NetBSD: files.pci,v 1.371.4.3 2015/04/19 06:45:17 riz Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -671,6 +671,7 @@
 file   dev/pci/ixgbe/ixgbe_netbsd.c    ixg
 file   dev/pci/ixgbe/ixgbe_82598.c     ixg
 file   dev/pci/ixgbe/ixgbe_82599.c     ixg
+file   dev/pci/ixgbe/ixgbe_x540.c      ixg
 file   dev/pci/ixgbe/ixgbe_api.c       ixg
 file   dev/pci/ixgbe/ixgbe_common.c    ixg
 file   dev/pci/ixgbe/ixgbe_mbx.c       ixg
diff -r fb3b26eab012 -r 9a74ea859922 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Sun Apr 19 05:27:29 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Sun Apr 19 06:45:17 2015 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2013, Intel Corporation 
+  Copyright (c) 2001-2012, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -58,8 +58,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-/*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.14.2.3 2015/03/26 13:39:34 martin Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 243716 2012-11-30 22:33:21Z jfv $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.4 2015/04/19 06:45:17 riz Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -74,7 +74,7 @@
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "2.3.11";
+char ixgbe_driver_version[] = "2.5.0 - 2";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -111,6 +111,8 @@
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0},
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0},
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0},
+       {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0},
+       {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0},
        /* required last entry */
        {0, 0, 0, 0, 0}
 };
@@ -132,13 +134,15 @@
 #if 0
 static int      ixgbe_shutdown(device_t);
 #endif
-static void     ixgbe_start(struct ifnet *);
-static void     ixgbe_start_locked(struct tx_ring *, struct ifnet *);
 #if __FreeBSD_version >= 800000
 static int     ixgbe_mq_start(struct ifnet *, struct mbuf *);
 static int     ixgbe_mq_start_locked(struct ifnet *,
                     struct tx_ring *, struct mbuf *);
 static void    ixgbe_qflush(struct ifnet *);
+static void    ixgbe_deferred_mq_start(void *, int);
+#else
+static void     ixgbe_start(struct ifnet *);
+static void     ixgbe_start_locked(struct tx_ring *, struct ifnet *);
 #endif
 static int      ixgbe_ioctl(struct ifnet *, u_long, void *);
 static void    ixgbe_ifstop(struct ifnet *, int);
@@ -190,13 +194,14 @@
 static int      ixgbe_xmit(struct tx_ring *, struct mbuf *);
 static int     ixgbe_set_flowcntl(SYSCTLFN_PROTO);
 static int     ixgbe_set_advertise(SYSCTLFN_PROTO);
+static int     ixgbe_set_thermal_test(SYSCTLFN_PROTO);
 static int     ixgbe_dma_malloc(struct adapter *, bus_size_t,
                    struct ixgbe_dma_alloc *, int);
 static void     ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *);
 static void    ixgbe_add_rx_process_limit(struct adapter *, const char *,
                    const char *, int *, int);
 static u32     ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *);
-static bool    ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
+static bool    ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *, u32 *);
 static void    ixgbe_set_ivar(struct adapter *, u8, u8, s8);
 static void    ixgbe_configure_ivars(struct adapter *);
 static u8 *    ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
@@ -213,6 +218,9 @@
 static __inline void ixgbe_rx_input(struct rx_ring *, struct ifnet *,
                    struct mbuf *, u32);
 
+static void    ixgbe_enable_rx_drop(struct adapter *);
+static void    ixgbe_disable_rx_drop(struct adapter *);
+
 /* Support for pluggable optic modules */
 static bool    ixgbe_sfp_probe(struct adapter *);
 static void    ixgbe_setup_optics(struct adapter *);
@@ -277,10 +285,6 @@
 static int ixgbe_rx_process_limit = 256;
 TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit);
 
-/* Flow control setting, default to full */
-static int ixgbe_flow_control = ixgbe_fc_full;
-TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control);
-
 /*
 ** Smart speed setting, default to on
 ** this only works as a compile option
@@ -297,15 +301,6 @@
 static int ixgbe_enable_msix = 1;
 TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix);
 
-/*
- * Header split: this causes the hardware to DMA
- * the header into a separate mbuf from the payload,
- * it can be a performance win in some workloads, but
- * in others it actually hurts, its off by default. 
- */
-static int ixgbe_header_split = FALSE;
-TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split);
-
 #if defined(NETBSD_MSI_OR_MSIX)
 /*
  * Number of Queues, can be set to 0,
@@ -329,6 +324,20 @@
 static int ixgbe_rxd = PERFORM_RXD;
 TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd);
 
+/*
+** HW RSC control: 
+**  this feature only works with
+**  IPv4, and only on 82599 and later.
+**  Also this will cause IP forwarding to
+**  fail and that can't be controlled by
+**  the stack as LRO can. For all these
+**  reasons I've deemed it best to leave
+**  this off and not bother with a tuneable
+**  interface, this would need to be compiled
+**  to enable.
+*/
+static bool ixgbe_rsc_enable = FALSE;
+
 /* Keep running tab on them for sanity check */
 static int ixgbe_total_ports;
 
@@ -359,7 +368,7 @@
  * be a reference on how to implement netmap support in a driver.
  * Additional comments are in ixgbe_netmap.h .
  *
- * <dev/netma/ixgbe_netmap.h> contains functions for netmap support
+ * <dev/netmap/ixgbe_netmap.h> contains functions for netmap support
  * that extend the standard driver.
  */
 #include <dev/netmap/ixgbe_netmap.h>
@@ -441,16 +450,10 @@
 
        if (sysctl_createv(log, 0, &rnode, &cnode,
            CTLFLAG_READWRITE, CTLTYPE_INT,
-           "flow_control", SYSCTL_DESCR("Flow Control"),
+           "fc", SYSCTL_DESCR("Flow Control"),
            ixgbe_set_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
                aprint_error_dev(dev, "could not create sysctl\n");
 
-       if (sysctl_createv(log, 0, &rnode, &cnode,
-           CTLFLAG_READWRITE, CTLTYPE_INT,
-           "advertise_gig", SYSCTL_DESCR("1G Link"),
-           ixgbe_set_advertise, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
-               aprint_error_dev(dev, "could not create sysctl\n");
-
        /* XXX This is an *instance* sysctl controlling a *global* variable.
         * XXX It's that way in the FreeBSD driver that this derives from.
         */
@@ -459,6 +462,18 @@
            "enable_aim", SYSCTL_DESCR("Interrupt Moderation"),
            NULL, 0, &ixgbe_enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
                aprint_error_dev(dev, "could not create sysctl\n");
+
+       if (sysctl_createv(log, 0, &rnode, &cnode,
+           CTLFLAG_READWRITE, CTLTYPE_INT,
+           "advertise_speed", SYSCTL_DESCR("Link Speed"),
+           ixgbe_set_advertise, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
+               aprint_error_dev(dev, "could not create sysctl\n");
+
+       if (sysctl_createv(log, 0, &rnode, &cnode,
+           CTLFLAG_READWRITE, CTLTYPE_INT,
+           "ts", SYSCTL_DESCR("Thermal Test"),
+           ixgbe_set_thermal_test, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
+               aprint_error_dev(dev, "could not create sysctl\n");
 }
 
 /*********************************************************************
@@ -591,27 +606,25 @@
                goto err_late;
        }
 
-       /* Get Hardware Flow Control setting */
-       hw->fc.requested_mode = ixgbe_fc_full;
-       hw->fc.pause_time = IXGBE_FC_PAUSE;
-       hw->fc.low_water = IXGBE_FC_LO;
-       hw->fc.high_water = IXGBE_FC_HI;
-       hw->fc.send_xon = TRUE;
-
        error = ixgbe_init_hw(hw);
-       if (error == IXGBE_ERR_EEPROM_VERSION) {
+       switch (error) {
+       case IXGBE_ERR_EEPROM_VERSION:
                aprint_error_dev(dev, "This device is a pre-production adapter/"
                    "LOM.  Please be aware there may be issues associated "
                    "with your hardware.\n If you are experiencing problems "
                    "please contact your Intel or hardware representative "
                    "who provided you with this hardware.\n");
-       } else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED)
+               break;
+       case IXGBE_ERR_SFP_NOT_SUPPORTED:
                aprint_error_dev(dev,"Unsupported SFP+ Module\n");
-
-       if (error) {
                error = EIO;
                aprint_error_dev(dev,"Hardware Initialization Failure\n");
                goto err_late;
+       case IXGBE_ERR_SFP_NOT_PRESENT:
+               device_printf(dev,"No SFP+ Module found\n");
+               /* falls thru */
+       default:
+               break;
        }
 
        /* Detect and set physical type */
@@ -694,10 +707,10 @@
 ixgbe_detach(device_t dev, int flags)
 {
        struct adapter *adapter = device_private(dev);
-       struct tx_ring *txr = adapter->tx_rings;
        struct rx_ring *rxr = adapter->rx_rings;
        struct ixgbe_hw_stats *stats = &adapter->stats;
        struct ix_queue *que = adapter->queues;
+       struct tx_ring *txr = adapter->tx_rings;
        u32     ctrl_ext;
 
        INIT_DEBUGOUT("ixgbe_detach: begin");
@@ -716,7 +729,10 @@
        ixgbe_stop(adapter);
        IXGBE_CORE_UNLOCK(adapter);
 
-       for (int i = 0; i < adapter->num_queues; i++, que++) {
+       for (int i = 0; i < adapter->num_queues; i++, que++, txr++) {
+#if __FreeBSD_version >= 800000
+               softint_disestablish(txr->txq_si);
+#endif
                softint_disestablish(que->que_si);
        }
 
@@ -761,6 +777,8 @@
        evcnt_detach(&adapter->tso_err);
        evcnt_detach(&adapter->tso_tx);
        evcnt_detach(&adapter->link_irq);
+
+       txr = adapter->tx_rings;
        for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) {
                evcnt_detach(&txr->no_desc_avail);
                evcnt_detach(&txr->total_packets);
@@ -787,7 +805,6 @@
                evcnt_detach(&rxr->rx_bytes);
                evcnt_detach(&rxr->no_jmbuf);
                evcnt_detach(&rxr->rx_discarded);
-               evcnt_detach(&rxr->rx_split_packets);
                evcnt_detach(&rxr->rx_irq);
        }
        evcnt_detach(&stats->ipcs);
@@ -880,6 +897,7 @@
 #endif
 
 
+#if __FreeBSD_version < 800000
 /*********************************************************************
  *  Transmit entry point
  *
@@ -899,20 +917,20 @@
 
        IXGBE_TX_LOCK_ASSERT(txr);
 
-       if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) !=
-           IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
        if (!adapter->link_active)
                return;
 
        while (!IFQ_IS_EMPTY(&ifp->if_snd)) {
+               if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
+                       break;
 
                IFQ_POLL(&ifp->if_snd, m_head);
                if (m_head == NULL)
                        break;
 



Home | Main Index | Thread Index | Old Index