Lines Matching +full:smd +full:- +full:channels

23 #include "smd.h"
142 WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, -60),
186 return -ENOMEM; in put_cfg_tlv_u32()
189 entry = (struct wcn36xx_hal_cfg *) (wcn->hal_buf + *len); in put_cfg_tlv_u32()
190 entry->id = id; in put_cfg_tlv_u32()
191 entry->len = sizeof(u32); in put_cfg_tlv_u32()
192 entry->pad_bytes = 0; in put_cfg_tlv_u32()
193 entry->reserve = 0; in put_cfg_tlv_u32()
208 bss_params->nw_type = WCN36XX_HAL_11A_NW_TYPE; in wcn36xx_smd_set_bss_nw_type()
209 else if (sta && sta->ht_cap.ht_supported) in wcn36xx_smd_set_bss_nw_type()
210 bss_params->nw_type = WCN36XX_HAL_11N_NW_TYPE; in wcn36xx_smd_set_bss_nw_type()
211 else if (sta && (sta->supp_rates[NL80211_BAND_2GHZ] & 0x7f)) in wcn36xx_smd_set_bss_nw_type()
212 bss_params->nw_type = WCN36XX_HAL_11G_NW_TYPE; in wcn36xx_smd_set_bss_nw_type()
214 bss_params->nw_type = WCN36XX_HAL_11B_NW_TYPE; in wcn36xx_smd_set_bss_nw_type()
226 if (sta && sta->ht_cap.ht_supported) { in wcn36xx_smd_set_bss_ht_params()
227 unsigned long caps = sta->ht_cap.cap; in wcn36xx_smd_set_bss_ht_params()
228 bss_params->ht = sta->ht_cap.ht_supported; in wcn36xx_smd_set_bss_ht_params()
229 bss_params->tx_channel_width_set = is_cap_supported(caps, in wcn36xx_smd_set_bss_ht_params()
231 bss_params->lsig_tx_op_protection_full_support = in wcn36xx_smd_set_bss_ht_params()
235 bss_params->ht_oper_mode = vif->bss_conf.ht_operation_mode; in wcn36xx_smd_set_bss_ht_params()
236 bss_params->lln_non_gf_coexist = in wcn36xx_smd_set_bss_ht_params()
237 !!(vif->bss_conf.ht_operation_mode & in wcn36xx_smd_set_bss_ht_params()
240 bss_params->dual_cts_protection = 0; in wcn36xx_smd_set_bss_ht_params()
242 bss_params->ht20_coexist = 0; in wcn36xx_smd_set_bss_ht_params()
251 if (sta && sta->vht_cap.vht_supported) in wcn36xx_smd_set_bss_vht_params()
252 bss->vht_capable = 1; in wcn36xx_smd_set_bss_vht_params()
258 if (sta->ht_cap.ht_supported) { in wcn36xx_smd_set_sta_ht_params()
259 unsigned long caps = sta->ht_cap.cap; in wcn36xx_smd_set_sta_ht_params()
260 sta_params->ht_capable = sta->ht_cap.ht_supported; in wcn36xx_smd_set_sta_ht_params()
261 sta_params->tx_channel_width_set = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
263 sta_params->lsig_txop_protection = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
266 sta_params->max_ampdu_size = sta->ht_cap.ampdu_factor; in wcn36xx_smd_set_sta_ht_params()
267 sta_params->max_ampdu_density = sta->ht_cap.ampdu_density; in wcn36xx_smd_set_sta_ht_params()
268 sta_params->max_amsdu_size = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
270 sta_params->sgi_20Mhz = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
272 sta_params->sgi_40mhz = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
274 sta_params->green_field_capable = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
276 sta_params->delayed_ba_support = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
278 sta_params->dsss_cck_mode_40mhz = is_cap_supported(caps, in wcn36xx_smd_set_sta_ht_params()
287 if (sta->vht_cap.vht_supported) { in wcn36xx_smd_set_sta_vht_params()
288 unsigned long caps = sta->vht_cap.cap; in wcn36xx_smd_set_sta_vht_params()
290 sta_params->vht_capable = sta->vht_cap.vht_supported; in wcn36xx_smd_set_sta_vht_params()
291 sta_params->vht_ldpc_enabled = in wcn36xx_smd_set_sta_vht_params()
293 if (get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) { in wcn36xx_smd_set_sta_vht_params()
294 sta_params->vht_tx_mu_beamformee_capable = in wcn36xx_smd_set_sta_vht_params()
296 if (sta_params->vht_tx_mu_beamformee_capable) in wcn36xx_smd_set_sta_vht_params()
297 sta_params->vht_tx_bf_enabled = 1; in wcn36xx_smd_set_sta_vht_params()
299 sta_params->vht_tx_mu_beamformee_capable = 0; in wcn36xx_smd_set_sta_vht_params()
301 sta_params->vht_tx_channel_width_set = 0; in wcn36xx_smd_set_sta_vht_params()
308 if (sta->ht_cap.ht_supported) { in wcn36xx_smd_set_sta_ht_ldpc_params()
309 sta_params->ht_ldpc_enabled = in wcn36xx_smd_set_sta_ht_ldpc_params()
310 is_cap_supported(sta->ht_cap.cap, IEEE80211_HT_CAP_LDPC_CODING); in wcn36xx_smd_set_sta_ht_ldpc_params()
317 sta_params->ht_capable = 1; in wcn36xx_smd_set_sta_default_ht_params()
318 sta_params->tx_channel_width_set = 1; in wcn36xx_smd_set_sta_default_ht_params()
319 sta_params->lsig_txop_protection = 1; in wcn36xx_smd_set_sta_default_ht_params()
320 sta_params->max_ampdu_size = 3; in wcn36xx_smd_set_sta_default_ht_params()
321 sta_params->max_ampdu_density = 5; in wcn36xx_smd_set_sta_default_ht_params()
322 sta_params->max_amsdu_size = 0; in wcn36xx_smd_set_sta_default_ht_params()
323 sta_params->sgi_20Mhz = 1; in wcn36xx_smd_set_sta_default_ht_params()
324 sta_params->sgi_40mhz = 1; in wcn36xx_smd_set_sta_default_ht_params()
325 sta_params->green_field_capable = 1; in wcn36xx_smd_set_sta_default_ht_params()
326 sta_params->delayed_ba_support = 0; in wcn36xx_smd_set_sta_default_ht_params()
327 sta_params->dsss_cck_mode_40mhz = 1; in wcn36xx_smd_set_sta_default_ht_params()
333 if (wcn->rf_id == RF_IRIS_WCN3680) { in wcn36xx_smd_set_sta_default_vht_params()
334 sta_params->vht_capable = 1; in wcn36xx_smd_set_sta_default_vht_params()
335 sta_params->vht_tx_mu_beamformee_capable = 1; in wcn36xx_smd_set_sta_default_vht_params()
337 sta_params->vht_capable = 0; in wcn36xx_smd_set_sta_default_vht_params()
338 sta_params->vht_tx_mu_beamformee_capable = 0; in wcn36xx_smd_set_sta_default_vht_params()
341 sta_params->vht_ldpc_enabled = 0; in wcn36xx_smd_set_sta_default_vht_params()
342 sta_params->vht_tx_channel_width_set = 0; in wcn36xx_smd_set_sta_default_vht_params()
343 sta_params->vht_tx_bf_enabled = 0; in wcn36xx_smd_set_sta_default_vht_params()
349 if (wcn->rf_id == RF_IRIS_WCN3680) in wcn36xx_smd_set_sta_default_ht_ldpc_params()
350 sta_params->ht_ldpc_enabled = 1; in wcn36xx_smd_set_sta_default_ht_ldpc_params()
352 sta_params->ht_ldpc_enabled = 0; in wcn36xx_smd_set_sta_default_ht_ldpc_params()
362 if (vif->type == NL80211_IFTYPE_ADHOC || in wcn36xx_smd_set_sta_params()
363 vif->type == NL80211_IFTYPE_AP || in wcn36xx_smd_set_sta_params()
364 vif->type == NL80211_IFTYPE_MESH_POINT) { in wcn36xx_smd_set_sta_params()
365 sta_params->type = 1; in wcn36xx_smd_set_sta_params()
366 sta_params->sta_index = WCN36XX_HAL_STA_INVALID_IDX; in wcn36xx_smd_set_sta_params()
368 sta_params->type = 0; in wcn36xx_smd_set_sta_params()
369 sta_params->sta_index = vif_priv->self_sta_index; in wcn36xx_smd_set_sta_params()
372 sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn); in wcn36xx_smd_set_sta_params()
379 if (NL80211_IFTYPE_STATION == vif->type) in wcn36xx_smd_set_sta_params()
380 memcpy(&sta_params->mac, vif->addr, ETH_ALEN); in wcn36xx_smd_set_sta_params()
382 memcpy(&sta_params->bssid, vif->addr, ETH_ALEN); in wcn36xx_smd_set_sta_params()
384 sta_params->encrypt_type = vif_priv->encrypt_type; in wcn36xx_smd_set_sta_params()
385 sta_params->short_preamble_supported = true; in wcn36xx_smd_set_sta_params()
387 sta_params->rifs_mode = 0; in wcn36xx_smd_set_sta_params()
388 sta_params->rmf = 0; in wcn36xx_smd_set_sta_params()
389 sta_params->action = 0; in wcn36xx_smd_set_sta_params()
390 sta_params->uapsd = 0; in wcn36xx_smd_set_sta_params()
391 sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC; in wcn36xx_smd_set_sta_params()
392 sta_params->max_ampdu_duration = 0; in wcn36xx_smd_set_sta_params()
393 sta_params->bssid_index = vif_priv->bss_index; in wcn36xx_smd_set_sta_params()
394 sta_params->p2p = 0; in wcn36xx_smd_set_sta_params()
398 if (NL80211_IFTYPE_STATION == vif->type) in wcn36xx_smd_set_sta_params()
399 memcpy(&sta_params->bssid, sta->addr, ETH_ALEN); in wcn36xx_smd_set_sta_params()
401 memcpy(&sta_params->mac, sta->addr, ETH_ALEN); in wcn36xx_smd_set_sta_params()
402 sta_params->wmm_enabled = sta->wme; in wcn36xx_smd_set_sta_params()
403 sta_params->max_sp_len = sta->max_sp; in wcn36xx_smd_set_sta_params()
404 sta_params->aid = sta_priv->aid; in wcn36xx_smd_set_sta_params()
406 memcpy(&sta_params->supported_rates, &sta_priv->supported_rates, in wcn36xx_smd_set_sta_params()
410 &sta_params->supported_rates); in wcn36xx_smd_set_sta_params()
420 (struct wcn36xx_hal_msg_header *)wcn->hal_buf; in wcn36xx_smd_send_and_wait()
421 u16 req_type = hdr->msg_type; in wcn36xx_smd_send_and_wait()
423 wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len); in wcn36xx_smd_send_and_wait()
425 init_completion(&wcn->hal_rsp_compl); in wcn36xx_smd_send_and_wait()
427 ret = rpmsg_send(wcn->smd_channel, wcn->hal_buf, len); in wcn36xx_smd_send_and_wait()
432 if (wait_for_completion_timeout(&wcn->hal_rsp_compl, in wcn36xx_smd_send_and_wait()
434 wcn36xx_err("Timeout! No SMD response to req %d in %dms\n", in wcn36xx_smd_send_and_wait()
436 ret = -ETIME; in wcn36xx_smd_send_and_wait()
440 "SMD command (req %d, rsp %d) completed in %dms\n", in wcn36xx_smd_send_and_wait()
441 req_type, hdr->msg_type, in wcn36xx_smd_send_and_wait()
442 jiffies_to_msecs(jiffies - start)); in wcn36xx_smd_send_and_wait()
452 hdr->msg_type = msg_type; in init_hal_msg()
453 hdr->msg_version = WCN36XX_HAL_MSG_VERSION0; in init_hal_msg()
454 hdr->len = msg_size + sizeof(*hdr); in init_hal_msg()
474 p_msg_body->header.msg_type = WCN36XX_HAL_PROCESS_PTT_REQ; \
475 p_msg_body->header.msg_version = WCN36XX_HAL_MSG_VERSION0; \
476 p_msg_body->header.len = sizeof(*p_msg_body) + ppt_msg_len; \
487 memset(send_buf, 0, p_msg_body->header.len); \
488 memcpy(send_buf, p_msg_body, p_msg_body->header.len); \
497 return -EIO; in wcn36xx_smd_rsp_status_check()
502 if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status) in wcn36xx_smd_rsp_status_check()
503 return rsp->status; in wcn36xx_smd_rsp_status_check()
516 if (!wcn->nv) { in wcn36xx_smd_load_nv()
517 ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev); in wcn36xx_smd_load_nv()
525 nv_d = (struct nv_data *)wcn->nv->data; in wcn36xx_smd_load_nv()
532 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_load_nv()
535 fw_bytes_left = wcn->nv->size - fm_offset - 4; in wcn36xx_smd_load_nv()
549 memcpy(wcn->hal_buf, &msg_body, sizeof(msg_body)); in wcn36xx_smd_load_nv()
552 memcpy(wcn->hal_buf + sizeof(msg_body), in wcn36xx_smd_load_nv()
553 &nv_d->table + fm_offset, in wcn36xx_smd_load_nv()
559 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, in wcn36xx_smd_load_nv()
560 wcn->hal_rsp_len); in wcn36xx_smd_load_nv()
572 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_load_nv()
581 return -EIO; in wcn36xx_smd_start_rsp()
585 if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->start_rsp_params.status) in wcn36xx_smd_start_rsp()
586 return -EIO; in wcn36xx_smd_start_rsp()
588 memcpy(wcn->crm_version, rsp->start_rsp_params.crm_version, in wcn36xx_smd_start_rsp()
590 memcpy(wcn->wlan_version, rsp->start_rsp_params.wlan_version, in wcn36xx_smd_start_rsp()
594 wcn->crm_version[WCN36XX_HAL_VERSION_LENGTH] = '\0'; in wcn36xx_smd_start_rsp()
595 wcn->wlan_version[WCN36XX_HAL_VERSION_LENGTH] = '\0'; in wcn36xx_smd_start_rsp()
597 wcn->fw_revision = rsp->start_rsp_params.version.revision; in wcn36xx_smd_start_rsp()
598 wcn->fw_version = rsp->start_rsp_params.version.version; in wcn36xx_smd_start_rsp()
599 wcn->fw_minor = rsp->start_rsp_params.version.minor; in wcn36xx_smd_start_rsp()
600 wcn->fw_major = rsp->start_rsp_params.version.major; in wcn36xx_smd_start_rsp()
602 if (wcn->first_boot) { in wcn36xx_smd_start_rsp()
603 wcn->first_boot = false; in wcn36xx_smd_start_rsp()
605 wcn->wlan_version, wcn->crm_version); in wcn36xx_smd_start_rsp()
608 wcn->fw_major, wcn->fw_minor, in wcn36xx_smd_start_rsp()
609 wcn->fw_version, wcn->fw_revision, in wcn36xx_smd_start_rsp()
610 rsp->start_rsp_params.stations, in wcn36xx_smd_start_rsp()
611 rsp->start_rsp_params.bssids); in wcn36xx_smd_start_rsp()
625 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_start()
631 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_start()
633 body = (struct wcn36xx_hal_mac_start_req_msg *)wcn->hal_buf; in wcn36xx_smd_start()
634 len = body->header.len; in wcn36xx_smd_start()
636 if (wcn->rf_id == RF_IRIS_WCN3680) { in wcn36xx_smd_start()
650 body->header.len = len; in wcn36xx_smd_start()
651 body->params.len = len - sizeof(*body); in wcn36xx_smd_start()
656 ret = wcn36xx_smd_send_and_wait(wcn, body->header.len); in wcn36xx_smd_start()
662 ret = wcn36xx_smd_start_rsp(wcn, wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_start()
669 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_start()
678 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_stop()
683 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_stop()
690 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_stop()
696 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_stop()
707 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_init_scan()
711 if (vif_priv->bss_index != WCN36XX_HAL_BSS_INVALID_IDX) { in wcn36xx_smd_init_scan()
715 msg_body.scan_entry.bss_index[0] = vif_priv->bss_index; in wcn36xx_smd_init_scan()
719 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_init_scan()
728 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_init_scan()
734 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_init_scan()
743 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_start_scan()
748 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_start_scan()
758 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_start_scan()
764 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_start_scan()
773 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_end_scan()
778 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_end_scan()
788 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_end_scan()
794 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_end_scan()
806 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_finish_scan()
811 if (vif_priv->bss_index != WCN36XX_HAL_BSS_INVALID_IDX) { in wcn36xx_smd_finish_scan()
815 msg_body.scan_entry.bss_index[0] = vif_priv->bss_index; in wcn36xx_smd_finish_scan()
819 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_finish_scan()
829 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_finish_scan()
835 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_finish_scan()
846 if (req->ie_len > WCN36XX_MAX_SCAN_IE_LEN) in wcn36xx_smd_start_hw_scan()
847 return -EINVAL; in wcn36xx_smd_start_hw_scan()
849 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_start_hw_scan()
852 ret = -ENOMEM; in wcn36xx_smd_start_hw_scan()
858 msg_body->scan_type = WCN36XX_HAL_SCAN_TYPE_ACTIVE; in wcn36xx_smd_start_hw_scan()
859 msg_body->min_ch_time = 30; in wcn36xx_smd_start_hw_scan()
860 msg_body->max_ch_time = 100; in wcn36xx_smd_start_hw_scan()
861 msg_body->scan_hidden = 1; in wcn36xx_smd_start_hw_scan()
862 memcpy(msg_body->mac, vif->addr, ETH_ALEN); in wcn36xx_smd_start_hw_scan()
863 msg_body->bss_type = vif_priv->bss_type; in wcn36xx_smd_start_hw_scan()
864 msg_body->p2p_search = vif->p2p; in wcn36xx_smd_start_hw_scan()
866 msg_body->num_ssid = min_t(u8, req->n_ssids, ARRAY_SIZE(msg_body->ssids)); in wcn36xx_smd_start_hw_scan()
867 for (i = 0; i < msg_body->num_ssid; i++) { in wcn36xx_smd_start_hw_scan()
868 msg_body->ssids[i].length = min_t(u8, req->ssids[i].ssid_len, in wcn36xx_smd_start_hw_scan()
869 sizeof(msg_body->ssids[i].ssid)); in wcn36xx_smd_start_hw_scan()
870 memcpy(msg_body->ssids[i].ssid, req->ssids[i].ssid, in wcn36xx_smd_start_hw_scan()
871 msg_body->ssids[i].length); in wcn36xx_smd_start_hw_scan()
874 msg_body->num_channel = min_t(u8, req->n_channels, in wcn36xx_smd_start_hw_scan()
875 sizeof(msg_body->channels)); in wcn36xx_smd_start_hw_scan()
876 for (i = 0; i < msg_body->num_channel; i++) { in wcn36xx_smd_start_hw_scan()
877 msg_body->channels[i] = in wcn36xx_smd_start_hw_scan()
878 HW_VALUE_CHANNEL(req->channels[i]->hw_value); in wcn36xx_smd_start_hw_scan()
881 msg_body->header.len -= WCN36XX_MAX_SCAN_IE_LEN; in wcn36xx_smd_start_hw_scan()
883 if (req->ie_len > 0) { in wcn36xx_smd_start_hw_scan()
884 msg_body->ie_len = req->ie_len; in wcn36xx_smd_start_hw_scan()
885 msg_body->header.len += req->ie_len; in wcn36xx_smd_start_hw_scan()
886 memcpy(msg_body->ie, req->ie, req->ie_len); in wcn36xx_smd_start_hw_scan()
889 PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body)); in wcn36xx_smd_start_hw_scan()
892 "hal start hw-scan (channels: %u; ssids: %u; p2p: %s)\n", in wcn36xx_smd_start_hw_scan()
893 msg_body->num_channel, msg_body->num_ssid, in wcn36xx_smd_start_hw_scan()
894 msg_body->p2p_search ? "yes" : "no"); in wcn36xx_smd_start_hw_scan()
896 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len); in wcn36xx_smd_start_hw_scan()
901 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_start_hw_scan()
909 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_start_hw_scan()
918 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_stop_hw_scan()
920 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_stop_hw_scan()
922 wcn36xx_dbg(WCN36XX_DBG_HAL, "hal stop hw-scan\n"); in wcn36xx_smd_stop_hw_scan()
929 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_stop_hw_scan()
936 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_stop_hw_scan()
950 rsp->channel_number, rsp->status); in wcn36xx_smd_switch_channel_rsp()
960 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_switch_channel()
966 memcpy(msg_body.self_sta_mac_addr, vif->addr, ETH_ALEN); in wcn36xx_smd_switch_channel()
968 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_switch_channel()
975 ret = wcn36xx_smd_switch_channel_rsp(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_switch_channel()
981 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_switch_channel()
998 rsp->header.len); in wcn36xx_smd_process_ptt_msg_rsp()
999 wcn36xx_dbg_dump(WCN36XX_DBG_HAL_DUMP, "HAL_PTT_MSG_RSP:", rsp->ptt_msg, in wcn36xx_smd_process_ptt_msg_rsp()
1000 rsp->header.len - sizeof(rsp->ptt_msg_resp_status)); in wcn36xx_smd_process_ptt_msg_rsp()
1002 if (rsp->header.len > 0) { in wcn36xx_smd_process_ptt_msg_rsp()
1003 *p_ptt_rsp_msg = kmemdup(rsp->ptt_msg, rsp->header.len, in wcn36xx_smd_process_ptt_msg_rsp()
1006 return -ENOMEM; in wcn36xx_smd_process_ptt_msg_rsp()
1018 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_process_ptt_msg()
1023 ret = -ENOMEM; in wcn36xx_smd_process_ptt_msg()
1028 memcpy(&p_msg_body->ptt_msg, ptt_msg, len); in wcn36xx_smd_process_ptt_msg()
1030 PREPARE_HAL_PTT_MSG_BUF(wcn->hal_buf, p_msg_body); in wcn36xx_smd_process_ptt_msg()
1032 ret = wcn36xx_smd_send_and_wait(wcn, p_msg_body->header.len); in wcn36xx_smd_process_ptt_msg()
1037 ret = wcn36xx_smd_process_ptt_msg_rsp(wcn->hal_buf, wcn->hal_rsp_len, in wcn36xx_smd_process_ptt_msg()
1046 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_process_ptt_msg()
1057 rsp->status &= (~(WCN36XX_FW_MSG_PNO_VERSION_MASK)); in wcn36xx_smd_update_scan_params_rsp()
1059 if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status) { in wcn36xx_smd_update_scan_params_rsp()
1061 return rsp->status; in wcn36xx_smd_update_scan_params_rsp()
1068 u8 *channels, size_t channel_count) in wcn36xx_smd_update_scan_params() argument
1073 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_update_scan_params()
1080 memcpy(msg_body.channels, channels, channel_count); in wcn36xx_smd_update_scan_params()
1087 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_update_scan_params()
1098 ret = wcn36xx_smd_update_scan_params_rsp(wcn->hal_buf, in wcn36xx_smd_update_scan_params()
1099 wcn->hal_rsp_len); in wcn36xx_smd_update_scan_params()
1106 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_update_scan_params()
1119 return -EINVAL; in wcn36xx_smd_add_sta_self_rsp()
1123 if (rsp->status != WCN36XX_FW_MSG_RESULT_SUCCESS) { in wcn36xx_smd_add_sta_self_rsp()
1125 rsp->status); in wcn36xx_smd_add_sta_self_rsp()
1126 return rsp->status; in wcn36xx_smd_add_sta_self_rsp()
1131 rsp->status, rsp->self_sta_index, rsp->dpu_index); in wcn36xx_smd_add_sta_self_rsp()
1133 vif_priv->self_sta_index = rsp->self_sta_index; in wcn36xx_smd_add_sta_self_rsp()
1134 vif_priv->self_dpu_desc_index = rsp->dpu_index; in wcn36xx_smd_add_sta_self_rsp()
1144 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_add_sta_self()
1147 memcpy(&msg_body.self_addr, vif->addr, ETH_ALEN); in wcn36xx_smd_add_sta_self()
1149 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_add_sta_self()
1162 wcn->hal_buf, in wcn36xx_smd_add_sta_self()
1163 wcn->hal_rsp_len); in wcn36xx_smd_add_sta_self()
1169 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_add_sta_self()
1178 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_delete_sta_self()
1183 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_delete_sta_self()
1190 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_delete_sta_self()
1197 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_delete_sta_self()
1206 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_delete_sta()
1211 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_delete_sta()
1222 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_delete_sta()
1228 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_delete_sta()
1237 return -EIO; in wcn36xx_smd_join_rsp()
1243 rsp->status, rsp->tx_mgmt_power); in wcn36xx_smd_join_rsp()
1253 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_join()
1260 if (conf_is_ht40_minus(&wcn->hw->conf)) in wcn36xx_smd_join()
1263 else if (conf_is_ht40_plus(&wcn->hw->conf)) in wcn36xx_smd_join()
1273 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_join()
1285 ret = wcn36xx_smd_join_rsp(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_join()
1291 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_join()
1302 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_set_link_st()
1309 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_set_link_st()
1320 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_set_link_st()
1326 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_set_link_st()
1335 memcpy(&v1->bssid, orig->bssid, ETH_ALEN); in wcn36xx_smd_convert_sta_to_v1()
1336 memcpy(&v1->mac, orig->mac, ETH_ALEN); in wcn36xx_smd_convert_sta_to_v1()
1337 v1->aid = orig->aid; in wcn36xx_smd_convert_sta_to_v1()
1338 v1->type = orig->type; in wcn36xx_smd_convert_sta_to_v1()
1339 v1->short_preamble_supported = orig->short_preamble_supported; in wcn36xx_smd_convert_sta_to_v1()
1340 v1->listen_interval = orig->listen_interval; in wcn36xx_smd_convert_sta_to_v1()
1341 v1->wmm_enabled = orig->wmm_enabled; in wcn36xx_smd_convert_sta_to_v1()
1342 v1->ht_capable = orig->ht_capable; in wcn36xx_smd_convert_sta_to_v1()
1343 v1->tx_channel_width_set = orig->tx_channel_width_set; in wcn36xx_smd_convert_sta_to_v1()
1344 v1->rifs_mode = orig->rifs_mode; in wcn36xx_smd_convert_sta_to_v1()
1345 v1->lsig_txop_protection = orig->lsig_txop_protection; in wcn36xx_smd_convert_sta_to_v1()
1346 v1->max_ampdu_size = orig->max_ampdu_size; in wcn36xx_smd_convert_sta_to_v1()
1347 v1->max_ampdu_density = orig->max_ampdu_density; in wcn36xx_smd_convert_sta_to_v1()
1348 v1->sgi_40mhz = orig->sgi_40mhz; in wcn36xx_smd_convert_sta_to_v1()
1349 v1->sgi_20Mhz = orig->sgi_20Mhz; in wcn36xx_smd_convert_sta_to_v1()
1350 v1->rmf = orig->rmf; in wcn36xx_smd_convert_sta_to_v1()
1351 v1->encrypt_type = orig->encrypt_type; in wcn36xx_smd_convert_sta_to_v1()
1352 v1->action = orig->action; in wcn36xx_smd_convert_sta_to_v1()
1353 v1->uapsd = orig->uapsd; in wcn36xx_smd_convert_sta_to_v1()
1354 v1->max_sp_len = orig->max_sp_len; in wcn36xx_smd_convert_sta_to_v1()
1355 v1->green_field_capable = orig->green_field_capable; in wcn36xx_smd_convert_sta_to_v1()
1356 v1->mimo_ps = orig->mimo_ps; in wcn36xx_smd_convert_sta_to_v1()
1357 v1->delayed_ba_support = orig->delayed_ba_support; in wcn36xx_smd_convert_sta_to_v1()
1358 v1->max_ampdu_duration = orig->max_ampdu_duration; in wcn36xx_smd_convert_sta_to_v1()
1359 v1->dsss_cck_mode_40mhz = orig->dsss_cck_mode_40mhz; in wcn36xx_smd_convert_sta_to_v1()
1360 memcpy(&v1->supported_rates, &orig->supported_rates, in wcn36xx_smd_convert_sta_to_v1()
1361 sizeof(orig->supported_rates)); in wcn36xx_smd_convert_sta_to_v1()
1362 v1->sta_index = orig->sta_index; in wcn36xx_smd_convert_sta_to_v1()
1363 v1->bssid_index = orig->bssid_index; in wcn36xx_smd_convert_sta_to_v1()
1364 v1->p2p = orig->p2p; in wcn36xx_smd_convert_sta_to_v1()
1383 memcpy(&sta_par->supported_rates, &sta_priv->supported_rates, in wcn36xx_smd_set_sta_params_v1()
1384 sizeof(sta_par->supported_rates)); in wcn36xx_smd_set_sta_params_v1()
1386 wcn36xx_set_default_rates_v1(&sta_par->supported_rates); in wcn36xx_smd_set_sta_params_v1()
1402 return -EINVAL; in wcn36xx_smd_config_sta_rsp()
1405 params = &rsp->params; in wcn36xx_smd_config_sta_rsp()
1407 if (params->status != WCN36XX_FW_MSG_RESULT_SUCCESS) { in wcn36xx_smd_config_sta_rsp()
1409 params->status); in wcn36xx_smd_config_sta_rsp()
1410 return -EIO; in wcn36xx_smd_config_sta_rsp()
1413 sta_priv->sta_index = params->sta_index; in wcn36xx_smd_config_sta_rsp()
1414 sta_priv->dpu_desc_index = params->dpu_index; in wcn36xx_smd_config_sta_rsp()
1415 sta_priv->ucast_dpu_sign = params->uc_ucast_sig; in wcn36xx_smd_config_sta_rsp()
1419 params->status, params->sta_index, params->bssid_index, in wcn36xx_smd_config_sta_rsp()
1420 params->uc_ucast_sig, params->p2p); in wcn36xx_smd_config_sta_rsp()
1432 if (wcn->rf_id == RF_IRIS_WCN3680) { in wcn36xx_smd_config_sta_v1()
1436 msg_body.header.len -= WCN36XX_DIFF_STA_PARAMS_V1_NOVHT; in wcn36xx_smd_config_sta_v1()
1443 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_config_sta_v1()
1447 sta_params->action, sta_params->sta_index, sta_params->bssid_index, in wcn36xx_smd_config_sta_v1()
1448 sta_params->bssid, sta_params->type, sta_params->mac, sta_params->aid); in wcn36xx_smd_config_sta_v1()
1466 PREPARE_HAL_BUF(wcn->hal_buf, msg); in wcn36xx_smd_config_sta_v0()
1470 sta_params->action, sta_params->sta_index, in wcn36xx_smd_config_sta_v0()
1471 sta_params->bssid_index, sta_params->bssid, in wcn36xx_smd_config_sta_v0()
1472 sta_params->type, sta_params->mac, sta_params->aid); in wcn36xx_smd_config_sta_v0()
1482 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_config_sta()
1495 wcn->hal_buf, in wcn36xx_smd_config_sta()
1496 wcn->hal_rsp_len); in wcn36xx_smd_config_sta()
1502 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_config_sta()
1517 memcpy(&bss->bssid, bssid, ETH_ALEN); in wcn36xx_smd_set_bss_params()
1519 memcpy(bss->self_mac_addr, vif->addr, ETH_ALEN); in wcn36xx_smd_set_bss_params()
1521 if (vif->type == NL80211_IFTYPE_STATION) { in wcn36xx_smd_set_bss_params()
1522 bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE; in wcn36xx_smd_set_bss_params()
1525 bss->oper_mode = 1; in wcn36xx_smd_set_bss_params()
1526 bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_MODE; in wcn36xx_smd_set_bss_params()
1527 } else if (vif->type == NL80211_IFTYPE_AP || in wcn36xx_smd_set_bss_params()
1528 vif->type == NL80211_IFTYPE_MESH_POINT) { in wcn36xx_smd_set_bss_params()
1529 bss->bss_type = WCN36XX_HAL_INFRA_AP_MODE; in wcn36xx_smd_set_bss_params()
1532 bss->oper_mode = 0; in wcn36xx_smd_set_bss_params()
1533 bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_SAP_MODE; in wcn36xx_smd_set_bss_params()
1534 } else if (vif->type == NL80211_IFTYPE_ADHOC) { in wcn36xx_smd_set_bss_params()
1535 bss->bss_type = WCN36XX_HAL_IBSS_MODE; in wcn36xx_smd_set_bss_params()
1538 bss->oper_mode = 1; in wcn36xx_smd_set_bss_params()
1540 wcn36xx_warn("Unknown type for bss config: %d\n", vif->type); in wcn36xx_smd_set_bss_params()
1543 if (vif->type == NL80211_IFTYPE_STATION) in wcn36xx_smd_set_bss_params()
1546 bss->nw_type = WCN36XX_HAL_11N_NW_TYPE; in wcn36xx_smd_set_bss_params()
1548 bss->short_slot_time_supported = vif->bss_conf.use_short_slot; in wcn36xx_smd_set_bss_params()
1549 bss->lla_coexist = 0; in wcn36xx_smd_set_bss_params()
1550 bss->llb_coexist = 0; in wcn36xx_smd_set_bss_params()
1551 bss->llg_coexist = 0; in wcn36xx_smd_set_bss_params()
1552 bss->rifs_mode = 0; in wcn36xx_smd_set_bss_params()
1553 bss->beacon_interval = vif->bss_conf.beacon_int; in wcn36xx_smd_set_bss_params()
1554 bss->dtim_period = vif_priv->dtim_period; in wcn36xx_smd_set_bss_params()
1558 bss->oper_channel = WCN36XX_HW_CHANNEL(wcn); in wcn36xx_smd_set_bss_params()
1560 if (conf_is_ht40_minus(&wcn->hw->conf)) in wcn36xx_smd_set_bss_params()
1561 bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in wcn36xx_smd_set_bss_params()
1562 else if (conf_is_ht40_plus(&wcn->hw->conf)) in wcn36xx_smd_set_bss_params()
1563 bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in wcn36xx_smd_set_bss_params()
1565 bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_NONE; in wcn36xx_smd_set_bss_params()
1567 bss->reserved = 0; in wcn36xx_smd_set_bss_params()
1569 /* wcn->ssid is only valid in AP and IBSS mode */ in wcn36xx_smd_set_bss_params()
1570 bss->ssid.length = vif_priv->ssid.length; in wcn36xx_smd_set_bss_params()
1571 memcpy(bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length); in wcn36xx_smd_set_bss_params()
1573 bss->obss_prot_enabled = 0; in wcn36xx_smd_set_bss_params()
1574 bss->rmf = 0; in wcn36xx_smd_set_bss_params()
1575 bss->max_probe_resp_retry_limit = 0; in wcn36xx_smd_set_bss_params()
1576 bss->hidden_ssid = vif->bss_conf.hidden_ssid; in wcn36xx_smd_set_bss_params()
1577 bss->proxy_probe_resp = 0; in wcn36xx_smd_set_bss_params()
1578 bss->edca_params_valid = 0; in wcn36xx_smd_set_bss_params()
1582 bss->ext_set_sta_key_param_valid = 0; in wcn36xx_smd_set_bss_params()
1586 bss->spectrum_mgt_enable = 0; in wcn36xx_smd_set_bss_params()
1587 bss->tx_mgmt_power = 0; in wcn36xx_smd_set_bss_params()
1588 bss->max_tx_power = WCN36XX_MAX_POWER(wcn); in wcn36xx_smd_set_bss_params()
1589 bss->action = update; in wcn36xx_smd_set_bss_params()
1591 vif_priv->bss_type = bss->bss_type; in wcn36xx_smd_set_bss_params()
1609 return -ENOMEM; in wcn36xx_smd_config_bss_v1()
1611 if (wcn->rf_id == RF_IRIS_WCN3680) { in wcn36xx_smd_config_bss_v1()
1615 msg_body->header.len -= WCN36XX_DIFF_BSS_PARAMS_V1_NOVHT; in wcn36xx_smd_config_bss_v1()
1618 bss = &msg_body->bss_params; in wcn36xx_smd_config_bss_v1()
1619 sta = &bss->sta; in wcn36xx_smd_config_bss_v1()
1626 memcpy(bss->bssid, &bss_v0.bssid, ETH_ALEN); in wcn36xx_smd_config_bss_v1()
1627 memcpy(bss->self_mac_addr, &bss_v0.self_mac_addr, ETH_ALEN); in wcn36xx_smd_config_bss_v1()
1629 bss->bss_type = bss_v0.bss_type; in wcn36xx_smd_config_bss_v1()
1630 bss->oper_mode = bss_v0.oper_mode; in wcn36xx_smd_config_bss_v1()
1631 bss->nw_type = bss_v0.nw_type; in wcn36xx_smd_config_bss_v1()
1633 bss->short_slot_time_supported = in wcn36xx_smd_config_bss_v1()
1635 bss->lla_coexist = bss_v0.lla_coexist; in wcn36xx_smd_config_bss_v1()
1636 bss->llb_coexist = bss_v0.llb_coexist; in wcn36xx_smd_config_bss_v1()
1637 bss->llg_coexist = bss_v0.llg_coexist; in wcn36xx_smd_config_bss_v1()
1638 bss->ht20_coexist = bss_v0.ht20_coexist; in wcn36xx_smd_config_bss_v1()
1639 bss->lln_non_gf_coexist = bss_v0.lln_non_gf_coexist; in wcn36xx_smd_config_bss_v1()
1641 bss->lsig_tx_op_protection_full_support = in wcn36xx_smd_config_bss_v1()
1643 bss->rifs_mode = bss_v0.rifs_mode; in wcn36xx_smd_config_bss_v1()
1644 bss->beacon_interval = bss_v0.beacon_interval; in wcn36xx_smd_config_bss_v1()
1645 bss->dtim_period = bss_v0.dtim_period; in wcn36xx_smd_config_bss_v1()
1646 bss->tx_channel_width_set = bss_v0.tx_channel_width_set; in wcn36xx_smd_config_bss_v1()
1647 bss->oper_channel = bss_v0.oper_channel; in wcn36xx_smd_config_bss_v1()
1649 if (wcn->hw->conf.chandef.width == NL80211_CHAN_WIDTH_80) { in wcn36xx_smd_config_bss_v1()
1650 chandef = &wcn->hw->conf.chandef; in wcn36xx_smd_config_bss_v1()
1651 bss->ext_channel = HW_VALUE_PHY(chandef->chan->hw_value); in wcn36xx_smd_config_bss_v1()
1653 bss->ext_channel = bss_v0.ext_channel; in wcn36xx_smd_config_bss_v1()
1656 bss->reserved = bss_v0.reserved; in wcn36xx_smd_config_bss_v1()
1658 memcpy(&bss->ssid, &bss_v0.ssid, in wcn36xx_smd_config_bss_v1()
1661 bss->action = bss_v0.action; in wcn36xx_smd_config_bss_v1()
1662 bss->rateset = bss_v0.rateset; in wcn36xx_smd_config_bss_v1()
1663 bss->ht = bss_v0.ht; in wcn36xx_smd_config_bss_v1()
1664 bss->obss_prot_enabled = bss_v0.obss_prot_enabled; in wcn36xx_smd_config_bss_v1()
1665 bss->rmf = bss_v0.rmf; in wcn36xx_smd_config_bss_v1()
1666 bss->ht_oper_mode = bss_v0.ht_oper_mode; in wcn36xx_smd_config_bss_v1()
1667 bss->dual_cts_protection = bss_v0.dual_cts_protection; in wcn36xx_smd_config_bss_v1()
1669 bss->max_probe_resp_retry_limit = in wcn36xx_smd_config_bss_v1()
1671 bss->hidden_ssid = bss_v0.hidden_ssid; in wcn36xx_smd_config_bss_v1()
1672 bss->proxy_probe_resp = bss_v0.proxy_probe_resp; in wcn36xx_smd_config_bss_v1()
1673 bss->edca_params_valid = bss_v0.edca_params_valid; in wcn36xx_smd_config_bss_v1()
1675 memcpy(&bss->acbe, &bss_v0.acbe, in wcn36xx_smd_config_bss_v1()
1677 memcpy(&bss->acbk, &bss_v0.acbk, in wcn36xx_smd_config_bss_v1()
1679 memcpy(&bss->acvi, &bss_v0.acvi, in wcn36xx_smd_config_bss_v1()
1681 memcpy(&bss->acvo, &bss_v0.acvo, in wcn36xx_smd_config_bss_v1()
1684 bss->ext_set_sta_key_param_valid = in wcn36xx_smd_config_bss_v1()
1687 memcpy(&bss->ext_set_sta_key_param, in wcn36xx_smd_config_bss_v1()
1691 bss->wcn36xx_hal_persona = bss_v0.wcn36xx_hal_persona; in wcn36xx_smd_config_bss_v1()
1692 bss->spectrum_mgt_enable = bss_v0.spectrum_mgt_enable; in wcn36xx_smd_config_bss_v1()
1693 bss->tx_mgmt_power = bss_v0.tx_mgmt_power; in wcn36xx_smd_config_bss_v1()
1694 bss->max_tx_power = bss_v0.max_tx_power; in wcn36xx_smd_config_bss_v1()
1698 PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body)); in wcn36xx_smd_config_bss_v1()
1702 bss->bssid, bss->self_mac_addr, bss->bss_type, in wcn36xx_smd_config_bss_v1()
1703 bss->oper_mode, bss->nw_type); in wcn36xx_smd_config_bss_v1()
1706 "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n", in wcn36xx_smd_config_bss_v1()
1707 sta->bssid, sta->action, sta->sta_index, in wcn36xx_smd_config_bss_v1()
1708 sta->bssid_index, sta->aid, sta->type, sta->mac); in wcn36xx_smd_config_bss_v1()
1710 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len); in wcn36xx_smd_config_bss_v1()
1729 return -ENOMEM; in wcn36xx_smd_config_bss_v0()
1733 bss = &msg->bss_params; in wcn36xx_smd_config_bss_v0()
1734 sta_params = &bss->sta; in wcn36xx_smd_config_bss_v0()
1739 PREPARE_HAL_BUF(wcn->hal_buf, (*msg)); in wcn36xx_smd_config_bss_v0()
1743 bss->bssid, bss->self_mac_addr, bss->bss_type, in wcn36xx_smd_config_bss_v0()
1744 bss->oper_mode, bss->nw_type); in wcn36xx_smd_config_bss_v0()
1747 "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n", in wcn36xx_smd_config_bss_v0()
1748 sta_params->bssid, sta_params->action, in wcn36xx_smd_config_bss_v0()
1749 sta_params->sta_index, sta_params->bssid_index, in wcn36xx_smd_config_bss_v0()
1750 sta_params->aid, sta_params->type, in wcn36xx_smd_config_bss_v0()
1751 sta_params->mac); in wcn36xx_smd_config_bss_v0()
1753 ret = wcn36xx_smd_send_and_wait(wcn, msg->header.len); in wcn36xx_smd_config_bss_v0()
1770 return -EINVAL; in wcn36xx_smd_config_bss_rsp()
1773 params = &rsp->bss_rsp_params; in wcn36xx_smd_config_bss_rsp()
1775 if (params->status != WCN36XX_FW_MSG_RESULT_SUCCESS) { in wcn36xx_smd_config_bss_rsp()
1777 params->status); in wcn36xx_smd_config_bss_rsp()
1778 return -EIO; in wcn36xx_smd_config_bss_rsp()
1785 params->status, params->bss_index, params->dpu_desc_index, in wcn36xx_smd_config_bss_rsp()
1786 params->bss_sta_index, params->bss_self_sta_index, in wcn36xx_smd_config_bss_rsp()
1787 params->bss_bcast_sta_idx, params->mac, in wcn36xx_smd_config_bss_rsp()
1788 params->tx_mgmt_power, params->ucast_dpu_signature); in wcn36xx_smd_config_bss_rsp()
1790 vif_priv->bss_index = params->bss_index; in wcn36xx_smd_config_bss_rsp()
1794 sta_priv->bss_sta_index = params->bss_sta_index; in wcn36xx_smd_config_bss_rsp()
1795 sta_priv->bss_dpu_desc_index = params->dpu_desc_index; in wcn36xx_smd_config_bss_rsp()
1798 vif_priv->self_ucast_dpu_sign = params->ucast_dpu_signature; in wcn36xx_smd_config_bss_rsp()
1809 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_config_bss()
1823 wcn->hal_buf, in wcn36xx_smd_config_bss()
1824 wcn->hal_rsp_len); in wcn36xx_smd_config_bss()
1829 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_config_bss()
1839 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_delete_bss()
1841 if (vif_priv->bss_index == WCN36XX_HAL_BSS_INVALID_IDX) in wcn36xx_smd_delete_bss()
1846 msg_body.bss_index = vif_priv->bss_index; in wcn36xx_smd_delete_bss()
1848 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_delete_bss()
1857 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_delete_bss()
1863 vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX; in wcn36xx_smd_delete_bss()
1865 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_delete_bss()
1876 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_send_beacon()
1879 pvm_len = skb_beacon->data[tim_off + 1] - 3; in wcn36xx_smd_send_beacon()
1880 pad = TIM_MIN_PVM_SIZE - pvm_len; in wcn36xx_smd_send_beacon()
1883 if (vif->type == NL80211_IFTYPE_MESH_POINT) in wcn36xx_smd_send_beacon()
1886 msg_body.beacon_length = skb_beacon->len + pad; in wcn36xx_smd_send_beacon()
1893 ret = -ENOMEM; in wcn36xx_smd_send_beacon()
1896 memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len); in wcn36xx_smd_send_beacon()
1897 memcpy(msg_body.bssid, vif->addr, ETH_ALEN); in wcn36xx_smd_send_beacon()
1910 skb_beacon->len - (tim_off + 5 + pvm_len)); in wcn36xx_smd_send_beacon()
1916 if (vif->type == NL80211_IFTYPE_MESH_POINT) in wcn36xx_smd_send_beacon()
1922 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_send_beacon()
1933 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_send_beacon()
1939 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_send_beacon()
1950 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_update_proberesp_tmpl()
1953 if (skb->len > BEACON_TEMPLATE_SIZE) { in wcn36xx_smd_update_proberesp_tmpl()
1955 skb->len); in wcn36xx_smd_update_proberesp_tmpl()
1956 ret = -E2BIG; in wcn36xx_smd_update_proberesp_tmpl()
1960 msg.probe_resp_template_len = skb->len; in wcn36xx_smd_update_proberesp_tmpl()
1961 memcpy(&msg.probe_resp_template, skb->data, skb->len); in wcn36xx_smd_update_proberesp_tmpl()
1963 memcpy(msg.bssid, vif->addr, ETH_ALEN); in wcn36xx_smd_update_proberesp_tmpl()
1965 PREPARE_HAL_BUF(wcn->hal_buf, msg); in wcn36xx_smd_update_proberesp_tmpl()
1976 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_update_proberesp_tmpl()
1983 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_update_proberesp_tmpl()
1997 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_set_stakey()
2019 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_set_stakey()
2026 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_set_stakey()
2032 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_set_stakey()
2046 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_set_bsskey()
2058 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_set_bsskey()
2065 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_set_bsskey()
2071 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_set_bsskey()
2083 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_remove_stakey()
2090 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_remove_stakey()
2097 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_remove_stakey()
2103 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_remove_stakey()
2115 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_remove_bsskey()
2121 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_remove_bsskey()
2128 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_remove_bsskey()
2134 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_remove_bsskey()
2144 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_enter_bmps()
2147 msg_body.bss_index = vif_priv->bss_index; in wcn36xx_smd_enter_bmps()
2148 msg_body.tbtt = vif->bss_conf.sync_tsf; in wcn36xx_smd_enter_bmps()
2149 msg_body.dtim_period = vif_priv->dtim_period; in wcn36xx_smd_enter_bmps()
2151 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_enter_bmps()
2158 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_enter_bmps()
2164 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_enter_bmps()
2174 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_exit_bmps()
2177 msg_body.bss_index = vif_priv->bss_index; in wcn36xx_smd_exit_bmps()
2179 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_exit_bmps()
2186 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_exit_bmps()
2192 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_exit_bmps()
2201 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_set_power_params()
2213 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_set_power_params()
2222 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_set_power_params()
2237 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_keep_alive_req()
2241 msg_body.bss_index = vif_priv->bss_index; in wcn36xx_smd_keep_alive_req()
2248 ret = -EINVAL; in wcn36xx_smd_keep_alive_req()
2252 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_keep_alive_req()
2259 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_keep_alive_req()
2265 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_keep_alive_req()
2275 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_dump_cmd_req()
2284 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_dump_cmd_req()
2291 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_dump_cmd_req()
2297 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_dump_cmd_req()
2321 return -EINVAL; in get_feat_caps()
2349 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_feature_caps_exchange()
2353 if (wcn->rf_id == RF_IRIS_WCN3680) in wcn36xx_smd_feature_caps_exchange()
2356 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_feature_caps_exchange()
2363 if (wcn->hal_rsp_len != sizeof(*rsp)) { in wcn36xx_smd_feature_caps_exchange()
2368 rsp = (struct wcn36xx_hal_feat_caps_msg *) wcn->hal_buf; in wcn36xx_smd_feature_caps_exchange()
2371 wcn->fw_feat_caps[i] = rsp->feat_caps[i]; in wcn36xx_smd_feature_caps_exchange()
2373 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_feature_caps_exchange()
2382 return -EINVAL; in wcn36xx_smd_add_ba_session_rsp()
2385 if (rsp->status != WCN36XX_FW_MSG_RESULT_SUCCESS) in wcn36xx_smd_add_ba_session_rsp()
2386 return rsp->status; in wcn36xx_smd_add_ba_session_rsp()
2388 *session = rsp->ba_session_id; in wcn36xx_smd_add_ba_session_rsp()
2404 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_add_ba_session()
2408 memcpy(&msg_body.mac_addr, sta->addr, ETH_ALEN); in wcn36xx_smd_add_ba_session()
2420 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_add_ba_session()
2427 ret = wcn36xx_smd_add_ba_session_rsp(wcn->hal_buf, wcn->hal_rsp_len, in wcn36xx_smd_add_ba_session()
2436 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_add_ba_session()
2445 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_add_ba()
2451 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_add_ba()
2458 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_add_ba()
2464 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_add_ba()
2473 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_del_ba()
2479 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_del_ba()
2486 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_del_ba()
2492 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_del_ba()
2501 return -EINVAL; in wcn36xx_smd_trigger_ba_rsp()
2504 return rsp->status; in wcn36xx_smd_trigger_ba_rsp()
2513 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_trigger_ba()
2519 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_trigger_ba()
2522 (wcn->hal_buf + sizeof(msg_body)); in wcn36xx_smd_trigger_ba()
2523 candidate->sta_index = sta_index; in wcn36xx_smd_trigger_ba()
2524 candidate->tid_bitmap = 1 << tid; in wcn36xx_smd_trigger_ba()
2531 ret = wcn36xx_smd_trigger_ba_rsp(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_trigger_ba()
2537 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_trigger_ba()
2547 return -EIO; in wcn36xx_smd_tx_compl_ind()
2550 wcn36xx_dxe_tx_ack_ind(wcn, rsp->status); in wcn36xx_smd_tx_compl_ind()
2562 return -EIO; in wcn36xx_smd_hw_scan_ind()
2565 wcn36xx_dbg(WCN36XX_DBG_HAL, "scan indication (type %x)\n", rsp->type); in wcn36xx_smd_hw_scan_ind()
2567 switch (rsp->type) { in wcn36xx_smd_hw_scan_ind()
2573 mutex_lock(&wcn->scan_lock); in wcn36xx_smd_hw_scan_ind()
2574 wcn->scan_req = NULL; in wcn36xx_smd_hw_scan_ind()
2575 if (wcn->scan_aborted) in wcn36xx_smd_hw_scan_ind()
2577 mutex_unlock(&wcn->scan_lock); in wcn36xx_smd_hw_scan_ind()
2578 ieee80211_scan_completed(wcn->hw, &scan_info); in wcn36xx_smd_hw_scan_ind()
2586 wcn36xx_warn("Unknown scan indication type %x\n", rsp->type); in wcn36xx_smd_hw_scan_ind()
2602 list_for_each_entry(tmp, &wcn->vif_list, list) { in wcn36xx_smd_missed_beacon_ind()
2604 tmp->bss_index); in wcn36xx_smd_missed_beacon_ind()
2613 return -EIO; in wcn36xx_smd_missed_beacon_ind()
2616 list_for_each_entry(tmp, &wcn->vif_list, list) { in wcn36xx_smd_missed_beacon_ind()
2617 if (tmp->bss_index == rsp->bss_index) { in wcn36xx_smd_missed_beacon_ind()
2619 rsp->bss_index); in wcn36xx_smd_missed_beacon_ind()
2626 wcn36xx_warn("BSS index %d not found\n", rsp->bss_index); in wcn36xx_smd_missed_beacon_ind()
2627 return -ENOENT; in wcn36xx_smd_missed_beacon_ind()
2640 return -EIO; in wcn36xx_smd_delete_sta_context_ind()
2644 rsp->addr2, rsp->sta_id); in wcn36xx_smd_delete_sta_context_ind()
2646 list_for_each_entry(tmp, &wcn->vif_list, list) { in wcn36xx_smd_delete_sta_context_ind()
2648 sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2); in wcn36xx_smd_delete_sta_context_ind()
2657 rsp->addr2, in wcn36xx_smd_delete_sta_context_ind()
2658 rsp->sta_id); in wcn36xx_smd_delete_sta_context_ind()
2659 return -ENOENT; in wcn36xx_smd_delete_sta_context_ind()
2671 return -EIO; in wcn36xx_smd_print_reg_info_ind()
2676 rsp->scenario, rsp->reason); in wcn36xx_smd_print_reg_info_ind()
2678 for (i = 0; i < rsp->count; i++) { in wcn36xx_smd_print_reg_info_ind()
2680 rsp->regs[i].addr, rsp->regs[i].value); in wcn36xx_smd_print_reg_info_ind()
2692 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_update_cfg()
2695 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); in wcn36xx_smd_update_cfg()
2697 body = (struct wcn36xx_hal_update_cfg_req_msg *) wcn->hal_buf; in wcn36xx_smd_update_cfg()
2701 body->header.len = len; in wcn36xx_smd_update_cfg()
2702 body->len = len - sizeof(*body); in wcn36xx_smd_update_cfg()
2704 ret = wcn36xx_smd_send_and_wait(wcn, body->header.len); in wcn36xx_smd_update_cfg()
2709 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_update_cfg()
2715 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_update_cfg()
2727 mutex_lock(&wcn->hal_mutex); in wcn36xx_smd_set_mc_list()
2730 wcn->hal_buf; in wcn36xx_smd_set_mc_list()
2731 init_hal_msg(&msg_body->header, WCN36XX_HAL_8023_MULTICAST_LIST_REQ, in wcn36xx_smd_set_mc_list()
2732 sizeof(msg_body->mc_addr_list)); in wcn36xx_smd_set_mc_list()
2736 memcpy(&msg_body->mc_addr_list, fp, in wcn36xx_smd_set_mc_list()
2737 sizeof(msg_body->mc_addr_list)); in wcn36xx_smd_set_mc_list()
2739 msg_body->mc_addr_list.mc_addr_count = 0; in wcn36xx_smd_set_mc_list()
2741 msg_body->mc_addr_list.bss_index = vif_priv->bss_index; in wcn36xx_smd_set_mc_list()
2743 ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len); in wcn36xx_smd_set_mc_list()
2748 ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); in wcn36xx_smd_set_mc_list()
2754 mutex_unlock(&wcn->hal_mutex); in wcn36xx_smd_set_mc_list()
2763 struct wcn36xx *wcn = hw->priv; in wcn36xx_smd_rsp_process()
2765 wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "SMD <<< ", buf, len); in wcn36xx_smd_rsp_process()
2767 switch (msg_header->msg_type) { in wcn36xx_smd_rsp_process()
2806 memcpy(wcn->hal_buf, buf, len); in wcn36xx_smd_rsp_process()
2807 wcn->hal_rsp_len = len; in wcn36xx_smd_rsp_process()
2808 complete(&wcn->hal_rsp_compl); in wcn36xx_smd_rsp_process()
2822 msg_header->msg_type); in wcn36xx_smd_rsp_process()
2823 return -ENOMEM; in wcn36xx_smd_rsp_process()
2826 msg_ind->msg_len = len; in wcn36xx_smd_rsp_process()
2827 memcpy(msg_ind->msg, buf, len); in wcn36xx_smd_rsp_process()
2829 spin_lock(&wcn->hal_ind_lock); in wcn36xx_smd_rsp_process()
2830 list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); in wcn36xx_smd_rsp_process()
2831 queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); in wcn36xx_smd_rsp_process()
2832 spin_unlock(&wcn->hal_ind_lock); in wcn36xx_smd_rsp_process()
2837 msg_header->msg_type); in wcn36xx_smd_rsp_process()
2853 spin_lock_irqsave(&wcn->hal_ind_lock, flags); in wcn36xx_ind_smd_work()
2855 if (list_empty(&wcn->hal_ind_queue)) { in wcn36xx_ind_smd_work()
2856 spin_unlock_irqrestore(&wcn->hal_ind_lock, flags); in wcn36xx_ind_smd_work()
2860 hal_ind_msg = list_first_entry(&wcn->hal_ind_queue, in wcn36xx_ind_smd_work()
2863 list_del(&hal_ind_msg->list); in wcn36xx_ind_smd_work()
2864 spin_unlock_irqrestore(&wcn->hal_ind_lock, flags); in wcn36xx_ind_smd_work()
2866 msg_header = (struct wcn36xx_hal_msg_header *)hal_ind_msg->msg; in wcn36xx_ind_smd_work()
2868 switch (msg_header->msg_type) { in wcn36xx_ind_smd_work()
2875 hal_ind_msg->msg, in wcn36xx_ind_smd_work()
2876 hal_ind_msg->msg_len); in wcn36xx_ind_smd_work()
2880 hal_ind_msg->msg, in wcn36xx_ind_smd_work()
2881 hal_ind_msg->msg_len); in wcn36xx_ind_smd_work()
2885 hal_ind_msg->msg, in wcn36xx_ind_smd_work()
2886 hal_ind_msg->msg_len); in wcn36xx_ind_smd_work()
2890 hal_ind_msg->msg, in wcn36xx_ind_smd_work()
2891 hal_ind_msg->msg_len); in wcn36xx_ind_smd_work()
2894 wcn36xx_smd_hw_scan_ind(wcn, hal_ind_msg->msg, in wcn36xx_ind_smd_work()
2895 hal_ind_msg->msg_len); in wcn36xx_ind_smd_work()
2899 msg_header->msg_type); in wcn36xx_ind_smd_work()
2908 wcn->hal_ind_wq = create_freezable_workqueue("wcn36xx_smd_ind"); in wcn36xx_smd_open()
2909 if (!wcn->hal_ind_wq) in wcn36xx_smd_open()
2910 return -ENOMEM; in wcn36xx_smd_open()
2912 INIT_WORK(&wcn->hal_ind_work, wcn36xx_ind_smd_work); in wcn36xx_smd_open()
2913 INIT_LIST_HEAD(&wcn->hal_ind_queue); in wcn36xx_smd_open()
2914 spin_lock_init(&wcn->hal_ind_lock); in wcn36xx_smd_open()
2923 cancel_work_sync(&wcn->hal_ind_work); in wcn36xx_smd_close()
2924 destroy_workqueue(wcn->hal_ind_wq); in wcn36xx_smd_close()
2926 list_for_each_entry_safe(msg, tmp, &wcn->hal_ind_queue, list) in wcn36xx_smd_close()