Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/pci/ixgbe Pull up the following revisions, all vi...



details:   https://anonhg.NetBSD.org/src/rev/8ad3f386eb4a
branches:  netbsd-9
changeset: 366619:8ad3f386eb4a
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jun 02 10:45:12 2022 +0000

description:
Pull up the following revisions, all via patch, requested by msaitoh
in ticket #1459:

        sys/dev/pci/ixgbe/ixgbe.c       1.261,1.265-1.268,1.273,1.275-1.277,
                                        1.312,1.316-1.319 via patch
        sys/dev/pci/ixgbe/ixgbe.h       1.85 via patch
        sys/dev/pci/ixgbe/ixgbe_type.h  1.46-1.47
        sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
        sys/dev/pci/ixgbe/ixv.c         1.182

- Reduce code duplication between ixgbe_msix_admin() and
  ixgbe_legacy_irq().
  - Add missing code which was not in ixgbe_msix_admin() from
    ixgbe_legacy_irq() and vice versa.
  - Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
  director reinit failed. NetBSD currently doesn't support flow
  director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
  - Add some debug printf()s.
  - Don't use "more" flag for simplify.
  - Fix typos in comment.
  - KNF.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c      |  384 +++++++++++++++++++---------------------
 sys/dev/pci/ixgbe/ixgbe.h      |    5 +-
 sys/dev/pci/ixgbe/ixgbe_type.h |   13 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c |    6 +-
 sys/dev/pci/ixgbe/ixv.c        |   39 ++--
 5 files changed, 220 insertions(+), 227 deletions(-)

diffs (truncated from 997 to 300 lines):

diff -r afa9bba06e31 -r 8ad3f386eb4a sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue May 31 14:04:24 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Jun 02 10:45:12 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.22 2022/05/31 14:03:26 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.23 2022/06/02 10:45:12 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.22 2022/05/31 14:03:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.23 2022/06/02 10:45:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -262,13 +262,12 @@
 /* Support for pluggable optic modules */
 static bool    ixgbe_sfp_probe(struct adapter *);
 
-/* Legacy (single vector) interrupt handler */
+/* Interrupt functions */
+static int     ixgbe_msix_que(void *);
+static int     ixgbe_msix_admin(void *);
+static void    ixgbe_intr_admin_common(struct adapter *, u32, u32 *);
 static int     ixgbe_legacy_irq(void *);
 
-/* The MSI/MSI-X Interrupt handlers */
-static int     ixgbe_msix_que(void *);
-static int     ixgbe_msix_link(void *);
-
 /* Software interrupts for deferred work */
 static void    ixgbe_handle_que(void *);
 static void    ixgbe_handle_link(void *);
@@ -422,6 +421,9 @@
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
 
+/* Interval between reports of errors */
+static const struct timeval ixgbe_errlog_intrvl = { 60, 0 };   /* 60s */
+
 /************************************************************************
  * ixgbe_initialize_rss_mapping
  ************************************************************************/
@@ -624,12 +626,11 @@
                 * so we do not need to clear the bit, but do it just in case
                 * this code is moved elsewhere.
                 */
-               if (adapter->num_queues > 1 &&
-                   adapter->hw.fc.requested_mode == ixgbe_fc_none) {
+               if ((adapter->num_queues > 1) &&
+                   (adapter->hw.fc.requested_mode == ixgbe_fc_none))
                        srrctl |= IXGBE_SRRCTL_DROP_EN;
-               } else {
+               else
                        srrctl &= ~IXGBE_SRRCTL_DROP_EN;
-               }
 
                IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(j), srrctl);
 
@@ -847,7 +848,8 @@
         * Initialize the shared code
         */
        if (ixgbe_init_shared_code(hw) != 0) {
-               aprint_error_dev(dev, "Unable to initialize the shared code\n");
+               aprint_error_dev(dev,
+                   "Unable to initialize the shared code\n");
                error = ENXIO;
                goto err_out;
        }
