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 Apply patch, requested by msaitoh in ti...



details:   https://anonhg.NetBSD.org/src/rev/564ac8571df2
branches:  netbsd-8
changeset: 454105:564ac8571df2
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Sep 05 09:06:07 2019 +0000

description:
Apply patch, requested by msaitoh in ticket #1367, to pull up the following
revisions:

        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.16
        sys/dev/pci/ixgbe/ixgbe.c                       1.180,1.203-1.204,
                                                        1.207-1.208 via patch
        sys/dev/pci/ixgbe/ix_txrx.c                     1.55
        sys/dev/pci/ixgbe/ixgbe_netbsd.c                1.10
        sys/dev/pci/ixgbe/ixgbe_common.c                1.25
        sys/dev/pci/ixgbe/ixv.c                         1.129-1.130

- X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
- An interrupt might not arrive when a module is inserted. When an link
  status change interrupt occurred and the driver still regard SFP as
  unplugged, issue the module softint before issuing LSC softint.
- Add 10000BASE-LX media if it's 1000BASE-BX.
- printf -> device_printf
- Avoid undefined behavior of VLAN filter setting.
- Simplify code.
- Fix typo in unused code.
- Fix typo in comment. Found by Wataru Ashihara.

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c      |   6 ++-
 sys/dev/pci/ixgbe/ixgbe.c        |  67 +++++++++++++++++++++------------------
 sys/dev/pci/ixgbe/ixgbe_common.c |   4 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.c |   5 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c   |   2 +-
 sys/dev/pci/ixgbe/ixv.c          |   7 ++-
 6 files changed, 50 insertions(+), 41 deletions(-)

diffs (234 lines):

diff -r da14cf4fff3f -r 564ac8571df2 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Wed Sep 04 08:33:39 2019 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Thu Sep 05 09:06:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.16 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.17 2019/09/05 09:06:07 martin Exp $ */
 
 /******************************************************************************
 
@@ -1363,7 +1363,9 @@
                        error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat,
                            rxbuf->pmap, mp, BUS_DMA_NOWAIT);
                        if (error != 0) {
-                               printf("Refresh mbufs: payload dmamap load failure - %d\n", error);
+                               device_printf(adapter->dev, "Refresh mbufs: "
+                                   "payload dmamap load failure - %d\n",
+                                   error);
                                m_free(mp);
                                rxbuf->buf = NULL;
                                goto update;
diff -r da14cf4fff3f -r 564ac8571df2 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Sep 04 08:33:39 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Sep 05 09:06:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.32 2019/08/29 16:31:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.33 2019/09/05 09:06:07 martin Exp $ */
 
 /******************************************************************************
 
@@ -1397,7 +1397,6 @@
 ixgbe_add_media_types(struct adapter *adapter)
 {
        struct ixgbe_hw *hw = &adapter->hw;
-       device_t        dev = adapter->dev;
        u64             layer;
 
        layer = adapter->phy_layer;
@@ -1449,7 +1448,7 @@
                ADD(IFM_10G_KR | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
-               ADD(AIFM_10G_KX4 | IFM_FDX, 0);
+               ADD(IFM_10G_KX4 | IFM_FDX, 0);
        }
 #else
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
@@ -1476,7 +1475,7 @@
                ADD(IFM_5000_T | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
-               device_printf(dev, "Media supported: 1000baseBX\n");
+               ADD(IFM_1000_LX | IFM_FDX, 0); /* IFM_1000_BX */
        /* XXX no ifmedia_set? */
 
        ADD(IFM_AUTO, 0);
@@ -1496,6 +1495,8 @@
                        return (TRUE);
                return (FALSE);
        case ixgbe_mac_82599EB:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
                switch (hw->mac.ops.get_media_type(hw)) {
                case ixgbe_media_type_fiber:
                case ixgbe_media_type_fiber_qsfp:
@@ -1503,11 +1504,6 @@
                default:
                        return (FALSE);
                }
-       case ixgbe_mac_X550EM_x:
-       case ixgbe_mac_X550EM_a:
-               if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber)
-                       return (TRUE);
-               return (FALSE);
        default:
                return (FALSE);
        }
