Lines Matching +full:mic +full:- +full:pos

1 /*-
2 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
3 * Copyright (c) 2004-2005 Atheros Communications, Inc.
21 * 3. Neither the names of the above-listed copyright holders nor the names
61 struct ath5k_hw *ah = hw->priv; in ath5k_tx()
64 if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { in ath5k_tx()
69 ath5k_tx_queue(hw, skb, &ah->txqs[qnum], control); in ath5k_tx()
76 struct ath5k_hw *ah = hw->priv; in ath5k_add_interface()
78 struct ath5k_vif *avf = (void *)vif->drv_priv; in ath5k_add_interface()
80 mutex_lock(&ah->lock); in ath5k_add_interface()
82 if ((vif->type == NL80211_IFTYPE_AP || in ath5k_add_interface()
83 vif->type == NL80211_IFTYPE_ADHOC) in ath5k_add_interface()
84 && (ah->num_ap_vifs + ah->num_adhoc_vifs) >= ATH_BCBUF) { in ath5k_add_interface()
85 ret = -ELNRNG; in ath5k_add_interface()
89 /* Don't allow other interfaces if one ad-hoc is configured. in ath5k_add_interface()
90 * TODO: Fix the problems with ad-hoc and multiple other interfaces. in ath5k_add_interface()
91 * We would need to operate the HW in ad-hoc mode to allow TSF updates in ath5k_add_interface()
94 if (ah->num_adhoc_vifs || in ath5k_add_interface()
95 (ah->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) { in ath5k_add_interface()
96 ATH5K_ERR(ah, "Only one single ad-hoc interface is allowed.\n"); in ath5k_add_interface()
97 ret = -ELNRNG; in ath5k_add_interface()
101 switch (vif->type) { in ath5k_add_interface()
106 avf->opmode = vif->type; in ath5k_add_interface()
109 ret = -EOPNOTSUPP; in ath5k_add_interface()
113 ah->nvifs++; in ath5k_add_interface()
114 ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode); in ath5k_add_interface()
117 if ((avf->opmode == NL80211_IFTYPE_AP) || in ath5k_add_interface()
118 (avf->opmode == NL80211_IFTYPE_ADHOC) || in ath5k_add_interface()
119 (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { in ath5k_add_interface()
122 WARN_ON(list_empty(&ah->bcbuf)); in ath5k_add_interface()
123 avf->bbuf = list_first_entry(&ah->bcbuf, struct ath5k_buf, in ath5k_add_interface()
125 list_del(&avf->bbuf->list); in ath5k_add_interface()
127 avf->bslot = 0; in ath5k_add_interface()
129 if (!ah->bslot[slot]) { in ath5k_add_interface()
130 avf->bslot = slot; in ath5k_add_interface()
134 BUG_ON(ah->bslot[avf->bslot] != NULL); in ath5k_add_interface()
135 ah->bslot[avf->bslot] = vif; in ath5k_add_interface()
136 if (avf->opmode == NL80211_IFTYPE_AP) in ath5k_add_interface()
137 ah->num_ap_vifs++; in ath5k_add_interface()
138 else if (avf->opmode == NL80211_IFTYPE_ADHOC) in ath5k_add_interface()
139 ah->num_adhoc_vifs++; in ath5k_add_interface()
140 else if (avf->opmode == NL80211_IFTYPE_MESH_POINT) in ath5k_add_interface()
141 ah->num_mesh_vifs++; in ath5k_add_interface()
147 ath5k_hw_set_lladdr(ah, vif->addr); in ath5k_add_interface()
152 mutex_unlock(&ah->lock); in ath5k_add_interface()
161 struct ath5k_hw *ah = hw->priv; in ath5k_remove_interface()
162 struct ath5k_vif *avf = (void *)vif->drv_priv; in ath5k_remove_interface()
165 mutex_lock(&ah->lock); in ath5k_remove_interface()
166 ah->nvifs--; in ath5k_remove_interface()
168 if (avf->bbuf) { in ath5k_remove_interface()
169 ath5k_txbuf_free_skb(ah, avf->bbuf); in ath5k_remove_interface()
170 list_add_tail(&avf->bbuf->list, &ah->bcbuf); in ath5k_remove_interface()
172 if (ah->bslot[i] == vif) { in ath5k_remove_interface()
173 ah->bslot[i] = NULL; in ath5k_remove_interface()
177 avf->bbuf = NULL; in ath5k_remove_interface()
179 if (avf->opmode == NL80211_IFTYPE_AP) in ath5k_remove_interface()
180 ah->num_ap_vifs--; in ath5k_remove_interface()
181 else if (avf->opmode == NL80211_IFTYPE_ADHOC) in ath5k_remove_interface()
182 ah->num_adhoc_vifs--; in ath5k_remove_interface()
183 else if (avf->opmode == NL80211_IFTYPE_MESH_POINT) in ath5k_remove_interface()
184 ah->num_mesh_vifs--; in ath5k_remove_interface()
187 mutex_unlock(&ah->lock); in ath5k_remove_interface()
197 struct ath5k_hw *ah = hw->priv; in ath5k_config()
198 struct ieee80211_conf *conf = &hw->conf; in ath5k_config()
202 mutex_lock(&ah->lock); in ath5k_config()
205 ret = ath5k_chan_set(ah, &conf->chandef); in ath5k_config()
211 (ah->ah_txpower.txp_requested != conf->power_level)) { in ath5k_config()
212 ah->ah_txpower.txp_requested = conf->power_level; in ath5k_config()
215 ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2)); in ath5k_config()
219 ah->ah_retry_long = conf->long_frame_max_tx_count; in ath5k_config()
220 ah->ah_retry_short = conf->short_frame_max_tx_count; in ath5k_config()
222 for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) in ath5k_config()
243 ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); in ath5k_config()
246 mutex_unlock(&ah->lock); in ath5k_config()
255 struct ath5k_vif *avf = (void *)vif->drv_priv; in ath5k_bss_info_changed()
256 struct ath5k_hw *ah = hw->priv; in ath5k_bss_info_changed()
259 mutex_lock(&ah->lock); in ath5k_bss_info_changed()
263 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); in ath5k_bss_info_changed()
264 common->curaid = 0; in ath5k_bss_info_changed()
269 ah->bintval = bss_conf->beacon_int; in ath5k_bss_info_changed()
274 ah->ah_short_slot = bss_conf->use_short_slot; in ath5k_bss_info_changed()
276 3 * ah->ah_coverage_class; in ath5k_bss_info_changed()
281 avf->assoc = vif->cfg.assoc; in ath5k_bss_info_changed()
282 if (vif->cfg.assoc) in ath5k_bss_info_changed()
283 ah->assoc = vif->cfg.assoc; in ath5k_bss_info_changed()
285 ah->assoc = ath5k_any_vif_assoc(ah); in ath5k_bss_info_changed()
287 if (ah->opmode == NL80211_IFTYPE_STATION) in ath5k_bss_info_changed()
288 ath5k_set_beacon_filter(hw, ah->assoc); in ath5k_bss_info_changed()
289 ath5k_hw_set_ledstate(ah, ah->assoc ? in ath5k_bss_info_changed()
291 if (vif->cfg.assoc) { in ath5k_bss_info_changed()
294 vif->cfg.aid, common->curbssid); in ath5k_bss_info_changed()
295 common->curaid = vif->cfg.aid; in ath5k_bss_info_changed()
302 spin_lock_bh(&ah->block); in ath5k_bss_info_changed()
304 spin_unlock_bh(&ah->block); in ath5k_bss_info_changed()
308 ah->enable_beacon = bss_conf->enable_beacon; in ath5k_bss_info_changed()
314 mutex_unlock(&ah->lock); in ath5k_bss_info_changed()
323 u8 pos; in ath5k_prepare_multicast() local
330 /* calculate XOR of eight 6-bit values */ in ath5k_prepare_multicast()
331 val = get_unaligned_le32(ha->addr + 0); in ath5k_prepare_multicast()
332 pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; in ath5k_prepare_multicast()
333 val = get_unaligned_le32(ha->addr + 3); in ath5k_prepare_multicast()
334 pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; in ath5k_prepare_multicast()
335 pos &= 0x3f; in ath5k_prepare_multicast()
336 mfilt[pos / 32] |= (1 << (pos % 32)); in ath5k_prepare_multicast()
341 * ha->addr[5]); */ in ath5k_prepare_multicast()
360 * - when operating in adhoc mode so the 802.11 layer creates
362 * - when operating in station mode for collecting rssi data when
364 * - when scanning
375 struct ath5k_hw *ah = hw->priv; in ath5k_configure_filter()
379 mutex_lock(&ah->lock); in ath5k_configure_filter()
406 if ((*new_flags & FIF_BCN_PRBRESP_PROMISC) || (ah->nvifs > 1)) in ath5k_configure_filter()
416 /* Additional settings per mode -- this is per ath5k */ in ath5k_configure_filter()
420 switch (ah->opmode) { in ath5k_configure_filter()
433 if (ah->assoc) in ath5k_configure_filter()
444 ah->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in ath5k_configure_filter()
463 ah->filter_flags = rfilt; in ath5k_configure_filter()
465 ah->fif_filter_flags = *new_flags; in ath5k_configure_filter()
467 mutex_unlock(&ah->lock); in ath5k_configure_filter()
476 struct ath5k_hw *ah = hw->priv; in ath5k_set_key()
481 return -EOPNOTSUPP; in ath5k_set_key()
483 if (key->flags & IEEE80211_KEY_FLAG_RX_MGMT) in ath5k_set_key()
484 return -EOPNOTSUPP; in ath5k_set_key()
486 if (vif->type == NL80211_IFTYPE_ADHOC && in ath5k_set_key()
487 (key->cipher == WLAN_CIPHER_SUITE_TKIP || in ath5k_set_key()
488 key->cipher == WLAN_CIPHER_SUITE_CCMP) && in ath5k_set_key()
489 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { in ath5k_set_key()
491 return -EOPNOTSUPP; in ath5k_set_key()
494 switch (key->cipher) { in ath5k_set_key()
500 if (common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM) in ath5k_set_key()
502 return -EOPNOTSUPP; in ath5k_set_key()
504 return -EOPNOTSUPP; in ath5k_set_key()
507 mutex_lock(&ah->lock); in ath5k_set_key()
513 key->hw_key_idx = ret; in ath5k_set_key()
514 /* push IV and Michael MIC generation to stack */ in ath5k_set_key()
515 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in ath5k_set_key()
516 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) in ath5k_set_key()
517 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; in ath5k_set_key()
518 if (key->cipher == WLAN_CIPHER_SUITE_CCMP) in ath5k_set_key()
519 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; in ath5k_set_key()
524 ath_key_delete(common, key->hw_key_idx); in ath5k_set_key()
527 ret = -EINVAL; in ath5k_set_key()
530 mutex_unlock(&ah->lock); in ath5k_set_key()
540 struct ath5k_hw *ah = hw->priv; in ath5k_sw_scan_start()
541 if (!ah->assoc) in ath5k_sw_scan_start()
549 struct ath5k_hw *ah = hw->priv; in ath5k_sw_scan_complete()
550 ath5k_hw_set_ledstate(ah, ah->assoc ? in ath5k_sw_scan_complete()
559 struct ath5k_hw *ah = hw->priv; in ath5k_get_stats()
564 stats->dot11ACKFailureCount = ah->stats.ack_fail; in ath5k_get_stats()
565 stats->dot11RTSFailureCount = ah->stats.rts_fail; in ath5k_get_stats()
566 stats->dot11RTSSuccessCount = ah->stats.rts_ok; in ath5k_get_stats()
567 stats->dot11FCSErrorCount = ah->stats.fcs_error; in ath5k_get_stats()
578 struct ath5k_hw *ah = hw->priv; in ath5k_conf_tx()
582 if (queue >= ah->ah_capabilities.cap_queues.q_tx_num) in ath5k_conf_tx()
585 mutex_lock(&ah->lock); in ath5k_conf_tx()
589 qi.tqi_aifs = params->aifs; in ath5k_conf_tx()
590 qi.tqi_cw_min = params->cw_min; in ath5k_conf_tx()
591 qi.tqi_cw_max = params->cw_max; in ath5k_conf_tx()
592 qi.tqi_burst_time = params->txop * 32; in ath5k_conf_tx()
597 queue, params->aifs, params->cw_min, in ath5k_conf_tx()
598 params->cw_max, params->txop); in ath5k_conf_tx()
603 ret = -EIO; in ath5k_conf_tx()
607 mutex_unlock(&ah->lock); in ath5k_conf_tx()
616 struct ath5k_hw *ah = hw->priv; in ath5k_get_tsf()
625 struct ath5k_hw *ah = hw->priv; in ath5k_set_tsf()
634 struct ath5k_hw *ah = hw->priv; in ath5k_reset_tsf()
640 if (ah->opmode == NL80211_IFTYPE_ADHOC) in ath5k_reset_tsf()
650 struct ath5k_hw *ah = hw->priv; in ath5k_get_survey()
651 struct ieee80211_conf *conf = &hw->conf; in ath5k_get_survey()
653 struct ath_cycle_counters *cc = &common->cc_survey; in ath5k_get_survey()
654 unsigned int div = common->clockrate * 1000; in ath5k_get_survey()
657 return -ENOENT; in ath5k_get_survey()
659 spin_lock_bh(&common->cc_lock); in ath5k_get_survey()
661 if (cc->cycles > 0) { in ath5k_get_survey()
662 ah->survey.time += cc->cycles / div; in ath5k_get_survey()
663 ah->survey.time_busy += cc->rx_busy / div; in ath5k_get_survey()
664 ah->survey.time_rx += cc->rx_frame / div; in ath5k_get_survey()
665 ah->survey.time_tx += cc->tx_frame / div; in ath5k_get_survey()
668 spin_unlock_bh(&common->cc_lock); in ath5k_get_survey()
670 memcpy(survey, &ah->survey, sizeof(*survey)); in ath5k_get_survey()
672 survey->channel = conf->chandef.chan; in ath5k_get_survey()
673 survey->noise = ah->ah_noise_floor; in ath5k_get_survey()
674 survey->filled = SURVEY_INFO_NOISE_DBM | in ath5k_get_survey()
686 * ath5k_set_coverage_class - Set IEEE 802.11 coverage class
698 struct ath5k_hw *ah = hw->priv; in ath5k_set_coverage_class()
700 mutex_lock(&ah->lock); in ath5k_set_coverage_class()
702 mutex_unlock(&ah->lock); in ath5k_set_coverage_class()
709 struct ath5k_hw *ah = hw->priv; in ath5k_set_antenna()
718 return -EINVAL; in ath5k_set_antenna()
726 struct ath5k_hw *ah = hw->priv; in ath5k_get_antenna()
728 switch (ah->ah_ant_mode) { in ath5k_get_antenna()
743 struct ath5k_hw *ah = hw->priv; in ath5k_get_ringparam()
745 *tx = ah->txqs[AR5K_TX_QUEUE_ID_DATA_MIN].txq_max; in ath5k_get_ringparam()
754 struct ath5k_hw *ah = hw->priv; in ath5k_set_ringparam()
759 return -EINVAL; in ath5k_set_ringparam()
763 return -EINVAL; in ath5k_set_ringparam()
765 for (qnum = 0; qnum < ARRAY_SIZE(ah->txqs); qnum++) { in ath5k_set_ringparam()
766 if (!ah->txqs[qnum].setup) in ath5k_set_ringparam()
768 if (ah->txqs[qnum].qnum < AR5K_TX_QUEUE_ID_DATA_MIN || in ath5k_set_ringparam()
769 ah->txqs[qnum].qnum > AR5K_TX_QUEUE_ID_DATA_MAX) in ath5k_set_ringparam()
772 ah->txqs[qnum].txq_max = tx; in ath5k_set_ringparam()
773 if (ah->txqs[qnum].txq_len >= ah->txqs[qnum].txq_max) in ath5k_set_ringparam()
774 ieee80211_stop_queue(hw, ah->txqs[qnum].qnum); in ath5k_set_ringparam()