summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-03-21 11:50:21 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-03-21 11:50:21 +0000
commit18263d7f04130052b42b37a0e294e15abf931566 (patch)
tree5b54b2038a5b344c079e77204b7c1780a30b8bf0
parent6292470710aa99c67ba4a3ed2f686a7ce3461775 (diff)
run event callbacks directly in the atq processing
previously events were queued on an SLIST, but multiple link state events could fire with the same callback. this corrupted the SLIST and effectively caused an infinite loop. ok jmatthew@
-rw-r--r--sys/dev/pci/if_ixl.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c
index 7b9280939e9..8658430c5f5 100644
--- a/sys/dev/pci/if_ixl.c
+++ b/sys/dev/pci/if_ixl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ixl.c,v 1.26 2019/03/12 01:07:37 jmatthew Exp $ */
+/* $OpenBSD: if_ixl.c,v 1.27 2019/03/21 11:50:20 dlg Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -1061,7 +1061,6 @@ struct ixl_rx_ring {
};
struct ixl_atq {
- SIMPLEQ_ENTRY(ixl_atq) iatq_entry;
struct ixl_aq_desc iatq_desc;
void *iatq_arg;
void (*iatq_fn)(struct ixl_softc *, void *);
@@ -3009,7 +3008,6 @@ ixl_atq_post(struct ixl_softc *sc, struct ixl_atq *iatq)
static void
ixl_atq_done(struct ixl_softc *sc)
{
- struct ixl_atq_list cmds = SIMPLEQ_HEAD_INITIALIZER(cmds);
struct ixl_aq_desc *atq, *slot;
struct ixl_atq *iatq;
unsigned int cons;
@@ -3032,10 +3030,11 @@ ixl_atq_done(struct ixl_softc *sc)
iatq = (struct ixl_atq *)slot->iaq_cookie;
iatq->iatq_desc = *slot;
- SIMPLEQ_INSERT_TAIL(&cmds, iatq, iatq_entry);
memset(slot, 0, sizeof(*slot));
+ (*iatq->iatq_fn)(sc, iatq->iatq_arg);
+
cons++;
cons &= IXL_AQ_MASK;
} while (cons != prod);
@@ -3045,12 +3044,6 @@ ixl_atq_done(struct ixl_softc *sc)
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
sc->sc_atq_cons = cons;
-
- while ((iatq = SIMPLEQ_FIRST(&cmds)) != NULL) {
- SIMPLEQ_REMOVE_HEAD(&cmds, iatq_entry);
-
- (*iatq->iatq_fn)(sc, iatq->iatq_arg);
- }
}
struct ixl_wakeup {