1 /******************************************************************************
3 * Copyright(c) 2009-2010 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 *****************************************************************************/
36 #include "btcoexist/rtl_btc.h"
38 /*mutex for start & stop is must here. */
39 static int rtl_op_start(struct ieee80211_hw *hw)
42 struct rtl_priv *rtlpriv = rtl_priv(hw);
43 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
45 if (!is_hal_stop(rtlhal))
47 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
49 mutex_lock(&rtlpriv->locks.conf_mutex);
50 err = rtlpriv->intf_ops->adapter_start(hw);
53 rtl_watch_dog_timer_callback((unsigned long)hw);
56 mutex_unlock(&rtlpriv->locks.conf_mutex);
60 static void rtl_op_stop(struct ieee80211_hw *hw)
62 struct rtl_priv *rtlpriv = rtl_priv(hw);
63 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
64 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
65 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
67 if (is_hal_stop(rtlhal))
70 /* here is must, because adhoc do stop and start,
71 * but stop with RFOFF may cause something wrong,
73 if (unlikely(ppsc->rfpwr_state == ERFOFF))
76 mutex_lock(&rtlpriv->locks.conf_mutex);
78 mac->link_state = MAC80211_NOLINK;
79 memset(mac->bssid, 0, 6);
80 mac->vendor = PEER_UNKNOWN;
83 rtl_cam_reset_sec_info(hw);
85 rtl_deinit_deferred_work(hw);
86 rtlpriv->intf_ops->adapter_stop(hw);
88 mutex_unlock(&rtlpriv->locks.conf_mutex);
91 static void rtl_op_tx(struct ieee80211_hw *hw,
92 struct ieee80211_tx_control *control,
95 struct rtl_priv *rtlpriv = rtl_priv(hw);
96 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
97 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
98 struct rtl_tcb_desc tcb_desc;
99 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
101 if (unlikely(is_hal_stop(rtlhal) || ppsc->rfpwr_state != ERFON))
104 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
107 if (!rtlpriv->intf_ops->waitq_insert(hw, control->sta, skb))
108 rtlpriv->intf_ops->adapter_tx(hw, control->sta, skb, &tcb_desc);
112 dev_kfree_skb_any(skb);
116 static int rtl_op_add_interface(struct ieee80211_hw *hw,
117 struct ieee80211_vif *vif)
119 struct rtl_priv *rtlpriv = rtl_priv(hw);
120 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
124 RT_TRACE(COMP_ERR, DBG_WARNING,
125 ("vif has been set!! mac->vif = 0x%p\n", mac->vif));
129 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
133 mutex_lock(&rtlpriv->locks.conf_mutex);
134 switch (ieee80211_vif_type_p2p(vif)) {
135 case NL80211_IFTYPE_P2P_CLIENT:
136 mac->p2p = P2P_ROLE_CLIENT;
138 case NL80211_IFTYPE_STATION:
139 if (mac->beacon_enabled == 1) {
140 RT_TRACE(COMP_MAC80211, DBG_LOUD,
141 ("NL80211_IFTYPE_STATION \n"));
142 mac->beacon_enabled = 0;
143 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
144 rtlpriv->cfg->maps[RTL_IBSS_INT_MASKS]);
147 case NL80211_IFTYPE_ADHOC:
148 RT_TRACE(COMP_MAC80211, DBG_LOUD,
149 ("NL80211_IFTYPE_ADHOC \n"));
151 mac->link_state = MAC80211_LINKED;
152 rtlpriv->cfg->ops->set_bcn_reg(hw);
153 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G)
154 mac->basic_rates = 0xfff;
156 mac->basic_rates = 0xff0;
157 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
158 (u8 *) (&mac->basic_rates));
161 case NL80211_IFTYPE_P2P_GO:
162 mac->p2p = P2P_ROLE_GO;
164 case NL80211_IFTYPE_AP:
165 RT_TRACE(COMP_MAC80211, DBG_LOUD,
166 ("NL80211_IFTYPE_AP \n"));
168 mac->link_state = MAC80211_LINKED;
169 rtlpriv->cfg->ops->set_bcn_reg(hw);
170 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G)
171 mac->basic_rates = 0xfff;
173 mac->basic_rates = 0xff0;
174 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
175 (u8 *) (&mac->basic_rates));
177 case NL80211_IFTYPE_MESH_POINT:
178 RT_TRACE(COMP_MAC80211, DBG_LOUD,
179 ("NL80211_IFTYPE_MESH_POINT \n"));
181 mac->link_state = MAC80211_LINKED;
182 rtlpriv->cfg->ops->set_bcn_reg(hw);
183 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G)
184 mac->basic_rates = 0xfff;
186 mac->basic_rates = 0xff0;
187 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
188 (u8 *) (&mac->basic_rates));
191 RT_TRACE(COMP_ERR, DBG_EMERG,
192 ("operation mode %d is not support!\n", vif->type));
198 if (!rtl_set_vif_info(hw, vif))
203 RT_TRACE(COMP_MAC80211, DBG_LOUD,
204 ("p2p role %x \n",vif->type));
205 mac->basic_rates = 0xff0;/*disable cck rate for p2p*/
206 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
207 (u8 *) (&mac->basic_rates));
210 mac->opmode = vif->type;
211 rtlpriv->cfg->ops->set_network_type(hw, vif->type);
212 memcpy(mac->mac_addr, vif->addr, ETH_ALEN);
213 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr);
216 mutex_unlock(&rtlpriv->locks.conf_mutex);
220 static void rtl_op_remove_interface(struct ieee80211_hw *hw,
221 struct ieee80211_vif *vif)
223 struct rtl_priv *rtlpriv = rtl_priv(hw);
224 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
226 mutex_lock(&rtlpriv->locks.conf_mutex);
228 /* Free beacon resources */
229 if ((vif->type == NL80211_IFTYPE_AP) ||
230 (vif->type == NL80211_IFTYPE_ADHOC) ||
231 (vif->type == NL80211_IFTYPE_MESH_POINT)) {
232 if (mac->beacon_enabled == 1) {
233 mac->beacon_enabled = 0;
234 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
235 rtlpriv->cfg->maps[RTL_IBSS_INT_MASKS]);
240 *Note: We assume NL80211_IFTYPE_UNSPECIFIED as
241 *NO LINK for our hardware.
245 mac->link_state = MAC80211_NOLINK;
246 memset(mac->bssid, 0, 6);
247 mac->vendor = PEER_UNKNOWN;
248 mac->opmode = NL80211_IFTYPE_UNSPECIFIED;
249 rtlpriv->cfg->ops->set_network_type(hw, mac->opmode);
251 mutex_unlock(&rtlpriv->locks.conf_mutex);
254 static int rtl_op_change_interface(struct ieee80211_hw *hw,
255 struct ieee80211_vif *vif,
256 enum nl80211_iftype new_type, bool p2p)
258 struct rtl_priv *rtlpriv = rtl_priv(hw);
260 rtl_op_remove_interface(hw, vif);
262 vif->type = new_type;
264 ret = rtl_op_add_interface(hw, vif);
265 RT_TRACE(COMP_MAC80211, DBG_LOUD,
270 static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
272 struct rtl_priv *rtlpriv = rtl_priv(hw);
273 struct rtl_phy *rtlphy = &(rtlpriv->phy);
274 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
275 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
276 struct ieee80211_conf *conf = &hw->conf;
282 mutex_lock(&rtlpriv->locks.conf_mutex);
283 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /* BIT(2) */
284 RT_TRACE(COMP_MAC80211, DBG_LOUD,
285 ("IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n"));
289 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
290 if (hw->conf.flags & IEEE80211_CONF_IDLE)
296 *although rfoff may not cause by ips, but we will
297 *check the reason in set_rf_power_state function
299 if (unlikely(ppsc->rfpwr_state == ERFOFF))
304 if (changed & IEEE80211_CONF_CHANGE_PS) {
305 cancel_delayed_work(&rtlpriv->works.ps_work);
306 cancel_delayed_work(&rtlpriv->works.ps_rfon_wq);
307 if (conf->flags & IEEE80211_CONF_PS) {
308 rtlpriv->psc.sw_ps_enabled = true;
309 /* sleep here is must, or we may recv the beacon and
310 * cause mac80211 into wrong ps state, this will cause
311 * power save nullfunc send fail, and further cause
312 * pkt loss, So sleep must quickly but not immediately
313 * because that will cause nullfunc send by mac80211
314 * fail, and cause pkt loss, we have tested that 5mA
315 * is worked very well */
316 if (!rtlpriv->psc.multi_buffered)
317 queue_delayed_work(rtlpriv->works.rtl_wq,
318 &rtlpriv->works.ps_work,
321 rtl_swlps_rf_awake(hw);
322 rtlpriv->psc.sw_ps_enabled = false;
326 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
327 RT_TRACE(COMP_MAC80211, DBG_LOUD,
328 ("IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
329 hw->conf.long_frame_max_tx_count));
330 mac->retry_long = hw->conf.long_frame_max_tx_count;
331 mac->retry_short = hw->conf.long_frame_max_tx_count;
332 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
333 (u8 *) (&hw->conf.long_frame_max_tx_count));
336 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
337 struct ieee80211_channel *channel = hw->conf.chandef.chan;
338 enum nl80211_channel_type channel_type =
339 cfg80211_get_chandef_type(&(hw->conf.chandef));
340 u8 wide_chan = (u8) channel->hw_value;
342 if (mac->act_scanning)
345 if (rtlpriv->dm.supp_phymode_switch &&
346 mac->link_state < MAC80211_LINKED &&
347 !mac->act_scanning) {
348 if (rtlpriv->cfg->ops->check_switch_to_dmdp)
349 rtlpriv->cfg->ops->check_switch_to_dmdp(hw);
353 *because we should back channel to
354 *current_network.chan in in scanning,
355 *So if set_chan == current_network.chan
357 *because mac80211 tell us wrong bw40
358 *info for cisco1253 bw20, so we modify
359 *it here based on UPPER & LOWER
361 switch (channel_type) {
362 case NL80211_CHAN_HT20:
363 case NL80211_CHAN_NO_HT:
365 mac->cur_40_prime_sc =
366 PRIME_CHNL_OFFSET_DONT_CARE;
367 rtlphy->current_chan_bw = HT_CHANNEL_WIDTH_20;
370 case NL80211_CHAN_HT40MINUS:
372 mac->cur_40_prime_sc = PRIME_CHNL_OFFSET_UPPER;
373 rtlphy->current_chan_bw =
374 HT_CHANNEL_WIDTH_20_40;
381 case NL80211_CHAN_HT40PLUS:
383 mac->cur_40_prime_sc = PRIME_CHNL_OFFSET_LOWER;
384 rtlphy->current_chan_bw =
385 HT_CHANNEL_WIDTH_20_40;
394 RT_TRACE(COMP_ERR, DBG_EMERG,
395 ("switch case not processed \n"));
402 /* in scanning, when before we offchannel we may send a ps=1
403 * null to AP, and then we may send a ps = 0 null to AP quickly,
404 * but first null have cause AP's put lots of packet to hw tx
405 * buffer, these packet must be tx before off channel so we must
406 * delay more time to let AP flush these packets before
407 * offchannel, or dis-association or delete BA will happen by AP
409 if (rtlpriv->mac80211.offchan_deley) {
410 rtlpriv->mac80211.offchan_deley = false;
414 rtlphy->current_channel = wide_chan;
416 rtlpriv->cfg->ops->switch_channel(hw);
417 rtlpriv->cfg->ops->set_channel_access(hw);
418 rtlpriv->cfg->ops->set_bw_mode(hw,
422 mutex_unlock(&rtlpriv->locks.conf_mutex);
427 static void rtl_op_configure_filter(struct ieee80211_hw *hw,
428 unsigned int changed_flags,
429 unsigned int *new_flags, u64 multicast)
431 struct rtl_priv *rtlpriv = rtl_priv(hw);
432 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
434 *new_flags &= RTL_SUPPORTED_FILTERS;
435 if (0 == changed_flags)
438 /*TODO: we disable broadcase now, so enable here */
439 if (changed_flags & FIF_ALLMULTI) {
440 if (*new_flags & FIF_ALLMULTI) {
441 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AM] |
442 rtlpriv->cfg->maps[MAC_RCR_AB];
443 RT_TRACE(COMP_MAC80211, DBG_LOUD,
444 ("Enable receive multicast frame.\n"));
446 mac->rx_conf &= ~(rtlpriv->cfg->maps[MAC_RCR_AM] |
447 rtlpriv->cfg->maps[MAC_RCR_AB]);
448 RT_TRACE(COMP_MAC80211, DBG_LOUD,
449 ("Disable receive multicast frame.\n"));
453 if (changed_flags & FIF_FCSFAIL) {
454 if (*new_flags & FIF_FCSFAIL) {
455 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACRC32];
456 RT_TRACE(COMP_MAC80211, DBG_LOUD,
457 ("Enable receive FCS error frame.\n"));
459 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACRC32];
460 RT_TRACE(COMP_MAC80211, DBG_LOUD,
461 ("Disable receive FCS error frame.\n"));
465 /* if ssid not set to hw don't check bssid
466 * here just used for linked scanning, & linked
467 * and nolink check bssid is set in set network_type */
468 if ((changed_flags & FIF_BCN_PRBRESP_PROMISC) &&
469 (mac->link_state >= MAC80211_LINKED)) {
470 if (mac->opmode != NL80211_IFTYPE_AP &&
471 mac->opmode != NL80211_IFTYPE_MESH_POINT) {
472 if (*new_flags & FIF_BCN_PRBRESP_PROMISC) {
473 rtlpriv->cfg->ops->set_chk_bssid(hw, false);
475 rtlpriv->cfg->ops->set_chk_bssid(hw, true);
480 if (changed_flags & FIF_CONTROL) {
481 if (*new_flags & FIF_CONTROL) {
482 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACF];
484 RT_TRACE(COMP_MAC80211, DBG_LOUD,
485 ("Enable receive control frame.\n"));
487 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACF];
488 RT_TRACE(COMP_MAC80211, DBG_LOUD,
489 ("Disable receive control frame.\n"));
493 if (changed_flags & FIF_OTHER_BSS) {
494 if (*new_flags & FIF_OTHER_BSS) {
495 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AAP];
496 RT_TRACE(COMP_MAC80211, DBG_LOUD,
497 ("Enable receive other BSS's frame.\n"));
499 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_AAP];
500 RT_TRACE(COMP_MAC80211, DBG_LOUD,
501 ("Disable receive other BSS's frame.\n"));
505 static int rtl_op_sta_add(struct ieee80211_hw *hw,
506 struct ieee80211_vif *vif,
507 struct ieee80211_sta *sta)
509 struct rtl_priv *rtlpriv = rtl_priv(hw);
510 struct rtl_hal *rtlhal= rtl_hal(rtl_priv(hw));
511 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
512 struct rtl_sta_info *sta_entry;
515 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
516 spin_lock_bh(&rtlpriv->locks.entry_list_lock);
517 list_add_tail(&sta_entry->list, &rtlpriv->entry_list);
518 spin_unlock_bh(&rtlpriv->locks.entry_list_lock);
519 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
520 sta_entry->wireless_mode = WIRELESS_MODE_G;
521 if (sta->supp_rates[0] <= 0xf)
522 sta_entry->wireless_mode = WIRELESS_MODE_B;
523 if (sta->ht_cap.ht_supported == true)
524 sta_entry->wireless_mode = WIRELESS_MODE_N_24G;
526 if (vif->type == NL80211_IFTYPE_ADHOC)
527 sta_entry->wireless_mode = WIRELESS_MODE_G;
528 } else if (rtlhal->current_bandtype == BAND_ON_5G) {
529 sta_entry->wireless_mode = WIRELESS_MODE_A;
530 if (sta->ht_cap.ht_supported == true)
531 sta_entry->wireless_mode = WIRELESS_MODE_N_24G;
533 if (vif->type == NL80211_IFTYPE_ADHOC)
534 sta_entry->wireless_mode = WIRELESS_MODE_A;
536 /*disable cck rate for p2p*/
538 sta->supp_rates[0] &= 0xfffffff0;
540 memcpy(sta_entry->mac_addr, sta->addr, ETH_ALEN);
541 RT_TRACE(COMP_MAC80211, DBG_DMESG,
542 ("Add sta addr is %pM\n",sta->addr));
543 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
549 static int rtl_op_sta_remove(struct ieee80211_hw *hw,
550 struct ieee80211_vif *vif,
551 struct ieee80211_sta *sta)
553 struct rtl_priv *rtlpriv = rtl_priv(hw);
554 struct rtl_sta_info *sta_entry;
556 RT_TRACE(COMP_MAC80211, DBG_DMESG,
557 ("Remove sta addr is %pM\n",sta->addr));
558 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
559 sta_entry->wireless_mode = 0;
560 sta_entry->ratr_index = 0;
561 spin_lock_bh(&rtlpriv->locks.entry_list_lock);
562 list_del(&sta_entry->list);
563 spin_unlock_bh(&rtlpriv->locks.entry_list_lock);
567 static int _rtl_get_hal_qnum(u16 queue)
592 *for mac80211 VO=0, VI=1, BE=2, BK=3
593 *for rtl819x BE=0, BK=1, VI=2, VO=3
595 static int rtl_op_conf_tx(struct ieee80211_hw *hw,
596 struct ieee80211_vif *vif, u16 queue,
597 const struct ieee80211_tx_queue_params *param)
599 struct rtl_priv *rtlpriv = rtl_priv(hw);
600 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
603 if (queue >= AC_MAX) {
604 RT_TRACE(COMP_ERR, DBG_WARNING,
605 ("queue number %d is incorrect!\n", queue));
609 aci = _rtl_get_hal_qnum(queue);
610 mac->ac[aci].aifs = param->aifs;
611 mac->ac[aci].cw_min = param->cw_min;
612 mac->ac[aci].cw_max = param->cw_max;
613 mac->ac[aci].tx_op = param->txop;
614 memcpy(&mac->edca_param[aci], param, sizeof(*param));
615 rtlpriv->cfg->ops->set_qos(hw, aci);
619 static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
620 struct ieee80211_vif *vif,
621 struct ieee80211_bss_conf *bss_conf,
624 struct rtl_priv *rtlpriv = rtl_priv(hw);
625 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
626 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
627 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
629 mutex_lock(&rtlpriv->locks.conf_mutex);
630 if ((vif->type == NL80211_IFTYPE_ADHOC) ||
631 (vif->type == NL80211_IFTYPE_AP) ||
632 (vif->type == NL80211_IFTYPE_MESH_POINT)) {
633 if ((changed & BSS_CHANGED_BEACON) ||
634 (changed & BSS_CHANGED_BEACON_ENABLED &&
635 bss_conf->enable_beacon)) {
636 if (mac->beacon_enabled == 0) {
637 RT_TRACE(COMP_MAC80211, DBG_DMESG,
638 ("BSS_CHANGED_BEACON_ENABLED \n"));
640 /*start hw beacon interrupt. */
641 /*rtlpriv->cfg->ops->set_bcn_reg(hw); */
642 mac->beacon_enabled = 1;
643 rtlpriv->cfg->ops->update_interrupt_mask(hw,
645 [RTL_IBSS_INT_MASKS], 0);
647 if (rtlpriv->cfg->ops->linked_set_reg)
648 rtlpriv->cfg->ops->linked_set_reg(hw);
651 if ((changed & BSS_CHANGED_BEACON_ENABLED &&
652 !bss_conf->enable_beacon)){
653 if (mac->beacon_enabled == 1) {
654 RT_TRACE(COMP_MAC80211, DBG_DMESG,
655 ("ADHOC DISABLE BEACON\n"));
657 mac->beacon_enabled = 0;
658 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
660 [RTL_IBSS_INT_MASKS]);
663 if (changed & BSS_CHANGED_BEACON_INT) {
664 RT_TRACE(COMP_BEACON, DBG_TRACE,
665 ("BSS_CHANGED_BEACON_INT\n"));
666 mac->beacon_interval = bss_conf->beacon_int;
667 rtlpriv->cfg->ops->set_bcn_intv(hw);
671 /*TODO: reference to enum ieee80211_bss_change */
672 if (changed & BSS_CHANGED_ASSOC) {
673 if (bss_conf->assoc) {
674 struct ieee80211_sta *sta = NULL;
675 /* we should reset all sec info & cam
676 * before set cam after linked, we should not
677 * reset in disassoc, that will cause tkip->wep
678 * fail because some flag will be wrong */
680 rtl_cam_reset_sec_info(hw);
681 /* reset cam to fix wep fail issue
682 * when change from wpa to wep */
683 rtl_cam_reset_all_entry(hw);
685 mac->link_state = MAC80211_LINKED;
686 mac->cnt_after_linked = 0;
687 mac->assoc_id = bss_conf->aid;
688 memcpy(mac->bssid, bss_conf->bssid, 6);
690 if (rtlpriv->cfg->ops->linked_set_reg)
691 rtlpriv->cfg->ops->linked_set_reg(hw);
694 sta = ieee80211_find_sta(vif, (u8*)bss_conf->bssid);
696 if (vif->type == NL80211_IFTYPE_STATION && sta)
697 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
698 RT_TRACE(COMP_EASY_CONCURRENT, DBG_LOUD,
699 ("send PS STATIC frame \n"));
700 if (rtlpriv->dm.supp_phymode_switch) {
701 if (sta->ht_cap.ht_supported)
702 rtl_send_smps_action(hw, sta,
703 IEEE80211_SMPS_STATIC);
707 RT_TRACE(COMP_MAC80211, DBG_DMESG,
708 ("BSS_CHANGED_ASSOC\n"));
710 if (mac->link_state == MAC80211_LINKED)
712 if (ppsc->p2p_ps_info.p2p_ps_mode> P2P_PS_NONE)
713 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
714 mac->link_state = MAC80211_NOLINK;
715 memset(mac->bssid, 0, 6);
716 mac->vendor = PEER_UNKNOWN;
718 if (rtlpriv->dm.supp_phymode_switch) {
719 if (rtlpriv->cfg->ops->check_switch_to_dmdp)
720 rtlpriv->cfg->ops->check_switch_to_dmdp(hw);
722 RT_TRACE(COMP_MAC80211, DBG_DMESG,
723 ("BSS_CHANGED_UN_ASSOC\n"));
727 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
728 RT_TRACE(COMP_MAC80211, DBG_TRACE,
729 ("BSS_CHANGED_ERP_CTS_PROT\n"));
730 mac->use_cts_protect = bss_conf->use_cts_prot;
733 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
734 RT_TRACE(COMP_MAC80211, DBG_LOUD,
735 ("BSS_CHANGED_ERP_PREAMBLE use short preamble:%x \n",
736 bss_conf->use_short_preamble));
738 mac->short_preamble = bss_conf->use_short_preamble;
739 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACK_PREAMBLE,
740 (u8 *) (&mac->short_preamble));
743 if (changed & BSS_CHANGED_ERP_SLOT) {
744 RT_TRACE(COMP_MAC80211, DBG_TRACE,
745 ("BSS_CHANGED_ERP_SLOT\n"));
747 if (bss_conf->use_short_slot)
748 mac->slot_time = RTL_SLOT_TIME_9;
750 mac->slot_time = RTL_SLOT_TIME_20;
752 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME,
753 (u8 *) (&mac->slot_time));
756 if (changed & BSS_CHANGED_HT) {
757 struct ieee80211_sta *sta = NULL;
759 RT_TRACE(COMP_MAC80211, DBG_TRACE,
760 ("BSS_CHANGED_HT\n"));
763 sta = ieee80211_find_sta(vif, (u8*)bss_conf->bssid);
765 if (sta->ht_cap.ampdu_density >
766 mac->current_ampdu_density)
767 mac->current_ampdu_density =
768 sta->ht_cap.ampdu_density;
769 if (sta->ht_cap.ampdu_factor <
770 mac->current_ampdu_factor)
771 mac->current_ampdu_factor =
772 sta->ht_cap.ampdu_factor;
776 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SHORTGI_DENSITY,
777 (u8 *) (&mac->max_mss_density));
778 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AMPDU_FACTOR,
779 &mac->current_ampdu_factor);
780 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AMPDU_MIN_SPACE,
781 &mac->current_ampdu_density);
784 if (changed & BSS_CHANGED_BSSID) {
786 struct ieee80211_sta *sta = NULL;
788 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BSSID,
789 (u8 *) bss_conf->bssid);
791 RT_TRACE(COMP_MAC80211, DBG_DMESG,
792 ("bssid: %pM\n", bss_conf->bssid));
794 mac->vendor = PEER_UNKNOWN;
795 memcpy(mac->bssid, bss_conf->bssid, 6);
796 rtlpriv->cfg->ops->set_network_type(hw, vif->type);
799 sta = ieee80211_find_sta(vif, (u8*)bss_conf->bssid);
805 if (rtlhal->current_bandtype == BAND_ON_5G) {
806 mac->mode = WIRELESS_MODE_A;
808 if (sta->supp_rates[0] <= 0xf)
809 mac->mode = WIRELESS_MODE_B;
811 mac->mode = WIRELESS_MODE_G;
814 if (sta->ht_cap.ht_supported) {
815 if (rtlhal->current_bandtype == BAND_ON_2_4G)
816 mac->mode = WIRELESS_MODE_N_24G;
818 mac->mode = WIRELESS_MODE_N_5G;
821 /* just station need it, because ibss & ap mode will
822 * set in sta_add, and will be NULL here */
823 if (vif->type == NL80211_IFTYPE_STATION) {
824 struct rtl_sta_info *sta_entry;
825 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
826 sta_entry->wireless_mode = mac->mode;
829 if (sta->ht_cap.ht_supported) {
830 mac->ht_enable = true;
833 * for cisco 1252 bw20 it's wrong
834 * if (ht_cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
840 if (changed & BSS_CHANGED_BASIC_RATES) {
841 /* for 5G must << RATE_6M_INDEX=4,
842 * because 5G have no cck rate*/
843 if (rtlhal->current_bandtype == BAND_ON_5G)
844 basic_rates = sta->supp_rates[1] << 4;
846 basic_rates = sta->supp_rates[0];
848 mac->basic_rates = basic_rates;
849 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
850 (u8 *) (&basic_rates));
856 * For FW LPS and Keep Alive:
857 * To tell firmware we have connected
858 * to an AP. For 92SE/CE power save v2.
860 if (changed & BSS_CHANGED_ASSOC) {
861 if (bss_conf->assoc) {
863 u8 mstatus = RT_MEDIA_CONNECT;
864 rtlpriv->cfg->ops->set_hw_reg(hw,
866 (u8 *) (&keep_alive));
868 rtlpriv->cfg->ops->set_hw_reg(hw,
869 HW_VAR_H2C_FW_JOINBSSRPT,
871 ppsc->report_linked = true;
875 u8 mstatus = RT_MEDIA_DISCONNECT;
876 rtlpriv->cfg->ops->set_hw_reg(hw,
877 HW_VAR_H2C_FW_JOINBSSRPT,
879 ppsc->report_linked = false;
883 if (rtlpriv->cfg->ops->get_btc_status()){
884 rtlpriv->btcoexist.btc_ops->btc_mediastatus_notify(
885 rtlpriv, ppsc->report_linked);
890 mutex_unlock(&rtlpriv->locks.conf_mutex);
893 static u64 rtl_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
895 struct rtl_priv *rtlpriv = rtl_priv(hw);
898 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_CORRECT_TSF, (u8 *) (&tsf));
902 static void rtl_op_set_tsf(struct ieee80211_hw *hw,
903 struct ieee80211_vif *vif, u64 tsf)
905 struct rtl_priv *rtlpriv = rtl_priv(hw);
906 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
907 u8 bibss = (mac->opmode == NL80211_IFTYPE_ADHOC) ? 1 : 0;
910 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_CORRECT_TSF, (u8 *) (&bibss));
913 static void rtl_op_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
915 struct rtl_priv *rtlpriv = rtl_priv(hw);
918 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_DUAL_TSF_RST, (u8 *) (&tmp));
921 static void rtl_op_sta_notify(struct ieee80211_hw *hw,
922 struct ieee80211_vif *vif,
923 enum sta_notify_cmd cmd,
924 struct ieee80211_sta *sta)
927 case STA_NOTIFY_SLEEP:
929 case STA_NOTIFY_AWAKE:
936 static int rtl_op_ampdu_action(struct ieee80211_hw *hw,
937 struct ieee80211_vif *vif,
938 enum ieee80211_ampdu_mlme_action action,
939 struct ieee80211_sta *sta, u16 tid, u16 * ssn
943 struct rtl_priv *rtlpriv = rtl_priv(hw);
946 case IEEE80211_AMPDU_TX_START:
947 RT_TRACE(COMP_MAC80211, DBG_TRACE,
948 ("IEEE80211_AMPDU_TX_START: TID:%d\n", tid));
949 return rtl_tx_agg_start(hw, vif, sta, tid, ssn);
951 case IEEE80211_AMPDU_TX_STOP_CONT:
952 case IEEE80211_AMPDU_TX_STOP_FLUSH:
953 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
954 RT_TRACE(COMP_MAC80211, DBG_TRACE,
955 ("IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid));
956 return rtl_tx_agg_stop(hw, vif, sta, tid);
958 case IEEE80211_AMPDU_TX_OPERATIONAL:
959 RT_TRACE(COMP_MAC80211, DBG_TRACE,
960 ("IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid));
961 rtl_tx_agg_oper(hw, sta, tid);
963 case IEEE80211_AMPDU_RX_START:
964 RT_TRACE(COMP_MAC80211, DBG_TRACE,
965 ("IEEE80211_AMPDU_RX_START:TID:%d\n", tid));
966 return rtl_rx_agg_start(hw, sta, tid);
968 case IEEE80211_AMPDU_RX_STOP:
969 RT_TRACE(COMP_MAC80211, DBG_TRACE,
970 ("IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid));
971 return rtl_rx_agg_stop(hw, sta, tid);
974 RT_TRACE(COMP_ERR, DBG_EMERG,
975 ("IEEE80211_AMPDU_ERR!!!!:\n"));
981 static void rtl_op_sw_scan_start(struct ieee80211_hw *hw)
983 struct rtl_priv *rtlpriv = rtl_priv(hw);
984 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
986 RT_TRACE(COMP_MAC80211, DBG_LOUD, ("\n"));
987 mac->act_scanning = true;
988 /*rtlpriv->btcops->btc_scan_notify(rtlpriv, 0); */
989 if (rtlpriv->link_info.b_higher_busytraffic) {
990 mac->skip_scan = true;
994 if (rtlpriv->dm.supp_phymode_switch) {
995 if (rtlpriv->cfg->ops->check_switch_to_dmdp)
996 rtlpriv->cfg->ops->check_switch_to_dmdp(hw);
999 if (mac->link_state == MAC80211_LINKED) {
1001 mac->link_state = MAC80211_LINKED_SCANNING;
1007 rtlpriv->rtlhal.b_load_imrandiqk_setting_for2g = false;
1009 rtlpriv->cfg->ops->led_control(hw, LED_CTL_SITE_SURVEY);
1011 rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_BACKUP_BAND0);
1015 static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw)
1017 struct rtl_priv *rtlpriv = rtl_priv(hw);
1018 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1020 RT_TRACE(COMP_MAC80211, DBG_LOUD, ("\n"));
1021 mac->act_scanning = false;
1022 mac->skip_scan = false;
1023 if (rtlpriv->link_info.b_higher_busytraffic) {
1027 /* p2p will use 1/6/11 to scan */
1028 if (mac->n_channels == 3)
1029 mac->p2p_in_use = true;
1031 mac->p2p_in_use = false;
1032 mac->n_channels = 0;
1034 rtlpriv->rtlhal.b_load_imrandiqk_setting_for2g = false;
1036 if (mac->link_state == MAC80211_LINKED_SCANNING) {
1037 mac->link_state = MAC80211_LINKED;
1038 if (mac->opmode == NL80211_IFTYPE_STATION) {
1039 /* fix fwlps issue */
1040 rtlpriv->cfg->ops->set_network_type(hw, mac->opmode);
1044 rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_RESTORE);
1045 /* rtlpriv->btcops->btc_scan_notify(rtlpriv, 1); */
1048 static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1049 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1050 struct ieee80211_key_conf *key)
1052 struct rtl_priv *rtlpriv = rtl_priv(hw);
1053 u8 key_type = NO_ENCRYPTION;
1055 bool group_key = false;
1056 bool wep_only = false;
1058 u8 mac_addr[ETH_ALEN];
1059 u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
1060 u8 zero_addr[ETH_ALEN] = { 0 };
1062 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
1063 RT_TRACE(COMP_ERR, DBG_WARNING,
1064 ("not open hw encryption\n"));
1065 return -ENOSPC; /*User disabled HW-crypto */
1067 /* To support IBSS, use sw-crypto for GTK */
1068 if(((vif->type == NL80211_IFTYPE_ADHOC) ||
1069 (vif->type == NL80211_IFTYPE_MESH_POINT)) &&
1070 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
1072 RT_TRACE(COMP_SEC, DBG_DMESG,
1073 ("%s hardware based encryption for keyidx: %d, mac: %pM\n",
1074 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
1075 sta ? sta->addr : bcast_addr));
1076 rtlpriv->sec.being_setkey = true;
1078 mutex_lock(&rtlpriv->locks.conf_mutex);
1079 /* <1> get encryption alg */
1081 switch (key->cipher) {
1082 case WLAN_CIPHER_SUITE_WEP40:
1083 key_type = WEP40_ENCRYPTION;
1084 RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:WEP40\n"));
1086 case WLAN_CIPHER_SUITE_WEP104:
1087 RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:WEP104\n"));
1088 key_type = WEP104_ENCRYPTION;
1090 case WLAN_CIPHER_SUITE_TKIP:
1091 key_type = TKIP_ENCRYPTION;
1092 RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:TKIP\n"));
1094 case WLAN_CIPHER_SUITE_CCMP:
1095 key_type = AESCCMP_ENCRYPTION;
1096 RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CCMP\n"));
1098 case WLAN_CIPHER_SUITE_AES_CMAC:
1099 /* HW don't support CMAC encryption,
1100 * use software CMAC encryption */
1101 key_type = AESCMAC_ENCRYPTION;
1102 RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CMAC\n"));
1103 RT_TRACE(COMP_SEC, DBG_DMESG,
1104 ("HW don't support CMAC encryption, "
1105 "use software CMAC encryption\n"));
1109 RT_TRACE(COMP_ERR, DBG_EMERG,
1110 ("alg_err:%x!!!!:\n", key->cipher));
1113 if(key_type == WEP40_ENCRYPTION ||
1114 key_type == WEP104_ENCRYPTION ||
1115 vif->type == NL80211_IFTYPE_ADHOC)
1116 rtlpriv->sec.use_defaultkey = true;
1118 /* <2> get key_idx */
1119 key_idx = (u8) (key->keyidx);
1122 /* <3> if pairwise key enable_hw_sec */
1123 group_key = !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE);
1125 /* wep always be group key, but there are two conditions:
1126 * 1) wep only: is just for wep enc, in this condition
1127 * rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION
1128 * will be true & enable_hw_sec will be set when wep
1130 * 2) wep(group) + AES(pairwise): some AP like cisco
1131 * may use it, in this condition enable_hw_sec will not
1132 * be set when wep key setting */
1133 /* we must reset sec_info after lingked before set key,
1134 * or some flag will be wrong*/
1135 if (vif->type == NL80211_IFTYPE_AP ||
1136 vif->type == NL80211_IFTYPE_MESH_POINT) {
1137 if (!group_key || key_type == WEP40_ENCRYPTION ||
1138 key_type == WEP104_ENCRYPTION) {
1142 rtlpriv->cfg->ops->enable_hw_sec(hw);
1145 if ((!group_key) || (vif->type == NL80211_IFTYPE_ADHOC) ||
1146 rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION) {
1147 if (rtlpriv->sec.pairwise_enc_algorithm ==
1149 (key_type == WEP40_ENCRYPTION ||
1150 key_type == WEP104_ENCRYPTION))
1152 rtlpriv->sec.pairwise_enc_algorithm = key_type;
1153 RT_TRACE(COMP_SEC, DBG_DMESG,
1154 ("set enable_hw_sec, key_type:%x(OPEN:0 WEP40:"
1155 "1 TKIP:2 AES:4 WEP104:5)\n", key_type));
1156 rtlpriv->cfg->ops->enable_hw_sec(hw);
1159 /* <4> set key based on cmd */
1163 RT_TRACE(COMP_SEC, DBG_DMESG,
1164 ("set WEP(group/pairwise) key\n"));
1165 /* Pairwise key with an assigned MAC address. */
1166 rtlpriv->sec.pairwise_enc_algorithm = key_type;
1167 rtlpriv->sec.group_enc_algorithm = key_type;
1168 /*set local buf about wep key. */
1169 memcpy(rtlpriv->sec.key_buf[key_idx],
1170 key->key, key->keylen);
1171 rtlpriv->sec.key_len[key_idx] = key->keylen;
1172 memcpy(mac_addr, zero_addr, ETH_ALEN);
1173 } else if (group_key) { /* group key */
1174 RT_TRACE(COMP_SEC, DBG_DMESG,
1175 ("set group key\n"));
1177 rtlpriv->sec.group_enc_algorithm = key_type;
1178 /*set local buf about group key. */
1179 memcpy(rtlpriv->sec.key_buf[key_idx],
1180 key->key, key->keylen);
1181 rtlpriv->sec.key_len[key_idx] = key->keylen;
1182 memcpy(mac_addr, bcast_addr, ETH_ALEN);
1183 } else { /* pairwise key */
1184 RT_TRACE(COMP_SEC, DBG_DMESG,
1185 ("set pairwise key\n"));
1187 RT_ASSERT(false, ("pairwise key withnot"
1193 /* Pairwise key with an assigned MAC address. */
1194 rtlpriv->sec.pairwise_enc_algorithm = key_type;
1195 /*set local buf about pairwise key. */
1196 memcpy(rtlpriv->sec.key_buf[PAIRWISE_KEYIDX],
1197 key->key, key->keylen);
1198 rtlpriv->sec.key_len[PAIRWISE_KEYIDX] = key->keylen;
1199 rtlpriv->sec.pairwise_key =
1200 rtlpriv->sec.key_buf[PAIRWISE_KEYIDX];
1201 memcpy(mac_addr, sta->addr, ETH_ALEN);
1203 rtlpriv->cfg->ops->set_key(hw, key_idx, mac_addr,
1204 group_key, key_type, wep_only,
1206 /* <5> tell mac80211 do something: */
1207 /*must use sw generate IV, or can not work !!!!. */
1208 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1209 key->hw_key_idx = key_idx;
1210 if (key_type == TKIP_ENCRYPTION)
1211 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1212 /*use software CCMP encryption for management frames (MFP) */
1213 if (key_type == AESCCMP_ENCRYPTION)
1214 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
1217 RT_TRACE(COMP_SEC, DBG_DMESG,
1218 ("disable key delete one entry\n"));
1219 /*set local buf about wep key. */
1220 if (vif->type == NL80211_IFTYPE_AP ||
1221 vif->type == NL80211_IFTYPE_MESH_POINT) {
1223 rtl_cam_del_entry(hw, sta->addr);
1225 memset(rtlpriv->sec.key_buf[key_idx], 0, key->keylen);
1226 rtlpriv->sec.key_len[key_idx] = 0;
1227 memcpy(mac_addr, zero_addr, ETH_ALEN);
1229 *mac80211 will delete entrys one by one,
1230 *so don't use rtl_cam_reset_all_entry
1231 *or clear all entry here.
1233 rtl_cam_delete_one_entry(hw, mac_addr, key_idx);
1236 RT_TRACE(COMP_ERR, DBG_EMERG,
1237 ("cmd_err:%x!!!!:\n", cmd));
1240 mutex_unlock(&rtlpriv->locks.conf_mutex);
1241 rtlpriv->sec.being_setkey = false;
1245 static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
1247 struct rtl_priv *rtlpriv = rtl_priv(hw);
1253 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
1256 mutex_lock(&rtlpriv->locks.conf_mutex);
1258 /*if Radio On return true here */
1259 radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid);
1262 if (unlikely(radio_state != rtlpriv->rfkill.rfkill_state)) {
1263 rtlpriv->rfkill.rfkill_state = radio_state;
1265 RT_TRACE(COMP_RF, DBG_DMESG,
1266 (KERN_INFO "wireless radio switch turned %s\n",
1267 radio_state ? "on" : "off"));
1269 blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1;
1270 wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
1274 mutex_unlock(&rtlpriv->locks.conf_mutex);
1277 /* this function is called by mac80211 to flush tx buffer
1278 * before switch channel or power save, or tx buffer packet
1279 * maybe send after offchannel or rf sleep, this may cause
1280 * dis-association by AP */
1281 static void rtl_op_flush(struct ieee80211_hw *hw,
1282 struct ieee80211_vif *vif,
1283 u32 queues, bool drop)
1285 struct rtl_priv *rtlpriv = rtl_priv(hw);
1287 if (rtlpriv->intf_ops->flush)
1288 rtlpriv->intf_ops->flush(hw, queues, drop);
1291 const struct ieee80211_ops rtl_ops = {
1292 .start = rtl_op_start,
1293 .stop = rtl_op_stop,
1295 .add_interface = rtl_op_add_interface,
1296 .remove_interface = rtl_op_remove_interface,
1297 .change_interface = rtl_op_change_interface,
1298 .config = rtl_op_config,
1299 .configure_filter = rtl_op_configure_filter,
1300 .set_key = rtl_op_set_key,
1301 .conf_tx = rtl_op_conf_tx,
1302 .bss_info_changed = rtl_op_bss_info_changed,
1303 .get_tsf = rtl_op_get_tsf,
1304 .set_tsf = rtl_op_set_tsf,
1305 .reset_tsf = rtl_op_reset_tsf,
1306 .sta_notify = rtl_op_sta_notify,
1307 .ampdu_action = rtl_op_ampdu_action,
1308 .sw_scan_start = rtl_op_sw_scan_start,
1309 .sw_scan_complete = rtl_op_sw_scan_complete,
1310 .rfkill_poll = rtl_op_rfkill_poll,
1311 .sta_add = rtl_op_sta_add,
1312 .sta_remove = rtl_op_sta_remove,
1313 .flush = rtl_op_flush,