Lines Matching refs:wcn

182 static int put_cfg_tlv_u32(struct wcn36xx *wcn, size_t *len, u32 id, u32 value)
192 entry = (struct wcn36xx_hal_cfg *) (wcn->hal_buf + *len);
206 static void wcn36xx_smd_set_bss_nw_type(struct wcn36xx *wcn,
210 if (NL80211_BAND_5GHZ == WCN36XX_BAND(wcn))
289 static void wcn36xx_smd_set_sta_vht_params(struct wcn36xx *wcn,
299 if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) {
337 static void wcn36xx_smd_set_sta_default_vht_params(struct wcn36xx *wcn,
340 if (wcn->rf_id == RF_IRIS_WCN3680) {
353 static void wcn36xx_smd_set_sta_default_ht_ldpc_params(struct wcn36xx *wcn,
356 if (wcn->rf_id == RF_IRIS_WCN3680)
362 static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
379 sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
422 static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
427 (struct wcn36xx_hal_msg_header *)wcn->hal_buf;
430 wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len);
432 init_completion(&wcn->hal_rsp_compl);
434 ret = rpmsg_send(wcn->smd_channel, wcn->hal_buf, len);
439 if (wait_for_completion_timeout(&wcn->hal_rsp_compl,
504 int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
512 if (!wcn->nv) {
513 ret = request_firmware(&wcn->nv, wcn->nv_file, wcn->dev);
516 wcn->nv_file, ret);
521 nv_d = (struct nv_data *)wcn->nv->data;
528 mutex_lock(&wcn->hal_mutex);
531 fw_bytes_left = wcn->nv->size - fm_offset - 4;
545 memcpy(wcn->hal_buf, &msg_body, sizeof(msg_body));
548 memcpy(wcn->hal_buf + sizeof(msg_body),
552 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
555 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf,
556 wcn->hal_rsp_len);
568 mutex_unlock(&wcn->hal_mutex);
572 static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len)
584 memcpy(wcn->crm_version, rsp->start_rsp_params.crm_version,
586 memcpy(wcn->wlan_version, rsp->start_rsp_params.wlan_version,
590 wcn->crm_version[WCN36XX_HAL_VERSION_LENGTH] = '\0';
591 wcn->wlan_version[WCN36XX_HAL_VERSION_LENGTH] = '\0';
593 wcn->fw_revision = rsp->start_rsp_params.version.revision;
594 wcn->fw_version = rsp->start_rsp_params.version.version;
595 wcn->fw_minor = rsp->start_rsp_params.version.minor;
596 wcn->fw_major = rsp->start_rsp_params.version.major;
598 if (wcn->first_boot) {
599 wcn->first_boot = false;
601 wcn->wlan_version, wcn->crm_version);
604 wcn->fw_major, wcn->fw_minor,
605 wcn->fw_version, wcn->fw_revision,
612 int wcn36xx_smd_start(struct wcn36xx *wcn)
621 mutex_lock(&wcn->hal_mutex);
627 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
629 body = (struct wcn36xx_hal_mac_start_req_msg *)wcn->hal_buf;
632 if (wcn->rf_id == RF_IRIS_WCN3680) {
641 ret = put_cfg_tlv_u32(wcn, &len, cfg_vals[i].cfg_id,
652 ret = wcn36xx_smd_send_and_wait(wcn, body->header.len);
658 ret = wcn36xx_smd_start_rsp(wcn, wcn->hal_buf, wcn->hal_rsp_len);
665 mutex_unlock(&wcn->hal_mutex);
669 int wcn36xx_smd_stop(struct wcn36xx *wcn)
674 mutex_lock(&wcn->hal_mutex);
679 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
681 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
686 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
692 mutex_unlock(&wcn->hal_mutex);
696 int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode,
703 mutex_lock(&wcn->hal_mutex);
715 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
719 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
724 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
729 wcn->sw_scan_init = true;
731 mutex_unlock(&wcn->hal_mutex);
735 int wcn36xx_smd_start_scan(struct wcn36xx *wcn, u8 scan_channel)
740 mutex_lock(&wcn->hal_mutex);
745 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
750 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
755 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
760 wcn->sw_scan_channel = scan_channel;
762 mutex_unlock(&wcn->hal_mutex);
766 int wcn36xx_smd_end_scan(struct wcn36xx *wcn, u8 scan_channel)
771 mutex_lock(&wcn->hal_mutex);
776 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
781 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
786 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
791 wcn->sw_scan_channel = 0;
793 mutex_unlock(&wcn->hal_mutex);
797 int wcn36xx_smd_finish_scan(struct wcn36xx *wcn,
805 mutex_lock(&wcn->hal_mutex);
809 msg_body.oper_channel = WCN36XX_HW_CHANNEL(wcn);
818 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
823 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
828 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
833 wcn->sw_scan_init = false;
835 mutex_unlock(&wcn->hal_mutex);
839 int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif,
849 mutex_lock(&wcn->hal_mutex);
889 PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));
896 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len);
901 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
909 mutex_unlock(&wcn->hal_mutex);
913 int wcn36xx_smd_stop_hw_scan(struct wcn36xx *wcn)
918 mutex_lock(&wcn->hal_mutex);
920 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
924 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
929 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
936 mutex_unlock(&wcn->hal_mutex);
940 int wcn36xx_smd_update_channel_list(struct wcn36xx *wcn, struct cfg80211_scan_request *req)
998 mutex_lock(&wcn->hal_mutex);
1000 PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));
1002 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len);
1008 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
1016 mutex_unlock(&wcn->hal_mutex);
1034 int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
1040 mutex_lock(&wcn->hal_mutex);
1048 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1050 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1055 ret = wcn36xx_smd_switch_channel_rsp(wcn->hal_buf, wcn->hal_rsp_len);
1061 mutex_unlock(&wcn->hal_mutex);
1091 int wcn36xx_smd_process_ptt_msg(struct wcn36xx *wcn,
1098 mutex_lock(&wcn->hal_mutex);
1110 PREPARE_HAL_PTT_MSG_BUF(wcn->hal_buf, p_msg_body);
1112 ret = wcn36xx_smd_send_and_wait(wcn, p_msg_body->header.len);
1117 ret = wcn36xx_smd_process_ptt_msg_rsp(wcn->hal_buf, wcn->hal_rsp_len,
1126 mutex_unlock(&wcn->hal_mutex);
1147 int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn,
1153 mutex_lock(&wcn->hal_mutex);
1167 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1173 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1178 ret = wcn36xx_smd_update_scan_params_rsp(wcn->hal_buf,
1179 wcn->hal_rsp_len);
1186 mutex_unlock(&wcn->hal_mutex);
1190 static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
1219 int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif)
1224 mutex_lock(&wcn->hal_mutex);
1229 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1235 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1240 ret = wcn36xx_smd_add_sta_self_rsp(wcn,
1242 wcn->hal_buf,
1243 wcn->hal_rsp_len);
1249 mutex_unlock(&wcn->hal_mutex);
1253 int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr)
1258 mutex_lock(&wcn->hal_mutex);
1263 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1265 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1270 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
1277 mutex_unlock(&wcn->hal_mutex);
1281 int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index)
1286 mutex_lock(&wcn->hal_mutex);
1291 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1297 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1302 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
1308 mutex_unlock(&wcn->hal_mutex);
1328 int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch)
1333 mutex_lock(&wcn->hal_mutex);
1340 if (conf_is_ht40_minus(&wcn->hw->conf))
1343 else if (conf_is_ht40_plus(&wcn->hw->conf))
1353 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1360 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1365 ret = wcn36xx_smd_join_rsp(wcn->hal_buf, wcn->hal_rsp_len);
1371 mutex_unlock(&wcn->hal_mutex);
1375 int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
1382 mutex_lock(&wcn->hal_mutex);
1389 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1395 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1400 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
1406 mutex_unlock(&wcn->hal_mutex);
1410 static void wcn36xx_smd_convert_sta_to_v1(struct wcn36xx *wcn,
1448 wcn36xx_smd_set_sta_params_v1(struct wcn36xx *wcn,
1456 wcn36xx_smd_set_sta_params(wcn, vif, sta, &sta_par_v0);
1457 wcn36xx_smd_convert_sta_to_v1(wcn, &sta_par_v0, sta_par);
1461 wcn36xx_smd_set_sta_vht_params(wcn, sta, sta_par);
1467 wcn36xx_smd_set_sta_default_vht_params(wcn, sta_par);
1468 wcn36xx_smd_set_sta_default_ht_ldpc_params(wcn, sta_par);
1472 static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
1505 static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
1512 if (wcn->rf_id == RF_IRIS_WCN3680) {
1521 wcn36xx_smd_set_sta_params_v1(wcn, vif, sta, sta_params);
1523 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1530 return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1533 static int wcn36xx_smd_config_sta_v0(struct wcn36xx *wcn,
1544 wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
1546 PREPARE_HAL_BUF(wcn->hal_buf, msg);
1554 return wcn36xx_smd_send_and_wait(wcn, msg.header.len);
1557 int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
1562 mutex_lock(&wcn->hal_mutex);
1564 if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24))
1565 ret = wcn36xx_smd_config_sta_v1(wcn, vif, sta);
1567 ret = wcn36xx_smd_config_sta_v0(wcn, vif, sta);
1573 ret = wcn36xx_smd_config_sta_rsp(wcn,
1575 wcn->hal_buf,
1576 wcn->hal_rsp_len);
1582 mutex_unlock(&wcn->hal_mutex);
1586 static void wcn36xx_smd_set_bss_params(struct wcn36xx *wcn,
1624 wcn36xx_smd_set_bss_nw_type(wcn, sta, bss);
1638 bss->oper_channel = WCN36XX_HW_CHANNEL(wcn);
1640 if (conf_is_ht40_minus(&wcn->hw->conf))
1642 else if (conf_is_ht40_plus(&wcn->hw->conf))
1649 /* wcn->ssid is only valid in AP and IBSS mode */
1668 bss->max_tx_power = WCN36XX_MAX_POWER(wcn);
1674 static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
1691 if (wcn->rf_id == RF_IRIS_WCN3680) {
1702 wcn36xx_smd_set_bss_params(wcn, vif, sta_80211, bssid, update, &bss_v0);
1703 wcn36xx_smd_set_sta_params_v1(wcn, vif, sta_80211, sta);
1729 if (wcn->hw->conf.chandef.width == NL80211_CHAN_WIDTH_80) {
1730 chandef = &wcn->hw->conf.chandef;
1778 PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));
1790 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len);
1796 static int wcn36xx_smd_config_bss_v0(struct wcn36xx *wcn,
1816 wcn36xx_smd_set_bss_params(wcn, vif, sta, bssid, update, bss);
1817 wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
1819 PREPARE_HAL_BUF(wcn->hal_buf, (*msg));
1833 ret = wcn36xx_smd_send_and_wait(wcn, msg->header.len);
1839 static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
1883 int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
1889 mutex_lock(&wcn->hal_mutex);
1891 if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24))
1892 ret = wcn36xx_smd_config_bss_v1(wcn, vif, sta, bssid, update);
1894 ret = wcn36xx_smd_config_bss_v0(wcn, vif, sta, bssid, update);
1900 ret = wcn36xx_smd_config_bss_rsp(wcn,
1903 wcn->hal_buf,
1904 wcn->hal_rsp_len);
1909 mutex_unlock(&wcn->hal_mutex);
1913 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif)
1919 mutex_lock(&wcn->hal_mutex);
1928 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
1932 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
1937 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
1945 mutex_unlock(&wcn->hal_mutex);
1949 int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
1956 mutex_lock(&wcn->hal_mutex);
2002 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2008 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2013 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2019 mutex_unlock(&wcn->hal_mutex);
2023 int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
2030 mutex_lock(&wcn->hal_mutex);
2045 PREPARE_HAL_BUF(wcn->hal_buf, msg);
2051 ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
2056 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2063 mutex_unlock(&wcn->hal_mutex);
2067 int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
2077 mutex_lock(&wcn->hal_mutex);
2099 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2101 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2106 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2112 mutex_unlock(&wcn->hal_mutex);
2116 int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
2126 mutex_lock(&wcn->hal_mutex);
2138 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2140 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2145 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2151 mutex_unlock(&wcn->hal_mutex);
2155 int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
2163 mutex_lock(&wcn->hal_mutex);
2170 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2172 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2177 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2183 mutex_unlock(&wcn->hal_mutex);
2187 int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
2195 mutex_lock(&wcn->hal_mutex);
2201 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2203 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2208 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2214 mutex_unlock(&wcn->hal_mutex);
2218 int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
2224 mutex_lock(&wcn->hal_mutex);
2231 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2233 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2238 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2244 mutex_unlock(&wcn->hal_mutex);
2248 int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
2254 mutex_lock(&wcn->hal_mutex);
2260 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2262 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2267 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2273 mutex_unlock(&wcn->hal_mutex);
2277 int wcn36xx_smd_enter_imps(struct wcn36xx *wcn)
2282 mutex_lock(&wcn->hal_mutex);
2285 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2287 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2292 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2300 mutex_unlock(&wcn->hal_mutex);
2304 int wcn36xx_smd_exit_imps(struct wcn36xx *wcn)
2309 mutex_lock(&wcn->hal_mutex);
2312 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2314 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2319 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2326 mutex_unlock(&wcn->hal_mutex);
2330 int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim)
2335 mutex_lock(&wcn->hal_mutex);
2345 msg_body.listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
2347 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2349 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2356 mutex_unlock(&wcn->hal_mutex);
2363 int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn,
2371 mutex_lock(&wcn->hal_mutex);
2386 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2388 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2393 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2399 mutex_unlock(&wcn->hal_mutex);
2403 int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
2409 mutex_lock(&wcn->hal_mutex);
2418 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2420 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2425 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2431 mutex_unlock(&wcn->hal_mutex);
2435 int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
2440 mutex_lock(&wcn->hal_mutex);
2444 if (wcn->rf_id == RF_IRIS_WCN3680) {
2451 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2453 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2458 if (wcn->hal_rsp_len != sizeof(*rsp)) {
2463 rsp = (struct wcn36xx_hal_feat_caps_msg *) wcn->hal_buf;
2466 wcn->fw_feat_caps[i] = rsp->feat_caps[i];
2468 mutex_unlock(&wcn->hal_mutex);
2488 int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn,
2499 mutex_lock(&wcn->hal_mutex);
2515 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2517 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2522 ret = wcn36xx_smd_add_ba_session_rsp(wcn->hal_buf, wcn->hal_rsp_len,
2532 mutex_unlock(&wcn->hal_mutex);
2536 int wcn36xx_smd_add_ba(struct wcn36xx *wcn, u8 session_id)
2541 mutex_lock(&wcn->hal_mutex);
2547 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2549 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2554 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2560 mutex_unlock(&wcn->hal_mutex);
2564 int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 direction, u8 sta_index)
2569 mutex_lock(&wcn->hal_mutex);
2575 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2577 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2582 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2588 mutex_unlock(&wcn->hal_mutex);
2592 int wcn36xx_smd_get_stats(struct wcn36xx *wcn, u8 sta_index, u32 stats_mask,
2606 mutex_lock(&wcn->hal_mutex);
2612 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2614 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2620 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2626 rsp = (struct wcn36xx_hal_stats_rsp_msg *)wcn->hal_buf;
2627 rsp_body = (wcn->hal_buf + sizeof(struct wcn36xx_hal_stats_rsp_msg));
2643 mutex_unlock(&wcn->hal_mutex);
2671 int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index, u16 tid, u16 *ssn)
2681 mutex_lock(&wcn->hal_mutex);
2687 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2690 (wcn->hal_buf + sizeof(msg_body));
2694 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2699 ret = wcn36xx_smd_trigger_ba_rsp(wcn->hal_buf, wcn->hal_rsp_len, ba_info);
2705 mutex_unlock(&wcn->hal_mutex);
2713 static int wcn36xx_smd_tx_compl_ind(struct wcn36xx *wcn, void *buf, size_t len)
2722 wcn36xx_dxe_tx_ack_ind(wcn, rsp->status);
2727 static int wcn36xx_smd_hw_scan_ind(struct wcn36xx *wcn, void *buf, size_t len)
2745 mutex_lock(&wcn->scan_lock);
2746 wcn->scan_req = NULL;
2747 if (wcn->scan_aborted)
2749 mutex_unlock(&wcn->scan_lock);
2750 ieee80211_scan_completed(wcn->hw, &scan_info);
2764 static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn,
2773 if (wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
2774 list_for_each_entry(tmp, &wcn->vif_list, list) {
2788 list_for_each_entry(tmp, &wcn->vif_list, list) {
2802 static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
2822 list_for_each_entry(vif_priv, &wcn->vif_list, list) {
2856 static int wcn36xx_smd_print_reg_info_ind(struct wcn36xx *wcn,
2880 int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value)
2886 mutex_lock(&wcn->hal_mutex);
2889 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2891 body = (struct wcn36xx_hal_update_cfg_req_msg *) wcn->hal_buf;
2894 put_cfg_tlv_u32(wcn, &len, cfg_id, value);
2898 ret = wcn36xx_smd_send_and_wait(wcn, body->header.len);
2903 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2909 mutex_unlock(&wcn->hal_mutex);
2913 int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn,
2921 mutex_lock(&wcn->hal_mutex);
2924 wcn->hal_buf;
2936 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len);
2941 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2947 mutex_unlock(&wcn->hal_mutex);
2951 int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
2958 mutex_lock(&wcn->hal_mutex);
2971 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2973 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2978 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
2984 mutex_unlock(&wcn->hal_mutex);
2989 int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
2998 mutex_lock(&wcn->hal_mutex);
3027 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3029 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
3034 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
3040 mutex_unlock(&wcn->hal_mutex);
3044 int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
3051 int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
3058 mutex_lock(&wcn->hal_mutex);
3072 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3074 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
3079 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
3085 mutex_unlock(&wcn->hal_mutex);
3089 static int wcn36xx_smd_gtk_offload_get_info_rsp(struct wcn36xx *wcn,
3096 if (wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len))
3099 rsp = (struct wcn36xx_hal_gtk_offload_get_info_rsp_msg *)wcn->hal_buf;
3130 int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn,
3137 mutex_lock(&wcn->hal_mutex);
3143 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3145 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
3150 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
3155 ret = wcn36xx_smd_gtk_offload_get_info_rsp(wcn, vif);
3157 mutex_unlock(&wcn->hal_mutex);
3161 int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn)
3166 mutex_lock(&wcn->hal_mutex);
3171 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3173 ret = rpmsg_send(wcn->smd_channel, wcn->hal_buf, msg_body.header.len);
3175 mutex_unlock(&wcn->hal_mutex);
3180 int wcn36xx_smd_host_resume(struct wcn36xx *wcn)
3186 mutex_lock(&wcn->hal_mutex);
3191 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3193 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
3198 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
3204 rsp = (struct wcn36xx_hal_host_resume_rsp_msg *)wcn->hal_buf;
3209 mutex_unlock(&wcn->hal_mutex);
3253 int wcn36xx_smd_add_beacon_filter(struct wcn36xx *wcn,
3262 if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, BCN_FILTER))
3265 mutex_lock(&wcn->hal_mutex);
3268 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3270 body = (struct wcn36xx_hal_add_bcn_filter_req_msg *)wcn->hal_buf;
3283 ret = wcn36xx_smd_send_and_wait(wcn, body->header.len);
3289 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
3295 mutex_unlock(&wcn->hal_mutex);
3304 struct wcn36xx *wcn = hw->priv;
3356 memcpy(wcn->hal_buf, buf, len);
3357 wcn->hal_rsp_len = len;
3358 complete(&wcn->hal_rsp_compl);
3379 spin_lock(&wcn->hal_ind_lock);
3380 list_add_tail(&msg_ind->list, &wcn->hal_ind_queue);
3381 queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work);
3382 spin_unlock(&wcn->hal_ind_lock);
3395 struct wcn36xx *wcn =
3403 spin_lock_irqsave(&wcn->hal_ind_lock, flags);
3405 if (list_empty(&wcn->hal_ind_queue)) {
3406 spin_unlock_irqrestore(&wcn->hal_ind_lock, flags);
3410 hal_ind_msg = list_first_entry(&wcn->hal_ind_queue,
3414 spin_unlock_irqrestore(&wcn->hal_ind_lock, flags);
3424 wcn36xx_smd_tx_compl_ind(wcn,
3429 wcn36xx_smd_missed_beacon_ind(wcn,
3434 wcn36xx_smd_delete_sta_context_ind(wcn,
3439 wcn36xx_smd_print_reg_info_ind(wcn,
3444 wcn36xx_smd_hw_scan_ind(wcn, hal_ind_msg->msg,
3456 int wcn36xx_smd_open(struct wcn36xx *wcn)
3458 wcn->hal_ind_wq = create_freezable_workqueue("wcn36xx_smd_ind");
3459 if (!wcn->hal_ind_wq)
3462 INIT_WORK(&wcn->hal_ind_work, wcn36xx_ind_smd_work);
3463 INIT_LIST_HEAD(&wcn->hal_ind_queue);
3464 spin_lock_init(&wcn->hal_ind_lock);
3469 void wcn36xx_smd_close(struct wcn36xx *wcn)
3473 cancel_work_sync(&wcn->hal_ind_work);
3474 destroy_workqueue(wcn->hal_ind_wq);
3476 list_for_each_entry_safe(msg, tmp, &wcn->hal_ind_queue, list)