main.c (e9e4e44309f866b115d08ab4a54834008c50a8a4) main.c (283dd11994cde99447a6dac203d96c0800e85e82)
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 1158 unchanged lines hidden (view full) ---

1167
1168 ath_dbg(common, CONFIG,
1169 "macaddr: %pM, bssid: %pM, bssidmask: %pM\n",
1170 common->macaddr, common->curbssid, common->bssidmask);
1171
1172 ath9k_ps_restore(sc);
1173}
1174
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 1158 unchanged lines hidden (view full) ---

1167
1168 ath_dbg(common, CONFIG,
1169 "macaddr: %pM, bssid: %pM, bssidmask: %pM\n",
1170 common->macaddr, common->curbssid, common->bssidmask);
1171
1172 ath9k_ps_restore(sc);
1173}
1174
1175static void ath9k_tpc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
1176{
1177 int *power = (int *)data;
1178
1179 if (*power < vif->bss_conf.txpower)
1180 *power = vif->bss_conf.txpower;
1181}
1182
1183/* Called with sc->mutex held. */
1184void ath9k_set_txpower(struct ath_softc *sc, struct ieee80211_vif *vif)
1185{
1186 int power;
1187 struct ath_hw *ah = sc->sc_ah;
1188 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
1189
1190 ath9k_ps_wakeup(sc);
1191 if (ah->tpc_enabled) {
1192 power = (vif) ? vif->bss_conf.txpower : -1;
1193 ieee80211_iterate_active_interfaces_atomic(
1194 sc->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
1195 ath9k_tpc_vif_iter, &power);
1196 if (power == -1)
1197 power = sc->hw->conf.power_level;
1198 } else {
1199 power = sc->hw->conf.power_level;
1200 }
1201 sc->cur_chan->txpower = 2 * power;
1202 ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
1203 sc->cur_chan->cur_txpower = reg->max_power_level;
1204 ath9k_ps_restore(sc);
1205}
1206
1175static void ath9k_assign_hw_queues(struct ieee80211_hw *hw,
1176 struct ieee80211_vif *vif)
1177{
1178 int i;
1179
1180 if (!ath9k_is_chanctx_enabled())
1181 return;
1182

--- 37 unchanged lines hidden (view full) ---

1220 avp->chanctx = sc->cur_chan;
1221 list_add_tail(&avp->list, &avp->chanctx->vifs);
1222 }
1223
1224 ath9k_calculate_summary_state(sc, avp->chanctx);
1225
1226 ath9k_assign_hw_queues(hw, vif);
1227
1207static void ath9k_assign_hw_queues(struct ieee80211_hw *hw,
1208 struct ieee80211_vif *vif)
1209{
1210 int i;
1211
1212 if (!ath9k_is_chanctx_enabled())
1213 return;
1214

--- 37 unchanged lines hidden (view full) ---

1252 avp->chanctx = sc->cur_chan;
1253 list_add_tail(&avp->list, &avp->chanctx->vifs);
1254 }
1255
1256 ath9k_calculate_summary_state(sc, avp->chanctx);
1257
1258 ath9k_assign_hw_queues(hw, vif);
1259
1260 ath9k_set_txpower(sc, vif);
1261
1228 an->sc = sc;
1229 an->sta = NULL;
1230 an->vif = vif;
1231 an->no_ps_filter = true;
1232 ath_tx_node_init(sc, an);
1233
1234 mutex_unlock(&sc->mutex);
1235 return 0;

--- 24 unchanged lines hidden (view full) ---

1260 vif->p2p = p2p;
1261
1262 if (ath9k_uses_beacons(vif->type))
1263 ath9k_beacon_assign_slot(sc, vif);
1264
1265 ath9k_assign_hw_queues(hw, vif);
1266 ath9k_calculate_summary_state(sc, avp->chanctx);
1267
1262 an->sc = sc;
1263 an->sta = NULL;
1264 an->vif = vif;
1265 an->no_ps_filter = true;
1266 ath_tx_node_init(sc, an);
1267
1268 mutex_unlock(&sc->mutex);
1269 return 0;

--- 24 unchanged lines hidden (view full) ---

1294 vif->p2p = p2p;
1295
1296 if (ath9k_uses_beacons(vif->type))
1297 ath9k_beacon_assign_slot(sc, vif);
1298
1299 ath9k_assign_hw_queues(hw, vif);
1300 ath9k_calculate_summary_state(sc, avp->chanctx);
1301
1302 ath9k_set_txpower(sc, vif);
1303
1268 mutex_unlock(&sc->mutex);
1269 return 0;
1270}
1271
1272static void ath9k_remove_interface(struct ieee80211_hw *hw,
1273 struct ieee80211_vif *vif)
1274{
1275 struct ath_softc *sc = hw->priv;

--- 13 unchanged lines hidden (view full) ---

1289
1290 if (ath9k_uses_beacons(vif->type))
1291 ath9k_beacon_remove_slot(sc, vif);
1292
1293 ath_tx_node_cleanup(sc, &avp->mcast_node);
1294
1295 ath9k_calculate_summary_state(sc, avp->chanctx);
1296
1304 mutex_unlock(&sc->mutex);
1305 return 0;
1306}
1307
1308static void ath9k_remove_interface(struct ieee80211_hw *hw,
1309 struct ieee80211_vif *vif)
1310{
1311 struct ath_softc *sc = hw->priv;

--- 13 unchanged lines hidden (view full) ---

1325
1326 if (ath9k_uses_beacons(vif->type))
1327 ath9k_beacon_remove_slot(sc, vif);
1328
1329 ath_tx_node_cleanup(sc, &avp->mcast_node);
1330
1331 ath9k_calculate_summary_state(sc, avp->chanctx);
1332
1333 ath9k_set_txpower(sc, NULL);
1334
1297 mutex_unlock(&sc->mutex);
1298}
1299
1300static void ath9k_enable_ps(struct ath_softc *sc)
1301{
1302 struct ath_hw *ah = sc->sc_ah;
1303 struct ath_common *common = ath9k_hw_common(ah);
1304

--- 87 unchanged lines hidden (view full) ---

1392 }
1393 }
1394
1395 if (!ath9k_is_chanctx_enabled() && (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
1396 ctx->offchannel = !!(conf->flags & IEEE80211_CONF_OFFCHANNEL);
1397 ath_chanctx_set_channel(sc, ctx, &hw->conf.chandef);
1398 }
1399
1335 mutex_unlock(&sc->mutex);
1336}
1337
1338static void ath9k_enable_ps(struct ath_softc *sc)
1339{
1340 struct ath_hw *ah = sc->sc_ah;
1341 struct ath_common *common = ath9k_hw_common(ah);
1342

--- 87 unchanged lines hidden (view full) ---

1430 }
1431 }
1432
1433 if (!ath9k_is_chanctx_enabled() && (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
1434 ctx->offchannel = !!(conf->flags & IEEE80211_CONF_OFFCHANNEL);
1435 ath_chanctx_set_channel(sc, ctx, &hw->conf.chandef);
1436 }
1437
1400 if (changed & IEEE80211_CONF_CHANGE_POWER) {
1401 ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level);
1402 sc->cur_chan->txpower = 2 * conf->power_level;
1403 ath9k_cmn_update_txpow(ah, sc->cur_chan->cur_txpower,
1404 sc->cur_chan->txpower,
1405 &sc->cur_chan->cur_txpower);
1406 }
1407
1408 mutex_unlock(&sc->mutex);
1409 ath9k_ps_restore(sc);
1410
1411 return 0;
1412}
1413
1414#define SUPPORTED_FILTERS \
1415 (FIF_PROMISC_IN_BSS | \

--- 343 unchanged lines hidden (view full) ---

1759 }
1760
1761 if (changed & BSS_CHANGED_P2P_PS)
1762 ath9k_p2p_bss_info_changed(sc, vif);
1763
1764 if (changed & CHECK_ANI)
1765 ath_check_ani(sc);
1766
1438 mutex_unlock(&sc->mutex);
1439 ath9k_ps_restore(sc);
1440
1441 return 0;
1442}
1443
1444#define SUPPORTED_FILTERS \
1445 (FIF_PROMISC_IN_BSS | \

--- 343 unchanged lines hidden (view full) ---

1789 }
1790
1791 if (changed & BSS_CHANGED_P2P_PS)
1792 ath9k_p2p_bss_info_changed(sc, vif);
1793
1794 if (changed & CHECK_ANI)
1795 ath_check_ani(sc);
1796
1797 if (changed & BSS_CHANGED_TXPOWER) {
1798 ath_dbg(common, CONFIG, "vif %pM power %d dbm power_type %d\n",
1799 vif->addr, bss_conf->txpower, bss_conf->txpower_type);
1800 ath9k_set_txpower(sc, vif);
1801 }
1802
1767 mutex_unlock(&sc->mutex);
1768 ath9k_ps_restore(sc);
1769
1770#undef CHECK_ANI
1771}
1772
1773static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1774{

--- 845 unchanged lines hidden ---
1803 mutex_unlock(&sc->mutex);
1804 ath9k_ps_restore(sc);
1805
1806#undef CHECK_ANI
1807}
1808
1809static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1810{

--- 845 unchanged lines hidden ---