Module Name: src Committed By: martin Date: Thu Sep 5 09:06:08 UTC 2019
Modified Files: src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_common.c ixgbe_netbsd.c ixgbe_x550.c ixv.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.24.2.16 -r1.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.88.2.32 -r1.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.13.2.6 -r1.13.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c cvs rdiff -u -r1.5.6.6 -r1.5.6.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c cvs rdiff -u -r1.56.2.23 -r1.56.2.24 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.16 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.17 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.16 Mon Jul 22 17:53:35 2019 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Thu Sep 5 09:06:07 2019 @@ -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 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, 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; Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.33 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32 Thu Aug 29 16:31:53 2019 +++ src/sys/dev/pci/ixgbe/ixgbe.c Thu Sep 5 09:06:07 2019 @@ -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 @@ static void 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 @@ ixgbe_add_media_types(struct adapter *ad 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 @@ ixgbe_add_media_types(struct adapter *ad 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 @@ ixgbe_is_sfp(struct ixgbe_hw *hw) 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 @@ ixgbe_is_sfp(struct ixgbe_hw *hw) 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 @@ ixgbe_enable_queue(struct adapter *adapt { 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 @@ ixgbe_msix_link(void *arg) /* 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 @@ ixgbe_msix_link(void *arg) 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 @@ ixgbe_sysctl_instance(struct adapter *ad 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; } Index: src/sys/dev/pci/ixgbe/ixgbe_common.c diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.6 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.7 --- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.6 Thu Aug 1 14:14:30 2019 +++ src/sys/dev/pci/ixgbe/ixgbe_common.c Thu Sep 5 09:06:08 2019 @@ -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 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_ * 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)); /* Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6.2.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6.2.4 --- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6.2.3 Mon Jul 22 17:53:35 2019 +++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c Thu Sep 5 09:06:08 2019 @@ -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 @@ ixgbe_jcl_reinit(struct adapter *adapter 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; } Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.5.6.6 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.5.6.7 --- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.5.6.6 Mon Jul 22 17:53:35 2019 +++ src/sys/dev/pci/ixgbe/ixgbe_x550.c Thu Sep 5 09:06:08 2019 @@ -875,7 +875,7 @@ static s32 ixgbe_setup_fw_link(struct ix * 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 | | Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.23 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.24 --- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.23 Thu Aug 1 14:14:30 2019 +++ src/sys/dev/pci/ixgbe/ixv.c Thu Sep 5 09:06:08 2019 @@ -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 @@ ixv_attach(device_t parent, device_t dev 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 @@ ixv_sysctl_instance(struct adapter *adap 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; }