Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/ixgbe If an SFP+ module is not inserted, don't t...
details: https://anonhg.NetBSD.org/src/rev/6c3494357046
branches: trunk
changeset: 943321:6c3494357046
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Aug 31 11:19:54 2020 +0000
description:
If an SFP+ module is not inserted, don't try to access SFP+ EEPROM.
This change eliminate long timeout.
Reduce code duplication using with ixgbe_sfp_cage_full(hw).
diffstat:
sys/dev/pci/ixgbe/ixgbe.c | 62 ++++-----------------------------------
sys/dev/pci/ixgbe/ixgbe.h | 7 +---
sys/dev/pci/ixgbe/ixgbe_common.c | 23 +------------
sys/dev/pci/ixgbe/ixgbe_phy.c | 40 +++++++++++++++++++++++++-
sys/dev/pci/ixgbe/ixgbe_phy.h | 3 +-
sys/dev/pci/ixgbe/ixgbe_type.h | 6 +++-
6 files changed, 57 insertions(+), 84 deletions(-)
diffs (285 lines):
diff -r c392dfe35785 -r 6c3494357046 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Mon Aug 31 06:44:12 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Mon Aug 31 11:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.250 2020/08/31 06:23:19 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.251 2020/08/31 11:19:54 msaitoh Exp $ */
/******************************************************************************
@@ -70,6 +70,7 @@
#endif
#include "ixgbe.h"
+#include "ixgbe_phy.h"
#include "ixgbe_sriov.h"
#include "vlan.h"
@@ -257,9 +258,6 @@
static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO);
static int ixgbe_sysctl_wufc(SYSCTLFN_PROTO);
-/* Support for pluggable optic modules */
-static bool ixgbe_sfp_cage_full(struct adapter *);
-
/* Legacy (single vector) interrupt handler */
static int ixgbe_legacy_irq(void *);
@@ -786,7 +784,7 @@
(strcmp(product, "MA10-ST0") == 0)) {
aprint_verbose_dev(dev,
"Enable SFP+ MOD_ABS inverse quirk\n");
- adapter->quirks |= IXGBE_QUIRK_MOD_ABS_INVERT;
+ adapter->hw.quirks |= IXGBE_QUIRK_MOD_ABS_INVERT;
}
}
}
@@ -4519,7 +4517,7 @@
was_full =
hw->phy.sfp_type != ixgbe_sfp_type_not_present;
- is_full = ixgbe_sfp_cage_full(adapter);
+ is_full = ixgbe_sfp_cage_full(hw);
/* Do probe if cage state changed */
if (was_full ^ is_full)
@@ -4661,35 +4659,6 @@
} /* ixgbe_handle_recovery_mode_timer */
/************************************************************************
- * ixgbe_sfp_cage_full
- *
- * Determine if a port had optics inserted.
- ************************************************************************/
-static bool
-ixgbe_sfp_cage_full(struct adapter *adapter)
-{
- struct ixgbe_hw *hw = &adapter->hw;
- uint32_t mask;
- int rv;
-
- if (hw->mac.type >= ixgbe_mac_X540)
- mask = IXGBE_ESDP_SDP0;
- else
- mask = IXGBE_ESDP_SDP2;
-
- rv = IXGBE_READ_REG(hw, IXGBE_ESDP) & mask;
- if ((adapter->quirks & IXGBE_QUIRK_MOD_ABS_INVERT) != 0)
- rv = !rv;
-
- if (hw->mac.type == ixgbe_mac_X550EM_a) {
- /* X550EM_a's SDP0 is inverted than others. */
- return !rv;
- }
-
- return rv;
-} /* ixgbe_sfp_cage_full */
-
-/************************************************************************
* ixgbe_handle_mod - Tasklet for SFP module interrupts
************************************************************************/
static void
@@ -4699,32 +4668,15 @@
struct ixgbe_hw *hw = &adapter->hw;
device_t dev = adapter->dev;
enum ixgbe_sfp_type last_sfp_type;
- u32 err, cage_full = 0;
+ u32 err;
bool last_unsupported_sfp_recovery;
last_sfp_type = hw->phy.sfp_type;
last_unsupported_sfp_recovery = hw->need_unsupported_sfp_recovery;
++adapter->mod_workev.ev_count;
if (adapter->hw.need_crosstalk_fix) {
- switch (hw->mac.type) {
- case ixgbe_mac_82599EB:
- cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
- IXGBE_ESDP_SDP2;
- break;
- case ixgbe_mac_X550EM_x:
- case ixgbe_mac_X550EM_a:
- /*
- * XXX See ixgbe_sfp_cage_full(). It seems the bit is
- * inverted on X550EM_a, so I think this is incorrect.
- */
- cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
- IXGBE_ESDP_SDP0;
- break;
- default:
- break;
- }
-
- if (!cage_full)
+ if ((hw->mac.type != ixgbe_mac_82598EB) &&
+ !ixgbe_sfp_cage_full(hw))
goto out;
}
diff -r c392dfe35785 -r 6c3494357046 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Mon Aug 31 06:44:12 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Mon Aug 31 11:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.70 2020/08/27 00:07:56 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.71 2020/08/31 11:19:54 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -623,9 +623,6 @@
u32 feat_cap;
u32 feat_en;
- /* Quirks */
- u32 quirks;
-
/* Traffic classes */
struct ixgbe_tc tcs[IXGBE_DCB_MAX_TRAFFIC_CLASS];
@@ -773,8 +770,6 @@
#define IXGBE_REQUEST_TASK_LSC 0x20
#define IXGBE_REQUEST_TASK_NEED_ACKINTR 0x80
-#define IXGBE_QUIRK_MOD_ABS_INVERT __BIT(0)
-
/* For NetBSD */
const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, struct rx_ring *,
diff -r c392dfe35785 -r 6c3494357046 sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c Mon Aug 31 06:44:12 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c Mon Aug 31 11:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.28 2020/08/27 03:57:52 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.29 2020/08/31 11:19:54 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -4267,25 +4267,8 @@
* the SFP+ cage is full.
*/
if (ixgbe_need_crosstalk_fix(hw)) {
- u32 sfp_cage_full;
-
- switch (hw->mac.type) {
- case ixgbe_mac_82599EB:
- sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
- IXGBE_ESDP_SDP2;
- break;
- case ixgbe_mac_X550EM_x:
- case ixgbe_mac_X550EM_a:
- sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
- IXGBE_ESDP_SDP0;
- break;
- default:
- /* sanity check - No SFP+ devices here */
- sfp_cage_full = FALSE;
- break;
- }
-
- if (!sfp_cage_full) {
+ if ((hw->mac.type != ixgbe_mac_82598EB) &&
+ !ixgbe_sfp_cage_full(hw)) {
*link_up = FALSE;
*speed = IXGBE_LINK_SPEED_UNKNOWN;
return IXGBE_SUCCESS;
diff -r c392dfe35785 -r 6c3494357046 sys/dev/pci/ixgbe/ixgbe_phy.c
--- a/sys/dev/pci/ixgbe/ixgbe_phy.c Mon Aug 31 06:44:12 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_phy.c Mon Aug 31 11:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_phy.c,v 1.22 2020/08/31 06:20:06 msaitoh Exp $ */
+/* $NetBSD: ixgbe_phy.c,v 1.23 2020/08/31 11:19:54 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -1288,6 +1288,36 @@
return IXGBE_ERR_PHY;
}
+/************************************************************************
+ * ixgbe_sfp_cage_full
+ *
+ * Determine if an SFP+ module is inserted to the cage.
+ ************************************************************************/
+bool
+ixgbe_sfp_cage_full(struct ixgbe_hw *hw)
+{
+ uint32_t mask;
+ int rv;
+
+ KASSERT(hw->mac.type != ixgbe_mac_82598EB);
+
+ if (hw->mac.type >= ixgbe_mac_X540)
+ mask = IXGBE_ESDP_SDP0;
+ else
+ mask = IXGBE_ESDP_SDP2;
+
+ rv = IXGBE_READ_REG(hw, IXGBE_ESDP) & mask;
+ if ((hw->quirks & IXGBE_QUIRK_MOD_ABS_INVERT) != 0)
+ rv = !rv;
+
+ if (hw->mac.type == ixgbe_mac_X550EM_a) {
+ /* X550EM_a's SDP0 is inverted than others. */
+ return !rv;
+ }
+
+ return rv;
+} /* ixgbe_sfp_cage_full */
+
/**
* ixgbe_identify_module_generic - Identifies module type
* @hw: pointer to hardware structure
@@ -1300,6 +1330,14 @@
DEBUGFUNC("ixgbe_identify_module_generic");
+ /* Lightweight way to check if the cage is not full. */
+ if (hw->mac.type != ixgbe_mac_82598EB) {
+ if (!ixgbe_sfp_cage_full(hw)) {
+ hw->phy.sfp_type = ixgbe_sfp_type_not_present;
+ return IXGBE_ERR_SFP_NOT_PRESENT;
+ }
+ }
+
switch (hw->mac.ops.get_media_type(hw)) {
case ixgbe_media_type_fiber:
status = ixgbe_identify_sfp_module_generic(hw);
diff -r c392dfe35785 -r 6c3494357046 sys/dev/pci/ixgbe/ixgbe_phy.h
--- a/sys/dev/pci/ixgbe/ixgbe_phy.h Mon Aug 31 06:44:12 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_phy.h Mon Aug 31 11:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_phy.h,v 1.11 2018/04/04 08:13:07 msaitoh Exp $ */
+/* $NetBSD: ixgbe_phy.h,v 1.12 2020/08/31 11:19:54 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -194,6 +194,7 @@
s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw);
s32 ixgbe_set_copper_phy_power(struct ixgbe_hw *hw, bool on);
+bool ixgbe_sfp_cage_full(struct ixgbe_hw *hw);
s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw);
s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw);
u64 ixgbe_get_supported_phy_sfp_layer_generic(struct ixgbe_hw *hw);
diff -r c392dfe35785 -r 6c3494357046 sys/dev/pci/ixgbe/ixgbe_type.h
--- a/sys/dev/pci/ixgbe/ixgbe_type.h Mon Aug 31 06:44:12 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_type.h Mon Aug 31 11:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.44 2019/12/23 09:36:18 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.45 2020/08/31 11:19:54 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -4264,6 +4264,7 @@
bool wol_enabled;
bool need_crosstalk_fix;
bool need_unsupported_sfp_recovery;
+ u32 quirks;
};
#define ixgbe_call_func(hw, func, params, error) \
@@ -4537,4 +4538,7 @@
#define IXGBE_HOST_INTERFACE_APPLY_UPDATE_CMD 0x38
#define IXGBE_HOST_INTERFACE_MASK_CMD 0x000000FF
+/* Flags for hw.quirks */
+#define IXGBE_QUIRK_MOD_ABS_INVERT __BIT(0)
+
#endif /* _IXGBE_TYPE_H_ */
Home |
Main Index |
Thread Index |
Old Index