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 Update ixg(4) and ixv(4) up to FreeBSD r28...



details:   https://anonhg.NetBSD.org/src/rev/6d987d47b4bc
branches:  trunk
changeset: 349226:6d987d47b4bc
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Dec 01 06:27:18 2016 +0000

description:
Update ixg(4) and ixv(4) up to FreeBSD r280197:
- Add support for 82599_QSFP_SF_QP and X540T1.
- Add partial support for X55x. It's required to sync with FreeBSD r282299
  to support X55x.
- Bugfixes.

diffstat:

 sys/dev/pci/ixgbe/LICENSE           |     6 +-
 sys/dev/pci/ixgbe/ix_txrx.c         |   164 +-
 sys/dev/pci/ixgbe/ixgbe.c           |   869 +++++++----
 sys/dev/pci/ixgbe/ixgbe.h           |   138 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c     |    94 +-
 sys/dev/pci/ixgbe/ixgbe_82598.h     |     5 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c     |  1111 +++++++-------
 sys/dev/pci/ixgbe/ixgbe_82599.h     |    11 +-
 sys/dev/pci/ixgbe/ixgbe_api.c       |   336 ++++-
 sys/dev/pci/ixgbe/ixgbe_api.h       |    49 +-
 sys/dev/pci/ixgbe/ixgbe_common.c    |   824 ++++++++--
 sys/dev/pci/ixgbe/ixgbe_common.h    |    29 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c       |    34 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.h       |     5 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c |     6 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.h |     4 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c |    16 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h |     4 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c       |    31 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h       |     6 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.c    |    15 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.h    |     3 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h     |     8 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c       |   897 ++++++++++--
 sys/dev/pci/ixgbe/ixgbe_phy.h       |    38 +-
 sys/dev/pci/ixgbe/ixgbe_type.h      |   680 ++++++++-
 sys/dev/pci/ixgbe/ixgbe_vf.c        |    74 +-
 sys/dev/pci/ixgbe/ixgbe_vf.h        |    19 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c      |   337 ++--
 sys/dev/pci/ixgbe/ixgbe_x540.h      |    10 +-
 sys/dev/pci/ixgbe/ixv.c             |  2551 +++-------------------------------
 31 files changed, 4450 insertions(+), 3924 deletions(-)

diffs (truncated from 13412 to 300 lines):

diff -r 43a6fd28d625 -r 6d987d47b4bc sys/dev/pci/ixgbe/LICENSE
--- a/sys/dev/pci/ixgbe/LICENSE Thu Dec 01 05:07:27 2016 +0000
+++ b/sys/dev/pci/ixgbe/LICENSE Thu Dec 01 06:27:18 2016 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2013, Intel Corporation 
+  Copyright (c) 2001-2015, 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: 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 $*/
+/*$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 $*/
diff -r 43a6fd28d625 -r 6d987d47b4bc sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Thu Dec 01 05:07:27 2016 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Thu Dec 01 06:27:18 2016 +0000
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2013, Intel Corporation 
+  Copyright (c) 2001-2014, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -58,13 +58,13 @@
  * 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 279805 2015-03-09 10:29:15Z araujo $*/
-/*$NetBSD: ix_txrx.c,v 1.2 2016/11/30 05:30:28 msaitoh Exp $*/
+/*$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 $*/
 
 #include "ixgbe.h"
 
 /*
-** HW RSC control: 
+** HW RSC control:
 **  this feature only works with
 **  IPv4, and only on 82599 and later.
 **  Also this will cause IP forwarding to
@@ -77,6 +77,64 @@
 */
 static bool ixgbe_rsc_enable = FALSE;
 
