Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Sync ixg(4) up to FreeBSD r250108:



details:   https://anonhg.NetBSD.org/src/rev/b7536b64d774
branches:  trunk
changeset: 337711:b7536b64d774
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Apr 24 07:00:51 2015 +0000

description:
Sync ixg(4) up to FreeBSD r250108:
 - Cleanup some unused counters and some unused code.
 - Improve performance.
 - Fix flow control - don't override user value on re-init
 - Fix to make 1G optics work correctly
 - Change to interrupt enabling - some bits were incorrect
   for certain hardware.
 - Certain stats fixes, remove a duplicate increment of
   ierror, thanks to Scott Long for pointing these out.
 - Fix the setting of RX which related to multicast.
 - Some netmap related fixes.

diffstat:

 sys/dev/pci/ixgbe/LICENSE        |    6 +-
 sys/dev/pci/ixgbe/ixgbe.c        |  824 +++++++++++++++++++-------------------
 sys/dev/pci/ixgbe/ixgbe.h        |   65 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c  |   64 ++-
 sys/dev/pci/ixgbe/ixgbe_82598.h  |    2 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c  |  383 ++++++++++++++---
 sys/dev/pci/ixgbe/ixgbe_82599.h  |   11 +-
 sys/dev/pci/ixgbe/ixgbe_api.c    |  111 ++--
 sys/dev/pci/ixgbe/ixgbe_api.h    |   10 +-
 sys/dev/pci/ixgbe/ixgbe_common.c |  278 ++++++++++++-
 sys/dev/pci/ixgbe/ixgbe_common.h |   27 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h    |   18 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.h |    4 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h  |    9 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c    |   59 +-
 sys/dev/pci/ixgbe/ixgbe_phy.h    |   26 +-
 sys/dev/pci/ixgbe/ixgbe_type.h   |   48 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c     |  131 +++++-
 sys/dev/pci/ixgbe/ixgbe_vf.h     |   15 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c   |   12 +-
 sys/dev/pci/ixgbe/ixgbe_x540.h   |    6 +-
 sys/dev/pci/ixgbe/ixv.c          |   43 +-
 22 files changed, 1427 insertions(+), 725 deletions(-)

diffs (truncated from 4560 to 300 lines):

diff -r 62ae72e03849 -r b7536b64d774 sys/dev/pci/ixgbe/LICENSE
--- a/sys/dev/pci/ixgbe/LICENSE Fri Apr 24 06:29:56 2015 +0000
+++ b/sys/dev/pci/ixgbe/LICENSE Fri Apr 24 07:00:51 2015 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2010, Intel Corporation 
+  Copyright (c) 2001-2013, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -30,5 +30,5 @@
   POSSIBILITY OF SUCH DAMAGE.
 
 ******************************************************************************/
