mac80211.c (de8a334f215c5a5c5bb070df4325af824d7eaaf1) mac80211.c (e119e740b1899169a19cf3cd43993a7d88c63bc6)
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2/*
3 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
6 */
7#include <linux/kernel.h>
8#include <linux/slab.h>

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

103struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
104 const char *alpha2,
105 enum iwl_mcc_source src_id,
106 bool *changed)
107{
108 struct ieee80211_regdomain *regd = NULL;
109 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
110 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2/*
3 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
6 */
7#include <linux/kernel.h>
8#include <linux/slab.h>

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

103struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
104 const char *alpha2,
105 enum iwl_mcc_source src_id,
106 bool *changed)
107{
108 struct ieee80211_regdomain *regd = NULL;
109 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
110 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
111 struct iwl_mcc_update_resp *resp;
111 struct iwl_mcc_update_resp_v8 *resp;
112 u8 resp_ver;
113
114 IWL_DEBUG_LAR(mvm, "Getting regdomain data for %s from FW\n", alpha2);
115
116 lockdep_assert_held(&mvm->mutex);
117
118 resp = iwl_mvm_update_mcc(mvm, alpha2, src_id);
119 if (IS_ERR_OR_NULL(resp)) {

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

133 MCC_UPDATE_CMD, 0);
134 IWL_DEBUG_LAR(mvm, "MCC update response version: %d\n", resp_ver);
135
136 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg,
137 __le32_to_cpu(resp->n_channels),
138 resp->channels,
139 __le16_to_cpu(resp->mcc),
140 __le16_to_cpu(resp->geo_info),
112 u8 resp_ver;
113
114 IWL_DEBUG_LAR(mvm, "Getting regdomain data for %s from FW\n", alpha2);
115
116 lockdep_assert_held(&mvm->mutex);
117
118 resp = iwl_mvm_update_mcc(mvm, alpha2, src_id);
119 if (IS_ERR_OR_NULL(resp)) {

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

133 MCC_UPDATE_CMD, 0);
134 IWL_DEBUG_LAR(mvm, "MCC update response version: %d\n", resp_ver);
135
136 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg,
137 __le32_to_cpu(resp->n_channels),
138 resp->channels,
139 __le16_to_cpu(resp->mcc),
140 __le16_to_cpu(resp->geo_info),
141 __le16_to_cpu(resp->cap), resp_ver);
141 le32_to_cpu(resp->cap), resp_ver);
142 /* Store the return source id */
143 src_id = resp->source_id;
144 if (IS_ERR_OR_NULL(regd)) {
145 IWL_DEBUG_LAR(mvm, "Could not get parse update from FW %d\n",
146 PTR_ERR_OR_ZERO(regd));
147 goto out;
148 }
149

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

240 WLAN_EXT_CAPA8_MAX_MSDU_IN_AMSDU_LSB,
241 [8] = WLAN_EXT_CAPA9_MAX_MSDU_IN_AMSDU_MSB,
242 [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
243};
244
245/* Additional interface types for which extended capabilities are
246 * specified separately
247 */
142 /* Store the return source id */
143 src_id = resp->source_id;
144 if (IS_ERR_OR_NULL(regd)) {
145 IWL_DEBUG_LAR(mvm, "Could not get parse update from FW %d\n",
146 PTR_ERR_OR_ZERO(regd));
147 goto out;
148 }
149

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

240 WLAN_EXT_CAPA8_MAX_MSDU_IN_AMSDU_LSB,
241 [8] = WLAN_EXT_CAPA9_MAX_MSDU_IN_AMSDU_MSB,
242 [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
243};
244
245/* Additional interface types for which extended capabilities are
246 * specified separately
247 */
248
249#define IWL_MVM_EMLSR_CAPA (IEEE80211_EML_CAP_EMLSR_SUPP | \
250 IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_32US << \
251 __bf_shf(IEEE80211_EML_CAP_EMLSR_PADDING_DELAY) | \
252 IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_64US << \
253 __bf_shf(IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY))
254
248static const struct wiphy_iftype_ext_capab add_iftypes_ext_capa[] = {
249 {
250 .iftype = NL80211_IFTYPE_STATION,
251 .extended_capabilities = he_if_types_ext_capa_sta,
252 .extended_capabilities_mask = he_if_types_ext_capa_sta,
253 .extended_capabilities_len = sizeof(he_if_types_ext_capa_sta),
255static const struct wiphy_iftype_ext_capab add_iftypes_ext_capa[] = {
256 {
257 .iftype = NL80211_IFTYPE_STATION,
258 .extended_capabilities = he_if_types_ext_capa_sta,
259 .extended_capabilities_mask = he_if_types_ext_capa_sta,
260 .extended_capabilities_len = sizeof(he_if_types_ext_capa_sta),
261 /* relevant only if EHT is supported */
262 .eml_capabilities = IWL_MVM_EMLSR_CAPA,
254 },
255 {
256 .iftype = NL80211_IFTYPE_STATION,
257 .extended_capabilities = tm_if_types_ext_capa_sta,
258 .extended_capabilities_mask = tm_if_types_ext_capa_sta,
259 .extended_capabilities_len = sizeof(tm_if_types_ext_capa_sta),
260 /* relevant only if EHT is supported */
263 },
264 {
265 .iftype = NL80211_IFTYPE_STATION,
266 .extended_capabilities = tm_if_types_ext_capa_sta,
267 .extended_capabilities_mask = tm_if_types_ext_capa_sta,
268 .extended_capabilities_len = sizeof(tm_if_types_ext_capa_sta),
269 /* relevant only if EHT is supported */
261 .eml_capabilities = IEEE80211_EML_CAP_EMLSR_SUPP,
270 .eml_capabilities = IWL_MVM_EMLSR_CAPA,
262 },
263};
264
265int iwl_mvm_op_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
266{
267 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
268 *tx_ant = iwl_mvm_get_valid_tx_ant(mvm);
269 *rx_ant = iwl_mvm_get_valid_rx_ant(mvm);

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

1024
1025 memset(&mvmvif->bf_data, 0, sizeof(mvmvif->bf_data));
1026
1027 for_each_mvm_vif_valid_link(mvmvif, link_id) {
1028 mvmvif->link[link_id]->ap_sta_id = IWL_MVM_INVALID_STA;
1029 mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID;
1030 mvmvif->link[link_id]->phy_ctxt = NULL;
1031 mvmvif->link[link_id]->active = 0;
271 },
272};
273
274int iwl_mvm_op_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
275{
276 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
277 *tx_ant = iwl_mvm_get_valid_tx_ant(mvm);
278 *rx_ant = iwl_mvm_get_valid_rx_ant(mvm);

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

1033
1034 memset(&mvmvif->bf_data, 0, sizeof(mvmvif->bf_data));
1035
1036 for_each_mvm_vif_valid_link(mvmvif, link_id) {
1037 mvmvif->link[link_id]->ap_sta_id = IWL_MVM_INVALID_STA;
1038 mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID;
1039 mvmvif->link[link_id]->phy_ctxt = NULL;
1040 mvmvif->link[link_id]->active = 0;
1041 mvmvif->link[link_id]->igtk = NULL;
1032 }
1033
1034 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data,
1035 lockdep_is_held(&mvm->mutex));
1036 if (probe_data)
1037 kfree_rcu(probe_data, rcu_head);
1038 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL);
1039}

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

