svn commit: r321508 - head/sys/dev/iwm
Adrian Chadd
adrian at FreeBSD.org
Wed Jul 26 05:29:09 UTC 2017
Author: adrian
Date: Wed Jul 26 05:29:08 2017
New Revision: 321508
URL: https://svnweb.freebsd.org/changeset/base/321508
Log:
[iwm] Cleanup mbufq draining. Add iwm_xmit_queue_drain() like in iwn(4).
* iwm_xmit_queue_drain() calls ieee80211_free_node(), removing a possible
memory leak, compared to using just mbufq_drain().
* Remove duplicate mbufq_drain() from iwm_mvm_rm_sta(), this should be
handled in the caller.
Obtained from: dragonflybsd.git 339d45fda40072e0aca5ece639173204716f11fe
Modified:
head/sys/dev/iwm/if_iwm.c
head/sys/dev/iwm/if_iwm_sta.c
Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:26:01 2017 (r321507)
+++ head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:29:08 2017 (r321508)
@@ -388,6 +388,7 @@ static struct ieee80211vap *
const uint8_t [IEEE80211_ADDR_LEN],
const uint8_t [IEEE80211_ADDR_LEN]);
static void iwm_vap_delete(struct ieee80211vap *);
+static void iwm_xmit_queue_drain(struct iwm_softc *);
static void iwm_scan_start(struct ieee80211com *);
static void iwm_scan_end(struct ieee80211com *);
static void iwm_update_mcast(struct ieee80211com *);
@@ -4103,7 +4104,7 @@ iwm_release(struct iwm_softc *sc, struct iwm_node *in)
* get here from RUN state.
*/
tfd_msk = 0xf;
- mbufq_drain(&sc->sc_snd);
+ iwm_xmit_queue_drain(sc);
iwm_mvm_flush_tx_path(sc, tfd_msk, IWM_CMD_SYNC);
/*
* We seem to get away with just synchronously sending the
@@ -6214,6 +6215,19 @@ iwm_vap_delete(struct ieee80211vap *vap)
}
static void
+iwm_xmit_queue_drain(struct iwm_softc *sc)
+{
+ struct mbuf *m;
+ struct ieee80211_node *ni;
+
+ while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
+ ni = (struct ieee80211_node *)m->m_pkthdr.rcvif;
+ ieee80211_free_node(ni);
+ m_freem(m);
+ }
+}
+
+static void
iwm_scan_start(struct ieee80211com *ic)
{
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
@@ -6372,6 +6386,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
callout_drain(&sc->sc_watchdog_to);
iwm_stop_device(sc);
if (do_net80211) {
+ IWM_LOCK(sc);
+ iwm_xmit_queue_drain(sc);
+ IWM_UNLOCK(sc);
ieee80211_ifdetach(&sc->sc_ic);
}
@@ -6405,7 +6422,6 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
sc->sc_notif_wait = NULL;
}
- mbufq_drain(&sc->sc_snd);
IWM_LOCK_DESTROY(sc);
return (0);
Modified: head/sys/dev/iwm/if_iwm_sta.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_sta.c Wed Jul 26 05:26:01 2017 (r321507)
+++ head/sys/dev/iwm/if_iwm_sta.c Wed Jul 26 05:29:08 2017 (r321508)
@@ -283,7 +283,6 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211v
ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE);
if (ret)
return ret;
- mbufq_drain(&sc->sc_snd); /* XXX needed ? */
for (ac = 0; ac < WME_NUM_AC; ac++) {
tfd_queue_msk |= htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]);
}
More information about the svn-src-head
mailing list