-/*$FreeBSD: src/sys/dev/ixgbe/LICENSE,v 1.4 2010/03/27 00:21:40 jfv Exp $*/
-/*$NetBSD: LICENSE,v 1.1 2011/08/12 21:55:28 dyoung Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/LICENSE 247822 2013-03-04 23:07:40Z jfv $*/
+/*$NetBSD: LICENSE,v 1.2 2015/04/24 07:00:51 msaitoh Exp $*/
diff -r 62ae72e03849 -r b7536b64d774 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Apr 24 06:29:56 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Apr 24 07:00:51 2015 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2012, Intel Corporation 
+  Copyright (c) 2001-2013, 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: head/sys/dev/ixgbe/ixgbe.c 243716 2012-11-30 22:33:21Z jfv $*/
-/*$NetBSD: ixgbe.c,v 1.27 2015/04/14 07:41:52 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 250108 2013-04-30 16:18:29Z luigi $*/
+/*$NetBSD: ixgbe.c,v 1.28 2015/04/24 07:00:51 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -74,7 +74,7 @@
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "2.5.0 - 2";
+char ixgbe_driver_version[] = "2.5.8 - HEAD";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -111,7 +111,6 @@
        {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}
@@ -134,15 +133,15 @@
 #if 0
 static int      ixgbe_shutdown(device_t);
 #endif
-#if __FreeBSD_version >= 800000
+#if IXGBE_LEGACY_TX
+static void     ixgbe_start(struct ifnet *);
+static void     ixgbe_start_locked(struct tx_ring *, struct ifnet *);
+#else
 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 *);
+static void    ixgbe_deferred_mq_start(void *);
 #endif
 static int      ixgbe_ioctl(struct ifnet *, u_long, void *);
 static void    ixgbe_ifstop(struct ifnet *, int);
@@ -184,7 +183,7 @@
 static void     ixgbe_disable_intr(struct adapter *);
 static void     ixgbe_update_stats_counters(struct adapter *);
 static bool    ixgbe_txeof(struct tx_ring *);
-static bool    ixgbe_rxeof(struct ix_queue *, int);
+static bool    ixgbe_rxeof(struct ix_queue *);
 static void    ixgbe_rx_checksum(u32, struct mbuf *, u32,
                    struct ixgbe_hw_stats *);
 static void     ixgbe_set_promisc(struct adapter *);
@@ -198,10 +197,10 @@
 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 *, u32 *);
+static int     ixgbe_tx_ctx_setup(struct tx_ring *,
+                   struct mbuf *, u32 *, u32 *);
+static int     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 *);
@@ -285,6 +284,10 @@
 static int ixgbe_rx_process_limit = 256;
 TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit);
 
+/* How many packets txeof tries to clean at a time */
+static int ixgbe_tx_process_limit = 256;
+TUNABLE_INT("hw.ixgbe.tx_process_limit", &ixgbe_tx_process_limit);
+
 /*
 ** Smart speed setting, default to on
 ** this only works as a compile option
@@ -641,11 +644,6 @@
        if (ixgbe_setup_interface(dev, adapter) != 0)
                goto err_late;
 
-       /* Sysctl for limiting the amount of work done in software interrupts */
-       ixgbe_add_rx_process_limit(adapter, "rx_processing_limit",
-           "max number of rx packets to process", &adapter->rx_process_limit,
-           ixgbe_rx_process_limit);
-
        /* Initialize statistics */
        ixgbe_update_stats_counters(adapter);
 
@@ -668,6 +666,9 @@
                    "PCIE, or x4 PCIE 2 slot is required.\n");
         }
 
+       /* Set an initial default flow control value */
+       adapter->fc =  ixgbe_fc_full;
+
        /* let hardware know driver is loaded */
        ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
        ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD;
@@ -730,7 +731,7 @@
        IXGBE_CORE_UNLOCK(adapter);
 
        for (int i = 0; i < adapter->num_queues; i++, que++, txr++) {
-#if __FreeBSD_version >= 800000
+#ifndef IXGBE_LEGACY_TX
                softint_disestablish(txr->txq_si);
 #endif
                softint_disestablish(que->que_si);
@@ -775,13 +776,13 @@
        evcnt_detach(&adapter->enomem_tx_dma_setup);
        evcnt_detach(&adapter->watchdog_events);
        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);
+               evcnt_detach(&txr->tso_tx);
 
                if (i < __arraycount(adapter->stats.mpc)) {
                        evcnt_detach(&adapter->stats.mpc[i]);
@@ -859,17 +860,6 @@
        evcnt_detach(&stats->ptc1023);
        evcnt_detach(&stats->ptc1522);
 
-       /* FC Stats */
-       evcnt_detach(&stats->fccrc);
-       evcnt_detach(&stats->fclast);
-       if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
-               evcnt_detach(&stats->fcoerpdc);
-               evcnt_detach(&stats->fcoeprc);
-               evcnt_detach(&stats->fcoeptc);
-               evcnt_detach(&stats->fcoedwrc);
-               evcnt_detach(&stats->fcoedwtc);
-       }
-
        ixgbe_free_transmit_structures(adapter);
        ixgbe_free_receive_structures(adapter);
        free(adapter->mta, M_DEVBUF);
@@ -897,7 +887,7 @@
 #endif
 
 
