Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci/ixgbe Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/52c542622b4c
branches:  netbsd-8
changeset: 435181:52c542622b4c
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 07 13:33:23 2018 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #961):

        sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.13
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.51
        sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.36
        sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.23
        sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.8
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.163
        sys/dev/pci/ixgbe/ix_txrx.c: revision 1.49

  Add force_10_100_autonego sysctl. The default value is 0(false).

This sysctl is only for 550EM_a with PHY firmware for a while.

  Make jcl allocation per queue to reduce mutex spin. Tested by me and
knakahara.

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c      |  26 ++++++++++++++------------
 sys/dev/pci/ixgbe/ixgbe.c        |  11 ++++++++++-
 sys/dev/pci/ixgbe/ixgbe.h        |   9 ++++++---
 sys/dev/pci/ixgbe/ixgbe_netbsd.c |  16 ++++++++--------
 sys/dev/pci/ixgbe/ixgbe_osdep.h  |   3 +--
 sys/dev/pci/ixgbe/ixgbe_type.h   |   3 ++-
 sys/dev/pci/ixgbe/ixgbe_x550.c   |  10 +++++++---
 7 files changed, 48 insertions(+), 30 deletions(-)

diffs (229 lines):

diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Tue Aug 07 13:33:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.11 2018/06/09 14:59:43 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.12 2018/08/07 13:33:23 martin Exp $ */
 
 /******************************************************************************
 
@@ -1343,7 +1343,7 @@
        while (j != limit) {
                rxbuf = &rxr->rx_buffers[i];
                if (rxbuf->buf == NULL) {
-                       mp = ixgbe_getjcl(&adapter->jcl_head, M_NOWAIT,
+                       mp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT,
                            MT_DATA, M_PKTHDR, rxr->mbuf_sz);
                        if (mp == NULL) {
                                rxr->no_jmbuf.ev_count++;
@@ -1505,6 +1505,17 @@
        /* Free current RX buffer structs and their mbufs */
        ixgbe_free_receive_ring(rxr);
 
+       IXGBE_RX_UNLOCK(rxr);
+       /*
+        * Now reinitialize our supply of jumbo mbufs.  The number
+        * or size of jumbo mbufs may have changed.
+        * Assume all of rxr->ptag are the same.
+        */
+       ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr,
+           (2 * adapter->num_rx_desc), adapter->rx_mbuf_sz);
+
+       IXGBE_RX_LOCK(rxr);
+
        /* Now replenish the mbufs */
        for (int j = 0; j != rxr->num_desc; ++j) {
                struct mbuf *mp;
@@ -1534,7 +1545,7 @@
 #endif /* DEV_NETMAP */
 
                rxbuf->flags = 0;
-               rxbuf->buf = ixgbe_getjcl(&adapter->jcl_head, M_NOWAIT,
+               rxbuf->buf = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT,
                    MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz);
                if (rxbuf->buf == NULL) {
                        error = ENOBUFS;
@@ -1611,15 +1622,6 @@
        struct rx_ring *rxr = adapter->rx_rings;
        int            j;
 
-       /*
-        * Now reinitialize our supply of jumbo mbufs.  The number
-        * or size of jumbo mbufs may have changed.
-        * Assume all of rxr->ptag are the same.
-        */
-       ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat,
-           (2 * adapter->num_rx_desc) * adapter->num_queues,
-           adapter->rx_mbuf_sz);
-
        for (j = 0; j < adapter->num_queues; j++, rxr++)
                if (ixgbe_setup_receive_ring(rxr))
                        goto fail;
diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue Aug 07 13:33:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.21 2018/07/26 23:21:54 snj Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.22 2018/08/07 13:33:23 martin Exp $ */
 
 /******************************************************************************
 
@@ -3315,6 +3315,15 @@
                        aprint_error_dev(dev, "could not create sysctl\n");
        }
 
+       if ((hw->mac.type == ixgbe_mac_X550EM_a)
+           && (hw->phy.type == ixgbe_phy_fw))
+               if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
+                   CTLTYPE_BOOL, "force_10_100_autonego",
+                   SYSCTL_DESCR("Force autonego on 10M and 100M"),
+                   NULL, 0, &hw->phy.force_10_100_autonego, 0,
+                   CTL_CREATE, CTL_EOL) != 0)
+                       aprint_error_dev(dev, "could not create sysctl\n");
+
        if (adapter->feat_cap & IXGBE_FEATURE_EEE) {
                if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
                    CTLTYPE_INT, "eee_state",
diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Tue Aug 07 13:33:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.13 2018/07/26 23:55:30 snj Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.14 2018/08/07 13:33:23 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -417,6 +417,9 @@
 #endif
        struct ixgbe_rx_buf     *rx_buffers;
        ixgbe_dma_tag_t         *ptag;
+       u16                     last_rx_mbuf_sz;
+       u32                     last_num_rx_desc;
+       ixgbe_extmem_head_t     jcl_head;
 
        u64                     bytes; /* Used for AIM calc */
        u64                     packets;
@@ -602,7 +605,6 @@
 
        struct sysctllog        *sysctllog;
        const struct sysctlnode *sysctltop;
-       ixgbe_extmem_head_t jcl_head;
 };
 
 /* Precision Time Sync (IEEE 1588) defines */
