int ath6kl_wmi_set_customer_scan_cmd(struct ath6kl_vif *vif) { //athcfg_wcmd_sta_t *cmd; int ret; int left; set_bit(SONY_WMI_SCAN, &vif->flag); //printk("%s[%d]Start sony scan,vif=0x%x\n\r",__func__,__LINE__,(int*)vif); ret = ath6kl_wmi_bssfilter_cmd( vif, ALL_BSS_FILTER, 0); if (ret) { return ret; } total_bss_info = 0; memset(&scaninfor_db[0],0x00,sizeof(scaninfor_db)); ret = ath6kl_wmi_startscan_cmd(vif, WMI_LONG_SCAN, 0, false, 0, 0, 0, NULL); left = wait_event_interruptible_timeout(vif->event_wq, !test_bit(SONY_WMI_SCAN, &vif->flag), WMI_TIMEOUT*10); ath6kl_wmi_bssfilter_cmd(vif, NONE_BSS_FILTER, 0); return ret; }
int ath6kl_wmi_get_customer_scan_time_cmd(struct ath6kl_vif *vif,athcfg_wcmd_scantime_t *val) { struct sk_buff *skb; athcfg_wcmd_sta_t *cmd; int ret; int left; unsigned long start_scan_timestamp; unsigned long end_scan_timestamp; unsigned long scan_time_msec; skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); if (!skb) return -ENOMEM; cmd = (athcfg_wcmd_sta_t *) skb->data; //set_bit(SONY_WMI_UPDATE, &vif->flag); set_bit(SONY_WMI_SCAN, &vif->flag); // printk("%s[%d]Start sony scan\n\r",__func__,__LINE__); ret = ath6kl_wmi_bssfilter_cmd( vif, ALL_BSS_FILTER, 0); if (ret) { return ret; } start_scan_timestamp = jiffies; ret = ath6kl_wmi_startscan_cmd(vif, WMI_LONG_SCAN, 0, false, 0, 0, 0, NULL); left = wait_event_interruptible_timeout(vif->event_wq, !test_bit(SONY_WMI_SCAN, &vif->flag), WMI_TIMEOUT*10); end_scan_timestamp = jiffies; scan_time_msec = jiffies_to_msecs(end_scan_timestamp-start_scan_timestamp); if(val) val->scan_time = scan_time_msec; //printk("%s[%d]scan_time_msec = %d msec \n\r",__func__,__LINE__,scan_time_msec); ath6kl_wmi_bssfilter_cmd(vif, NONE_BSS_FILTER, 0); //printk("%s[%d]\n\r",__func__,__LINE__); //memcpy(val ,&stainfo_private,sizeof(athcfg_wcmd_sta_t)); return ret; }
static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_scan_request *request) { struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev); s8 n_channels = 0; u16 *channels = NULL; int ret = 0; if (!ath6kl_cfg80211_ready(ar)) return -EIO; if (!ar->usr_bss_filter) { clear_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag); ret = ath6kl_wmi_bssfilter_cmd( ar->wmi, (test_bit(CONNECTED, &ar->flag) ? ALL_BUT_BSS_FILTER : ALL_BSS_FILTER), 0); if (ret) { ath6kl_err("couldn't set bss filtering\n"); return ret; } } if (request->n_ssids && request->ssids[0].ssid_len) { u8 i; if (request->n_ssids > (MAX_PROBED_SSID_INDEX - 1)) request->n_ssids = MAX_PROBED_SSID_INDEX - 1; for (i = 0; i < request->n_ssids; i++) ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1, SPECIFIC_SSID_FLAG, request->ssids[i].ssid_len, request->ssids[i].ssid); } if (request->ie) { ret = ath6kl_wmi_set_appie_cmd(ar->wmi, WMI_FRAME_PROBE_REQ, request->ie, request->ie_len); if (ret) { ath6kl_err("failed to set Probe Request appie for " "scan"); return ret; } } /* * Scan only the requested channels if the request specifies a set of * channels. If the list is longer than the target supports, do not * configure the list and instead, scan all available channels. */ if (request->n_channels > 0 && request->n_channels <= WMI_MAX_CHANNELS) { u8 i; n_channels = request->n_channels; channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL); if (channels == NULL) { ath6kl_warn("failed to set scan channels, " "scan all channels"); n_channels = 0; } for (i = 0; i < n_channels; i++) channels[i] = request->channels[i]->center_freq; } ret = ath6kl_wmi_startscan_cmd(ar->wmi, WMI_LONG_SCAN, 0, false, 0, 0, n_channels, channels); if (ret) ath6kl_err("wmi_startscan_cmd failed\n"); else ar->scan_req = request; kfree(channels); return ret; }
int ath6kl_wmi_set_customer_testmode_cmd(struct ath6kl_vif *vif, athcfg_wcmd_testmode_t *val) { struct sk_buff *skb; struct WMI_CUSTOMER_TESTMODE_STRUCT *cmd; int ret = 0; bool send_wmi_flag = false; switch(val->operation) { case ATHCFG_WCMD_TESTMODE_BSSID: { if(memcmp(testmode_private.bssid,val->bssid,sizeof(testmode_private.bssid)) != 0) { memcpy(testmode_private.bssid,val->bssid,sizeof(testmode_private.bssid)); send_wmi_flag = true; } //printk("%s[%d] testmode_private.bssid=\"%pM\"\n",__func__,__LINE__,testmode_private.bssid); } break; case ATHCFG_WCMD_TESTMODE_CHAN: { if(testmode_private.chan != val->chan) { testmode_private.chan = val->chan; send_wmi_flag = true; } //printk("%s[%d] testmode_private.chan=%d\n",__func__,__LINE__,testmode_private.chan); } break; case ATHCFG_WCMD_TESTMODE_RX: { if(testmode_private.rx != val->rx) { testmode_private.rx = val->rx; send_wmi_flag = true; } } break; case ATHCFG_WCMD_TESTMODE_ANT: default: printk("%s[%d]Not support\n",__func__,__LINE__); return -1; } //send WMI to target if(send_wmi_flag) { testmode_private.rx = val->rx; skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); if (!skb) return -ENOMEM; cmd = (struct WMI_CUSTOMER_TESTMODE_STRUCT *) skb->data; //transfer to little endian memcpy(cmd->bssid, val->bssid, sizeof(cmd->bssid)); cmd->chan = cpu_to_le32(val->chan); cmd->operation = cpu_to_le16(val->operation); cmd->antenna = val->antenna; cmd->rx = val->rx; cmd->rssi_combined = cpu_to_le32(val->rssi_combined); cmd->rssi0 = cpu_to_le32(val->rssi0); cmd->rssi1 = cpu_to_le32(val->rssi1); cmd->rssi2 = cpu_to_le32(val->rssi2); ret = ath6kl_wmi_cmd_send(vif, skb, WMI_SET_CUSTOM_TESTMODE, NO_SYNC_WMIFLAG); } if(val->operation == ATHCFG_WCMD_TESTMODE_RX) { if(val->rx == 1) { s8 n_channels = 1; u16 *channels = NULL; int i; set_bit(SONY_WMI_TESTMODE_RX, &vif->flag); //set scan param ath6kl_wmi_scanparams_cmd( vif, 0, 0xffff, 0, vif->sc_params.minact_chdwell_time, vif->sc_params.maxact_chdwell_time,//0xffff, 1000,//vif->sc_params.pas_chdwell_time, msec vif->sc_params.short_scan_ratio, (vif->sc_params.scan_ctrl_flags & ~ACTIVE_SCAN_CTRL_FLAGS), //vif->sc_params.scan_ctrl_flags, vif->sc_params.max_dfsch_act_time, vif->sc_params.maxact_scan_per_ssid); //assign request channel channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL); if (channels == NULL) { n_channels = 0; } for (i = 0; i < n_channels; i++) { channels[i] = ieee80211_channel_to_frequency_ath6kl((testmode_private.chan == 0 ? 1:testmode_private.chan),IEEE80211_NUM_BANDS); //printk("%s[%d]channels[%d]=%d,testmode_private.chan=%d\n",__func__,__LINE__,i,channels[i],testmode_private.chan); } ret = ath6kl_wmi_bssfilter_cmd( vif, ALL_BSS_FILTER, 0); if (ret) { printk("%s[%d] Fail\n",__func__,__LINE__); goto rx_fail; } ret = ath6kl_wmi_startscan_cmd(vif, WMI_LONG_SCAN, 1, false, 0, 0, n_channels, channels); if (ret) { printk("%s[%d] Fail\n",__func__,__LINE__); goto rx_fail; } rx_fail: kfree(channels); } else { //cancel test mode scan clear_bit(SONY_WMI_TESTMODE_RX, &vif->flag); ath6kl_wmi_scanparams_cmd(vif, vif->sc_params.fg_start_period, vif->sc_params.fg_end_period, vif->sc_params.bg_period, vif->sc_params.minact_chdwell_time, vif->sc_params.maxact_chdwell_time, vif->sc_params.pas_chdwell_time, vif->sc_params.short_scan_ratio, vif->sc_params.scan_ctrl_flags, vif->sc_params.max_dfsch_act_time, vif->sc_params.maxact_scan_per_ssid); } } return ret; }