1228
1229 /* firmware counters are obviously reset now, but we shouldn't
1230 * partially track so also clear the fw_reset_accu counters.
1231 */
1232 memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats));
1233
1234 /* async_handlers_wk is now blocked */
1235
1042 }
1043
1044 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data,
1045 lockdep_is_held(&mvm->mutex));
1046 if (probe_data)
1047 kfree_rcu(probe_data, rcu_head);
1048 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL);
1049}

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

1238
1239 /* firmware counters are obviously reset now, but we shouldn't
1240 * partially track so also clear the fw_reset_accu counters.
1241 */
1242 memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats));
1243
1244 /* async_handlers_wk is now blocked */
1245
1236 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12)
1246 if (!iwl_mvm_has_new_station_api(mvm->fw))
1237 iwl_mvm_rm_aux_sta(mvm);
1238
1239 iwl_mvm_stop_device(mvm);
1240
1241 iwl_mvm_async_handlers_purge(mvm);
1242 /* async_handlers_list is empty and will stay empty: HW is stopped */
1243
1244 /*

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

1473 /* data is bw wide so the start is half the width */
1474 data_start = chandef->center_freq1 - bw / 2;
1475 /* control is 20Mhz width */
1476 control_start = chandef->chan->center_freq - 10;
1477
1478 return (control_start - data_start) / 80;
1479}
1480
1247 iwl_mvm_rm_aux_sta(mvm);
1248
1249 iwl_mvm_stop_device(mvm);
1250
1251 iwl_mvm_async_handlers_purge(mvm);
1252 /* async_handlers_list is empty and will stay empty: HW is stopped */
1253
1254 /*

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

1483 /* data is bw wide so the start is half the width */
1484 data_start = chandef->center_freq1 - bw / 2;
1485 /* control is 20Mhz width */
1486 control_start = chandef->chan->center_freq - 10;
1487
1488 return (control_start - data_start) / 80;
1489}
1490
1481/*
1482 * Returns true if addding the interface is done
1483 * (either with success or failure)
1484 *
1485 * FIXME: remove this again and merge it in
1486 */
1487static bool iwl_mvm_mac_add_interface_common(struct iwl_mvm *mvm,
1488 struct ieee80211_hw *hw,
1489 struct ieee80211_vif *vif,
1490 int *ret)
1491static int iwl_mvm_alloc_bcast_mcast_sta(struct iwl_mvm *mvm,
1492 struct ieee80211_vif *vif)
1491{
1492 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1493{
1494 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1495 int ret;
1493
1494 lockdep_assert_held(&mvm->mutex);
1495
1496
1497 lockdep_assert_held(&mvm->mutex);
1498
1499 ret = iwl_mvm_alloc_bcast_sta(mvm, vif);
1500 if (ret) {
1501 IWL_ERR(mvm, "Failed to allocate bcast sta\n");
1502 return ret;
1503 }
1504
1505 /* Only queue for this station is the mcast queue,
1506 * which shouldn't be in TFD mask anyway
1507 */
1508 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->deflink.mcast_sta, 0,
1509 vif->type,
1510 IWL_STA_MULTICAST);
1511}
1512
1513static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
1514 struct ieee80211_vif *vif)
1515{
1516 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1517 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1518 int ret;
1519
1520 mutex_lock(&mvm->mutex);
1521
1496 mvmvif->mvm = mvm;
1497
1498 /* the first link always points to the default one */
1499 mvmvif->link[0] = &mvmvif->deflink;
1500
1501 /*
1502 * Not much to do here. The stack will not allow interface
1503 * types or combinations that we didn't advertise, so we
1504 * don't really have to check the types.
1505 */
1506
1507 /* make sure that beacon statistics don't go backwards with FW reset */
1508 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
1509 mvmvif->deflink.beacon_stats.accu_num_beacons +=
1510 mvmvif->deflink.beacon_stats.num_beacons;
1511
1512 /* Allocate resources for the MAC context, and add it to the fw */
1522 mvmvif->mvm = mvm;
1523
1524 /* the first link always points to the default one */
1525 mvmvif->link[0] = &mvmvif->deflink;
1526
1527 /*
1528 * Not much to do here. The stack will not allow interface
1529 * types or combinations that we didn't advertise, so we
1530 * don't really have to check the types.
1531 */
1532
1533 /* make sure that beacon statistics don't go backwards with FW reset */
1534 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
1535 mvmvif->deflink.beacon_stats.accu_num_beacons +=
1536 mvmvif->deflink.beacon_stats.num_beacons;
1537
1538 /* Allocate resources for the MAC context, and add it to the fw */
1513 *ret = iwl_mvm_mac_ctxt_init(mvm, vif);
1514 if (*ret)
1515 return true;
1539 ret = iwl_mvm_mac_ctxt_init(mvm, vif);
1540 if (ret)
1541 goto out;
1516
1517 rcu_assign_pointer(mvm->vif_id_to_mac[mvmvif->id], vif);
1518
1542
1543 rcu_assign_pointer(mvm->vif_id_to_mac[mvmvif->id], vif);
1544
1545 /* Currently not much to do for NAN */
1546 if (vif->type == NL80211_IFTYPE_NAN) {
1547 ret = 0;
1548 goto out;
1549 }
1550
1519 /*
1520 * The AP binding flow can be done only after the beacon
1521 * template is configured (which happens only in the mac80211
1522 * start_ap() flow), and adding the broadcast station can happen
1523 * only after the binding.
1524 * In addition, since modifying the MAC before adding a bcast
1525 * station is not allowed by the FW, delay the adding of MAC context to
1526 * the point where we can also add the bcast station.
1527 * In short: there's not much we can do at this point, other than
1528 * allocating resources :)
1529 */
1530 if (vif->type == NL80211_IFTYPE_AP ||
1531 vif->type == NL80211_IFTYPE_ADHOC) {
1532 iwl_mvm_vif_dbgfs_register(mvm, vif);
1551 /*
1552 * The AP binding flow can be done only after the beacon
1553 * template is configured (which happens only in the mac80211
1554 * start_ap() flow), and adding the broadcast station can happen
1555 * only after the binding.
1556 * In addition, since modifying the MAC before adding a bcast
1557 * station is not allowed by the FW, delay the adding of MAC context to
1558 * the point where we can also add the bcast station.
1559 * In short: there's not much we can do at this point, other than
1560 * allocating resources :)
1561 */
1562 if (vif->type == NL80211_IFTYPE_AP ||
1563 vif->type == NL80211_IFTYPE_ADHOC) {
1564 iwl_mvm_vif_dbgfs_register(mvm, vif);
1533 return true;
1565 ret = 0;
1566 goto out;
1534 }
1535
1536 mvmvif->features |= hw->netdev_features;
1537
1567 }
1568
1569 mvmvif->features |= hw->netdev_features;
1570
1538 return false;
1539}
1540
1541static int iwl_mvm_alloc_bcast_mcast_sta(struct iwl_mvm *mvm,
1542 struct ieee80211_vif *vif)
1543{
1544 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1545 int ret;
1546
1547 lockdep_assert_held(&mvm->mutex);
1548
1549 ret = iwl_mvm_alloc_bcast_sta(mvm, vif);
1550 if (ret) {
1551 IWL_ERR(mvm, "Failed to allocate bcast sta\n");
1552 return ret;
1553 }
1554
1555 /*
1556 * Only queue for this station is the mcast queue,
1557 * which shouldn't be in TFD mask anyway
1558 */
1559 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->deflink.mcast_sta, 0,
1560 vif->type,
1561 IWL_STA_MULTICAST);
1562}
1563
1564static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
1565 struct ieee80211_vif *vif)
1566{
1567 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1568 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1569 int ret;
1570
1571 mutex_lock(&mvm->mutex);
1572
1573 /* Common for MLD and non-MLD API */
1574 if (iwl_mvm_mac_add_interface_common(mvm, hw, vif, &ret))
1575 goto out;
1576
1577 ret = iwl_mvm_mac_ctxt_add(mvm, vif);
1578 if (ret)
1579 goto out_unlock;
1580
1581 ret = iwl_mvm_power_update_mac(mvm);
1582 if (ret)
1583 goto out_remove_mac;
1584

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

2241 return ret;
2242}
2243
2244/*
2245 * This function sets the MU EDCA parameters ans returns whether MU EDCA
2246 * is enabled or not
2247 */
2248bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm,
1571 ret = iwl_mvm_mac_ctxt_add(mvm, vif);
1572 if (ret)
1573 goto out_unlock;
1574
1575 ret = iwl_mvm_power_update_mac(mvm);
1576 if (ret)
1577 goto out_remove_mac;
1578

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

