if_run.c (288646) | if_run.c (288649) |
---|---|
1/*- 2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr> 3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca> 4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org> 5 * Copyright (c) 2013-2014 Kevin Lo 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 4 unchanged lines hidden (view full) --- 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr> 3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca> 4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org> 5 * Copyright (c) 2013-2014 Kevin Lo 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 4 unchanged lines hidden (view full) --- 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> |
21__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 288646 2015-10-04 04:25:56Z adrian $"); | 21__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 288649 2015-10-04 05:22:17Z adrian $"); |
22 23/*- 24 * Ralink Technology RT2700U/RT2800U/RT3000U/RT3900E chipset driver. 25 * http://www.ralinktech.com/ 26 */ 27 28#include <sys/param.h> 29#include <sys/sockio.h> --- 796 unchanged lines hidden (view full) --- 826 827 return (0); 828 829detach: 830 run_detach(self); 831 return (ENXIO); 832} 833 | 22 23/*- 24 * Ralink Technology RT2700U/RT2800U/RT3000U/RT3900E chipset driver. 25 * http://www.ralinktech.com/ 26 */ 27 28#include <sys/param.h> 29#include <sys/sockio.h> --- 796 unchanged lines hidden (view full) --- 826 827 return (0); 828 829detach: 830 run_detach(self); 831 return (ENXIO); 832} 833 |
834static void 835run_drain_mbufq(struct run_softc *sc) 836{ 837 struct mbuf *m; 838 struct ieee80211_node *ni; 839 840 RUN_LOCK_ASSERT(sc, MA_OWNED); 841 while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { 842 ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; 843 m->m_pkthdr.rcvif = NULL; 844 ieee80211_free_node(ni); 845 m_freem(m); 846 } 847} 848 |
|
834static int 835run_detach(device_t self) 836{ 837 struct run_softc *sc = device_get_softc(self); 838 struct ieee80211com *ic = &sc->sc_ic; 839 int i; 840 841 RUN_LOCK(sc); --- 5 unchanged lines hidden (view full) --- 847 848 RUN_LOCK(sc); 849 sc->ratectl_run = RUN_RATECTL_OFF; 850 sc->cmdq_run = sc->cmdq_key_set = RUN_CMDQ_ABORT; 851 852 /* free TX list, if any */ 853 for (i = 0; i != RUN_EP_QUEUES; i++) 854 run_unsetup_tx_list(sc, &sc->sc_epq[i]); | 849static int 850run_detach(device_t self) 851{ 852 struct run_softc *sc = device_get_softc(self); 853 struct ieee80211com *ic = &sc->sc_ic; 854 int i; 855 856 RUN_LOCK(sc); --- 5 unchanged lines hidden (view full) --- 862 863 RUN_LOCK(sc); 864 sc->ratectl_run = RUN_RATECTL_OFF; 865 sc->cmdq_run = sc->cmdq_key_set = RUN_CMDQ_ABORT; 866 867 /* free TX list, if any */ 868 for (i = 0; i != RUN_EP_QUEUES; i++) 869 run_unsetup_tx_list(sc, &sc->sc_epq[i]); |
870 871 /* Free TX queue */ 872 run_drain_mbufq(sc); |
|
855 RUN_UNLOCK(sc); 856 857 if (sc->sc_ic.ic_softc == sc) { 858 /* drain tasks */ 859 usb_callout_drain(&sc->ratectl_ch); 860 ieee80211_draintask(ic, &sc->cmdq_task); 861 ieee80211_draintask(ic, &sc->ratectl_task); 862 ieee80211_ifdetach(ic); 863 } 864 | 873 RUN_UNLOCK(sc); 874 875 if (sc->sc_ic.ic_softc == sc) { 876 /* drain tasks */ 877 usb_callout_drain(&sc->ratectl_ch); 878 ieee80211_draintask(ic, &sc->cmdq_task); 879 ieee80211_draintask(ic, &sc->ratectl_task); 880 ieee80211_ifdetach(ic); 881 } 882 |
865 mbufq_drain(&sc->sc_snd); | |
866 mtx_destroy(&sc->sc_mtx); 867 868 return (0); 869} 870 871static struct ieee80211vap * 872run_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, 873 enum ieee80211_opmode opmode, int flags, --- 5293 unchanged lines hidden (view full) --- 6167 6168 RUN_UNLOCK(sc); 6169 6170 for(i = 0; i < RUN_N_XFER; i++) 6171 usbd_transfer_drain(sc->sc_xfer[i]); 6172 6173 RUN_LOCK(sc); 6174 | 883 mtx_destroy(&sc->sc_mtx); 884 885 return (0); 886} 887 888static struct ieee80211vap * 889run_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, 890 enum ieee80211_opmode opmode, int flags, --- 5293 unchanged lines hidden (view full) --- 6184 6185 RUN_UNLOCK(sc); 6186 6187 for(i = 0; i < RUN_N_XFER; i++) 6188 usbd_transfer_drain(sc->sc_xfer[i]); 6189 6190 RUN_LOCK(sc); 6191 |
6192 run_drain_mbufq(sc); 6193 |
|
6175 if (sc->rx_m != NULL) { 6176 m_free(sc->rx_m); 6177 sc->rx_m = NULL; 6178 } 6179 6180 /* Disable Tx/Rx DMA. */ 6181 if (run_read(sc, RT2860_WPDMA_GLO_CFG, &tmp) != 0) 6182 return; --- 72 unchanged lines hidden --- | 6194 if (sc->rx_m != NULL) { 6195 m_free(sc->rx_m); 6196 sc->rx_m = NULL; 6197 } 6198 6199 /* Disable Tx/Rx DMA. */ 6200 if (run_read(sc, RT2860_WPDMA_GLO_CFG, &tmp) != 0) 6201 return; --- 72 unchanged lines hidden --- |