+#ifdef IXGBE_FDIR
+/*
+** For Flow Director: this is the
+** number of TX packets we sample
+** for the filter pool, this means
+** every 20th packet will be probed.
+**
+** This feature can be disabled by
+** setting this to 0.
+*/
+static int atr_sample_rate = 20;
+#endif
+
+/* Shared PCI config read/write */
+u16
+ixgbe_read_pci_cfg(struct ixgbe_hw *hw, u32 reg)
+{
+       switch (reg % 4) {
+       case 0:
+               return pci_conf_read(hw->back->pc, hw->back->tag, reg) &
+                   __BITS(15, 0);
+       case 2:
+               return __SHIFTOUT(pci_conf_read(hw->back->pc, hw->back->tag,
+                   reg - 2), __BITS(31, 16));
+       default:
+               panic("%s: invalid register (%" PRIx32, __func__, reg); 
+               break;
+       }
+}
+
+void
+ixgbe_write_pci_cfg(struct ixgbe_hw *hw, u32 reg, u16 value)
+{
+       pcireg_t old;
+
+       switch (reg % 4) {
+       case 0:
+               old = pci_conf_read(hw->back->pc, hw->back->tag, reg) &
+                   __BITS(31, 16);
+               pci_conf_write(hw->back->pc, hw->back->tag, reg, value | old);
+               break;
+       case 2:
+               old = pci_conf_read(hw->back->pc, hw->back->tag, reg - 2) &
+                   __BITS(15, 0);
+               pci_conf_write(hw->back->pc, hw->back->tag, reg - 2,
+                   __SHIFTIN(value, __BITS(31, 16)) | old);
+               break;
+       default:
+               panic("%s: invalid register (%" PRIx32, __func__, reg); 
+               break;
+       }
+
+       return;
+}
+
+/*********************************************************************
+ *  Local Function prototypes
+ *********************************************************************/
 static void    ixgbe_setup_transmit_ring(struct tx_ring *);
 static void     ixgbe_free_transmit_buffers(struct tx_ring *);
 static int     ixgbe_setup_receive_ring(struct rx_ring *);
@@ -97,7 +155,6 @@
 static __inline void ixgbe_rx_input(struct rx_ring *, struct ifnet *,
                    struct mbuf *, u32);
 
-static void     ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *);
 static void    ixgbe_setup_hw_rsc(struct rx_ring *);
 
 #ifdef IXGBE_LEGACY_TX
@@ -155,11 +212,6 @@
 
                /* Send a copy of the frame to the BPF listener */
                bpf_mtap(ifp, m_head);
-
-               /* Set watchdog on */
-               getmicrotime(&txr->watchdog_time);
-               txr->queue_status = IXGBE_QUEUE_WORKING;
-
        }
        return;
 }
@@ -200,7 +252,6 @@
        uint32_t bucket_id;
 #endif
 
-       /* Which queue to use */
        /*
         * When doing RSS, map it to the same outbound queue
         * as the incoming flow would be mapped to.
@@ -211,18 +262,18 @@
        if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
 #ifdef RSS
                if (rss_hash2bucket(m->m_pkthdr.flowid,
-                   M_HASHTYPE_GET(m), &bucket_id) == 0) {
-                       /* XXX TODO: spit out something if bucket_id > num_queues? */
+                   M_HASHTYPE_GET(m), &bucket_id) == 0)
+                       /* TODO: spit out something if bucket_id > num_queues? */
                        i = bucket_id % adapter->num_queues;
-               } else {
+               else
 #endif
                        i = m->m_pkthdr.flowid % adapter->num_queues;
-#ifdef RSS
-               }
-#endif
-       } else {
+       } else
                i = curcpu % adapter->num_queues;
-       }
+
+       /* Check for a hung queue and pick alternative */
+       if (((1 << i) & adapter->active_queues) == 0)
+               i = ffsl(adapter->active_queues);
 
        txr = &adapter->tx_rings[i];
        que = &adapter->queues[i];
@@ -272,6 +323,12 @@
                drbr_advance(ifp, txr->br);
 #endif
                enqueued++;
+#if 0 // this is VF-only
+#if __FreeBSD_version >= 1100036
+               if (next->m_flags & M_MCAST)
+                       if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
+#endif
+#endif
                /* Send a copy of the frame to the BPF listener */
                bpf_mtap(ifp, next);
                if ((ifp->if_flags & IFF_RUNNING) == 0)
@@ -281,12 +338,6 @@
 #endif
        }
 
