Chinaunix首页 | 论坛 | 博客
  • 博客访问: 323810
  • 博文数量: 101
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 774
  • 用 户 组: 普通用户
  • 注册时间: 2018-10-15 14:13
个人简介

搭建一个和linux开发者知识共享和学习的平台

文章分类

全部博文(101)

文章存档

2024年(15)

2023年(24)

2022年(27)

2019年(8)

2018年(27)

分类: LINUX

2023-07-13 11:29:01

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 %02x:%02x:%02x:%02x:%02x:%02x 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 */
阅读(500) | 评论(0) | 转发(0) |
0

上一篇:深入理解Linux内存

下一篇:CAN协议

给主人留下些什么吧!~~