Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Synchronize our ixg(4) driver up to FreeBSD r230...



details:   https://anonhg.NetBSD.org/src/rev/4e5d59dcddb0
branches:  trunk
changeset: 807051:4e5d59dcddb0
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Mar 27 05:57:28 2015 +0000

description:
Synchronize our ixg(4) driver up to FreeBSD r230775:
 - Add X540 support.
 - Add 100BaseTX support.
 - Fix a lot of bugs.
 - Improve performance.

diffstat:

 sys/dev/pci/files.pci            |     3 +-
 sys/dev/pci/ixgbe/ixgbe.c        |   306 ++++++--
 sys/dev/pci/ixgbe/ixgbe.h        |    14 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c  |   258 +++---
 sys/dev/pci/ixgbe/ixgbe_82599.c  |  1036 +++++++++++++++--------------
 sys/dev/pci/ixgbe/ixgbe_api.c    |   294 +++++--
 sys/dev/pci/ixgbe/ixgbe_api.h    |    90 +-
 sys/dev/pci/ixgbe/ixgbe_common.c |  1319 +++++++++++++++++++++++++++----------
 sys/dev/pci/ixgbe/ixgbe_common.h |    46 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c    |    39 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h    |    91 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h  |    15 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c    |   351 +++++----
 sys/dev/pci/ixgbe/ixgbe_phy.h    |   128 +-
 sys/dev/pci/ixgbe/ixgbe_type.h   |   363 +++++++++-
 sys/dev/pci/ixgbe/ixgbe_vf.c     |   145 ++-
 sys/dev/pci/ixgbe/ixgbe_vf.h     |   112 +-
 sys/dev/pci/ixgbe/ixv.c          |    83 +-
 sys/dev/pci/ixgbe/ixv.h          |    20 +-
 19 files changed, 3019 insertions(+), 1694 deletions(-)

diffs (truncated from 8988 to 300 lines):

diff -r 7d6ad4ecbef0 -r 4e5d59dcddb0 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Fri Mar 27 05:47:37 2015 +0000
+++ b/sys/dev/pci/files.pci     Fri Mar 27 05:57:28 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.374 2015/03/10 09:26:49 msaitoh Exp $
+#      $NetBSD: files.pci,v 1.375 2015/03/27 05:57:28 msaitoh 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 7d6ad4ecbef0 -r 4e5d59dcddb0 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 27 05:47:37 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 27 05:57:28 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 
@@ -59,7 +59,7 @@
  * 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.23 2015/03/25 12:53:55 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.24 2015/03/27 05:57:28 msaitoh 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.4.5";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -111,6 +111,7 @@
        {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_X540T, 0, 0, 0},
        /* required last entry */
        {0, 0, 0, 0, 0}
 };
@@ -190,6 +191,7 @@
 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 *);
@@ -277,10 +279,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
@@ -441,16 +439,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 +451,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");
 }
 
 /*********************************************************************
@@ -593,9 +597,10 @@
 
        /* Get Hardware Flow Control setting */
        hw->fc.requested_mode = ixgbe_fc_full;
+       adapter->fc = hw->fc.requested_mode;
        hw->fc.pause_time = IXGBE_FC_PAUSE;
        hw->fc.low_water = IXGBE_FC_LO;
-       hw->fc.high_water = IXGBE_FC_HI;
+       hw->fc.high_water[0] = IXGBE_FC_HI;
        hw->fc.send_xon = TRUE;
 
        error = ixgbe_init_hw(hw);
@@ -906,13 +911,18 @@
                return;
 
        while (!IFQ_IS_EMPTY(&ifp->if_snd)) {
+               if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) {
+                       txr->queue_status |= IXGBE_QUEUE_DEPLETED;
+                       break;
+               }
 
                IFQ_POLL(&ifp->if_snd, m_head);
                if (m_head == NULL)
                        break;
 
                if ((rc = ixgbe_xmit(txr, m_head)) == EAGAIN) {
-                       ifp->if_flags |= IFF_OACTIVE;
+                       if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
+                               txr->queue_status |= IXGBE_QUEUE_DEPLETED;
                        break;
                }
                IFQ_DEQUEUE(&ifp->if_snd, m_head);
@@ -978,11 +988,14 @@
        /* Which queue to use */
        if ((m->m_flags & M_FLOWID) != 0)
                i = m->m_pkthdr.flowid % adapter->num_queues;
+       else
+               i = curcpu % adapter->num_queues;
 
        txr = &adapter->tx_rings[i];
        que = &adapter->queues[i];
 
