From 5b6a60ea0aebb0dc126e2d953612946a825dc004 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 16 May 2002 06:32:37 +0000 Subject: [PATCH] Use splnet() when we need to block timeouts rather than splimp() since the former blocks software interrupts, while the latter blocks hardware interrupts. Avoid one place where I'm at splnet across a call to copyout. Leave one in place to give bde something to complain about :-). Actaully, I'll fix it in a subsequent commit. Reviewed by: bde spl conical hat to: imp --- sys/dev/wi/wi_hostap.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/sys/dev/wi/wi_hostap.c b/sys/dev/wi/wi_hostap.c index c91c81d2148..4224dc710bf 100644 --- a/sys/dev/wi/wi_hostap.c +++ b/sys/dev/wi/wi_hostap.c @@ -104,6 +104,13 @@ static void wihap_sta_disassoc(struct wi_softc *sc, static void wihap_disassoc_req(struct wi_softc *sc, struct wi_frame *rxfrm, caddr_t pkt, int len); +/* + * Spl use in this driver. + * + * splnet is used everywhere here to block timeouts when we need to do + * so. + */ + /* * take_hword() * @@ -294,7 +301,7 @@ wihap_shutdown(struct wi_softc *sc) * a single broadcast. Maybe try that someday. */ - s = splimp(); + s = splnet(); sta = LIST_FIRST(&whi->sta_list); while (sta) { untimeout(wihap_sta_timeout, sta, sta->tmo); @@ -318,6 +325,7 @@ wihap_shutdown(struct wi_softc *sc) } whi->apflags = 0; + splx(s); } /* sta_hash_func() @@ -1067,7 +1075,7 @@ wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m) return (1); } - s = splclock(); + s = splnet(); /* Find source station. */ sta = wihap_sta_find(whi, rxfrm->wi_addr2); @@ -1140,7 +1148,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; - s = splimp(); + s = splnet(); sta = wihap_sta_find(whi, reqsta.addr); if (sta == NULL) error = ENOENT; @@ -1162,21 +1170,21 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) case SIOCHOSTAP_GET: if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; - s = splimp(); + s = splnet(); sta = wihap_sta_find(whi, reqsta.addr); - if (sta == NULL) + if (sta == NULL) { error = ENOENT; - else { + splx(s); + } else { reqsta.flags = sta->flags; reqsta.asid = sta->asid; reqsta.capinfo = sta->capinfo; reqsta.sig_info = sta->sig_info; reqsta.rates = sta->rates; - + splx(s); error = copyout(&reqsta, ifr->ifr_data, sizeof(reqsta)); } - splx(s); break; case SIOCHOSTAP_ADD: @@ -1184,7 +1192,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; - s = splimp(); + s = splnet(); sta = wihap_sta_find(whi, reqsta.addr); if (sta != NULL) { error = EEXIST; @@ -1224,7 +1232,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) reqall.nstations = whi->n_stations; n = 0; - s = splimp(); + s = splnet(); sta = LIST_FIRST(&whi->sta_list); while (sta && reqall.size >= n+sizeof(struct hostap_sta)) {