2235 return ret;
2236}
2237
2238/*
2239 * This function sets the MU EDCA parameters ans returns whether MU EDCA
2240 * is enabled or not
2241 */
2242bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm,
2249 struct iwl_mvm_vif *mvmvif,
2243 const struct iwl_mvm_vif_link_info *link_info,
2250 struct iwl_he_backoff_conf *trig_based_txf)
2251{
2252 int i;
2253 /* Mark MU EDCA as enabled, unless none detected on some AC */
2254 bool mu_edca_enabled = true;
2255
2256 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
2244 struct iwl_he_backoff_conf *trig_based_txf)
2245{
2246 int i;
2247 /* Mark MU EDCA as enabled, unless none detected on some AC */
2248 bool mu_edca_enabled = true;
2249
2250 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
2257 struct ieee80211_he_mu_edca_param_ac_rec *mu_edca =
2258 &mvmvif->deflink.queue_params[i].mu_edca_param_rec;
2251 const struct ieee80211_he_mu_edca_param_ac_rec *mu_edca =
2252 &link_info->queue_params[i].mu_edca_param_rec;
2259 u8 ac = iwl_mvm_mac80211_ac_to_ucode_ac(i);
2260
2253 u8 ac = iwl_mvm_mac80211_ac_to_ucode_ac(i);
2254
2261 if (!mvmvif->deflink.queue_params[i].mu_edca) {
2255 if (!link_info->queue_params[i].mu_edca) {
2262 mu_edca_enabled = false;
2263 break;
2264 }
2265
2266 trig_based_txf[ac].cwmin =
2267 cpu_to_le16(mu_edca->ecw_min_max & 0xf);
2268 trig_based_txf[ac].cwmax =
2269 cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4);

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

2280{
2281 const struct ieee80211_supported_band *sband;
2282 const struct ieee80211_sta_he_cap *own_he_cap = NULL;
2283
2284 /* This capability is the same for all bands,
2285 * so take it from one of them.
2286 */
2287 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ];
2256 mu_edca_enabled = false;
2257 break;
2258 }
2259
2260 trig_based_txf[ac].cwmin =
2261 cpu_to_le16(mu_edca->ecw_min_max & 0xf);
2262 trig_based_txf[ac].cwmax =
2263 cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4);

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