-       if (IXGBE_TX_TRYLOCK(txr)) {
+       if (((txr->queue_status & IXGBE_QUEUE_DEPLETED) == 0) &&
+           IXGBE_TX_TRYLOCK(txr)) {
                err = ixgbe_mq_start_locked(ifp, txr, m);
                IXGBE_TX_UNLOCK(txr);
        } else {
@@ -1000,8 +1013,9 @@
         struct mbuf     *next;
         int             enqueued, err = 0;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) !=
-           IFF_RUNNING || adapter->link_active == 0) {
+       if (((ifp->if_flags & IFF_RUNNING) == 0) ||
+           (txr->queue_status == IXGBE_QUEUE_DEPLETED) ||
+           adapter->link_active == 0) {
                if (m != NULL)
                        err = drbr_enqueue(ifp, txr->br, m);
                return (err);
@@ -1041,10 +1055,13 @@
 
        if (enqueued > 0) {
                /* Set watchdog on */
-               txr->queue_status = IXGBE_QUEUE_WORKING;
+               txr->queue_status |= IXGBE_QUEUE_WORKING;
                getmicrotime(&txr->watchdog_time);
        }
 
+       if (txr->tx_avail < IXGBE_TX_CLEANUP_THRESHOLD)
+               ixgbe_txeof(txr);
+
        return (err);
 }
 
@@ -1263,6 +1280,10 @@
        if (hw->mac.type == ixgbe_mac_82599EB)
                gpie |= IXGBE_SDP2_GPIEN;
 
+       /* Thermal Failure Detection */
+       if (hw->mac.type == ixgbe_mac_X540)
+               gpie |= IXGBE_SDP0_GPIEN;
+
        if (adapter->msix > 1) {
                /* Enable Enhanced MSIX mode */
                gpie |= IXGBE_GPIE_MSIX_MODE;
@@ -1371,8 +1392,12 @@
 
 #ifdef IXGBE_FDIR
        /* Init Flow director */
-       if (hw->mac.type != ixgbe_mac_82598EB)
+       if (hw->mac.type != ixgbe_mac_82598EB) {
+               u32 hdrm = 64 << fdir_pballoc;
+
+               hw->mac.ops.setup_rxpba(hw, 0, hdrm, PBA_STRATEGY_EQUAL);
                ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc);
+       }
 #endif
 
        /*
@@ -1502,7 +1527,7 @@
                        ixgbe_start_locked(txr, ifp);
 #endif
                IXGBE_TX_UNLOCK(txr);
-               if (more) {
+               if (more || (ifp->if_flags & IFF_OACTIVE)) {
                        adapter->req.ev_count++;
                        softint_schedule(que->que_si);
                        return;
@@ -1596,6 +1621,7 @@
        bool            more_tx, more_rx;
        u32             newitr = 0;
 
+       ixgbe_disable_queue(adapter, que->msix);
        ++que->irqs;
 
        more_rx = ixgbe_rxeof(que, adapter->rx_process_limit);
@@ -1608,7 +1634,7 @@
        ** scheduled to handle it.
        */
 #if __FreeBSD_version < 800000
-       if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd))
+       if (!IFQ_IS_EMPTY(&adapter->ifp->if_snd))
 #else
        if (!drbr_empty(adapter->ifp, txr->br))
 #endif
@@ -1730,6 +1756,15 @@
                IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
        }
 
+       /* Check for over temp condition */
+       if ((hw->mac.type == ixgbe_mac_X540) &&
+           (reg_eicr & IXGBE_EICR_GPI_SDP0)) {
+               device_printf(adapter->dev, "\nCRITICAL: OVER TEMP!! "
+                   "PHY IS SHUT DOWN!!\n");
+               device_printf(adapter->dev, "System shutdown required\n");
+               IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0);
+       }
+
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER);
        return;
 }
@@ -1763,6 +1798,9 @@
        ifmr->ifm_status |= IFM_ACTIVE;
 
        switch (adapter->link_speed) {
+               case IXGBE_LINK_SPEED_100_FULL:
+                       ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+                       break;
                case IXGBE_LINK_SPEED_1GB_FULL:
                        ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
                        break;
@@ -1798,7 +1836,9 @@
         switch (IFM_SUBTYPE(ifm->ifm_media)) {
         case IFM_AUTO:
                 adapter->hw.phy.autoneg_advertised =
-                   IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_10GB_FULL;
+                   IXGBE_LINK_SPEED_100_FULL |
+                   IXGBE_LINK_SPEED_1GB_FULL |
+                   IXGBE_LINK_SPEED_10GB_FULL;
                 break;
         default:
                 device_printf(adapter->dev, "Only auto media type\n");
@@ -2049,7 +2089,7 @@
 
        update_ptr = mta;
        ixgbe_update_mc_addr_list(&adapter->hw,
-           update_ptr, mcnt, ixgbe_mc_array_itr);
+           update_ptr, mcnt, ixgbe_mc_array_itr, TRUE);
 
        return;
 }
@@ -2083,11 +2123,15 @@
 static void
 ixgbe_local_timer1(void *arg)
 {
-       struct adapter *adapter = arg;
+       struct adapter  *adapter = arg;
        device_t        dev = adapter->dev;
-       struct tx_ring *txr = adapter->tx_rings;
+       struct ifnet    *ifp = adapter->ifp;
+       struct ix_queue *que = adapter->queues;
+       struct tx_ring  *txr = adapter->tx_rings;
+       int             hung, busy, paused;
 
        KASSERT(mutex_owned(&adapter->core_mtx));
+       hung = busy = paused = 0;
 
        /* Check for pluggable optics */
        if (adapter->sfp_probe)



Home | Main Index | Thread Index | Old Index