Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Update ixg(4) and ixv(4) up to FreeBSD r282299:



details:   https://anonhg.NetBSD.org/src/rev/5c1300e0313a
branches:  trunk
changeset: 349228:5c1300e0313a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Dec 01 06:56:28 2016 +0000

description:
Update ixg(4) and ixv(4) up to FreeBSD r282299:
- Add support for X55x.
- ADD EEE support (not tested).
- Add WOL support (not tested).
- Add suspend/resume support (not testd).
- Add LPLU support (not tested).
- Add DMA Coalescing (note verified).
- Not tested well for sysctls.
- Fix ixgbe_set_advertise() a bit. At least, FreeBSD r294578 is required
  to work hw.ixg0.advertise_speed sysctl correctly.

diffstat:

 sys/dev/pci/files.pci               |    28 +-
 sys/dev/pci/ixgbe/LICENSE           |     2 +-
 sys/dev/pci/ixgbe/ix_txrx.c         |    71 +-
 sys/dev/pci/ixgbe/ixgbe.c           |  1262 ++++++++++++++++++++++++++--------
 sys/dev/pci/ixgbe/ixgbe.h           |    41 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c     |    11 +-
 sys/dev/pci/ixgbe/ixgbe_82598.h     |     4 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c     |    10 +-
 sys/dev/pci/ixgbe/ixgbe_82599.h     |     4 +-
 sys/dev/pci/ixgbe/ixgbe_api.c       |   126 +++-
 sys/dev/pci/ixgbe/ixgbe_api.h       |    15 +-
 sys/dev/pci/ixgbe/ixgbe_common.c    |    10 +-
 sys/dev/pci/ixgbe/ixgbe_common.h    |     6 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c       |    14 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.h       |     4 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c |     4 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.h |     4 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c |     4 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h |     4 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c       |     8 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h       |     6 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.c    |     2 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.h    |     2 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h     |    13 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c       |   234 +++++-
 sys/dev/pci/ixgbe/ixgbe_phy.h       |    27 +-
 sys/dev/pci/ixgbe/ixgbe_type.h      |   269 +++++-
 sys/dev/pci/ixgbe/ixgbe_vf.c        |     7 +-
 sys/dev/pci/ixgbe/ixgbe_vf.h        |     6 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c      |    14 +-
 sys/dev/pci/ixgbe/ixgbe_x540.h      |     4 +-
 sys/dev/pci/ixgbe/ixv.c             |    57 +-
 32 files changed, 1705 insertions(+), 568 deletions(-)

diffs (truncated from 4328 to 300 lines):

diff -r e10db1970a71 -r 5c1300e0313a sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Thu Dec 01 06:29:39 2016 +0000
+++ b/sys/dev/pci/files.pci     Thu Dec 01 06:56:28 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.383 2016/11/28 02:23:33 msaitoh Exp $
+#      $NetBSD: files.pci,v 1.384 2016/12/01 06:56: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
@@ -665,20 +665,20 @@
 file   dev/pci/if_stge.c               stge
 
 # Intel i82598 & i82599 10-Gigabit Ethernet
-define ixgbe_common
-file   dev/pci/ixgbe/ix_txrx.c ixgbe_common
 device ixg: ether, ifnet, arp
-attach ixg at pci:     ixgbe_common
-file   dev/pci/ixgbe/ixgbe.c           ixg
-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
-file   dev/pci/ixgbe/ixgbe_phy.c       ixg
-file   dev/pci/ixgbe/ixgbe_vf.c        ixg
+attach ixg at pci
+file   dev/pci/ixgbe/ixgbe.c           ixg | ixv
+file   dev/pci/ixgbe/ix_txrx.c         ixg | ixv
+file   dev/pci/ixgbe/ixgbe_netbsd.c    ixg | ixv
+file   dev/pci/ixgbe/ixgbe_82598.c     ixg | ixv
+file   dev/pci/ixgbe/ixgbe_82599.c     ixg | ixv
+file   dev/pci/ixgbe/ixgbe_x540.c      ixg | ixv
+file   dev/pci/ixgbe/ixgbe_x550.c      ixg | ixv
+file   dev/pci/ixgbe/ixgbe_api.c       ixg | ixv
+file   dev/pci/ixgbe/ixgbe_common.c    ixg | ixv
+file   dev/pci/ixgbe/ixgbe_mbx.c       ixg | ixv
+file   dev/pci/ixgbe/ixgbe_phy.c       ixg | ixv
+file   dev/pci/ixgbe/ixgbe_vf.c        ixg | ixv
 
 # This appears to be the driver for virtual instances of i82599.
 device ixv: ether, ifnet, arp
