From f549aee37da0b37ae1ebf15abdaa214f8a469509 Mon Sep 17 00:00:00 2001 From: kettenis Date: Fri, 30 Dec 2022 16:49:34 +0000 Subject: [PATCH] Do not send (normal) packets before we reach the run state. Logic copied from iwm(4), which also looks at the TX_MGMT_ONLY flag. We don't expect that flag to be ever set for bwfm(4), but it shouldn't hurt and it keeps things consistent across drivers. This fixes issues with suspend/resume (including firmware crashes seen on the M2 Macbook Air). ok patrick@, stsp@ --- sys/dev/ic/bwfm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index b4f8c70d29e..56c8e2365b5 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.105 2022/06/30 19:57:40 stsp Exp $ */ +/* $OpenBSD: bwfm.c,v 1.106 2022/12/30 16:49:34 kettenis Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt @@ -391,6 +391,7 @@ void bwfm_start(struct ifnet *ifp) { struct bwfm_softc *sc = ifp->if_softc; + struct ieee80211com *ic = &sc->sc_ic; struct mbuf *m; if (!(ifp->if_flags & IFF_RUNNING)) @@ -408,6 +409,10 @@ bwfm_start(struct ifnet *ifp) break; } + if (ic->ic_state != IEEE80211_S_RUN || + (ic->ic_xflags & IEEE80211_F_TX_MGMT_ONLY)) + break; + m = ifq_dequeue(&ifp->if_snd); if (m == NULL) break; -- 2.20.1