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 r243716:



details:   https://anonhg.NetBSD.org/src/rev/3b55982db454
branches:  trunk
changeset: 337415:3b55982db454
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Apr 14 07:17:06 2015 +0000

description:
Sync ixg(4) up to FreeBSD r243716:
 - A lot of bugfixes. Some of them are realted to multi queue and those
   have not affected in NetBSD because we have not used it yet.
 - Show 1000Base-SX correctly.
 - Fix if_baudrate from 1G to 10G.
 - Improve performance.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c       |  624 ++++++++++++++++-----------------------
 sys/dev/pci/ixgbe/ixgbe.h       |   43 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c |    7 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h |   28 +-
 sys/dev/pci/ixgbe/ixv.c         |    8 +-
 5 files changed, 321 insertions(+), 389 deletions(-)

diffs (truncated from 1407 to 300 lines):

diff -r 1d088a3eaed6 -r 3b55982db454 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Apr 14 06:11:15 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue Apr 14 07:17:06 2015 +0000
@@ -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 238149 2012-07-05 20:51:44Z jfv $*/
-/*$NetBSD: ixgbe.c,v 1.25 2015/04/02 09:26:55 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 243716 2012-11-30 22:33:21Z jfv $*/
+/*$NetBSD: ixgbe.c,v 1.26 2015/04/14 07:17:06 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -74,7 +74,7 @@
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "2.4.8";
+char ixgbe_driver_version[] = "2.5.0 - 2";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -134,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);
@@ -216,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 *);
@@ -296,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,
@@ -328,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;
 
@@ -697,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");
@@ -719,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);
        }
 
@@ -764,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);
@@ -790,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);
@@ -883,6 +897,7 @@
 #endif
 
 
+#if __FreeBSD_version < 800000
 /*********************************************************************
  *  Transmit entry point
  *
@@ -902,25 +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) {
-                       txr->queue_status |= IXGBE_QUEUE_DEPLETED;
+               if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
                        break;
-               }
 
                IFQ_POLL(&ifp->if_snd, m_head);
                if (m_head == NULL)
                        break;
 
                if ((rc = ixgbe_xmit(txr, m_head)) == EAGAIN) {
-                       if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
-                               txr->queue_status |= IXGBE_QUEUE_DEPLETED;
                        break;
                }
                IFQ_DEQUEUE(&ifp->if_snd, m_head);
@@ -970,7 +980,7 @@
        return;
 }
 
-#if __FreeBSD_version >= 800000
+#else
 /*
 ** Multiqueue Transmit driver
 **
@@ -992,13 +1002,12 @@
        txr = &adapter->tx_rings[i];
        que = &adapter->queues[i];
 
-       if (((txr->queue_status & IXGBE_QUEUE_DEPLETED) == 0) &&
-           IXGBE_TX_TRYLOCK(txr)) {
+       if (IXGBE_TX_TRYLOCK(txr)) {
                err = ixgbe_mq_start_locked(ifp, txr, m);
                IXGBE_TX_UNLOCK(txr);
        } else {
                err = drbr_enqueue(ifp, txr->br, m);
-               softint_schedule(que->que_si);
+               softint_schedule(txr->txq_si);
        }
 
        return (err);
@@ -1012,7 +1021,6 @@
         int             enqueued, err = 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);
@@ -1037,23 +1045,18 @@
                        break;
                }
                enqueued++;
-               drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
                /* Send a copy of the frame to the BPF listener */
                bpf_mtap(ifp, next);
                if ((ifp->if_flags & IFF_RUNNING) == 0)
                        break;
                if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD)
                        ixgbe_txeof(txr);
-               if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) {
-                       ifp->if_flags |= IFF_OACTIVE;
-                       break;
-               }
                next = drbr_dequeue(ifp, txr->br);
        }
 
        if (enqueued > 0) {
                /* Set watchdog on */
-               txr->queue_status |= IXGBE_QUEUE_WORKING;
+               txr->queue_status = IXGBE_QUEUE_WORKING;
                getmicrotime(&txr->watchdog_time);
        }
 
@@ -1064,6 +1067,22 @@
 }
 
 /*
+ * Called from a taskqueue to drain queued transmit packets.
+ */
+static void
+ixgbe_deferred_mq_start(void *arg, int pending)
+{
+       struct tx_ring *txr = arg;
+       struct adapter *adapter = txr->adapter;
+       struct ifnet *ifp = adapter->ifp;
+
+       IXGBE_TX_LOCK(txr);
+       if (!drbr_empty(ifp, txr->br))
+               ixgbe_mq_start_locked(ifp, txr, NULL);
+       IXGBE_TX_UNLOCK(txr);
+}
+
+/*
 ** Flush all ring buffers
 */
 static void
@@ -1248,7 +1267,7 @@
 
        /*
        ** Determine the correct mbuf pool
-       ** for doing jumbo/headersplit
+       ** for doing jumbo frames
        */
        if (adapter->max_frame_size <= 2048)
                adapter->rx_mbuf_sz = MCLBYTES;
@@ -1459,7 +1478,6 @@
 
        /* Now inform the stack we're ready */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        return;
 }
@@ -1571,7 +1589,6 @@
 
        /* Reenable this interrupt */
        ixgbe_enable_queue(adapter, que->msix);
-
        return;
 }
 
@@ -1835,7 +1852,7 @@
                        ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
                        break;
                case IXGBE_LINK_SPEED_1GB_FULL:
-                       ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+                       ifmr->ifm_active |= adapter->optics | IFM_FDX;
                        break;
                case IXGBE_LINK_SPEED_10GB_FULL:
                        ifmr->ifm_active |= adapter->optics | IFM_FDX;
@@ -2157,13 +2174,11 @@
 {
        struct adapter  *adapter = arg;
        device_t        dev = adapter->dev;
-       struct ifnet    *ifp = adapter->ifp;
        struct ix_queue *que = adapter->queues;
        struct tx_ring  *txr = adapter->tx_rings;
-       int             hung, busy, paused;
+       int             hung = 0, paused = 0;
 
        KASSERT(mutex_owned(&adapter->core_mtx));
-       hung = busy = paused = 0;
 
        /* Check for pluggable optics */
        if (adapter->sfp_probe)
@@ -2182,27 +2197,18 @@
 
        /*
        ** Check the TX queues status
-       **      - central locked handling of OACTIVE



Home | Main Index | Thread Index | Old Index