Commit 6c2cfb4e authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: remove the use of scan shadow buffer

Remove scan shadow buffer, which is used to store a copy of scan
results. Instead, use cfg80211 provided API's to retrieve required
info. Remove the helper functions which are operating on shadow buffer,
as it's not require now.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8ffcedd6
......@@ -210,7 +210,7 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
scan_req = &hif_drv->usr_scan_req;
if (scan_req->scan_result) {
scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
scan_req->scan_result(evt, NULL, scan_req->arg);
scan_req->scan_result = NULL;
}
......@@ -564,10 +564,10 @@ static void handle_connect_timeout(struct work_struct *work)
kfree(msg);
}
static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
u16 *out_index, u8 *pcipher_tc,
u8 *auth_total_cnt, u32 tsf_lo,
u8 *rates_no)
static void host_int_fill_join_bss_param(struct join_bss_param *param,
const u8 *ies, u16 *out_index,
u8 *pcipher_tc, u8 *auth_total_cnt,
u32 tsf_lo, u8 *rates_no)
{
u8 ext_rates_no;
u16 offset;
......@@ -700,31 +700,44 @@ static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
*out_index = index;
}
static void *host_int_parse_join_bss_param(struct network_info *info)
void *wilc_parse_join_bss_param(struct cfg80211_bss *bss)
{
struct join_bss_param *param;
u16 index = 0;
u8 rates_no = 0;
u8 pcipher_total_cnt = 0;
u8 auth_total_cnt = 0;
const u8 *tim_elm, *ssid_elm;
const struct cfg80211_bss_ies *ies = bss->ies;
param = kzalloc(sizeof(*param), GFP_KERNEL);
if (!param)
return NULL;
param->dtim_period = info->dtim_period;
param->beacon_period = info->beacon_period;
param->cap_info = info->cap_info;
memcpy(param->bssid, info->bssid, 6);
memcpy((u8 *)param->ssid, info->ssid, info->ssid_len + 1);
param->ssid_len = info->ssid_len;
param->beacon_period = bss->beacon_interval;
param->cap_info = bss->capability;
ether_addr_copy(param->bssid, bss->bssid);
ssid_elm = cfg80211_find_ie(WLAN_EID_SSID, ies->data, ies->len);
if (ssid_elm) {
param->ssid_len = ssid_elm[1];
if (param->ssid_len <= IEEE80211_MAX_SSID_LEN)
memcpy(param->ssid, ssid_elm + 2, param->ssid_len);
else
param->ssid_len = 0;
}
tim_elm = cfg80211_find_ie(WLAN_EID_TIM, ies->data, ies->len);
if (tim_elm && tim_elm[1] >= 2)
param->dtim_period = tim_elm[3];
memset(param->rsn_pcip_policy, 0xFF, 3);
memset(param->rsn_auth_policy, 0xFF, 3);
while (index < info->ies_len)
host_int_fill_join_bss_param(param, info->ies, &index,
while (index < ies->len)
host_int_fill_join_bss_param(param, ies->data, &index,
&pcipher_total_cnt,
&auth_total_cnt, info->tsf_lo,
&auth_total_cnt, ies->tsf,
&rates_no);
return (void *)param;
......@@ -829,57 +842,20 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct rcvd_net_info *rcvd_info = &msg->body.net_info;
u32 i;
bool found;
struct network_info *info = NULL;
void *params;
struct host_if_drv *hif_drv = vif->hif_drv;
struct user_scan_req *scan_req = &hif_drv->usr_scan_req;
found = true;
struct user_scan_req *scan_req = &vif->hif_drv->usr_scan_req;
if (!scan_req->scan_result)
goto done;
wilc_parse_network_info(rcvd_info->buffer, &info);
if (!info || !scan_req->scan_result) {
netdev_err(vif->ndev, "%s: info or scan result NULL\n",
if (!info) {
netdev_err(vif->ndev, "%s: info is NULL\n",
__func__);
goto done;
}
for (i = 0; i < scan_req->ch_cnt; i++) {
if (memcmp(scan_req->net_info[i].bssid, info->bssid, 6) == 0) {
if (info->rssi <= scan_req->net_info[i].rssi) {
goto done;
} else {
scan_req->net_info[i].rssi = info->rssi;
found = false;
break;
}
}
}
if (found) {
if (scan_req->ch_cnt < MAX_NUM_SCANNED_NETWORKS) {
scan_req->net_info[scan_req->ch_cnt].rssi = info->rssi;
memcpy(scan_req->net_info[scan_req->ch_cnt].bssid,
info->bssid, 6);
scan_req->ch_cnt++;
info->new_network = true;
params = host_int_parse_join_bss_param(info);
scan_req->scan_result(SCAN_EVENT_NETWORK_FOUND, info,
scan_req->arg, params);
}
} else {
info->new_network = false;
scan_req->scan_result(SCAN_EVENT_NETWORK_FOUND, info,
scan_req->arg, NULL);
}
scan_req->scan_result(SCAN_EVENT_NETWORK_FOUND, info, scan_req->arg);
done:
kfree(rcvd_info->buffer);
......@@ -1150,8 +1126,7 @@ int wilc_disconnect(struct wilc_vif *vif)
if (scan_req->scan_result) {
del_timer(&hif_drv->scan_timer);
scan_req->scan_result(SCAN_EVENT_ABORTED, NULL, scan_req->arg,
NULL);
scan_req->scan_result(SCAN_EVENT_ABORTED, NULL, scan_req->arg);
scan_req->scan_result = NULL;
}
......@@ -2131,8 +2106,7 @@ int wilc_deinit(struct wilc_vif *vif)
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
hif_drv->usr_scan_req.arg,
NULL);
hif_drv->usr_scan_req.arg);
hif_drv->usr_scan_req.scan_result = NULL;
}
......
......@@ -19,7 +19,6 @@ enum {
#define WILC_MAX_NUM_STA 9
#define MAX_NUM_SCANNED_NETWORKS 100
#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130
#define WILC_MAX_NUM_PROBED_SSID 10
#define TX_MIC_KEY_LEN 8
......@@ -29,8 +28,6 @@ enum {
#define WILC_ADD_STA_LENGTH 40
#define WILC_NUM_CONCURRENT_IFC 2
#define NUM_RSSI 5
enum {
WILC_SET_CFG = 0,
WILC_GET_CFG
......@@ -38,12 +35,6 @@ enum {
#define WILC_MAX_ASSOC_RESP_FRAME_SIZE 256
struct rssi_history_buffer {
bool full;
u8 index;
s8 samples[NUM_RSSI];
};
struct network_info {
s8 rssi;
u16 cap_info;
......@@ -53,15 +44,9 @@ struct network_info {
u16 beacon_period;
u8 dtim_period;
u8 ch;
unsigned long time_scan_cached;
unsigned long time_scan;
bool new_network;
u8 found;
u32 tsf_lo;
u8 *ies;
u16 ies_len;
void *join_params;
struct rssi_history_buffer rssi_history;
u64 tsf;
};
......@@ -129,11 +114,6 @@ enum cfg_param {
WILC_CFG_PARAM_RTS_THRESHOLD = BIT(3)
};
struct found_net_info {
u8 bssid[6];
s8 rssi;
};
enum scan_event {
SCAN_EVENT_NETWORK_FOUND = 0,
SCAN_EVENT_DONE = 1,
......@@ -148,7 +128,7 @@ enum conn_event {
};
typedef void (*wilc_scan_result)(enum scan_event, struct network_info *,
void *, void *);
void *);
typedef void (*wilc_connect_result)(enum conn_event,
struct connect_info *,
......@@ -178,7 +158,6 @@ struct user_scan_req {
wilc_scan_result scan_result;
void *arg;
u32 ch_cnt;
struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS];
};
struct user_conn_req {
......@@ -307,4 +286,5 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
void *wilc_parse_join_bss_param(struct cfg80211_bss *bss);
#endif
......@@ -137,7 +137,6 @@ struct wilc_priv {
u64 tx_cookie;
bool cfg_scanning;
u32 rcvd_ch_cnt;
u8 associated_bss[ETH_ALEN];
struct sta_info assoc_stainfo;
......@@ -155,8 +154,6 @@ struct wilc_priv {
/* mutexes */
struct mutex scan_req_lock;
bool p2p_listen_state;
struct timer_list aging_timer;
struct network_info scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
int scanned_cnt;
struct wilc_p2p_var p2p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment