Lines Matching +full:pn +full:- +full:retry +full:- +full:params

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Mac80211 STA API for ST-Ericsson CW1200 drivers
5 * Copyright (c) 2010, ST-Ericsson
46 list_del(&event->link); in __cw1200_free_event_queue()
56 struct cw1200_common *priv = dev->priv; in cw1200_start()
59 cw1200_pm_stay_awake(&priv->pm_state, HZ); in cw1200_start()
61 mutex_lock(&priv->conf_mutex); in cw1200_start()
64 WSM_EDCA_SET(&priv->edca, 0, 0x0002, 0x0003, 0x0007, 47, 0xc8, false); in cw1200_start()
65 WSM_EDCA_SET(&priv->edca, 1, 0x0002, 0x0007, 0x000f, 94, 0xc8, false); in cw1200_start()
66 WSM_EDCA_SET(&priv->edca, 2, 0x0003, 0x000f, 0x03ff, 0, 0xc8, false); in cw1200_start()
67 WSM_EDCA_SET(&priv->edca, 3, 0x0007, 0x000f, 0x03ff, 0, 0xc8, false); in cw1200_start()
68 ret = wsm_set_edca_params(priv, &priv->edca); in cw1200_start()
72 ret = cw1200_set_uapsd_param(priv, &priv->edca); in cw1200_start()
76 priv->setbssparams_done = false; in cw1200_start()
78 memcpy(priv->mac_addr, dev->wiphy->perm_addr, ETH_ALEN); in cw1200_start()
79 priv->mode = NL80211_IFTYPE_MONITOR; in cw1200_start()
80 priv->wep_default_key_id = -1; in cw1200_start()
82 priv->cqm_beacon_loss_count = 10; in cw1200_start()
89 mutex_unlock(&priv->conf_mutex); in cw1200_start()
95 struct cw1200_common *priv = dev->priv; in cw1200_stop()
101 while (down_trylock(&priv->scan.lock)) { in cw1200_stop()
103 priv->scan.req = NULL; in cw1200_stop()
106 up(&priv->scan.lock); in cw1200_stop()
108 cancel_delayed_work_sync(&priv->scan.probe_work); in cw1200_stop()
109 cancel_delayed_work_sync(&priv->scan.timeout); in cw1200_stop()
110 cancel_delayed_work_sync(&priv->clear_recent_scan_work); in cw1200_stop()
111 cancel_delayed_work_sync(&priv->join_timeout); in cw1200_stop()
113 cancel_work_sync(&priv->unjoin_work); in cw1200_stop()
114 cancel_delayed_work_sync(&priv->link_id_gc_work); in cw1200_stop()
115 flush_workqueue(priv->workqueue); in cw1200_stop()
116 del_timer_sync(&priv->mcast_timeout); in cw1200_stop()
117 mutex_lock(&priv->conf_mutex); in cw1200_stop()
118 priv->mode = NL80211_IFTYPE_UNSPECIFIED; in cw1200_stop()
119 priv->listening = false; in cw1200_stop()
121 spin_lock(&priv->event_queue_lock); in cw1200_stop()
122 list_splice_init(&priv->event_queue, &list); in cw1200_stop()
123 spin_unlock(&priv->event_queue_lock); in cw1200_stop()
127 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_stop()
128 priv->join_pending = false; in cw1200_stop()
131 cw1200_queue_clear(&priv->tx_queue[i]); in cw1200_stop()
132 mutex_unlock(&priv->conf_mutex); in cw1200_stop()
136 if (atomic_xchg(&priv->tx_lock, 1) != 1) in cw1200_stop()
137 pr_debug("[STA] TX is force-unlocked due to stop request.\n"); in cw1200_stop()
140 atomic_xchg(&priv->tx_lock, 0); /* for recovery to work */ in cw1200_stop()
153 priv->delayed_link_loss = 0; in __cw1200_cqm_bssloss_sm()
154 cancel_work_sync(&priv->bss_params_work); in __cw1200_cqm_bssloss_sm()
157 priv->bss_loss_state, in __cw1200_cqm_bssloss_sm()
159 atomic_read(&priv->tx_lock), in __cw1200_cqm_bssloss_sm()
160 priv->delayed_unjoin); in __cw1200_cqm_bssloss_sm()
163 if (priv->delayed_unjoin) in __cw1200_cqm_bssloss_sm()
167 queue_delayed_work(priv->workqueue, in __cw1200_cqm_bssloss_sm()
168 &priv->bss_loss_work, in __cw1200_cqm_bssloss_sm()
170 priv->bss_loss_state = 0; in __cw1200_cqm_bssloss_sm()
173 if (!priv->vif->p2p && !atomic_read(&priv->tx_lock)) in __cw1200_cqm_bssloss_sm()
176 cancel_delayed_work_sync(&priv->bss_loss_work); in __cw1200_cqm_bssloss_sm()
177 priv->bss_loss_state = 0; in __cw1200_cqm_bssloss_sm()
178 queue_work(priv->workqueue, &priv->bss_params_work); in __cw1200_cqm_bssloss_sm()
181 if (priv->bss_loss_state < 3) in __cw1200_cqm_bssloss_sm()
184 cancel_delayed_work_sync(&priv->bss_loss_work); in __cw1200_cqm_bssloss_sm()
185 priv->bss_loss_state = 0; in __cw1200_cqm_bssloss_sm()
196 priv->bss_loss_state++; in __cw1200_cqm_bssloss_sm()
198 skb = ieee80211_nullfunc_get(priv->hw, priv->vif, -1, false); in __cw1200_cqm_bssloss_sm()
201 cw1200_tx(priv->hw, NULL, skb); in __cw1200_cqm_bssloss_sm()
209 struct cw1200_common *priv = dev->priv; in cw1200_add_interface()
212 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | in cw1200_add_interface()
216 mutex_lock(&priv->conf_mutex); in cw1200_add_interface()
218 if (priv->mode != NL80211_IFTYPE_MONITOR) { in cw1200_add_interface()
219 mutex_unlock(&priv->conf_mutex); in cw1200_add_interface()
220 return -EOPNOTSUPP; in cw1200_add_interface()
223 switch (vif->type) { in cw1200_add_interface()
228 priv->mode = vif->type; in cw1200_add_interface()
231 mutex_unlock(&priv->conf_mutex); in cw1200_add_interface()
232 return -EOPNOTSUPP; in cw1200_add_interface()
235 priv->vif = vif; in cw1200_add_interface()
236 memcpy(priv->mac_addr, vif->addr, ETH_ALEN); in cw1200_add_interface()
238 /* Enable auto-calibration */ in cw1200_add_interface()
244 mutex_unlock(&priv->conf_mutex); in cw1200_add_interface()
251 struct cw1200_common *priv = dev->priv; in cw1200_remove_interface()
257 mutex_lock(&priv->conf_mutex); in cw1200_remove_interface()
258 switch (priv->join_status) { in cw1200_remove_interface()
264 if (queue_work(priv->workqueue, &priv->unjoin_work) <= 0) in cw1200_remove_interface()
268 for (i = 0; priv->link_id_map; ++i) { in cw1200_remove_interface()
269 if (priv->link_id_map & BIT(i)) { in cw1200_remove_interface()
272 priv->link_id_map &= ~BIT(i); in cw1200_remove_interface()
275 memset(priv->link_id_db, 0, sizeof(priv->link_id_db)); in cw1200_remove_interface()
276 priv->sta_asleep_mask = 0; in cw1200_remove_interface()
277 priv->enable_beacon = false; in cw1200_remove_interface()
278 priv->tx_multicast = false; in cw1200_remove_interface()
279 priv->aid0_bit_set = false; in cw1200_remove_interface()
280 priv->buffered_multicasts = false; in cw1200_remove_interface()
281 priv->pspoll_mask = 0; in cw1200_remove_interface()
291 priv->vif = NULL; in cw1200_remove_interface()
292 priv->mode = NL80211_IFTYPE_MONITOR; in cw1200_remove_interface()
293 eth_zero_addr(priv->mac_addr); in cw1200_remove_interface()
294 memset(&priv->p2p_ps_modeinfo, 0, sizeof(priv->p2p_ps_modeinfo)); in cw1200_remove_interface()
297 priv->listening = false; in cw1200_remove_interface()
298 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_remove_interface()
302 mutex_unlock(&priv->conf_mutex); in cw1200_remove_interface()
312 p2p, vif->type, vif->p2p); in cw1200_change_interface()
314 if (new_type != vif->type || vif->p2p != p2p) { in cw1200_change_interface()
316 vif->type = new_type; in cw1200_change_interface()
317 vif->p2p = p2p; in cw1200_change_interface()
327 struct cw1200_common *priv = dev->priv; in cw1200_config()
328 struct ieee80211_conf *conf = &dev->conf; in cw1200_config()
332 down(&priv->scan.lock); in cw1200_config()
333 mutex_lock(&priv->conf_mutex); in cw1200_config()
338 priv->output_power = conf->power_level; in cw1200_config()
339 pr_debug("[STA] TX power: %d\n", priv->output_power); in cw1200_config()
340 wsm_set_output_power(priv, priv->output_power * 10); in cw1200_config()
344 (priv->channel != conf->chandef.chan)) { in cw1200_config()
345 struct ieee80211_channel *ch = conf->chandef.chan; in cw1200_config()
347 .channel_number = ch->hw_value, in cw1200_config()
350 ch->center_freq, ch->hw_value); in cw1200_config()
355 ret = wait_event_timeout(priv->channel_switch_done, in cw1200_config()
356 !priv->channel_switch_in_progress, in cw1200_config()
360 priv->channel = ch; in cw1200_config()
363 ret = -ETIMEDOUT; in cw1200_config()
373 if (!(conf->flags & IEEE80211_CONF_PS)) in cw1200_config()
374 priv->powersave_mode.mode = WSM_PSM_ACTIVE; in cw1200_config()
375 else if (conf->dynamic_ps_timeout <= 0) in cw1200_config()
376 priv->powersave_mode.mode = WSM_PSM_PS; in cw1200_config()
378 priv->powersave_mode.mode = WSM_PSM_FAST_PS; in cw1200_config()
380 /* Firmware requires that value for this 1-byte field must in cw1200_config()
384 if (conf->dynamic_ps_timeout >= 0x80) in cw1200_config()
385 priv->powersave_mode.fast_psm_idle_period = 0xFF; in cw1200_config()
387 priv->powersave_mode.fast_psm_idle_period = in cw1200_config()
388 conf->dynamic_ps_timeout << 1; in cw1200_config()
390 if (priv->join_status == CW1200_JOIN_STATUS_STA && in cw1200_config()
391 priv->bss_params.aid) in cw1200_config()
392 cw1200_set_pm(priv, &priv->powersave_mode); in cw1200_config()
397 * there's a monitor interface present -- use this in cw1200_config()
411 /* Disable p2p-dev mode forced by TX request */ in cw1200_config()
412 if ((priv->join_status == CW1200_JOIN_STATUS_MONITOR) && in cw1200_config()
413 (conf->flags & IEEE80211_CONF_IDLE) && in cw1200_config()
414 !priv->listening) { in cw1200_config()
416 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_config()
423 pr_debug("[STA] Retry limits: %d (long), %d (short).\n", in cw1200_config()
424 conf->long_frame_max_tx_count, in cw1200_config()
425 conf->short_frame_max_tx_count); in cw1200_config()
426 spin_lock_bh(&priv->tx_policy_cache.lock); in cw1200_config()
427 priv->long_frame_max_tx_count = conf->long_frame_max_tx_count; in cw1200_config()
428 priv->short_frame_max_tx_count = in cw1200_config()
429 (conf->short_frame_max_tx_count < 0x0F) ? in cw1200_config()
430 conf->short_frame_max_tx_count : 0x0F; in cw1200_config()
431 priv->hw->max_rate_tries = priv->short_frame_max_tx_count; in cw1200_config()
432 spin_unlock_bh(&priv->tx_policy_cache.lock); in cw1200_config()
434 mutex_unlock(&priv->conf_mutex); in cw1200_config()
435 up(&priv->scan.lock); in cw1200_config()
442 bool bssid_filtering = !priv->rx_filter.bssid; in cw1200_update_filtering()
443 bool is_p2p = priv->vif && priv->vif->p2p; in cw1200_update_filtering()
444 bool is_sta = priv->vif && NL80211_IFTYPE_STATION == priv->vif->type; in cw1200_update_filtering()
465 if (priv->join_status == CW1200_JOIN_STATUS_PASSIVE) in cw1200_update_filtering()
467 else if (priv->join_status == CW1200_JOIN_STATUS_MONITOR) in cw1200_update_filtering()
470 if (priv->disable_beacon_filter) { in cw1200_update_filtering()
496 ret = wsm_set_rx_filter(priv, &priv->rx_filter); in cw1200_update_filtering()
504 ret = wsm_set_multicast_filter(priv, &priv->multicast_filter); in cw1200_update_filtering()
506 wiphy_err(priv->hw->wiphy, in cw1200_update_filtering()
527 priv->beacon_int * priv->join_dtim_period > in cw1200_set_beacon_wakeup_period_work()
529 priv->join_dtim_period, 0); in cw1200_set_beacon_wakeup_period_work()
541 struct cw1200_common *priv = hw->priv; in cw1200_prepare_multicast()
546 priv->has_multicast_subscription = false; in cw1200_prepare_multicast()
547 memset(&priv->multicast_filter, 0x00, sizeof(priv->multicast_filter)); in cw1200_prepare_multicast()
554 pr_debug("[STA] multicast: %pM\n", ha->addr); in cw1200_prepare_multicast()
555 memcpy(&priv->multicast_filter.macaddrs[count], in cw1200_prepare_multicast()
556 ha->addr, ETH_ALEN); in cw1200_prepare_multicast()
557 if (!ether_addr_equal(ha->addr, broadcast_ipv4) && in cw1200_prepare_multicast()
558 !ether_addr_equal(ha->addr, broadcast_ipv6)) in cw1200_prepare_multicast()
559 priv->has_multicast_subscription = true; in cw1200_prepare_multicast()
564 priv->multicast_filter.enable = __cpu_to_le32(1); in cw1200_prepare_multicast()
565 priv->multicast_filter.num_addrs = __cpu_to_le32(count); in cw1200_prepare_multicast()
576 struct cw1200_common *priv = dev->priv; in cw1200_configure_filter()
587 down(&priv->scan.lock); in cw1200_configure_filter()
588 mutex_lock(&priv->conf_mutex); in cw1200_configure_filter()
590 priv->rx_filter.promiscuous = 0; in cw1200_configure_filter()
591 priv->rx_filter.bssid = (*total_flags & (FIF_OTHER_BSS | in cw1200_configure_filter()
593 priv->rx_filter.fcs = (*total_flags & FIF_FCSFAIL) ? 1 : 0; in cw1200_configure_filter()
594 priv->disable_beacon_filter = !(*total_flags & in cw1200_configure_filter()
597 if (priv->listening != listening) { in cw1200_configure_filter()
598 priv->listening = listening; in cw1200_configure_filter()
604 mutex_unlock(&priv->conf_mutex); in cw1200_configure_filter()
605 up(&priv->scan.lock); in cw1200_configure_filter()
610 const struct ieee80211_tx_queue_params *params) in cw1200_conf_tx() argument
612 struct cw1200_common *priv = dev->priv; in cw1200_conf_tx()
614 /* To prevent re-applying PM request OID again and again*/ in cw1200_conf_tx()
617 mutex_lock(&priv->conf_mutex); in cw1200_conf_tx()
619 if (queue < dev->queues) { in cw1200_conf_tx()
620 old_uapsd_flags = le16_to_cpu(priv->uapsd_info.uapsd_flags); in cw1200_conf_tx()
622 WSM_TX_QUEUE_SET(&priv->tx_queue_params, queue, 0, 0, 0); in cw1200_conf_tx()
624 &priv->tx_queue_params.params[queue], queue); in cw1200_conf_tx()
626 ret = -EINVAL; in cw1200_conf_tx()
630 WSM_EDCA_SET(&priv->edca, queue, params->aifs, in cw1200_conf_tx()
631 params->cw_min, params->cw_max, in cw1200_conf_tx()
632 params->txop, 0xc8, in cw1200_conf_tx()
633 params->uapsd); in cw1200_conf_tx()
634 ret = wsm_set_edca_params(priv, &priv->edca); in cw1200_conf_tx()
636 ret = -EINVAL; in cw1200_conf_tx()
640 if (priv->mode == NL80211_IFTYPE_STATION) { in cw1200_conf_tx()
641 ret = cw1200_set_uapsd_param(priv, &priv->edca); in cw1200_conf_tx()
642 if (!ret && priv->setbssparams_done && in cw1200_conf_tx()
643 (priv->join_status == CW1200_JOIN_STATUS_STA) && in cw1200_conf_tx()
644 (old_uapsd_flags != le16_to_cpu(priv->uapsd_info.uapsd_flags))) in cw1200_conf_tx()
645 ret = cw1200_set_pm(priv, &priv->powersave_mode); in cw1200_conf_tx()
648 ret = -EINVAL; in cw1200_conf_tx()
652 mutex_unlock(&priv->conf_mutex); in cw1200_conf_tx()
659 struct cw1200_common *priv = dev->priv; in cw1200_get_stats()
661 memcpy(stats, &priv->stats, sizeof(*stats)); in cw1200_get_stats()
669 if (priv->uapsd_info.uapsd_flags != 0) in cw1200_set_pm()
672 if (memcmp(&pm, &priv->firmware_ps_mode, in cw1200_set_pm()
674 priv->firmware_ps_mode = pm; in cw1200_set_pm()
685 int ret = -EOPNOTSUPP; in cw1200_set_key()
686 struct cw1200_common *priv = dev->priv; in cw1200_set_key()
689 mutex_lock(&priv->conf_mutex); in cw1200_set_key()
693 int pairwise = (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) ? in cw1200_set_key()
696 struct wsm_add_key *wsm_key = &priv->keys[idx]; in cw1200_set_key()
699 ret = -EINVAL; in cw1200_set_key()
704 peer_addr = sta->addr; in cw1200_set_key()
706 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | in cw1200_set_key()
709 switch (key->cipher) { in cw1200_set_key()
712 if (key->keylen > 16) { in cw1200_set_key()
714 ret = -EINVAL; in cw1200_set_key()
719 wsm_key->type = WSM_KEY_TYPE_WEP_PAIRWISE; in cw1200_set_key()
720 memcpy(wsm_key->wep_pairwise.peer, in cw1200_set_key()
722 memcpy(wsm_key->wep_pairwise.keydata, in cw1200_set_key()
723 &key->key[0], key->keylen); in cw1200_set_key()
724 wsm_key->wep_pairwise.keylen = key->keylen; in cw1200_set_key()
726 wsm_key->type = WSM_KEY_TYPE_WEP_DEFAULT; in cw1200_set_key()
727 memcpy(wsm_key->wep_group.keydata, in cw1200_set_key()
728 &key->key[0], key->keylen); in cw1200_set_key()
729 wsm_key->wep_group.keylen = key->keylen; in cw1200_set_key()
730 wsm_key->wep_group.keyid = key->keyidx; in cw1200_set_key()
736 wsm_key->type = WSM_KEY_TYPE_TKIP_PAIRWISE; in cw1200_set_key()
737 memcpy(wsm_key->tkip_pairwise.peer, in cw1200_set_key()
739 memcpy(wsm_key->tkip_pairwise.keydata, in cw1200_set_key()
740 &key->key[0], 16); in cw1200_set_key()
741 memcpy(wsm_key->tkip_pairwise.tx_mic_key, in cw1200_set_key()
742 &key->key[16], 8); in cw1200_set_key()
743 memcpy(wsm_key->tkip_pairwise.rx_mic_key, in cw1200_set_key()
744 &key->key[24], 8); in cw1200_set_key()
747 (priv->mode == NL80211_IFTYPE_AP) ? in cw1200_set_key()
749 wsm_key->type = WSM_KEY_TYPE_TKIP_GROUP; in cw1200_set_key()
750 memcpy(wsm_key->tkip_group.keydata, in cw1200_set_key()
751 &key->key[0], 16); in cw1200_set_key()
752 memcpy(wsm_key->tkip_group.rx_mic_key, in cw1200_set_key()
753 &key->key[mic_offset], 8); in cw1200_set_key()
755 wsm_key->tkip_group.rx_seqnum[0] = seq.tkip.iv16 & 0xff; in cw1200_set_key()
756 wsm_key->tkip_group.rx_seqnum[1] = (seq.tkip.iv16 >> 8) & 0xff; in cw1200_set_key()
757 wsm_key->tkip_group.rx_seqnum[2] = seq.tkip.iv32 & 0xff; in cw1200_set_key()
758 wsm_key->tkip_group.rx_seqnum[3] = (seq.tkip.iv32 >> 8) & 0xff; in cw1200_set_key()
759 wsm_key->tkip_group.rx_seqnum[4] = (seq.tkip.iv32 >> 16) & 0xff; in cw1200_set_key()
760 wsm_key->tkip_group.rx_seqnum[5] = (seq.tkip.iv32 >> 24) & 0xff; in cw1200_set_key()
761 wsm_key->tkip_group.rx_seqnum[6] = 0; in cw1200_set_key()
762 wsm_key->tkip_group.rx_seqnum[7] = 0; in cw1200_set_key()
764 wsm_key->tkip_group.keyid = key->keyidx; in cw1200_set_key()
770 wsm_key->type = WSM_KEY_TYPE_AES_PAIRWISE; in cw1200_set_key()
771 memcpy(wsm_key->aes_pairwise.peer, in cw1200_set_key()
773 memcpy(wsm_key->aes_pairwise.keydata, in cw1200_set_key()
774 &key->key[0], 16); in cw1200_set_key()
776 wsm_key->type = WSM_KEY_TYPE_AES_GROUP; in cw1200_set_key()
777 memcpy(wsm_key->aes_group.keydata, in cw1200_set_key()
778 &key->key[0], 16); in cw1200_set_key()
780 wsm_key->aes_group.rx_seqnum[0] = seq.ccmp.pn[5]; in cw1200_set_key()
781 wsm_key->aes_group.rx_seqnum[1] = seq.ccmp.pn[4]; in cw1200_set_key()
782 wsm_key->aes_group.rx_seqnum[2] = seq.ccmp.pn[3]; in cw1200_set_key()
783 wsm_key->aes_group.rx_seqnum[3] = seq.ccmp.pn[2]; in cw1200_set_key()
784 wsm_key->aes_group.rx_seqnum[4] = seq.ccmp.pn[1]; in cw1200_set_key()
785 wsm_key->aes_group.rx_seqnum[5] = seq.ccmp.pn[0]; in cw1200_set_key()
786 wsm_key->aes_group.rx_seqnum[6] = 0; in cw1200_set_key()
787 wsm_key->aes_group.rx_seqnum[7] = 0; in cw1200_set_key()
788 wsm_key->aes_group.keyid = key->keyidx; in cw1200_set_key()
793 wsm_key->type = WSM_KEY_TYPE_WAPI_PAIRWISE; in cw1200_set_key()
794 memcpy(wsm_key->wapi_pairwise.peer, in cw1200_set_key()
796 memcpy(wsm_key->wapi_pairwise.keydata, in cw1200_set_key()
797 &key->key[0], 16); in cw1200_set_key()
798 memcpy(wsm_key->wapi_pairwise.mic_key, in cw1200_set_key()
799 &key->key[16], 16); in cw1200_set_key()
800 wsm_key->wapi_pairwise.keyid = key->keyidx; in cw1200_set_key()
802 wsm_key->type = WSM_KEY_TYPE_WAPI_GROUP; in cw1200_set_key()
803 memcpy(wsm_key->wapi_group.keydata, in cw1200_set_key()
804 &key->key[0], 16); in cw1200_set_key()
805 memcpy(wsm_key->wapi_group.mic_key, in cw1200_set_key()
806 &key->key[16], 16); in cw1200_set_key()
807 wsm_key->wapi_group.keyid = key->keyidx; in cw1200_set_key()
811 pr_warn("Unhandled key type %d\n", key->cipher); in cw1200_set_key()
813 ret = -EOPNOTSUPP; in cw1200_set_key()
818 key->hw_key_idx = idx; in cw1200_set_key()
823 .index = key->hw_key_idx, in cw1200_set_key()
827 ret = -EINVAL; in cw1200_set_key()
838 mutex_unlock(&priv->conf_mutex); in cw1200_set_key()
846 u8 queue_id = cw1200_queue_get_queue_id(priv->pending_frame_id); in cw1200_wep_key_work()
847 struct cw1200_queue *queue = &priv->tx_queue[queue_id]; in cw1200_wep_key_work()
849 priv->wep_default_key_id); in cw1200_wep_key_work()
852 priv->wep_default_key_id); in cw1200_wep_key_work()
856 cw1200_queue_requeue(queue, priv->pending_frame_id); in cw1200_wep_key_work()
864 struct cw1200_common *priv = hw->priv; in cw1200_set_rts_threshold()
866 if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) in cw1200_set_rts_threshold()
869 if (value != (u32) -1) in cw1200_set_rts_threshold()
874 if (priv->rts_threshold == value) in cw1200_set_rts_threshold()
878 priv->rts_threshold); in cw1200_set_rts_threshold()
880 /* mutex_lock(&priv->conf_mutex); */ in cw1200_set_rts_threshold()
884 priv->rts_threshold = value; in cw1200_set_rts_threshold()
885 /* mutex_unlock(&priv->conf_mutex); */ in cw1200_set_rts_threshold()
902 cw1200_queue_clear(&priv->tx_queue[i]); in __cw1200_flush()
905 priv->tx_queue_stats.wait_link_id_empty, in __cw1200_flush()
907 &priv->tx_queue_stats, -1), in __cw1200_flush()
912 ret = -ETIMEDOUT; in __cw1200_flush()
919 if (!cw1200_queue_stats_is_empty(&priv->tx_queue_stats, -1)) { in __cw1200_flush()
932 struct cw1200_common *priv = hw->priv; in cw1200_flush()
934 switch (priv->mode) { in cw1200_flush()
939 if (!priv->enable_beacon) in cw1200_flush()
957 spin_lock(&priv->event_queue_lock); in cw1200_free_event_queue()
958 list_splice_init(&priv->event_queue, &list); in cw1200_free_event_queue()
959 spin_unlock(&priv->event_queue_lock); in cw1200_free_event_queue()
971 spin_lock(&priv->event_queue_lock); in cw1200_event_handler()
972 list_splice_init(&priv->event_queue, &list); in cw1200_event_handler()
973 spin_unlock(&priv->event_queue_lock); in cw1200_event_handler()
976 switch (event->evt.id) { in cw1200_event_handler()
982 cancel_work_sync(&priv->unjoin_work); in cw1200_event_handler()
983 if (!down_trylock(&priv->scan.lock)) { in cw1200_event_handler()
985 up(&priv->scan.lock); in cw1200_event_handler()
990 priv->delayed_link_loss = 1; in cw1200_event_handler()
992 queue_delayed_work(priv->workqueue, in cw1200_event_handler()
993 &priv->bss_loss_work, 5*HZ); in cw1200_event_handler()
999 cancel_work_sync(&priv->unjoin_work); in cw1200_event_handler()
1002 wiphy_info(priv->hw->wiphy, "radar pulse detected\n"); in cw1200_event_handler()
1007 * RSSI = RCPI / 2 - 110 in cw1200_event_handler()
1009 int rcpi_rssi = (int)(event->evt.data & 0xFF); in cw1200_event_handler()
1011 if (priv->cqm_use_rssi) in cw1200_event_handler()
1014 rcpi_rssi = rcpi_rssi / 2 - 110; in cw1200_event_handler()
1016 cqm_evt = (rcpi_rssi <= priv->cqm_rssi_thold) ? in cw1200_event_handler()
1020 ieee80211_cqm_rssi_notify(priv->vif, cqm_evt, rcpi_rssi, in cw1200_event_handler()
1042 if (queue_work(priv->workqueue, &priv->unjoin_work) <= 0) in cw1200_bss_loss_work()
1050 mutex_lock(&priv->conf_mutex); in cw1200_bss_params_work()
1052 priv->bss_params.reset_beacon_loss = 1; in cw1200_bss_params_work()
1053 wsm_set_bss_params(priv, &priv->bss_params); in cw1200_bss_params_work()
1054 priv->bss_params.reset_beacon_loss = 0; in cw1200_bss_params_work()
1056 mutex_unlock(&priv->conf_mutex); in cw1200_bss_params_work()
1068 const u8 *p = priv->sdd->data; in cw1200_parse_sdd_file()
1071 while (p + 2 <= priv->sdd->data + priv->sdd->size) { in cw1200_parse_sdd_file()
1072 if (p + p[1] + 2 > priv->sdd->data + priv->sdd->size) { in cw1200_parse_sdd_file()
1074 return -1; in cw1200_parse_sdd_file()
1081 ret = -1; in cw1200_parse_sdd_file()
1085 if (!v) /* non-zero means this is enabled */ in cw1200_parse_sdd_file()
1089 priv->conf_listen_interval = (v >> 7) & 0x1F; in cw1200_parse_sdd_file()
1091 priv->conf_listen_interval); in cw1200_parse_sdd_file()
1096 if (clk != priv->hw_refclk) in cw1200_parse_sdd_file()
1098 clk, priv->hw_refclk); in cw1200_parse_sdd_file()
1107 if (!priv->bt_present) { in cw1200_parse_sdd_file()
1109 priv->conf_listen_interval = 0; in cw1200_parse_sdd_file()
1124 * what can lead to signal level oscilations in user-end applications in cw1200_setup_mac()
1134 .dot11StationId = &priv->mac_addr[0], in cw1200_setup_mac()
1141 priv->cqm_use_rssi = true; in cw1200_setup_mac()
1143 if (!priv->sdd) { in cw1200_setup_mac()
1144 ret = request_firmware(&priv->sdd, priv->sdd_path, priv->pdev); in cw1200_setup_mac()
1146 pr_err("Can't load sdd file %s.\n", priv->sdd_path); in cw1200_setup_mac()
1152 cfg.dpdData = priv->sdd->data; in cw1200_setup_mac()
1153 cfg.dpdData_size = priv->sdd->size; in cw1200_setup_mac()
1166 pr_debug("[STA] Join complete (%d)\n", priv->join_complete_status); in cw1200_join_complete()
1168 priv->join_pending = false; in cw1200_join_complete()
1169 if (priv->join_complete_status) { in cw1200_join_complete()
1170 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_join_complete()
1171 cw1200_update_listening(priv, priv->listening); in cw1200_join_complete()
1173 ieee80211_connection_loss(priv->vif); in cw1200_join_complete()
1175 if (priv->mode == NL80211_IFTYPE_ADHOC) in cw1200_join_complete()
1176 priv->join_status = CW1200_JOIN_STATUS_IBSS; in cw1200_join_complete()
1178 priv->join_status = CW1200_JOIN_STATUS_PRE_STA; in cw1200_join_complete()
1187 mutex_lock(&priv->conf_mutex); in cw1200_join_complete_work()
1189 mutex_unlock(&priv->conf_mutex); in cw1200_join_complete_work()
1196 arg->status); in cw1200_join_complete_cb()
1198 if (cancel_delayed_work(&priv->join_timeout)) { in cw1200_join_complete_cb()
1199 priv->join_complete_status = arg->status; in cw1200_join_complete_cb()
1200 queue_work(priv->workqueue, &priv->join_complete_work); in cw1200_join_complete_cb()
1208 struct ieee80211_bss_conf *conf = &priv->vif->bss_conf; in cw1200_do_join()
1212 .mode = priv->vif->cfg.ibss_joined ? in cw1200_do_join()
1218 conf->basic_rates), in cw1200_do_join()
1220 if (delayed_work_pending(&priv->join_timeout)) { in cw1200_do_join()
1221 pr_warn("[STA] - Join request already pending, skipping..\n"); in cw1200_do_join()
1226 if (priv->join_status) in cw1200_do_join()
1229 bssid = priv->vif->bss_conf.bssid; in cw1200_do_join()
1231 bss = cfg80211_get_bss(priv->hw->wiphy, priv->channel, bssid, NULL, 0, in cw1200_do_join()
1234 if (!bss && !priv->vif->cfg.ibss_joined) { in cw1200_do_join()
1239 mutex_lock(&priv->conf_mutex); in cw1200_do_join()
1244 if (atomic_read(&priv->scan.in_progress)) { in cw1200_do_join()
1249 priv->join_pending = true; in cw1200_do_join()
1256 if (!priv->beacon_int) in cw1200_do_join()
1257 priv->beacon_int = 1; in cw1200_do_join()
1259 join.beacon_interval = priv->beacon_int; in cw1200_do_join()
1262 if (priv->bt_present) { in cw1200_do_join()
1263 if (((priv->conf_listen_interval * 100) % in cw1200_do_join()
1264 priv->beacon_int) == 0) in cw1200_do_join()
1265 priv->listen_interval = in cw1200_do_join()
1266 ((priv->conf_listen_interval * 100) / in cw1200_do_join()
1267 priv->beacon_int); in cw1200_do_join()
1269 priv->listen_interval = in cw1200_do_join()
1270 ((priv->conf_listen_interval * 100) / in cw1200_do_join()
1271 priv->beacon_int + 1); in cw1200_do_join()
1274 if (priv->hw->conf.ps_dtim_period) in cw1200_do_join()
1275 priv->join_dtim_period = priv->hw->conf.ps_dtim_period; in cw1200_do_join()
1276 join.dtim_period = priv->join_dtim_period; in cw1200_do_join()
1278 join.channel_number = priv->channel->hw_value; in cw1200_do_join()
1279 join.band = (priv->channel->band == NL80211_BAND_5GHZ) ? in cw1200_do_join()
1286 join.dtim_period, priv->beacon_int); in cw1200_do_join()
1288 if (!priv->vif->cfg.ibss_joined) { in cw1200_do_join()
1299 if (priv->vif->p2p) { in cw1200_do_join()
1306 if (!priv->vif->cfg.ibss_joined) { in cw1200_do_join()
1314 cw1200_pm_stay_awake(&priv->pm_state, in cw1200_do_join()
1320 wsm_set_block_ack_policy(priv, priv->ba_tx_tid_mask, in cw1200_do_join()
1321 priv->ba_rx_tid_mask); in cw1200_do_join()
1325 priv->join_status = CW1200_JOIN_STATUS_JOINING; in cw1200_do_join()
1326 queue_delayed_work(priv->workqueue, in cw1200_do_join()
1327 &priv->join_timeout, in cw1200_do_join()
1340 cancel_delayed_work_sync(&priv->join_timeout); in cw1200_do_join()
1341 cw1200_update_listening(priv, priv->listening); in cw1200_do_join()
1343 if (queue_work(priv->workqueue, &priv->unjoin_work) <= 0) in cw1200_do_join()
1357 priv->disable_beacon_filter = true; in cw1200_do_join()
1362 mutex_unlock(&priv->conf_mutex); in cw1200_do_join()
1364 cfg80211_put_bss(priv->hw->wiphy, bss); in cw1200_do_join()
1373 if (queue_work(priv->workqueue, &priv->unjoin_work) <= 0) in cw1200_join_timeout()
1383 cancel_delayed_work_sync(&priv->join_timeout); in cw1200_do_unjoin()
1385 mutex_lock(&priv->conf_mutex); in cw1200_do_unjoin()
1386 priv->join_pending = false; in cw1200_do_unjoin()
1388 if (atomic_read(&priv->scan.in_progress)) { in cw1200_do_unjoin()
1389 if (priv->delayed_unjoin) in cw1200_do_unjoin()
1390 wiphy_dbg(priv->hw->wiphy, "Delayed unjoin is already scheduled.\n"); in cw1200_do_unjoin()
1392 priv->delayed_unjoin = true; in cw1200_do_unjoin()
1396 priv->delayed_link_loss = false; in cw1200_do_unjoin()
1398 if (!priv->join_status) in cw1200_do_unjoin()
1401 if (priv->join_status == CW1200_JOIN_STATUS_AP) in cw1200_do_unjoin()
1404 cancel_work_sync(&priv->update_filtering_work); in cw1200_do_unjoin()
1405 cancel_work_sync(&priv->set_beacon_wakeup_period_work); in cw1200_do_unjoin()
1406 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_do_unjoin()
1412 wsm_set_output_power(priv, priv->output_power * 10); in cw1200_do_unjoin()
1413 priv->join_dtim_period = 0; in cw1200_do_unjoin()
1416 cancel_work_sync(&priv->event_handler); in cw1200_do_unjoin()
1417 cw1200_update_listening(priv, priv->listening); in cw1200_do_unjoin()
1423 priv->disable_beacon_filter = false; in cw1200_do_unjoin()
1425 memset(&priv->association_mode, 0, in cw1200_do_unjoin()
1426 sizeof(priv->association_mode)); in cw1200_do_unjoin()
1427 memset(&priv->bss_params, 0, sizeof(priv->bss_params)); in cw1200_do_unjoin()
1428 priv->setbssparams_done = false; in cw1200_do_unjoin()
1429 memset(&priv->firmware_ps_mode, 0, in cw1200_do_unjoin()
1430 sizeof(priv->firmware_ps_mode)); in cw1200_do_unjoin()
1435 mutex_unlock(&priv->conf_mutex); in cw1200_do_unjoin()
1446 ieee80211_connection_loss(priv->vif); in cw1200_unjoin_work()
1462 if (priv->channel) { in cw1200_enable_listening()
1463 start.band = priv->channel->band == NL80211_BAND_5GHZ ? in cw1200_enable_listening()
1465 start.channel_number = priv->channel->hw_value; in cw1200_enable_listening()
1487 if (priv->join_status == CW1200_JOIN_STATUS_PASSIVE) { in cw1200_update_listening()
1489 priv->join_status = CW1200_JOIN_STATUS_MONITOR; in cw1200_update_listening()
1493 if (priv->join_status == CW1200_JOIN_STATUS_MONITOR) { in cw1200_update_listening()
1495 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_update_listening()
1511 if (arg->uapsd_enable[0]) in cw1200_set_uapsd_param()
1514 if (arg->uapsd_enable[1]) in cw1200_set_uapsd_param()
1517 if (arg->uapsd_enable[2]) in cw1200_set_uapsd_param()
1520 if (arg->uapsd_enable[3]) in cw1200_set_uapsd_param()
1523 /* Currently pseudo U-APSD operation is not supported, so setting in cw1200_set_uapsd_param()
1528 priv->uapsd_info.uapsd_flags = cpu_to_le16(uapsd_flags); in cw1200_set_uapsd_param()
1529 priv->uapsd_info.min_auto_trigger_interval = 0; in cw1200_set_uapsd_param()
1530 priv->uapsd_info.max_auto_trigger_interval = 0; in cw1200_set_uapsd_param()
1531 priv->uapsd_info.auto_trigger_step = 0; in cw1200_set_uapsd_param()
1533 ret = wsm_set_uapsd_info(priv, &priv->uapsd_info); in cw1200_set_uapsd_param()
1543 struct cw1200_common *priv = hw->priv; in cw1200_sta_add()
1545 (struct cw1200_sta_priv *)&sta->drv_priv; in cw1200_sta_add()
1549 if (priv->mode != NL80211_IFTYPE_AP) in cw1200_sta_add()
1552 sta_priv->link_id = cw1200_find_link_id(priv, sta->addr); in cw1200_sta_add()
1553 if (WARN_ON(!sta_priv->link_id)) { in cw1200_sta_add()
1554 wiphy_info(priv->hw->wiphy, in cw1200_sta_add()
1556 return -ENOENT; in cw1200_sta_add()
1559 entry = &priv->link_id_db[sta_priv->link_id - 1]; in cw1200_sta_add()
1560 spin_lock_bh(&priv->ps_state_lock); in cw1200_sta_add()
1561 if ((sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) == in cw1200_sta_add()
1563 priv->sta_asleep_mask |= BIT(sta_priv->link_id); in cw1200_sta_add()
1564 entry->status = CW1200_LINK_HARD; in cw1200_sta_add()
1565 while ((skb = skb_dequeue(&entry->rx_queue))) in cw1200_sta_add()
1566 ieee80211_rx_irqsafe(priv->hw, skb); in cw1200_sta_add()
1567 spin_unlock_bh(&priv->ps_state_lock); in cw1200_sta_add()
1574 struct cw1200_common *priv = hw->priv; in cw1200_sta_remove()
1576 (struct cw1200_sta_priv *)&sta->drv_priv; in cw1200_sta_remove()
1579 if (priv->mode != NL80211_IFTYPE_AP || !sta_priv->link_id) in cw1200_sta_remove()
1582 entry = &priv->link_id_db[sta_priv->link_id - 1]; in cw1200_sta_remove()
1583 spin_lock_bh(&priv->ps_state_lock); in cw1200_sta_remove()
1584 entry->status = CW1200_LINK_RESERVE; in cw1200_sta_remove()
1585 entry->timestamp = jiffies; in cw1200_sta_remove()
1587 if (queue_work(priv->workqueue, &priv->link_id_work) <= 0) in cw1200_sta_remove()
1589 spin_unlock_bh(&priv->ps_state_lock); in cw1200_sta_remove()
1590 flush_workqueue(priv->workqueue); in cw1200_sta_remove()
1599 struct cw1200_common *priv = dev->priv; in __cw1200_sta_notify()
1608 bit = priv->link_id_map; in __cw1200_sta_notify()
1609 prev = priv->sta_asleep_mask & bit; in __cw1200_sta_notify()
1614 if (priv->buffered_multicasts && in __cw1200_sta_notify()
1615 !priv->sta_asleep_mask) in __cw1200_sta_notify()
1616 queue_work(priv->workqueue, in __cw1200_sta_notify()
1617 &priv->multicast_start_work); in __cw1200_sta_notify()
1618 priv->sta_asleep_mask |= bit; in __cw1200_sta_notify()
1623 priv->sta_asleep_mask &= ~bit; in __cw1200_sta_notify()
1624 priv->pspoll_mask &= ~bit; in __cw1200_sta_notify()
1625 if (priv->tx_multicast && link_id && in __cw1200_sta_notify()
1626 !priv->sta_asleep_mask) in __cw1200_sta_notify()
1627 queue_work(priv->workqueue, in __cw1200_sta_notify()
1628 &priv->multicast_stop_work); in __cw1200_sta_notify()
1640 struct cw1200_common *priv = dev->priv; in cw1200_sta_notify()
1642 (struct cw1200_sta_priv *)&sta->drv_priv; in cw1200_sta_notify()
1644 spin_lock_bh(&priv->ps_state_lock); in cw1200_sta_notify()
1645 __cw1200_sta_notify(dev, vif, notify_cmd, sta_priv->link_id); in cw1200_sta_notify()
1646 spin_unlock_bh(&priv->ps_state_lock); in cw1200_sta_notify()
1657 link_id, priv->sta_asleep_mask); in cw1200_ps_notify()
1659 __cw1200_sta_notify(priv->hw, priv->vif, in cw1200_ps_notify()
1674 skb = ieee80211_beacon_get_tim(priv->hw, priv->vif, in cw1200_set_tim_impl()
1679 return -ENOENT; in cw1200_set_tim_impl()
1686 skb->data[tim_offset + 2] = 0; in cw1200_set_tim_impl()
1690 skb->data[tim_offset + 4] |= 1; in cw1200_set_tim_impl()
1692 skb->data[tim_offset + 4] &= ~1; in cw1200_set_tim_impl()
1695 update_ie.ies = &skb->data[tim_offset]; in cw1200_set_tim_impl()
1708 (void)cw1200_set_tim_impl(priv, priv->aid0_bit_set); in cw1200_set_tim_work()
1714 struct cw1200_common *priv = dev->priv; in cw1200_set_tim()
1715 queue_work(priv->workqueue, &priv->set_tim_work); in cw1200_set_tim()
1733 mutex_lock(&priv->conf_mutex); in cw1200_set_cts_work()
1734 erp_info = priv->erp_info; in cw1200_set_cts_work()
1735 mutex_unlock(&priv->conf_mutex); in cw1200_set_cts_work()
1756 if (priv->mode == NL80211_IFTYPE_STATION) { in cw1200_set_btcoexinfo()
1767 if (!priv->vif->p2p) { in cw1200_set_btcoexinfo()
1769 if (priv->bss_params.operational_rate_set & ~0xF) { in cw1200_set_btcoexinfo()
1773 priv->bss_params.operational_rate_set & ~0xF)); in cw1200_set_btcoexinfo()
1777 arg.internalTxRate = (__ffs(le32_to_cpu(priv->association_mode.basic_rate_set))); in cw1200_set_btcoexinfo()
1779 arg.nonErpInternalTxRate = (__ffs(le32_to_cpu(priv->association_mode.basic_rate_set))); in cw1200_set_btcoexinfo()
1782 arg.internalTxRate = (__ffs(priv->bss_params.operational_rate_set & ~0xF)); in cw1200_set_btcoexinfo()
1783 arg.nonErpInternalTxRate = (__ffs(priv->bss_params.operational_rate_set & ~0xF)); in cw1200_set_btcoexinfo()
1787 priv->mode, in cw1200_set_btcoexinfo()
1802 struct cw1200_common *priv = dev->priv; in cw1200_bss_info_changed()
1805 mutex_lock(&priv->conf_mutex); in cw1200_bss_info_changed()
1817 vif->cfg.arp_addr_cnt); in cw1200_bss_info_changed()
1822 if (vif->cfg.arp_addr_cnt > 0 && in cw1200_bss_info_changed()
1823 vif->cfg.arp_addr_cnt <= WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES) { in cw1200_bss_info_changed()
1824 for (i = 0; i < vif->cfg.arp_addr_cnt; i++) { in cw1200_bss_info_changed()
1825 filter.ipv4addrs[i] = vif->cfg.arp_addr_list[i]; in cw1200_bss_info_changed()
1845 priv->beacon_int = info->beacon_int; in cw1200_bss_info_changed()
1851 pr_debug("BSS_CHANGED_BEACON_ENABLED (%d)\n", info->enable_beacon); in cw1200_bss_info_changed()
1853 if (priv->enable_beacon != info->enable_beacon) { in cw1200_bss_info_changed()
1854 cw1200_enable_beaconing(priv, info->enable_beacon); in cw1200_bss_info_changed()
1855 priv->enable_beacon = info->enable_beacon; in cw1200_bss_info_changed()
1861 if (vif->cfg.ibss_joined) in cw1200_bss_info_changed()
1863 else if (priv->join_status == CW1200_JOIN_STATUS_AP) in cw1200_bss_info_changed()
1870 priv->wep_default_key_id = -1; in cw1200_bss_info_changed()
1886 if (vif->cfg.assoc) { in cw1200_bss_info_changed()
1887 if (priv->join_status < CW1200_JOIN_STATUS_PRE_STA) { in cw1200_bss_info_changed()
1889 mutex_unlock(&priv->conf_mutex); in cw1200_bss_info_changed()
1891 } else if (priv->join_status == CW1200_JOIN_STATUS_PRE_STA) { in cw1200_bss_info_changed()
1892 priv->join_status = CW1200_JOIN_STATUS_STA; in cw1200_bss_info_changed()
1898 if (vif->cfg.assoc || vif->cfg.ibss_joined) { in cw1200_bss_info_changed()
1902 if (info->dtim_period) in cw1200_bss_info_changed()
1903 priv->join_dtim_period = info->dtim_period; in cw1200_bss_info_changed()
1904 priv->beacon_int = info->beacon_int; in cw1200_bss_info_changed()
1908 if (info->bssid && !vif->cfg.ibss_joined) in cw1200_bss_info_changed()
1909 sta = ieee80211_find_sta(vif, info->bssid); in cw1200_bss_info_changed()
1911 priv->ht_info.ht_cap = sta->deflink.ht_cap; in cw1200_bss_info_changed()
1912 priv->bss_params.operational_rate_set = in cw1200_bss_info_changed()
1914 sta->deflink.supp_rates[priv->channel->band]); in cw1200_bss_info_changed()
1915 priv->ht_info.channel_type = cfg80211_get_chandef_type(&dev->conf.chandef); in cw1200_bss_info_changed()
1916 priv->ht_info.operation_mode = info->ht_operation_mode; in cw1200_bss_info_changed()
1918 memset(&priv->ht_info, 0, in cw1200_bss_info_changed()
1919 sizeof(priv->ht_info)); in cw1200_bss_info_changed()
1920 priv->bss_params.operational_rate_set = -1; in cw1200_bss_info_changed()
1925 if (priv->ht_info.operation_mode & in cw1200_bss_info_changed()
1930 htprot |= cpu_to_le32((priv->ht_info.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION) << 2); in cw1200_bss_info_changed()
1940 priv->association_mode.greenfield = in cw1200_bss_info_changed()
1941 cw1200_ht_greenfield(&priv->ht_info); in cw1200_bss_info_changed()
1942 priv->association_mode.flags = in cw1200_bss_info_changed()
1948 priv->association_mode.preamble = in cw1200_bss_info_changed()
1949 info->use_short_preamble ? in cw1200_bss_info_changed()
1952 priv->association_mode.basic_rate_set = __cpu_to_le32( in cw1200_bss_info_changed()
1954 info->basic_rates)); in cw1200_bss_info_changed()
1955 priv->association_mode.mpdu_start_spacing = in cw1200_bss_info_changed()
1956 cw1200_ht_ampdu_density(&priv->ht_info); in cw1200_bss_info_changed()
1959 cancel_work_sync(&priv->unjoin_work); in cw1200_bss_info_changed()
1961 priv->bss_params.beacon_lost_count = priv->cqm_beacon_loss_count; in cw1200_bss_info_changed()
1962 priv->bss_params.aid = vif->cfg.aid; in cw1200_bss_info_changed()
1964 if (priv->join_dtim_period < 1) in cw1200_bss_info_changed()
1965 priv->join_dtim_period = 1; in cw1200_bss_info_changed()
1968 priv->join_dtim_period, priv->beacon_int); in cw1200_bss_info_changed()
1970 priv->association_mode.preamble, in cw1200_bss_info_changed()
1971 priv->association_mode.greenfield, in cw1200_bss_info_changed()
1972 priv->bss_params.aid, in cw1200_bss_info_changed()
1973 priv->bss_params.operational_rate_set, in cw1200_bss_info_changed()
1974 priv->association_mode.basic_rate_set); in cw1200_bss_info_changed()
1975 wsm_set_association_mode(priv, &priv->association_mode); in cw1200_bss_info_changed()
1977 if (!vif->cfg.ibss_joined) { in cw1200_bss_info_changed()
1979 wsm_set_bss_params(priv, &priv->bss_params); in cw1200_bss_info_changed()
1980 priv->setbssparams_done = true; in cw1200_bss_info_changed()
1981 cw1200_set_beacon_wakeup_period_work(&priv->set_beacon_wakeup_period_work); in cw1200_bss_info_changed()
1982 cw1200_set_pm(priv, &priv->powersave_mode); in cw1200_bss_info_changed()
1984 if (priv->vif->p2p) { in cw1200_bss_info_changed()
1987 &priv->p2p_ps_modeinfo); in cw1200_bss_info_changed()
1989 if (priv->bt_present) in cw1200_bss_info_changed()
1992 memset(&priv->association_mode, 0, in cw1200_bss_info_changed()
1993 sizeof(priv->association_mode)); in cw1200_bss_info_changed()
1994 memset(&priv->bss_params, 0, sizeof(priv->bss_params)); in cw1200_bss_info_changed()
2002 u32 prev_erp_info = priv->erp_info; in cw1200_bss_info_changed()
2003 if (info->use_cts_prot) in cw1200_bss_info_changed()
2004 priv->erp_info |= WLAN_ERP_USE_PROTECTION; in cw1200_bss_info_changed()
2006 priv->erp_info &= ~WLAN_ERP_USE_PROTECTION; in cw1200_bss_info_changed()
2008 if (info->use_short_preamble) in cw1200_bss_info_changed()
2009 priv->erp_info |= WLAN_ERP_BARKER_PREAMBLE; in cw1200_bss_info_changed()
2011 priv->erp_info &= ~WLAN_ERP_BARKER_PREAMBLE; in cw1200_bss_info_changed()
2013 pr_debug("[STA] ERP Protection: %x\n", priv->erp_info); in cw1200_bss_info_changed()
2015 if (prev_erp_info != priv->erp_info) in cw1200_bss_info_changed()
2016 queue_work(priv->workqueue, &priv->set_cts_work); in cw1200_bss_info_changed()
2021 __le32 slot_time = info->use_short_slot ? in cw1200_bss_info_changed()
2033 pr_debug("[CQM] RSSI threshold subscribe: %d +- %d\n", in cw1200_bss_info_changed()
2034 info->cqm_rssi_thold, info->cqm_rssi_hyst); in cw1200_bss_info_changed()
2035 priv->cqm_rssi_thold = info->cqm_rssi_thold; in cw1200_bss_info_changed()
2036 priv->cqm_rssi_hyst = info->cqm_rssi_hyst; in cw1200_bss_info_changed()
2038 if (info->cqm_rssi_thold || info->cqm_rssi_hyst) { in cw1200_bss_info_changed()
2047 * RSSI = RCPI / 2 - 110 in cw1200_bss_info_changed()
2049 if (priv->cqm_use_rssi) { in cw1200_bss_info_changed()
2051 info->cqm_rssi_thold + info->cqm_rssi_hyst; in cw1200_bss_info_changed()
2053 info->cqm_rssi_thold; in cw1200_bss_info_changed()
2056 threshold.upperThreshold = (info->cqm_rssi_thold + info->cqm_rssi_hyst + 110) * 2; in cw1200_bss_info_changed()
2057 threshold.lowerThreshold = (info->cqm_rssi_thold + 110) * 2; in cw1200_bss_info_changed()
2068 if (priv->cqm_use_rssi) in cw1200_bss_info_changed()
2073 mutex_unlock(&priv->conf_mutex); in cw1200_bss_info_changed()
2085 long tmo = priv->join_dtim_period * in cw1200_multicast_start_work()
2086 (priv->beacon_int + 20) * HZ / 1024; in cw1200_multicast_start_work()
2088 cancel_work_sync(&priv->multicast_stop_work); in cw1200_multicast_start_work()
2090 if (!priv->aid0_bit_set) { in cw1200_multicast_start_work()
2093 priv->aid0_bit_set = true; in cw1200_multicast_start_work()
2094 mod_timer(&priv->mcast_timeout, jiffies + tmo); in cw1200_multicast_start_work()
2104 if (priv->aid0_bit_set) { in cw1200_multicast_stop_work()
2105 del_timer_sync(&priv->mcast_timeout); in cw1200_multicast_stop_work()
2107 priv->aid0_bit_set = false; in cw1200_multicast_stop_work()
2117 wiphy_warn(priv->hw->wiphy, in cw1200_mcast_timeout()
2119 spin_lock_bh(&priv->ps_state_lock); in cw1200_mcast_timeout()
2120 priv->tx_multicast = priv->aid0_bit_set && in cw1200_mcast_timeout()
2121 priv->buffered_multicasts; in cw1200_mcast_timeout()
2122 if (priv->tx_multicast) in cw1200_mcast_timeout()
2124 spin_unlock_bh(&priv->ps_state_lock); in cw1200_mcast_timeout()
2129 struct ieee80211_ampdu_params *params) in cw1200_ampdu_action() argument
2138 return -ENOTSUPP; in cw1200_ampdu_action()
2147 arg->stop ? "stop" : "start", in cw1200_suspend_resume()
2148 arg->multicast ? "broadcast" : "unicast"); in cw1200_suspend_resume()
2150 if (arg->multicast) { in cw1200_suspend_resume()
2152 spin_lock_bh(&priv->ps_state_lock); in cw1200_suspend_resume()
2153 if (arg->stop) { in cw1200_suspend_resume()
2154 priv->tx_multicast = false; in cw1200_suspend_resume()
2161 cw1200_pm_stay_awake(&priv->pm_state, in cw1200_suspend_resume()
2162 priv->join_dtim_period * in cw1200_suspend_resume()
2163 (priv->beacon_int + 20) * HZ / 1024); in cw1200_suspend_resume()
2164 priv->tx_multicast = (priv->aid0_bit_set && in cw1200_suspend_resume()
2165 priv->buffered_multicasts); in cw1200_suspend_resume()
2166 if (priv->tx_multicast) { in cw1200_suspend_resume()
2171 spin_unlock_bh(&priv->ps_state_lock); in cw1200_suspend_resume()
2173 del_timer_sync(&priv->mcast_timeout); in cw1200_suspend_resume()
2175 spin_lock_bh(&priv->ps_state_lock); in cw1200_suspend_resume()
2176 cw1200_ps_notify(priv, arg->link_id, arg->stop); in cw1200_suspend_resume()
2177 spin_unlock_bh(&priv->ps_state_lock); in cw1200_suspend_resume()
2178 if (!arg->stop) in cw1200_suspend_resume()
2198 if (priv->mode == NL80211_IFTYPE_STATION || in cw1200_upload_beacon()
2199 priv->mode == NL80211_IFTYPE_MONITOR || in cw1200_upload_beacon()
2200 priv->mode == NL80211_IFTYPE_UNSPECIFIED) in cw1200_upload_beacon()
2203 if (priv->vif->p2p) in cw1200_upload_beacon()
2206 frame.skb = ieee80211_beacon_get_tim(priv->hw, priv->vif, in cw1200_upload_beacon()
2209 return -ENOMEM; in cw1200_upload_beacon()
2217 * and any other beacon-specific IEs in cw1200_upload_beacon()
2219 mgmt = (void *)frame.skb->data; in cw1200_upload_beacon()
2220 mgmt->frame_control = in cw1200_upload_beacon()
2225 if (priv->vif->p2p) { in cw1200_upload_beacon()
2247 frame.skb = ieee80211_pspoll_get(priv->hw, priv->vif); in cw1200_upload_pspoll()
2249 return -ENOMEM; in cw1200_upload_pspoll()
2266 frame.skb = ieee80211_nullfunc_get(priv->hw, priv->vif,-1, false); in cw1200_upload_null()
2268 return -ENOMEM; in cw1200_upload_null()
2286 frame.skb = ieee80211_qosnullfunc_get(priv->hw, priv->vif); in cw1200_upload_qosnull()
2288 return -ENOMEM; in cw1200_upload_qosnull()
2311 struct ieee80211_bss_conf *conf = &priv->vif->bss_conf; in cw1200_start_ap()
2313 .mode = priv->vif->p2p ? in cw1200_start_ap()
2315 .band = (priv->channel->band == NL80211_BAND_5GHZ) ? in cw1200_start_ap()
2317 .channel_number = priv->channel->hw_value, in cw1200_start_ap()
2318 .beacon_interval = conf->beacon_int, in cw1200_start_ap()
2319 .dtim_period = conf->dtim_period, in cw1200_start_ap()
2320 .preamble = conf->use_short_preamble ? in cw1200_start_ap()
2325 conf->basic_rates), in cw1200_start_ap()
2333 if (!conf->hidden_ssid) { in cw1200_start_ap()
2334 start.ssid_len = priv->vif->cfg.ssid_len; in cw1200_start_ap()
2335 memcpy(start.ssid, priv->vif->cfg.ssid, start.ssid_len); in cw1200_start_ap()
2338 priv->beacon_int = conf->beacon_int; in cw1200_start_ap()
2339 priv->join_dtim_period = conf->dtim_period; in cw1200_start_ap()
2341 memset(&priv->link_id_db, 0, sizeof(priv->link_id_db)); in cw1200_start_ap()
2351 if (!ret && priv->vif->p2p) { in cw1200_start_ap()
2353 wsm_set_p2p_ps_modeinfo(priv, &priv->p2p_ps_modeinfo); in cw1200_start_ap()
2357 priv->join_status = CW1200_JOIN_STATUS_AP; in cw1200_start_ap()
2366 struct ieee80211_bss_conf *conf = &priv->vif->bss_conf; in cw1200_update_beaconing()
2372 if (priv->mode == NL80211_IFTYPE_AP) { in cw1200_update_beaconing()
2374 if (priv->join_status != CW1200_JOIN_STATUS_AP || in cw1200_update_beaconing()
2375 priv->beacon_int != conf->beacon_int) { in cw1200_update_beaconing()
2378 if (priv->join_status != CW1200_JOIN_STATUS_PASSIVE) in cw1200_update_beaconing()
2380 priv->join_status = CW1200_JOIN_STATUS_PASSIVE; in cw1200_update_beaconing()
2385 priv->join_status); in cw1200_update_beaconing()