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