@@ -1153,7 +1155,8 @@
        error = ixgbe_start_hw(hw);
        switch (error) {
        case IXGBE_ERR_EEPROM_VERSION:
-               aprint_error_dev(dev, "This device is a pre-production adapter/"
+               aprint_error_dev(dev,
+                   "This device is a pre-production adapter/"
                    "LOM.  Please be aware there may be issues associated "
                    "with your hardware.\nIf you are experiencing problems "
                    "please contact your Intel or hardware representative "
@@ -1439,60 +1442,45 @@
        ADD(IFM_NONE, 0);
 
        /* Media types with matching NetBSD media defines */
-       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) {
+       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T)
                ADD(IFM_10G_T | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T) {
+       if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T)
                ADD(IFM_1000_T | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_100BASE_TX) {
+       if (layer & IXGBE_PHYSICAL_LAYER_100BASE_TX)
                ADD(IFM_100_TX | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_10BASE_T) {
+       if (layer & IXGBE_PHYSICAL_LAYER_10BASE_T)
                ADD(IFM_10_T | IFM_FDX, 0);
-       }
 
        if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU ||
-           layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA) {
+           layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA)
                ADD(IFM_10G_TWINAX | IFM_FDX, 0);
-       }
 
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LR) {
                ADD(IFM_10G_LR | IFM_FDX, 0);
-               if (hw->phy.multispeed_fiber) {
+               if (hw->phy.multispeed_fiber)
                        ADD(IFM_1000_LX | IFM_FDX, 0);
-               }
        }
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR) {
                ADD(IFM_10G_SR | IFM_FDX, 0);
-               if (hw->phy.multispeed_fiber) {
+               if (hw->phy.multispeed_fiber)
                        ADD(IFM_1000_SX | IFM_FDX, 0);
-               }
-       } else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) {
+       } else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX)
                ADD(IFM_1000_SX | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4) {
+       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4)
                ADD(IFM_10G_CX4 | IFM_FDX, 0);
-       }
-
-       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
+
+       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR)
                ADD(IFM_10G_KR | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
+       if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4)
                ADD(IFM_10G_KX4 | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX) {
+       if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX)
                ADD(IFM_1000_KX | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX) {
+       if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX)
                ADD(IFM_2500_KX | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_T) {
+       if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_T)
                ADD(IFM_2500_T | IFM_FDX, 0);
-       }
-       if (layer & IXGBE_PHYSICAL_LAYER_5GBASE_T) {
+       if (layer & IXGBE_PHYSICAL_LAYER_5GBASE_T)
                ADD(IFM_5000_T | IFM_FDX, 0);
-       }
        if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
                ADD(IFM_1000_BX10 | IFM_FDX, 0);
        /* XXX no ifmedia_set? */
@@ -1626,13 +1614,17 @@
                IXGBE_EVC_REGADD(hw, stats, IXGBE_PXONTXC(i), pxontxc[i]);
                IXGBE_EVC_REGADD(hw, stats, IXGBE_PXOFFTXC(i), pxofftxc[i]);
                if (hw->mac.type >= ixgbe_mac_82599EB) {
-                       IXGBE_EVC_REGADD(hw, stats, IXGBE_PXONRXCNT(i), pxonrxc[i]);
-                       IXGBE_EVC_REGADD(hw, stats, IXGBE_PXOFFRXCNT(i), pxoffrxc[i]);
-                       IXGBE_EVC_REGADD(hw, stats, IXGBE_PXON2OFFCNT(i),
-                           pxon2offc[i]);
+                       IXGBE_EVC_REGADD(hw, stats,
+                           IXGBE_PXONRXCNT(i), pxonrxc[i]);
+                       IXGBE_EVC_REGADD(hw, stats,
+                           IXGBE_PXOFFRXCNT(i), pxoffrxc[i]);
+                       IXGBE_EVC_REGADD(hw, stats,
+                           IXGBE_PXON2OFFCNT(i), pxon2offc[i]);
                } else {
-                       IXGBE_EVC_REGADD(hw, stats, IXGBE_PXONRXC(i), pxonrxc[i]);
-                       IXGBE_EVC_REGADD(hw, stats, IXGBE_PXOFFRXC(i), pxoffrxc[i]);
+                       IXGBE_EVC_REGADD(hw, stats,
+                           IXGBE_PXONRXC(i), pxonrxc[i]);
+                       IXGBE_EVC_REGADD(hw, stats,
+                           IXGBE_PXOFFRXC(i), pxoffrxc[i]);
                }
        }
        IXGBE_EVC_ADD(&stats->mpctotal, total_missed_rx);
@@ -1782,8 +1774,8 @@
            NULL, xname, "Watchdog timeouts");
        evcnt_attach_dynamic(&adapter->tso_err, EVCNT_TYPE_MISC,
            NULL, xname, "TSO errors");
