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 the following revisions, reques...



details:   https://anonhg.NetBSD.org/src/rev/1914fb775461
branches:  netbsd-8
changeset: 366632:1914fb775461
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jun 03 12:31:09 2022 +0000

description:
Pull up the following revisions, requestes by msaitoh in ticket #1746:

        sys/dev/pci/ixgbe/ix_txrx.c                     1.95
        sys/dev/pci/ixgbe/ixgbe.c                       1.261,1.263,
                                                        1.265-1.268,1.273,
                                                        1.275-1.277,1.305,
                                                        1.312,
                                                        1.316-1.321 via patch
        sys/dev/pci/ixgbe/ixgbe.h                       1.85 via patch
        sys/dev/pci/ixgbe/ixgbe_mbx.c                   1.19
        sys/dev/pci/ixgbe/ixgbe_netbsd.h                1.15-1.16
        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.178,1.182 via patch

- 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.
  - Use macro.
  - Fix typos in comment.
  - KNF.

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c      |   46 +-
 sys/dev/pci/ixgbe/ixgbe.c        |  791 ++++++++++++++++++--------------------
 sys/dev/pci/ixgbe/ixgbe.h        |    5 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c    |   59 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.h |   31 +-
 sys/dev/pci/ixgbe/ixgbe_type.h   |   13 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c   |    6 +-
 sys/dev/pci/ixgbe/ixv.c          |  155 +++---
 8 files changed, 554 insertions(+), 552 deletions(-)

diffs (truncated from 2199 to 300 lines):

