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 Pull up the following revisions (via patch), ...



details:   https://anonhg.NetBSD.org/src/rev/d43c21a0172c
branches:  netbsd-7
changeset: 799151:d43c21a0172c
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 26 13:39:34 2015 +0000

description:
Pull up the following revisions (via patch), requested by msaitoh in #641:

        sys/dev/pci/files.pci                           1.374
        sys/dev/pci/ixgbe/ixgbe.h                       1.3
        sys/dev/pci/ixgbe/ixgbe.c                       1.20-1.23
        sys/dev/pci/ixgbe/ixgbe_type.h                  1.3-1.7
        sys/dev/pci/ixgbe/ixgbe_82599.c                 1.4-1.5
        sys/dev/pci/ixgbe/ixgbe_api.c                   1.3-1.4
        sys/dev/pci/ixgbe/ixgbe_vf.h                    1.2
        sys/dev/pci/ixgbe/ixv.c                         1.3-1.4
        sys/dev/pci/ixgbe/ixv.h                         1.3

 - Sync ixg(4) up to FreeBSD r230572.
   - Fix in the interrupt handler to make sure the stack TX queue is processed.
     (FreeBSD r222588)
   - The maximum read size of incoming packets is done in 1024-byte increments.
     The current code was rounding down the maximum frame size instead of
     routing up, resulting in a read size of 1024 bytes, in the non-jumbo
     frame case, and splitting the packets across multiple mbufs.
     (FreeBSD r225045)
   - Consequently the above problem exposed another issue, which is when
     packets were splitted across multiple mbufs, and all of the mbufs in the
     chain have the M_PKTHDR flag set. (FreeBSD r225045)
   - Use the correct constant for conversion between interrupt rate
     and EITR values (the previous values were off by a factor of 2)
     (FreeBSD r230572)
   - Make dev.ix.N.queueM.interrupt_rate a RW sysctl variable. Changing
     individual values affects the queue immediately, and propagates to all
     interfaces at the next reinit. (FreeBSD r230572)
   - Add dev.ix.N.queueM.irqs rdonly sysctl, to export the actual interrupt
     counts. (FreeBSD r230572)
   - Some netmap related changes.
 - Fix a bug that vlan setting may not apply to the parent interface correctly.
 - Add 82599EN_SFP and 82599_SFP_SF_QP.
 - Modify to make Intel Intel 10G Ethernet (ixg(4)) virtual function ixv(4)
   compilable. Not completed yet. It's required to use MSI-X.
 - Change comments, tabs and spaces to make difference among *BSDs small.
 - Enclose macro argument correctly. Same as *BSDs. No binary change.
 - Add missing parenthesis in IXGBE_CORE_LOCK_ASSERT() macro. No binary change.

diffstat:

 sys/dev/pci/files.pci           |     7 +-
 sys/dev/pci/ixgbe/ixgbe.c       |   252 ++-
 sys/dev/pci/ixgbe/ixgbe.h       |     4 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c |     6 +-
 sys/dev/pci/ixgbe/ixgbe_api.c   |     6 +-
 sys/dev/pci/ixgbe/ixgbe_type.h  |  3810 +++++++++++++++++++-------------------
 sys/dev/pci/ixgbe/ixgbe_vf.h    |     7 +-
 sys/dev/pci/ixgbe/ixv.c         |  1518 ++++++++------
 sys/dev/pci/ixgbe/ixv.h         |   105 +-
 9 files changed, 3087 insertions(+), 2628 deletions(-)

diffs (truncated from 8261 to 300 lines):

diff -r 0ad039e6ff32 -r d43c21a0172c sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Thu Mar 26 11:30:49 2015 +0000
+++ b/sys/dev/pci/files.pci     Thu Mar 26 13:39:34 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.371.4.1 2014/11/02 10:09:44 martin Exp $
+#      $NetBSD: files.pci,v 1.371.4.2 2015/03/26 13:39:34 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -676,8 +676,11 @@
 file   dev/pci/ixgbe/ixgbe_mbx.c       ixg
 file   dev/pci/ixgbe/ixgbe_phy.c       ixg
 file   dev/pci/ixgbe/ixgbe_vf.c        ixg
+
 # This appears to be the driver for virtual instances of i82599.
