1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 /* Copyright(c) 2019-2020 Realtek Corporation 3 */ 4 5 #include "cam.h" 6 #include "chan.h" 7 #include "coex.h" 8 #include "debug.h" 9 #include "fw.h" 10 #include "mac.h" 11 #include "phy.h" 12 #include "ps.h" 13 #include "reg.h" 14 #include "sar.h" 15 #include "ser.h" 16 #include "util.h" 17 #include "wow.h" 18 19 static void rtw89_ops_tx(struct ieee80211_hw *hw, 20 struct ieee80211_tx_control *control, 21 struct sk_buff *skb) 22 { 23 struct rtw89_dev *rtwdev = hw->priv; 24 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 25 struct ieee80211_vif *vif = info->control.vif; 26 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 27 struct ieee80211_sta *sta = control->sta; 28 u32 flags = IEEE80211_SKB_CB(skb)->flags; 29 int ret, qsel; 30 31 if (rtwvif->offchan && !(flags & IEEE80211_TX_CTL_TX_OFFCHAN) && sta) { 32 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 33 34 rtw89_debug(rtwdev, RTW89_DBG_TXRX, "ops_tx during offchan\n"); 35 skb_queue_tail(&rtwsta->roc_queue, skb); 36 return; 37 } 38 39 ret = rtw89_core_tx_write(rtwdev, vif, sta, skb, &qsel); 40 if (ret) { 41 rtw89_err(rtwdev, "failed to transmit skb: %d\n", ret); 42 ieee80211_free_txskb(hw, skb); 43 return; 44 } 45 rtw89_core_tx_kick_off(rtwdev, qsel); 46 } 47 48 static void rtw89_ops_wake_tx_queue(struct ieee80211_hw *hw, 49 struct ieee80211_txq *txq) 50 { 51 struct rtw89_dev *rtwdev = hw->priv; 52 53 ieee80211_schedule_txq(hw, txq); 54 queue_work(rtwdev->txq_wq, &rtwdev->txq_work); 55 } 56 57 static int rtw89_ops_start(struct ieee80211_hw *hw) 58 { 59 struct rtw89_dev *rtwdev = hw->priv; 60 int ret; 61 62 mutex_lock(&rtwdev->mutex); 63 ret = rtw89_core_start(rtwdev); 64 mutex_unlock(&rtwdev->mutex); 65 66 return ret; 67 } 68 69 static void rtw89_ops_stop(struct ieee80211_hw *hw) 70 { 71 struct rtw89_dev *rtwdev = hw->priv; 72 73 mutex_lock(&rtwdev->mutex); 74 rtw89_core_stop(rtwdev); 75 mutex_unlock(&rtwdev->mutex); 76 } 77 78 static int rtw89_ops_config(struct ieee80211_hw *hw, u32 changed) 79 { 80 struct rtw89_dev *rtwdev = hw->priv; 81 82 /* let previous ips work finish to ensure we don't leave ips twice */ 83 cancel_work_sync(&rtwdev->ips_work); 84 85 mutex_lock(&rtwdev->mutex); 86 rtw89_leave_ps_mode(rtwdev); 87 88 if ((changed & IEEE80211_CONF_CHANGE_IDLE) && 89 !(hw->conf.flags & IEEE80211_CONF_IDLE)) 90 rtw89_leave_ips(rtwdev); 91 92 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 93 rtw89_config_entity_chandef(rtwdev, RTW89_SUB_ENTITY_0, 94 &hw->conf.chandef); 95 rtw89_set_channel(rtwdev); 96 } 97 98 if ((changed & IEEE80211_CONF_CHANGE_IDLE) && 99 (hw->conf.flags & IEEE80211_CONF_IDLE) && 100 !rtwdev->scanning) 101 rtw89_enter_ips(rtwdev); 102 103 mutex_unlock(&rtwdev->mutex); 104 105 return 0; 106 } 107 108 static int rtw89_ops_add_interface(struct ieee80211_hw *hw, 109 struct ieee80211_vif *vif) 110 { 111 struct rtw89_dev *rtwdev = hw->priv; 112 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 113 int ret = 0; 114 115 rtw89_debug(rtwdev, RTW89_DBG_STATE, "add vif %pM type %d, p2p %d\n", 116 vif->addr, vif->type, vif->p2p); 117 118 mutex_lock(&rtwdev->mutex); 119 120 rtw89_leave_ips_by_hwflags(rtwdev); 121 122 if (RTW89_CHK_FW_FEATURE(BEACON_FILTER, &rtwdev->fw)) 123 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | 124 IEEE80211_VIF_SUPPORTS_CQM_RSSI; 125 126 rtwvif->rtwdev = rtwdev; 127 rtwvif->roc.state = RTW89_ROC_IDLE; 128 rtwvif->offchan = false; 129 list_add_tail(&rtwvif->list, &rtwdev->rtwvifs_list); 130 INIT_WORK(&rtwvif->update_beacon_work, rtw89_core_update_beacon_work); 131 INIT_DELAYED_WORK(&rtwvif->roc.roc_work, rtw89_roc_work); 132 rtw89_leave_ps_mode(rtwdev); 133 134 rtw89_traffic_stats_init(rtwdev, &rtwvif->stats); 135 rtw89_vif_type_mapping(vif, false); 136 rtwvif->port = rtw89_core_acquire_bit_map(rtwdev->hw_port, 137 RTW89_PORT_NUM); 138 if (rtwvif->port == RTW89_PORT_NUM) { 139 ret = -ENOSPC; 140 list_del_init(&rtwvif->list); 141 goto out; 142 } 143 144 rtwvif->bcn_hit_cond = 0; 145 rtwvif->mac_idx = RTW89_MAC_0; 146 rtwvif->phy_idx = RTW89_PHY_0; 147 rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0; 148 rtwvif->chanctx_assigned = false; 149 rtwvif->hit_rule = 0; 150 rtwvif->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; 151 ether_addr_copy(rtwvif->mac_addr, vif->addr); 152 INIT_LIST_HEAD(&rtwvif->general_pkt_list); 153 154 ret = rtw89_mac_add_vif(rtwdev, rtwvif); 155 if (ret) { 156 rtw89_core_release_bit_map(rtwdev->hw_port, rtwvif->port); 157 list_del_init(&rtwvif->list); 158 goto out; 159 } 160 161 rtw89_core_txq_init(rtwdev, vif->txq); 162 163 rtw89_btc_ntfy_role_info(rtwdev, rtwvif, NULL, BTC_ROLE_START); 164 165 rtw89_recalc_lps(rtwdev); 166 out: 167 mutex_unlock(&rtwdev->mutex); 168 169 return ret; 170 } 171 172 static void rtw89_ops_remove_interface(struct ieee80211_hw *hw, 173 struct ieee80211_vif *vif) 174 { 175 struct rtw89_dev *rtwdev = hw->priv; 176 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 177 178 rtw89_debug(rtwdev, RTW89_DBG_STATE, "remove vif %pM type %d p2p %d\n", 179 vif->addr, vif->type, vif->p2p); 180 181 cancel_work_sync(&rtwvif->update_beacon_work); 182 cancel_delayed_work_sync(&rtwvif->roc.roc_work); 183 184 mutex_lock(&rtwdev->mutex); 185 rtw89_leave_ps_mode(rtwdev); 186 rtw89_btc_ntfy_role_info(rtwdev, rtwvif, NULL, BTC_ROLE_STOP); 187 rtw89_mac_remove_vif(rtwdev, rtwvif); 188 rtw89_core_release_bit_map(rtwdev->hw_port, rtwvif->port); 189 list_del_init(&rtwvif->list); 190 rtw89_recalc_lps(rtwdev); 191 rtw89_enter_ips_by_hwflags(rtwdev); 192 193 mutex_unlock(&rtwdev->mutex); 194 } 195 196 static int rtw89_ops_change_interface(struct ieee80211_hw *hw, 197 struct ieee80211_vif *vif, 198 enum nl80211_iftype type, bool p2p) 199 { 200 struct rtw89_dev *rtwdev = hw->priv; 201 int ret; 202 203 set_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags); 204 205 rtw89_debug(rtwdev, RTW89_DBG_STATE, "change vif %pM (%d)->(%d), p2p (%d)->(%d)\n", 206 vif->addr, vif->type, type, vif->p2p, p2p); 207 208 rtw89_ops_remove_interface(hw, vif); 209 210 vif->type = type; 211 vif->p2p = p2p; 212 213 ret = rtw89_ops_add_interface(hw, vif); 214 if (ret) 215 rtw89_warn(rtwdev, "failed to change interface %d\n", ret); 216 217 clear_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags); 218 219 return ret; 220 } 221 222 static void rtw89_ops_configure_filter(struct ieee80211_hw *hw, 223 unsigned int changed_flags, 224 unsigned int *new_flags, 225 u64 multicast) 226 { 227 struct rtw89_dev *rtwdev = hw->priv; 228 const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def; 229 u32 rx_fltr; 230 231 mutex_lock(&rtwdev->mutex); 232 rtw89_leave_ps_mode(rtwdev); 233 234 *new_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_FCSFAIL | 235 FIF_BCN_PRBRESP_PROMISC | FIF_PROBE_REQ; 236 237 if (changed_flags & FIF_ALLMULTI) { 238 if (*new_flags & FIF_ALLMULTI) 239 rtwdev->hal.rx_fltr &= ~B_AX_A_MC; 240 else 241 rtwdev->hal.rx_fltr |= B_AX_A_MC; 242 } 243 if (changed_flags & FIF_FCSFAIL) { 244 if (*new_flags & FIF_FCSFAIL) 245 rtwdev->hal.rx_fltr |= B_AX_A_CRC32_ERR; 246 else 247 rtwdev->hal.rx_fltr &= ~B_AX_A_CRC32_ERR; 248 } 249 if (changed_flags & FIF_OTHER_BSS) { 250 if (*new_flags & FIF_OTHER_BSS) 251 rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH; 252 else 253 rtwdev->hal.rx_fltr |= B_AX_A_A1_MATCH; 254 } 255 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { 256 if (*new_flags & FIF_BCN_PRBRESP_PROMISC) { 257 rtwdev->hal.rx_fltr &= ~B_AX_A_BCN_CHK_EN; 258 rtwdev->hal.rx_fltr &= ~B_AX_A_BC; 259 rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH; 260 } else { 261 rtwdev->hal.rx_fltr |= B_AX_A_BCN_CHK_EN; 262 rtwdev->hal.rx_fltr |= B_AX_A_BC; 263 rtwdev->hal.rx_fltr |= B_AX_A_A1_MATCH; 264 } 265 } 266 if (changed_flags & FIF_PROBE_REQ) { 267 if (*new_flags & FIF_PROBE_REQ) { 268 rtwdev->hal.rx_fltr &= ~B_AX_A_BC_CAM_MATCH; 269 rtwdev->hal.rx_fltr &= ~B_AX_A_UC_CAM_MATCH; 270 } else { 271 rtwdev->hal.rx_fltr |= B_AX_A_BC_CAM_MATCH; 272 rtwdev->hal.rx_fltr |= B_AX_A_UC_CAM_MATCH; 273 } 274 } 275 276 rx_fltr = rtwdev->hal.rx_fltr; 277 278 /* mac80211 doesn't configure filter when HW scan, driver need to 279 * set by itself. However, during P2P scan might have configure 280 * filter to overwrite filter that HW scan needed, so we need to 281 * check scan and append related filter 282 */ 283 if (rtwdev->scanning) { 284 rx_fltr &= ~B_AX_A_BCN_CHK_EN; 285 rx_fltr &= ~B_AX_A_BC; 286 rx_fltr &= ~B_AX_A_A1_MATCH; 287 } 288 289 rtw89_write32_mask(rtwdev, 290 rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_0), 291 B_AX_RX_FLTR_CFG_MASK, 292 rx_fltr); 293 if (!rtwdev->dbcc_en) 294 goto out; 295 rtw89_write32_mask(rtwdev, 296 rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_1), 297 B_AX_RX_FLTR_CFG_MASK, 298 rx_fltr); 299 300 out: 301 mutex_unlock(&rtwdev->mutex); 302 } 303 304 static const u8 ac_to_fw_idx[IEEE80211_NUM_ACS] = { 305 [IEEE80211_AC_VO] = 3, 306 [IEEE80211_AC_VI] = 2, 307 [IEEE80211_AC_BE] = 0, 308 [IEEE80211_AC_BK] = 1, 309 }; 310 311 static u8 rtw89_aifsn_to_aifs(struct rtw89_dev *rtwdev, 312 struct rtw89_vif *rtwvif, u8 aifsn) 313 { 314 struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif); 315 const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, 316 rtwvif->sub_entity_idx); 317 u8 slot_time; 318 u8 sifs; 319 320 slot_time = vif->bss_conf.use_short_slot ? 9 : 20; 321 sifs = chan->band_type == RTW89_BAND_5G ? 16 : 10; 322 323 return aifsn * slot_time + sifs; 324 } 325 326 static void ____rtw89_conf_tx_edca(struct rtw89_dev *rtwdev, 327 struct rtw89_vif *rtwvif, u16 ac) 328 { 329 struct ieee80211_tx_queue_params *params = &rtwvif->tx_params[ac]; 330 u32 val; 331 u8 ecw_max, ecw_min; 332 u8 aifs; 333 334 /* 2^ecw - 1 = cw; ecw = log2(cw + 1) */ 335 ecw_max = ilog2(params->cw_max + 1); 336 ecw_min = ilog2(params->cw_min + 1); 337 aifs = rtw89_aifsn_to_aifs(rtwdev, rtwvif, params->aifs); 338 val = FIELD_PREP(FW_EDCA_PARAM_TXOPLMT_MSK, params->txop) | 339 FIELD_PREP(FW_EDCA_PARAM_CWMAX_MSK, ecw_max) | 340 FIELD_PREP(FW_EDCA_PARAM_CWMIN_MSK, ecw_min) | 341 FIELD_PREP(FW_EDCA_PARAM_AIFS_MSK, aifs); 342 rtw89_fw_h2c_set_edca(rtwdev, rtwvif, ac_to_fw_idx[ac], val); 343 } 344 345 #define R_MUEDCA_ACS_PARAM(acs) {R_AX_MUEDCA_ ## acs ## _PARAM_0, \ 346 R_BE_MUEDCA_ ## acs ## _PARAM_0} 347 348 static const u32 ac_to_mu_edca_param[IEEE80211_NUM_ACS][RTW89_CHIP_GEN_NUM] = { 349 [IEEE80211_AC_VO] = R_MUEDCA_ACS_PARAM(VO), 350 [IEEE80211_AC_VI] = R_MUEDCA_ACS_PARAM(VI), 351 [IEEE80211_AC_BE] = R_MUEDCA_ACS_PARAM(BE), 352 [IEEE80211_AC_BK] = R_MUEDCA_ACS_PARAM(BK), 353 }; 354 355 static void ____rtw89_conf_tx_mu_edca(struct rtw89_dev *rtwdev, 356 struct rtw89_vif *rtwvif, u16 ac) 357 { 358 struct ieee80211_tx_queue_params *params = &rtwvif->tx_params[ac]; 359 struct ieee80211_he_mu_edca_param_ac_rec *mu_edca; 360 int gen = rtwdev->chip->chip_gen; 361 u8 aifs, aifsn; 362 u16 timer_32us; 363 u32 reg; 364 u32 val; 365 366 if (!params->mu_edca) 367 return; 368 369 mu_edca = ¶ms->mu_edca_param_rec; 370 aifsn = FIELD_GET(GENMASK(3, 0), mu_edca->aifsn); 371 aifs = aifsn ? rtw89_aifsn_to_aifs(rtwdev, rtwvif, aifsn) : 0; 372 timer_32us = mu_edca->mu_edca_timer << 8; 373 374 val = FIELD_PREP(B_AX_MUEDCA_BE_PARAM_0_TIMER_MASK, timer_32us) | 375 FIELD_PREP(B_AX_MUEDCA_BE_PARAM_0_CW_MASK, mu_edca->ecw_min_max) | 376 FIELD_PREP(B_AX_MUEDCA_BE_PARAM_0_AIFS_MASK, aifs); 377 reg = rtw89_mac_reg_by_idx(rtwdev, ac_to_mu_edca_param[ac][gen], rtwvif->mac_idx); 378 rtw89_write32(rtwdev, reg, val); 379 380 rtw89_mac_set_hw_muedca_ctrl(rtwdev, rtwvif, true); 381 } 382 383 static void __rtw89_conf_tx(struct rtw89_dev *rtwdev, 384 struct rtw89_vif *rtwvif, u16 ac) 385 { 386 ____rtw89_conf_tx_edca(rtwdev, rtwvif, ac); 387 ____rtw89_conf_tx_mu_edca(rtwdev, rtwvif, ac); 388 } 389 390 static void rtw89_conf_tx(struct rtw89_dev *rtwdev, 391 struct rtw89_vif *rtwvif) 392 { 393 u16 ac; 394 395 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 396 __rtw89_conf_tx(rtwdev, rtwvif, ac); 397 } 398 399 static void rtw89_station_mode_sta_assoc(struct rtw89_dev *rtwdev, 400 struct ieee80211_vif *vif, 401 struct ieee80211_bss_conf *conf) 402 { 403 struct ieee80211_sta *sta; 404 405 if (vif->type != NL80211_IFTYPE_STATION) 406 return; 407 408 sta = ieee80211_find_sta(vif, conf->bssid); 409 if (!sta) { 410 rtw89_err(rtwdev, "can't find sta to set sta_assoc state\n"); 411 return; 412 } 413 414 rtw89_vif_type_mapping(vif, true); 415 416 rtw89_core_sta_assoc(rtwdev, vif, sta); 417 } 418 419 static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw, 420 struct ieee80211_vif *vif, 421 struct ieee80211_bss_conf *conf, 422 u64 changed) 423 { 424 struct rtw89_dev *rtwdev = hw->priv; 425 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 426 427 mutex_lock(&rtwdev->mutex); 428 rtw89_leave_ps_mode(rtwdev); 429 430 if (changed & BSS_CHANGED_ASSOC) { 431 if (vif->cfg.assoc) { 432 rtw89_station_mode_sta_assoc(rtwdev, vif, conf); 433 rtw89_phy_set_bss_color(rtwdev, vif); 434 rtw89_chip_cfg_txpwr_ul_tb_offset(rtwdev, vif); 435 rtw89_mac_port_update(rtwdev, rtwvif); 436 rtw89_mac_set_he_obss_narrow_bw_ru(rtwdev, vif); 437 438 rtw89_queue_chanctx_work(rtwdev); 439 } else { 440 /* Abort ongoing scan if cancel_scan isn't issued 441 * when disconnected by peer 442 */ 443 if (rtwdev->scanning) 444 rtw89_hw_scan_abort(rtwdev, vif); 445 } 446 } 447 448 if (changed & BSS_CHANGED_BSSID) { 449 ether_addr_copy(rtwvif->bssid, conf->bssid); 450 rtw89_cam_bssid_changed(rtwdev, rtwvif); 451 rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL, NULL); 452 } 453 454 if (changed & BSS_CHANGED_BEACON) 455 rtw89_fw_h2c_update_beacon(rtwdev, rtwvif); 456 457 if (changed & BSS_CHANGED_ERP_SLOT) 458 rtw89_conf_tx(rtwdev, rtwvif); 459 460 if (changed & BSS_CHANGED_HE_BSS_COLOR) 461 rtw89_phy_set_bss_color(rtwdev, vif); 462 463 if (changed & BSS_CHANGED_MU_GROUPS) 464 rtw89_mac_bf_set_gid_table(rtwdev, vif, conf); 465 466 if (changed & BSS_CHANGED_P2P_PS) 467 rtw89_core_update_p2p_ps(rtwdev, vif); 468 469 if (changed & BSS_CHANGED_CQM) 470 rtw89_fw_h2c_set_bcn_fltr_cfg(rtwdev, vif, true); 471 472 if (changed & BSS_CHANGED_PS) 473 rtw89_recalc_lps(rtwdev); 474 475 mutex_unlock(&rtwdev->mutex); 476 } 477 478 static int rtw89_ops_start_ap(struct ieee80211_hw *hw, 479 struct ieee80211_vif *vif, 480 struct ieee80211_bss_conf *link_conf) 481 { 482 struct rtw89_dev *rtwdev = hw->priv; 483 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 484 const struct rtw89_chan *chan; 485 486 mutex_lock(&rtwdev->mutex); 487 488 chan = rtw89_chan_get(rtwdev, rtwvif->sub_entity_idx); 489 if (chan->band_type == RTW89_BAND_6G) { 490 mutex_unlock(&rtwdev->mutex); 491 return -EOPNOTSUPP; 492 } 493 494 if (rtwdev->scanning) 495 rtw89_hw_scan_abort(rtwdev, rtwdev->scan_info.scanning_vif); 496 497 ether_addr_copy(rtwvif->bssid, vif->bss_conf.bssid); 498 rtw89_cam_bssid_changed(rtwdev, rtwvif); 499 rtw89_mac_port_update(rtwdev, rtwvif); 500 rtw89_fw_h2c_assoc_cmac_tbl(rtwdev, vif, NULL); 501 rtw89_fw_h2c_role_maintain(rtwdev, rtwvif, NULL, RTW89_ROLE_TYPE_CHANGE); 502 rtw89_fw_h2c_join_info(rtwdev, rtwvif, NULL, true); 503 rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL, NULL); 504 rtw89_chip_rfk_channel(rtwdev); 505 506 rtw89_queue_chanctx_work(rtwdev); 507 mutex_unlock(&rtwdev->mutex); 508 509 return 0; 510 } 511 512 static 513 void rtw89_ops_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 514 struct ieee80211_bss_conf *link_conf) 515 { 516 struct rtw89_dev *rtwdev = hw->priv; 517 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 518 519 mutex_lock(&rtwdev->mutex); 520 rtw89_mac_stop_ap(rtwdev, rtwvif); 521 rtw89_fw_h2c_assoc_cmac_tbl(rtwdev, vif, NULL); 522 rtw89_fw_h2c_join_info(rtwdev, rtwvif, NULL, true); 523 mutex_unlock(&rtwdev->mutex); 524 } 525 526 static int rtw89_ops_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 527 bool set) 528 { 529 struct rtw89_dev *rtwdev = hw->priv; 530 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 531 struct rtw89_vif *rtwvif = rtwsta->rtwvif; 532 533 ieee80211_queue_work(rtwdev->hw, &rtwvif->update_beacon_work); 534 535 return 0; 536 } 537 538 static int rtw89_ops_conf_tx(struct ieee80211_hw *hw, 539 struct ieee80211_vif *vif, 540 unsigned int link_id, u16 ac, 541 const struct ieee80211_tx_queue_params *params) 542 { 543 struct rtw89_dev *rtwdev = hw->priv; 544 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 545 546 mutex_lock(&rtwdev->mutex); 547 rtw89_leave_ps_mode(rtwdev); 548 rtwvif->tx_params[ac] = *params; 549 __rtw89_conf_tx(rtwdev, rtwvif, ac); 550 mutex_unlock(&rtwdev->mutex); 551 552 return 0; 553 } 554 555 static int __rtw89_ops_sta_state(struct ieee80211_hw *hw, 556 struct ieee80211_vif *vif, 557 struct ieee80211_sta *sta, 558 enum ieee80211_sta_state old_state, 559 enum ieee80211_sta_state new_state) 560 { 561 struct rtw89_dev *rtwdev = hw->priv; 562 563 if (old_state == IEEE80211_STA_NOTEXIST && 564 new_state == IEEE80211_STA_NONE) 565 return rtw89_core_sta_add(rtwdev, vif, sta); 566 567 if (old_state == IEEE80211_STA_AUTH && 568 new_state == IEEE80211_STA_ASSOC) { 569 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) 570 return 0; /* defer to bss_info_changed to have vif info */ 571 return rtw89_core_sta_assoc(rtwdev, vif, sta); 572 } 573 574 if (old_state == IEEE80211_STA_ASSOC && 575 new_state == IEEE80211_STA_AUTH) 576 return rtw89_core_sta_disassoc(rtwdev, vif, sta); 577 578 if (old_state == IEEE80211_STA_AUTH && 579 new_state == IEEE80211_STA_NONE) 580 return rtw89_core_sta_disconnect(rtwdev, vif, sta); 581 582 if (old_state == IEEE80211_STA_NONE && 583 new_state == IEEE80211_STA_NOTEXIST) 584 return rtw89_core_sta_remove(rtwdev, vif, sta); 585 586 return 0; 587 } 588 589 static int rtw89_ops_sta_state(struct ieee80211_hw *hw, 590 struct ieee80211_vif *vif, 591 struct ieee80211_sta *sta, 592 enum ieee80211_sta_state old_state, 593 enum ieee80211_sta_state new_state) 594 { 595 struct rtw89_dev *rtwdev = hw->priv; 596 int ret; 597 598 mutex_lock(&rtwdev->mutex); 599 rtw89_leave_ps_mode(rtwdev); 600 ret = __rtw89_ops_sta_state(hw, vif, sta, old_state, new_state); 601 mutex_unlock(&rtwdev->mutex); 602 603 return ret; 604 } 605 606 static int rtw89_ops_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 607 struct ieee80211_vif *vif, 608 struct ieee80211_sta *sta, 609 struct ieee80211_key_conf *key) 610 { 611 struct rtw89_dev *rtwdev = hw->priv; 612 int ret = 0; 613 614 mutex_lock(&rtwdev->mutex); 615 rtw89_leave_ps_mode(rtwdev); 616 617 switch (cmd) { 618 case SET_KEY: 619 rtw89_btc_ntfy_specific_packet(rtwdev, PACKET_EAPOL_END); 620 ret = rtw89_cam_sec_key_add(rtwdev, vif, sta, key); 621 if (ret && ret != -EOPNOTSUPP) { 622 rtw89_err(rtwdev, "failed to add key to sec cam\n"); 623 goto out; 624 } 625 break; 626 case DISABLE_KEY: 627 rtw89_hci_flush_queues(rtwdev, BIT(rtwdev->hw->queues) - 1, 628 false); 629 rtw89_mac_flush_txq(rtwdev, BIT(rtwdev->hw->queues) - 1, false); 630 ret = rtw89_cam_sec_key_del(rtwdev, vif, sta, key, true); 631 if (ret) { 632 rtw89_err(rtwdev, "failed to remove key from sec cam\n"); 633 goto out; 634 } 635 break; 636 } 637 638 out: 639 mutex_unlock(&rtwdev->mutex); 640 641 return ret; 642 } 643 644 static int rtw89_ops_ampdu_action(struct ieee80211_hw *hw, 645 struct ieee80211_vif *vif, 646 struct ieee80211_ampdu_params *params) 647 { 648 struct rtw89_dev *rtwdev = hw->priv; 649 struct ieee80211_sta *sta = params->sta; 650 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 651 u16 tid = params->tid; 652 struct ieee80211_txq *txq = sta->txq[tid]; 653 struct rtw89_txq *rtwtxq = (struct rtw89_txq *)txq->drv_priv; 654 655 switch (params->action) { 656 case IEEE80211_AMPDU_TX_START: 657 return IEEE80211_AMPDU_TX_START_IMMEDIATE; 658 case IEEE80211_AMPDU_TX_STOP_CONT: 659 case IEEE80211_AMPDU_TX_STOP_FLUSH: 660 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: 661 mutex_lock(&rtwdev->mutex); 662 clear_bit(RTW89_TXQ_F_AMPDU, &rtwtxq->flags); 663 mutex_unlock(&rtwdev->mutex); 664 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 665 break; 666 case IEEE80211_AMPDU_TX_OPERATIONAL: 667 mutex_lock(&rtwdev->mutex); 668 set_bit(RTW89_TXQ_F_AMPDU, &rtwtxq->flags); 669 rtwsta->ampdu_params[tid].agg_num = params->buf_size; 670 rtwsta->ampdu_params[tid].amsdu = params->amsdu; 671 rtw89_leave_ps_mode(rtwdev); 672 mutex_unlock(&rtwdev->mutex); 673 break; 674 case IEEE80211_AMPDU_RX_START: 675 mutex_lock(&rtwdev->mutex); 676 rtw89_fw_h2c_ba_cam(rtwdev, rtwsta, true, params); 677 mutex_unlock(&rtwdev->mutex); 678 break; 679 case IEEE80211_AMPDU_RX_STOP: 680 mutex_lock(&rtwdev->mutex); 681 rtw89_fw_h2c_ba_cam(rtwdev, rtwsta, false, params); 682 mutex_unlock(&rtwdev->mutex); 683 break; 684 default: 685 WARN_ON(1); 686 return -ENOTSUPP; 687 } 688 689 return 0; 690 } 691 692 static int rtw89_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value) 693 { 694 struct rtw89_dev *rtwdev = hw->priv; 695 696 mutex_lock(&rtwdev->mutex); 697 rtw89_leave_ps_mode(rtwdev); 698 if (test_bit(RTW89_FLAG_POWERON, rtwdev->flags)) 699 rtw89_mac_update_rts_threshold(rtwdev, RTW89_MAC_0); 700 mutex_unlock(&rtwdev->mutex); 701 702 return 0; 703 } 704 705 static void rtw89_ops_sta_statistics(struct ieee80211_hw *hw, 706 struct ieee80211_vif *vif, 707 struct ieee80211_sta *sta, 708 struct station_info *sinfo) 709 { 710 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 711 712 sinfo->txrate = rtwsta->ra_report.txrate; 713 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); 714 } 715 716 static 717 void __rtw89_drop_packets(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif) 718 { 719 struct rtw89_vif *rtwvif; 720 721 if (vif) { 722 rtwvif = (struct rtw89_vif *)vif->drv_priv; 723 rtw89_mac_pkt_drop_vif(rtwdev, rtwvif); 724 } else { 725 rtw89_for_each_rtwvif(rtwdev, rtwvif) 726 rtw89_mac_pkt_drop_vif(rtwdev, rtwvif); 727 } 728 } 729 730 static void rtw89_ops_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 731 u32 queues, bool drop) 732 { 733 struct rtw89_dev *rtwdev = hw->priv; 734 735 mutex_lock(&rtwdev->mutex); 736 rtw89_leave_lps(rtwdev); 737 rtw89_hci_flush_queues(rtwdev, queues, drop); 738 739 if (drop && !RTW89_CHK_FW_FEATURE(NO_PACKET_DROP, &rtwdev->fw)) 740 __rtw89_drop_packets(rtwdev, vif); 741 else 742 rtw89_mac_flush_txq(rtwdev, queues, drop); 743 744 mutex_unlock(&rtwdev->mutex); 745 } 746 747 struct rtw89_iter_bitrate_mask_data { 748 struct rtw89_dev *rtwdev; 749 struct ieee80211_vif *vif; 750 const struct cfg80211_bitrate_mask *mask; 751 }; 752 753 static void rtw89_ra_mask_info_update_iter(void *data, struct ieee80211_sta *sta) 754 { 755 struct rtw89_iter_bitrate_mask_data *br_data = data; 756 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 757 struct ieee80211_vif *vif = rtwvif_to_vif(rtwsta->rtwvif); 758 759 if (vif != br_data->vif || vif->p2p) 760 return; 761 762 rtwsta->use_cfg_mask = true; 763 rtwsta->mask = *br_data->mask; 764 rtw89_phy_ra_updata_sta(br_data->rtwdev, sta, IEEE80211_RC_SUPP_RATES_CHANGED); 765 } 766 767 static void rtw89_ra_mask_info_update(struct rtw89_dev *rtwdev, 768 struct ieee80211_vif *vif, 769 const struct cfg80211_bitrate_mask *mask) 770 { 771 struct rtw89_iter_bitrate_mask_data br_data = { .rtwdev = rtwdev, 772 .vif = vif, 773 .mask = mask}; 774 775 ieee80211_iterate_stations_atomic(rtwdev->hw, rtw89_ra_mask_info_update_iter, 776 &br_data); 777 } 778 779 static int rtw89_ops_set_bitrate_mask(struct ieee80211_hw *hw, 780 struct ieee80211_vif *vif, 781 const struct cfg80211_bitrate_mask *mask) 782 { 783 struct rtw89_dev *rtwdev = hw->priv; 784 785 mutex_lock(&rtwdev->mutex); 786 rtw89_phy_rate_pattern_vif(rtwdev, vif, mask); 787 rtw89_ra_mask_info_update(rtwdev, vif, mask); 788 mutex_unlock(&rtwdev->mutex); 789 790 return 0; 791 } 792 793 static 794 int rtw89_ops_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) 795 { 796 struct rtw89_dev *rtwdev = hw->priv; 797 struct rtw89_hal *hal = &rtwdev->hal; 798 799 if (hal->ant_diversity) { 800 if (tx_ant != rx_ant || hweight32(tx_ant) != 1) 801 return -EINVAL; 802 } else if (rx_ant != hw->wiphy->available_antennas_rx && rx_ant != hal->antenna_rx) { 803 return -EINVAL; 804 } 805 806 mutex_lock(&rtwdev->mutex); 807 hal->antenna_tx = tx_ant; 808 hal->antenna_rx = rx_ant; 809 hal->tx_path_diversity = false; 810 hal->ant_diversity_fixed = true; 811 mutex_unlock(&rtwdev->mutex); 812 813 return 0; 814 } 815 816 static 817 int rtw89_ops_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) 818 { 819 struct rtw89_dev *rtwdev = hw->priv; 820 struct rtw89_hal *hal = &rtwdev->hal; 821 822 *tx_ant = hal->antenna_tx; 823 *rx_ant = hal->antenna_rx; 824 825 return 0; 826 } 827 828 static void rtw89_ops_sw_scan_start(struct ieee80211_hw *hw, 829 struct ieee80211_vif *vif, 830 const u8 *mac_addr) 831 { 832 struct rtw89_dev *rtwdev = hw->priv; 833 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 834 835 mutex_lock(&rtwdev->mutex); 836 rtw89_core_scan_start(rtwdev, rtwvif, mac_addr, false); 837 mutex_unlock(&rtwdev->mutex); 838 } 839 840 static void rtw89_ops_sw_scan_complete(struct ieee80211_hw *hw, 841 struct ieee80211_vif *vif) 842 { 843 struct rtw89_dev *rtwdev = hw->priv; 844 845 mutex_lock(&rtwdev->mutex); 846 rtw89_core_scan_complete(rtwdev, vif, false); 847 mutex_unlock(&rtwdev->mutex); 848 } 849 850 static void rtw89_ops_reconfig_complete(struct ieee80211_hw *hw, 851 enum ieee80211_reconfig_type reconfig_type) 852 { 853 struct rtw89_dev *rtwdev = hw->priv; 854 855 if (reconfig_type == IEEE80211_RECONFIG_TYPE_RESTART) 856 rtw89_ser_recfg_done(rtwdev); 857 } 858 859 static int rtw89_ops_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 860 struct ieee80211_scan_request *req) 861 { 862 struct rtw89_dev *rtwdev = hw->priv; 863 struct rtw89_vif *rtwvif = vif_to_rtwvif_safe(vif); 864 int ret = 0; 865 866 if (!RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) 867 return 1; 868 869 if (rtwdev->scanning || rtwvif->offchan) 870 return -EBUSY; 871 872 mutex_lock(&rtwdev->mutex); 873 rtw89_hw_scan_start(rtwdev, vif, req); 874 ret = rtw89_hw_scan_offload(rtwdev, vif, true); 875 if (ret) { 876 rtw89_hw_scan_abort(rtwdev, vif); 877 rtw89_err(rtwdev, "HW scan failed with status: %d\n", ret); 878 } 879 mutex_unlock(&rtwdev->mutex); 880 881 return ret; 882 } 883 884 static void rtw89_ops_cancel_hw_scan(struct ieee80211_hw *hw, 885 struct ieee80211_vif *vif) 886 { 887 struct rtw89_dev *rtwdev = hw->priv; 888 889 if (!RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) 890 return; 891 892 if (!rtwdev->scanning) 893 return; 894 895 mutex_lock(&rtwdev->mutex); 896 rtw89_hw_scan_abort(rtwdev, vif); 897 mutex_unlock(&rtwdev->mutex); 898 } 899 900 static void rtw89_ops_sta_rc_update(struct ieee80211_hw *hw, 901 struct ieee80211_vif *vif, 902 struct ieee80211_sta *sta, u32 changed) 903 { 904 struct rtw89_dev *rtwdev = hw->priv; 905 906 rtw89_phy_ra_updata_sta(rtwdev, sta, changed); 907 } 908 909 static int rtw89_ops_add_chanctx(struct ieee80211_hw *hw, 910 struct ieee80211_chanctx_conf *ctx) 911 { 912 struct rtw89_dev *rtwdev = hw->priv; 913 int ret; 914 915 mutex_lock(&rtwdev->mutex); 916 ret = rtw89_chanctx_ops_add(rtwdev, ctx); 917 mutex_unlock(&rtwdev->mutex); 918 919 return ret; 920 } 921 922 static void rtw89_ops_remove_chanctx(struct ieee80211_hw *hw, 923 struct ieee80211_chanctx_conf *ctx) 924 { 925 struct rtw89_dev *rtwdev = hw->priv; 926 927 mutex_lock(&rtwdev->mutex); 928 rtw89_chanctx_ops_remove(rtwdev, ctx); 929 mutex_unlock(&rtwdev->mutex); 930 } 931 932 static void rtw89_ops_change_chanctx(struct ieee80211_hw *hw, 933 struct ieee80211_chanctx_conf *ctx, 934 u32 changed) 935 { 936 struct rtw89_dev *rtwdev = hw->priv; 937 938 mutex_lock(&rtwdev->mutex); 939 rtw89_chanctx_ops_change(rtwdev, ctx, changed); 940 mutex_unlock(&rtwdev->mutex); 941 } 942 943 static int rtw89_ops_assign_vif_chanctx(struct ieee80211_hw *hw, 944 struct ieee80211_vif *vif, 945 struct ieee80211_bss_conf *link_conf, 946 struct ieee80211_chanctx_conf *ctx) 947 { 948 struct rtw89_dev *rtwdev = hw->priv; 949 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 950 int ret; 951 952 mutex_lock(&rtwdev->mutex); 953 ret = rtw89_chanctx_ops_assign_vif(rtwdev, rtwvif, ctx); 954 mutex_unlock(&rtwdev->mutex); 955 956 return ret; 957 } 958 959 static void rtw89_ops_unassign_vif_chanctx(struct ieee80211_hw *hw, 960 struct ieee80211_vif *vif, 961 struct ieee80211_bss_conf *link_conf, 962 struct ieee80211_chanctx_conf *ctx) 963 { 964 struct rtw89_dev *rtwdev = hw->priv; 965 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; 966 967 mutex_lock(&rtwdev->mutex); 968 rtw89_chanctx_ops_unassign_vif(rtwdev, rtwvif, ctx); 969 mutex_unlock(&rtwdev->mutex); 970 } 971 972 static int rtw89_ops_remain_on_channel(struct ieee80211_hw *hw, 973 struct ieee80211_vif *vif, 974 struct ieee80211_channel *chan, 975 int duration, 976 enum ieee80211_roc_type type) 977 { 978 struct rtw89_dev *rtwdev = hw->priv; 979 struct rtw89_vif *rtwvif = vif_to_rtwvif_safe(vif); 980 struct rtw89_roc *roc = &rtwvif->roc; 981 982 if (!vif) 983 return -EINVAL; 984 985 mutex_lock(&rtwdev->mutex); 986 987 if (roc->state != RTW89_ROC_IDLE) { 988 mutex_unlock(&rtwdev->mutex); 989 return -EBUSY; 990 } 991 992 if (rtwdev->scanning) 993 rtw89_hw_scan_abort(rtwdev, vif); 994 995 if (type == IEEE80211_ROC_TYPE_MGMT_TX) 996 roc->state = RTW89_ROC_MGMT; 997 else 998 roc->state = RTW89_ROC_NORMAL; 999 1000 roc->duration = duration; 1001 roc->chan = *chan; 1002 roc->type = type; 1003 1004 rtw89_roc_start(rtwdev, rtwvif); 1005 1006 mutex_unlock(&rtwdev->mutex); 1007 1008 return 0; 1009 } 1010 1011 static int rtw89_ops_cancel_remain_on_channel(struct ieee80211_hw *hw, 1012 struct ieee80211_vif *vif) 1013 { 1014 struct rtw89_dev *rtwdev = hw->priv; 1015 struct rtw89_vif *rtwvif = vif_to_rtwvif_safe(vif); 1016 1017 if (!rtwvif) 1018 return -EINVAL; 1019 1020 cancel_delayed_work_sync(&rtwvif->roc.roc_work); 1021 1022 mutex_lock(&rtwdev->mutex); 1023 rtw89_roc_end(rtwdev, rtwvif); 1024 mutex_unlock(&rtwdev->mutex); 1025 1026 return 0; 1027 } 1028 1029 static void rtw89_set_tid_config_iter(void *data, struct ieee80211_sta *sta) 1030 { 1031 struct cfg80211_tid_config *tid_config = data; 1032 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 1033 struct rtw89_dev *rtwdev = rtwsta->rtwvif->rtwdev; 1034 1035 rtw89_core_set_tid_config(rtwdev, sta, tid_config); 1036 } 1037 1038 static int rtw89_ops_set_tid_config(struct ieee80211_hw *hw, 1039 struct ieee80211_vif *vif, 1040 struct ieee80211_sta *sta, 1041 struct cfg80211_tid_config *tid_config) 1042 { 1043 struct rtw89_dev *rtwdev = hw->priv; 1044 1045 mutex_lock(&rtwdev->mutex); 1046 if (sta) 1047 rtw89_core_set_tid_config(rtwdev, sta, tid_config); 1048 else 1049 ieee80211_iterate_stations_atomic(rtwdev->hw, 1050 rtw89_set_tid_config_iter, 1051 tid_config); 1052 mutex_unlock(&rtwdev->mutex); 1053 1054 return 0; 1055 } 1056 1057 #ifdef CONFIG_PM 1058 static int rtw89_ops_suspend(struct ieee80211_hw *hw, 1059 struct cfg80211_wowlan *wowlan) 1060 { 1061 struct rtw89_dev *rtwdev = hw->priv; 1062 int ret; 1063 1064 set_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags); 1065 cancel_delayed_work_sync(&rtwdev->track_work); 1066 1067 mutex_lock(&rtwdev->mutex); 1068 ret = rtw89_wow_suspend(rtwdev, wowlan); 1069 mutex_unlock(&rtwdev->mutex); 1070 1071 if (ret) { 1072 rtw89_warn(rtwdev, "failed to suspend for wow %d\n", ret); 1073 clear_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags); 1074 return 1; 1075 } 1076 1077 return 0; 1078 } 1079 1080 static int rtw89_ops_resume(struct ieee80211_hw *hw) 1081 { 1082 struct rtw89_dev *rtwdev = hw->priv; 1083 int ret; 1084 1085 mutex_lock(&rtwdev->mutex); 1086 ret = rtw89_wow_resume(rtwdev); 1087 if (ret) 1088 rtw89_warn(rtwdev, "failed to resume for wow %d\n", ret); 1089 mutex_unlock(&rtwdev->mutex); 1090 1091 clear_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags); 1092 ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->track_work, 1093 RTW89_TRACK_WORK_PERIOD); 1094 1095 return ret ? 1 : 0; 1096 } 1097 1098 static void rtw89_ops_set_wakeup(struct ieee80211_hw *hw, bool enabled) 1099 { 1100 struct rtw89_dev *rtwdev = hw->priv; 1101 1102 device_set_wakeup_enable(rtwdev->dev, enabled); 1103 } 1104 #endif 1105 1106 const struct ieee80211_ops rtw89_ops = { 1107 .tx = rtw89_ops_tx, 1108 .wake_tx_queue = rtw89_ops_wake_tx_queue, 1109 .start = rtw89_ops_start, 1110 .stop = rtw89_ops_stop, 1111 .config = rtw89_ops_config, 1112 .add_interface = rtw89_ops_add_interface, 1113 .change_interface = rtw89_ops_change_interface, 1114 .remove_interface = rtw89_ops_remove_interface, 1115 .configure_filter = rtw89_ops_configure_filter, 1116 .bss_info_changed = rtw89_ops_bss_info_changed, 1117 .start_ap = rtw89_ops_start_ap, 1118 .stop_ap = rtw89_ops_stop_ap, 1119 .set_tim = rtw89_ops_set_tim, 1120 .conf_tx = rtw89_ops_conf_tx, 1121 .sta_state = rtw89_ops_sta_state, 1122 .set_key = rtw89_ops_set_key, 1123 .ampdu_action = rtw89_ops_ampdu_action, 1124 .set_rts_threshold = rtw89_ops_set_rts_threshold, 1125 .sta_statistics = rtw89_ops_sta_statistics, 1126 .flush = rtw89_ops_flush, 1127 .set_bitrate_mask = rtw89_ops_set_bitrate_mask, 1128 .set_antenna = rtw89_ops_set_antenna, 1129 .get_antenna = rtw89_ops_get_antenna, 1130 .sw_scan_start = rtw89_ops_sw_scan_start, 1131 .sw_scan_complete = rtw89_ops_sw_scan_complete, 1132 .reconfig_complete = rtw89_ops_reconfig_complete, 1133 .hw_scan = rtw89_ops_hw_scan, 1134 .cancel_hw_scan = rtw89_ops_cancel_hw_scan, 1135 .add_chanctx = rtw89_ops_add_chanctx, 1136 .remove_chanctx = rtw89_ops_remove_chanctx, 1137 .change_chanctx = rtw89_ops_change_chanctx, 1138 .assign_vif_chanctx = rtw89_ops_assign_vif_chanctx, 1139 .unassign_vif_chanctx = rtw89_ops_unassign_vif_chanctx, 1140 .remain_on_channel = rtw89_ops_remain_on_channel, 1141 .cancel_remain_on_channel = rtw89_ops_cancel_remain_on_channel, 1142 .set_sar_specs = rtw89_ops_set_sar_specs, 1143 .sta_rc_update = rtw89_ops_sta_rc_update, 1144 .set_tid_config = rtw89_ops_set_tid_config, 1145 #ifdef CONFIG_PM 1146 .suspend = rtw89_ops_suspend, 1147 .resume = rtw89_ops_resume, 1148 .set_wakeup = rtw89_ops_set_wakeup, 1149 #endif 1150 }; 1151 EXPORT_SYMBOL(rtw89_ops); 1152