@@ -2542,7 +2538,7 @@
 {
        struct ixgbe_hw *hw = &adapter->hw;
        struct ix_queue *que = &adapter->queues[vector];
-       u64             queue = (u64)(1ULL << vector);
+       u64             queue = 1ULL << vector;
        u32             mask;
 
        mutex_enter(&que->dc_mtx);
@@ -3077,6 +3073,34 @@
        /* Clear interrupt with write */
        IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
 
+       if (ixgbe_is_sfp(hw)) {
+               /* Pluggable optics-related interrupt */
+               if (hw->mac.type >= ixgbe_mac_X540)
+                       eicr_mask = IXGBE_EICR_GPI_SDP0_X540;
+               else
+                       eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw);
+
+               /*
+                *  An interrupt might not arrive when a module is inserted.
+                * When an link status change interrupt occurred and the driver
+                * still regard SFP as unplugged, issue the module softint
+                * and then issue LSC interrupt.
+                */
+               if ((eicr & eicr_mask)
+                   || ((hw->phy.sfp_type == ixgbe_sfp_type_not_present)
+                       && (eicr & IXGBE_EICR_LSC))) {
+                       IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask);
+                       softint_schedule(adapter->mod_si);
+               }
+
+               if ((hw->mac.type == ixgbe_mac_82599EB) &&
+                   (eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
+                       IXGBE_WRITE_REG(hw, IXGBE_EICR,
+                           IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
+                       softint_schedule(adapter->msf_si);
+               }
+       }
+
        /* Link status change */
        if (eicr & IXGBE_EICR_LSC) {
                IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC);
@@ -3135,26 +3159,6 @@
                        softint_schedule(adapter->mbx_si);
        }
 
-       if (ixgbe_is_sfp(hw)) {
-               /* Pluggable optics-related interrupt */
-               if (hw->mac.type >= ixgbe_mac_X540)
-                       eicr_mask = IXGBE_EICR_GPI_SDP0_X540;
-               else
-                       eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw);
-
-               if (eicr & eicr_mask) {
-                       IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask);
-                       softint_schedule(adapter->mod_si);
-               }
-
-               if ((hw->mac.type == ixgbe_mac_82599EB) &&
-                   (eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
-                       IXGBE_WRITE_REG(hw, IXGBE_EICR,
-                           IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
-                       softint_schedule(adapter->msf_si);
-               }
-       }
-
        /* Check for fan failure */
        if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) {
                ixgbe_check_fan_failure(adapter, eicr, TRUE);
@@ -3262,7 +3266,8 @@
 
        return rnode;
 err:
-       printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
+       device_printf(adapter->dev,
+           "%s: sysctl_createv failed, rc = %d\n", __func__, rc);
        return NULL;
 }
 
diff -r da14cf4fff3f -r 564ac8571df2 sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c  Wed Sep 04 08:33:39 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c  Thu Sep 05 09:06:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.13.2.6 2019/08/01 14:14:30 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.13.2.7 2019/09/05 09:06:08 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -4020,7 +4020,7 @@
         *    bits[4-0]:  which bit in the register
         */
        regidx = vlan / 32;
-       vfta_delta = 1 << (vlan % 32);
+       vfta_delta = (u32)1 << (vlan % 32);
        vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx));
 
        /*
diff -r da14cf4fff3f -r 564ac8571df2 sys/dev/pci/ixgbe/ixgbe_netbsd.c
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.c  Wed Sep 04 08:33:39 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.c  Thu Sep 05 09:06:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.3 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.4 2019/09/05 09:06:08 martin Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -197,7 +197,8 @@
 
        for (i = 0; i < nbuf; i++) {
                if ((em = ixgbe_newext(eh, dmat, size)) == NULL) {
-                       printf("%s: only %d of %d jumbo buffers allocated\n",
+                       device_printf(adapter->dev,
+                           "%s: only %d of %d jumbo buffers allocated\n",
                            __func__, i, nbuf);
                        break;
                }
diff -r da14cf4fff3f -r 564ac8571df2 sys/dev/pci/ixgbe/ixgbe_x550.c
--- a/sys/dev/pci/ixgbe/ixgbe_x550.c    Wed Sep 04 08:33:39 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_x550.c    Thu Sep 05 09:06:07 2019 +0000
@@ -875,7 +875,7 @@
         *  Broken firmware sets BMCR register incorrectly if
         * FW_PHY_ACT_SETUP_LINK_AN isn't set.
         * a) FDX may not be set.
-        * b) BMCR_SPEED1 (bit 6) is always cleard.
+        * b) BMCR_SPEED1 (bit 6) is always cleared.
         * + -------+------+-----------+-----+--------------------------+
         * |request | BMCR | BMCR spd | BMCR |                          |
         * |        | (HEX)| (in bits)|  FDX |                          |
diff -r da14cf4fff3f -r 564ac8571df2 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Wed Sep 04 08:33:39 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Thu Sep 05 09:06:07 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.23 2019/08/01 14:14:30 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.24 2019/09/05 09:06:08 martin Exp $*/
 
 /******************************************************************************
 
@@ -528,7 +528,7 @@
 
        error = ixv_allocate_msix(adapter, pa);
        if (error) {
-               device_printf(dev, "ixv_allocate_msix() failed!\n");
+               aprint_error_dev(dev, "ixv_allocate_msix() failed!\n");
                goto err_late;
        }
 
@@ -2341,7 +2341,8 @@
 
        return rnode;
 err:
-       printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
+       device_printf(adapter->dev,
+           "%s: sysctl_createv failed, rc = %d\n", __func__, rc);
        return NULL;
 }
 



Home | Main Index | Thread Index | Old Index