if_iwm.c (300833) | if_iwm.c (301187) |
---|---|
1/* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ 2 3/* 4 * Copyright (c) 2014 genua mbh <info@genua.de> 5 * Copyright (c) 2014 Fixup Software Ltd. 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 --- 89 unchanged lines hidden (view full) --- 98 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 99 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 100 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 101 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 102 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 103 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 104 */ 105#include <sys/cdefs.h> | 1/* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ 2 3/* 4 * Copyright (c) 2014 genua mbh <info@genua.de> 5 * Copyright (c) 2014 Fixup Software Ltd. 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 --- 89 unchanged lines hidden (view full) --- 98 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 99 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 100 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 101 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 102 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 103 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 104 */ 105#include <sys/cdefs.h> |
106__FBSDID("$FreeBSD: head/sys/dev/iwm/if_iwm.c 300833 2016-05-27 07:10:11Z adrian $"); | 106__FBSDID("$FreeBSD: head/sys/dev/iwm/if_iwm.c 301187 2016-06-02 04:42:28Z adrian $"); |
107 108#include "opt_wlan.h" 109 110#include <sys/param.h> 111#include <sys/bus.h> 112#include <sys/conf.h> 113#include <sys/endian.h> 114#include <sys/firmware.h> --- 43 unchanged lines hidden (view full) --- 158#include <dev/iwm/if_iwm_phy_db.h> 159#include <dev/iwm/if_iwm_mac_ctxt.h> 160#include <dev/iwm/if_iwm_phy_ctxt.h> 161#include <dev/iwm/if_iwm_time_event.h> 162#include <dev/iwm/if_iwm_power.h> 163#include <dev/iwm/if_iwm_scan.h> 164 165#include <dev/iwm/if_iwm_pcie_trans.h> | 107 108#include "opt_wlan.h" 109 110#include <sys/param.h> 111#include <sys/bus.h> 112#include <sys/conf.h> 113#include <sys/endian.h> 114#include <sys/firmware.h> --- 43 unchanged lines hidden (view full) --- 158#include <dev/iwm/if_iwm_phy_db.h> 159#include <dev/iwm/if_iwm_mac_ctxt.h> 160#include <dev/iwm/if_iwm_phy_ctxt.h> 161#include <dev/iwm/if_iwm_time_event.h> 162#include <dev/iwm/if_iwm_power.h> 163#include <dev/iwm/if_iwm_scan.h> 164 165#include <dev/iwm/if_iwm_pcie_trans.h> |
166#include <dev/iwm/if_iwm_led.h> |
|
166 167const uint8_t iwm_nvm_channels[] = { 168 /* 2.4 GHz */ 169 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 170 /* 5 GHz */ 171 36, 40, 44, 48, 52, 56, 60, 64, 172 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 173 149, 153, 157, 161, 165 --- 3336 unchanged lines hidden (view full) --- 3510 int error; 3511 3512 IWM_DPRINTF(sc, IWM_DEBUG_STATE, 3513 "switching state %s -> %s\n", 3514 ieee80211_state_name[vap->iv_state], 3515 ieee80211_state_name[nstate]); 3516 IEEE80211_UNLOCK(ic); 3517 IWM_LOCK(sc); | 167 168const uint8_t iwm_nvm_channels[] = { 169 /* 2.4 GHz */ 170 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 171 /* 5 GHz */ 172 36, 40, 44, 48, 52, 56, 60, 64, 173 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 174 149, 153, 157, 161, 165 --- 3336 unchanged lines hidden (view full) --- 3511 int error; 3512 3513 IWM_DPRINTF(sc, IWM_DEBUG_STATE, 3514 "switching state %s -> %s\n", 3515 ieee80211_state_name[vap->iv_state], 3516 ieee80211_state_name[nstate]); 3517 IEEE80211_UNLOCK(ic); 3518 IWM_LOCK(sc); |
3519 3520 if (vap->iv_state == IEEE80211_S_SCAN && nstate != vap->iv_state) 3521 iwm_led_blink_stop(sc); 3522 |
|
3518 /* disable beacon filtering if we're hopping out of RUN */ 3519 if (vap->iv_state == IEEE80211_S_RUN && nstate != vap->iv_state) { 3520 iwm_mvm_disable_beacon_filter(sc); 3521 3522 if (((in = IWM_NODE(vap->iv_bss)) != NULL)) 3523 in->in_assoc = 0; 3524 3525 iwm_release(sc, NULL); --- 298 unchanged lines hidden (view full) --- 3824static void 3825iwm_stop(struct iwm_softc *sc) 3826{ 3827 3828 sc->sc_flags &= ~IWM_FLAG_HW_INITED; 3829 sc->sc_flags |= IWM_FLAG_STOPPED; 3830 sc->sc_generation++; 3831 sc->sc_scanband = 0; | 3523 /* disable beacon filtering if we're hopping out of RUN */ 3524 if (vap->iv_state == IEEE80211_S_RUN && nstate != vap->iv_state) { 3525 iwm_mvm_disable_beacon_filter(sc); 3526 3527 if (((in = IWM_NODE(vap->iv_bss)) != NULL)) 3528 in->in_assoc = 0; 3529 3530 iwm_release(sc, NULL); --- 298 unchanged lines hidden (view full) --- 3829static void 3830iwm_stop(struct iwm_softc *sc) 3831{ 3832 3833 sc->sc_flags &= ~IWM_FLAG_HW_INITED; 3834 sc->sc_flags |= IWM_FLAG_STOPPED; 3835 sc->sc_generation++; 3836 sc->sc_scanband = 0; |
3837 iwm_led_blink_stop(sc); |
|
3832 sc->sc_tx_timer = 0; 3833 iwm_stop_device(sc); 3834} 3835 3836static void 3837iwm_watchdog(void *arg) 3838{ 3839 struct iwm_softc *sc = arg; --- 755 unchanged lines hidden (view full) --- 4595 struct ieee80211com *ic = &sc->sc_ic; 4596 int error; 4597 int txq_i, i; 4598 4599 sc->sc_dev = dev; 4600 IWM_LOCK_INIT(sc); 4601 mbufq_init(&sc->sc_snd, ifqmaxlen); 4602 callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0); | 3838 sc->sc_tx_timer = 0; 3839 iwm_stop_device(sc); 3840} 3841 3842static void 3843iwm_watchdog(void *arg) 3844{ 3845 struct iwm_softc *sc = arg; --- 755 unchanged lines hidden (view full) --- 4601 struct ieee80211com *ic = &sc->sc_ic; 4602 int error; 4603 int txq_i, i; 4604 4605 sc->sc_dev = dev; 4606 IWM_LOCK_INIT(sc); 4607 mbufq_init(&sc->sc_snd, ifqmaxlen); 4608 callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0); |
4609 callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); |
|
4603 TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); 4604 sc->sc_tq = taskqueue_create("iwm_taskq", M_WAITOK, 4605 taskqueue_thread_enqueue, &sc->sc_tq); 4606 error = taskqueue_start_threads(&sc->sc_tq, 1, 0, "iwm_taskq"); 4607 if (error != 0) { 4608 device_printf(dev, "can't start threads, error %d\n", 4609 error); 4610 goto fail; --- 263 unchanged lines hidden (view full) --- 4874 if (sc->sc_scanband) 4875 return; 4876 IWM_LOCK(sc); 4877 error = iwm_mvm_scan_request(sc, IEEE80211_CHAN_2GHZ, 0, NULL, 0); 4878 if (error) { 4879 device_printf(sc->sc_dev, "could not initiate scan\n"); 4880 IWM_UNLOCK(sc); 4881 ieee80211_cancel_scan(vap); | 4610 TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); 4611 sc->sc_tq = taskqueue_create("iwm_taskq", M_WAITOK, 4612 taskqueue_thread_enqueue, &sc->sc_tq); 4613 error = taskqueue_start_threads(&sc->sc_tq, 1, 0, "iwm_taskq"); 4614 if (error != 0) { 4615 device_printf(dev, "can't start threads, error %d\n", 4616 error); 4617 goto fail; --- 263 unchanged lines hidden (view full) --- 4881 if (sc->sc_scanband) 4882 return; 4883 IWM_LOCK(sc); 4884 error = iwm_mvm_scan_request(sc, IEEE80211_CHAN_2GHZ, 0, NULL, 0); 4885 if (error) { 4886 device_printf(sc->sc_dev, "could not initiate scan\n"); 4887 IWM_UNLOCK(sc); 4888 ieee80211_cancel_scan(vap); |
4882 } else | 4889 } else { 4890 iwm_led_blink_start(sc); |
4883 IWM_UNLOCK(sc); | 4891 IWM_UNLOCK(sc); |
4892 } |
|
4884} 4885 4886static void 4887iwm_scan_end(struct ieee80211com *ic) 4888{ | 4893} 4894 4895static void 4896iwm_scan_end(struct ieee80211com *ic) 4897{ |
4898 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); 4899 struct iwm_softc *sc = ic->ic_softc; 4900 4901 IWM_LOCK(sc); 4902 iwm_led_blink_stop(sc); 4903 if (vap->iv_state == IEEE80211_S_RUN) 4904 iwm_mvm_led_enable(sc); 4905 IWM_UNLOCK(sc); |
|
4889} 4890 4891static void 4892iwm_update_mcast(struct ieee80211com *ic) 4893{ 4894} 4895 4896static void --- 80 unchanged lines hidden (view full) --- 4977 struct iwm_fw_info *fw = &sc->sc_fw; 4978 device_t dev = sc->sc_dev; 4979 int i; 4980 4981 if (sc->sc_tq) { 4982 taskqueue_drain_all(sc->sc_tq); 4983 taskqueue_free(sc->sc_tq); 4984 } | 4906} 4907 4908static void 4909iwm_update_mcast(struct ieee80211com *ic) 4910{ 4911} 4912 4913static void --- 80 unchanged lines hidden (view full) --- 4994 struct iwm_fw_info *fw = &sc->sc_fw; 4995 device_t dev = sc->sc_dev; 4996 int i; 4997 4998 if (sc->sc_tq) { 4999 taskqueue_drain_all(sc->sc_tq); 5000 taskqueue_free(sc->sc_tq); 5001 } |
5002 callout_drain(&sc->sc_led_blink_to); |
|
4985 callout_drain(&sc->sc_watchdog_to); 4986 iwm_stop_device(sc); 4987 if (do_net80211) 4988 ieee80211_ifdetach(&sc->sc_ic); 4989 4990 /* Free descriptor rings */ 4991 for (i = 0; i < nitems(sc->txq); i++) 4992 iwm_free_tx_ring(sc, &sc->txq[i]); --- 54 unchanged lines hidden --- | 5003 callout_drain(&sc->sc_watchdog_to); 5004 iwm_stop_device(sc); 5005 if (do_net80211) 5006 ieee80211_ifdetach(&sc->sc_ic); 5007 5008 /* Free descriptor rings */ 5009 for (i = 0; i < nitems(sc->txq); i++) 5010 iwm_free_tx_ring(sc, &sc->txq[i]); --- 54 unchanged lines hidden --- |