-       evcnt_attach_dynamic(&adapter->link_irq, EVCNT_TYPE_INTR,
-           NULL, xname, "Link MSI-X IRQ Handled");
+       evcnt_attach_dynamic(&adapter->admin_irq, EVCNT_TYPE_INTR,
+           NULL, xname, "Admin MSI-X IRQ Handled");
        evcnt_attach_dynamic(&adapter->link_sicount, EVCNT_TYPE_INTR,
            NULL, xname, "Link softint");
        evcnt_attach_dynamic(&adapter->mod_sicount, EVCNT_TYPE_INTR,
@@ -1797,8 +1789,7 @@
        KASSERT(IXGBE_DCB_MAX_TRAFFIC_CLASS == 8);
        for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
                snprintf(adapter->tcs[i].evnamebuf,
-                   sizeof(adapter->tcs[i].evnamebuf), "%s tc%d",
-                   xname, i);
+                   sizeof(adapter->tcs[i].evnamebuf), "%s tc%d", xname, i);
                if (i < __arraycount(stats->mpc)) {
                        evcnt_attach_dynamic(&stats->mpc[i],
                            EVCNT_TYPE_MISC, NULL, adapter->tcs[i].evnamebuf,
@@ -1826,7 +1817,7 @@
                                evcnt_attach_dynamic(&stats->pxon2offc[i],
                                    EVCNT_TYPE_MISC, NULL,
                                    adapter->tcs[i].evnamebuf,
-                           "pxon2offc");
+                                   "pxon2offc");
                }
        }
 
@@ -1836,13 +1827,13 @@
 #endif /* LRO */
 
                snprintf(adapter->queues[i].evnamebuf,
-                   sizeof(adapter->queues[i].evnamebuf), "%s q%d",
-                   xname, i);
+                   sizeof(adapter->queues[i].evnamebuf), "%s q%d", xname, i);
                snprintf(adapter->queues[i].namebuf,
                    sizeof(adapter->queues[i].namebuf), "q%d", i);
 
                if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
-                       aprint_error_dev(dev, "could not create sysctl root\n");
+                       aprint_error_dev(dev,
+                           "could not create sysctl root\n");
                        break;
                }
 
@@ -2090,7 +2081,7 @@
        IXGBE_EVC_STORE(&adapter->enomem_tx_dma_setup, 0);
        IXGBE_EVC_STORE(&adapter->tso_err, 0);
        IXGBE_EVC_STORE(&adapter->watchdog_events, 0);
-       IXGBE_EVC_STORE(&adapter->link_irq, 0);
+       IXGBE_EVC_STORE(&adapter->admin_irq, 0);
        IXGBE_EVC_STORE(&adapter->link_sicount, 0);
        IXGBE_EVC_STORE(&adapter->mod_sicount, 0);
        IXGBE_EVC_STORE(&adapter->msf_sicount, 0);
@@ -2632,7 +2623,9 @@
                            "PCIE Gen3 slot is required.\n");
                }
        } else
-               device_printf(dev, "Unable to determine slot speed/width. The speed/width reported are that of the internal switch.\n");
+               device_printf(dev,
+                   "Unable to determine slot speed/width. The speed/width "
+                   "reported are that of the internal switch.\n");
 
        return;
 } /* ixgbe_get_slot_info */
@@ -2737,9 +2730,8 @@
                 * twice workqueue_enqueue() is not required .
                 */
                workqueue_enqueue(adapter->que_wq, &que->wq_cookie, curcpu());
-       } else {
+       } else
                softint_schedule(que->que_si);
-       }
 }
 
 /************************************************************************
@@ -2753,7 +2745,6 @@
        struct ifnet    *ifp = adapter->ifp;
        struct tx_ring  *txr = que->txr;
        struct rx_ring  *rxr = que->rxr;
-       bool            more;
        u32             newitr = 0;
 
        /* Protect against spurious interrupts */
@@ -2769,13 +2760,6 @@
         */
        que->txrx_use_workqueue = adapter->txrx_use_workqueue;
 
-#ifdef __NetBSD__
-       /* Don't run ixgbe_rxeof in interrupt context */
-       more = true;
-#else
-       more = ixgbe_rxeof(que);
-#endif
-
        IXGBE_TX_LOCK(txr);
        ixgbe_txeof(txr);
        IXGBE_TX_UNLOCK(txr);
@@ -2821,10 +2805,9 @@
         * on 1G and higher.
         */
        if ((adapter->link_speed != IXGBE_LINK_SPEED_100_FULL)
-           && (adapter->link_speed != IXGBE_LINK_SPEED_10_FULL)) {
+           && (adapter->link_speed != IXGBE_LINK_SPEED_10_FULL))
                if (newitr < IXGBE_MIN_RSC_EITR_10G1G)
                        newitr = IXGBE_MIN_RSC_EITR_10G1G;
-       }
 
        /* save for next interrupt */
        que->eitr_setting = newitr;
@@ -2836,10 +2819,7 @@
        rxr->packets = 0;
 
 no_calc:
-       if (more)



Home | Main Index | Thread Index | Old Index