1 /****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2017 Intel Deutschland GmbH 9 * Copyright(c) 2018 - 2020 Intel Corporation 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of version 2 of the GNU General Public License as 13 * published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * General Public License for more details. 19 * 20 * The full GNU General Public License is included in this distribution 21 * in the file called COPYING. 22 * 23 * Contact Information: 24 * Intel Linux Wireless <linuxwifi@intel.com> 25 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * 27 * BSD LICENSE 28 * 29 * Copyright(c) 2017 Intel Deutschland GmbH 30 * Copyright(c) 2018 - 2020 Intel Corporation 31 * All rights reserved. 32 * 33 * Redistribution and use in source and binary forms, with or without 34 * modification, are permitted provided that the following conditions 35 * are met: 36 * 37 * * Redistributions of source code must retain the above copyright 38 * notice, this list of conditions and the following disclaimer. 39 * * Redistributions in binary form must reproduce the above copyright 40 * notice, this list of conditions and the following disclaimer in 41 * the documentation and/or other materials provided with the 42 * distribution. 43 * * Neither the name Intel Corporation nor the names of its 44 * contributors may be used to endorse or promote products derived 45 * from this software without specific prior written permission. 46 * 47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 48 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 49 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 50 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 51 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 53 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 57 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 * 59 *****************************************************************************/ 60 #include "rs.h" 61 #include "fw-api.h" 62 #include "sta.h" 63 #include "iwl-op-mode.h" 64 #include "mvm.h" 65 66 static u8 rs_fw_bw_from_sta_bw(struct ieee80211_sta *sta) 67 { 68 switch (sta->bandwidth) { 69 case IEEE80211_STA_RX_BW_160: 70 return IWL_TLC_MNG_CH_WIDTH_160MHZ; 71 case IEEE80211_STA_RX_BW_80: 72 return IWL_TLC_MNG_CH_WIDTH_80MHZ; 73 case IEEE80211_STA_RX_BW_40: 74 return IWL_TLC_MNG_CH_WIDTH_40MHZ; 75 case IEEE80211_STA_RX_BW_20: 76 default: 77 return IWL_TLC_MNG_CH_WIDTH_20MHZ; 78 } 79 } 80 81 static u8 rs_fw_set_active_chains(u8 chains) 82 { 83 u8 fw_chains = 0; 84 85 if (chains & ANT_A) 86 fw_chains |= IWL_TLC_MNG_CHAIN_A_MSK; 87 if (chains & ANT_B) 88 fw_chains |= IWL_TLC_MNG_CHAIN_B_MSK; 89 if (chains & ANT_C) 90 WARN(false, 91 "tlc offload doesn't support antenna C. chains: 0x%x\n", 92 chains); 93 94 return fw_chains; 95 } 96 97 static u8 rs_fw_sgi_cw_support(struct ieee80211_sta *sta) 98 { 99 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 100 struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; 101 struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; 102 u8 supp = 0; 103 104 if (he_cap->has_he) 105 return 0; 106 107 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) 108 supp |= BIT(IWL_TLC_MNG_CH_WIDTH_20MHZ); 109 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) 110 supp |= BIT(IWL_TLC_MNG_CH_WIDTH_40MHZ); 111 if (vht_cap->cap & IEEE80211_VHT_CAP_SHORT_GI_80) 112 supp |= BIT(IWL_TLC_MNG_CH_WIDTH_80MHZ); 113 if (vht_cap->cap & IEEE80211_VHT_CAP_SHORT_GI_160) 114 supp |= BIT(IWL_TLC_MNG_CH_WIDTH_160MHZ); 115 116 return supp; 117 } 118 119 static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm, 120 struct ieee80211_sta *sta, 121 struct ieee80211_supported_band *sband) 122 { 123 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 124 struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; 125 struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; 126 bool vht_ena = vht_cap->vht_supported; 127 u16 flags = 0; 128 129 if (mvm->cfg->ht_params->stbc && 130 (num_of_ant(iwl_mvm_get_valid_tx_ant(mvm)) > 1)) { 131 if (he_cap->has_he) { 132 if (he_cap->he_cap_elem.phy_cap_info[2] & 133 IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ) 134 flags |= IWL_TLC_MNG_CFG_FLAGS_STBC_MSK; 135 136 if (he_cap->he_cap_elem.phy_cap_info[7] & 137 IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ) 138 flags |= IWL_TLC_MNG_CFG_FLAGS_HE_STBC_160MHZ_MSK; 139 } else if ((ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) || 140 (vht_ena && 141 (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK))) 142 flags |= IWL_TLC_MNG_CFG_FLAGS_STBC_MSK; 143 } 144 145 if (mvm->cfg->ht_params->ldpc && 146 ((ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) || 147 (vht_ena && (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)))) 148 flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK; 149 150 /* consider LDPC support in case of HE */ 151 if (he_cap->has_he && (he_cap->he_cap_elem.phy_cap_info[1] & 152 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)) 153 flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK; 154 155 if (sband->iftype_data && sband->iftype_data->he_cap.has_he && 156 !(sband->iftype_data->he_cap.he_cap_elem.phy_cap_info[1] & 157 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)) 158 flags &= ~IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK; 159 160 if (he_cap->has_he && 161 (he_cap->he_cap_elem.phy_cap_info[3] & 162 IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK)) 163 flags |= IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_1_MSK; 164 165 return flags; 166 } 167 168 static 169 int rs_fw_vht_highest_rx_mcs_index(const struct ieee80211_sta_vht_cap *vht_cap, 170 int nss) 171 { 172 u16 rx_mcs = le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) & 173 (0x3 << (2 * (nss - 1))); 174 rx_mcs >>= (2 * (nss - 1)); 175 176 switch (rx_mcs) { 177 case IEEE80211_VHT_MCS_SUPPORT_0_7: 178 return IWL_TLC_MNG_HT_RATE_MCS7; 179 case IEEE80211_VHT_MCS_SUPPORT_0_8: 180 return IWL_TLC_MNG_HT_RATE_MCS8; 181 case IEEE80211_VHT_MCS_SUPPORT_0_9: 182 return IWL_TLC_MNG_HT_RATE_MCS9; 183 default: 184 WARN_ON_ONCE(1); 185 break; 186 } 187 188 return 0; 189 } 190 191 static void 192 rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta, 193 const struct ieee80211_sta_vht_cap *vht_cap, 194 struct iwl_tlc_config_cmd *cmd) 195 { 196 u16 supp; 197 int i, highest_mcs; 198 u8 max_nss = sta->rx_nss; 199 struct ieee80211_vht_cap ieee_vht_cap = { 200 .vht_cap_info = cpu_to_le32(vht_cap->cap), 201 .supp_mcs = vht_cap->vht_mcs, 202 }; 203 204 /* the station support only a single receive chain */ 205 if (sta->smps_mode == IEEE80211_SMPS_STATIC) 206 max_nss = 1; 207 208 for (i = 0; i < max_nss && i < IWL_TLC_NSS_MAX; i++) { 209 int nss = i + 1; 210 211 highest_mcs = rs_fw_vht_highest_rx_mcs_index(vht_cap, nss); 212 if (!highest_mcs) 213 continue; 214 215 supp = BIT(highest_mcs + 1) - 1; 216 if (sta->bandwidth == IEEE80211_STA_RX_BW_20) 217 supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9); 218 219 cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = cpu_to_le16(supp); 220 /* 221 * Check if VHT extended NSS indicates that the bandwidth/NSS 222 * configuration is supported - only for MCS 0 since we already 223 * decoded the MCS bits anyway ourselves. 224 */ 225 if (sta->bandwidth == IEEE80211_STA_RX_BW_160 && 226 ieee80211_get_vht_max_nss(&ieee_vht_cap, 227 IEEE80211_VHT_CHANWIDTH_160MHZ, 228 0, true, nss) >= nss) 229 cmd->ht_rates[i][IWL_TLC_HT_BW_160] = 230 cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160]; 231 } 232 } 233 234 static u16 rs_fw_he_ieee80211_mcs_to_rs_mcs(u16 mcs) 235 { 236 switch (mcs) { 237 case IEEE80211_HE_MCS_SUPPORT_0_7: 238 return BIT(IWL_TLC_MNG_HT_RATE_MCS7 + 1) - 1; 239 case IEEE80211_HE_MCS_SUPPORT_0_9: 240 return BIT(IWL_TLC_MNG_HT_RATE_MCS9 + 1) - 1; 241 case IEEE80211_HE_MCS_SUPPORT_0_11: 242 return BIT(IWL_TLC_MNG_HT_RATE_MCS11 + 1) - 1; 243 case IEEE80211_HE_MCS_NOT_SUPPORTED: 244 return 0; 245 } 246 247 WARN(1, "invalid HE MCS %d\n", mcs); 248 return 0; 249 } 250 251 static void 252 rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta, 253 struct ieee80211_supported_band *sband, 254 struct iwl_tlc_config_cmd *cmd) 255 { 256 const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; 257 u16 mcs_160 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); 258 u16 mcs_80 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80); 259 u16 tx_mcs_80 = 260 le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80); 261 u16 tx_mcs_160 = 262 le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160); 263 int i; 264 u8 nss = sta->rx_nss; 265 266 /* the station support only a single receive chain */ 267 if (sta->smps_mode == IEEE80211_SMPS_STATIC) 268 nss = 1; 269 270 for (i = 0; i < nss && i < IWL_TLC_NSS_MAX; i++) { 271 u16 _mcs_160 = (mcs_160 >> (2 * i)) & 0x3; 272 u16 _mcs_80 = (mcs_80 >> (2 * i)) & 0x3; 273 u16 _tx_mcs_160 = (tx_mcs_160 >> (2 * i)) & 0x3; 274 u16 _tx_mcs_80 = (tx_mcs_80 >> (2 * i)) & 0x3; 275 276 /* If one side doesn't support - mark both as not supporting */ 277 if (_mcs_80 == IEEE80211_HE_MCS_NOT_SUPPORTED || 278 _tx_mcs_80 == IEEE80211_HE_MCS_NOT_SUPPORTED) { 279 _mcs_80 = IEEE80211_HE_MCS_NOT_SUPPORTED; 280 _tx_mcs_80 = IEEE80211_HE_MCS_NOT_SUPPORTED; 281 } 282 if (_mcs_80 > _tx_mcs_80) 283 _mcs_80 = _tx_mcs_80; 284 cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = 285 cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_80)); 286 287 /* If one side doesn't support - mark both as not supporting */ 288 if (_mcs_160 == IEEE80211_HE_MCS_NOT_SUPPORTED || 289 _tx_mcs_160 == IEEE80211_HE_MCS_NOT_SUPPORTED) { 290 _mcs_160 = IEEE80211_HE_MCS_NOT_SUPPORTED; 291 _tx_mcs_160 = IEEE80211_HE_MCS_NOT_SUPPORTED; 292 } 293 if (_mcs_160 > _tx_mcs_160) 294 _mcs_160 = _tx_mcs_160; 295 cmd->ht_rates[i][IWL_TLC_HT_BW_160] = 296 cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_160)); 297 } 298 } 299 300 static void rs_fw_set_supp_rates(struct ieee80211_sta *sta, 301 struct ieee80211_supported_band *sband, 302 struct iwl_tlc_config_cmd *cmd) 303 { 304 int i; 305 unsigned long tmp; 306 unsigned long supp; /* must be unsigned long for for_each_set_bit */ 307 const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 308 const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; 309 const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; 310 311 /* non HT rates */ 312 supp = 0; 313 tmp = sta->supp_rates[sband->band]; 314 for_each_set_bit(i, &tmp, BITS_PER_LONG) 315 supp |= BIT(sband->bitrates[i].hw_value); 316 317 cmd->non_ht_rates = cpu_to_le16(supp); 318 cmd->mode = IWL_TLC_MNG_MODE_NON_HT; 319 320 /* HT/VHT rates */ 321 if (he_cap->has_he) { 322 cmd->mode = IWL_TLC_MNG_MODE_HE; 323 rs_fw_he_set_enabled_rates(sta, sband, cmd); 324 } else if (vht_cap->vht_supported) { 325 cmd->mode = IWL_TLC_MNG_MODE_VHT; 326 rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd); 327 } else if (ht_cap->ht_supported) { 328 cmd->mode = IWL_TLC_MNG_MODE_HT; 329 cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_HT_BW_NONE_160] = 330 cpu_to_le16(ht_cap->mcs.rx_mask[0]); 331 332 /* the station support only a single receive chain */ 333 if (sta->smps_mode == IEEE80211_SMPS_STATIC) 334 cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_HT_BW_NONE_160] = 335 0; 336 else 337 cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_HT_BW_NONE_160] = 338 cpu_to_le16(ht_cap->mcs.rx_mask[1]); 339 } 340 } 341 342 void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm, 343 struct iwl_rx_cmd_buffer *rxb) 344 { 345 struct iwl_rx_packet *pkt = rxb_addr(rxb); 346 struct iwl_tlc_update_notif *notif; 347 struct ieee80211_sta *sta; 348 struct iwl_mvm_sta *mvmsta; 349 struct iwl_lq_sta_rs_fw *lq_sta; 350 u32 flags; 351 352 rcu_read_lock(); 353 354 notif = (void *)pkt->data; 355 sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]); 356 if (IS_ERR_OR_NULL(sta)) { 357 IWL_ERR(mvm, "Invalid sta id (%d) in FW TLC notification\n", 358 notif->sta_id); 359 goto out; 360 } 361 362 mvmsta = iwl_mvm_sta_from_mac80211(sta); 363 364 if (!mvmsta) { 365 IWL_ERR(mvm, "Invalid sta id (%d) in FW TLC notification\n", 366 notif->sta_id); 367 goto out; 368 } 369 370 flags = le32_to_cpu(notif->flags); 371 372 lq_sta = &mvmsta->lq_sta.rs_fw; 373 374 if (flags & IWL_TLC_NOTIF_FLAG_RATE) { 375 char pretty_rate[100]; 376 lq_sta->last_rate_n_flags = le32_to_cpu(notif->rate); 377 rs_pretty_print_rate(pretty_rate, sizeof(pretty_rate), 378 lq_sta->last_rate_n_flags); 379 IWL_DEBUG_RATE(mvm, "new rate: %s\n", pretty_rate); 380 } 381 382 if (flags & IWL_TLC_NOTIF_FLAG_AMSDU && !mvmsta->orig_amsdu_len) { 383 u16 size = le32_to_cpu(notif->amsdu_size); 384 int i; 385 386 if (sta->max_amsdu_len < size) { 387 /* 388 * In debug sta->max_amsdu_len < size 389 * so also check with orig_amsdu_len which holds the 390 * original data before debugfs changed the value 391 */ 392 WARN_ON(mvmsta->orig_amsdu_len < size); 393 goto out; 394 } 395 396 mvmsta->amsdu_enabled = le32_to_cpu(notif->amsdu_enabled); 397 mvmsta->max_amsdu_len = size; 398 sta->max_rc_amsdu_len = mvmsta->max_amsdu_len; 399 400 for (i = 0; i < IWL_MAX_TID_COUNT; i++) { 401 if (mvmsta->amsdu_enabled & BIT(i)) 402 sta->max_tid_amsdu_len[i] = 403 iwl_mvm_max_amsdu_size(mvm, sta, i); 404 else 405 /* 406 * Not so elegant, but this will effectively 407 * prevent AMSDU on this TID 408 */ 409 sta->max_tid_amsdu_len[i] = 1; 410 } 411 412 IWL_DEBUG_RATE(mvm, 413 "AMSDU update. AMSDU size: %d, AMSDU selected size: %d, AMSDU TID bitmap 0x%X\n", 414 le32_to_cpu(notif->amsdu_size), size, 415 mvmsta->amsdu_enabled); 416 } 417 out: 418 rcu_read_unlock(); 419 } 420 421 u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *sta) 422 { 423 const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; 424 const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 425 426 if (vht_cap->vht_supported) { 427 switch (vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK) { 428 case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454: 429 return IEEE80211_MAX_MPDU_LEN_VHT_11454; 430 case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991: 431 return IEEE80211_MAX_MPDU_LEN_VHT_7991; 432 default: 433 return IEEE80211_MAX_MPDU_LEN_VHT_3895; 434 } 435 } else if (ht_cap->ht_supported) { 436 if (ht_cap->cap & IEEE80211_HT_CAP_MAX_AMSDU) 437 /* 438 * agg is offloaded so we need to assume that agg 439 * are enabled and max mpdu in ampdu is 4095 440 * (spec 802.11-2016 9.3.2.1) 441 */ 442 return IEEE80211_MAX_MPDU_LEN_HT_BA; 443 else 444 return IEEE80211_MAX_MPDU_LEN_HT_3839; 445 } 446 447 /* in legacy mode no amsdu is enabled so return zero */ 448 return 0; 449 } 450 451 void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 452 enum nl80211_band band, bool update) 453 { 454 struct ieee80211_hw *hw = mvm->hw; 455 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 456 struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw; 457 u32 cmd_id = iwl_cmd_id(TLC_MNG_CONFIG_CMD, DATA_PATH_GROUP, 0); 458 struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; 459 u16 max_amsdu_len = rs_fw_get_max_amsdu_len(sta); 460 struct iwl_tlc_config_cmd cfg_cmd = { 461 .sta_id = mvmsta->sta_id, 462 .max_ch_width = update ? 463 rs_fw_bw_from_sta_bw(sta) : RATE_MCS_CHAN_WIDTH_20, 464 .flags = cpu_to_le16(rs_fw_get_config_flags(mvm, sta, sband)), 465 .chains = rs_fw_set_active_chains(iwl_mvm_get_valid_tx_ant(mvm)), 466 .sgi_ch_width_supp = rs_fw_sgi_cw_support(sta), 467 .max_mpdu_len = cpu_to_le16(max_amsdu_len), 468 .amsdu = iwl_mvm_is_csum_supported(mvm), 469 }; 470 int ret; 471 u16 cmd_size = sizeof(cfg_cmd); 472 473 /* In old versions of the API the struct is 4 bytes smaller */ 474 if (iwl_fw_lookup_cmd_ver(mvm->fw, DATA_PATH_GROUP, 475 TLC_MNG_CONFIG_CMD, 0) < 3) 476 cmd_size -= 4; 477 478 memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers)); 479 480 #ifdef CONFIG_IWLWIFI_DEBUGFS 481 iwl_mvm_reset_frame_stats(mvm); 482 #endif 483 rs_fw_set_supp_rates(sta, sband, &cfg_cmd); 484 485 /* 486 * since TLC offload works with one mode we can assume 487 * that only vht/ht is used and also set it as station max amsdu 488 */ 489 sta->max_amsdu_len = max_amsdu_len; 490 491 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC, cmd_size, 492 &cfg_cmd); 493 if (ret) 494 IWL_ERR(mvm, "Failed to send rate scale config (%d)\n", ret); 495 } 496 497 int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, 498 bool enable) 499 { 500 /* TODO: need to introduce a new FW cmd since LQ cmd is not relevant */ 501 IWL_DEBUG_RATE(mvm, "tx protection - not implemented yet.\n"); 502 return 0; 503 } 504 505 void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta) 506 { 507 struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw; 508 509 IWL_DEBUG_RATE(mvm, "create station rate scale window\n"); 510 511 lq_sta->pers.drv = mvm; 512 lq_sta->pers.sta_id = mvmsta->sta_id; 513 lq_sta->pers.chains = 0; 514 memset(lq_sta->pers.chain_signal, 0, sizeof(lq_sta->pers.chain_signal)); 515 lq_sta->pers.last_rssi = S8_MIN; 516 lq_sta->last_rate_n_flags = 0; 517 518 #ifdef CONFIG_MAC80211_DEBUGFS 519 lq_sta->pers.dbg_fixed_rate = 0; 520 #endif 521 } 522