2274{
2275 const struct ieee80211_supported_band *sband;
2276 const struct ieee80211_sta_he_cap *own_he_cap = NULL;
2277
2278 /* This capability is the same for all bands,
2279 * so take it from one of them.
2280 */
2281 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ];
2288 own_he_cap = ieee80211_get_he_iftype_cap(sband,
2289 ieee80211_vif_type_p2p(vif));
2282 own_he_cap = ieee80211_get_he_iftype_cap_vif(sband, vif);
2290
2291 return (own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] &
2292 IEEE80211_HE_MAC_CAP2_ACK_EN));
2293}
2294
2295__le32 iwl_mvm_get_sta_htc_flags(struct ieee80211_sta *sta,
2296 struct ieee80211_link_sta *link_sta)
2297{

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

2400 flags |= STA_CTXT_HE_32BIT_BA_BITMAP;
2401
2402 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] &
2403 IEEE80211_HE_MAC_CAP2_ACK_EN)
2404 flags |= STA_CTXT_HE_ACK_ENABLED;
2405
2406 rcu_read_unlock();
2407
2283
2284 return (own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] &
2285 IEEE80211_HE_MAC_CAP2_ACK_EN));
2286}
2287
2288__le32 iwl_mvm_get_sta_htc_flags(struct ieee80211_sta *sta,
2289 struct ieee80211_link_sta *link_sta)
2290{

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

2393 flags |= STA_CTXT_HE_32BIT_BA_BITMAP;
2394
2395 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] &
2396 IEEE80211_HE_MAC_CAP2_ACK_EN)
2397 flags |= STA_CTXT_HE_ACK_ENABLED;
2398
2399 rcu_read_unlock();
2400
2408 if (iwl_mvm_set_fw_mu_edca_params(mvm, mvmvif,
2401 if (iwl_mvm_set_fw_mu_edca_params(mvm, &mvmvif->deflink,
2409 &sta_ctxt_cmd.trig_based_txf[0]))
2410 flags |= STA_CTXT_HE_MU_EDCA_CW;
2411
2412 if (vif->bss_conf.uora_exists) {
2413 flags |= STA_CTXT_HE_TRIG_RND_ALLOC;
2414
2415 sta_ctxt_cmd.rand_alloc_ecwmin =
2416 vif->bss_conf.uora_ocw_range & 0x7;

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

2893 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL);
2894
2895 iwl_mvm_bt_coex_vif_change(mvm);
2896
2897 /* we don't support TDLS during DCM */
2898 if (iwl_mvm_phy_ctx_count(mvm) > 1)
2899 iwl_mvm_teardown_tdls_peers(mvm);
2900
2402 &sta_ctxt_cmd.trig_based_txf[0]))
2403 flags |= STA_CTXT_HE_MU_EDCA_CW;
2404
2405 if (vif->bss_conf.uora_exists) {
2406 flags |= STA_CTXT_HE_TRIG_RND_ALLOC;
2407
2408 sta_ctxt_cmd.rand_alloc_ecwmin =
2409 vif->bss_conf.uora_ocw_range & 0x7;

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

2886 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL);
2887
2888 iwl_mvm_bt_coex_vif_change(mvm);
2889
2890 /* we don't support TDLS during DCM */
2891 if (iwl_mvm_phy_ctx_count(mvm) > 1)
2892 iwl_mvm_teardown_tdls_peers(mvm);
2893
2901 iwl_mvm_ftm_restart_responder(mvm, vif);
2894 iwl_mvm_ftm_restart_responder(mvm, vif, &vif->bss_conf);
2902
2903 goto out_unlock;
2904
2905out_failed:
2906 iwl_mvm_power_update_mac(mvm);
2907 mvmvif->ap_ibss_active = false;
2908 iwl_mvm_send_rm_bcast_sta(mvm, vif);
2909 iwl_mvm_rm_mcast_sta(mvm, vif);

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