diff -r e10db1970a71 -r 5c1300e0313a sys/dev/pci/ixgbe/LICENSE
--- a/sys/dev/pci/ixgbe/LICENSE Thu Dec 01 06:29:39 2016 +0000
+++ b/sys/dev/pci/ixgbe/LICENSE Thu Dec 01 06:56:28 2016 +0000
@@ -31,4 +31,4 @@
 
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/LICENSE 280182 2015-03-17 18:32:28Z jfv $*/
-/*$NetBSD: LICENSE,v 1.3 2016/12/01 06:27:18 msaitoh Exp $*/
+/*$NetBSD: LICENSE,v 1.4 2016/12/01 06:56:28 msaitoh Exp $*/
diff -r e10db1970a71 -r 5c1300e0313a sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Thu Dec 01 06:29:39 2016 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Thu Dec 01 06:56:28 2016 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2014, Intel Corporation 
+  Copyright (c) 2001-2015, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -58,11 +58,19 @@
  * 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/ix_txrx.c 280182 2015-03-17 18:32:28Z jfv $*/
-/*$NetBSD: ix_txrx.c,v 1.3 2016/12/01 06:27:18 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 282289 2015-04-30 22:53:27Z erj $*/
+/*$NetBSD: ix_txrx.c,v 1.4 2016/12/01 06:56:28 msaitoh Exp $*/
 
 #include "ixgbe.h"
 
+#ifdef DEV_NETMAP
+#include <net/netmap.h>
+#include <sys/selinfo.h>
+#include <dev/netmap/netmap_kern.h>
+
+extern int ix_crcstrip;
+#endif
+
 /*
 ** HW RSC control:
 **  this feature only works with
@@ -259,7 +267,11 @@
         * If everything is setup correctly, it should be the
         * same bucket that the current CPU we're on is.
         */
+#if __FreeBSD_version < 1100054
+       if (m->m_flags & M_FLOWID) {
+#else
        if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
+#endif
 #ifdef RSS
                if (rss_hash2bucket(m->m_pkthdr.flowid,
                    M_HASHTYPE_GET(m), &bucket_id) == 0)
@@ -325,7 +337,12 @@
                enqueued++;
 #if 0 // this is VF-only
 #if __FreeBSD_version >= 1100036
-               if (next->m_flags & M_MCAST)
+               /*
+                * Since we're looking at the tx ring, we can check
+                * to see if we're a VF by examing our tail register
+                * address.
+                */
+               if (txr->tail < IXGBE_TDT(0) && next->m_flags & M_MCAST)
                        if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
 #endif
 #endif
@@ -361,8 +378,8 @@
 }
 
 /*
-** Flush all ring buffers
-*/
+ * Flush all ring buffers
+ */
 void
 ixgbe_qflush(struct ifnet *ifp)
 {
@@ -457,9 +474,9 @@
        }
 
        /*
-       ** Set up the appropriate offload context
-       ** this will consume the first descriptor
-       */
+        * Set up the appropriate offload context
+        * this will consume the first descriptor
+        */
        error = ixgbe_tx_ctx_setup(txr, m_head, &cmd_type_len, &olinfo_status);
        if (__predict_false(error)) {
                return (error);
@@ -476,7 +493,6 @@
        }
 #endif
 
-       olinfo_status |= IXGBE_ADVTXD_CC;
        i = txr->next_avail_desc;
        for (j = 0; j < map->dm_nsegs; j++) {
                bus_size_t seglen;
@@ -503,11 +519,11 @@
 
        txbuf->m_head = m_head;
        /*
-       ** Here we swap the map so the last descriptor,
-       ** which gets the completion interrupt has the
-       ** real map, and the first descriptor gets the
-       ** unused map from this descriptor.
-       */
+        * Here we swap the map so the last descriptor,
+        * which gets the completion interrupt has the
+        * real map, and the first descriptor gets the
+        * unused map from this 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,
@@ -760,9 +776,9 @@
 ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp,
     u32 *cmd_type_len, u32 *olinfo_status)
 {
-       struct m_tag *mtag;
        struct adapter *adapter = txr->adapter;
        struct ethercom *ec = &adapter->osdep.ec;
+       struct m_tag *mtag;
        struct ixgbe_adv_tx_context_desc *TXD;
        struct ether_vlan_header *eh;
        struct ip ip;
@@ -797,6 +813,8 @@
                vtag = htole16(VLAN_TAG_VALUE(mtag) & 0xffff);
                vlan_macip_lens |= (vtag << IXGBE_ADVTXD_VLAN_SHIFT);
        }
