summaryrefslogtreecommitdiff
path: root/sys/dev/pci/qle.c
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2018-07-03 07:07:18 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2018-07-03 07:07:18 +0000
commit8727e54dd7c80ab2c82a1acff1b4f8ff7597d0b1 (patch)
treebf1345377c39743633331e35bd267a5c731f6a00 /sys/dev/pci/qle.c
parent78a8e22cbc5ae11652155deff9dbc595bc87925a (diff)
During attach, give the loop a while to settle before we start looking
for targets. With some combinations of controllers and targets, the loop seems to bounce a bit, but with a short delay we can attach targets more reliably.
Diffstat (limited to 'sys/dev/pci/qle.c')
-rw-r--r--sys/dev/pci/qle.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/pci/qle.c b/sys/dev/pci/qle.c
index 54f40aaa11c..046b7c56eb6 100644
--- a/sys/dev/pci/qle.c
+++ b/sys/dev/pci/qle.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qle.c,v 1.40 2018/07/03 06:54:47 jmatthew Exp $ */
+/* $OpenBSD: qle.c,v 1.41 2018/07/03 07:07:17 jmatthew Exp $ */
/*
* Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -67,6 +67,7 @@ int qledebug = QLE_D_PORT;
#define QLE_DEFAULT_PORT_NAME 0x400000007F000003ULL /* from isp(4) */
#define QLE_WAIT_FOR_LOOP 10
+#define QLE_LOOP_SETTLE 10
/* rounded up range of assignable handles */
#define QLE_MAX_TARGETS 2048
@@ -359,7 +360,7 @@ qle_attach(struct device *parent, struct device *self, void *aux)
pcireg_t bars[] = { QLE_PCI_MEM_BAR, QLE_PCI_IO_BAR };
pcireg_t memtype;
- int r, i, rv;
+ int r, i, rv, loop_up;
sc->sc_pc = pa->pa_pc;
sc->sc_tag = pa->pa_tag;
@@ -628,6 +629,7 @@ qle_attach(struct device *parent, struct device *self, void *aux)
task_set(&sc->sc_update_task, qle_do_update, sc);
/* wait a bit for link to come up so we can scan and attach devices */
+ loop_up = 0;
for (i = 0; i < QLE_WAIT_FOR_LOOP * 10000; i++) {
u_int16_t isr, info;
@@ -638,8 +640,11 @@ qle_attach(struct device *parent, struct device *self, void *aux)
qle_handle_intr(sc, isr, info);
- if (sc->sc_loop_up)
- break;
+ if (sc->sc_loop_up) {
+ if (++loop_up == QLE_LOOP_SETTLE)
+ break;
+ } else
+ loop_up = 0;
}
if (sc->sc_loop_up) {