diff -r 211b78891aa7 -r 1914fb775461 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Tue May 31 14:08:47 2022 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Fri Jun 03 12:31:09 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -247,7 +247,7 @@
 
        if (__predict_false(!pcq_put(txr->txr_interq, m))) {
                m_freem(m);
-               txr->pcq_drops.ev_count++;
+               IXGBE_EVC_ADD(&txr->pcq_drops, 1);
                return ENOBUFS;
        }
        if (IXGBE_TX_TRYLOCK(txr)) {
@@ -475,7 +475,7 @@
        /* Make certain there are enough descriptors */
        if (txr->tx_avail < (map->dm_nsegs + 2)) {
                txr->txr_no_space = true;
-               txr->no_desc_avail.ev_count++;
+               IXGBE_EVC_ADD(&txr->no_desc_avail, 1);
                ixgbe_dmamap_unload(txr->txtag, txbuf->map);
                return EAGAIN;
        }
@@ -546,7 +546,7 @@
         * Advance the Transmit Descriptor Tail (Tdt), this tells the
         * hardware that this frame is available to transmit.
         */
-       ++txr->total_packets.ev_count;
+       IXGBE_EVC_ADD(&txr->total_packets, 1);
        IXGBE_WRITE_REG(&adapter->hw, txr->tail, i);
 
        /*
@@ -583,7 +583,7 @@
 
        while ((m = pcq_get(txr->txr_interq)) != NULL) {
                m_freem(m);
-               txr->pcq_drops.ev_count++;
+               IXGBE_EVC_ADD(&txr->pcq_drops, 1);
        }
 }
 
@@ -846,7 +846,7 @@
                int rv = ixgbe_tso_setup(txr, mp, cmd_type_len, olinfo_status);
 
                if (rv != 0)
-                       ++adapter->tso_err.ev_count;
+                       IXGBE_EVC_ADD(&adapter->tso_err, 1);
                return rv;
        }
 
@@ -1088,7 +1088,7 @@
        *cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE;
        *olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8;
        *olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT;
-       ++txr->tso_tx.ev_count;
+       IXGBE_EVC_ADD(&txr->tso_tx, 1);
 
        return (0);
 } /* ixgbe_tso_setup */
@@ -1360,7 +1360,7 @@
                if (__predict_false(rxbuf->buf == NULL)) {
                        mp = ixgbe_getcl();
                        if (mp == NULL) {
-                               rxr->no_mbuf.ev_count++;
+                               IXGBE_EVC_ADD(&rxr->no_mbuf, 1);
                                goto update;
                        }
                        mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz;
@@ -1549,7 +1549,7 @@
                rxbuf->flags = 0;
                rxbuf->buf = ixgbe_getcl();
                if (rxbuf->buf == NULL) {
-                       rxr->no_mbuf.ev_count++;
+                       IXGBE_EVC_ADD(&rxr->no_mbuf, 1);
                        error = ENOBUFS;
                        goto fail;
                }
@@ -1582,11 +1582,11 @@
        rxr->next_to_refresh = adapter->num_rx_desc - 1; /* Fully allocated */
        rxr->lro_enabled = FALSE;
        rxr->discard_multidesc = false;
-       rxr->rx_copies.ev_count = 0;
+       IXGBE_EVC_STORE(&rxr->rx_copies, 0);
 #if 0 /* NetBSD */
-       rxr->rx_bytes.ev_count = 0;
+       IXGBE_EVC_STORE(&rxr->rx_bytes, 0);
 #if 1  /* Fix inconsistency */
-       rxr->rx_packets.ev_count = 0;
+       IXGBE_EVC_STORE(&rxr->rx_packets, 0);
 #endif
 #endif
        rxr->vtag_strip = FALSE;
@@ -1918,7 +1918,7 @@
                        if (adapter->feat_en & IXGBE_FEATURE_VF)
                                if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 #endif
-                       rxr->rx_discarded.ev_count++;
+                       IXGBE_EVC_ADD(&rxr->rx_discarded, 1);
                        ixgbe_rx_discard(rxr, i);
                        discard_multidesc = false;
                        goto next_desc;
@@ -1934,14 +1934,14 @@
                                /* For short packet. See below. */
                                sendmp = m_gethdr(M_NOWAIT, MT_DATA);
                                if (__predict_false(sendmp == NULL)) {
-                                       rxr->no_mbuf.ev_count++;
+                                       IXGBE_EVC_ADD(&rxr->no_mbuf, 1);
                                        discard = true;
                                }
                        } else {
                                /* For long packet. */
                                newmp = ixgbe_getcl();
                                if (__predict_false(newmp == NULL)) {
-                                       rxr->no_mbuf.ev_count++;
+                                       IXGBE_EVC_ADD(&rxr->no_mbuf, 1);
                                        discard = true;
                                }
                        }
@@ -2045,7 +2045,7 @@
                                sendmp->m_data += ETHER_ALIGN;
                                memcpy(mtod(sendmp, void *),
                                    mtod(mp, void *), len);
-                               rxr->rx_copies.ev_count++;
+                               IXGBE_EVC_ADD(&rxr->rx_copies, 1);
                                rbuf->flags |= IXGBE_RX_COPY;
                        } else {
                                /* For long packet */
@@ -2074,10 +2074,10 @@
                } else { /* Sending this frame */
                        m_set_rcvif(sendmp, ifp);
                        ++rxr->packets;
-                       rxr->rx_packets.ev_count++;
+                       IXGBE_EVC_ADD(&rxr->rx_packets, 1);
                        /* capture data for AIM */
                        rxr->bytes += sendmp->m_pkthdr.len;
-                       rxr->rx_bytes.ev_count += sendmp->m_pkthdr.len;
+                       IXGBE_EVC_ADD(&rxr->rx_bytes, sendmp->m_pkthdr.len);
                        /* Process vlan info */
                        if ((rxr->vtag_strip) && (staterr & IXGBE_RXD_STAT_VP))
                                vtag = le16toh(cur->wb.upper.vlan);
@@ -2218,23 +2218,23 @@
 
        /* IPv4 checksum */
        if (status & IXGBE_RXD_STAT_IPCS) {
-               stats->ipcs.ev_count++;
+               IXGBE_EVC_ADD(&stats->ipcs, 1);
                if (!(errors & IXGBE_RXD_ERR_IPE)) {
                        /* IP Checksum Good */
                        mp->m_pkthdr.csum_flags = M_CSUM_IPv4;
                } else {
-                       stats->ipcs_bad.ev_count++;
+                       IXGBE_EVC_ADD(&stats->ipcs_bad, 1);
                        mp->m_pkthdr.csum_flags = M_CSUM_IPv4|M_CSUM_IPv4_BAD;
                }
        }
        /* TCP/UDP/SCTP checksum */
        if (status & IXGBE_RXD_STAT_L4CS) {
-               stats->l4cs.ev_count++;
+               IXGBE_EVC_ADD(&stats->l4cs, 1);
                int type = M_CSUM_TCPv4|M_CSUM_TCPv6|M_CSUM_UDPv4|M_CSUM_UDPv6;
                if (!(errors & IXGBE_RXD_ERR_TCPE)) {
                        mp->m_pkthdr.csum_flags |= type;
                } else {
-                       stats->l4cs_bad.ev_count++;
+                       IXGBE_EVC_ADD(&stats->l4cs_bad, 1);
                        mp->m_pkthdr.csum_flags |= type | M_CSUM_TCP_UDP_BAD;
                }
        }
diff -r 211b78891aa7 -r 1914fb775461 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue May 31 14:08:47 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Jun 03 12:31:09 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.52 2022/06/03 12:31:10 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.52 2022/06/03 12:31:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -260,13 +260,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 *);
@@ -420,6 +419,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
  ************************************************************************/
@@ -622,12 +624,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);
 
@@ -845,7 +846,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;
        }
@@ -1148,7 +1150,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 "
@@ -1434,49 +1437,38 @@
        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) {



Home | Main Index | Thread Index | Old Index