3035 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
3036
3037 /* Need to send a new beacon template to the FW */
3038 if (changes & BSS_CHANGED_BEACON &&
3039 iwl_mvm_mac_ctxt_beacon_changed(mvm, vif, &vif->bss_conf))
3040 IWL_WARN(mvm, "Failed updating beacon data\n");
3041
3042 if (changes & BSS_CHANGED_FTM_RESPONDER) {
2895
2896 goto out_unlock;
2897
2898out_failed:
2899 iwl_mvm_power_update_mac(mvm);
2900 mvmvif->ap_ibss_active = false;
2901 iwl_mvm_send_rm_bcast_sta(mvm, vif);
2902 iwl_mvm_rm_mcast_sta(mvm, vif);

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

3028 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
3029
3030 /* Need to send a new beacon template to the FW */
3031 if (changes & BSS_CHANGED_BEACON &&
3032 iwl_mvm_mac_ctxt_beacon_changed(mvm, vif, &vif->bss_conf))
3033 IWL_WARN(mvm, "Failed updating beacon data\n");
3034
3035 if (changes & BSS_CHANGED_FTM_RESPONDER) {
3043 int ret = iwl_mvm_ftm_start_responder(mvm, vif);
3036 int ret = iwl_mvm_ftm_start_responder(mvm, vif, &vif->bss_conf);
3044
3045 if (ret)
3046 IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
3047 ret);
3048 }
3049
3050}
3051
3052static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
3053 struct ieee80211_vif *vif,
3054 struct ieee80211_bss_conf *bss_conf,
3055 u64 changes)
3056{
3037
3038 if (ret)
3039 IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
3040 ret);
3041 }
3042
3043}
3044
3045static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
3046 struct ieee80211_vif *vif,
3047 struct ieee80211_bss_conf *bss_conf,
3048 u64 changes)
3049{
3057 struct iwl_mvm_bss_info_changed_ops callbacks = {
3050 static const struct iwl_mvm_bss_info_changed_ops callbacks = {
3058 .bss_info_changed_sta = iwl_mvm_bss_info_changed_station,
3059 .bss_info_changed_ap_ibss = iwl_mvm_bss_info_changed_ap_ibss,
3060 };
3061
3062 iwl_mvm_bss_info_changed_common(hw, vif, bss_conf, &callbacks,
3063 changes);
3064}
3065
3066void
3067iwl_mvm_bss_info_changed_common(struct ieee80211_hw *hw,
3068 struct ieee80211_vif *vif,
3069 struct ieee80211_bss_conf *bss_conf,
3051 .bss_info_changed_sta = iwl_mvm_bss_info_changed_station,
3052 .bss_info_changed_ap_ibss = iwl_mvm_bss_info_changed_ap_ibss,
3053 };
3054
3055 iwl_mvm_bss_info_changed_common(hw, vif, bss_conf, &callbacks,
3056 changes);
3057}
3058
3059void
3060iwl_mvm_bss_info_changed_common(struct ieee80211_hw *hw,
3061 struct ieee80211_vif *vif,
3062 struct ieee80211_bss_conf *bss_conf,
3070 struct iwl_mvm_bss_info_changed_ops *callbacks,
3063 const struct iwl_mvm_bss_info_changed_ops *callbacks,
3071 u64 changes)
3072{
3073 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3074
3075 mutex_lock(&mvm->mutex);
3076
3077 if (changes & BSS_CHANGED_IDLE && !vif->cfg.idle)
3078 iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true);

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

3463 mvm->cca_40mhz_workaround--;
3464 if (mvm->cca_40mhz_workaround)
3465 return;
3466
3467 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ];
3468
3469 sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3470
3064 u64 changes)
3065{
3066 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3067
3068 mutex_lock(&mvm->mutex);
3069
3070 if (changes & BSS_CHANGED_IDLE && !vif->cfg.idle)
3071 iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true);

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

3456 mvm->cca_40mhz_workaround--;
3457 if (mvm->cca_40mhz_workaround)
3458 return;
3459
3460 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ];
3461
3462 sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3463
3471 he_cap = ieee80211_get_he_iftype_cap(sband,
3472 ieee80211_vif_type_p2p(vif));
3464 he_cap = ieee80211_get_he_iftype_cap_vif(sband, vif);
3473
3474 if (he_cap) {
3475 /* we know that ours is writable */
3476 struct ieee80211_sta_he_cap *he = (void *)(uintptr_t)he_cap;
3477
3478 he->he_cap_elem.phy_cap_info[0] |=
3479 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G;
3480 }

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

3559}
3560
3561static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3562 struct ieee80211_vif *vif,
3563 struct ieee80211_sta *sta,
3564 enum ieee80211_sta_state old_state,
3565 enum ieee80211_sta_state new_state)
3566{
3465
3466 if (he_cap) {
3467 /* we know that ours is writable */
3468 struct ieee80211_sta_he_cap *he = (void *)(uintptr_t)he_cap;
3469
3470 he->he_cap_elem.phy_cap_info[0] |=
3471 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G;
3472 }

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

3551}
3552
3553static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3554 struct ieee80211_vif *vif,
3555 struct ieee80211_sta *sta,
3556 enum ieee80211_sta_state old_state,
3557 enum ieee80211_sta_state new_state)
3558{
3567 struct iwl_mvm_sta_state_ops callbacks = {
3559 static const struct iwl_mvm_sta_state_ops callbacks = {
3568 .add_sta = iwl_mvm_add_sta,
3569 .update_sta = iwl_mvm_update_sta,
3570 .rm_sta = iwl_mvm_rm_sta,
3571 .mac_ctxt_changed = iwl_mvm_mac_ctxt_changed_wrapper,
3572 };
3573
3574 return iwl_mvm_mac_sta_state_common(hw, vif, sta, old_state, new_state,
3575 &callbacks);

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

3664 }
3665 }
3666}
3667
3668static int
3669iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,
3670 struct ieee80211_vif *vif,
3671 struct ieee80211_sta *sta,
3560 .add_sta = iwl_mvm_add_sta,
3561 .update_sta = iwl_mvm_update_sta,
3562 .rm_sta = iwl_mvm_rm_sta,
3563 .mac_ctxt_changed = iwl_mvm_mac_ctxt_changed_wrapper,
3564 };
3565
3566 return iwl_mvm_mac_sta_state_common(hw, vif, sta, old_state, new_state,
3567 &callbacks);

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

