Lines Matching +full:conf +full:- +full:rx
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2008-2009 Nokia Corporation
26 #include "rx.h"
34 wl->if_ops->enable_irq(wl); in wl1251_enable_interrupts()
39 wl->if_ops->disable_irq(wl); in wl1251_disable_interrupts()
44 return wl->if_ops->power(wl, false); in wl1251_power_off()
49 return wl->if_ops->power(wl, true); in wl1251_power_on()
55 struct device *dev = wiphy_dev(wl->hw->wiphy); in wl1251_fetch_firmware()
65 if (fw->size % 4) { in wl1251_fetch_firmware()
67 fw->size); in wl1251_fetch_firmware()
68 ret = -EILSEQ; in wl1251_fetch_firmware()
72 wl->fw_len = fw->size; in wl1251_fetch_firmware()
73 wl->fw = vmalloc(wl->fw_len); in wl1251_fetch_firmware()
75 if (!wl->fw) { in wl1251_fetch_firmware()
77 ret = -ENOMEM; in wl1251_fetch_firmware()
81 memcpy(wl->fw, fw->data, wl->fw_len); in wl1251_fetch_firmware()
94 struct device *dev = wiphy_dev(wl->hw->wiphy); in wl1251_fetch_nvs()
104 if (fw->size % 4) { in wl1251_fetch_nvs()
106 fw->size); in wl1251_fetch_nvs()
107 ret = -EILSEQ; in wl1251_fetch_nvs()
111 wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL); in wl1251_fetch_nvs()
113 if (!wl->nvs) { in wl1251_fetch_nvs()
115 ret = -ENOMEM; in wl1251_fetch_nvs()
119 wl->nvs_len = fw->size; in wl1251_fetch_nvs()
150 wl->if_ops->reset(wl); in wl1251_chip_wakeup()
166 wl->chip_id = wl1251_reg_read32(wl, CHIP_ID_B); in wl1251_chip_wakeup()
170 switch (wl->chip_id) { in wl1251_chip_wakeup()
173 wl->chip_id); in wl1251_chip_wakeup()
177 wl->chip_id); in wl1251_chip_wakeup()
181 wl1251_error("unsupported chip id: 0x%x", wl->chip_id); in wl1251_chip_wakeup()
182 ret = -ENODEV; in wl1251_chip_wakeup()
186 if (wl->fw == NULL) { in wl1251_chip_wakeup()
204 mutex_lock(&wl->mutex); in wl1251_irq_work()
208 if (wl->state == WL1251_STATE_OFF) in wl1251_irq_work()
221 if (wl->data_path) { in wl1251_irq_work()
222 wl->rx_counter = wl1251_mem_read32( in wl1251_irq_work()
223 wl, wl->data_path->rx_control_addr); in wl1251_irq_work()
226 switch ((wl->rx_counter - wl->rx_handled) & 0xf) { in wl1251_irq_work()
229 "RX: FW and host in sync"); in wl1251_irq_work()
234 wl1251_debug(DEBUG_IRQ, "RX: FW +1"); in wl1251_irq_work()
239 wl1251_debug(DEBUG_IRQ, "RX: FW +2"); in wl1251_irq_work()
245 "RX: FW and host out of sync: %d", in wl1251_irq_work()
246 wl->rx_counter - wl->rx_handled); in wl1251_irq_work()
250 wl->rx_handled = wl->rx_counter; in wl1251_irq_work()
252 wl1251_debug(DEBUG_IRQ, "RX counter: %d", in wl1251_irq_work()
253 wl->rx_counter); in wl1251_irq_work()
256 intr &= wl->intr_mask; in wl1251_irq_work()
292 if (--ctr == 0) in wl1251_irq_work()
299 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); in wl1251_irq_work()
303 mutex_unlock(&wl->mutex); in wl1251_irq_work()
313 wl->tx_mgmt_frm_rate, in wl1251_join()
314 wl->tx_mgmt_frm_mod); in wl1251_join()
322 if (is_zero_ether_addr(wl->bssid)) in wl1251_join()
323 wl->rx_config &= ~CFG_BSSID_FILTER_EN; in wl1251_join()
342 struct wl1251 *wl = hw->priv; in wl1251_op_tx()
345 skb_queue_tail(&wl->tx_queue, skb); in wl1251_op_tx()
348 * The chip specific setup must run before the first TX packet - in wl1251_op_tx()
352 ieee80211_queue_work(wl->hw, &wl->tx_work); in wl1251_op_tx()
358 if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_HIGH_WATERMARK) { in wl1251_op_tx()
361 spin_lock_irqsave(&wl->wl_lock, flags); in wl1251_op_tx()
362 ieee80211_stop_queues(wl->hw); in wl1251_op_tx()
363 wl->tx_queue_stopped = true; in wl1251_op_tx()
364 spin_unlock_irqrestore(&wl->wl_lock, flags); in wl1251_op_tx()
370 struct wl1251 *wl = hw->priv; in wl1251_op_start()
371 struct wiphy *wiphy = hw->wiphy; in wl1251_op_start()
376 mutex_lock(&wl->mutex); in wl1251_op_start()
378 if (wl->state != WL1251_STATE_OFF) { in wl1251_op_start()
380 wl->state); in wl1251_op_start()
381 ret = -EBUSY; in wl1251_op_start()
401 wl->state = WL1251_STATE_ON; in wl1251_op_start()
403 wl1251_info("firmware booted (%s)", wl->fw_ver); in wl1251_op_start()
406 wiphy->hw_version = wl->chip_id; in wl1251_op_start()
407 strscpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); in wl1251_op_start()
413 mutex_unlock(&wl->mutex); in wl1251_op_start()
420 struct wl1251 *wl = hw->priv; in wl1251_op_stop()
426 mutex_lock(&wl->mutex); in wl1251_op_stop()
428 WARN_ON(wl->state != WL1251_STATE_ON); in wl1251_op_stop()
430 if (wl->scanning) { in wl1251_op_stop()
435 ieee80211_scan_completed(wl->hw, &info); in wl1251_op_stop()
436 wl->scanning = false; in wl1251_op_stop()
439 wl->state = WL1251_STATE_OFF; in wl1251_op_stop()
443 mutex_unlock(&wl->mutex); in wl1251_op_stop()
445 cancel_work_sync(&wl->irq_work); in wl1251_op_stop()
446 cancel_work_sync(&wl->tx_work); in wl1251_op_stop()
447 cancel_delayed_work_sync(&wl->elp_work); in wl1251_op_stop()
449 mutex_lock(&wl->mutex); in wl1251_op_stop()
455 eth_zero_addr(wl->bssid); in wl1251_op_stop()
456 wl->listen_int = 1; in wl1251_op_stop()
457 wl->bss_type = MAX_BSS_TYPE; in wl1251_op_stop()
459 wl->data_in_count = 0; in wl1251_op_stop()
460 wl->rx_counter = 0; in wl1251_op_stop()
461 wl->rx_handled = 0; in wl1251_op_stop()
462 wl->rx_current_buffer = 0; in wl1251_op_stop()
463 wl->rx_last_id = 0; in wl1251_op_stop()
464 wl->next_tx_complete = 0; in wl1251_op_stop()
465 wl->elp = false; in wl1251_op_stop()
466 wl->station_mode = STATION_ACTIVE_MODE; in wl1251_op_stop()
467 wl->psm_entry_retry = 0; in wl1251_op_stop()
468 wl->tx_queue_stopped = false; in wl1251_op_stop()
469 wl->power_level = WL1251_DEFAULT_POWER_LEVEL; in wl1251_op_stop()
470 wl->rssi_thold = 0; in wl1251_op_stop()
471 wl->channel = WL1251_DEFAULT_CHANNEL; in wl1251_op_stop()
472 wl->monitor_present = false; in wl1251_op_stop()
473 wl->joined = false; in wl1251_op_stop()
477 mutex_unlock(&wl->mutex); in wl1251_op_stop()
483 struct wl1251 *wl = hw->priv; in wl1251_op_add_interface()
486 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | in wl1251_op_add_interface()
491 vif->type, vif->addr); in wl1251_op_add_interface()
493 mutex_lock(&wl->mutex); in wl1251_op_add_interface()
494 if (wl->vif) { in wl1251_op_add_interface()
495 ret = -EBUSY; in wl1251_op_add_interface()
499 wl->vif = vif; in wl1251_op_add_interface()
501 switch (vif->type) { in wl1251_op_add_interface()
503 wl->bss_type = BSS_TYPE_STA_BSS; in wl1251_op_add_interface()
506 wl->bss_type = BSS_TYPE_IBSS; in wl1251_op_add_interface()
509 ret = -EOPNOTSUPP; in wl1251_op_add_interface()
513 if (!ether_addr_equal_unaligned(wl->mac_addr, vif->addr)) { in wl1251_op_add_interface()
514 memcpy(wl->mac_addr, vif->addr, ETH_ALEN); in wl1251_op_add_interface()
515 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); in wl1251_op_add_interface()
522 mutex_unlock(&wl->mutex); in wl1251_op_add_interface()
529 struct wl1251 *wl = hw->priv; in wl1251_op_remove_interface()
531 mutex_lock(&wl->mutex); in wl1251_op_remove_interface()
533 wl->vif = NULL; in wl1251_op_remove_interface()
534 eth_zero_addr(wl->bssid); in wl1251_op_remove_interface()
535 mutex_unlock(&wl->mutex); in wl1251_op_remove_interface()
543 int ret = -ENOMEM; in wl1251_build_null_data()
545 if (wl->bss_type == BSS_TYPE_IBSS) { in wl1251_build_null_data()
549 skb = ieee80211_nullfunc_get(wl->hw, wl->vif, -1, false); in wl1251_build_null_data()
552 size = skb->len; in wl1251_build_null_data()
553 ptr = skb->data; in wl1251_build_null_data()
572 memcpy(template.addr1, wl->bssid, ETH_ALEN); in wl1251_build_qos_null_data()
573 memcpy(template.addr2, wl->mac_addr, ETH_ALEN); in wl1251_build_qos_null_data()
574 memcpy(template.addr3, wl->bssid, ETH_ALEN); in wl1251_build_qos_null_data()
587 static bool wl1251_can_do_pm(struct ieee80211_conf *conf, struct wl1251 *wl) in wl1251_can_do_pm() argument
589 return (conf->flags & IEEE80211_CONF_PS) && !wl->monitor_present; in wl1251_can_do_pm()
594 struct wl1251 *wl = hw->priv; in wl1251_op_config()
595 struct ieee80211_conf *conf = &hw->conf; in wl1251_op_config() local
599 conf->chandef.chan->center_freq); in wl1251_op_config()
604 conf->flags & IEEE80211_CONF_MONITOR ? "on" : "off", in wl1251_op_config()
605 conf->flags & IEEE80211_CONF_PS ? "on" : "off", in wl1251_op_config()
606 conf->power_level); in wl1251_op_config()
608 mutex_lock(&wl->mutex); in wl1251_op_config()
617 if (conf->flags & IEEE80211_CONF_MONITOR) { in wl1251_op_config()
618 wl->monitor_present = true; in wl1251_op_config()
621 wl->monitor_present = false; in wl1251_op_config()
630 if (channel != wl->channel) { in wl1251_op_config()
631 wl->channel = channel; in wl1251_op_config()
640 if (wl->vif == NULL) { in wl1251_op_config()
641 wl->joined = false; in wl1251_op_config()
642 ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1); in wl1251_op_config()
644 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_config()
645 wl->beacon_int, wl->dtim_period); in wl1251_op_config()
651 if (wl1251_can_do_pm(conf, wl) && !wl->psm_requested) { in wl1251_op_config()
654 wl->psm_requested = true; in wl1251_op_config()
656 wl->dtim_period = conf->ps_dtim_period; in wl1251_op_config()
658 ret = wl1251_acx_wr_tbtt_and_dtim(wl, wl->beacon_int, in wl1251_op_config()
659 wl->dtim_period); in wl1251_op_config()
667 } else if (!wl1251_can_do_pm(conf, wl) && wl->psm_requested) { in wl1251_op_config()
670 wl->psm_requested = false; in wl1251_op_config()
672 if (wl->station_mode != STATION_ACTIVE_MODE) { in wl1251_op_config()
679 if (changed & IEEE80211_CONF_CHANGE_IDLE && !wl->scanning) { in wl1251_op_config()
680 if (conf->flags & IEEE80211_CONF_IDLE) { in wl1251_op_config()
688 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_config()
689 wl->beacon_int, wl->dtim_period); in wl1251_op_config()
695 if (conf->power_level != wl->power_level) { in wl1251_op_config()
696 ret = wl1251_acx_tx_power(wl, conf->power_level); in wl1251_op_config()
700 wl->power_level = conf->power_level; in wl1251_op_config()
707 mutex_unlock(&wl->mutex); in wl1251_op_config()
723 struct wl1251 *wl = hw->priv; in wl1251_op_prepare_multicast()
725 if (unlikely(wl->state == WL1251_STATE_OFF)) in wl1251_op_prepare_multicast()
735 fp->mc_list_length = 0; in wl1251_op_prepare_multicast()
737 fp->enabled = false; in wl1251_op_prepare_multicast()
739 fp->enabled = true; in wl1251_op_prepare_multicast()
741 memcpy(fp->mc_list[fp->mc_list_length], in wl1251_op_prepare_multicast()
742 ha->addr, ETH_ALEN); in wl1251_op_prepare_multicast()
743 fp->mc_list_length++; in wl1251_op_prepare_multicast()
762 struct wl1251 *wl = hw->priv; in wl1251_op_configure_filter()
776 mutex_lock(&wl->mutex); in wl1251_op_configure_filter()
778 wl->rx_config = WL1251_DEFAULT_RX_CONFIG; in wl1251_op_configure_filter()
779 wl->rx_filter = WL1251_DEFAULT_RX_FILTER; in wl1251_op_configure_filter()
786 wl->rx_config &= ~CFG_MC_FILTER_EN; in wl1251_op_configure_filter()
788 wl->rx_filter |= CFG_RX_FCS_ERROR; in wl1251_op_configure_filter()
790 wl->rx_config &= ~CFG_BSSID_FILTER_EN; in wl1251_op_configure_filter()
791 wl->rx_config &= ~CFG_SSID_FILTER_EN; in wl1251_op_configure_filter()
794 wl->rx_filter |= CFG_RX_CTL_EN; in wl1251_op_configure_filter()
795 if (*total & FIF_OTHER_BSS || is_zero_ether_addr(wl->bssid)) in wl1251_op_configure_filter()
796 wl->rx_config &= ~CFG_BSSID_FILTER_EN; in wl1251_op_configure_filter()
798 wl->rx_filter |= CFG_RX_PREQ_EN; in wl1251_op_configure_filter()
800 if (wl->state == WL1251_STATE_OFF) in wl1251_op_configure_filter()
810 ret = wl1251_acx_group_address_tbl(wl, fp->enabled, in wl1251_op_configure_filter()
811 fp->mc_list, in wl1251_op_configure_filter()
812 fp->mc_list_length); in wl1251_op_configure_filter()
817 wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter); in wl1251_op_configure_filter()
822 mutex_unlock(&wl->mutex); in wl1251_op_configure_filter()
833 switch (mac80211_key->cipher) { in wl1251_set_key_type()
837 key->key_type = KEY_WEP_DEFAULT; in wl1251_set_key_type()
839 key->key_type = KEY_WEP_ADDR; in wl1251_set_key_type()
841 mac80211_key->hw_key_idx = mac80211_key->keyidx; in wl1251_set_key_type()
845 key->key_type = KEY_TKIP_MIC_GROUP; in wl1251_set_key_type()
847 key->key_type = KEY_TKIP_MIC_PAIRWISE; in wl1251_set_key_type()
849 mac80211_key->hw_key_idx = mac80211_key->keyidx; in wl1251_set_key_type()
853 key->key_type = KEY_AES_GROUP; in wl1251_set_key_type()
855 key->key_type = KEY_AES_PAIRWISE; in wl1251_set_key_type()
856 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in wl1251_set_key_type()
859 wl1251_error("Unknown key cipher 0x%x", mac80211_key->cipher); in wl1251_set_key_type()
860 return -EOPNOTSUPP; in wl1251_set_key_type()
871 struct wl1251 *wl = hw->priv; in wl1251_op_set_key()
883 ret = -ENOMEM; in wl1251_op_set_key()
887 addr = sta ? sta->addr : bcast_addr; in wl1251_op_set_key()
892 key->cipher, key->keyidx, key->keylen, key->flags); in wl1251_op_set_key()
893 wl1251_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen); in wl1251_op_set_key()
897 ret = -EOPNOTSUPP; in wl1251_op_set_key()
901 mutex_lock(&wl->mutex); in wl1251_op_set_key()
905 if (wl->monitor_present) { in wl1251_op_set_key()
906 ret = -EOPNOTSUPP; in wl1251_op_set_key()
909 wl_cmd->key_action = KEY_ADD_OR_REPLACE; in wl1251_op_set_key()
912 wl_cmd->key_action = KEY_REMOVE; in wl1251_op_set_key()
929 if (wl_cmd->key_type != KEY_WEP_DEFAULT) in wl1251_op_set_key()
930 memcpy(wl_cmd->addr, addr, ETH_ALEN); in wl1251_op_set_key()
932 if ((wl_cmd->key_type == KEY_TKIP_MIC_GROUP) || in wl1251_op_set_key()
933 (wl_cmd->key_type == KEY_TKIP_MIC_PAIRWISE)) { in wl1251_op_set_key()
936 * TKIP (16 bytes) - TX MIC (8 bytes) - RX MIC (8 bytes) in wl1251_op_set_key()
938 * TKIP - RX MIC - TX MIC in wl1251_op_set_key()
940 memcpy(wl_cmd->key, key->key, 16); in wl1251_op_set_key()
941 memcpy(wl_cmd->key + 16, key->key + 24, 8); in wl1251_op_set_key()
942 memcpy(wl_cmd->key + 24, key->key + 16, 8); in wl1251_op_set_key()
945 memcpy(wl_cmd->key, key->key, key->keylen); in wl1251_op_set_key()
947 wl_cmd->key_size = key->keylen; in wl1251_op_set_key()
949 wl_cmd->id = key->keyidx; in wl1251_op_set_key()
950 wl_cmd->ssid_profile = 0; in wl1251_op_set_key()
964 mutex_unlock(&wl->mutex); in wl1251_op_set_key()
976 struct cfg80211_scan_request *req = &hw_req->req; in wl1251_op_hw_scan()
977 struct wl1251 *wl = hw->priv; in wl1251_op_hw_scan()
985 if (req->n_ssids) { in wl1251_op_hw_scan()
986 ssid = req->ssids[0].ssid; in wl1251_op_hw_scan()
987 ssid_len = req->ssids[0].ssid_len; in wl1251_op_hw_scan()
990 mutex_lock(&wl->mutex); in wl1251_op_hw_scan()
992 if (wl->scanning) { in wl1251_op_hw_scan()
994 ret = -EINVAL; in wl1251_op_hw_scan()
1002 if (hw->conf.flags & IEEE80211_CONF_IDLE) { in wl1251_op_hw_scan()
1006 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_hw_scan()
1007 wl->beacon_int, wl->dtim_period); in wl1251_op_hw_scan()
1012 skb = ieee80211_probereq_get(wl->hw, wl->vif->addr, ssid, ssid_len, in wl1251_op_hw_scan()
1013 req->ie_len); in wl1251_op_hw_scan()
1015 ret = -ENOMEM; in wl1251_op_hw_scan()
1018 if (req->ie_len) in wl1251_op_hw_scan()
1019 skb_put_data(skb, req->ie, req->ie_len); in wl1251_op_hw_scan()
1021 ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, in wl1251_op_hw_scan()
1022 skb->len); in wl1251_op_hw_scan()
1031 wl->scanning = true; in wl1251_op_hw_scan()
1033 ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels, in wl1251_op_hw_scan()
1034 req->n_channels, WL1251_SCAN_NUM_PROBES); in wl1251_op_hw_scan()
1037 wl->scanning = false; in wl1251_op_hw_scan()
1043 if (hw->conf.flags & IEEE80211_CONF_IDLE) in wl1251_op_hw_scan()
1049 mutex_unlock(&wl->mutex); in wl1251_op_hw_scan()
1057 struct wl1251 *wl = hw->priv; in wl1251_op_set_rts_threshold()
1060 mutex_lock(&wl->mutex); in wl1251_op_set_rts_threshold()
1073 mutex_unlock(&wl->mutex); in wl1251_op_set_rts_threshold()
1083 struct wl1251 *wl = hw->priv; in wl1251_op_bss_info_changed()
1090 mutex_lock(&wl->mutex); in wl1251_op_bss_info_changed()
1097 ret = wl1251_acx_low_rssi(wl, bss_conf->cqm_rssi_thold, in wl1251_op_bss_info_changed()
1103 wl->rssi_thold = bss_conf->cqm_rssi_thold; in wl1251_op_bss_info_changed()
1107 memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { in wl1251_op_bss_info_changed()
1108 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); in wl1251_op_bss_info_changed()
1110 if (!is_zero_ether_addr(wl->bssid)) { in wl1251_op_bss_info_changed()
1119 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_bss_info_changed()
1120 wl->beacon_int, wl->dtim_period); in wl1251_op_bss_info_changed()
1127 if (vif->cfg.assoc) { in wl1251_op_bss_info_changed()
1128 wl->beacon_int = bss_conf->beacon_int; in wl1251_op_bss_info_changed()
1130 skb = ieee80211_pspoll_get(wl->hw, wl->vif); in wl1251_op_bss_info_changed()
1135 skb->data, in wl1251_op_bss_info_changed()
1136 skb->len); in wl1251_op_bss_info_changed()
1141 ret = wl1251_acx_aid(wl, vif->cfg.aid); in wl1251_op_bss_info_changed()
1146 wl->beacon_int = WL1251_DEFAULT_BEACON_INT; in wl1251_op_bss_info_changed()
1147 wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD; in wl1251_op_bss_info_changed()
1151 if (bss_conf->use_short_slot) in wl1251_op_bss_info_changed()
1162 if (bss_conf->use_short_preamble) in wl1251_op_bss_info_changed()
1169 if (bss_conf->use_cts_prot) in wl1251_op_bss_info_changed()
1180 __be32 addr = vif->cfg.arp_addr_list[0]; in wl1251_op_bss_info_changed()
1181 WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); in wl1251_op_bss_info_changed()
1183 enable = vif->cfg.arp_addr_cnt == 1 && vif->cfg.assoc; in wl1251_op_bss_info_changed()
1194 ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data, in wl1251_op_bss_info_changed()
1195 beacon->len); in wl1251_op_bss_info_changed()
1202 ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data, in wl1251_op_bss_info_changed()
1203 beacon->len); in wl1251_op_bss_info_changed()
1210 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_bss_info_changed()
1211 wl->beacon_int, wl->dtim_period); in wl1251_op_bss_info_changed()
1221 mutex_unlock(&wl->mutex); in wl1251_op_bss_info_changed()
1291 struct wl1251 *wl = hw->priv; in wl1251_op_conf_tx()
1294 mutex_lock(&wl->mutex); in wl1251_op_conf_tx()
1296 wl1251_debug(DEBUG_MAC80211, "mac80211 conf tx %d", queue); in wl1251_op_conf_tx()
1304 params->cw_min, params->cw_max, in wl1251_op_conf_tx()
1305 params->aifs, params->txop * 32); in wl1251_op_conf_tx()
1309 if (params->uapsd) in wl1251_op_conf_tx()
1325 mutex_unlock(&wl->mutex); in wl1251_op_conf_tx()
1333 struct wl1251 *wl = hw->priv; in wl1251_op_get_survey()
1334 struct ieee80211_conf *conf = &hw->conf; in wl1251_op_get_survey() local
1337 return -ENOENT; in wl1251_op_get_survey()
1339 survey->channel = conf->chandef.chan; in wl1251_op_get_survey()
1340 survey->filled = SURVEY_INFO_NOISE_DBM; in wl1251_op_get_survey()
1341 survey->noise = wl->noise; in wl1251_op_get_survey()
1390 return -ETIMEDOUT; in wl1251_read_eeprom_byte()
1431 wl->mac_addr[i] = mac[ETH_ALEN - i - 1]; in wl1251_read_eeprom_mac()
1443 if (wl->nvs_len < 0x24) in wl1251_check_nvs_mac()
1444 return -ENODATA; in wl1251_check_nvs_mac()
1447 if (wl->nvs[NVS_OFF_MAC_LEN] != 2 || in wl1251_check_nvs_mac()
1448 wl->nvs[NVS_OFF_MAC_ADDR_LO] != 0x6d || in wl1251_check_nvs_mac()
1449 wl->nvs[NVS_OFF_MAC_ADDR_HI] != 0x54) in wl1251_check_nvs_mac()
1450 return -EINVAL; in wl1251_check_nvs_mac()
1466 mac[i] = wl->nvs[NVS_OFF_MAC_DATA + ETH_ALEN - i - 1]; in wl1251_read_nvs_mac()
1468 /* 00:00:20:07:03:09 is in example file wl1251-nvs.bin, so invalid */ in wl1251_read_nvs_mac()
1470 return -EINVAL; in wl1251_read_nvs_mac()
1472 memcpy(wl->mac_addr, mac, ETH_ALEN); in wl1251_read_nvs_mac()
1486 wl->nvs[NVS_OFF_MAC_DATA + i] = wl->mac_addr[ETH_ALEN - i - 1]; in wl1251_write_nvs_mac()
1495 if (wl->mac80211_registered) in wl1251_register_hw()
1498 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); in wl1251_register_hw()
1500 ret = ieee80211_register_hw(wl->hw); in wl1251_register_hw()
1506 wl->mac80211_registered = true; in wl1251_register_hw()
1518 wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc) in wl1251_init_ieee80211()
1524 ieee80211_hw_set(wl->hw, SIGNAL_DBM); in wl1251_init_ieee80211()
1525 ieee80211_hw_set(wl->hw, SUPPORTS_PS); in wl1251_init_ieee80211()
1527 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in wl1251_init_ieee80211()
1529 wl->hw->wiphy->max_scan_ssids = 1; in wl1251_init_ieee80211()
1534 wl->hw->wiphy->max_scan_ie_len = 512; in wl1251_init_ieee80211()
1536 wl->hw->wiphy->bands[NL80211_BAND_2GHZ] = &wl1251_band_2ghz; in wl1251_init_ieee80211()
1538 wl->hw->queues = 4; in wl1251_init_ieee80211()
1540 if (wl->nvs == NULL && !wl->use_eeprom) { in wl1251_init_ieee80211()
1546 if (wl->use_eeprom) in wl1251_init_ieee80211()
1551 if (ret == 0 && !is_valid_ether_addr(wl->mac_addr)) in wl1251_init_ieee80211()
1552 ret = -EINVAL; in wl1251_init_ieee80211()
1560 memcpy(wl->mac_addr, nokia_oui, 3); in wl1251_init_ieee80211()
1561 get_random_bytes(wl->mac_addr + 3, 3); in wl1251_init_ieee80211()
1562 if (!wl->use_eeprom) in wl1251_init_ieee80211()
1565 wl1251_warning("Setting random MAC address: %pM", wl->mac_addr); in wl1251_init_ieee80211()
1591 return ERR_PTR(-ENOMEM); in wl1251_alloc_hw()
1594 wl = hw->priv; in wl1251_alloc_hw()
1597 wl->hw = hw; in wl1251_alloc_hw()
1599 wl->data_in_count = 0; in wl1251_alloc_hw()
1601 skb_queue_head_init(&wl->tx_queue); in wl1251_alloc_hw()
1603 INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); in wl1251_alloc_hw()
1604 wl->channel = WL1251_DEFAULT_CHANNEL; in wl1251_alloc_hw()
1605 wl->monitor_present = false; in wl1251_alloc_hw()
1606 wl->joined = false; in wl1251_alloc_hw()
1607 wl->scanning = false; in wl1251_alloc_hw()
1608 wl->bss_type = MAX_BSS_TYPE; in wl1251_alloc_hw()
1609 wl->default_key = 0; in wl1251_alloc_hw()
1610 wl->listen_int = 1; in wl1251_alloc_hw()
1611 wl->rx_counter = 0; in wl1251_alloc_hw()
1612 wl->rx_handled = 0; in wl1251_alloc_hw()
1613 wl->rx_current_buffer = 0; in wl1251_alloc_hw()
1614 wl->rx_last_id = 0; in wl1251_alloc_hw()
1615 wl->rx_config = WL1251_DEFAULT_RX_CONFIG; in wl1251_alloc_hw()
1616 wl->rx_filter = WL1251_DEFAULT_RX_FILTER; in wl1251_alloc_hw()
1617 wl->elp = false; in wl1251_alloc_hw()
1618 wl->station_mode = STATION_ACTIVE_MODE; in wl1251_alloc_hw()
1619 wl->psm_requested = false; in wl1251_alloc_hw()
1620 wl->psm_entry_retry = 0; in wl1251_alloc_hw()
1621 wl->tx_queue_stopped = false; in wl1251_alloc_hw()
1622 wl->power_level = WL1251_DEFAULT_POWER_LEVEL; in wl1251_alloc_hw()
1623 wl->rssi_thold = 0; in wl1251_alloc_hw()
1624 wl->beacon_int = WL1251_DEFAULT_BEACON_INT; in wl1251_alloc_hw()
1625 wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD; in wl1251_alloc_hw()
1626 wl->vif = NULL; in wl1251_alloc_hw()
1629 wl->tx_frames[i] = NULL; in wl1251_alloc_hw()
1631 wl->next_tx_complete = 0; in wl1251_alloc_hw()
1633 INIT_WORK(&wl->irq_work, wl1251_irq_work); in wl1251_alloc_hw()
1634 INIT_WORK(&wl->tx_work, wl1251_tx_work); in wl1251_alloc_hw()
1636 wl->state = WL1251_STATE_OFF; in wl1251_alloc_hw()
1637 mutex_init(&wl->mutex); in wl1251_alloc_hw()
1638 spin_lock_init(&wl->wl_lock); in wl1251_alloc_hw()
1640 wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; in wl1251_alloc_hw()
1641 wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE; in wl1251_alloc_hw()
1643 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); in wl1251_alloc_hw()
1644 if (!wl->rx_descriptor) { in wl1251_alloc_hw()
1645 wl1251_error("could not allocate memory for rx descriptor"); in wl1251_alloc_hw()
1647 return ERR_PTR(-ENOMEM); in wl1251_alloc_hw()
1656 ieee80211_unregister_hw(wl->hw); in wl1251_free_hw()
1660 kfree(wl->target_mem_map); in wl1251_free_hw()
1661 kfree(wl->data_path); in wl1251_free_hw()
1662 vfree(wl->fw); in wl1251_free_hw()
1663 wl->fw = NULL; in wl1251_free_hw()
1664 kfree(wl->nvs); in wl1251_free_hw()
1665 wl->nvs = NULL; in wl1251_free_hw()
1667 kfree(wl->rx_descriptor); in wl1251_free_hw()
1668 wl->rx_descriptor = NULL; in wl1251_free_hw()
1670 ieee80211_free_hw(wl->hw); in wl1251_free_hw()