-#file  dev/pci/ixgbe/ixv.c             ixg
+device ixv: ether, ifnet, arp
+attach ixv at pci
+file   dev/pci/ixgbe/ixv.c             ixv
 
 # Intel i8254x Gigabit Ethernet
 device wm: ether, ifnet, arp, mii, mii_bitbang
diff -r 0ad039e6ff32 -r d43c21a0172c sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Mar 26 11:30:49 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Mar 26 13:39:34 2015 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2011, Intel Corporation 
+  Copyright (c) 2001-2013, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -59,9 +59,10 @@
  * 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.2 2015/02/24 10:41:09 martin Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.3 2015/03/26 13:39:34 martin Exp $*/
 
 #include "opt_inet.h"
+#include "opt_inet6.h"
 
 #include "ixgbe.h"
 
@@ -73,7 +74,7 @@
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "2.3.10";
+char ixgbe_driver_version[] = "2.3.11";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -106,8 +107,10 @@
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_T3_LOM, 0, 0, 0},
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_COMBO_BACKPLANE, 0, 0, 0},
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_BACKPLANE_FCOE, 0, 0, 0},
+       {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF2, 0, 0, 0},
        {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0},
-       {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_DELL, 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},
        /* required last entry */
        {0, 0, 0, 0, 0}
 };
@@ -267,7 +270,7 @@
 #define TUNABLE_INT(__x, __y)
 TUNABLE_INT("hw.ixgbe.enable_aim", &ixgbe_enable_aim);
 
-static int ixgbe_max_interrupt_rate = (8000000 / IXGBE_LOW_LATENCY);
+static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY);
 TUNABLE_INT("hw.ixgbe.max_interrupt_rate", &ixgbe_max_interrupt_rate);
 
 /* How many packets rxeof tries to clean at a time */
@@ -300,7 +303,7 @@
  * it can be a performance win in some workloads, but
  * in others it actually hurts, its off by default. 
  */
-static bool ixgbe_header_split = FALSE;
+static int ixgbe_header_split = FALSE;
 TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split);
 
 #if defined(NETBSD_MSI_OR_MSIX)
@@ -350,6 +353,18 @@
 static int fdir_pballoc = 1;
 #endif
 
+#ifdef DEV_NETMAP
+/*
+ * The #ifdef DEV_NETMAP / #endif blocks in this file are meant to
+ * 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
+ * that extend the standard driver.
+ */
+#include <dev/netmap/ixgbe_netmap.h>
+#endif /* DEV_NETMAP */
+
 /*********************************************************************
  *  Device identification routine
  *
@@ -647,6 +662,9 @@
 
        ixgbe_add_hw_stats(adapter);
 
+#ifdef DEV_NETMAP
+       ixgbe_netmap_attach(adapter);
+#endif /* DEV_NETMAP */
        INIT_DEBUGOUT("ixgbe_attach: end");
        return;
 err_late:
@@ -717,6 +735,9 @@
 
        ether_ifdetach(adapter->ifp);
        callout_halt(&adapter->timer, NULL);
+#ifdef DEV_NETMAP
+       netmap_detach(adapter->ifp);
+#endif /* DEV_NETMAP */
        ixgbe_free_pci_resources(adapter);
 #if 0  /* XXX the NetBSD port is probably missing something here */
        bus_generic_detach(dev);
@@ -1064,6 +1085,9 @@
        else if ((change & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
                ixgbe_set_promisc(adapter);
 
+       /* Set up VLAN support and filter */
+       ixgbe_setup_vlan_hw_support(adapter);
+
        IXGBE_CORE_UNLOCK(adapter);
 
        return rc;
@@ -1289,6 +1313,31 @@
                                msec_delay(1);
                }
                wmb();
+#ifdef DEV_NETMAP
+               /*
+                * In netmap mode, we must preserve the buffers made
+                * available to userspace before the if_init()
+                * (this is true by default on the TX side, because
+                * init makes all buffers available to userspace).
+                *
+                * netmap_reset() and the device specific routines
+                * (e.g. ixgbe_setup_receive_rings()) map these
+                * buffers at the end of the NIC ring, so here we
+                * must set the RDT (tail) register to make sure
+                * they are not overwritten.
+                *
+                * In this driver the NIC ring starts at RDH = 0,
+                * RDT points to the last slot available for reception (?),
+                * so RDT = num_rx_desc - 1 means the whole ring is available.
+                */
+               if (ifp->if_capenable & IFCAP_NETMAP) {
+                       struct netmap_adapter *na = NA(adapter->ifp);
+                       struct netmap_kring *kring = &na->rx_rings[i];
+                       int t = na->num_rx_desc - 1 - kring->nr_hwavail;
+
+                       IXGBE_WRITE_REG(hw, IXGBE_RDT(i), t);
+               } else
+#endif /* DEV_NETMAP */
                IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1);
        }
 
