119 if (bss_conf->
assoc) {
131 ath9k_htc_vif_iter, priv);
142 static void ath9k_htc_bssid_iter(
void *data,
u8 *mac,
struct ieee80211_vif *vif)
165 ath9k_htc_bssid_iter(&iter_data, vif->
addr, vif);
190 struct ath_common *common = ath9k_hw_common(ah);
217 "Unable to reset device (%u Mhz) reset status %d\n",
227 mode = ath9k_htc_get_curmode(priv, ah->
curchan);
233 ath9k_htc_vif_reconfig(priv);
248 struct ath_common *common = ath9k_hw_common(ah);
275 "(%u MHz) -> (%u MHz), HT: %d, HT40: %d fastcc: %d\n",
276 priv->
ah->curchan->channel,
277 channel->
center_freq, conf_is_ht(conf), conf_is_ht40(conf),
286 "Unable to reset channel (%u Mhz) reset status %d\n",
300 mode = ath9k_htc_get_curmode(priv, hchan);
314 ath9k_htc_vif_reconfig(priv);
331 static void __ath9k_htc_remove_monitor_interface(
struct ath9k_htc_priv *priv)
343 ath_err(common,
"Unable to remove monitor interface at idx: %d\n",
351 static int ath9k_htc_add_monitor_interface(
struct ath9k_htc_priv *priv)
356 int ret = 0, sta_idx;
389 priv->
vif_slot |= (1 << hvif.index);
408 tsta.sta_index = sta_idx;
409 tsta.vif_index = hvif.index;
414 ath_err(common,
"Unable to add station entry for monitor mode\n");
421 priv->
ah->is_monitoring =
true;
424 "Attached a monitor interface at idx: %d, sta idx: %d\n",
433 __ath9k_htc_remove_monitor_interface(priv);
435 ath_dbg(common, FATAL,
"Unable to attach a monitor interface\n");
440 static int ath9k_htc_remove_monitor_interface(
struct ath9k_htc_priv *priv)
446 __ath9k_htc_remove_monitor_interface(priv);
452 ath_err(common,
"Unable to remove station entry for monitor mode\n");
458 priv->
ah->is_monitoring =
false;
461 "Removed a monitor interface at idx: %d, sta idx: %d\n",
492 ista->index = sta_idx;
495 sta->
ht_cap.ampdu_factor);
503 tsta.sta_index = sta_idx;
504 tsta.vif_index = avp->
index;
510 "Unable to add station entry for: %pM\n",
517 "Added a station entry for: %pM (idx: %d)\n",
518 sta->
addr, tsta.sta_index);
521 "Added a station entry for VIF %d (idx: %d)\n",
522 avp->
index, tsta.sta_index);
545 sta_idx = ista->index;
554 "Unable to remove station entry for: %pM\n",
561 "Removed a station entry for: %pM (idx: %d)\n",
565 "Removed a station entry for VIF %d (idx: %d)\n",
566 avp->
index, sta_idx);
603 sband = priv->
hw->wiphy->bands[priv->
hw->conf.channel->band];
605 for (i = 0,
j = 0; i < sband->n_bitrates; i++) {
607 trate->
rates.legacy_rates.rs_rates[
j]
608 = (sband->bitrates[
i].bitrate * 2) / 10;
612 trate->
rates.legacy_rates.rs_nrates =
j;
614 if (sta->
ht_cap.ht_supported) {
615 for (i = 0,
j = 0; i < 77; i++) {
616 if (sta->
ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
617 trate->
rates.ht_rates.rs_rates[
j++] =
i;
621 trate->
rates.ht_rates.rs_nrates =
j;
624 if (sta->
ht_cap.mcs.rx_mask[1])
627 (conf_is_ht40(&priv->
hw->conf)))
629 if (conf_is_ht40(&priv->
hw->conf) &&
632 else if (conf_is_ht20(&priv->
hw->conf) &&
652 "Unable to initialize Rate information on target\n");
666 ath9k_htc_setup_rate(priv, sta, &trate);
667 ret = ath9k_htc_send_rate_cmd(priv, &trate);
670 "Updated target sta: %pM, rate caps: 0x%X\n",
691 ath9k_htc_setup_rate(priv, sta, &trate);
694 ret = ath9k_htc_send_rate_cmd(priv, &trate);
697 "Updated target sta: %pM, rate caps: 0x%X\n",
719 aggr.sta_index = ista->
index;
720 aggr.tidno = tid & 0xf;
726 "Unable to %s TX aggregation for (%pM, %d)\n",
727 (aggr.aggr_enable) ?
"start" :
"stop", sta->
addr, tid);
730 "%s TX aggregation for (%pM, %d)\n",
731 (aggr.aggr_enable) ?
"Starting" :
"Stopping",
734 spin_lock_bh(&priv->
tx.tx_lock);
736 spin_unlock_bh(&priv->
tx.tx_lock);
771 struct ath_common *common = ath9k_hw_common(ah);
772 bool longcal =
false;
773 bool shortcal =
false;
774 bool aniflag =
false;
776 u32 cal_interval, short_cal_interval;
793 if (!common->
ani.caldone) {
794 if ((timestamp - common->
ani.shortcal_timer) >=
795 short_cal_interval) {
802 if ((timestamp - common->
ani.resetcal_timer) >=
805 if (common->
ani.caldone)
811 if (ah->
config.enable_ani &&
818 if (longcal || shortcal || aniflag) {
827 if (longcal || shortcal)
828 common->
ani.caldone =
829 ath9k_hw_calibrate(ah, ah->
curchan,
842 if (ah->
config.enable_ani)
844 if (!common->
ani.caldone)
845 cal_interval =
min(cal_interval, (
u32)short_cal_interval);
868 padsize = padpos & 3;
869 if (padsize && skb->
len > padpos) {
870 if (skb_headroom(skb) <
padsize) {
871 ath_dbg(common, XMIT,
"No room for padding\n");
880 ath_dbg(common, XMIT,
"No free TX slot\n");
886 ath_dbg(common, XMIT,
"Tx failed\n");
904 struct ath_common *common = ath9k_hw_common(ah);
915 "Starting driver with initial channel: %d MHz\n",
928 "Unable to reset hardware; reset status %d (freq %u MHz)\n",
937 mode = ath9k_htc_get_curmode(priv, init_channel);
948 "Failed to update capability in target\n");
953 spin_lock_bh(&priv->
tx.tx_lock);
955 spin_unlock_bh(&priv->
tx.tx_lock);
962 ath9k_htc_start_btcoex(priv);
973 struct ath_common *common = ath9k_hw_common(ah);
1003 #ifdef CONFIG_MAC80211_LEDS
1010 ath9k_htc_stop_btcoex(priv);
1013 if (priv->
ah->is_monitoring)
1014 ath9k_htc_remove_monitor_interface(priv);
1027 static int ath9k_htc_add_interface(
struct ieee80211_hw *hw,
1046 ath_err(common,
"IBSS coexistence with other modes is not allowed\n");
1054 ath_err(common,
"Max. number of beaconing interfaces reached\n");
1063 switch (vif->
type) {
1075 "Interface type %d not yet supported\n", vif->
type);
1091 ret = ath9k_htc_add_station(priv, vif,
NULL);
1097 ath9k_htc_set_bssid_mask(priv, vif);
1108 ath9k_htc_set_opmode(priv);
1116 ath_dbg(common,
CONFIG,
"Attach a VIF of type: %d at idx: %d\n",
1126 static void ath9k_htc_remove_interface(
struct ieee80211_hw *hw,
1141 hvif.index = avp->
index;
1144 ath_err(common,
"Unable to remove interface at idx: %d\n",
1150 ath9k_htc_remove_station(priv, vif,
NULL);
1158 ath9k_htc_set_opmode(priv);
1160 ath9k_htc_set_bssid_mask(priv, vif);
1168 ath9k_htc_vif_iter, priv);
1184 bool chip_reset =
false;
1206 !priv->
ah->is_monitoring)
1207 ath9k_htc_add_monitor_interface(priv);
1208 else if (priv->
ah->is_monitoring)
1209 ath9k_htc_remove_monitor_interface(priv);
1221 hw->
conf.channel_type);
1223 if (ath9k_htc_set_channel(priv, hw, &priv->
ah->channels[pos]) < 0) {
1224 ath_err(common,
"Unable to set channel\n");
1254 #define SUPPORTED_FILTERS \
1255 (FIF_PROMISC_IN_BSS | \
1260 FIF_BCN_PRBRESP_PROMISC | \
1264 static void ath9k_htc_configure_filter(
struct ieee80211_hw *hw,
1265 unsigned int changed_flags,
1266 unsigned int *total_flags,
1278 "Unable to configure filter on invalid state\n");
1288 ath_dbg(ath9k_hw_common(priv->
ah),
CONFIG,
"Set HW RX filter: 0x%x\n",
1304 ret = ath9k_htc_add_station(priv, vif, sta);
1306 ath9k_htc_init_rate(priv, sta);
1313 static int ath9k_htc_sta_remove(
struct ieee80211_hw *hw,
1325 ret = ath9k_htc_remove_station(priv, vif, sta);
1332 static void ath9k_htc_sta_rc_update(
struct ieee80211_hw *hw,
1345 ath9k_htc_setup_rate(priv, sta, &trate);
1346 if (!ath9k_htc_send_rate_cmd(priv, &trate))
1348 "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
1352 "Unable to update supported rates for sta: %pM\n",
1377 qi.tqi_aifs = params->
aifs;
1378 qi.tqi_cwmin = params->
cw_min;
1379 qi.tqi_cwmax = params->
cw_max;
1380 qi.tqi_burstTime = params->
txop * 32;
1385 "Configure tx [queue/hwq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
1391 ath_err(common,
"TXQ Update failed\n");
1446 if (priv->
ah->sw_mgmt_crypto &&
1474 static void ath9k_htc_bss_iter(
void *data,
u8 *mac,
struct ieee80211_vif *vif)
1486 static void ath9k_htc_choose_set_bssid(
struct ath9k_htc_priv *priv)
1490 ath9k_htc_bss_iter, priv);
1491 ath9k_htc_set_bssid(priv);
1495 static void ath9k_htc_bss_info_changed(
struct ieee80211_hw *hw,
1502 struct ath_common *common = ath9k_hw_common(ah);
1515 ath9k_htc_choose_set_bssid(priv);
1527 ath9k_htc_set_bssid(priv);
1539 if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->
enable_beacon) {
1546 "Beacon disabled for BSS: %pM\n",
1558 (priv->
nvifs == 1) &&
1564 "Beacon interval changed for BSS: %pM\n",
1579 ath9k_htc_update_rate(priv, vif, bss_conf);
1612 static void ath9k_htc_reset_tsf(
struct ieee80211_hw *hw,
1624 static int ath9k_htc_ampdu_action(
struct ieee80211_hw *hw,
1643 ret = ath9k_htc_tx_aggr_oper(priv, vif, sta, action, tid);
1648 ath9k_htc_tx_aggr_oper(priv, vif, sta, action, tid);
1653 spin_lock_bh(&priv->
tx.tx_lock);
1655 spin_unlock_bh(&priv->
tx.tx_lock);
1658 ath_err(ath9k_hw_common(priv->
ah),
"Unknown AMPDU action\n");
1667 static void ath9k_htc_sw_scan_start(
struct ieee80211_hw *hw)
1680 static void ath9k_htc_sw_scan_complete(
struct ieee80211_hw *hw)
1689 ath9k_htc_vif_reconfig(priv);
1699 static void ath9k_htc_set_coverage_class(
struct ieee80211_hw *hw,
1717 static int ath9k_htc_set_bitrate_mask(
struct ieee80211_hw *hw,
1730 tmask.vif_index = avp->
index;
1737 "Unable to set 2G rate mask for "
1738 "interface at idx: %d\n", avp->
index);
1748 "Unable to set 5G rate mask for "
1749 "interface at idx: %d\n", avp->
index);
1761 static int ath9k_htc_get_stats(
struct ieee80211_hw *hw,
1778 .start = ath9k_htc_start,
1779 .stop = ath9k_htc_stop,
1780 .add_interface = ath9k_htc_add_interface,
1781 .remove_interface = ath9k_htc_remove_interface,
1782 .config = ath9k_htc_config,
1783 .configure_filter = ath9k_htc_configure_filter,
1784 .sta_add = ath9k_htc_sta_add,
1785 .sta_remove = ath9k_htc_sta_remove,
1786 .conf_tx = ath9k_htc_conf_tx,
1787 .sta_rc_update = ath9k_htc_sta_rc_update,
1788 .bss_info_changed = ath9k_htc_bss_info_changed,
1789 .set_key = ath9k_htc_set_key,
1790 .get_tsf = ath9k_htc_get_tsf,
1791 .set_tsf = ath9k_htc_set_tsf,
1792 .reset_tsf = ath9k_htc_reset_tsf,
1793 .ampdu_action = ath9k_htc_ampdu_action,
1794 .sw_scan_start = ath9k_htc_sw_scan_start,
1795 .sw_scan_complete = ath9k_htc_sw_scan_complete,
1796 .set_rts_threshold = ath9k_htc_set_rts_threshold,
1798 .set_coverage_class = ath9k_htc_set_coverage_class,
1799 .set_bitrate_mask = ath9k_htc_set_bitrate_mask,
1800 .get_stats = ath9k_htc_get_stats,