Lines Matching +full:assoc +full:- +full:weight
268 * rsi_set_default_parameters() - This function sets default parameters.
275 common->band = NL80211_BAND_2GHZ; in rsi_set_default_parameters()
276 common->channel_width = BW_20MHZ; in rsi_set_default_parameters()
277 common->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; in rsi_set_default_parameters()
278 common->channel = 1; in rsi_set_default_parameters()
279 memset(&common->rate_config, 0, sizeof(common->rate_config)); in rsi_set_default_parameters()
280 common->fsm_state = FSM_CARD_NOT_READY; in rsi_set_default_parameters()
281 common->iface_down = true; in rsi_set_default_parameters()
282 common->endpoint = EP_2GHZ_20MHZ; in rsi_set_default_parameters()
283 common->driver_mode = 1; /* End to end mode */ in rsi_set_default_parameters()
284 common->lp_ps_handshake_mode = 0; /* Default no handShake mode*/ in rsi_set_default_parameters()
285 common->ulp_ps_handshake_mode = 2; /* Default PKT handShake mode*/ in rsi_set_default_parameters()
286 common->rf_power_val = 0; /* Default 1.9V */ in rsi_set_default_parameters()
287 common->wlan_rf_power_mode = 0; in rsi_set_default_parameters()
288 common->obm_ant_sel_val = 2; in rsi_set_default_parameters()
289 common->beacon_interval = RSI_BEACON_INTERVAL; in rsi_set_default_parameters()
290 common->dtim_cnt = RSI_DTIM_COUNT; in rsi_set_default_parameters()
291 common->w9116_features.pll_mode = 0x0; in rsi_set_default_parameters()
292 common->w9116_features.rf_type = 1; in rsi_set_default_parameters()
293 common->w9116_features.wireless_mode = 0; in rsi_set_default_parameters()
294 common->w9116_features.enable_ppe = 0; in rsi_set_default_parameters()
295 common->w9116_features.afe_type = 1; in rsi_set_default_parameters()
296 common->w9116_features.dpd = 0; in rsi_set_default_parameters()
297 common->w9116_features.sifs_tx_enable = 0; in rsi_set_default_parameters()
298 common->w9116_features.ps_options = 0; in rsi_set_default_parameters()
303 memset((u8 *)&common->bgscan, 0, sizeof(struct rsi_bgscan_params)); in init_bgscan_params()
304 common->bgscan.bgscan_threshold = RSI_DEF_BGSCAN_THRLD; in init_bgscan_params()
305 common->bgscan.roam_threshold = RSI_DEF_ROAM_THRLD; in init_bgscan_params()
306 common->bgscan.bgscan_periodicity = RSI_BGSCAN_PERIODICITY; in init_bgscan_params()
307 common->bgscan.num_bgscan_channels = 0; in init_bgscan_params()
308 common->bgscan.two_probe = 1; in init_bgscan_params()
309 common->bgscan.active_scan_duration = RSI_ACTIVE_SCAN_TIME; in init_bgscan_params()
310 common->bgscan.passive_scan_duration = RSI_PASSIVE_SCAN_TIME; in init_bgscan_params()
314 * rsi_set_contention_vals() - This function sets the contention values for the
325 common->tx_qinfo[ii].wme_params = in rsi_set_contention_vals()
326 (((common->edca_params[ii].cw_min / 2) + in rsi_set_contention_vals()
327 (common->edca_params[ii].aifs)) * in rsi_set_contention_vals()
329 common->tx_qinfo[ii].weight = common->tx_qinfo[ii].wme_params; in rsi_set_contention_vals()
330 common->tx_qinfo[ii].pkt_contended = 0; in rsi_set_contention_vals()
335 * rsi_send_internal_mgmt_frame() - This function sends management frames to
341 * Return: 0 on success, -1 on failure.
351 return -ENOMEM; in rsi_send_internal_mgmt_frame()
353 desc = (struct rsi_cmd_desc *)skb->data; in rsi_send_internal_mgmt_frame()
354 desc->desc_dword0.len_qno |= cpu_to_le16(DESC_IMMEDIATE_WAKEUP); in rsi_send_internal_mgmt_frame()
355 skb->priority = MGMT_SOFT_Q; in rsi_send_internal_mgmt_frame()
356 tx_params = (struct skb_info *)&IEEE80211_SKB_CB(skb)->driver_data; in rsi_send_internal_mgmt_frame()
357 tx_params->flags |= INTERNAL_MGMT_PKT; in rsi_send_internal_mgmt_frame()
358 skb_queue_tail(&common->tx_queue[MGMT_SOFT_Q], skb); in rsi_send_internal_mgmt_frame()
359 rsi_set_event(&common->tx_thread.event); in rsi_send_internal_mgmt_frame()
364 * rsi_load_radio_caps() - This function is used to send radio capabilities
373 struct rsi_hw *adapter = common->priv; in rsi_load_radio_caps()
392 return -ENOMEM; in rsi_load_radio_caps()
395 memset(skb->data, 0, frame_len); in rsi_load_radio_caps()
396 radio_caps = (struct rsi_radio_caps *)skb->data; in rsi_load_radio_caps()
398 radio_caps->desc_dword0.frame_type = RADIO_CAPABILITIES; in rsi_load_radio_caps()
399 radio_caps->channel_num = common->channel; in rsi_load_radio_caps()
400 radio_caps->rf_model = RSI_RF_TYPE; in rsi_load_radio_caps()
402 radio_caps->radio_cfg_info = RSI_LMAC_CLOCK_80MHZ; in rsi_load_radio_caps()
403 if (common->channel_width == BW_40MHZ) { in rsi_load_radio_caps()
404 radio_caps->radio_cfg_info |= RSI_ENABLE_40MHZ; in rsi_load_radio_caps()
406 if (common->fsm_state == FSM_MAC_INIT_DONE) { in rsi_load_radio_caps()
407 struct ieee80211_hw *hw = adapter->hw; in rsi_load_radio_caps()
408 struct ieee80211_conf *conf = &hw->conf; in rsi_load_radio_caps()
411 radio_caps->ppe_ack_rate = in rsi_load_radio_caps()
415 radio_caps->ppe_ack_rate = in rsi_load_radio_caps()
419 radio_caps->ppe_ack_rate = in rsi_load_radio_caps()
425 radio_caps->radio_info |= radio_id; in rsi_load_radio_caps()
427 if (adapter->device_model == RSI_DEV_9116 && in rsi_load_radio_caps()
428 common->channel_width == BW_20MHZ) in rsi_load_radio_caps()
429 radio_caps->radio_cfg_info &= ~0x3; in rsi_load_radio_caps()
431 radio_caps->sifs_tx_11n = cpu_to_le16(SIFS_TX_11N_VALUE); in rsi_load_radio_caps()
432 radio_caps->sifs_tx_11b = cpu_to_le16(SIFS_TX_11B_VALUE); in rsi_load_radio_caps()
433 radio_caps->slot_rx_11n = cpu_to_le16(SHORT_SLOT_VALUE); in rsi_load_radio_caps()
434 radio_caps->ofdm_ack_tout = cpu_to_le16(OFDM_ACK_TOUT_VALUE); in rsi_load_radio_caps()
435 radio_caps->cck_ack_tout = cpu_to_le16(CCK_ACK_TOUT_VALUE); in rsi_load_radio_caps()
436 radio_caps->preamble_type = cpu_to_le16(LONG_PREAMBLE); in rsi_load_radio_caps()
439 radio_caps->qos_params[ii].cont_win_min_q = cpu_to_le16(3); in rsi_load_radio_caps()
440 radio_caps->qos_params[ii].cont_win_max_q = cpu_to_le16(0x3f); in rsi_load_radio_caps()
441 radio_caps->qos_params[ii].aifsn_val_q = cpu_to_le16(2); in rsi_load_radio_caps()
442 radio_caps->qos_params[ii].txop_q = 0; in rsi_load_radio_caps()
446 if (common->edca_params[ii].cw_max > 0) { in rsi_load_radio_caps()
447 radio_caps->qos_params[ii].cont_win_min_q = in rsi_load_radio_caps()
448 cpu_to_le16(common->edca_params[ii].cw_min); in rsi_load_radio_caps()
449 radio_caps->qos_params[ii].cont_win_max_q = in rsi_load_radio_caps()
450 cpu_to_le16(common->edca_params[ii].cw_max); in rsi_load_radio_caps()
451 radio_caps->qos_params[ii].aifsn_val_q = in rsi_load_radio_caps()
452 cpu_to_le16(common->edca_params[ii].aifs << 8); in rsi_load_radio_caps()
453 radio_caps->qos_params[ii].txop_q = in rsi_load_radio_caps()
454 cpu_to_le16(common->edca_params[ii].txop); in rsi_load_radio_caps()
458 radio_caps->qos_params[BROADCAST_HW_Q].txop_q = cpu_to_le16(0xffff); in rsi_load_radio_caps()
459 radio_caps->qos_params[MGMT_HW_Q].txop_q = 0; in rsi_load_radio_caps()
460 radio_caps->qos_params[BEACON_HW_Q].txop_q = cpu_to_le16(0xffff); in rsi_load_radio_caps()
462 memcpy(&common->rate_pwr[0], &gc[0], 40); in rsi_load_radio_caps()
464 radio_caps->gcpd_per_rate[inx++] = in rsi_load_radio_caps()
465 cpu_to_le16(common->rate_pwr[ii] & 0x00FF); in rsi_load_radio_caps()
467 rsi_set_len_qno(&radio_caps->desc_dword0.len_qno, in rsi_load_radio_caps()
468 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_load_radio_caps()
476 * rsi_mgmt_pkt_to_core() - This function is the entry point for Mgmt module.
481 * Return: 0 on success, -1 on failure.
487 struct rsi_hw *adapter = common->priv; in rsi_mgmt_pkt_to_core()
493 if (!adapter->sc_nvifs) in rsi_mgmt_pkt_to_core()
494 return -ENOLINK; in rsi_mgmt_pkt_to_core()
496 msg_len -= pad_bytes; in rsi_mgmt_pkt_to_core()
501 return -EINVAL; in rsi_mgmt_pkt_to_core()
506 return -ENOMEM; in rsi_mgmt_pkt_to_core()
513 rx_params = (struct skb_info *)info->driver_data; in rsi_mgmt_pkt_to_core()
514 rx_params->rssi = rsi_get_rssi(msg); in rsi_mgmt_pkt_to_core()
515 rx_params->channel = rsi_get_channel(msg); in rsi_mgmt_pkt_to_core()
522 * rsi_hal_send_sta_notify_frame() - This function sends the station notify
542 u16 vap_id = ((struct vif_priv *)vif->drv_priv)->vap_id; in rsi_hal_send_sta_notify_frame()
553 return -ENOMEM; in rsi_hal_send_sta_notify_frame()
556 memset(skb->data, 0, frame_len); in rsi_hal_send_sta_notify_frame()
557 peer_notify = (struct rsi_peer_notify *)skb->data; in rsi_hal_send_sta_notify_frame()
560 peer_notify->command = cpu_to_le16(PEER_TYPE_AP << 1); in rsi_hal_send_sta_notify_frame()
562 peer_notify->command = cpu_to_le16(PEER_TYPE_STA << 1); in rsi_hal_send_sta_notify_frame()
566 peer_notify->command |= cpu_to_le16(RSI_ADD_PEER); in rsi_hal_send_sta_notify_frame()
569 peer_notify->command |= cpu_to_le16(RSI_DELETE_PEER); in rsi_hal_send_sta_notify_frame()
575 peer_notify->command |= cpu_to_le16((aid & 0xfff) << 4); in rsi_hal_send_sta_notify_frame()
576 ether_addr_copy(peer_notify->mac_addr, bssid); in rsi_hal_send_sta_notify_frame()
577 peer_notify->mpdu_density = cpu_to_le16(RSI_MPDU_DENSITY); in rsi_hal_send_sta_notify_frame()
578 peer_notify->sta_flags = cpu_to_le32((qos_enable) ? 1 : 0); in rsi_hal_send_sta_notify_frame()
580 rsi_set_len_qno(&peer_notify->desc.desc_dword0.len_qno, in rsi_hal_send_sta_notify_frame()
581 (frame_len - FRAME_DESC_SZ), in rsi_hal_send_sta_notify_frame()
583 peer_notify->desc.desc_dword0.frame_type = PEER_NOTIFY; in rsi_hal_send_sta_notify_frame()
584 peer_notify->desc.desc_dword3.qid_tid = sta_id; in rsi_hal_send_sta_notify_frame()
585 peer_notify->desc.desc_dword3.sta_id = vap_id; in rsi_hal_send_sta_notify_frame()
591 if ((vif->type == NL80211_IFTYPE_STATION) && in rsi_hal_send_sta_notify_frame()
600 * rsi_send_aggregation_params_frame() - This function sends the ampdu
627 return -ENOMEM; in rsi_send_aggregation_params_frame()
630 memset(skb->data, 0, frame_len); in rsi_send_aggregation_params_frame()
631 aggr_params = (struct rsi_aggr_params *)skb->data; in rsi_send_aggregation_params_frame()
635 rsi_set_len_qno(&aggr_params->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_send_aggregation_params_frame()
636 aggr_params->desc_dword0.frame_type = AMPDU_IND; in rsi_send_aggregation_params_frame()
638 aggr_params->aggr_params = tid & RSI_AGGR_PARAMS_TID_MASK; in rsi_send_aggregation_params_frame()
639 aggr_params->peer_id = sta_id; in rsi_send_aggregation_params_frame()
641 aggr_params->seq_start = cpu_to_le16(ssn); in rsi_send_aggregation_params_frame()
642 aggr_params->baw_size = cpu_to_le16(buf_size); in rsi_send_aggregation_params_frame()
643 aggr_params->aggr_params |= RSI_AGGR_PARAMS_START; in rsi_send_aggregation_params_frame()
645 aggr_params->seq_start = cpu_to_le16(ssn); in rsi_send_aggregation_params_frame()
646 aggr_params->aggr_params |= (RSI_AGGR_PARAMS_START | in rsi_send_aggregation_params_frame()
649 aggr_params->aggr_params |= RSI_AGGR_PARAMS_RX_AGGR; in rsi_send_aggregation_params_frame()
658 * rsi_program_bb_rf() - This function starts base band and RF programming.
676 return -ENOMEM; in rsi_program_bb_rf()
679 memset(skb->data, 0, frame_len); in rsi_program_bb_rf()
680 bb_rf_prog = (struct rsi_bb_rf_prog *)skb->data; in rsi_program_bb_rf()
682 rsi_set_len_qno(&bb_rf_prog->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_program_bb_rf()
683 bb_rf_prog->desc_dword0.frame_type = BBP_PROG_IN_TA; in rsi_program_bb_rf()
684 bb_rf_prog->endpoint = common->endpoint; in rsi_program_bb_rf()
685 bb_rf_prog->rf_power_mode = common->wlan_rf_power_mode; in rsi_program_bb_rf()
687 if (common->rf_reset) { in rsi_program_bb_rf()
688 bb_rf_prog->flags = cpu_to_le16(RF_RESET_ENABLE); in rsi_program_bb_rf()
691 common->rf_reset = 0; in rsi_program_bb_rf()
693 common->bb_rf_prog_count = 1; in rsi_program_bb_rf()
694 bb_rf_prog->flags |= cpu_to_le16(PUT_BBP_RESET | BBP_REG_WRITE | in rsi_program_bb_rf()
702 * rsi_set_vap_capabilities() - This function send vap capability to firmware.
706 * @vap_id: Rate information - offset and mask
707 * @vap_status: VAP status - ADD, DELETE or UPDATE
719 struct rsi_hw *adapter = common->priv; in rsi_set_vap_capabilities()
720 struct ieee80211_hw *hw = adapter->hw; in rsi_set_vap_capabilities()
721 struct ieee80211_conf *conf = &hw->conf; in rsi_set_vap_capabilities()
730 return -ENOMEM; in rsi_set_vap_capabilities()
733 memset(skb->data, 0, frame_len); in rsi_set_vap_capabilities()
734 vap_caps = (struct rsi_vap_caps *)skb->data; in rsi_set_vap_capabilities()
736 rsi_set_len_qno(&vap_caps->desc_dword0.len_qno, in rsi_set_vap_capabilities()
737 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_set_vap_capabilities()
738 vap_caps->desc_dword0.frame_type = VAP_CAPABILITIES; in rsi_set_vap_capabilities()
739 vap_caps->status = vap_status; in rsi_set_vap_capabilities()
740 vap_caps->vif_type = mode; in rsi_set_vap_capabilities()
741 vap_caps->channel_bw = common->channel_width; in rsi_set_vap_capabilities()
742 vap_caps->vap_id = vap_id; in rsi_set_vap_capabilities()
743 vap_caps->radioid_macid = ((common->mac_id & 0xf) << 4) | in rsi_set_vap_capabilities()
744 (common->radio_id & 0xf); in rsi_set_vap_capabilities()
746 memcpy(vap_caps->mac_addr, mac_addr, IEEE80211_ADDR_LEN); in rsi_set_vap_capabilities()
747 vap_caps->keep_alive_period = cpu_to_le16(90); in rsi_set_vap_capabilities()
748 vap_caps->frag_threshold = cpu_to_le16(IEEE80211_MAX_FRAG_THRESHOLD); in rsi_set_vap_capabilities()
750 vap_caps->rts_threshold = cpu_to_le16(common->rts_threshold); in rsi_set_vap_capabilities()
752 if (common->band == NL80211_BAND_5GHZ) { in rsi_set_vap_capabilities()
753 vap_caps->default_ctrl_rate = cpu_to_le16(RSI_RATE_6); in rsi_set_vap_capabilities()
754 vap_caps->default_mgmt_rate = cpu_to_le32(RSI_RATE_6); in rsi_set_vap_capabilities()
756 vap_caps->default_ctrl_rate = cpu_to_le16(RSI_RATE_1); in rsi_set_vap_capabilities()
757 vap_caps->default_mgmt_rate = cpu_to_le32(RSI_RATE_1); in rsi_set_vap_capabilities()
761 vap_caps->ctrl_rate_flags = in rsi_set_vap_capabilities()
764 vap_caps->ctrl_rate_flags = in rsi_set_vap_capabilities()
767 vap_caps->ctrl_rate_flags = in rsi_set_vap_capabilities()
771 vap_caps->default_data_rate = 0; in rsi_set_vap_capabilities()
772 vap_caps->beacon_interval = cpu_to_le16(common->beacon_interval); in rsi_set_vap_capabilities()
773 vap_caps->dtim_period = cpu_to_le16(common->dtim_cnt); in rsi_set_vap_capabilities()
781 * rsi_hal_load_key() - This function is used to load keys within the firmware.
791 * Return: 0 on success, -1 on failure.
813 return -ENOMEM; in rsi_hal_load_key()
816 memset(skb->data, 0, frame_len); in rsi_hal_load_key()
817 set_key = (struct rsi_set_key *)skb->data; in rsi_hal_load_key()
821 if (vif->type == NL80211_IFTYPE_AP) in rsi_hal_load_key()
838 rsi_set_len_qno(&set_key->desc_dword0.len_qno, in rsi_hal_load_key()
839 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_hal_load_key()
840 set_key->desc_dword0.frame_type = SET_KEY_REQ; in rsi_hal_load_key()
841 set_key->key_desc = cpu_to_le16(key_descriptor); in rsi_hal_load_key()
842 set_key->sta_id = sta_id; in rsi_hal_load_key()
847 memcpy(&set_key->key[key_id][1], data, key_len * 2); in rsi_hal_load_key()
849 memcpy(&set_key->key[0][0], data, key_len); in rsi_hal_load_key()
851 memcpy(set_key->tx_mic_key, &data[16], 8); in rsi_hal_load_key()
852 memcpy(set_key->rx_mic_key, &data[24], 8); in rsi_hal_load_key()
854 memset(&set_key[FRAME_DESC_SZ], 0, frame_len - FRAME_DESC_SZ); in rsi_hal_load_key()
879 return -ENOMEM; in rsi_send_common_dev_params()
882 memset(skb->data, 0, frame_len); in rsi_send_common_dev_params()
884 dev_cfgs = (struct rsi_config_vals *)skb->data; in rsi_send_common_dev_params()
887 rsi_set_len_qno(&dev_cfgs->len_qno, (frame_len - FRAME_DESC_SZ), in rsi_send_common_dev_params()
889 dev_cfgs->pkt_type = COMMON_DEV_CONFIG; in rsi_send_common_dev_params()
891 dev_cfgs->lp_ps_handshake = common->lp_ps_handshake_mode; in rsi_send_common_dev_params()
892 dev_cfgs->ulp_ps_handshake = common->ulp_ps_handshake_mode; in rsi_send_common_dev_params()
894 dev_cfgs->unused_ulp_gpio = RSI_UNUSED_ULP_GPIO_BITMAP; in rsi_send_common_dev_params()
895 dev_cfgs->unused_soc_gpio_bitmap = in rsi_send_common_dev_params()
898 dev_cfgs->opermode = common->oper_mode; in rsi_send_common_dev_params()
899 dev_cfgs->wlan_rf_pwr_mode = common->wlan_rf_power_mode; in rsi_send_common_dev_params()
900 dev_cfgs->driver_mode = common->driver_mode; in rsi_send_common_dev_params()
901 dev_cfgs->region_code = NL80211_DFS_FCC; in rsi_send_common_dev_params()
902 dev_cfgs->antenna_sel_val = common->obm_ant_sel_val; in rsi_send_common_dev_params()
910 * rsi_load_bootup_params() - This function send bootup params to the firmware.
925 return -ENOMEM; in rsi_load_bootup_params()
928 memset(skb->data, 0, sizeof(struct rsi_boot_params)); in rsi_load_bootup_params()
929 boot_params = (struct rsi_boot_params *)skb->data; in rsi_load_bootup_params()
933 if (common->channel_width == BW_40MHZ) { in rsi_load_bootup_params()
934 memcpy(&boot_params->bootup_params, in rsi_load_bootup_params()
939 boot_params->desc_word[7] = cpu_to_le16(UMAC_CLK_40BW); in rsi_load_bootup_params()
941 memcpy(&boot_params->bootup_params, in rsi_load_bootup_params()
945 boot_params->desc_word[7] = cpu_to_le16(UMAC_CLK_20BW); in rsi_load_bootup_params()
950 boot_params->desc_word[7] = cpu_to_le16(UMAC_CLK_40MHZ); in rsi_load_bootup_params()
961 boot_params->desc_word[0] = cpu_to_le16(sizeof(struct bootup_params) | in rsi_load_bootup_params()
963 boot_params->desc_word[1] = cpu_to_le16(BOOTUP_PARAMS_REQUEST); in rsi_load_bootup_params()
979 return -ENOMEM; in rsi_load_9116_bootup_params()
980 memset(skb->data, 0, sizeof(struct rsi_boot_params)); in rsi_load_9116_bootup_params()
981 boot_params = (struct rsi_boot_params_9116 *)skb->data; in rsi_load_9116_bootup_params()
983 if (common->channel_width == BW_40MHZ) { in rsi_load_9116_bootup_params()
984 memcpy(&boot_params->bootup_params, in rsi_load_9116_bootup_params()
989 boot_params->umac_clk = cpu_to_le16(UMAC_CLK_40BW); in rsi_load_9116_bootup_params()
991 memcpy(&boot_params->bootup_params, in rsi_load_9116_bootup_params()
995 boot_params->umac_clk = cpu_to_le16(UMAC_CLK_20BW); in rsi_load_9116_bootup_params()
1000 boot_params->umac_clk = cpu_to_le16(UMAC_CLK_40MHZ); in rsi_load_9116_bootup_params()
1006 rsi_set_len_qno(&boot_params->desc_dword0.len_qno, in rsi_load_9116_bootup_params()
1008 boot_params->desc_dword0.frame_type = BOOTUP_PARAMS_REQUEST; in rsi_load_9116_bootup_params()
1015 * rsi_send_reset_mac() - This function prepares reset MAC request and sends an
1032 return -ENOMEM; in rsi_send_reset_mac()
1035 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_reset_mac()
1036 mgmt_frame = (struct rsi_mac_frame *)skb->data; in rsi_send_reset_mac()
1038 mgmt_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); in rsi_send_reset_mac()
1039 mgmt_frame->desc_word[1] = cpu_to_le16(RESET_MAC_REQ); in rsi_send_reset_mac()
1040 mgmt_frame->desc_word[4] = cpu_to_le16(RETRY_COUNT << 8); in rsi_send_reset_mac()
1043 if (common->priv->device_model == RSI_DEV_9116) in rsi_send_reset_mac()
1044 mgmt_frame->desc_word[3] |= in rsi_send_reset_mac()
1053 * rsi_band_check() - This function programs the band
1062 struct rsi_hw *adapter = common->priv; in rsi_band_check()
1063 struct ieee80211_hw *hw = adapter->hw; in rsi_band_check()
1064 u8 prev_bw = common->channel_width; in rsi_band_check()
1065 u8 prev_ep = common->endpoint; in rsi_band_check()
1068 if (common->band != curchan->band) { in rsi_band_check()
1069 common->rf_reset = 1; in rsi_band_check()
1070 common->band = curchan->band; in rsi_band_check()
1073 if ((hw->conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT) || in rsi_band_check()
1074 (hw->conf.chandef.width == NL80211_CHAN_WIDTH_20)) in rsi_band_check()
1075 common->channel_width = BW_20MHZ; in rsi_band_check()
1077 common->channel_width = BW_40MHZ; in rsi_band_check()
1079 if (common->band == NL80211_BAND_2GHZ) { in rsi_band_check()
1080 if (common->channel_width) in rsi_band_check()
1081 common->endpoint = EP_2GHZ_40MHZ; in rsi_band_check()
1083 common->endpoint = EP_2GHZ_20MHZ; in rsi_band_check()
1085 if (common->channel_width) in rsi_band_check()
1086 common->endpoint = EP_5GHZ_40MHZ; in rsi_band_check()
1088 common->endpoint = EP_5GHZ_20MHZ; in rsi_band_check()
1091 if (common->endpoint != prev_ep) { in rsi_band_check()
1097 if (common->channel_width != prev_bw) { in rsi_band_check()
1098 if (adapter->device_model == RSI_DEV_9116) in rsi_band_check()
1114 * rsi_set_channel() - This function programs the channel.
1137 return -ENOMEM; in rsi_set_channel()
1140 memset(skb->data, 0, frame_len); in rsi_set_channel()
1141 chan_cfg = (struct rsi_chan_config *)skb->data; in rsi_set_channel()
1143 rsi_set_len_qno(&chan_cfg->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_set_channel()
1144 chan_cfg->desc_dword0.frame_type = SCAN_REQUEST; in rsi_set_channel()
1145 chan_cfg->channel_number = channel->hw_value; in rsi_set_channel()
1146 chan_cfg->antenna_gain_offset_2g = channel->max_antenna_gain; in rsi_set_channel()
1147 chan_cfg->antenna_gain_offset_5g = channel->max_antenna_gain; in rsi_set_channel()
1148 chan_cfg->region_rftype = (RSI_RF_TYPE & 0xf) << 4; in rsi_set_channel()
1150 if ((channel->flags & IEEE80211_CHAN_NO_IR) || in rsi_set_channel()
1151 (channel->flags & IEEE80211_CHAN_RADAR)) { in rsi_set_channel()
1152 chan_cfg->antenna_gain_offset_2g |= RSI_CHAN_RADAR; in rsi_set_channel()
1154 if (common->tx_power < channel->max_power) in rsi_set_channel()
1155 chan_cfg->tx_power = cpu_to_le16(common->tx_power); in rsi_set_channel()
1157 chan_cfg->tx_power = cpu_to_le16(channel->max_power); in rsi_set_channel()
1159 chan_cfg->region_rftype |= (common->priv->dfs_region & 0xf); in rsi_set_channel()
1161 if (common->channel_width == BW_40MHZ) in rsi_set_channel()
1162 chan_cfg->channel_width = 0x1; in rsi_set_channel()
1164 common->channel = channel->hw_value; in rsi_set_channel()
1172 * rsi_send_radio_params_update() - This function sends the radio
1190 return -ENOMEM; in rsi_send_radio_params_update()
1193 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_radio_params_update()
1194 cmd_frame = (struct rsi_mac_frame *)skb->data; in rsi_send_radio_params_update()
1196 cmd_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); in rsi_send_radio_params_update()
1197 cmd_frame->desc_word[1] = cpu_to_le16(RADIO_PARAMS_UPDATE); in rsi_send_radio_params_update()
1198 cmd_frame->desc_word[3] = cpu_to_le16(BIT(0)); in rsi_send_radio_params_update()
1200 cmd_frame->desc_word[3] |= cpu_to_le16(common->tx_power << 8); in rsi_send_radio_params_update()
1218 return -ENOMEM; in rsi_send_vap_dynamic_update()
1220 memset(skb->data, 0, sizeof(struct rsi_dynamic_s)); in rsi_send_vap_dynamic_update()
1221 dynamic_frame = (struct rsi_dynamic_s *)skb->data; in rsi_send_vap_dynamic_update()
1222 rsi_set_len_qno(&dynamic_frame->desc_dword0.len_qno, in rsi_send_vap_dynamic_update()
1223 sizeof(dynamic_frame->frame_body), RSI_WIFI_MGMT_Q); in rsi_send_vap_dynamic_update()
1225 dynamic_frame->desc_dword0.frame_type = VAP_DYNAMIC_UPDATE; in rsi_send_vap_dynamic_update()
1226 dynamic_frame->desc_dword2.pkt_info = in rsi_send_vap_dynamic_update()
1227 cpu_to_le32(common->rts_threshold); in rsi_send_vap_dynamic_update()
1229 if (common->wow_flags & RSI_WOW_ENABLED) { in rsi_send_vap_dynamic_update()
1231 dynamic_frame->desc_dword3.token = in rsi_send_vap_dynamic_update()
1233 dynamic_frame->frame_body.keep_alive_period = in rsi_send_vap_dynamic_update()
1236 dynamic_frame->frame_body.keep_alive_period = in rsi_send_vap_dynamic_update()
1240 dynamic_frame->desc_dword3.sta_id = 0; /* vap id */ in rsi_send_vap_dynamic_update()
1248 * rsi_compare() - This function is used to compare two integers
1252 * Return: 0 if both are equal, -1 if the first is smaller, else 1
1260 return -1; in rsi_compare()
1269 * rsi_map_rates() - This function is used to map selected rates to hw rates.
1295 * rsi_send_auto_rate_request() - This function is to set rates for connection
1312 struct ieee80211_hw *hw = common->priv->hw; in rsi_send_auto_rate_request()
1313 u8 band = hw->conf.chandef.chan->band; in rsi_send_auto_rate_request()
1328 return -ENOMEM; in rsi_send_auto_rate_request()
1331 memset(skb->data, 0, frame_len); in rsi_send_auto_rate_request()
1337 return -ENOMEM; in rsi_send_auto_rate_request()
1340 auto_rate = (struct rsi_auto_rate *)skb->data; in rsi_send_auto_rate_request()
1342 auto_rate->aarf_rssi = cpu_to_le16(((u16)3 << 6) | (u16)(18 & 0x3f)); in rsi_send_auto_rate_request()
1343 auto_rate->collision_tolerance = cpu_to_le16(3); in rsi_send_auto_rate_request()
1344 auto_rate->failure_limit = cpu_to_le16(3); in rsi_send_auto_rate_request()
1345 auto_rate->initial_boundary = cpu_to_le16(3); in rsi_send_auto_rate_request()
1346 auto_rate->max_threshold_limt = cpu_to_le16(27); in rsi_send_auto_rate_request()
1348 auto_rate->desc.desc_dword0.frame_type = AUTO_RATE_IND; in rsi_send_auto_rate_request()
1350 if (common->channel_width == BW_40MHZ) in rsi_send_auto_rate_request()
1351 auto_rate->desc.desc_dword3.qid_tid = BW_40MHZ; in rsi_send_auto_rate_request()
1352 auto_rate->desc.desc_dword3.sta_id = sta_id; in rsi_send_auto_rate_request()
1354 if (vif->type == NL80211_IFTYPE_STATION) { in rsi_send_auto_rate_request()
1355 rate_bitmap = common->bitrate_mask[band]; in rsi_send_auto_rate_request()
1356 is_ht = common->vif_info[0].is_ht; in rsi_send_auto_rate_request()
1357 is_sgi = common->vif_info[0].sgi; in rsi_send_auto_rate_request()
1359 rate_bitmap = sta->deflink.supp_rates[band]; in rsi_send_auto_rate_request()
1360 is_ht = sta->deflink.ht_cap.ht_supported; in rsi_send_auto_rate_request()
1361 if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) || in rsi_send_auto_rate_request()
1362 (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)) in rsi_send_auto_rate_request()
1367 configured_rates = common->rate_config[band].configured_mask ?: 0xffffffff; in rsi_send_auto_rate_request()
1385 ii < (ARRAY_SIZE(rsi_rates) - rate_table_offset); ii++) { in rsi_send_auto_rate_request()
1409 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1412 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1419 for (ii = rate_offset, kk = ARRAY_SIZE(rsi_mcsrates) - 1; in rsi_send_auto_rate_request()
1421 if (is_sgi || conf_is_ht40(&common->priv->hw->conf)) in rsi_send_auto_rate_request()
1422 auto_rate->supported_rates[ii++] = in rsi_send_auto_rate_request()
1425 auto_rate->supported_rates[ii++] = in rsi_send_auto_rate_request()
1427 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1428 cpu_to_le16(rsi_mcsrates[kk--]); in rsi_send_auto_rate_request()
1431 for (; ii < (RSI_TBL_SZ - 1); ii++) { in rsi_send_auto_rate_request()
1432 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1438 auto_rate->supported_rates[ii] = cpu_to_le16(min_rate); in rsi_send_auto_rate_request()
1440 auto_rate->num_supported_rates = cpu_to_le16(num_supported_rates * 2); in rsi_send_auto_rate_request()
1441 auto_rate->moderate_rate_inx = cpu_to_le16(num_supported_rates / 2); in rsi_send_auto_rate_request()
1444 rsi_set_len_qno(&auto_rate->desc.desc_dword0.len_qno, in rsi_send_auto_rate_request()
1445 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_send_auto_rate_request()
1454 * rsi_inform_bss_status() - This function informs about bss status with the
1483 common->hw_data_qs_blocked = true; in rsi_inform_bss_status()
1491 if (!common->rate_config[common->band].fixed_enabled) in rsi_inform_bss_status()
1496 common->hw_data_qs_blocked = false; in rsi_inform_bss_status()
1499 common->hw_data_qs_blocked = true; in rsi_inform_bss_status()
1501 if (!(common->wow_flags & RSI_WOW_ENABLED)) in rsi_inform_bss_status()
1512 * rsi_eeprom_read() - This function sends a frame to read the mac address
1516 * Return: 0 on success, -1 on failure.
1521 struct rsi_hw *adapter = common->priv; in rsi_eeprom_read()
1530 return -ENOMEM; in rsi_eeprom_read()
1533 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_eeprom_read()
1534 mgmt_frame = (struct rsi_eeprom_read_frame *)skb->data; in rsi_eeprom_read()
1537 rsi_set_len_qno(&mgmt_frame->len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_eeprom_read()
1538 mgmt_frame->pkt_type = EEPROM_READ; in rsi_eeprom_read()
1541 mgmt_frame->pkt_info = in rsi_eeprom_read()
1542 cpu_to_le32((adapter->eeprom.length << RSI_EEPROM_LEN_OFFSET) & in rsi_eeprom_read()
1544 mgmt_frame->pkt_info |= cpu_to_le32((3 << RSI_EEPROM_HDR_SIZE_OFFSET) & in rsi_eeprom_read()
1548 mgmt_frame->eeprom_offset = cpu_to_le32(adapter->eeprom.offset); in rsi_eeprom_read()
1556 * rsi_send_block_unblock_frame() - This function sends a frame to block/unblock
1561 * returns 0 on success, -1 on failure.
1574 return -ENOMEM; in rsi_send_block_unblock_frame()
1577 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_block_unblock_frame()
1578 mgmt_frame = (struct rsi_block_unblock_data *)skb->data; in rsi_send_block_unblock_frame()
1580 rsi_set_len_qno(&mgmt_frame->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_send_block_unblock_frame()
1581 mgmt_frame->desc_dword0.frame_type = BLOCK_HW_QUEUE; in rsi_send_block_unblock_frame()
1582 mgmt_frame->host_quiet_info = QUIET_INFO_VALID; in rsi_send_block_unblock_frame()
1586 mgmt_frame->block_q_bitmap = cpu_to_le16(0xf); in rsi_send_block_unblock_frame()
1587 mgmt_frame->block_q_bitmap |= cpu_to_le16(0xf << 4); in rsi_send_block_unblock_frame()
1590 mgmt_frame->unblock_q_bitmap = cpu_to_le16(0xf); in rsi_send_block_unblock_frame()
1591 mgmt_frame->unblock_q_bitmap |= cpu_to_le16(0xf << 4); in rsi_send_block_unblock_frame()
1600 * rsi_send_rx_filter_frame() - Sends a frame to filter the RX packets
1605 * Returns 0 on success, -1 on failure.
1618 return -ENOMEM; in rsi_send_rx_filter_frame()
1621 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_rx_filter_frame()
1622 cmd_frame = (struct rsi_mac_frame *)skb->data; in rsi_send_rx_filter_frame()
1624 cmd_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); in rsi_send_rx_filter_frame()
1625 cmd_frame->desc_word[1] = cpu_to_le16(SET_RX_FILTER); in rsi_send_rx_filter_frame()
1626 cmd_frame->desc_word[4] = cpu_to_le16(rx_filter_word); in rsi_send_rx_filter_frame()
1636 struct rsi_common *common = adapter->priv; in rsi_send_ps_request()
1644 return -ENOMEM; in rsi_send_ps_request()
1645 memset(skb->data, 0, frame_len); in rsi_send_ps_request()
1647 ps = (struct rsi_request_ps *)skb->data; in rsi_send_ps_request()
1648 ps_info = &adapter->ps_info; in rsi_send_ps_request()
1650 rsi_set_len_qno(&ps->desc.desc_dword0.len_qno, in rsi_send_ps_request()
1651 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_send_ps_request()
1652 ps->desc.desc_dword0.frame_type = WAKEUP_SLEEP_REQUEST; in rsi_send_ps_request()
1654 ps->ps_sleep.enable = RSI_PS_ENABLE; in rsi_send_ps_request()
1655 ps->desc.desc_dword3.token = cpu_to_le16(RSI_SLEEP_REQUEST); in rsi_send_ps_request()
1657 ps->ps_sleep.enable = RSI_PS_DISABLE; in rsi_send_ps_request()
1658 ps->desc.desc_dword0.len_qno |= cpu_to_le16(RSI_PS_DISABLE_IND); in rsi_send_ps_request()
1659 ps->desc.desc_dword3.token = cpu_to_le16(RSI_WAKEUP_REQUEST); in rsi_send_ps_request()
1662 ps->ps_uapsd_acs = common->uapsd_bitmap; in rsi_send_ps_request()
1664 ps->ps_sleep.sleep_type = ps_info->sleep_type; in rsi_send_ps_request()
1665 ps->ps_sleep.num_bcns_per_lis_int = in rsi_send_ps_request()
1666 cpu_to_le16(ps_info->num_bcns_per_lis_int); in rsi_send_ps_request()
1667 ps->ps_sleep.sleep_duration = in rsi_send_ps_request()
1668 cpu_to_le32(ps_info->deep_sleep_wakeup_period); in rsi_send_ps_request()
1670 if (vif->cfg.assoc) in rsi_send_ps_request()
1671 ps->ps_sleep.connected_sleep = RSI_CONNECTED_SLEEP; in rsi_send_ps_request()
1673 ps->ps_sleep.connected_sleep = RSI_DEEP_SLEEP; in rsi_send_ps_request()
1675 ps->ps_listen_interval = cpu_to_le32(ps_info->listen_interval); in rsi_send_ps_request()
1676 ps->ps_dtim_interval_duration = in rsi_send_ps_request()
1677 cpu_to_le32(ps_info->dtim_interval_duration); in rsi_send_ps_request()
1679 if (ps_info->listen_interval > ps_info->dtim_interval_duration) in rsi_send_ps_request()
1680 ps->ps_listen_interval = cpu_to_le32(RSI_PS_DISABLE); in rsi_send_ps_request()
1682 ps->ps_num_dtim_intervals = cpu_to_le16(ps_info->num_dtims_per_sleep); in rsi_send_ps_request()
1699 return -ENOMEM; in rsi_send_w9116_features()
1700 memset(skb->data, 0, frame_len); in rsi_send_w9116_features()
1702 w9116_features = (struct rsi_wlan_9116_features *)skb->data; in rsi_send_w9116_features()
1704 w9116_features->pll_mode = common->w9116_features.pll_mode; in rsi_send_w9116_features()
1705 w9116_features->rf_type = common->w9116_features.rf_type; in rsi_send_w9116_features()
1706 w9116_features->wireless_mode = common->w9116_features.wireless_mode; in rsi_send_w9116_features()
1707 w9116_features->enable_ppe = common->w9116_features.enable_ppe; in rsi_send_w9116_features()
1708 w9116_features->afe_type = common->w9116_features.afe_type; in rsi_send_w9116_features()
1709 if (common->w9116_features.dpd) in rsi_send_w9116_features()
1710 w9116_features->feature_enable |= cpu_to_le32(RSI_DPD); in rsi_send_w9116_features()
1711 if (common->w9116_features.sifs_tx_enable) in rsi_send_w9116_features()
1712 w9116_features->feature_enable |= in rsi_send_w9116_features()
1714 if (common->w9116_features.ps_options & RSI_DUTY_CYCLING) in rsi_send_w9116_features()
1715 w9116_features->feature_enable |= cpu_to_le32(RSI_DUTY_CYCLING); in rsi_send_w9116_features()
1716 if (common->w9116_features.ps_options & RSI_END_OF_FRAME) in rsi_send_w9116_features()
1717 w9116_features->feature_enable |= cpu_to_le32(RSI_END_OF_FRAME); in rsi_send_w9116_features()
1718 w9116_features->feature_enable |= in rsi_send_w9116_features()
1719 cpu_to_le32((common->w9116_features.ps_options & ~0x3) << 2); in rsi_send_w9116_features()
1721 rsi_set_len_qno(&w9116_features->desc.desc_dword0.len_qno, in rsi_send_w9116_features()
1722 frame_len - FRAME_DESC_SZ, RSI_WIFI_MGMT_Q); in rsi_send_w9116_features()
1723 w9116_features->desc.desc_dword0.frame_type = FEATURES_ENABLE; in rsi_send_w9116_features()
1730 * rsi_set_antenna() - This function send antenna configuration request
1747 return -ENOMEM; in rsi_set_antenna()
1750 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_set_antenna()
1752 ant_sel_frame = (struct rsi_ant_sel_frame *)skb->data; in rsi_set_antenna()
1753 ant_sel_frame->desc_dword0.frame_type = ANT_SEL_FRAME; in rsi_set_antenna()
1754 ant_sel_frame->sub_frame_type = ANTENNA_SEL_TYPE; in rsi_set_antenna()
1755 ant_sel_frame->ant_value = cpu_to_le16(antenna & ANTENNA_MASK_VALUE); in rsi_set_antenna()
1756 rsi_set_len_qno(&ant_sel_frame->desc_dword0.len_qno, in rsi_set_antenna()
1770 return -ENOMEM; in rsi_send_beacon()
1772 memset(skb->data, 0, MAX_MGMT_PKT_SIZE); in rsi_send_beacon()
1774 dword_align_bytes = ((unsigned long)skb->data & 0x3f); in rsi_send_beacon()
1776 skb_pull(skb, (64 - dword_align_bytes)); in rsi_send_beacon()
1780 return -EINVAL; in rsi_send_beacon()
1782 skb_queue_tail(&common->tx_queue[MGMT_BEACON_Q], skb); in rsi_send_beacon()
1783 rsi_set_event(&common->tx_thread.event); in rsi_send_beacon()
1802 return -ENOMEM; in rsi_send_wowlan_request()
1803 memset(skb->data, 0, length); in rsi_send_wowlan_request()
1804 cmd_frame = (struct rsi_wowlan_req *)skb->data; in rsi_send_wowlan_request()
1806 rsi_set_len_qno(&cmd_frame->desc.desc_dword0.len_qno, in rsi_send_wowlan_request()
1807 (length - FRAME_DESC_SZ), in rsi_send_wowlan_request()
1809 cmd_frame->desc.desc_dword0.frame_type = WOWLAN_CONFIG_PARAMS; in rsi_send_wowlan_request()
1810 cmd_frame->host_sleep_status = sleep_status; in rsi_send_wowlan_request()
1811 if (common->secinfo.gtk_cipher) in rsi_send_wowlan_request()
1814 cmd_frame->wow_flags = flags; in rsi_send_wowlan_request()
1816 cmd_frame->host_sleep_status, cmd_frame->wow_flags); in rsi_send_wowlan_request()
1826 struct rsi_bgscan_params *params = &common->bgscan; in rsi_send_bgscan_params()
1827 struct cfg80211_scan_request *scan_req = common->hwscan; in rsi_send_bgscan_params()
1837 return -ENOMEM; in rsi_send_bgscan_params()
1838 memset(skb->data, 0, frame_len); in rsi_send_bgscan_params()
1840 bgscan = (struct rsi_bgscan_config *)skb->data; in rsi_send_bgscan_params()
1841 rsi_set_len_qno(&bgscan->desc_dword0.len_qno, in rsi_send_bgscan_params()
1842 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_send_bgscan_params()
1843 bgscan->desc_dword0.frame_type = BG_SCAN_PARAMS; in rsi_send_bgscan_params()
1844 bgscan->bgscan_threshold = cpu_to_le16(params->bgscan_threshold); in rsi_send_bgscan_params()
1845 bgscan->roam_threshold = cpu_to_le16(params->roam_threshold); in rsi_send_bgscan_params()
1847 bgscan->bgscan_periodicity = in rsi_send_bgscan_params()
1848 cpu_to_le16(params->bgscan_periodicity); in rsi_send_bgscan_params()
1849 bgscan->active_scan_duration = in rsi_send_bgscan_params()
1850 cpu_to_le16(params->active_scan_duration); in rsi_send_bgscan_params()
1851 bgscan->passive_scan_duration = in rsi_send_bgscan_params()
1852 cpu_to_le16(params->passive_scan_duration); in rsi_send_bgscan_params()
1853 bgscan->two_probe = params->two_probe; in rsi_send_bgscan_params()
1855 bgscan->num_bgscan_channels = scan_req->n_channels; in rsi_send_bgscan_params()
1856 for (i = 0; i < bgscan->num_bgscan_channels; i++) in rsi_send_bgscan_params()
1857 bgscan->channels2scan[i] = in rsi_send_bgscan_params()
1858 cpu_to_le16(scan_req->channels[i]->hw_value); in rsi_send_bgscan_params()
1871 struct cfg80211_scan_request *scan_req = common->hwscan; in rsi_send_bgscan_probe_req()
1882 if (common->priv->sc_nvifs <= 0) in rsi_send_bgscan_probe_req()
1883 return -ENODEV; in rsi_send_bgscan_probe_req()
1885 if (scan_req->n_ssids) { in rsi_send_bgscan_probe_req()
1886 ssid = scan_req->ssids[0].ssid; in rsi_send_bgscan_probe_req()
1887 ssid_len = scan_req->ssids[0].ssid_len; in rsi_send_bgscan_probe_req()
1892 return -ENOMEM; in rsi_send_bgscan_probe_req()
1893 memset(skb->data, 0, frame_len + MAX_BGSCAN_PROBE_REQ_LEN); in rsi_send_bgscan_probe_req()
1895 bgscan = (struct rsi_bgscan_probe *)skb->data; in rsi_send_bgscan_probe_req()
1896 bgscan->desc_dword0.frame_type = BG_SCAN_PROBE_REQ; in rsi_send_bgscan_probe_req()
1897 bgscan->flags = cpu_to_le16(HOST_BG_SCAN_TRIG); in rsi_send_bgscan_probe_req()
1898 if (common->band == NL80211_BAND_5GHZ) { in rsi_send_bgscan_probe_req()
1899 bgscan->mgmt_rate = cpu_to_le16(RSI_RATE_6); in rsi_send_bgscan_probe_req()
1900 bgscan->def_chan = cpu_to_le16(40); in rsi_send_bgscan_probe_req()
1902 bgscan->mgmt_rate = cpu_to_le16(RSI_RATE_1); in rsi_send_bgscan_probe_req()
1903 bgscan->def_chan = cpu_to_le16(11); in rsi_send_bgscan_probe_req()
1905 bgscan->channel_scan_time = cpu_to_le16(RSI_CHANNEL_SCAN_TIME); in rsi_send_bgscan_probe_req()
1907 probereq_skb = ieee80211_probereq_get(common->priv->hw, vif->addr, ssid, in rsi_send_bgscan_probe_req()
1908 ssid_len, scan_req->ie_len); in rsi_send_bgscan_probe_req()
1911 return -ENOMEM; in rsi_send_bgscan_probe_req()
1914 memcpy(&skb->data[frame_len], probereq_skb->data, probereq_skb->len); in rsi_send_bgscan_probe_req()
1916 bgscan->probe_req_length = cpu_to_le16(probereq_skb->len); in rsi_send_bgscan_probe_req()
1918 rsi_set_len_qno(&bgscan->desc_dword0.len_qno, in rsi_send_bgscan_probe_req()
1919 (frame_len - FRAME_DESC_SZ + probereq_skb->len), in rsi_send_bgscan_probe_req()
1922 skb_put(skb, frame_len + probereq_skb->len); in rsi_send_bgscan_probe_req()
1930 * rsi_handle_ta_confirm_type() - This function handles the confirm frames.
1934 * Return: 0 on success, -1 on failure.
1939 struct rsi_hw *adapter = common->priv; in rsi_handle_ta_confirm_type()
1948 if (common->fsm_state == FSM_BOOT_PARAMS_SENT) { in rsi_handle_ta_confirm_type()
1949 if (adapter->device_model == RSI_DEV_9116) { in rsi_handle_ta_confirm_type()
1950 common->band = NL80211_BAND_5GHZ; in rsi_handle_ta_confirm_type()
1951 common->num_supp_bands = 2; in rsi_handle_ta_confirm_type()
1956 common->fsm_state = FSM_RESET_MAC_SENT; in rsi_handle_ta_confirm_type()
1958 adapter->eeprom.length = in rsi_handle_ta_confirm_type()
1962 adapter->eeprom.offset = WLAN_MAC_EEPROM_ADDR; in rsi_handle_ta_confirm_type()
1964 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_ta_confirm_type()
1967 common->fsm_state = FSM_EEPROM_READ_MAC_ADDR; in rsi_handle_ta_confirm_type()
1972 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
1988 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_ta_confirm_type()
1991 if (common->fsm_state == FSM_EEPROM_READ_MAC_ADDR) { in rsi_handle_ta_confirm_type()
1994 memcpy(common->mac_addr, &msg[offset], ETH_ALEN); in rsi_handle_ta_confirm_type()
1995 adapter->eeprom.length = in rsi_handle_ta_confirm_type()
1997 adapter->eeprom.offset = WLAN_EEPROM_RFTYPE_ADDR; in rsi_handle_ta_confirm_type()
2002 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_ta_confirm_type()
2005 common->fsm_state = FSM_EEPROM_READ_RF_TYPE; in rsi_handle_ta_confirm_type()
2006 } else if (common->fsm_state == FSM_EEPROM_READ_RF_TYPE) { in rsi_handle_ta_confirm_type()
2009 common->band = NL80211_BAND_5GHZ; in rsi_handle_ta_confirm_type()
2010 common->num_supp_bands = 2; in rsi_handle_ta_confirm_type()
2014 common->band = NL80211_BAND_2GHZ; in rsi_handle_ta_confirm_type()
2015 common->num_supp_bands = 1; in rsi_handle_ta_confirm_type()
2019 common->fsm_state = FSM_RESET_MAC_SENT; in rsi_handle_ta_confirm_type()
2028 if (common->fsm_state == FSM_RESET_MAC_SENT) { in rsi_handle_ta_confirm_type()
2035 common->fsm_state = FSM_RADIO_CAPS_SENT; in rsi_handle_ta_confirm_type()
2039 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
2045 if (common->fsm_state == FSM_RADIO_CAPS_SENT) { in rsi_handle_ta_confirm_type()
2046 common->rf_reset = 1; in rsi_handle_ta_confirm_type()
2047 if (adapter->device_model == RSI_DEV_9116 && in rsi_handle_ta_confirm_type()
2056 common->fsm_state = FSM_BB_RF_PROG_SENT; in rsi_handle_ta_confirm_type()
2063 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
2072 if (common->fsm_state == FSM_BB_RF_PROG_SENT) { in rsi_handle_ta_confirm_type()
2073 common->bb_rf_prog_count--; in rsi_handle_ta_confirm_type()
2074 if (!common->bb_rf_prog_count) { in rsi_handle_ta_confirm_type()
2075 common->fsm_state = FSM_MAC_INIT_DONE; in rsi_handle_ta_confirm_type()
2076 if (common->reinit_hw) { in rsi_handle_ta_confirm_type()
2077 complete(&common->wlan_init_completion); in rsi_handle_ta_confirm_type()
2079 if (common->bt_defer_attach) in rsi_handle_ta_confirm_type()
2088 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
2103 if (common->bgscan_en) { in rsi_handle_ta_confirm_type()
2107 common->bgscan_en = 0; in rsi_handle_ta_confirm_type()
2109 ieee80211_scan_completed(adapter->hw, &info); in rsi_handle_ta_confirm_type()
2123 return -EINVAL; in rsi_handle_ta_confirm_type()
2130 switch (common->fsm_state) { in rsi_handle_card_ready()
2135 return -EINVAL; in rsi_handle_card_ready()
2136 common->fsm_state = FSM_COMMON_DEV_PARAMS_SENT; in rsi_handle_card_ready()
2141 if (common->priv->device_model == RSI_DEV_9116) { in rsi_handle_card_ready()
2146 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_card_ready()
2147 return -EINVAL; in rsi_handle_card_ready()
2149 memcpy(common->mac_addr, &msg[20], ETH_ALEN); in rsi_handle_card_ready()
2150 rsi_dbg(INIT_ZONE, "MAC Addr %pM", common->mac_addr); in rsi_handle_card_ready()
2153 common->priv->usb_buffer_status_reg = *(u32 *)&msg[8]; in rsi_handle_card_ready()
2155 common->priv->usb_buffer_status_reg); in rsi_handle_card_ready()
2157 if (common->priv->device_model == RSI_DEV_9116) in rsi_handle_card_ready()
2162 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_card_ready()
2165 common->fsm_state = FSM_BOOT_PARAMS_SENT; in rsi_handle_card_ready()
2170 __func__, common->fsm_state); in rsi_handle_card_ready()
2171 return -EINVAL; in rsi_handle_card_ready()
2178 * rsi_mgmt_pkt_recv() - This function processes the management packets
2183 * Return: 0 on success, -1 on failure.
2197 common->hibernate_resume = false; in rsi_mgmt_pkt_recv()
2204 common->mgmt_q_block = false; in rsi_mgmt_pkt_recv()
2210 common->eapol4_confirm = true; in rsi_mgmt_pkt_recv()
2213 common->hw_data_qs_blocked = false; in rsi_mgmt_pkt_recv()
2219 if (common->fsm_state != FSM_MAC_INIT_DONE) in rsi_mgmt_pkt_recv()
2220 return -1; in rsi_mgmt_pkt_recv()
2221 if (common->iface_down) in rsi_mgmt_pkt_recv()
2222 return -1; in rsi_mgmt_pkt_recv()
2223 if (!common->beacon_enabled) in rsi_mgmt_pkt_recv()
2224 return -1; in rsi_mgmt_pkt_recv()
2252 "##### Un-intentional Wakeup #####\n"); in rsi_mgmt_pkt_recv()