+       else if (!IXGBE_IS_X550VF(adapter) && (offload == FALSE))
+               return (0);
 
        /*
         * Determine where frame payload starts.
@@ -1271,7 +1289,6 @@
        rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
        rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
 #ifdef DEV_NETMAP /* crcstrip is optional in netmap */
-       extern int ix_crcstrip;
        if (adapter->ifp->if_capenable & IFCAP_NETMAP && !ix_crcstrip)
 #endif /* DEV_NETMAP */
        rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
@@ -1350,6 +1367,7 @@
                 */
                if ((rxbuf->flags & IXGBE_RX_COPY) == 0) {
                        /* Get the memory mapping */
+                       ixgbe_dmamap_unload(rxr->ptag, rxbuf->pmap);
                        error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat,
                            rxbuf->pmap, mp, BUS_DMA_NOWAIT);
                        if (error != 0) {
@@ -1421,8 +1439,7 @@
 
        for (i = 0; i < rxr->num_desc; i++, rxbuf++) {
                rxbuf = &rxr->rx_buffers[i];
-               error = ixgbe_dmamap_create(rxr->ptag,
-                   BUS_DMA_NOWAIT, &rxbuf->pmap);
+               error = ixgbe_dmamap_create(rxr->ptag, 0, &rxbuf->pmap);
                if (error) {
                        aprint_error_dev(dev, "Unable to create RX dma map\n");
                        goto fail;
@@ -1775,6 +1792,7 @@
                m_free(rbuf->buf);
                rbuf->buf = NULL;
        }
+       ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 
        rbuf->flags = 0;
 
@@ -1788,9 +1806,6 @@
  *  the mbufs in the descriptor and sends data which has been
  *  dma'ed into host memory to upper layer.
  *
- *  We loop at most count times if count is > 0, or until done if
- *  count < 0.
- *
  *  Return TRUE for more work, FALSE for all clean.
  *********************************************************************/
 bool
@@ -1859,10 +1874,9 @@
 
                /* Make sure bad packets are discarded */
                if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) {
-#if 0 // VF-only
 #if __FreeBSD_version >= 1100036
-               if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-#endif
+                       if (IXGBE_IS_VF(adapter))
+                               if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 #endif
                        rxr->rx_discarded.ev_count++;
                        ixgbe_rx_discard(rxr, i);
@@ -1977,6 +1991,9 @@
 #ifdef RSS
                        sendmp->m_pkthdr.flowid =
                            le32toh(cur->wb.lower.hi_dword.rss);
+#if __FreeBSD_version < 1100054
+                       sendmp->m_flags |= M_FLOWID;
+#endif
                        switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {
                        case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
                                M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV4);
@@ -2010,7 +2027,11 @@
                        }
 #else /* RSS */
                        sendmp->m_pkthdr.flowid = que->msix;
+#if __FreeBSD_version >= 1100054
                        M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE);
+#else
+                       sendmp->m_flags |= M_FLOWID;
+#endif
 #endif /* RSS */
 #endif /* FreeBSD_version */
                }
diff -r e10db1970a71 -r 5c1300e0313a sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Dec 01 06:29:39 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Dec 01 06:56:28 2016 +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/if_ix.c 280182 2015-03-17 18:32:28Z jfv $*/
-/*$NetBSD: ixgbe.c,v 1.43 2016/12/01 06:27:18 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 282299 2015-05-01 12:10:36Z bz $*/
+/*$NetBSD: ixgbe.c,v 1.44 2016/12/01 06:56:28 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -77,7 +77,7 @@
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "2.7.4";
+char ixgbe_driver_version[] = "2.8.3";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -142,6 +142,8 @@
 #if 0
 static int      ixgbe_shutdown(device_t);
 #endif
+static bool    ixgbe_suspend(device_t, const pmf_qual_t *);
+static bool    ixgbe_resume(device_t, const pmf_qual_t *);
 static int      ixgbe_ioctl(struct ifnet *, u_long, void *);
 static void    ixgbe_ifstop(struct ifnet *, int);
 static int     ixgbe_init(struct ifnet *);
@@ -162,7 +164,12 @@
 static void    ixgbe_free_pci_resources(struct adapter *);
 static void    ixgbe_local_timer(void *);
 static int     ixgbe_setup_interface(device_t, struct adapter *);
+static void    ixgbe_config_dmac(struct adapter *);
+static void    ixgbe_config_delay_values(struct adapter *);
 static void    ixgbe_config_link(struct adapter *);
+static void    ixgbe_check_eee_support(struct adapter *);
+static void    ixgbe_check_wol_support(struct adapter *);



Home | Main Index | Thread Index | Old Index