@@ -752,7 +754,8 @@
 const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
 
 /* For NetBSD */
-void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, int, size_t);
+void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, struct rx_ring *,
+    int, size_t);
 
 #include "ixgbe_bypass.h"
 #include "ixgbe_fdir.h"
diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ixgbe_netbsd.c
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.c  Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.c  Tue Aug 07 13:33:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.1 2018/06/09 14:59:43 martin Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.2 2018/08/07 13:33:23 martin Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -162,10 +162,10 @@
 }
 
 void
-ixgbe_jcl_reinit(struct adapter *adapter, bus_dma_tag_t dmat, int nbuf,
-    size_t size)
+ixgbe_jcl_reinit(struct adapter *adapter, bus_dma_tag_t dmat,
+    struct rx_ring *rxr, int nbuf, size_t size)
 {
-       ixgbe_extmem_head_t *eh = &adapter->jcl_head;
+       ixgbe_extmem_head_t *eh = &rxr->jcl_head;
        ixgbe_extmem_t *em;
        int i;
 
@@ -182,8 +182,8 @@
         *  Note that the num_rx_desc is currently fixed value. It's never
         * changed after device is attached.
         */
-       if ((adapter->osdep.last_rx_mbuf_sz == adapter->rx_mbuf_sz)
-           && (adapter->osdep.last_num_rx_desc == adapter->num_rx_desc))
+       if ((rxr->last_rx_mbuf_sz == rxr->mbuf_sz)
+           && (rxr->last_num_rx_desc == adapter->num_rx_desc))
                return;
 
        /* Free all dmamem */
@@ -205,8 +205,8 @@
        }
 
        /* Keep current parameters */
-       adapter->osdep.last_rx_mbuf_sz = adapter->rx_mbuf_sz;
-       adapter->osdep.last_num_rx_desc = adapter->num_rx_desc;
+       rxr->last_rx_mbuf_sz = adapter->rx_mbuf_sz;
+       rxr->last_num_rx_desc = adapter->num_rx_desc;
 }
 
 static void
diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ixgbe_osdep.h
--- a/sys/dev/pci/ixgbe/ixgbe_osdep.h   Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_osdep.h   Tue Aug 07 13:33:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_osdep.h,v 1.17.6.4 2018/06/09 14:59:43 martin Exp $ */
+/* $NetBSD: ixgbe_osdep.h,v 1.17.6.5 2018/08/07 13:33:23 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -208,7 +208,6 @@
        bus_size_t         mem_size;
        bus_dma_tag_t      dmat;
        u16                last_rx_mbuf_sz;
-       u32                last_num_rx_desc;
        pci_intr_handle_t  *intrs;
        int                nintrs;
        void               *ihs[IXG_MAX_NINTR];
diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ixgbe_type.h
--- a/sys/dev/pci/ixgbe/ixgbe_type.h    Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_type.h    Tue Aug 07 13:33:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.22.2.6 2018/07/26 23:21:54 snj Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.22.2.7 2018/08/07 13:33:23 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -4166,6 +4166,7 @@
        enum ixgbe_media_type           media_type;
        u32 phy_semaphore_mask;
        bool                            reset_disable;
+       bool                            force_10_100_autonego;
        ixgbe_autoneg_advertised        autoneg_advertised;
        ixgbe_link_speed speeds_supported;
        ixgbe_link_speed eee_speeds_supported;
diff -r cd4764ad2882 -r 52c542622b4c sys/dev/pci/ixgbe/ixgbe_x550.c
--- a/sys/dev/pci/ixgbe/ixgbe_x550.c    Tue Aug 07 13:28:59 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_x550.c    Tue Aug 07 13:33:23 2018 +0000
@@ -847,9 +847,10 @@
                setup[0] |= FW_PHY_ACT_SETUP_LINK_EEE;
 
 #ifdef IXGBE_DENVERTON_WA
-       /* Don't use auto-nego for 10/100Mbps */
-       if ((hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_100_FULL)
-           || (hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_10_FULL)) {
+       if ((hw->phy.force_10_100_autonego == false)
+           && ((hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_100_FULL)
+               || (hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_10_FULL))) {
+               /* Don't use auto-nego for 10/100Mbps */
                setup[0] &= ~FW_PHY_ACT_SETUP_LINK_AN;
                setup[0] &= ~FW_PHY_ACT_SETUP_LINK_EEE;
                setup[0] &= ~(FW_PHY_ACT_SETUP_LINK_PAUSE_RXTX
@@ -862,6 +863,9 @@
                return rc;
 
 #ifdef IXGBE_DENVERTON_WA
+       if (hw->phy.force_10_100_autonego == true)
+               goto out;
+
        ret_val = ixgbe_read_phy_reg_x550a(hw, MII_BMCR, 0, &phydata);
        if (ret_val != 0)
                goto out;



Home | Main Index | Thread Index | Old Index