summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2024-01-10 05:06:01 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2024-01-10 05:06:01 +0000
commit607ab04b9fcf35691fd82703a58a98eb20f630c2 (patch)
tree21b2f879e78aafdc18649b06ac3e439fca951dbe /sys/dev
parentccf6f7c156ae132b44b31de81c6034eb7a6fcd8e (diff)
If bringing up a queue fails, only tear down the ones that we set up
successfully, rather than trying to tear them all down and crashing. tested by hrvoje, who can make queue setup fail sometimes ok bluhm@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_bnxt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/pci/if_bnxt.c b/sys/dev/pci/if_bnxt.c
index 94b80f04000..fc1de6ddcca 100644
--- a/sys/dev/pci/if_bnxt.c
+++ b/sys/dev/pci/if_bnxt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnxt.c,v 1.42 2024/01/09 04:32:29 jmatthew Exp $ */
+/* $OpenBSD: if_bnxt.c,v 1.43 2024/01/10 05:06:00 jmatthew Exp $ */
/*-
* Broadcom NetXtreme-C/E network driver.
*
@@ -1073,7 +1073,7 @@ bnxt_up(struct bnxt_softc *sc)
if (bnxt_hwrm_vnic_ctx_alloc(sc, &sc->sc_vnic.rss_id) != 0) {
printf("%s: failed to allocate vnic rss context\n",
DEVNAME(sc));
- goto down_queues;
+ goto down_all_queues;
}
sc->sc_vnic.id = (uint16_t)HWRM_NA_SIGNATURE;
@@ -1139,8 +1139,11 @@ dealloc_vnic:
bnxt_hwrm_vnic_free(sc, &sc->sc_vnic);
dealloc_vnic_ctx:
bnxt_hwrm_vnic_ctx_free(sc, &sc->sc_vnic.rss_id);
+
+down_all_queues:
+ i = sc->sc_nqueues;
down_queues:
- for (i = 0; i < sc->sc_nqueues; i++)
+ while (i-- > 0)
bnxt_queue_down(sc, &sc->sc_queues[i]);
bnxt_dmamem_free(sc, sc->sc_rx_cfg);