37 #include <linux/export.h>
46 "Firmware callback routine entered!\n");
49 pr_err(
"Firmware %s not available\n", rtlpriv->
cfg->fw_name);
55 "Firmware is too big!\n");
66 "Can't register mac80211 hw\n");
69 rtlpriv->
mac80211.mac80211_registered = 1;
85 if (!is_hal_stop(rtlhal))
90 err = rtlpriv->
intf_ops->adapter_start(hw);
104 if (is_hal_stop(rtlhal))
122 rtlpriv->
intf_ops->adapter_stop(hw);
143 if (!rtlpriv->
intf_ops->waitq_insert(hw, control->
sta, skb))
144 rtlpriv->
intf_ops->adapter_tx(hw, control->
sta, skb, &tcb_desc);
152 static int rtl_op_add_interface(
struct ieee80211_hw *hw,
163 "vif has been set!! mac->vif = 0x%p\n", mac->
vif);
174 "NL80211_IFTYPE_STATION\n");
176 rtlpriv->
cfg->ops->update_interrupt_mask(hw, 0,
183 "NL80211_IFTYPE_ADHOC\n");
186 rtlpriv->
cfg->ops->set_bcn_reg(hw);
197 "NL80211_IFTYPE_AP\n");
200 rtlpriv->
cfg->ops->set_bcn_reg(hw);
210 "operation mode %d is not supported!\n", vif->
type);
217 rtlpriv->
cfg->ops->set_network_type(hw, vif->
type);
226 static void rtl_op_remove_interface(
struct ieee80211_hw *hw,
240 rtlpriv->
cfg->ops->update_interrupt_mask(hw, 0,
255 rtlpriv->
cfg->ops->set_network_type(hw, mac->
opmode);
270 "IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n");
293 rtlpriv->
psc.sw_ps_enabled =
true;
301 if (!rtlpriv->
psc.multi_buffered)
303 &rtlpriv->
works.ps_work,
307 rtlpriv->
psc.sw_ps_enabled =
false;
313 "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
314 hw->
conf.long_frame_max_tx_count);
335 switch (hw->
conf.channel_type) {
369 "switch case not processed\n");
384 if (rtlpriv->
mac80211.offchan_delay) {
385 rtlpriv->
mac80211.offchan_delay =
false;
390 rtlpriv->
cfg->ops->switch_channel(hw);
391 rtlpriv->
cfg->ops->set_channel_access(hw);
392 rtlpriv->
cfg->ops->set_bw_mode(hw,
393 hw->
conf.channel_type);
401 static void rtl_op_configure_filter(
struct ieee80211_hw *hw,
402 unsigned int changed_flags,
403 unsigned int *new_flags,
u64 multicast)
414 if (*new_flags & FIF_ALLMULTI) {
418 "Enable receive multicast frame\n");
423 "Disable receive multicast frame\n");
428 if (*new_flags & FIF_FCSFAIL) {
431 "Enable receive FCS error frame\n");
435 "Disable receive FCS error frame\n");
445 if (*new_flags & FIF_BCN_PRBRESP_PROMISC) {
446 rtlpriv->
cfg->ops->set_chk_bssid(hw,
false);
448 rtlpriv->
cfg->ops->set_chk_bssid(hw,
true);
454 if (*new_flags & FIF_CONTROL) {
458 "Enable receive control frame\n");
462 "Disable receive control frame\n");
467 if (*new_flags & FIF_OTHER_BSS) {
470 "Enable receive other BSS's frame\n");
474 "Disable receive other BSS's frame\n");
492 if (sta->
ht_cap.ht_supported)
496 if (sta->
ht_cap.ht_supported)
505 "Add sta addr is %pM\n", sta->
addr);
506 rtlpriv->
cfg->ops->update_rate_tbl(hw, sta, 0);
518 "Remove sta addr is %pM\n", sta->
addr);
525 static int _rtl_get_hal_qnum(
u16 queue)
563 "queue number %d is incorrect!\n", queue);
567 aci = _rtl_get_hal_qnum(queue);
568 mac->
ac[aci].aifs = param->
aifs;
573 rtlpriv->
cfg->ops->set_qos(hw, aci);
577 static void rtl_op_bss_info_changed(
struct ieee80211_hw *hw,
596 "BSS_CHANGED_BEACON_ENABLED\n");
601 rtlpriv->
cfg->ops->update_interrupt_mask(hw,
606 if (rtlpriv->
cfg->ops->linked_set_reg)
607 rtlpriv->
cfg->ops->linked_set_reg(hw);
614 "ADHOC DISABLE BEACON\n");
617 rtlpriv->
cfg->ops->update_interrupt_mask(hw, 0,
624 "BSS_CHANGED_BEACON_INT\n");
626 rtlpriv->
cfg->ops->set_bcn_intv(hw);
632 if (bss_conf->
assoc) {
648 if (rtlpriv->
cfg->ops->linked_set_reg)
649 rtlpriv->
cfg->ops->linked_set_reg(hw);
651 rtlpriv->
cfg->ops->update_rate_tbl(hw, sta, 0);
653 "BSS_CHANGED_ASSOC\n");
668 "BSS_CHANGED_UN_ASSOC\n");
674 "BSS_CHANGED_ERP_CTS_PROT\n");
680 "BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n",
690 "BSS_CHANGED_ERP_SLOT\n");
704 sta = get_sta(hw, vif, bss_conf->
bssid);
706 if (sta->
ht_cap.ampdu_density >
709 sta->
ht_cap.ampdu_density;
710 if (sta->
ht_cap.ampdu_factor <
736 rtlpriv->
cfg->ops->set_network_type(hw, vif->
type);
739 sta = get_sta(hw, vif, bss_conf->
bssid);
754 if (sta->
ht_cap.ht_supported) {
769 if (sta->
ht_cap.ht_supported) {
790 (
u8 *) (&basic_rates));
800 if (changed & BSS_CHANGED_ASSOC) {
801 if (bss_conf->
assoc) {
804 rtlpriv->
cfg->ops->set_hw_reg(hw,
812 rtlpriv->
cfg->ops->set_hw_reg(hw,
879 "IEEE80211_AMPDU_TX_START: TID:%d\n", tid);
884 "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid);
889 "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid);
894 "IEEE80211_AMPDU_RX_START:TID:%d\n", tid);
898 "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid);
902 "IEEE80211_AMPDU_ERR!!!!:\n");
908 static void rtl_op_sw_scan_start(
struct ieee80211_hw *hw)
925 rtlpriv->
rtlhal.load_imrandiqk_setting_for2g =
false;
931 static void rtl_op_sw_scan_complete(
struct ieee80211_hw *hw)
939 rtlpriv->
rtlhal.load_imrandiqk_setting_for2g =
false;
945 rtlpriv->
cfg->ops->set_network_type(hw, mac->
opmode);
960 bool group_key =
false;
961 bool wep_only =
false;
964 u8 bcast_addr[
ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
967 if (rtlpriv->
cfg->mod_params->sw_crypto || rtlpriv->
sec.use_sw_sec) {
969 "not open hw encryption\n");
973 "%s hardware based encryption for keyidx: %d, mac: %pM\n",
975 sta ? sta->
addr : bcast_addr);
976 rtlpriv->
sec.being_setkey =
true;
1006 rtlpriv->
sec.use_defaultkey =
true;
1030 rtlpriv->
cfg->ops->enable_hw_sec(hw);
1035 if (rtlpriv->
sec.pairwise_enc_algorithm ==
1040 rtlpriv->
sec.pairwise_enc_algorithm = key_type;
1042 "set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1 TKIP:2 AES:4 WEP104:5)\n",
1044 rtlpriv->
cfg->ops->enable_hw_sec(hw);
1052 "set WEP(group/pairwise) key\n");
1054 rtlpriv->
sec.pairwise_enc_algorithm = key_type;
1055 rtlpriv->
sec.group_enc_algorithm = key_type;
1059 rtlpriv->
sec.key_len[key_idx] = key->
keylen;
1061 }
else if (group_key) {
1065 rtlpriv->
sec.group_enc_algorithm = key_type;
1069 rtlpriv->
sec.key_len[key_idx] = key->
keylen;
1073 "set pairwise key\n");
1076 "pairwise key without mac_addr\n");
1082 rtlpriv->
sec.pairwise_enc_algorithm = key_type;
1087 rtlpriv->
sec.pairwise_key =
1091 rtlpriv->
cfg->ops->set_key(hw, key_idx, mac_addr,
1092 group_key, key_type, wep_only,
1103 "disable key delete one entry\n");
1110 rtlpriv->
sec.key_len[key_idx] = 0;
1124 "cmd_err:%x!!!!\n", cmd);
1128 rtlpriv->
sec.being_setkey =
false;
1132 static void rtl_op_rfkill_poll(
struct ieee80211_hw *hw)
1146 radio_state = rtlpriv->
cfg->ops->radio_onoff_checking(hw, &valid);
1150 rtlpriv->
rfkill.rfkill_state = radio_state;
1153 "wireless radio switch turned %s\n",
1154 radio_state ?
"on" :
"off");
1156 blocked = (rtlpriv->
rfkill.rfkill_state == 1) ? 0 : 1;
1168 static void rtl_op_flush(
struct ieee80211_hw *hw,
bool drop)
1173 rtlpriv->
intf_ops->flush(hw, drop);
1177 .start = rtl_op_start,
1178 .stop = rtl_op_stop,
1180 .add_interface = rtl_op_add_interface,
1181 .remove_interface = rtl_op_remove_interface,
1182 .config = rtl_op_config,
1183 .configure_filter = rtl_op_configure_filter,
1184 .sta_add = rtl_op_sta_add,
1185 .sta_remove = rtl_op_sta_remove,
1186 .set_key = rtl_op_set_key,
1187 .conf_tx = rtl_op_conf_tx,
1188 .bss_info_changed = rtl_op_bss_info_changed,
1189 .get_tsf = rtl_op_get_tsf,
1190 .set_tsf = rtl_op_set_tsf,
1191 .reset_tsf = rtl_op_reset_tsf,
1192 .sta_notify = rtl_op_sta_notify,
1193 .ampdu_action = rtl_op_ampdu_action,
1194 .sw_scan_start = rtl_op_sw_scan_start,
1195 .sw_scan_complete = rtl_op_sw_scan_complete,
1196 .rfkill_poll = rtl_op_rfkill_poll,
1197 .flush = rtl_op_flush,