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 common->min_rate = 0xffff; 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.
1134 return -ENOMEM; in rsi_set_channel()
1141 memset(skb->data, 0, frame_len); in rsi_set_channel()
1142 chan_cfg = (struct rsi_chan_config *)skb->data; in rsi_set_channel()
1144 rsi_set_len_qno(&chan_cfg->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_set_channel()
1145 chan_cfg->desc_dword0.frame_type = SCAN_REQUEST; in rsi_set_channel()
1146 chan_cfg->channel_number = channel->hw_value; in rsi_set_channel()
1147 chan_cfg->antenna_gain_offset_2g = channel->max_antenna_gain; in rsi_set_channel()
1148 chan_cfg->antenna_gain_offset_5g = channel->max_antenna_gain; in rsi_set_channel()
1149 chan_cfg->region_rftype = (RSI_RF_TYPE & 0xf) << 4; in rsi_set_channel()
1151 if ((channel->flags & IEEE80211_CHAN_NO_IR) || in rsi_set_channel()
1152 (channel->flags & IEEE80211_CHAN_RADAR)) { in rsi_set_channel()
1153 chan_cfg->antenna_gain_offset_2g |= RSI_CHAN_RADAR; in rsi_set_channel()
1155 if (common->tx_power < channel->max_power) in rsi_set_channel()
1156 chan_cfg->tx_power = cpu_to_le16(common->tx_power); in rsi_set_channel()
1158 chan_cfg->tx_power = cpu_to_le16(channel->max_power); in rsi_set_channel()
1160 chan_cfg->region_rftype |= (common->priv->dfs_region & 0xf); in rsi_set_channel()
1162 if (common->channel_width == BW_40MHZ) in rsi_set_channel()
1163 chan_cfg->channel_width = 0x1; in rsi_set_channel()
1165 common->channel = channel->hw_value; in rsi_set_channel()
1173 * rsi_send_radio_params_update() - This function sends the radio
1191 return -ENOMEM; in rsi_send_radio_params_update()
1194 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_radio_params_update()
1195 cmd_frame = (struct rsi_mac_frame *)skb->data; in rsi_send_radio_params_update()
1197 cmd_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); in rsi_send_radio_params_update()
1198 cmd_frame->desc_word[1] = cpu_to_le16(RADIO_PARAMS_UPDATE); in rsi_send_radio_params_update()
1199 cmd_frame->desc_word[3] = cpu_to_le16(BIT(0)); in rsi_send_radio_params_update()
1201 cmd_frame->desc_word[3] |= cpu_to_le16(common->tx_power << 8); in rsi_send_radio_params_update()
1219 return -ENOMEM; in rsi_send_vap_dynamic_update()
1221 memset(skb->data, 0, sizeof(struct rsi_dynamic_s)); in rsi_send_vap_dynamic_update()
1222 dynamic_frame = (struct rsi_dynamic_s *)skb->data; in rsi_send_vap_dynamic_update()
1223 rsi_set_len_qno(&dynamic_frame->desc_dword0.len_qno, in rsi_send_vap_dynamic_update()
1224 sizeof(dynamic_frame->frame_body), RSI_WIFI_MGMT_Q); in rsi_send_vap_dynamic_update()
1226 dynamic_frame->desc_dword0.frame_type = VAP_DYNAMIC_UPDATE; in rsi_send_vap_dynamic_update()
1227 dynamic_frame->desc_dword2.pkt_info = in rsi_send_vap_dynamic_update()
1228 cpu_to_le32(common->rts_threshold); in rsi_send_vap_dynamic_update()
1230 if (common->wow_flags & RSI_WOW_ENABLED) { in rsi_send_vap_dynamic_update()
1232 dynamic_frame->desc_dword3.token = in rsi_send_vap_dynamic_update()
1234 dynamic_frame->frame_body.keep_alive_period = in rsi_send_vap_dynamic_update()
1237 dynamic_frame->frame_body.keep_alive_period = in rsi_send_vap_dynamic_update()
1241 dynamic_frame->desc_dword3.sta_id = 0; /* vap id */ in rsi_send_vap_dynamic_update()
1249 * rsi_compare() - This function is used to compare two integers
1253 * Return: 0 if both are equal, -1 if the first is smaller, else 1
1261 return -1; in rsi_compare()
1270 * rsi_map_rates() - This function is used to map selected rates to hw rates.
1296 * rsi_send_auto_rate_request() - This function is to set rates for connection
1313 struct ieee80211_hw *hw = common->priv->hw; in rsi_send_auto_rate_request()
1314 u8 band = hw->conf.chandef.chan->band; in rsi_send_auto_rate_request()
1329 return -ENOMEM; in rsi_send_auto_rate_request()
1332 memset(skb->data, 0, frame_len); in rsi_send_auto_rate_request()
1338 return -ENOMEM; in rsi_send_auto_rate_request()
1341 auto_rate = (struct rsi_auto_rate *)skb->data; in rsi_send_auto_rate_request()
1343 auto_rate->aarf_rssi = cpu_to_le16(((u16)3 << 6) | (u16)(18 & 0x3f)); in rsi_send_auto_rate_request()
1344 auto_rate->collision_tolerance = cpu_to_le16(3); in rsi_send_auto_rate_request()
1345 auto_rate->failure_limit = cpu_to_le16(3); in rsi_send_auto_rate_request()
1346 auto_rate->initial_boundary = cpu_to_le16(3); in rsi_send_auto_rate_request()
1347 auto_rate->max_threshold_limt = cpu_to_le16(27); in rsi_send_auto_rate_request()
1349 auto_rate->desc.desc_dword0.frame_type = AUTO_RATE_IND; in rsi_send_auto_rate_request()
1351 if (common->channel_width == BW_40MHZ) in rsi_send_auto_rate_request()
1352 auto_rate->desc.desc_dword3.qid_tid = BW_40MHZ; in rsi_send_auto_rate_request()
1353 auto_rate->desc.desc_dword3.sta_id = sta_id; in rsi_send_auto_rate_request()
1355 if (vif->type == NL80211_IFTYPE_STATION) { in rsi_send_auto_rate_request()
1356 rate_bitmap = common->bitrate_mask[band]; in rsi_send_auto_rate_request()
1357 is_ht = common->vif_info[0].is_ht; in rsi_send_auto_rate_request()
1358 is_sgi = common->vif_info[0].sgi; in rsi_send_auto_rate_request()
1360 rate_bitmap = sta->supp_rates[band]; in rsi_send_auto_rate_request()
1361 is_ht = sta->ht_cap.ht_supported; in rsi_send_auto_rate_request()
1362 if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) || in rsi_send_auto_rate_request()
1363 (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)) in rsi_send_auto_rate_request()
1382 ii < (ARRAY_SIZE(rsi_rates) - rate_table_offset); ii++) { in rsi_send_auto_rate_request()
1403 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1406 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1413 for (ii = rate_offset, kk = ARRAY_SIZE(rsi_mcsrates) - 1; in rsi_send_auto_rate_request()
1415 if (is_sgi || conf_is_ht40(&common->priv->hw->conf)) in rsi_send_auto_rate_request()
1416 auto_rate->supported_rates[ii++] = in rsi_send_auto_rate_request()
1419 auto_rate->supported_rates[ii++] = in rsi_send_auto_rate_request()
1421 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1422 cpu_to_le16(rsi_mcsrates[kk--]); in rsi_send_auto_rate_request()
1425 for (; ii < (RSI_TBL_SZ - 1); ii++) { in rsi_send_auto_rate_request()
1426 auto_rate->supported_rates[ii] = in rsi_send_auto_rate_request()
1432 auto_rate->supported_rates[ii] = cpu_to_le16(min_rate); in rsi_send_auto_rate_request()
1434 auto_rate->num_supported_rates = cpu_to_le16(num_supported_rates * 2); in rsi_send_auto_rate_request()
1435 auto_rate->moderate_rate_inx = cpu_to_le16(num_supported_rates / 2); in rsi_send_auto_rate_request()
1438 rsi_set_len_qno(&auto_rate->desc.desc_dword0.len_qno, in rsi_send_auto_rate_request()
1439 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_send_auto_rate_request()
1448 * rsi_inform_bss_status() - This function informs about bss status with the
1477 common->hw_data_qs_blocked = true; in rsi_inform_bss_status()
1485 if (common->min_rate == 0xffff) in rsi_inform_bss_status()
1490 common->hw_data_qs_blocked = false; in rsi_inform_bss_status()
1493 common->hw_data_qs_blocked = true; in rsi_inform_bss_status()
1495 if (!(common->wow_flags & RSI_WOW_ENABLED)) in rsi_inform_bss_status()
1506 * rsi_eeprom_read() - This function sends a frame to read the mac address
1510 * Return: 0 on success, -1 on failure.
1515 struct rsi_hw *adapter = common->priv; in rsi_eeprom_read()
1524 return -ENOMEM; in rsi_eeprom_read()
1527 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_eeprom_read()
1528 mgmt_frame = (struct rsi_eeprom_read_frame *)skb->data; in rsi_eeprom_read()
1531 rsi_set_len_qno(&mgmt_frame->len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_eeprom_read()
1532 mgmt_frame->pkt_type = EEPROM_READ; in rsi_eeprom_read()
1535 mgmt_frame->pkt_info = in rsi_eeprom_read()
1536 cpu_to_le32((adapter->eeprom.length << RSI_EEPROM_LEN_OFFSET) & in rsi_eeprom_read()
1538 mgmt_frame->pkt_info |= cpu_to_le32((3 << RSI_EEPROM_HDR_SIZE_OFFSET) & in rsi_eeprom_read()
1542 mgmt_frame->eeprom_offset = cpu_to_le32(adapter->eeprom.offset); in rsi_eeprom_read()
1555 * returns 0 on success, -1 on failure.
1568 return -ENOMEM; in rsi_send_block_unblock_frame()
1571 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_block_unblock_frame()
1572 mgmt_frame = (struct rsi_block_unblock_data *)skb->data; in rsi_send_block_unblock_frame()
1574 rsi_set_len_qno(&mgmt_frame->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); in rsi_send_block_unblock_frame()
1575 mgmt_frame->desc_dword0.frame_type = BLOCK_HW_QUEUE; in rsi_send_block_unblock_frame()
1576 mgmt_frame->host_quiet_info = QUIET_INFO_VALID; in rsi_send_block_unblock_frame()
1580 mgmt_frame->block_q_bitmap = cpu_to_le16(0xf); in rsi_send_block_unblock_frame()
1581 mgmt_frame->block_q_bitmap |= cpu_to_le16(0xf << 4); in rsi_send_block_unblock_frame()
1584 mgmt_frame->unblock_q_bitmap = cpu_to_le16(0xf); in rsi_send_block_unblock_frame()
1585 mgmt_frame->unblock_q_bitmap |= cpu_to_le16(0xf << 4); in rsi_send_block_unblock_frame()
1594 * rsi_send_rx_filter_frame() - Sends a frame to filter the RX packets
1599 * Returns 0 on success, -1 on failure.
1612 return -ENOMEM; in rsi_send_rx_filter_frame()
1615 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_send_rx_filter_frame()
1616 cmd_frame = (struct rsi_mac_frame *)skb->data; in rsi_send_rx_filter_frame()
1618 cmd_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); in rsi_send_rx_filter_frame()
1619 cmd_frame->desc_word[1] = cpu_to_le16(SET_RX_FILTER); in rsi_send_rx_filter_frame()
1620 cmd_frame->desc_word[4] = cpu_to_le16(rx_filter_word); in rsi_send_rx_filter_frame()
1630 struct rsi_common *common = adapter->priv; in rsi_send_ps_request()
1631 struct ieee80211_bss_conf *bss = &vif->bss_conf; in rsi_send_ps_request()
1639 return -ENOMEM; in rsi_send_ps_request()
1640 memset(skb->data, 0, frame_len); in rsi_send_ps_request()
1642 ps = (struct rsi_request_ps *)skb->data; in rsi_send_ps_request()
1643 ps_info = &adapter->ps_info; in rsi_send_ps_request()
1645 rsi_set_len_qno(&ps->desc.desc_dword0.len_qno, in rsi_send_ps_request()
1646 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_send_ps_request()
1647 ps->desc.desc_dword0.frame_type = WAKEUP_SLEEP_REQUEST; in rsi_send_ps_request()
1649 ps->ps_sleep.enable = RSI_PS_ENABLE; in rsi_send_ps_request()
1650 ps->desc.desc_dword3.token = cpu_to_le16(RSI_SLEEP_REQUEST); in rsi_send_ps_request()
1652 ps->ps_sleep.enable = RSI_PS_DISABLE; in rsi_send_ps_request()
1653 ps->desc.desc_dword0.len_qno |= cpu_to_le16(RSI_PS_DISABLE_IND); in rsi_send_ps_request()
1654 ps->desc.desc_dword3.token = cpu_to_le16(RSI_WAKEUP_REQUEST); in rsi_send_ps_request()
1657 ps->ps_uapsd_acs = common->uapsd_bitmap; in rsi_send_ps_request()
1659 ps->ps_sleep.sleep_type = ps_info->sleep_type; in rsi_send_ps_request()
1660 ps->ps_sleep.num_bcns_per_lis_int = in rsi_send_ps_request()
1661 cpu_to_le16(ps_info->num_bcns_per_lis_int); in rsi_send_ps_request()
1662 ps->ps_sleep.sleep_duration = in rsi_send_ps_request()
1663 cpu_to_le32(ps_info->deep_sleep_wakeup_period); in rsi_send_ps_request()
1665 if (bss->assoc) in rsi_send_ps_request()
1666 ps->ps_sleep.connected_sleep = RSI_CONNECTED_SLEEP; in rsi_send_ps_request()
1668 ps->ps_sleep.connected_sleep = RSI_DEEP_SLEEP; in rsi_send_ps_request()
1670 ps->ps_listen_interval = cpu_to_le32(ps_info->listen_interval); in rsi_send_ps_request()
1671 ps->ps_dtim_interval_duration = in rsi_send_ps_request()
1672 cpu_to_le32(ps_info->dtim_interval_duration); in rsi_send_ps_request()
1674 if (ps_info->listen_interval > ps_info->dtim_interval_duration) in rsi_send_ps_request()
1675 ps->ps_listen_interval = cpu_to_le32(RSI_PS_DISABLE); in rsi_send_ps_request()
1677 ps->ps_num_dtim_intervals = cpu_to_le16(ps_info->num_dtims_per_sleep); in rsi_send_ps_request()
1694 return -ENOMEM; in rsi_send_w9116_features()
1695 memset(skb->data, 0, frame_len); in rsi_send_w9116_features()
1697 w9116_features = (struct rsi_wlan_9116_features *)skb->data; in rsi_send_w9116_features()
1699 w9116_features->pll_mode = common->w9116_features.pll_mode; in rsi_send_w9116_features()
1700 w9116_features->rf_type = common->w9116_features.rf_type; in rsi_send_w9116_features()
1701 w9116_features->wireless_mode = common->w9116_features.wireless_mode; in rsi_send_w9116_features()
1702 w9116_features->enable_ppe = common->w9116_features.enable_ppe; in rsi_send_w9116_features()
1703 w9116_features->afe_type = common->w9116_features.afe_type; in rsi_send_w9116_features()
1704 if (common->w9116_features.dpd) in rsi_send_w9116_features()
1705 w9116_features->feature_enable |= cpu_to_le32(RSI_DPD); in rsi_send_w9116_features()
1706 if (common->w9116_features.sifs_tx_enable) in rsi_send_w9116_features()
1707 w9116_features->feature_enable |= in rsi_send_w9116_features()
1709 if (common->w9116_features.ps_options & RSI_DUTY_CYCLING) in rsi_send_w9116_features()
1710 w9116_features->feature_enable |= cpu_to_le32(RSI_DUTY_CYCLING); in rsi_send_w9116_features()
1711 if (common->w9116_features.ps_options & RSI_END_OF_FRAME) in rsi_send_w9116_features()
1712 w9116_features->feature_enable |= cpu_to_le32(RSI_END_OF_FRAME); in rsi_send_w9116_features()
1713 w9116_features->feature_enable |= in rsi_send_w9116_features()
1714 cpu_to_le32((common->w9116_features.ps_options & ~0x3) << 2); in rsi_send_w9116_features()
1716 rsi_set_len_qno(&w9116_features->desc.desc_dword0.len_qno, in rsi_send_w9116_features()
1717 frame_len - FRAME_DESC_SZ, RSI_WIFI_MGMT_Q); in rsi_send_w9116_features()
1718 w9116_features->desc.desc_dword0.frame_type = FEATURES_ENABLE; in rsi_send_w9116_features()
1725 * rsi_set_antenna() - This function send antenna configuration request
1742 return -ENOMEM; in rsi_set_antenna()
1745 memset(skb->data, 0, FRAME_DESC_SZ); in rsi_set_antenna()
1747 ant_sel_frame = (struct rsi_ant_sel_frame *)skb->data; in rsi_set_antenna()
1748 ant_sel_frame->desc_dword0.frame_type = ANT_SEL_FRAME; in rsi_set_antenna()
1749 ant_sel_frame->sub_frame_type = ANTENNA_SEL_TYPE; in rsi_set_antenna()
1750 ant_sel_frame->ant_value = cpu_to_le16(antenna & ANTENNA_MASK_VALUE); in rsi_set_antenna()
1751 rsi_set_len_qno(&ant_sel_frame->desc_dword0.len_qno, in rsi_set_antenna()
1765 return -ENOMEM; in rsi_send_beacon()
1767 memset(skb->data, 0, MAX_MGMT_PKT_SIZE); in rsi_send_beacon()
1769 dword_align_bytes = ((unsigned long)skb->data & 0x3f); in rsi_send_beacon()
1771 skb_pull(skb, (64 - dword_align_bytes)); in rsi_send_beacon()
1775 return -EINVAL; in rsi_send_beacon()
1777 skb_queue_tail(&common->tx_queue[MGMT_BEACON_Q], skb); in rsi_send_beacon()
1778 rsi_set_event(&common->tx_thread.event); in rsi_send_beacon()
1797 return -ENOMEM; in rsi_send_wowlan_request()
1798 memset(skb->data, 0, length); in rsi_send_wowlan_request()
1799 cmd_frame = (struct rsi_wowlan_req *)skb->data; in rsi_send_wowlan_request()
1801 rsi_set_len_qno(&cmd_frame->desc.desc_dword0.len_qno, in rsi_send_wowlan_request()
1802 (length - FRAME_DESC_SZ), in rsi_send_wowlan_request()
1804 cmd_frame->desc.desc_dword0.frame_type = WOWLAN_CONFIG_PARAMS; in rsi_send_wowlan_request()
1805 cmd_frame->host_sleep_status = sleep_status; in rsi_send_wowlan_request()
1806 if (common->secinfo.security_enable && in rsi_send_wowlan_request()
1807 common->secinfo.gtk_cipher) in rsi_send_wowlan_request()
1810 cmd_frame->wow_flags = flags; in rsi_send_wowlan_request()
1812 cmd_frame->host_sleep_status, cmd_frame->wow_flags); in rsi_send_wowlan_request()
1822 struct rsi_bgscan_params *params = &common->bgscan; in rsi_send_bgscan_params()
1823 struct cfg80211_scan_request *scan_req = common->hwscan; in rsi_send_bgscan_params()
1833 return -ENOMEM; in rsi_send_bgscan_params()
1834 memset(skb->data, 0, frame_len); in rsi_send_bgscan_params()
1836 bgscan = (struct rsi_bgscan_config *)skb->data; in rsi_send_bgscan_params()
1837 rsi_set_len_qno(&bgscan->desc_dword0.len_qno, in rsi_send_bgscan_params()
1838 (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); in rsi_send_bgscan_params()
1839 bgscan->desc_dword0.frame_type = BG_SCAN_PARAMS; in rsi_send_bgscan_params()
1840 bgscan->bgscan_threshold = cpu_to_le16(params->bgscan_threshold); in rsi_send_bgscan_params()
1841 bgscan->roam_threshold = cpu_to_le16(params->roam_threshold); in rsi_send_bgscan_params()
1843 bgscan->bgscan_periodicity = in rsi_send_bgscan_params()
1844 cpu_to_le16(params->bgscan_periodicity); in rsi_send_bgscan_params()
1845 bgscan->active_scan_duration = in rsi_send_bgscan_params()
1846 cpu_to_le16(params->active_scan_duration); in rsi_send_bgscan_params()
1847 bgscan->passive_scan_duration = in rsi_send_bgscan_params()
1848 cpu_to_le16(params->passive_scan_duration); in rsi_send_bgscan_params()
1849 bgscan->two_probe = params->two_probe; in rsi_send_bgscan_params()
1851 bgscan->num_bgscan_channels = scan_req->n_channels; in rsi_send_bgscan_params()
1852 for (i = 0; i < bgscan->num_bgscan_channels; i++) in rsi_send_bgscan_params()
1853 bgscan->channels2scan[i] = in rsi_send_bgscan_params()
1854 cpu_to_le16(scan_req->channels[i]->hw_value); in rsi_send_bgscan_params()
1867 struct cfg80211_scan_request *scan_req = common->hwscan; in rsi_send_bgscan_probe_req()
1878 if (common->priv->sc_nvifs <= 0) in rsi_send_bgscan_probe_req()
1879 return -ENODEV; in rsi_send_bgscan_probe_req()
1881 if (scan_req->n_ssids) { in rsi_send_bgscan_probe_req()
1882 ssid = scan_req->ssids[0].ssid; in rsi_send_bgscan_probe_req()
1883 ssid_len = scan_req->ssids[0].ssid_len; in rsi_send_bgscan_probe_req()
1888 return -ENOMEM; in rsi_send_bgscan_probe_req()
1889 memset(skb->data, 0, frame_len + MAX_BGSCAN_PROBE_REQ_LEN); in rsi_send_bgscan_probe_req()
1891 bgscan = (struct rsi_bgscan_probe *)skb->data; in rsi_send_bgscan_probe_req()
1892 bgscan->desc_dword0.frame_type = BG_SCAN_PROBE_REQ; in rsi_send_bgscan_probe_req()
1893 bgscan->flags = cpu_to_le16(HOST_BG_SCAN_TRIG); in rsi_send_bgscan_probe_req()
1894 if (common->band == NL80211_BAND_5GHZ) { in rsi_send_bgscan_probe_req()
1895 bgscan->mgmt_rate = cpu_to_le16(RSI_RATE_6); in rsi_send_bgscan_probe_req()
1896 bgscan->def_chan = cpu_to_le16(40); in rsi_send_bgscan_probe_req()
1898 bgscan->mgmt_rate = cpu_to_le16(RSI_RATE_1); in rsi_send_bgscan_probe_req()
1899 bgscan->def_chan = cpu_to_le16(11); in rsi_send_bgscan_probe_req()
1901 bgscan->channel_scan_time = cpu_to_le16(RSI_CHANNEL_SCAN_TIME); in rsi_send_bgscan_probe_req()
1903 probereq_skb = ieee80211_probereq_get(common->priv->hw, vif->addr, ssid, in rsi_send_bgscan_probe_req()
1904 ssid_len, scan_req->ie_len); in rsi_send_bgscan_probe_req()
1907 return -ENOMEM; in rsi_send_bgscan_probe_req()
1910 memcpy(&skb->data[frame_len], probereq_skb->data, probereq_skb->len); in rsi_send_bgscan_probe_req()
1912 bgscan->probe_req_length = cpu_to_le16(probereq_skb->len); in rsi_send_bgscan_probe_req()
1914 rsi_set_len_qno(&bgscan->desc_dword0.len_qno, in rsi_send_bgscan_probe_req()
1915 (frame_len - FRAME_DESC_SZ + probereq_skb->len), in rsi_send_bgscan_probe_req()
1918 skb_put(skb, frame_len + probereq_skb->len); in rsi_send_bgscan_probe_req()
1926 * rsi_handle_ta_confirm_type() - This function handles the confirm frames.
1930 * Return: 0 on success, -1 on failure.
1935 struct rsi_hw *adapter = common->priv; in rsi_handle_ta_confirm_type()
1944 if (common->fsm_state == FSM_BOOT_PARAMS_SENT) { in rsi_handle_ta_confirm_type()
1945 if (adapter->device_model == RSI_DEV_9116) { in rsi_handle_ta_confirm_type()
1946 common->band = NL80211_BAND_5GHZ; in rsi_handle_ta_confirm_type()
1947 common->num_supp_bands = 2; in rsi_handle_ta_confirm_type()
1952 common->fsm_state = FSM_RESET_MAC_SENT; in rsi_handle_ta_confirm_type()
1954 adapter->eeprom.length = in rsi_handle_ta_confirm_type()
1958 adapter->eeprom.offset = WLAN_MAC_EEPROM_ADDR; in rsi_handle_ta_confirm_type()
1960 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_ta_confirm_type()
1963 common->fsm_state = FSM_EEPROM_READ_MAC_ADDR; in rsi_handle_ta_confirm_type()
1968 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
1984 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_ta_confirm_type()
1987 if (common->fsm_state == FSM_EEPROM_READ_MAC_ADDR) { in rsi_handle_ta_confirm_type()
1990 memcpy(common->mac_addr, &msg[offset], ETH_ALEN); in rsi_handle_ta_confirm_type()
1991 adapter->eeprom.length = in rsi_handle_ta_confirm_type()
1993 adapter->eeprom.offset = WLAN_EEPROM_RFTYPE_ADDR; in rsi_handle_ta_confirm_type()
1998 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_ta_confirm_type()
2001 common->fsm_state = FSM_EEPROM_READ_RF_TYPE; in rsi_handle_ta_confirm_type()
2002 } else if (common->fsm_state == FSM_EEPROM_READ_RF_TYPE) { in rsi_handle_ta_confirm_type()
2005 common->band = NL80211_BAND_5GHZ; in rsi_handle_ta_confirm_type()
2006 common->num_supp_bands = 2; in rsi_handle_ta_confirm_type()
2010 common->band = NL80211_BAND_2GHZ; in rsi_handle_ta_confirm_type()
2011 common->num_supp_bands = 1; in rsi_handle_ta_confirm_type()
2015 common->fsm_state = FSM_RESET_MAC_SENT; in rsi_handle_ta_confirm_type()
2024 if (common->fsm_state == FSM_RESET_MAC_SENT) { in rsi_handle_ta_confirm_type()
2031 common->fsm_state = FSM_RADIO_CAPS_SENT; in rsi_handle_ta_confirm_type()
2035 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
2041 if (common->fsm_state == FSM_RADIO_CAPS_SENT) { in rsi_handle_ta_confirm_type()
2042 common->rf_reset = 1; in rsi_handle_ta_confirm_type()
2043 if (adapter->device_model == RSI_DEV_9116 && in rsi_handle_ta_confirm_type()
2052 common->fsm_state = FSM_BB_RF_PROG_SENT; in rsi_handle_ta_confirm_type()
2059 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
2068 if (common->fsm_state == FSM_BB_RF_PROG_SENT) { in rsi_handle_ta_confirm_type()
2069 common->bb_rf_prog_count--; in rsi_handle_ta_confirm_type()
2070 if (!common->bb_rf_prog_count) { in rsi_handle_ta_confirm_type()
2071 common->fsm_state = FSM_MAC_INIT_DONE; in rsi_handle_ta_confirm_type()
2072 if (common->reinit_hw) { in rsi_handle_ta_confirm_type()
2073 complete(&common->wlan_init_completion); in rsi_handle_ta_confirm_type()
2081 __func__, common->fsm_state); in rsi_handle_ta_confirm_type()
2096 if (common->bgscan_en) { in rsi_handle_ta_confirm_type()
2100 common->bgscan_en = 0; in rsi_handle_ta_confirm_type()
2102 ieee80211_scan_completed(adapter->hw, &info); in rsi_handle_ta_confirm_type()
2116 return -EINVAL; in rsi_handle_ta_confirm_type()
2123 switch (common->fsm_state) { in rsi_handle_card_ready()
2128 return -EINVAL; in rsi_handle_card_ready()
2129 common->fsm_state = FSM_COMMON_DEV_PARAMS_SENT; in rsi_handle_card_ready()
2134 if (common->priv->device_model == RSI_DEV_9116) { in rsi_handle_card_ready()
2139 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_card_ready()
2140 return -EINVAL; in rsi_handle_card_ready()
2142 memcpy(common->mac_addr, &msg[20], ETH_ALEN); in rsi_handle_card_ready()
2143 rsi_dbg(INIT_ZONE, "MAC Addr %pM", common->mac_addr); in rsi_handle_card_ready()
2146 common->priv->usb_buffer_status_reg = *(u32 *)&msg[8]; in rsi_handle_card_ready()
2148 common->priv->usb_buffer_status_reg); in rsi_handle_card_ready()
2150 if (common->priv->device_model == RSI_DEV_9116) in rsi_handle_card_ready()
2155 common->fsm_state = FSM_CARD_NOT_READY; in rsi_handle_card_ready()
2158 common->fsm_state = FSM_BOOT_PARAMS_SENT; in rsi_handle_card_ready()
2163 __func__, common->fsm_state); in rsi_handle_card_ready()
2164 return -EINVAL; in rsi_handle_card_ready()
2171 * rsi_mgmt_pkt_recv() - This function processes the management packets
2176 * Return: 0 on success, -1 on failure.
2190 common->hibernate_resume = false; in rsi_mgmt_pkt_recv()
2197 common->mgmt_q_block = false; in rsi_mgmt_pkt_recv()
2203 common->eapol4_confirm = true; in rsi_mgmt_pkt_recv()
2206 common->hw_data_qs_blocked = false; in rsi_mgmt_pkt_recv()
2212 if (common->fsm_state != FSM_MAC_INIT_DONE) in rsi_mgmt_pkt_recv()
2213 return -1; in rsi_mgmt_pkt_recv()
2214 if (common->iface_down) in rsi_mgmt_pkt_recv()
2215 return -1; in rsi_mgmt_pkt_recv()
2216 if (!common->beacon_enabled) in rsi_mgmt_pkt_recv()
2217 return -1; in rsi_mgmt_pkt_recv()
2245 "##### Un-intentional Wakeup #####\n"); in rsi_mgmt_pkt_recv()