summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2020-12-08 04:37:27 +0000
committercheloha <cheloha@openbsd.org>2020-12-08 04:37:27 +0000
commit259ac96e221e4df8b18379751c412e5212bf0ca3 (patch)
tree7266a84ae026910cbac144d15f16cc6ee83c793c
parentcorrect ttm_tt error paths if bus_dmamap_create() fails (diff)
downloadwireguard-openbsd-259ac96e221e4df8b18379751c412e5212bf0ca3.tar.xz
wireguard-openbsd-259ac96e221e4df8b18379751c412e5212bf0ca3.zip
an(4): tsleep(9) -> tsleep_nsec(9)
In an_wait() we spin for up to (3 * hz) iterations awaiting AN_EV_CMD. If we don't see it in a given iteration we block for up to 1 tick and spin again. jsg@ suggests instead blocking for 100ms at a time for up to 30 iterations. Discussed with mpi@. Idea from jsg@. Murmurs of agreement from claudio@ and kettenis@. probably ok jsg@
-rw-r--r--sys/dev/ic/an.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c
index e92aa27a7f0..97bc598dc66 100644
--- a/sys/dev/ic/an.c
+++ b/sys/dev/ic/an.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: an.c,v 1.76 2020/07/10 13:26:37 patrick Exp $ */
+/* $OpenBSD: an.c,v 1.77 2020/12/08 04:37:27 cheloha Exp $ */
/* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -681,10 +681,10 @@ an_wait(struct an_softc *sc)
int i;
CSR_WRITE_2(sc, AN_COMMAND, AN_CMD_NOOP2);
- for (i = 0; i < 3*hz; i++) {
+ for (i = 0; i < 3000; i += 100) {
if (CSR_READ_2(sc, AN_EVENT_STAT) & AN_EV_CMD)
break;
- (void)tsleep(sc, PWAIT, "anatch", 1);
+ tsleep_nsec(sc, PWAIT, "anatch", MSEC_TO_NSEC(100));
}
CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_CMD);
}