3656 }
3657 }
3658}
3659
3660static int
3661iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,
3662 struct ieee80211_vif *vif,
3663 struct ieee80211_sta *sta,
3672 struct iwl_mvm_sta_state_ops *callbacks)
3664 const struct iwl_mvm_sta_state_ops *callbacks)
3673{
3674 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3675 struct ieee80211_link_sta *link_sta;
3676 unsigned int i;
3677 int ret;
3678
3679 lockdep_assert_held(&mvm->mutex);
3680

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

3708 return 0;
3709}
3710
3711static int
3712iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
3713 struct iwl_mvm *mvm,
3714 struct ieee80211_vif *vif,
3715 struct ieee80211_sta *sta,
3665{
3666 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3667 struct ieee80211_link_sta *link_sta;
3668 unsigned int i;
3669 int ret;
3670
3671 lockdep_assert_held(&mvm->mutex);
3672

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

3700 return 0;
3701}
3702
3703static int
3704iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
3705 struct iwl_mvm *mvm,
3706 struct ieee80211_vif *vif,
3707 struct ieee80211_sta *sta,
3716 struct iwl_mvm_sta_state_ops *callbacks)
3708 const struct iwl_mvm_sta_state_ops *callbacks)
3717{
3718 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3719 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3720 struct ieee80211_link_sta *link_sta;
3721 unsigned int link_id;
3722
3723 lockdep_assert_held(&mvm->mutex);
3724

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

3765
3766 return callbacks->update_sta(mvm, vif, sta);
3767}
3768
3769static int
3770iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm,
3771 struct ieee80211_vif *vif,
3772 struct ieee80211_sta *sta,
3709{
3710 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3711 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3712 struct ieee80211_link_sta *link_sta;
3713 unsigned int link_id;
3714
3715 lockdep_assert_held(&mvm->mutex);
3716

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

3757
3758 return callbacks->update_sta(mvm, vif, sta);
3759}
3760
3761static int
3762iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm,
3763 struct ieee80211_vif *vif,
3764 struct ieee80211_sta *sta,
3773 struct iwl_mvm_sta_state_ops *callbacks)
3765 const struct iwl_mvm_sta_state_ops *callbacks)
3774{
3775 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3776 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3777
3778 lockdep_assert_held(&mvm->mutex);
3779
3780 /* we don't support TDLS during DCM */
3781 if (iwl_mvm_phy_ctx_count(mvm) > 1)

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

3800
3801 return 0;
3802}
3803
3804static int
3805iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm,
3806 struct ieee80211_vif *vif,
3807 struct ieee80211_sta *sta,
3766{
3767 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3768 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3769
3770 lockdep_assert_held(&mvm->mutex);
3771
3772 /* we don't support TDLS during DCM */
3773 if (iwl_mvm_phy_ctx_count(mvm) > 1)

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

3792
3793 return 0;
3794}
3795
3796static int
3797iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm,
3798 struct ieee80211_vif *vif,
3799 struct ieee80211_sta *sta,
3808 struct iwl_mvm_sta_state_ops *callbacks)
3800 const struct iwl_mvm_sta_state_ops *callbacks)
3809{
3810 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3811 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
3801{
3802 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3803 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
3812 int ret;
3813
3814 lockdep_assert_held(&mvm->mutex);
3815
3816 mvmsta->authorized = false;
3817
3818 /* once we move into assoc state, need to update rate scale to
3819 * disable using wide bandwidth
3820 */
3821 iwl_mvm_rs_rate_init_all_links(mvm, vif, sta);
3822
3823 if (!sta->tdls) {
3824 /* Set this but don't call iwl_mvm_mac_ctxt_changed()
3825 * yet to avoid sending high prio again for a little
3826 * time.
3827 */
3828 mvmvif->authorized = 0;
3829
3830 /* disable beacon filtering */
3804
3805 lockdep_assert_held(&mvm->mutex);
3806
3807 mvmsta->authorized = false;
3808
3809 /* once we move into assoc state, need to update rate scale to
3810 * disable using wide bandwidth
3811 */
3812 iwl_mvm_rs_rate_init_all_links(mvm, vif, sta);
3813
3814 if (!sta->tdls) {
3815 /* Set this but don't call iwl_mvm_mac_ctxt_changed()
3816 * yet to avoid sending high prio again for a little
3817 * time.
3818 */
3819 mvmvif->authorized = 0;
3820
3821 /* disable beacon filtering */
3831 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
3832 WARN_ON(ret &&
3833 !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
3834 &mvm->status));
3822 iwl_mvm_disable_beacon_filter(mvm, vif, 0);
3835 }
3836
3837 return 0;
3838}
3839
3840/* Common part for MLD and non-MLD modes */
3841int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
3842 struct ieee80211_vif *vif,
3843 struct ieee80211_sta *sta,
3844 enum ieee80211_sta_state old_state,
3845 enum ieee80211_sta_state new_state,
3823 }
3824
3825 return 0;
3826}
3827
3828/* Common part for MLD and non-MLD modes */
3829int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
3830 struct ieee80211_vif *vif,
3831 struct ieee80211_sta *sta,
3832 enum ieee80211_sta_state old_state,
3833 enum ieee80211_sta_state new_state,
3846 struct iwl_mvm_sta_state_ops *callbacks)
3834 const struct iwl_mvm_sta_state_ops *callbacks)
3847{
3848 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3849 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3850 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3851 unsigned int link_id;
3852 int ret;
3853
3854 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n",

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

4528 lockdep_assert_held(&mvm->mutex);
4529
4530 if (!fw_has_capa(&mvm->fw->ucode_capa,
4531 IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT)) {
4532 IWL_ERR(mvm, "hotspot not supported\n");
4533 return -EINVAL;
4534 }
4535
3835{
3836 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3837 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3838 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3839 unsigned int link_id;
3840 int ret;
3841
3842 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n",

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

4516 lockdep_assert_held(&mvm->mutex);
4517
4518 if (!fw_has_capa(&mvm->fw->ucode_capa,
4519 IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT)) {
4520 IWL_ERR(mvm, "hotspot not supported\n");
4521 return -EINVAL;
4522 }
4523
4536 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12) {
4524 if (iwl_mvm_has_new_station_api(mvm->fw)) {
4537 ret = iwl_mvm_add_aux_sta(mvm, lmac_id);
4538 WARN(ret, "Failed to allocate aux station");
4539 }
4540
4541 return ret;
4542}
4543
4544static int iwl_mvm_roc_switch_binding(struct iwl_mvm *mvm,

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

4568}
4569
4570static int iwl_mvm_roc(struct ieee80211_hw *hw,
4571 struct ieee80211_vif *vif,
4572 struct ieee80211_channel *channel,
4573 int duration,
4574 enum ieee80211_roc_type type)
4575{
4525 ret = iwl_mvm_add_aux_sta(mvm, lmac_id);
4526 WARN(ret, "Failed to allocate aux station");
4527 }
4528
4529 return ret;
4530}
4531
4532static int iwl_mvm_roc_switch_binding(struct iwl_mvm *mvm,

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

4556}
4557
4558static int iwl_mvm_roc(struct ieee80211_hw *hw,
4559 struct ieee80211_vif *vif,
4560 struct ieee80211_channel *channel,
4561 int duration,
4562 enum ieee80211_roc_type type)
4563{
4576 struct iwl_mvm_roc_ops ops = {
4564 static const struct iwl_mvm_roc_ops ops = {
4577 .add_aux_sta_for_hs20 = iwl_mvm_add_aux_sta_for_hs20,
4578 .switch_phy_ctxt = iwl_mvm_roc_switch_binding,
4579 };
4580
4581 return iwl_mvm_roc_common(hw, vif, channel, duration, type, &ops);
4582}
4583
4584/* Execute the common part for MLD and non-MLD modes */
4585int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4586 struct ieee80211_channel *channel, int duration,
4587 enum ieee80211_roc_type type,
4565 .add_aux_sta_for_hs20 = iwl_mvm_add_aux_sta_for_hs20,
4566 .switch_phy_ctxt = iwl_mvm_roc_switch_binding,
4567 };
4568
4569 return iwl_mvm_roc_common(hw, vif, channel, duration, type, &ops);
4570}
4571
4572/* Execute the common part for MLD and non-MLD modes */
4573int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4574 struct ieee80211_channel *channel, int duration,
4575 enum ieee80211_roc_type type,
4588 struct iwl_mvm_roc_ops *ops)
4576 const struct iwl_mvm_roc_ops *ops)
4589{
4590 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
4591 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
4592 struct cfg80211_chan_def chandef;
4593 struct iwl_mvm_phy_ctxt *phy_ctxt;
4594 bool band_change_removal;
4595 int ret, i;
4596 u32 lmac_id;

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

4603 * the work it does can complete and we can accept new frames.
4604 */
4605 flush_work(&mvm->roc_done_wk);
4606
4607 mutex_lock(&mvm->mutex);
4608
4609 switch (vif->type) {
4610 case NL80211_IFTYPE_STATION:
4577{
4578 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
4579 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
4580 struct cfg80211_chan_def chandef;
4581 struct iwl_mvm_phy_ctxt *phy_ctxt;
4582 bool band_change_removal;
4583 int ret, i;
4584 u32 lmac_id;

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

4591 * the work it does can complete and we can accept new frames.
4592 */
4593 flush_work(&mvm->roc_done_wk);
4594
4595 mutex_lock(&mvm->mutex);
4596
4597 switch (vif->type) {
4598 case NL80211_IFTYPE_STATION:
4611 lmac_id = iwl_mvm_get_lmac_id(mvm->fw, channel->band);
4599 lmac_id = iwl_mvm_get_lmac_id(mvm, channel->band);
4612
4613 /* Use aux roc framework (HS20) */
4614 ret = ops->add_aux_sta_for_hs20(mvm, lmac_id);
4615 if (!ret)
4616 ret = iwl_mvm_send_aux_roc_cmd(mvm, channel,
4617 vif, duration);
4618 goto out_unlock;
4619 case NL80211_IFTYPE_P2P_DEVICE:

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

5087 mutex_lock(&mvm->mutex);
5088 __iwl_mvm_unassign_vif_chanctx(mvm, vif, link_conf, ctx, false);
5089 mutex_unlock(&mvm->mutex);
5090}
5091
5092static int
5093iwl_mvm_switch_vif_chanctx_swap(struct iwl_mvm *mvm,
5094 struct ieee80211_vif_chanctx_switch *vifs,
4600
4601 /* Use aux roc framework (HS20) */
4602 ret = ops->add_aux_sta_for_hs20(mvm, lmac_id);
4603 if (!ret)
4604 ret = iwl_mvm_send_aux_roc_cmd(mvm, channel,
4605 vif, duration);
4606 goto out_unlock;
4607 case NL80211_IFTYPE_P2P_DEVICE:

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

5075 mutex_lock(&mvm->mutex);
5076 __iwl_mvm_unassign_vif_chanctx(mvm, vif, link_conf, ctx, false);
5077 mutex_unlock(&mvm->mutex);
5078}
5079
5080static int
5081iwl_mvm_switch_vif_chanctx_swap(struct iwl_mvm *mvm,
5082 struct ieee80211_vif_chanctx_switch *vifs,
5095 struct iwl_mvm_switch_vif_chanctx_ops *ops)
5083 const struct iwl_mvm_switch_vif_chanctx_ops *ops)
5096{
5097 int ret;
5098
5099 mutex_lock(&mvm->mutex);
5100 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf,
5101 vifs[0].old_ctx, true);
5102 __iwl_mvm_remove_chanctx(mvm, vifs[0].old_ctx);
5103

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

5146 mutex_unlock(&mvm->mutex);
5147
5148 return ret;
5149}
5150
5151static int
5152iwl_mvm_switch_vif_chanctx_reassign(struct iwl_mvm *mvm,
5153 struct ieee80211_vif_chanctx_switch *vifs,
5084{
5085 int ret;
5086
5087 mutex_lock(&mvm->mutex);
5088 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf,
5089 vifs[0].old_ctx, true);
5090 __iwl_mvm_remove_chanctx(mvm, vifs[0].old_ctx);
5091

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

5134 mutex_unlock(&mvm->mutex);
5135
5136 return ret;
5137}
5138
5139static int
5140iwl_mvm_switch_vif_chanctx_reassign(struct iwl_mvm *mvm,
5141 struct ieee80211_vif_chanctx_switch *vifs,
5154 struct iwl_mvm_switch_vif_chanctx_ops *ops)
5142 const struct iwl_mvm_switch_vif_chanctx_ops *ops)
5155{
5156 int ret;
5157
5158 mutex_lock(&mvm->mutex);
5159 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf,
5160 vifs[0].old_ctx, true);
5161
5162 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf,

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

5189}
5190
5191/* Execute the common part for both MLD and non-MLD modes */
5192int
5193iwl_mvm_switch_vif_chanctx_common(struct ieee80211_hw *hw,
5194 struct ieee80211_vif_chanctx_switch *vifs,
5195 int n_vifs,
5196 enum ieee80211_chanctx_switch_mode mode,
5143{
5144 int ret;
5145
5146 mutex_lock(&mvm->mutex);
5147 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf,
5148 vifs[0].old_ctx, true);
5149
5150 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf,

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

5177}
5178
5179/* Execute the common part for both MLD and non-MLD modes */
5180int
5181iwl_mvm_switch_vif_chanctx_common(struct ieee80211_hw *hw,
5182 struct ieee80211_vif_chanctx_switch *vifs,
5183 int n_vifs,
5184 enum ieee80211_chanctx_switch_mode mode,
5197 struct iwl_mvm_switch_vif_chanctx_ops *ops)
5185 const struct iwl_mvm_switch_vif_chanctx_ops *ops)
5198{
5199 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
5200 int ret;
5201
5202 /* we only support a single-vif right now */
5203 if (n_vifs > 1)
5204 return -EOPNOTSUPP;
5205

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

5218 return ret;
5219}
5220
5221static int iwl_mvm_switch_vif_chanctx(struct ieee80211_hw *hw,
5222 struct ieee80211_vif_chanctx_switch *vifs,
5223 int n_vifs,
5224 enum ieee80211_chanctx_switch_mode mode)
5225{
5186{
5187 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
5188 int ret;
5189
5190 /* we only support a single-vif right now */
5191 if (n_vifs > 1)
5192 return -EOPNOTSUPP;
5193

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

5206 return ret;
5207}
5208
5209static int iwl_mvm_switch_vif_chanctx(struct ieee80211_hw *hw,
5210 struct ieee80211_vif_chanctx_switch *vifs,
5211 int n_vifs,
5212 enum ieee80211_chanctx_switch_mode mode)
5213{
5226 struct iwl_mvm_switch_vif_chanctx_ops ops = {
5214 static const struct iwl_mvm_switch_vif_chanctx_ops ops = {
5227 .__assign_vif_chanctx = __iwl_mvm_assign_vif_chanctx,
5228 .__unassign_vif_chanctx = __iwl_mvm_unassign_vif_chanctx,
5229 };
5230
5231 return iwl_mvm_switch_vif_chanctx_common(hw, vifs, n_vifs, mode, &ops);
5232}
5233
5234int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw)

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

6149}
6150
6151static bool iwl_mvm_mac_can_aggregate(struct ieee80211_hw *hw,
6152 struct sk_buff *head,
6153 struct sk_buff *skb)
6154{
6155 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
6156
5215 .__assign_vif_chanctx = __iwl_mvm_assign_vif_chanctx,
5216 .__unassign_vif_chanctx = __iwl_mvm_unassign_vif_chanctx,
5217 };
5218
5219 return iwl_mvm_switch_vif_chanctx_common(hw, vifs, n_vifs, mode, &ops);
5220}
5221
5222int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw)

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

