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