@@ -1534,7 +1583,7 @@
 #if defined(NETBSD_MSI_OR_MSIX)
 /*********************************************************************
  *
- *  MSI Queue Interrupt Service routine
+ *  MSIX Queue Interrupt Service routine
  *
  **********************************************************************/
 void
@@ -1553,6 +1602,17 @@
 
        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? */
@@ -1889,11 +1949,7 @@
        txr->next_avail_desc = i;
 
        txbuf->m_head = m_head;
-       /* We exchange the maps instead of copying because otherwise
-        * we end up with many pointers to the same map and we free
-        * one map twice in ixgbe_free_transmit_structures().  Who
-        * knows what other problems this caused.  --dyoung
-        */
+       /* 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->dt_dmat, map, 0, m_head->m_pkthdr.len,
@@ -2495,7 +2551,9 @@
 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);
 #endif
 }
@@ -2633,7 +2691,6 @@
 
        ifp = adapter->ifp = &ec->ec_if;
        strlcpy(ifp->if_xname, device_xname(dev), IFNAMSIZ);
-       ifp->if_mtu = ETHERMTU;
        ifp->if_baudrate = 1000000000;
        ifp->if_init = ixgbe_init;
        ifp->if_stop = ixgbe_ifstop;
@@ -2663,19 +2720,20 @@
        ifp->if_capenable = 0;
 
        ec->ec_capabilities |= ETHERCAP_VLAN_HWCSUM;
-       ec->ec_capabilities |= ETHERCAP_VLAN_HWTAGGING | ETHERCAP_VLAN_MTU;
        ec->ec_capabilities |= ETHERCAP_JUMBO_MTU;
+       ec->ec_capabilities |= ETHERCAP_VLAN_HWTAGGING
+                           | ETHERCAP_VLAN_MTU;
        ec->ec_capenable = ec->ec_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.
        */
        ec->ec_capabilities |= ETHERCAP_VLAN_HWFILTER;
@@ -3050,9 +3108,20 @@
        struct adapter *adapter = txr->adapter;
        struct ixgbe_tx_buf *txbuf;
        int i;
+#ifdef DEV_NETMAP
+       struct netmap_adapter *na = NA(adapter->ifp);
+       struct netmap_slot *slot;
+#endif /* DEV_NETMAP */
 
        /* Clear the old ring contents */
        IXGBE_TX_LOCK(txr);
+#ifdef DEV_NETMAP
+       /*
+        * (under lock): if in netmap mode, do some consistency
+        * checks and set slot to entry 0 of the netmap ring.
+        */
+       slot = netmap_reset(na, NR_TX, txr->me, 0);
+#endif /* DEV_NETMAP */
        bzero((void *)txr->tx_base,
              (sizeof(union ixgbe_adv_tx_desc)) * adapter->num_tx_desc);
        /* Reset indices */
@@ -3070,6 +3139,25 @@
                        m_freem(txbuf->m_head);
                        txbuf->m_head = NULL;
                }
+#ifdef DEV_NETMAP
+               /*
+                * In netmap mode, set the map for the packet buffer.
+                * NOTE: Some drivers (not this one) also need to set
+                * the physical buffer address in the NIC ring.
+                * Slots in the netmap ring (indexed by "si") are
+                * kring->nkr_hwofs positions "ahead" wrt the
+                * corresponding slot in the NIC ring. In some drivers
+                * (not here) nkr_hwofs can be negative. When computing
+                * si = i + kring->nkr_hwofs make sure to handle wraparounds.
+                */
+               if (slot) {
+                       int si = i + na->tx_rings[txr->me].nkr_hwofs;
+
+                       if (si >= na->num_tx_desc)
+                               si -= na->num_tx_desc;
+                       netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si));
+               }
+#endif /* DEV_NETMAP */
                /* Clear the EOP index */
                txbuf->eop_index = -1;
         }
@@ -3547,6 +3635,48 @@
 
        KASSERT(mutex_owned(&txr->tx_mtx));
 
+#ifdef DEV_NETMAP



Home | Main Index | Thread Index | Old Index