6137}
6138
6139static bool iwl_mvm_mac_can_aggregate(struct ieee80211_hw *hw,
6140 struct sk_buff *head,
6141 struct sk_buff *skb)
6142{
6143 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
6144
6157 if (iwl_mvm_has_new_tx_csum(mvm))
6158 return iwl_mvm_tx_csum_bz(mvm, head, true) ==
6159 iwl_mvm_tx_csum_bz(mvm, skb, true);
6160
6161 /* For now don't aggregate IPv6 in AMSDU */
6162 if (skb->protocol != htons(ETH_P_IP))
6163 return false;
6164
6165 if (!iwl_mvm_is_csum_supported(mvm))
6166 return true;
6167
6168 return iwl_mvm_can_hw_csum(skb) == iwl_mvm_can_hw_csum(head);

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

6272 .get_survey = iwl_mvm_mac_get_survey,
6273 .sta_statistics = iwl_mvm_mac_sta_statistics,
6274 .get_ftm_responder_stats = iwl_mvm_mac_get_ftm_responder_stats,
6275 .start_pmsr = iwl_mvm_start_pmsr,
6276 .abort_pmsr = iwl_mvm_abort_pmsr,
6277
6278 .can_aggregate_in_amsdu = iwl_mvm_mac_can_aggregate,
6279#ifdef CONFIG_IWLWIFI_DEBUGFS
6145 /* For now don't aggregate IPv6 in AMSDU */
6146 if (skb->protocol != htons(ETH_P_IP))
6147 return false;
6148
6149 if (!iwl_mvm_is_csum_supported(mvm))
6150 return true;
6151
6152 return iwl_mvm_can_hw_csum(skb) == iwl_mvm_can_hw_csum(head);

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

6256 .get_survey = iwl_mvm_mac_get_survey,
6257 .sta_statistics = iwl_mvm_mac_sta_statistics,
6258 .get_ftm_responder_stats = iwl_mvm_mac_get_ftm_responder_stats,
6259 .start_pmsr = iwl_mvm_start_pmsr,
6260 .abort_pmsr = iwl_mvm_abort_pmsr,
6261
6262 .can_aggregate_in_amsdu = iwl_mvm_mac_can_aggregate,
6263#ifdef CONFIG_IWLWIFI_DEBUGFS
6280 .sta_add_debugfs = iwl_mvm_sta_add_debugfs,
6264 .link_sta_add_debugfs = iwl_mvm_link_sta_add_debugfs,
6281#endif
6282 .set_hw_timestamp = iwl_mvm_set_hw_timestamp,
6283};
6265#endif
6266 .set_hw_timestamp = iwl_mvm_set_hw_timestamp,
6267};