static inline int rwnx_rx_scanu_result_ind(struct rwnx_hw *rwnx_hw,
struct rwnx_cmd *cmd,
struct ipc_e2a_msg *msg)
{
struct cfg80211_bss *bss = null;
struct ieee80211_channel *chan;
struct scanu_result_ind *ind = (struct scanu_result_ind *)msg->param;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)ind->payload;
const u8 *ie = mgmt->u.beacon.variable;
char *ssid = null;
int ssid_len = 0;
int freq = 0;
#ifdef config_use_wireless_ext
struct scanu_result_wext *scan_re_wext;
#endif
rwnx_dbg(rwnx_fn_entry_str);
chan = ieee80211_get_channel(rwnx_hw->wiphy, ind->center_freq);
if (chan != null) {
#if linux_version_code < kernel_version(3, 17, 0)
//ktime_t ts;
struct timespec ts;
get_monotonic_boottime(&ts);
//ts = ktime_get_real();
mgmt->u.probe_resp.timestamp = ((u64)ts.tv_sec*1000000) ts.tv_nsec/1000;
#else
struct timespec64 ts;
ktime_get_real_ts64(&ts);
mgmt->u.probe_resp.timestamp = ((u64)ts.tv_sec*1000000) ts.tv_nsec/1000;
#endif
bss = cfg80211_inform_bss_frame(rwnx_hw->wiphy, chan,
(struct ieee80211_mgmt *)ind->payload,
ind->length, ind->rssi * 100, gfp_atomic);
#if 0
//print scan result info start
if(ie != null){
ssid_len = ie[1];
ssid = (char *)vmalloc(sizeof(char)* (ssid_len 1));
if(ssid != null){
memset(ssid, 0, ssid_len 1);
memcpy(ssid, &ie[2], ssid_len);
freq = ind->center_freq;
aicwfdbg(logdebug, "%s x:x:x:x:x:x ssid:%s freq:%d timestamp:%ld\r\n", __func__,
bss->bssid[0],bss->bssid[1],bss->bssid[2],
bss->bssid[3],bss->bssid[4],bss->bssid[5],
ssid, freq, (long)mgmt->u.probe_resp.timestamp);
vfree(ssid);
ssid = null;
}else{
aicwfdbg(logerror, "%s ssid vmalloc fail skip printk ssid info \r\n", __func__);
}
}
//print scan result info end
#endif
#ifdef config_use_wireless_ext
if(rwnx_hw->wext_scan){
scan_re_wext = (struct scanu_result_wext *)vmalloc(sizeof(struct scanu_result_wext));
scan_re_wext->ind = (struct scanu_result_ind *)vmalloc(sizeof(struct scanu_result_ind));
scan_re_wext->payload = (u32_l *)vmalloc(sizeof(u32_l) * ind->length);
memset(scan_re_wext->ind, 0, sizeof(struct scanu_result_ind));
memset(scan_re_wext->payload, 0, ind->length);
memcpy(scan_re_wext->ind, ind, sizeof(struct scanu_result_ind));
memcpy(scan_re_wext->payload, ind->payload, ind->length);
scan_re_wext->bss = bss;
init_list_head(&scan_re_wext->scanu_re_list);
list_add_tail(&scan_re_wext->scanu_re_list, &rwnx_hw->wext_scanre_list);
return 0;
}
#endif
}
if (bss != null)
#if linux_version_code < kernel_version(3, 9, 0)
cfg80211_put_bss(bss);
#else
cfg80211_put_bss(rwnx_hw->wiphy, bss);
#endif
return 0;
}
#endif /* config_rwnx_fullmac */
阅读(307) | 评论(0) | 转发(0) |