-#if __FreeBSD_version < 800000
+#ifdef IXGBE_LEGACY_TX
 /*********************************************************************
  *  Transmit entry point
  *
@@ -937,7 +927,7 @@
                if (rc == EFBIG) {
                        struct mbuf *mtmp;
 
-                       if ((mtmp = m_defrag(m_head, M_DONTWAIT)) != NULL) {
+                       if ((mtmp = m_defrag(m_head, M_NOWAIT)) != NULL) {
                                m_head = mtmp;
                                rc = ixgbe_xmit(txr, m_head);
                                if (rc != 0)
@@ -980,7 +970,8 @@
        return;
 }
 
-#else
+#else /* ! IXGBE_LEGACY_TX */
+
 /*
 ** Multiqueue Transmit driver
 **
@@ -997,7 +988,7 @@
        if ((m->m_flags & M_FLOWID) != 0)
                i = m->m_pkthdr.flowid % adapter->num_queues;
        else
-               i = curcpu % adapter->num_queues;
+               i = cpu_index(curcpu()) % adapter->num_queues;
 
        txr = &adapter->tx_rings[i];
        que = &adapter->queues[i];
@@ -1028,22 +1019,24 @@
        }
 
        enqueued = 0;
-       if (m == NULL) {
-               next = drbr_dequeue(ifp, txr->br);
-       } else if (drbr_needs_enqueue(ifp, txr->br)) {
-               if ((err = drbr_enqueue(ifp, txr->br, m)) != 0)
+       if (m != NULL) {
+               err = drbr_enqueue(ifp, txr->br, m);
+               if (err) {
                        return (err);
-               next = drbr_dequeue(ifp, txr->br);
-       } else
-               next = m;
+               }
+       }
 
        /* Process the queue */
-       while (next != NULL) {
+       while ((next = drbr_peek(ifp, txr->br)) != NULL) {
                if ((err = ixgbe_xmit(txr, &next)) != 0) {
-                       if (next != NULL)
-                               err = drbr_enqueue(ifp, txr->br, next);
+                       if (next == NULL) {
+                               drbr_advance(ifp, txr->br);
+                       } else {
+                               drbr_putback(ifp, txr->br, next);
+                       }
                        break;
                }
+               drbr_advance(ifp, txr->br);
                enqueued++;
                /* Send a copy of the frame to the BPF listener */
                bpf_mtap(ifp, next);
@@ -1051,7 +1044,6 @@
                        break;
                if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD)
                        ixgbe_txeof(txr);
-               next = drbr_dequeue(ifp, txr->br);
        }
 
        if (enqueued > 0) {
@@ -1070,7 +1062,7 @@
  * Called from a taskqueue to drain queued transmit packets.
  */
 static void
-ixgbe_deferred_mq_start(void *arg, int pending)
+ixgbe_deferred_mq_start(void *arg)
 {
        struct tx_ring *txr = arg;
        struct adapter *adapter = txr->adapter;
@@ -1100,7 +1092,7 @@
        }
        if_qflush(ifp);
 }
-#endif /* __FreeBSD_version >= 800000 */
+#endif /* IXGBE_LEGACY_TX */
 
 static int
 ixgbe_ifflags_cb(struct ethercom *ec)
@@ -1140,6 +1132,7 @@
 ixgbe_ioctl(struct ifnet * ifp, u_long command, void *data)
 {
        struct adapter  *adapter = ifp->if_softc;
+       struct ixgbe_hw *hw = &adapter->hw;
        struct ifcapreq *ifcr = data;
        struct ifreq    *ifr = data;
        int             error = 0;
@@ -1174,6 +1167,22 @@
        case SIOCSIFMEDIA:
        case SIOCGIFMEDIA:
                return ifmedia_ioctl(ifp, ifr, &adapter->media, command);
+       case SIOCGI2C:
+       {
+               struct ixgbe_i2c_req    i2c;
+               IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)");
+               error = copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+               if (error)
+                       break;
+               if ((i2c.dev_addr != 0xA0) || (i2c.dev_addr != 0xA2)){
+                       error = EINVAL;
+                       break;
+               }
+               hw->phy.ops.read_i2c_byte(hw, i2c.offset,



Home | Main Index | Thread Index | Old Index