-       if (enqueued > 0) {
-               /* Set watchdog on */
-               txr->queue_status = IXGBE_QUEUE_WORKING;
-               getmicrotime(&txr->watchdog_time);
-       }
-
        if (txr->tx_avail < IXGBE_TX_CLEANUP_THRESHOLD)
                ixgbe_txeof(txr);
 
@@ -329,6 +380,7 @@
 }
 #endif /* IXGBE_LEGACY_TX */
 
+
 /*********************************************************************
  *
  *  This routine maps the mbufs to tx descriptors, allowing the
@@ -424,6 +476,7 @@
        }
 #endif
 
+       olinfo_status |= IXGBE_ADVTXD_CC;
        i = txr->next_avail_desc;
        for (j = 0; j < map->dm_nsegs; j++) {
                bus_size_t seglen;
@@ -471,7 +524,11 @@
         * hardware that this frame is available to transmit.
         */
        ++txr->total_packets.ev_count;
-       IXGBE_WRITE_REG(&adapter->hw, IXGBE_TDT(txr->me), i);
+       IXGBE_WRITE_REG(&adapter->hw, txr->tail, i);
+
+       /* Mark queue as having work */
+       if (txr->busy == 0)
+               txr->busy = 1;
 
        return 0;
 }
@@ -739,8 +796,7 @@
        if ((mtag = VLAN_OUTPUT_TAG(ec, mp)) != NULL) {
                vtag = htole16(VLAN_TAG_VALUE(mtag) & 0xffff);
                vlan_macip_lens |= (vtag << IXGBE_ADVTXD_VLAN_SHIFT);
-       } else if (offload == FALSE) /* ... no offload to do */
-               return 0;
+       }
 
        /*
         * Determine where frame payload starts.
@@ -761,6 +817,9 @@
        /* Set the ether header length */
        vlan_macip_lens |= ehdrlen << IXGBE_ADVTXD_MACLEN_SHIFT;
 
+       if (offload == FALSE)
+               goto no_offloads;
+
        switch (etype) {
        case ETHERTYPE_IP:
                m_copydata(mp, ehdrlen, sizeof(ip), &ip);
@@ -790,7 +849,6 @@
                *olinfo_status |= IXGBE_TXD_POPTS_IXSM << 8;
 
        vlan_macip_lens |= ip_hlen;
-       type_tucmd_mlhl |= IXGBE_ADVTXD_DCMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT;
 
        if (mp->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_TCPv6)) {
                type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP;
@@ -802,6 +860,9 @@
                KASSERT(ipproto == IPPROTO_UDP);
        }
 
+no_offloads:
+       type_tucmd_mlhl |= IXGBE_ADVTXD_DCMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT;
+
        /* Now copy bits into descriptor */
        TXD->vlan_macip_lens = htole32(vlan_macip_lens);
        TXD->type_tucmd_mlhl = htole32(type_tucmd_mlhl);
@@ -936,6 +997,7 @@
        return (0);
 }
 
+
 /**********************************************************************
  *
  *  Examine each tx_buffer in the used queue. If the hardware is done
@@ -952,7 +1014,6 @@
        u16                     limit = txr->process_limit;
        struct ixgbe_tx_buf     *buf;
        union ixgbe_adv_tx_desc *txd;
-       struct timeval now, elapsed;
 
        KASSERT(mutex_owned(&txr->tx_mtx));
 
@@ -987,7 +1048,7 @@
 #endif /* DEV_NETMAP */
 
        if (txr->tx_avail == txr->num_desc) {
-               txr->queue_status = IXGBE_QUEUE_IDLE;
+               txr->busy = 0;
                return;
        }
 
@@ -1051,7 +1112,6 @@
                ++txr->packets;
                ++processed;
                ++ifp->if_opackets;
-               getmicrotime(&txr->watchdog_time);
 
                /* Try the next packet */
                ++txd;
@@ -1073,22 +1133,29 @@
        txr->next_to_clean = work;
 
        /*
-       ** Watchdog calculation, we know there's
+       ** Queue Hang detection, we know there's
        ** work outstanding or the first return



Home | Main Index | Thread Index | Old Index