1 /******************************************************************************
3 * Copyright(c) 2009-2012 Realtek Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
37 #include <linux/export.h>
39 void rtl_fw_cb(const struct firmware
*firmware
, void *context
)
41 struct ieee80211_hw
*hw
= context
;
42 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
45 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_LOUD
,
46 "Firmware callback routine entered!\n");
47 complete(&rtlpriv
->firmware_loading_complete
);
49 pr_err("Firmware %s not available\n", rtlpriv
->cfg
->fw_name
);
50 rtlpriv
->max_fw_size
= 0;
53 if (firmware
->size
> rtlpriv
->max_fw_size
) {
54 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
55 "Firmware is too big!\n");
56 release_firmware(firmware
);
59 memcpy(rtlpriv
->rtlhal
.pfirmware
, firmware
->data
, firmware
->size
);
60 rtlpriv
->rtlhal
.fwsize
= firmware
->size
;
61 release_firmware(firmware
);
63 err
= ieee80211_register_hw(hw
);
65 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
66 "Can't register mac80211 hw\n");
69 rtlpriv
->mac80211
.mac80211_registered
= 1;
71 set_bit(RTL_STATUS_INTERFACE_START
, &rtlpriv
->status
);
76 EXPORT_SYMBOL(rtl_fw_cb
);
78 /*mutex for start & stop is must here. */
79 static int rtl_op_start(struct ieee80211_hw
*hw
)
82 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
83 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
85 if (!is_hal_stop(rtlhal
))
87 if (!test_bit(RTL_STATUS_INTERFACE_START
, &rtlpriv
->status
))
89 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
90 err
= rtlpriv
->intf_ops
->adapter_start(hw
);
92 rtl_watch_dog_timer_callback((unsigned long)hw
);
93 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
97 static void rtl_op_stop(struct ieee80211_hw
*hw
)
99 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
100 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
101 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
102 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
104 if (is_hal_stop(rtlhal
))
107 if (unlikely(ppsc
->rfpwr_state
== ERFOFF
)) {
112 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
114 mac
->link_state
= MAC80211_NOLINK
;
115 memset(mac
->bssid
, 0, 6);
116 mac
->vendor
= PEER_UNKNOWN
;
119 rtl_cam_reset_sec_info(hw
);
121 rtl_deinit_deferred_work(hw
);
122 rtlpriv
->intf_ops
->adapter_stop(hw
);
124 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
127 static void rtl_op_tx(struct ieee80211_hw
*hw
, struct sk_buff
*skb
)
129 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
130 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
131 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
132 struct rtl_tcb_desc tcb_desc
;
133 memset(&tcb_desc
, 0, sizeof(struct rtl_tcb_desc
));
135 if (unlikely(is_hal_stop(rtlhal
) || ppsc
->rfpwr_state
!= ERFON
))
138 if (!test_bit(RTL_STATUS_INTERFACE_START
, &rtlpriv
->status
))
141 if (!rtlpriv
->intf_ops
->waitq_insert(hw
, skb
))
142 rtlpriv
->intf_ops
->adapter_tx(hw
, skb
, &tcb_desc
);
147 dev_kfree_skb_any(skb
);
150 static int rtl_op_add_interface(struct ieee80211_hw
*hw
,
151 struct ieee80211_vif
*vif
)
153 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
154 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
157 vif
->driver_flags
|= IEEE80211_VIF_BEACON_FILTER
;
160 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
161 "vif has been set!! mac->vif = 0x%p\n", mac
->vif
);
167 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
169 case NL80211_IFTYPE_STATION
:
170 if (mac
->beacon_enabled
== 1) {
171 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
172 "NL80211_IFTYPE_STATION\n");
173 mac
->beacon_enabled
= 0;
174 rtlpriv
->cfg
->ops
->update_interrupt_mask(hw
, 0,
176 [RTL_IBSS_INT_MASKS
]);
179 case NL80211_IFTYPE_ADHOC
:
180 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
181 "NL80211_IFTYPE_ADHOC\n");
183 mac
->link_state
= MAC80211_LINKED
;
184 rtlpriv
->cfg
->ops
->set_bcn_reg(hw
);
185 if (rtlpriv
->rtlhal
.current_bandtype
== BAND_ON_2_4G
)
186 mac
->basic_rates
= 0xfff;
188 mac
->basic_rates
= 0xff0;
189 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_BASIC_RATE
,
190 (u8
*) (&mac
->basic_rates
));
193 case NL80211_IFTYPE_AP
:
194 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
195 "NL80211_IFTYPE_AP\n");
197 mac
->link_state
= MAC80211_LINKED
;
198 rtlpriv
->cfg
->ops
->set_bcn_reg(hw
);
199 if (rtlpriv
->rtlhal
.current_bandtype
== BAND_ON_2_4G
)
200 mac
->basic_rates
= 0xfff;
202 mac
->basic_rates
= 0xff0;
203 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_BASIC_RATE
,
204 (u8
*) (&mac
->basic_rates
));
207 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
208 "operation mode %d is not supported!\n", vif
->type
);
214 mac
->opmode
= vif
->type
;
215 rtlpriv
->cfg
->ops
->set_network_type(hw
, vif
->type
);
216 memcpy(mac
->mac_addr
, vif
->addr
, ETH_ALEN
);
217 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_ETHER_ADDR
, mac
->mac_addr
);
220 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
224 static void rtl_op_remove_interface(struct ieee80211_hw
*hw
,
225 struct ieee80211_vif
*vif
)
227 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
228 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
230 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
232 /* Free beacon resources */
233 if ((mac
->opmode
== NL80211_IFTYPE_AP
) ||
234 (mac
->opmode
== NL80211_IFTYPE_ADHOC
) ||
235 (mac
->opmode
== NL80211_IFTYPE_MESH_POINT
)) {
236 if (mac
->beacon_enabled
== 1) {
237 mac
->beacon_enabled
= 0;
238 rtlpriv
->cfg
->ops
->update_interrupt_mask(hw
, 0,
240 [RTL_IBSS_INT_MASKS
]);
245 *Note: We assume NL80211_IFTYPE_UNSPECIFIED as
246 *NO LINK for our hardware.
249 mac
->link_state
= MAC80211_NOLINK
;
250 memset(mac
->bssid
, 0, 6);
251 mac
->vendor
= PEER_UNKNOWN
;
252 mac
->opmode
= NL80211_IFTYPE_UNSPECIFIED
;
253 rtlpriv
->cfg
->ops
->set_network_type(hw
, mac
->opmode
);
254 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
257 static int rtl_op_config(struct ieee80211_hw
*hw
, u32 changed
)
259 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
260 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
261 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
262 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
263 struct ieee80211_conf
*conf
= &hw
->conf
;
265 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
266 if (changed
& IEEE80211_CONF_CHANGE_LISTEN_INTERVAL
) { /*BIT(2)*/
267 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
268 "IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n");
272 if (changed
& IEEE80211_CONF_CHANGE_IDLE
) {
273 if (hw
->conf
.flags
& IEEE80211_CONF_IDLE
)
279 *although rfoff may not cause by ips, but we will
280 *check the reason in set_rf_power_state function
282 if (unlikely(ppsc
->rfpwr_state
== ERFOFF
))
287 if (changed
& IEEE80211_CONF_CHANGE_PS
) {
288 cancel_delayed_work(&rtlpriv
->works
.ps_work
);
289 cancel_delayed_work(&rtlpriv
->works
.ps_rfon_wq
);
290 if (conf
->flags
& IEEE80211_CONF_PS
) {
291 rtlpriv
->psc
.sw_ps_enabled
= true;
292 /* sleep here is must, or we may recv the beacon and
293 * cause mac80211 into wrong ps state, this will cause
294 * power save nullfunc send fail, and further cause
295 * pkt loss, So sleep must quickly but not immediatly
296 * because that will cause nullfunc send by mac80211
297 * fail, and cause pkt loss, we have tested that 5mA
298 * is worked very well */
299 if (!rtlpriv
->psc
.multi_buffered
)
300 queue_delayed_work(rtlpriv
->works
.rtl_wq
,
301 &rtlpriv
->works
.ps_work
,
304 rtl_swlps_rf_awake(hw
);
305 rtlpriv
->psc
.sw_ps_enabled
= false;
309 if (changed
& IEEE80211_CONF_CHANGE_RETRY_LIMITS
) {
310 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
311 "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
312 hw
->conf
.long_frame_max_tx_count
);
313 mac
->retry_long
= hw
->conf
.long_frame_max_tx_count
;
314 mac
->retry_short
= hw
->conf
.long_frame_max_tx_count
;
315 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_RETRY_LIMIT
,
317 long_frame_max_tx_count
));
320 if (changed
& IEEE80211_CONF_CHANGE_CHANNEL
) {
321 struct ieee80211_channel
*channel
= hw
->conf
.channel
;
322 u8 wide_chan
= (u8
) channel
->hw_value
;
325 *because we should back channel to
326 *current_network.chan in in scanning,
327 *So if set_chan == current_network.chan
329 *because mac80211 tell us wrong bw40
330 *info for cisco1253 bw20, so we modify
331 *it here based on UPPER & LOWER
333 switch (hw
->conf
.channel_type
) {
334 case NL80211_CHAN_HT20
:
335 case NL80211_CHAN_NO_HT
:
337 mac
->cur_40_prime_sc
=
338 PRIME_CHNL_OFFSET_DONT_CARE
;
339 rtlphy
->current_chan_bw
= HT_CHANNEL_WIDTH_20
;
342 case NL80211_CHAN_HT40MINUS
:
344 mac
->cur_40_prime_sc
= PRIME_CHNL_OFFSET_UPPER
;
345 rtlphy
->current_chan_bw
=
346 HT_CHANNEL_WIDTH_20_40
;
353 case NL80211_CHAN_HT40PLUS
:
355 mac
->cur_40_prime_sc
= PRIME_CHNL_OFFSET_LOWER
;
356 rtlphy
->current_chan_bw
=
357 HT_CHANNEL_WIDTH_20_40
;
366 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
367 "switch case not processed\n");
374 /* In scanning, before we go offchannel we may send a ps=1 null
375 * to AP, and then we may send a ps = 0 null to AP quickly, but
376 * first null may have caused AP to put lots of packet to hw tx
377 * buffer. These packets must be tx'd before we go off channel
378 * so we must delay more time to let AP flush these packets
379 * before going offchannel, or dis-association or delete BA will
382 if (rtlpriv
->mac80211
.offchan_delay
) {
383 rtlpriv
->mac80211
.offchan_delay
= false;
386 rtlphy
->current_channel
= wide_chan
;
388 rtlpriv
->cfg
->ops
->switch_channel(hw
);
389 rtlpriv
->cfg
->ops
->set_channel_access(hw
);
390 rtlpriv
->cfg
->ops
->set_bw_mode(hw
,
391 hw
->conf
.channel_type
);
394 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
399 static void rtl_op_configure_filter(struct ieee80211_hw
*hw
,
400 unsigned int changed_flags
,
401 unsigned int *new_flags
, u64 multicast
)
403 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
404 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
406 *new_flags
&= RTL_SUPPORTED_FILTERS
;
410 /*TODO: we disable broadcase now, so enable here */
411 if (changed_flags
& FIF_ALLMULTI
) {
412 if (*new_flags
& FIF_ALLMULTI
) {
413 mac
->rx_conf
|= rtlpriv
->cfg
->maps
[MAC_RCR_AM
] |
414 rtlpriv
->cfg
->maps
[MAC_RCR_AB
];
415 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
416 "Enable receive multicast frame\n");
418 mac
->rx_conf
&= ~(rtlpriv
->cfg
->maps
[MAC_RCR_AM
] |
419 rtlpriv
->cfg
->maps
[MAC_RCR_AB
]);
420 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
421 "Disable receive multicast frame\n");
425 if (changed_flags
& FIF_FCSFAIL
) {
426 if (*new_flags
& FIF_FCSFAIL
) {
427 mac
->rx_conf
|= rtlpriv
->cfg
->maps
[MAC_RCR_ACRC32
];
428 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
429 "Enable receive FCS error frame\n");
431 mac
->rx_conf
&= ~rtlpriv
->cfg
->maps
[MAC_RCR_ACRC32
];
432 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
433 "Disable receive FCS error frame\n");
437 /* if ssid not set to hw don't check bssid
438 * here just used for linked scanning, & linked
439 * and nolink check bssid is set in set network_type */
440 if ((changed_flags
& FIF_BCN_PRBRESP_PROMISC
) &&
441 (mac
->link_state
>= MAC80211_LINKED
)) {
442 if (mac
->opmode
!= NL80211_IFTYPE_AP
) {
443 if (*new_flags
& FIF_BCN_PRBRESP_PROMISC
) {
444 rtlpriv
->cfg
->ops
->set_chk_bssid(hw
, false);
446 rtlpriv
->cfg
->ops
->set_chk_bssid(hw
, true);
451 if (changed_flags
& FIF_CONTROL
) {
452 if (*new_flags
& FIF_CONTROL
) {
453 mac
->rx_conf
|= rtlpriv
->cfg
->maps
[MAC_RCR_ACF
];
455 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
456 "Enable receive control frame\n");
458 mac
->rx_conf
&= ~rtlpriv
->cfg
->maps
[MAC_RCR_ACF
];
459 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
460 "Disable receive control frame\n");
464 if (changed_flags
& FIF_OTHER_BSS
) {
465 if (*new_flags
& FIF_OTHER_BSS
) {
466 mac
->rx_conf
|= rtlpriv
->cfg
->maps
[MAC_RCR_AAP
];
467 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
468 "Enable receive other BSS's frame\n");
470 mac
->rx_conf
&= ~rtlpriv
->cfg
->maps
[MAC_RCR_AAP
];
471 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
472 "Disable receive other BSS's frame\n");
476 static int rtl_op_sta_add(struct ieee80211_hw
*hw
,
477 struct ieee80211_vif
*vif
,
478 struct ieee80211_sta
*sta
)
480 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
481 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
482 struct rtl_sta_info
*sta_entry
;
485 sta_entry
= (struct rtl_sta_info
*) sta
->drv_priv
;
486 if (rtlhal
->current_bandtype
== BAND_ON_2_4G
) {
487 sta_entry
->wireless_mode
= WIRELESS_MODE_G
;
488 if (sta
->supp_rates
[0] <= 0xf)
489 sta_entry
->wireless_mode
= WIRELESS_MODE_B
;
490 if (sta
->ht_cap
.ht_supported
)
491 sta_entry
->wireless_mode
= WIRELESS_MODE_N_24G
;
492 } else if (rtlhal
->current_bandtype
== BAND_ON_5G
) {
493 sta_entry
->wireless_mode
= WIRELESS_MODE_A
;
494 if (sta
->ht_cap
.ht_supported
)
495 sta_entry
->wireless_mode
= WIRELESS_MODE_N_24G
;
498 /* I found some times mac80211 give wrong supp_rates for adhoc*/
499 if (rtlpriv
->mac80211
.opmode
== NL80211_IFTYPE_ADHOC
)
500 sta_entry
->wireless_mode
= WIRELESS_MODE_G
;
502 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
,
503 "Add sta addr is %pM\n", sta
->addr
);
504 rtlpriv
->cfg
->ops
->update_rate_tbl(hw
, sta
, 0);
508 static int rtl_op_sta_remove(struct ieee80211_hw
*hw
,
509 struct ieee80211_vif
*vif
,
510 struct ieee80211_sta
*sta
)
512 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
513 struct rtl_sta_info
*sta_entry
;
515 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
,
516 "Remove sta addr is %pM\n", sta
->addr
);
517 sta_entry
= (struct rtl_sta_info
*) sta
->drv_priv
;
518 sta_entry
->wireless_mode
= 0;
519 sta_entry
->ratr_index
= 0;
523 static int _rtl_get_hal_qnum(u16 queue
)
548 *for mac80211 VO=0, VI=1, BE=2, BK=3
549 *for rtl819x BE=0, BK=1, VI=2, VO=3
551 static int rtl_op_conf_tx(struct ieee80211_hw
*hw
,
552 struct ieee80211_vif
*vif
, u16 queue
,
553 const struct ieee80211_tx_queue_params
*param
)
555 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
556 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
559 if (queue
>= AC_MAX
) {
560 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
561 "queue number %d is incorrect!\n", queue
);
565 aci
= _rtl_get_hal_qnum(queue
);
566 mac
->ac
[aci
].aifs
= param
->aifs
;
567 mac
->ac
[aci
].cw_min
= cpu_to_le16(param
->cw_min
);
568 mac
->ac
[aci
].cw_max
= cpu_to_le16(param
->cw_max
);
569 mac
->ac
[aci
].tx_op
= cpu_to_le16(param
->txop
);
570 memcpy(&mac
->edca_param
[aci
], param
, sizeof(*param
));
571 rtlpriv
->cfg
->ops
->set_qos(hw
, aci
);
575 static void rtl_op_bss_info_changed(struct ieee80211_hw
*hw
,
576 struct ieee80211_vif
*vif
,
577 struct ieee80211_bss_conf
*bss_conf
, u32 changed
)
579 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
580 struct rtl_hal
*rtlhal
= rtl_hal(rtlpriv
);
581 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
582 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
583 struct ieee80211_sta
*sta
= NULL
;
585 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
586 if ((vif
->type
== NL80211_IFTYPE_ADHOC
) ||
587 (vif
->type
== NL80211_IFTYPE_AP
) ||
588 (vif
->type
== NL80211_IFTYPE_MESH_POINT
)) {
589 if ((changed
& BSS_CHANGED_BEACON
) ||
590 (changed
& BSS_CHANGED_BEACON_ENABLED
&&
591 bss_conf
->enable_beacon
)) {
592 if (mac
->beacon_enabled
== 0) {
593 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
,
594 "BSS_CHANGED_BEACON_ENABLED\n");
596 /*start hw beacon interrupt. */
597 /*rtlpriv->cfg->ops->set_bcn_reg(hw); */
598 mac
->beacon_enabled
= 1;
599 rtlpriv
->cfg
->ops
->update_interrupt_mask(hw
,
601 [RTL_IBSS_INT_MASKS
],
604 if (rtlpriv
->cfg
->ops
->linked_set_reg
)
605 rtlpriv
->cfg
->ops
->linked_set_reg(hw
);
608 if ((changed
& BSS_CHANGED_BEACON_ENABLED
&&
609 !bss_conf
->enable_beacon
)) {
610 if (mac
->beacon_enabled
== 1) {
611 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
,
612 "ADHOC DISABLE BEACON\n");
614 mac
->beacon_enabled
= 0;
615 rtlpriv
->cfg
->ops
->update_interrupt_mask(hw
, 0,
617 [RTL_IBSS_INT_MASKS
]);
620 if (changed
& BSS_CHANGED_BEACON_INT
) {
621 RT_TRACE(rtlpriv
, COMP_BEACON
, DBG_TRACE
,
622 "BSS_CHANGED_BEACON_INT\n");
623 mac
->beacon_interval
= bss_conf
->beacon_int
;
624 rtlpriv
->cfg
->ops
->set_bcn_intv(hw
);
628 /*TODO: reference to enum ieee80211_bss_change */
629 if (changed
& BSS_CHANGED_ASSOC
) {
630 if (bss_conf
->assoc
) {
631 /* we should reset all sec info & cam
632 * before set cam after linked, we should not
633 * reset in disassoc, that will cause tkip->wep
634 * fail because some flag will be wrong */
636 rtl_cam_reset_sec_info(hw
);
637 /* reset cam to fix wep fail issue
638 * when change from wpa to wep */
639 rtl_cam_reset_all_entry(hw
);
641 mac
->link_state
= MAC80211_LINKED
;
642 mac
->cnt_after_linked
= 0;
643 mac
->assoc_id
= bss_conf
->aid
;
644 memcpy(mac
->bssid
, bss_conf
->bssid
, 6);
646 if (rtlpriv
->cfg
->ops
->linked_set_reg
)
647 rtlpriv
->cfg
->ops
->linked_set_reg(hw
);
648 if (mac
->opmode
== NL80211_IFTYPE_STATION
&& sta
)
649 rtlpriv
->cfg
->ops
->update_rate_tbl(hw
, sta
, 0);
650 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
,
651 "BSS_CHANGED_ASSOC\n");
653 if (mac
->link_state
== MAC80211_LINKED
)
656 mac
->link_state
= MAC80211_NOLINK
;
657 memset(mac
->bssid
, 0, 6);
660 rtl_cam_reset_sec_info(hw
);
662 rtl_cam_reset_all_entry(hw
);
663 mac
->vendor
= PEER_UNKNOWN
;
665 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
,
666 "BSS_CHANGED_UN_ASSOC\n");
670 if (changed
& BSS_CHANGED_ERP_CTS_PROT
) {
671 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
672 "BSS_CHANGED_ERP_CTS_PROT\n");
673 mac
->use_cts_protect
= bss_conf
->use_cts_prot
;
676 if (changed
& BSS_CHANGED_ERP_PREAMBLE
) {
677 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
,
678 "BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n",
679 bss_conf
->use_short_preamble
);
681 mac
->short_preamble
= bss_conf
->use_short_preamble
;
682 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_ACK_PREAMBLE
,
683 (u8
*) (&mac
->short_preamble
));
686 if (changed
& BSS_CHANGED_ERP_SLOT
) {
687 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
688 "BSS_CHANGED_ERP_SLOT\n");
690 if (bss_conf
->use_short_slot
)
691 mac
->slot_time
= RTL_SLOT_TIME_9
;
693 mac
->slot_time
= RTL_SLOT_TIME_20
;
695 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_SLOT_TIME
,
696 (u8
*) (&mac
->slot_time
));
699 if (changed
& BSS_CHANGED_HT
) {
700 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
, "BSS_CHANGED_HT\n");
702 sta
= get_sta(hw
, vif
, bss_conf
->bssid
);
704 if (sta
->ht_cap
.ampdu_density
>
705 mac
->current_ampdu_density
)
706 mac
->current_ampdu_density
=
707 sta
->ht_cap
.ampdu_density
;
708 if (sta
->ht_cap
.ampdu_factor
<
709 mac
->current_ampdu_factor
)
710 mac
->current_ampdu_factor
=
711 sta
->ht_cap
.ampdu_factor
;
715 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_SHORTGI_DENSITY
,
716 (u8
*) (&mac
->max_mss_density
));
717 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_AMPDU_FACTOR
,
718 &mac
->current_ampdu_factor
);
719 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_AMPDU_MIN_SPACE
,
720 &mac
->current_ampdu_density
);
723 if (changed
& BSS_CHANGED_BSSID
) {
726 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_BSSID
,
727 (u8
*) bss_conf
->bssid
);
729 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_DMESG
, "%pM\n",
732 mac
->vendor
= PEER_UNKNOWN
;
733 memcpy(mac
->bssid
, bss_conf
->bssid
, 6);
734 rtlpriv
->cfg
->ops
->set_network_type(hw
, vif
->type
);
737 sta
= get_sta(hw
, vif
, bss_conf
->bssid
);
743 if (rtlhal
->current_bandtype
== BAND_ON_5G
) {
744 mac
->mode
= WIRELESS_MODE_A
;
746 if (sta
->supp_rates
[0] <= 0xf)
747 mac
->mode
= WIRELESS_MODE_B
;
749 mac
->mode
= WIRELESS_MODE_G
;
752 if (sta
->ht_cap
.ht_supported
) {
753 if (rtlhal
->current_bandtype
== BAND_ON_2_4G
)
754 mac
->mode
= WIRELESS_MODE_N_24G
;
756 mac
->mode
= WIRELESS_MODE_N_5G
;
759 /* just station need it, because ibss & ap mode will
760 * set in sta_add, and will be NULL here */
761 if (mac
->opmode
== NL80211_IFTYPE_STATION
) {
762 struct rtl_sta_info
*sta_entry
;
763 sta_entry
= (struct rtl_sta_info
*) sta
->drv_priv
;
764 sta_entry
->wireless_mode
= mac
->mode
;
767 if (sta
->ht_cap
.ht_supported
) {
768 mac
->ht_enable
= true;
771 * for cisco 1252 bw20 it's wrong
772 * if (ht_cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
778 if (changed
& BSS_CHANGED_BASIC_RATES
) {
779 /* for 5G must << RATE_6M_INDEX=4,
780 * because 5G have no cck rate*/
781 if (rtlhal
->current_bandtype
== BAND_ON_5G
)
782 basic_rates
= sta
->supp_rates
[1] << 4;
784 basic_rates
= sta
->supp_rates
[0];
786 mac
->basic_rates
= basic_rates
;
787 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_BASIC_RATE
,
788 (u8
*) (&basic_rates
));
795 * To tell firmware we have connected
796 * to an AP. For 92SE/CE power save v2.
798 if (changed
& BSS_CHANGED_ASSOC
) {
799 if (bss_conf
->assoc
) {
800 if (ppsc
->fwctrl_lps
) {
801 u8 mstatus
= RT_MEDIA_CONNECT
;
802 rtlpriv
->cfg
->ops
->set_hw_reg(hw
,
803 HW_VAR_H2C_FW_JOINBSSRPT
,
805 ppsc
->report_linked
= true;
808 if (ppsc
->fwctrl_lps
) {
809 u8 mstatus
= RT_MEDIA_DISCONNECT
;
810 rtlpriv
->cfg
->ops
->set_hw_reg(hw
,
811 HW_VAR_H2C_FW_JOINBSSRPT
,
813 ppsc
->report_linked
= false;
819 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
822 static u64
rtl_op_get_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
)
824 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
827 rtlpriv
->cfg
->ops
->get_hw_reg(hw
, HW_VAR_CORRECT_TSF
, (u8
*) (&tsf
));
831 static void rtl_op_set_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
834 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
835 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
836 u8 bibss
= (mac
->opmode
== NL80211_IFTYPE_ADHOC
) ? 1 : 0;
839 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_CORRECT_TSF
, (u8
*) (&bibss
));
842 static void rtl_op_reset_tsf(struct ieee80211_hw
*hw
,
843 struct ieee80211_vif
*vif
)
845 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
848 rtlpriv
->cfg
->ops
->set_hw_reg(hw
, HW_VAR_DUAL_TSF_RST
, (u8
*) (&tmp
));
851 static void rtl_op_sta_notify(struct ieee80211_hw
*hw
,
852 struct ieee80211_vif
*vif
,
853 enum sta_notify_cmd cmd
,
854 struct ieee80211_sta
*sta
)
857 case STA_NOTIFY_SLEEP
:
859 case STA_NOTIFY_AWAKE
:
866 static int rtl_op_ampdu_action(struct ieee80211_hw
*hw
,
867 struct ieee80211_vif
*vif
,
868 enum ieee80211_ampdu_mlme_action action
,
869 struct ieee80211_sta
*sta
, u16 tid
, u16
*ssn
,
872 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
875 case IEEE80211_AMPDU_TX_START
:
876 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
877 "IEEE80211_AMPDU_TX_START: TID:%d\n", tid
);
878 return rtl_tx_agg_start(hw
, sta
, tid
, ssn
);
880 case IEEE80211_AMPDU_TX_STOP
:
881 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
882 "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid
);
883 return rtl_tx_agg_stop(hw
, sta
, tid
);
885 case IEEE80211_AMPDU_TX_OPERATIONAL
:
886 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
887 "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid
);
888 rtl_tx_agg_oper(hw
, sta
, tid
);
890 case IEEE80211_AMPDU_RX_START
:
891 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
892 "IEEE80211_AMPDU_RX_START:TID:%d\n", tid
);
894 case IEEE80211_AMPDU_RX_STOP
:
895 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_TRACE
,
896 "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid
);
899 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
900 "IEEE80211_AMPDU_ERR!!!!:\n");
906 static void rtl_op_sw_scan_start(struct ieee80211_hw
*hw
)
908 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
909 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
911 mac
->act_scanning
= true;
913 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
, "\n");
915 if (mac
->link_state
== MAC80211_LINKED
) {
917 mac
->link_state
= MAC80211_LINKED_SCANNING
;
923 rtlpriv
->rtlhal
.load_imrandiqk_setting_for2g
= false;
925 rtlpriv
->cfg
->ops
->led_control(hw
, LED_CTL_SITE_SURVEY
);
926 rtlpriv
->cfg
->ops
->scan_operation_backup(hw
, SCAN_OPT_BACKUP
);
929 static void rtl_op_sw_scan_complete(struct ieee80211_hw
*hw
)
931 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
932 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
934 RT_TRACE(rtlpriv
, COMP_MAC80211
, DBG_LOUD
, "\n");
935 mac
->act_scanning
= false;
937 rtlpriv
->rtlhal
.load_imrandiqk_setting_for2g
= false;
939 if (mac
->link_state
== MAC80211_LINKED_SCANNING
) {
940 mac
->link_state
= MAC80211_LINKED
;
941 if (mac
->opmode
== NL80211_IFTYPE_STATION
) {
942 /* fix fwlps issue */
943 rtlpriv
->cfg
->ops
->set_network_type(hw
, mac
->opmode
);
947 rtlpriv
->cfg
->ops
->scan_operation_backup(hw
, SCAN_OPT_RESTORE
);
950 static int rtl_op_set_key(struct ieee80211_hw
*hw
, enum set_key_cmd cmd
,
951 struct ieee80211_vif
*vif
, struct ieee80211_sta
*sta
,
952 struct ieee80211_key_conf
*key
)
954 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
955 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
956 u8 key_type
= NO_ENCRYPTION
;
958 bool group_key
= false;
959 bool wep_only
= false;
961 u8 mac_addr
[ETH_ALEN
];
962 u8 bcast_addr
[ETH_ALEN
] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
963 u8 zero_addr
[ETH_ALEN
] = { 0 };
965 if (rtlpriv
->cfg
->mod_params
->sw_crypto
|| rtlpriv
->sec
.use_sw_sec
) {
966 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
967 "not open hw encryption\n");
968 return -ENOSPC
; /*User disabled HW-crypto */
970 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
,
971 "%s hardware based encryption for keyidx: %d, mac: %pM\n",
972 cmd
== SET_KEY
? "Using" : "Disabling", key
->keyidx
,
973 sta
? sta
->addr
: bcast_addr
);
974 rtlpriv
->sec
.being_setkey
= true;
976 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
977 /* <1> get encryption alg */
979 switch (key
->cipher
) {
980 case WLAN_CIPHER_SUITE_WEP40
:
981 key_type
= WEP40_ENCRYPTION
;
982 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
, "alg:WEP40\n");
984 case WLAN_CIPHER_SUITE_WEP104
:
985 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
, "alg:WEP104\n");
986 key_type
= WEP104_ENCRYPTION
;
988 case WLAN_CIPHER_SUITE_TKIP
:
989 key_type
= TKIP_ENCRYPTION
;
990 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
, "alg:TKIP\n");
992 case WLAN_CIPHER_SUITE_CCMP
:
993 key_type
= AESCCMP_ENCRYPTION
;
994 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
, "alg:CCMP\n");
997 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
, "alg_err:%x!!!!\n",
1001 if (key_type
== WEP40_ENCRYPTION
||
1002 key_type
== WEP104_ENCRYPTION
||
1003 mac
->opmode
== NL80211_IFTYPE_ADHOC
)
1004 rtlpriv
->sec
.use_defaultkey
= true;
1006 /* <2> get key_idx */
1007 key_idx
= (u8
) (key
->keyidx
);
1010 /* <3> if pairwise key enable_hw_sec */
1011 group_key
= !(key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
);
1013 /* wep always be group key, but there are two conditions:
1014 * 1) wep only: is just for wep enc, in this condition
1015 * rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION
1016 * will be true & enable_hw_sec will be set when wep
1018 * 2) wep(group) + AES(pairwise): some AP like cisco
1019 * may use it, in this condition enable_hw_sec will not
1020 * be set when wep key setting */
1021 /* we must reset sec_info after lingked before set key,
1022 * or some flag will be wrong*/
1023 if (mac
->opmode
== NL80211_IFTYPE_AP
) {
1024 if (!group_key
|| key_type
== WEP40_ENCRYPTION
||
1025 key_type
== WEP104_ENCRYPTION
) {
1028 rtlpriv
->cfg
->ops
->enable_hw_sec(hw
);
1031 if ((!group_key
) || (mac
->opmode
== NL80211_IFTYPE_ADHOC
) ||
1032 rtlpriv
->sec
.pairwise_enc_algorithm
== NO_ENCRYPTION
) {
1033 if (rtlpriv
->sec
.pairwise_enc_algorithm
==
1035 (key_type
== WEP40_ENCRYPTION
||
1036 key_type
== WEP104_ENCRYPTION
))
1038 rtlpriv
->sec
.pairwise_enc_algorithm
= key_type
;
1039 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
,
1040 "set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1 TKIP:2 AES:4 WEP104:5)\n",
1042 rtlpriv
->cfg
->ops
->enable_hw_sec(hw
);
1045 /* <4> set key based on cmd */
1049 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
,
1050 "set WEP(group/pairwise) key\n");
1051 /* Pairwise key with an assigned MAC address. */
1052 rtlpriv
->sec
.pairwise_enc_algorithm
= key_type
;
1053 rtlpriv
->sec
.group_enc_algorithm
= key_type
;
1054 /*set local buf about wep key. */
1055 memcpy(rtlpriv
->sec
.key_buf
[key_idx
],
1056 key
->key
, key
->keylen
);
1057 rtlpriv
->sec
.key_len
[key_idx
] = key
->keylen
;
1058 memcpy(mac_addr
, zero_addr
, ETH_ALEN
);
1059 } else if (group_key
) { /* group key */
1060 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
,
1063 rtlpriv
->sec
.group_enc_algorithm
= key_type
;
1064 /*set local buf about group key. */
1065 memcpy(rtlpriv
->sec
.key_buf
[key_idx
],
1066 key
->key
, key
->keylen
);
1067 rtlpriv
->sec
.key_len
[key_idx
] = key
->keylen
;
1068 memcpy(mac_addr
, bcast_addr
, ETH_ALEN
);
1069 } else { /* pairwise key */
1070 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
,
1071 "set pairwise key\n");
1074 "pairwise key without mac_addr\n");
1079 /* Pairwise key with an assigned MAC address. */
1080 rtlpriv
->sec
.pairwise_enc_algorithm
= key_type
;
1081 /*set local buf about pairwise key. */
1082 memcpy(rtlpriv
->sec
.key_buf
[PAIRWISE_KEYIDX
],
1083 key
->key
, key
->keylen
);
1084 rtlpriv
->sec
.key_len
[PAIRWISE_KEYIDX
] = key
->keylen
;
1085 rtlpriv
->sec
.pairwise_key
=
1086 rtlpriv
->sec
.key_buf
[PAIRWISE_KEYIDX
];
1087 memcpy(mac_addr
, sta
->addr
, ETH_ALEN
);
1089 rtlpriv
->cfg
->ops
->set_key(hw
, key_idx
, mac_addr
,
1090 group_key
, key_type
, wep_only
,
1092 /* <5> tell mac80211 do something: */
1093 /*must use sw generate IV, or can not work !!!!. */
1094 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_IV
;
1095 key
->hw_key_idx
= key_idx
;
1096 if (key_type
== TKIP_ENCRYPTION
)
1097 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_MMIC
;
1100 RT_TRACE(rtlpriv
, COMP_SEC
, DBG_DMESG
,
1101 "disable key delete one entry\n");
1102 /*set local buf about wep key. */
1103 if (mac
->opmode
== NL80211_IFTYPE_AP
) {
1105 rtl_cam_del_entry(hw
, sta
->addr
);
1107 memset(rtlpriv
->sec
.key_buf
[key_idx
], 0, key
->keylen
);
1108 rtlpriv
->sec
.key_len
[key_idx
] = 0;
1109 memcpy(mac_addr
, zero_addr
, ETH_ALEN
);
1111 *mac80211 will delete entrys one by one,
1112 *so don't use rtl_cam_reset_all_entry
1113 *or clear all entry here.
1115 rtl_cam_delete_one_entry(hw
, mac_addr
, key_idx
);
1117 rtl_cam_reset_sec_info(hw
);
1121 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
1122 "cmd_err:%x!!!!\n", cmd
);
1125 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
1126 rtlpriv
->sec
.being_setkey
= false;
1130 static void rtl_op_rfkill_poll(struct ieee80211_hw
*hw
)
1132 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1138 if (!test_bit(RTL_STATUS_INTERFACE_START
, &rtlpriv
->status
))
1141 mutex_lock(&rtlpriv
->locks
.conf_mutex
);
1143 /*if Radio On return true here */
1144 radio_state
= rtlpriv
->cfg
->ops
->radio_onoff_checking(hw
, &valid
);
1147 if (unlikely(radio_state
!= rtlpriv
->rfkill
.rfkill_state
)) {
1148 rtlpriv
->rfkill
.rfkill_state
= radio_state
;
1150 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
1151 "wireless radio switch turned %s\n",
1152 radio_state
? "on" : "off");
1154 blocked
= (rtlpriv
->rfkill
.rfkill_state
== 1) ? 0 : 1;
1155 wiphy_rfkill_set_hw_state(hw
->wiphy
, blocked
);
1159 mutex_unlock(&rtlpriv
->locks
.conf_mutex
);
1162 /* this function is called by mac80211 to flush tx buffer
1163 * before switch channle or power save, or tx buffer packet
1164 * maybe send after offchannel or rf sleep, this may cause
1165 * dis-association by AP */
1166 static void rtl_op_flush(struct ieee80211_hw
*hw
, bool drop
)
1168 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1170 if (rtlpriv
->intf_ops
->flush
)
1171 rtlpriv
->intf_ops
->flush(hw
, drop
);
1174 const struct ieee80211_ops rtl_ops
= {
1175 .start
= rtl_op_start
,
1176 .stop
= rtl_op_stop
,
1178 .add_interface
= rtl_op_add_interface
,
1179 .remove_interface
= rtl_op_remove_interface
,
1180 .config
= rtl_op_config
,
1181 .configure_filter
= rtl_op_configure_filter
,
1182 .sta_add
= rtl_op_sta_add
,
1183 .sta_remove
= rtl_op_sta_remove
,
1184 .set_key
= rtl_op_set_key
,
1185 .conf_tx
= rtl_op_conf_tx
,
1186 .bss_info_changed
= rtl_op_bss_info_changed
,
1187 .get_tsf
= rtl_op_get_tsf
,
1188 .set_tsf
= rtl_op_set_tsf
,
1189 .reset_tsf
= rtl_op_reset_tsf
,
1190 .sta_notify
= rtl_op_sta_notify
,
1191 .ampdu_action
= rtl_op_ampdu_action
,
1192 .sw_scan_start
= rtl_op_sw_scan_start
,
1193 .sw_scan_complete
= rtl_op_sw_scan_complete
,
1194 .rfkill_poll
= rtl_op_rfkill_poll
,
1195 .flush
= rtl_op_flush
,