old mode 100644new mode 100755.. | .. |
---|
19 | 19 | #include "rwnx_compat.h" |
---|
20 | 20 | #include "rwnx_cmds.h" |
---|
21 | 21 | #include "aicwf_txrxif.h" |
---|
| 22 | +#include "rwnx_wakelock.h" |
---|
22 | 23 | |
---|
23 | 24 | const struct mac_addr mac_addr_bcst = {{0xFFFF, 0xFFFF, 0xFFFF}}; |
---|
24 | 25 | |
---|
.. | .. |
---|
227 | 228 | |
---|
228 | 229 | //RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
229 | 230 | |
---|
| 231 | + rwnx_wakeup_lock_timeout(rwnx_hw->ws_tx, jiffies_to_msecs(5)); |
---|
230 | 232 | #ifdef AICWF_USB_SUPPORT |
---|
231 | 233 | if (rwnx_hw->usbdev->state == USB_DOWN_ST) { |
---|
232 | 234 | rwnx_msg_free(rwnx_hw, msg_params); |
---|
.. | .. |
---|
286 | 288 | empty = list_empty(&rwnx_hw->cmd_mgr->cmds); |
---|
287 | 289 | spin_unlock_bh(&rwnx_hw->cmd_mgr->lock); |
---|
288 | 290 | if (!empty) { |
---|
289 | | - udelay(100); |
---|
290 | | - printk("check cmdqueue empty\n"); |
---|
| 291 | + if (in_softirq()) { |
---|
| 292 | + printk("in_softirq:check cmdqueue empty\n"); |
---|
| 293 | + mdelay(10); |
---|
| 294 | + } else { |
---|
| 295 | + printk("check cmdqueue empty\n"); |
---|
| 296 | + msleep(50); |
---|
| 297 | + } |
---|
291 | 298 | } |
---|
292 | 299 | } while (!empty);//wait for cmd queue empty |
---|
293 | 300 | } |
---|
.. | .. |
---|
320 | 327 | |
---|
321 | 328 | RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
322 | 329 | |
---|
| 330 | + rwnx_wakeup_lock_timeout(rwnx_hw->ws_tx, jiffies_to_msecs(5)); |
---|
323 | 331 | msg = container_of((void *)msg_params, struct lmac_msg, param); |
---|
324 | 332 | |
---|
325 | 333 | //nonblock = is_non_blocking_msg(msg->id); |
---|
.. | .. |
---|
646 | 654 | } |
---|
647 | 655 | |
---|
648 | 656 | int rwnx_send_roc(struct rwnx_hw *rwnx_hw, struct rwnx_vif *vif, |
---|
649 | | - struct ieee80211_channel *chan, unsigned int duration) |
---|
| 657 | + struct ieee80211_channel *chan, unsigned int duration, |
---|
| 658 | + struct mm_remain_on_channel_cfm *roc_cfm) |
---|
650 | 659 | { |
---|
651 | 660 | struct mm_remain_on_channel_req *req; |
---|
652 | 661 | struct cfg80211_chan_def chandef; |
---|
.. | .. |
---|
674 | 683 | req->tx_power = chan_to_fw_pwr(chan->max_power); |
---|
675 | 684 | |
---|
676 | 685 | /* Send the MM_REMAIN_ON_CHANNEL_REQ message to LMAC FW */ |
---|
677 | | - return rwnx_send_msg(rwnx_hw, req, 1, MM_REMAIN_ON_CHANNEL_CFM, NULL); |
---|
| 686 | + return rwnx_send_msg(rwnx_hw, req, 1, MM_REMAIN_ON_CHANNEL_CFM, roc_cfm); |
---|
678 | 687 | } |
---|
679 | 688 | |
---|
680 | 689 | int rwnx_send_cancel_roc(struct rwnx_hw *rwnx_hw) |
---|
.. | .. |
---|
919 | 928 | rf_calib_req->param_alpha = 0x0c34c008; |
---|
920 | 929 | rf_calib_req->bt_calib_en = 0; |
---|
921 | 930 | rf_calib_req->bt_calib_param = 0x264203; |
---|
| 931 | + rf_calib_req->xtal_cap = 0; |
---|
| 932 | + rf_calib_req->xtal_cap_fine = 0; |
---|
922 | 933 | |
---|
923 | 934 | /* Send the MM_SET_RF_CALIB_REQ message to UMAC FW */ |
---|
924 | 935 | error = rwnx_send_msg(rwnx_hw, rf_calib_req, 1, MM_SET_RF_CALIB_CFM, cfm); |
---|
.. | .. |
---|
949 | 960 | return error; |
---|
950 | 961 | }; |
---|
951 | 962 | |
---|
952 | | -int rwnx_send_get_sta_txinfo_req(struct rwnx_hw *rwnx_hw, u8_l sta_idx, struct mm_get_sta_txinfo_cfm *cfm) |
---|
| 963 | +int rwnx_send_get_sta_info_req(struct rwnx_hw *rwnx_hw, u8_l sta_idx, struct mm_get_sta_info_cfm *cfm) |
---|
953 | 964 | { |
---|
954 | | - struct mm_get_sta_txinfo_req *get_txinfo_req; |
---|
| 965 | + struct mm_get_sta_info_req *get_info_req; |
---|
955 | 966 | int error; |
---|
956 | 967 | |
---|
957 | 968 | |
---|
958 | | - /* Build the MM_GET_STA_TXINFO_REQ message */ |
---|
959 | | - get_txinfo_req = rwnx_msg_zalloc(MM_GET_STA_TXINFO_REQ, TASK_MM, DRV_TASK_ID, |
---|
960 | | - sizeof(struct mm_get_sta_txinfo_req)); |
---|
| 969 | + /* Build the MM_GET_STA_INFO_REQ message */ |
---|
| 970 | + get_info_req = rwnx_msg_zalloc(MM_GET_STA_INFO_REQ, TASK_MM, DRV_TASK_ID, |
---|
| 971 | + sizeof(struct mm_get_sta_info_req)); |
---|
961 | 972 | |
---|
962 | | - if (!get_txinfo_req) { |
---|
| 973 | + if (!get_info_req) { |
---|
963 | 974 | return -ENOMEM; |
---|
964 | 975 | } |
---|
965 | 976 | |
---|
966 | | - get_txinfo_req->sta_idx = 1; |
---|
| 977 | + get_info_req->sta_idx = sta_idx; |
---|
967 | 978 | |
---|
968 | | - /* Send the MM_GET_STA_TXINFO_REQ message to UMAC FW */ |
---|
969 | | - error = rwnx_send_msg(rwnx_hw, get_txinfo_req, 1, MM_GET_STA_TXINFO_CFM, cfm); |
---|
| 979 | + /* Send the MM_GET_STA_INFO_REQ message to UMAC FW */ |
---|
| 980 | + error = rwnx_send_msg(rwnx_hw, get_info_req, 1, MM_GET_STA_INFO_CFM, cfm); |
---|
970 | 981 | |
---|
971 | 982 | return error; |
---|
972 | 983 | }; |
---|
973 | 984 | |
---|
| 985 | +int rwnx_send_set_stack_start_req(struct rwnx_hw *rwnx_hw, u8_l on, u8_l efuse_valid, u8_l set_vendor_info, |
---|
| 986 | + u8_l fwtrace_redir_en, struct mm_set_stack_start_cfm *cfm) |
---|
| 987 | +{ |
---|
| 988 | + struct mm_set_stack_start_req *req; |
---|
| 989 | + int error; |
---|
| 990 | + |
---|
| 991 | + /* Build the MM_SET_STACK_START_REQ message */ |
---|
| 992 | + req = rwnx_msg_zalloc(MM_SET_STACK_START_REQ, TASK_MM, DRV_TASK_ID, sizeof(struct mm_set_stack_start_req)); |
---|
| 993 | + |
---|
| 994 | + if (!req) { |
---|
| 995 | + return -ENOMEM; |
---|
| 996 | + } |
---|
| 997 | + |
---|
| 998 | + req->is_stack_start = on; |
---|
| 999 | + req->efuse_valid = efuse_valid; |
---|
| 1000 | + req->set_vendor_info = set_vendor_info; |
---|
| 1001 | + req->fwtrace_redir = fwtrace_redir_en; |
---|
| 1002 | + /* Send the MM_SET_STACK_START_REQ message to UMAC FW */ |
---|
| 1003 | + error = rwnx_send_msg(rwnx_hw, req, 1, MM_SET_STACK_START_CFM, cfm); |
---|
| 1004 | + |
---|
| 1005 | + return error; |
---|
| 1006 | +} |
---|
| 1007 | + |
---|
| 1008 | +int rwnx_send_txop_req(struct rwnx_hw *rwnx_hw, uint16_t *txop, u8_l long_nav_en, u8_l cfe_en) |
---|
| 1009 | +{ |
---|
| 1010 | + struct mm_set_txop_req *req; |
---|
| 1011 | + int error; |
---|
| 1012 | + |
---|
| 1013 | + /* Build the MM_SET_TXOP_REQ message */ |
---|
| 1014 | + req = rwnx_msg_zalloc(MM_SET_TXOP_REQ, TASK_MM, DRV_TASK_ID, sizeof(struct mm_set_txop_req)); |
---|
| 1015 | + |
---|
| 1016 | + if (!req) { |
---|
| 1017 | + return -ENOMEM; |
---|
| 1018 | + } |
---|
| 1019 | + |
---|
| 1020 | + req->txop_bk = txop[0]; |
---|
| 1021 | + req->txop_be = txop[1]; |
---|
| 1022 | + req->txop_vi = txop[2]; |
---|
| 1023 | + req->txop_vo = txop[3]; |
---|
| 1024 | + req->long_nav_en = long_nav_en; |
---|
| 1025 | + req->cfe_en = cfe_en; |
---|
| 1026 | + /* Send the MM_SET_TXOP_REQ message to UMAC FW */ |
---|
| 1027 | + error = rwnx_send_msg(rwnx_hw, req, 1, MM_SET_TXOP_CFM, NULL); |
---|
| 1028 | + |
---|
| 1029 | + return error; |
---|
| 1030 | +} |
---|
| 1031 | + |
---|
| 1032 | +int rwnx_send_get_fw_version_req(struct rwnx_hw *rwnx_hw, struct mm_get_fw_version_cfm *cfm) |
---|
| 1033 | +{ |
---|
| 1034 | + void *req; |
---|
| 1035 | + int error; |
---|
| 1036 | + |
---|
| 1037 | + /* Build the MM_GET_FW_VERSION_REQ message */ |
---|
| 1038 | + req = rwnx_msg_zalloc(MM_GET_FW_VERSION_REQ, TASK_MM, DRV_TASK_ID, sizeof(u8)); |
---|
| 1039 | + |
---|
| 1040 | + if (!req) { |
---|
| 1041 | + return -ENOMEM; |
---|
| 1042 | + } |
---|
| 1043 | + |
---|
| 1044 | + /* Send the MM_GET_FW_VERSION_REQ message to UMAC FW */ |
---|
| 1045 | + error = rwnx_send_msg(rwnx_hw, req, 1, MM_GET_FW_VERSION_CFM, cfm); |
---|
| 1046 | + |
---|
| 1047 | + return error; |
---|
| 1048 | +} |
---|
| 1049 | + |
---|
| 1050 | + |
---|
| 1051 | +int rwnx_send_txpwr_idx_req(struct rwnx_hw *rwnx_hw) |
---|
| 1052 | +{ |
---|
| 1053 | + struct mm_set_txpwr_idx_req *txpwr_idx_req; |
---|
| 1054 | + txpwr_idx_conf_t *txpwr_idx; |
---|
| 1055 | + int error; |
---|
| 1056 | + |
---|
| 1057 | + RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
| 1058 | + |
---|
| 1059 | + /* Build the MM_SET_TXPWR_IDX_REQ message */ |
---|
| 1060 | + txpwr_idx_req = rwnx_msg_zalloc(MM_SET_TXPWR_IDX_REQ, TASK_MM, DRV_TASK_ID, |
---|
| 1061 | + sizeof(struct mm_set_txpwr_idx_req)); |
---|
| 1062 | + |
---|
| 1063 | + if (!txpwr_idx_req) { |
---|
| 1064 | + return -ENOMEM; |
---|
| 1065 | + } |
---|
| 1066 | + |
---|
| 1067 | + txpwr_idx = &txpwr_idx_req->txpwr_idx; |
---|
| 1068 | + txpwr_idx->enable = 1; |
---|
| 1069 | + txpwr_idx->dsss = 9; |
---|
| 1070 | + txpwr_idx->ofdmlowrate_2g4 = 8; |
---|
| 1071 | + txpwr_idx->ofdm64qam_2g4 = 8; |
---|
| 1072 | + txpwr_idx->ofdm256qam_2g4 = 8; |
---|
| 1073 | + txpwr_idx->ofdm1024qam_2g4 = 8; |
---|
| 1074 | + txpwr_idx->ofdmlowrate_5g = 11; |
---|
| 1075 | + txpwr_idx->ofdm64qam_5g = 10; |
---|
| 1076 | + txpwr_idx->ofdm256qam_5g = 9; |
---|
| 1077 | + txpwr_idx->ofdm1024qam_5g = 9; |
---|
| 1078 | + |
---|
| 1079 | + get_userconfig_txpwr_idx(txpwr_idx); |
---|
| 1080 | + |
---|
| 1081 | + if (txpwr_idx->enable == 0) { |
---|
| 1082 | + rwnx_msg_free(rwnx_hw, txpwr_idx_req); |
---|
| 1083 | + return 0; |
---|
| 1084 | + } else { |
---|
| 1085 | + /* Send the MM_SET_TXPWR_IDX_REQ message to UMAC FW */ |
---|
| 1086 | + error = rwnx_send_msg(rwnx_hw, txpwr_idx_req, 1, MM_SET_TXPWR_IDX_CFM, NULL); |
---|
| 1087 | + |
---|
| 1088 | + return error; |
---|
| 1089 | + } |
---|
| 1090 | +}; |
---|
| 1091 | + |
---|
| 1092 | +int rwnx_send_txpwr_ofst_req(struct rwnx_hw *rwnx_hw) |
---|
| 1093 | +{ |
---|
| 1094 | + struct mm_set_txpwr_ofst_req *txpwr_ofst_req; |
---|
| 1095 | + txpwr_ofst_conf_t *txpwr_ofst; |
---|
| 1096 | + int error; |
---|
| 1097 | + |
---|
| 1098 | + RWNX_DBG(RWNX_FN_ENTRY_STR); |
---|
| 1099 | + |
---|
| 1100 | + /* Build the MM_SET_TXPWR_OFST_REQ message */ |
---|
| 1101 | + txpwr_ofst_req = rwnx_msg_zalloc(MM_SET_TXPWR_OFST_REQ, TASK_MM, DRV_TASK_ID, |
---|
| 1102 | + sizeof(struct mm_set_txpwr_ofst_req)); |
---|
| 1103 | + |
---|
| 1104 | + if (!txpwr_ofst_req) { |
---|
| 1105 | + return -ENOMEM; |
---|
| 1106 | + } |
---|
| 1107 | + |
---|
| 1108 | + txpwr_ofst = &txpwr_ofst_req->txpwr_ofst; |
---|
| 1109 | + txpwr_ofst->enable = 1; |
---|
| 1110 | + txpwr_ofst->chan_1_4 = 0; |
---|
| 1111 | + txpwr_ofst->chan_5_9 = 0; |
---|
| 1112 | + txpwr_ofst->chan_10_13 = 0; |
---|
| 1113 | + txpwr_ofst->chan_36_64 = 0; |
---|
| 1114 | + txpwr_ofst->chan_100_120 = 0; |
---|
| 1115 | + txpwr_ofst->chan_122_140 = 0; |
---|
| 1116 | + txpwr_ofst->chan_142_165 = 0; |
---|
| 1117 | + |
---|
| 1118 | + get_userconfig_txpwr_ofst(txpwr_ofst); |
---|
| 1119 | + |
---|
| 1120 | + if (txpwr_ofst->enable == 0) { |
---|
| 1121 | + rwnx_msg_free(rwnx_hw, txpwr_ofst_req); |
---|
| 1122 | + return 0; |
---|
| 1123 | + } else { |
---|
| 1124 | + /* Send the MM_SET_TXPWR_OFST_REQ message to UMAC FW */ |
---|
| 1125 | + error = rwnx_send_msg(rwnx_hw, txpwr_ofst_req, 1, MM_SET_TXPWR_OFST_CFM, NULL); |
---|
| 1126 | + |
---|
| 1127 | + return error; |
---|
| 1128 | + } |
---|
| 1129 | +}; |
---|
974 | 1130 | |
---|
975 | 1131 | /****************************************************************************** |
---|
976 | 1132 | * Control messages handling functions (FULLMAC only) |
---|
.. | .. |
---|
1040 | 1196 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) |
---|
1041 | 1197 | if (wiphy->bands[NL80211_BAND_2GHZ]->iftype_data != NULL) { |
---|
1042 | 1198 | he_cap = &wiphy->bands[NL80211_BAND_2GHZ]->iftype_data->he_cap; |
---|
1043 | | - } |
---|
1044 | 1199 | #endif |
---|
1045 | 1200 | #if defined(CONFIG_HE_FOR_OLD_KERNEL) |
---|
1046 | 1201 | if (1) { |
---|
1047 | 1202 | he_cap = &rwnx_he_capa.he_cap; |
---|
1048 | | - #else |
---|
1049 | | - { |
---|
1050 | 1203 | #endif |
---|
1051 | 1204 | req->he_supp = he_cap->has_he; |
---|
1052 | 1205 | for (i = 0; i < ARRAY_SIZE(he_cap->he_cap_elem.mac_cap_info); i++) { |
---|
.. | .. |
---|
1699 | 1852 | if (!memcmp(P2P_WILDCARD_SSID, param->ssids[i].ssid, |
---|
1700 | 1853 | P2P_WILDCARD_SSID_LEN)) { |
---|
1701 | 1854 | printk("p2p scanu:%d,%d,%d\n", rwnx_vif->vif_index, rwnx_vif->is_p2p_vif, rwnx_hw->is_p2p_alive); |
---|
1702 | | - if (rwnx_vif->is_p2p_vif && !rwnx_hw->is_p2p_alive) { |
---|
| 1855 | + if (rwnx_vif == rwnx_hw->p2p_dev_vif && !rwnx_vif->up) { |
---|
1703 | 1856 | err = rwnx_send_add_if (rwnx_hw, rwnx_vif->wdev.address, |
---|
1704 | 1857 | RWNX_VIF_TYPE(rwnx_vif), false, &add_if_cfm); |
---|
1705 | 1858 | if (err) |
---|