summaryrefslogtreecommitdiff
path: root/drivers/staging/wilc1000
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r--drivers/staging/wilc1000/Makefile3
-rw-r--r--drivers/staging/wilc1000/coreconfigurator.c287
-rw-r--r--drivers/staging/wilc1000/coreconfigurator.h81
-rw-r--r--drivers/staging/wilc1000/host_interface.c2788
-rw-r--r--drivers/staging/wilc1000/host_interface.h242
-rw-r--r--drivers/staging/wilc1000/linux_wlan.c92
-rw-r--r--drivers/staging/wilc1000/wilc_sdio.c23
-rw-r--r--drivers/staging/wilc1000/wilc_spi.c13
-rw-r--r--drivers/staging/wilc1000/wilc_wfi_cfgoperations.c328
-rw-r--r--drivers/staging/wilc1000/wilc_wfi_netdevice.h74
-rw-r--r--drivers/staging/wilc1000/wilc_wlan.c115
-rw-r--r--drivers/staging/wilc1000/wilc_wlan_cfg.c1
-rw-r--r--drivers/staging/wilc1000/wilc_wlan_if.h221
13 files changed, 1274 insertions, 2994 deletions
diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 37e8560e501e..72a4daa05fdb 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -5,8 +5,7 @@ ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
- coreconfigurator.o host_interface.o \
- wilc_wlan_cfg.o wilc_wlan.o
+ host_interface.o wilc_wlan_cfg.o wilc_wlan.o
obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
wilc1000-sdio-objs += wilc_sdio.o
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
deleted file mode 100644
index d6d3a971be43..000000000000
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ /dev/null
@@ -1,287 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
- * All rights reserved.
- */
-
-#include <linux/ieee80211.h>
-
-#include "coreconfigurator.h"
-
-#define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \
- BEACON_INTERVAL_LEN + CAP_INFO_LEN)
-
-enum sub_frame_type {
- ASSOC_REQ = 0x00,
- ASSOC_RSP = 0x10,
- REASSOC_REQ = 0x20,
- REASSOC_RSP = 0x30,
- PROBE_REQ = 0x40,
- PROBE_RSP = 0x50,
- BEACON = 0x80,
- ATIM = 0x90,
- DISASOC = 0xA0,
- AUTH = 0xB0,
- DEAUTH = 0xC0,
- ACTION = 0xD0,
- PS_POLL = 0xA4,
- RTS = 0xB4,
- CTS = 0xC4,
- ACK = 0xD4,
- CFEND = 0xE4,
- CFEND_ACK = 0xF4,
- DATA = 0x08,
- DATA_ACK = 0x18,
- DATA_POLL = 0x28,
- DATA_POLL_ACK = 0x38,
- NULL_FRAME = 0x48,
- CFACK = 0x58,
- CFPOLL = 0x68,
- CFPOLL_ACK = 0x78,
- QOS_DATA = 0x88,
- QOS_DATA_ACK = 0x98,
- QOS_DATA_POLL = 0xA8,
- QOS_DATA_POLL_ACK = 0xB8,
- QOS_NULL_FRAME = 0xC8,
- QOS_CFPOLL = 0xE8,
- QOS_CFPOLL_ACK = 0xF8,
- BLOCKACK_REQ = 0x84,
- BLOCKACK = 0x94,
- FRAME_SUBTYPE_FORCE_32BIT = 0xFFFFFFFF
-};
-
-static inline u16 get_beacon_period(u8 *data)
-{
- u16 bcn_per;
-
- bcn_per = data[0];
- bcn_per |= (data[1] << 8);
-
- return bcn_per;
-}
-
-static inline u32 get_beacon_timestamp_lo(u8 *data)
-{
- u32 time_stamp = 0;
- u32 index = MAC_HDR_LEN;
-
- time_stamp |= data[index++];
- time_stamp |= (data[index++] << 8);
- time_stamp |= (data[index++] << 16);
- time_stamp |= (data[index] << 24);
-
- return time_stamp;
-}
-
-static inline u32 get_beacon_timestamp_hi(u8 *data)
-{
- u32 time_stamp = 0;
- u32 index = (MAC_HDR_LEN + 4);
-
- time_stamp |= data[index++];
- time_stamp |= (data[index++] << 8);
- time_stamp |= (data[index++] << 16);
- time_stamp |= (data[index] << 24);
-
- return time_stamp;
-}
-
-static inline enum sub_frame_type get_sub_type(u8 *header)
-{
- return ((enum sub_frame_type)(header[0] & 0xFC));
-}
-
-static inline u8 get_to_ds(u8 *header)
-{
- return (header[1] & 0x01);
-}
-
-static inline u8 get_from_ds(u8 *header)
-{
- return ((header[1] & 0x02) >> 1);
-}
-
-static inline void get_address1(u8 *msa, u8 *addr)
-{
- memcpy(addr, msa + 4, 6);
-}
-
-static inline void get_address2(u8 *msa, u8 *addr)
-{
- memcpy(addr, msa + 10, 6);
-}
-
-static inline void get_address3(u8 *msa, u8 *addr)
-{
- memcpy(addr, msa + 16, 6);
-}
-
-static inline void get_bssid(u8 *data, u8 *bssid)
-{
- if (get_from_ds(data) == 1)
- get_address2(data, bssid);
- else if (get_to_ds(data) == 1)
- get_address1(data, bssid);
- else
- get_address3(data, bssid);
-}
-
-static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
-{
- u8 i, j, len;
-
- len = data[TAG_PARAM_OFFSET + 1];
- j = TAG_PARAM_OFFSET + 2;
-
- if (len >= MAX_SSID_LEN)
- len = 0;
-
- for (i = 0; i < len; i++, j++)
- ssid[i] = data[j];
-
- ssid[len] = '\0';
-
- *p_ssid_len = len;
-}
-
-static inline u16 get_cap_info(u8 *data)
-{
- u16 cap_info = 0;
- u16 index = MAC_HDR_LEN;
- enum sub_frame_type st;
-
- st = get_sub_type(data);
-
- if (st == BEACON || st == PROBE_RSP)
- index += TIME_STAMP_LEN + BEACON_INTERVAL_LEN;
-
- cap_info = data[index];
- cap_info |= (data[index + 1] << 8);
-
- return cap_info;
-}
-
-static inline u16 get_asoc_status(u8 *data)
-{
- u16 asoc_status;
-
- asoc_status = data[3];
- return (asoc_status << 8) | data[2];
-}
-
-static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 tag_param_offset)
-{
- u16 index;
-
- index = tag_param_offset;
-
- while (index < (rx_len - FCS_LEN)) {
- if (msa[index] == WLAN_EID_TIM)
- return &msa[index];
- index += (IE_HDR_LEN + msa[index + 1]);
- }
-
- return NULL;
-}
-
-static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
-{
- u16 index;
-
- index = TAG_PARAM_OFFSET;
- while (index < (rx_len - FCS_LEN)) {
- if (msa[index] == WLAN_EID_DS_PARAMS)
- return msa[index + 2];
- index += msa[index + 1] + IE_HDR_LEN;
- }
-
- return 0;
-}
-
-s32 wilc_parse_network_info(u8 *msg_buffer,
- struct network_info **ret_network_info)
-{
- struct network_info *network_info;
- u8 *wid_val, *msa, *tim_elm, *ies;
- u32 tsf_lo, tsf_hi;
- u16 wid_len, rx_len, ies_len;
- u8 msg_type, index;
-
- msg_type = msg_buffer[0];
-
- if ('N' != msg_type)
- return -EFAULT;
-
- wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
- wid_val = &msg_buffer[8];
-
- network_info = kzalloc(sizeof(*network_info), GFP_KERNEL);
- if (!network_info)
- return -ENOMEM;
-
- network_info->rssi = wid_val[0];
-
- msa = &wid_val[1];
-
- rx_len = wid_len - 1;
- network_info->cap_info = get_cap_info(msa);
- network_info->tsf_lo = get_beacon_timestamp_lo(msa);
-
- tsf_lo = get_beacon_timestamp_lo(msa);
- tsf_hi = get_beacon_timestamp_hi(msa);
-
- network_info->tsf_hi = tsf_lo | ((u64)tsf_hi << 32);
-
- get_ssid(msa, network_info->ssid, &network_info->ssid_len);
- get_bssid(msa, network_info->bssid);
-
- network_info->ch = get_current_channel_802_11n(msa, rx_len
- + FCS_LEN);
-
- index = MAC_HDR_LEN + TIME_STAMP_LEN;
-
- network_info->beacon_period = get_beacon_period(msa + index);
-
- index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
-
- tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
- if (tim_elm)
- network_info->dtim_period = tim_elm[3];
- ies = &msa[TAG_PARAM_OFFSET];
- ies_len = rx_len - TAG_PARAM_OFFSET;
-
- if (ies_len > 0) {
- network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
- if (!network_info->ies) {
- kfree(network_info);
- return -ENOMEM;
- }
- }
- network_info->ies_len = ies_len;
-
- *ret_network_info = network_info;
-
- return 0;
-}
-
-s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
- struct connect_info *ret_conn_info)
-{
- u8 *ies;
- u16 ies_len;
-
- ret_conn_info->status = get_asoc_status(buffer);
- if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
- ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
- ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
- AID_LEN);
-
- ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL);
- if (!ret_conn_info->resp_ies)
- return -ENOMEM;
-
- ret_conn_info->resp_ies_len = ies_len;
- }
-
- return 0;
-}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
deleted file mode 100644
index b62acb447383..000000000000
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
- * All rights reserved.
- */
-
-#ifndef CORECONFIGURATOR_H
-#define CORECONFIGURATOR_H
-
-#include "wilc_wlan_if.h"
-
-#define NUM_RSSI 5
-
-#define MAC_HDR_LEN 24
-#define FCS_LEN 4
-#define TIME_STAMP_LEN 8
-#define BEACON_INTERVAL_LEN 2
-#define CAP_INFO_LEN 2
-#define STATUS_CODE_LEN 2
-#define AID_LEN 2
-#define IE_HDR_LEN 2
-
-#define SET_CFG 0
-#define GET_CFG 1
-
-#define MAX_STRING_LEN 256
-#define MAX_ASSOC_RESP_FRAME_SIZE MAX_STRING_LEN
-
-#define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
-#define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
-
-struct rssi_history_buffer {
- bool full;
- u8 index;
- s8 samples[NUM_RSSI];
-};
-
-struct network_info {
- s8 rssi;
- u16 cap_info;
- u8 ssid[MAX_SSID_LEN];
- u8 ssid_len;
- u8 bssid[6];
- 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_hi;
-};
-
-struct connect_info {
- u8 bssid[6];
- u8 *req_ies;
- size_t req_ies_len;
- u8 *resp_ies;
- u16 resp_ies_len;
- u16 status;
-};
-
-struct disconnect_info {
- u16 reason;
- u8 *ie;
- size_t ie_len;
-};
-
-s32 wilc_parse_network_info(u8 *msg_buffer,
- struct network_info **ret_network_info);
-s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
- struct connect_info *ret_conn_info);
-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);
-#endif
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 01db8999335e..70c854d939ce 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -13,80 +13,11 @@
#define REAL_JOIN_REQ 0
-struct host_if_wpa_attr {
- u8 *key;
- const u8 *mac_addr;
- u8 *seq;
- u8 seq_len;
- u8 index;
- u8 key_len;
- u8 mode;
-};
-
-struct host_if_wep_attr {
- u8 *key;
- u8 key_len;
- u8 index;
- u8 mode;
- enum authtype auth_type;
-};
-
-union host_if_key_attr {
- struct host_if_wep_attr wep;
- struct host_if_wpa_attr wpa;
- struct host_if_pmkid_attr pmkid;
-};
-
-struct key_attr {
- enum KEY_TYPE type;
- u8 action;
- union host_if_key_attr attr;
-};
-
-struct scan_attr {
- u8 src;
- u8 type;
- u8 *ch_freq_list;
- u8 ch_list_len;
- u8 *ies;
- size_t ies_len;
- wilc_scan_result result;
- void *arg;
- struct hidden_network hidden_network;
-};
-
-struct connect_attr {
- u8 *bssid;
- u8 *ssid;
- size_t ssid_len;
- u8 *ies;
- size_t ies_len;
- u8 security;
- wilc_connect_result result;
- void *arg;
- enum authtype auth_type;
- u8 ch;
- void *params;
-};
-
struct rcvd_async_info {
u8 *buffer;
u32 len;
};
-struct channel_attr {
- u8 set_ch;
-};
-
-struct beacon_attr {
- u32 interval;
- u32 dtim_period;
- u32 head_len;
- u8 *head;
- u32 tail_len;
- u8 *tail;
-};
-
struct set_multicast {
bool enabled;
u32 cnt;
@@ -94,58 +25,58 @@ struct set_multicast {
};
struct del_all_sta {
- u8 del_all_sta[MAX_NUM_STA][ETH_ALEN];
u8 assoc_sta;
+ u8 mac[WILC_MAX_NUM_STA][ETH_ALEN];
};
-struct del_sta {
- u8 mac_addr[ETH_ALEN];
+struct wilc_op_mode {
+ __le32 mode;
};
-struct power_mgmt_param {
- bool enabled;
- u32 timeout;
-};
+struct wilc_reg_frame {
+ bool reg;
+ u8 reg_id;
+ __le32 frame_type;
+} __packed;
-struct set_ip_addr {
- u8 *ip_addr;
- u8 idx;
-};
+struct wilc_drv_handler {
+ __le32 handler;
+ u8 mode;
+} __packed;
-struct sta_inactive_t {
- u32 inactive_time;
- u8 mac[6];
-};
+struct wilc_wep_key {
+ u8 index;
+ u8 key_len;
+ u8 key[0];
+} __packed;
-struct tx_power {
- u8 tx_pwr;
-};
+struct wilc_sta_wpa_ptk {
+ u8 mac_addr[ETH_ALEN];
+ u8 key_len;
+ u8 key[0];
+} __packed;
+
+struct wilc_ap_wpa_ptk {
+ u8 mac_addr[ETH_ALEN];
+ u8 index;
+ u8 key_len;
+ u8 key[0];
+} __packed;
+
+struct wilc_gtk_key {
+ u8 mac_addr[ETH_ALEN];
+ u8 rsc[8];
+ u8 index;
+ u8 key_len;
+ u8 key[0];
+} __packed;
union message_body {
- struct scan_attr scan_info;
- struct connect_attr con_info;
struct rcvd_net_info net_info;
struct rcvd_async_info async_info;
- struct key_attr key_info;
- struct cfg_param_attr cfg_info;
- struct channel_attr channel_info;
- struct beacon_attr beacon_info;
- struct add_sta_param add_sta_info;
- struct del_sta del_sta_info;
- struct add_sta_param edit_sta_info;
- struct power_mgmt_param pwr_mgmt_info;
- struct sta_inactive_t mac_info;
- struct set_ip_addr ip_info;
- struct drv_handler drv;
struct set_multicast multicast_info;
- struct op_mode mode;
- struct get_mac_addr get_mac_info;
- struct ba_session_info session_info;
struct remain_ch remain_on_ch;
- struct reg_frame reg_frame;
char *data;
- struct del_all_sta del_all_sta_info;
- struct tx_power tx_power;
};
struct host_if_msg {
@@ -242,422 +173,12 @@ static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
{
int index = idx - 1;
- if (index < 0 || index >= NUM_CONCURRENT_IFC)
+ if (index < 0 || index >= WILC_NUM_CONCURRENT_IFC)
return NULL;
return wilc->vif[index];
}
-static void handle_set_channel(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct channel_attr *hif_set_ch = &msg->body.channel_info;
- int ret;
- struct wid wid;
-
- wid.id = WID_CURRENT_CHANNEL;
- wid.type = WID_CHAR;
- wid.val = (char *)&hif_set_ch->set_ch;
- wid.size = sizeof(char);
-
- ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
- if (ret)
- netdev_err(vif->ndev, "Failed to set channel\n");
- kfree(msg);
-}
-
-static void handle_set_wfi_drv_handler(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct drv_handler *hif_drv_handler = &msg->body.drv;
- int ret;
- struct wid wid;
- u8 *currbyte, *buffer;
- struct host_if_drv *hif_drv;
-
- if (!vif->hif_drv || !hif_drv_handler)
- goto free_msg;
-
- hif_drv = vif->hif_drv;
-
- buffer = kzalloc(DRV_HANDLER_SIZE, GFP_KERNEL);
- if (!buffer)
- goto free_msg;
-
- currbyte = buffer;
- *currbyte = hif_drv->driver_handler_id & DRV_HANDLER_MASK;
- currbyte++;
- *currbyte = (u32)0 & DRV_HANDLER_MASK;
- currbyte++;
- *currbyte = (u32)0 & DRV_HANDLER_MASK;
- currbyte++;
- *currbyte = (u32)0 & DRV_HANDLER_MASK;
- currbyte++;
- *currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1));
-
- wid.id = WID_SET_DRV_HANDLER;
- wid.type = WID_STR;
- wid.val = (s8 *)buffer;
- wid.size = DRV_HANDLER_SIZE;
-
- ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- hif_drv->driver_handler_id);
- if (ret)
- netdev_err(vif->ndev, "Failed to set driver handler\n");
-
- kfree(buffer);
-
-free_msg:
- if (msg->is_sync)
- complete(&msg->work_comp);
-
- kfree(msg);
-}
-
-static void handle_set_operation_mode(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct op_mode *hif_op_mode = &msg->body.mode;
- int ret;
- struct wid wid;
-
- wid.id = WID_SET_OPERATION_MODE;
- wid.type = WID_INT;
- wid.val = (s8 *)&hif_op_mode->mode;
- wid.size = sizeof(u32);
-
- ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
- if (ret)
- netdev_err(vif->ndev, "Failed to set operation mode\n");
-
- kfree(msg);
-}
-
-static void handle_get_mac_address(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct get_mac_addr *get_mac_addr = &msg->body.get_mac_info;
- int ret;
- struct wid wid;
-
- wid.id = WID_MAC_ADDR;
- wid.type = WID_STR;
- wid.val = get_mac_addr->mac_addr;
- wid.size = ETH_ALEN;
-
- ret = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
- if (ret)
- netdev_err(vif->ndev, "Failed to get mac address\n");
- complete(&msg->work_comp);
- /* free 'msg' data later, in caller */
-}
-
-static void handle_cfg_param(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct cfg_param_attr *param = &msg->body.cfg_info;
- int ret;
- struct wid wid_list[32];
- struct host_if_drv *hif_drv = vif->hif_drv;
- int i = 0;
-
- mutex_lock(&hif_drv->cfg_values_lock);
-
- if (param->flag & BSS_TYPE) {
- u8 bss_type = param->bss_type;
-
- if (bss_type < 6) {
- wid_list[i].id = WID_BSS_TYPE;
- wid_list[i].val = (s8 *)&param->bss_type;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.bss_type = bss_type;
- } else {
- netdev_err(vif->ndev, "check value 6 over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & AUTH_TYPE) {
- u8 auth_type = param->auth_type;
-
- if (auth_type == 1 || auth_type == 2 || auth_type == 5) {
- wid_list[i].id = WID_AUTH_TYPE;
- wid_list[i].val = (s8 *)&param->auth_type;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.auth_type = auth_type;
- } else {
- netdev_err(vif->ndev, "Impossible value\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & AUTHEN_TIMEOUT) {
- if (param->auth_timeout > 0) {
- wid_list[i].id = WID_AUTH_TIMEOUT;
- wid_list[i].val = (s8 *)&param->auth_timeout;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.auth_timeout = param->auth_timeout;
- } else {
- netdev_err(vif->ndev, "Range(1 ~ 65535) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & POWER_MANAGEMENT) {
- u8 pm_mode = param->power_mgmt_mode;
-
- if (pm_mode < 5) {
- wid_list[i].id = WID_POWER_MANAGEMENT;
- wid_list[i].val = (s8 *)&param->power_mgmt_mode;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.power_mgmt_mode = pm_mode;
- } else {
- netdev_err(vif->ndev, "Invalid power mode\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & RETRY_SHORT) {
- u16 retry_limit = param->short_retry_limit;
-
- if (retry_limit > 0 && retry_limit < 256) {
- wid_list[i].id = WID_SHORT_RETRY_LIMIT;
- wid_list[i].val = (s8 *)&param->short_retry_limit;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.short_retry_limit = retry_limit;
- } else {
- netdev_err(vif->ndev, "Range(1~256) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & RETRY_LONG) {
- u16 limit = param->long_retry_limit;
-
- if (limit > 0 && limit < 256) {
- wid_list[i].id = WID_LONG_RETRY_LIMIT;
- wid_list[i].val = (s8 *)&param->long_retry_limit;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.long_retry_limit = limit;
- } else {
- netdev_err(vif->ndev, "Range(1~256) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & FRAG_THRESHOLD) {
- u16 frag_th = param->frag_threshold;
-
- if (frag_th > 255 && frag_th < 7937) {
- wid_list[i].id = WID_FRAG_THRESHOLD;
- wid_list[i].val = (s8 *)&param->frag_threshold;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.frag_threshold = frag_th;
- } else {
- netdev_err(vif->ndev, "Threshold Range fail\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & RTS_THRESHOLD) {
- u16 rts_th = param->rts_threshold;
-
- if (rts_th > 255) {
- wid_list[i].id = WID_RTS_THRESHOLD;
- wid_list[i].val = (s8 *)&param->rts_threshold;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.rts_threshold = rts_th;
- } else {
- netdev_err(vif->ndev, "Threshold Range fail\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & PREAMBLE) {
- u16 preamble_type = param->preamble_type;
-
- if (param->preamble_type < 3) {
- wid_list[i].id = WID_PREAMBLE;
- wid_list[i].val = (s8 *)&param->preamble_type;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.preamble_type = preamble_type;
- } else {
- netdev_err(vif->ndev, "Preamble Range(0~2) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & SHORT_SLOT_ALLOWED) {
- u8 slot_allowed = param->short_slot_allowed;
-
- if (slot_allowed < 2) {
- wid_list[i].id = WID_SHORT_SLOT_ALLOWED;
- wid_list[i].val = (s8 *)&param->short_slot_allowed;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.short_slot_allowed = slot_allowed;
- } else {
- netdev_err(vif->ndev, "Short slot(2) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & TXOP_PROT_DISABLE) {
- u8 prot_disabled = param->txop_prot_disabled;
-
- if (param->txop_prot_disabled < 2) {
- wid_list[i].id = WID_11N_TXOP_PROT_DISABLE;
- wid_list[i].val = (s8 *)&param->txop_prot_disabled;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.txop_prot_disabled = prot_disabled;
- } else {
- netdev_err(vif->ndev, "TXOP prot disable\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & BEACON_INTERVAL) {
- u16 beacon_interval = param->beacon_interval;
-
- if (beacon_interval > 0) {
- wid_list[i].id = WID_BEACON_INTERVAL;
- wid_list[i].val = (s8 *)&param->beacon_interval;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.beacon_interval = beacon_interval;
- } else {
- netdev_err(vif->ndev, "Beacon interval(1~65535)fail\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & DTIM_PERIOD) {
- if (param->dtim_period > 0 && param->dtim_period < 256) {
- wid_list[i].id = WID_DTIM_PERIOD;
- wid_list[i].val = (s8 *)&param->dtim_period;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.dtim_period = param->dtim_period;
- } else {
- netdev_err(vif->ndev, "DTIM range(1~255) fail\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & SITE_SURVEY) {
- enum site_survey enabled = param->site_survey_enabled;
-
- if (enabled < 3) {
- wid_list[i].id = WID_SITE_SURVEY;
- wid_list[i].val = (s8 *)&param->site_survey_enabled;
- wid_list[i].type = WID_CHAR;
- wid_list[i].size = sizeof(char);
- hif_drv->cfg_values.site_survey_enabled = enabled;
- } else {
- netdev_err(vif->ndev, "Site survey disable\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & SITE_SURVEY_SCAN_TIME) {
- u16 scan_time = param->site_survey_scan_time;
-
- if (scan_time > 0) {
- wid_list[i].id = WID_SITE_SURVEY_SCAN_TIME;
- wid_list[i].val = (s8 *)&param->site_survey_scan_time;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.site_survey_scan_time = scan_time;
- } else {
- netdev_err(vif->ndev, "Site scan time(1~65535) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & ACTIVE_SCANTIME) {
- u16 active_scan_time = param->active_scan_time;
-
- if (active_scan_time > 0) {
- wid_list[i].id = WID_ACTIVE_SCAN_TIME;
- wid_list[i].val = (s8 *)&param->active_scan_time;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.active_scan_time = active_scan_time;
- } else {
- netdev_err(vif->ndev, "Active time(1~65535) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & PASSIVE_SCANTIME) {
- u16 time = param->passive_scan_time;
-
- if (time > 0) {
- wid_list[i].id = WID_PASSIVE_SCAN_TIME;
- wid_list[i].val = (s8 *)&param->passive_scan_time;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.passive_scan_time = time;
- } else {
- netdev_err(vif->ndev, "Passive time(1~65535) over\n");
- goto unlock;
- }
- i++;
- }
- if (param->flag & CURRENT_TX_RATE) {
- enum current_tx_rate curr_tx_rate = param->curr_tx_rate;
-
- if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 ||
- curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 ||
- curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 ||
- curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 ||
- curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 ||
- curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 ||
- curr_tx_rate == MBPS_54) {
- wid_list[i].id = WID_CURRENT_TX_RATE;
- wid_list[i].val = (s8 *)&curr_tx_rate;
- wid_list[i].type = WID_SHORT;
- wid_list[i].size = sizeof(u16);
- hif_drv->cfg_values.curr_tx_rate = (u8)curr_tx_rate;
- } else {
- netdev_err(vif->ndev, "out of TX rate\n");
- goto unlock;
- }
- i++;
- }
-
- ret = wilc_send_config_pkt(vif, SET_CFG, wid_list,
- i, wilc_get_vif_idx(vif));
-
- if (ret)
- netdev_err(vif->ndev, "Error in setting CFG params\n");
-
-unlock:
- mutex_unlock(&hif_drv->cfg_values_lock);
- kfree(msg);
-}
-
static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
{
int result = 0;
@@ -673,7 +194,7 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
wid.val = (s8 *)&abort_running_scan;
wid.size = sizeof(char);
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
@@ -696,11 +217,11 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
return result;
}
-static void handle_scan(struct work_struct *work)
+int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
+ u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
+ size_t ies_len, wilc_scan_result scan_result, void *user_arg,
+ struct hidden_network *hidden_net)
{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct scan_attr *scan_info = &msg->body.scan_info;
int result = 0;
struct wid wid_list[5];
u32 index = 0;
@@ -709,10 +230,6 @@ static void handle_scan(struct work_struct *work)
u8 valuesize = 0;
u8 *hdn_ntwk_wid_val = NULL;
struct host_if_drv *hif_drv = vif->hif_drv;
- struct hidden_network *hidden_net = &scan_info->hidden_network;
-
- hif_drv->usr_scan_req.scan_result = scan_info->result;
- hif_drv->usr_scan_req.arg = scan_info->arg;
if (hif_drv->hif_state >= HOST_IF_SCANNING &&
hif_drv->hif_state < HOST_IF_CONNECTED) {
@@ -729,156 +246,95 @@ static void handle_scan(struct work_struct *work)
hif_drv->usr_scan_req.ch_cnt = 0;
- wid_list[index].id = WID_SSID_PROBE_REQ;
- wid_list[index].type = WID_STR;
+ if (hidden_net) {
+ wid_list[index].id = WID_SSID_PROBE_REQ;
+ wid_list[index].type = WID_STR;
- for (i = 0; i < hidden_net->n_ssids; i++)
- valuesize += ((hidden_net->net_info[i].ssid_len) + 1);
- hdn_ntwk_wid_val = kmalloc(valuesize + 1, GFP_KERNEL);
- wid_list[index].val = hdn_ntwk_wid_val;
- if (wid_list[index].val) {
- buffer = wid_list[index].val;
+ for (i = 0; i < hidden_net->n_ssids; i++)
+ valuesize += ((hidden_net->net_info[i].ssid_len) + 1);
+ hdn_ntwk_wid_val = kmalloc(valuesize + 1, GFP_KERNEL);
+ wid_list[index].val = hdn_ntwk_wid_val;
+ if (wid_list[index].val) {
+ buffer = wid_list[index].val;
- *buffer++ = hidden_net->n_ssids;
+ *buffer++ = hidden_net->n_ssids;
- for (i = 0; i < hidden_net->n_ssids; i++) {
- *buffer++ = hidden_net->net_info[i].ssid_len;
- memcpy(buffer, hidden_net->net_info[i].ssid,
- hidden_net->net_info[i].ssid_len);
- buffer += hidden_net->net_info[i].ssid_len;
- }
+ for (i = 0; i < hidden_net->n_ssids; i++) {
+ *buffer++ = hidden_net->net_info[i].ssid_len;
+ memcpy(buffer, hidden_net->net_info[i].ssid,
+ hidden_net->net_info[i].ssid_len);
+ buffer += hidden_net->net_info[i].ssid_len;
+ }
- wid_list[index].size = (s32)(valuesize + 1);
- index++;
+ wid_list[index].size = (s32)(valuesize + 1);
+ index++;
+ }
}
wid_list[index].id = WID_INFO_ELEMENT_PROBE;
wid_list[index].type = WID_BIN_DATA;
- wid_list[index].val = scan_info->ies;
- wid_list[index].size = scan_info->ies_len;
+ wid_list[index].val = (s8 *)ies;
+ wid_list[index].size = ies_len;
index++;
wid_list[index].id = WID_SCAN_TYPE;
wid_list[index].type = WID_CHAR;
wid_list[index].size = sizeof(char);
- wid_list[index].val = (s8 *)&scan_info->type;
+ wid_list[index].val = (s8 *)&scan_type;
index++;
wid_list[index].id = WID_SCAN_CHANNEL_LIST;
wid_list[index].type = WID_BIN_DATA;
- if (scan_info->ch_freq_list &&
- scan_info->ch_list_len > 0) {
- int i;
-
- for (i = 0; i < scan_info->ch_list_len; i++) {
- if (scan_info->ch_freq_list[i] > 0)
- scan_info->ch_freq_list[i] -= 1;
+ if (ch_freq_list && ch_list_len > 0) {
+ for (i = 0; i < ch_list_len; i++) {
+ if (ch_freq_list[i] > 0)
+ ch_freq_list[i] -= 1;
}
}
- wid_list[index].val = scan_info->ch_freq_list;
- wid_list[index].size = scan_info->ch_list_len;
+ wid_list[index].val = ch_freq_list;
+ wid_list[index].size = ch_list_len;
index++;
wid_list[index].id = WID_START_SCAN_REQ;
wid_list[index].type = WID_CHAR;
wid_list[index].size = sizeof(char);
- wid_list[index].val = (s8 *)&scan_info->src;
+ wid_list[index].val = (s8 *)&scan_source;
index++;
- result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
index,
wilc_get_vif_idx(vif));
-
- if (result)
- netdev_err(vif->ndev, "Failed to send scan parameters\n");
-
-error:
if (result) {
- del_timer(&hif_drv->scan_timer);
- handle_scan_done(vif, SCAN_EVENT_ABORTED);
+ netdev_err(vif->ndev, "Failed to send scan parameters\n");
+ goto error;
}
- kfree(scan_info->ch_freq_list);
- scan_info->ch_freq_list = NULL;
-
- kfree(scan_info->ies);
- scan_info->ies = NULL;
- kfree(scan_info->hidden_network.net_info);
- scan_info->hidden_network.net_info = NULL;
+ hif_drv->usr_scan_req.scan_result = scan_result;
+ hif_drv->usr_scan_req.arg = user_arg;
+ hif_drv->scan_timer_vif = vif;
+ mod_timer(&hif_drv->scan_timer,
+ jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
- kfree(hdn_ntwk_wid_val);
+error:
+ if (hidden_net) {
+ kfree(hidden_net->net_info);
+ kfree(hdn_ntwk_wid_val);
+ }
- kfree(msg);
+ return result;
}
-static void handle_connect(struct work_struct *work)
+static int wilc_send_connect_wid(struct wilc_vif *vif)
{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct connect_attr *conn_attr = &msg->body.con_info;
int result = 0;
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
u8 *cur_byte = NULL;
- struct join_bss_param *bss_param;
struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (msg->vif->hif_drv->usr_scan_req.scan_result) {
- result = wilc_enqueue_work(msg);
- if (result)
- goto error;
-
- usleep_range(2 * 1000, 2 * 1000);
- return;
- }
-
- bss_param = conn_attr->params;
- if (!bss_param) {
- netdev_err(vif->ndev, "Required BSSID not found\n");
- result = -ENOENT;
- goto error;
- }
-
- if (conn_attr->bssid) {
- hif_drv->usr_conn_req.bssid = kmemdup(conn_attr->bssid, 6,
- GFP_KERNEL);
- if (!hif_drv->usr_conn_req.bssid) {
- result = -ENOMEM;
- goto error;
- }
- }
-
- hif_drv->usr_conn_req.ssid_len = conn_attr->ssid_len;
- if (conn_attr->ssid) {
- hif_drv->usr_conn_req.ssid = kmalloc(conn_attr->ssid_len + 1,
- GFP_KERNEL);
- if (!hif_drv->usr_conn_req.ssid) {
- result = -ENOMEM;
- goto error;
- }
- memcpy(hif_drv->usr_conn_req.ssid,
- conn_attr->ssid,
- conn_attr->ssid_len);
- hif_drv->usr_conn_req.ssid[conn_attr->ssid_len] = '\0';
- }
-
- hif_drv->usr_conn_req.ies_len = conn_attr->ies_len;
- if (conn_attr->ies) {
- hif_drv->usr_conn_req.ies = kmemdup(conn_attr->ies,
- conn_attr->ies_len,
- GFP_KERNEL);
- if (!hif_drv->usr_conn_req.ies) {
- result = -ENOMEM;
- goto error;
- }
- }
-
- hif_drv->usr_conn_req.security = conn_attr->security;
- hif_drv->usr_conn_req.auth_type = conn_attr->auth_type;
- hif_drv->usr_conn_req.conn_result = conn_attr->result;
- hif_drv->usr_conn_req.arg = conn_attr->arg;
+ struct user_conn_req *conn_attr = &hif_drv->usr_conn_req;
+ struct join_bss_param *bss_param = hif_drv->usr_conn_req.param;
wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
wid_list[wid_cnt].type = WID_INT;
@@ -900,20 +356,20 @@ static void handle_connect(struct work_struct *work)
wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
wid_list[wid_cnt].type = WID_BIN_DATA;
- wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
- wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
+ wid_list[wid_cnt].val = conn_attr->ies;
+ wid_list[wid_cnt].size = conn_attr->ies_len;
wid_cnt++;
wid_list[wid_cnt].id = WID_11I_MODE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
- wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
+ wid_list[wid_cnt].val = (s8 *)&conn_attr->security;
wid_cnt++;
wid_list[wid_cnt].id = WID_AUTH_TYPE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
- wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
+ wid_list[wid_cnt].val = (s8 *)&conn_attr->auth_type;
wid_cnt++;
wid_list[wid_cnt].id = WID_JOIN_REQ_EXTENDED;
@@ -933,7 +389,7 @@ static void handle_connect(struct work_struct *work)
cur_byte[conn_attr->ssid_len] = '\0';
}
cur_byte += MAX_SSID_LEN;
- *(cur_byte++) = INFRASTRUCTURE;
+ *(cur_byte++) = WILC_FW_BSS_TYPE_INFRA;
if (conn_attr->ch >= 1 && conn_attr->ch <= 14) {
*(cur_byte++) = conn_attr->ch;
@@ -941,8 +397,8 @@ static void handle_connect(struct work_struct *work)
netdev_err(vif->ndev, "Channel out of range\n");
*(cur_byte++) = 0xFF;
}
- *(cur_byte++) = (bss_param->cap_info) & 0xFF;
- *(cur_byte++) = ((bss_param->cap_info) >> 8) & 0xFF;
+ put_unaligned_le16(bss_param->cap_info, cur_byte);
+ cur_byte += 2;
if (conn_attr->bssid)
memcpy(cur_byte, conn_attr->bssid, 6);
@@ -952,8 +408,8 @@ static void handle_connect(struct work_struct *work)
memcpy(cur_byte, conn_attr->bssid, 6);
cur_byte += 6;
- *(cur_byte++) = (bss_param->beacon_period) & 0xFF;
- *(cur_byte++) = ((bss_param->beacon_period) >> 8) & 0xFF;
+ put_unaligned_le16(bss_param->beacon_period, cur_byte);
+ cur_byte += 2;
*(cur_byte++) = bss_param->dtim_period;
memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1);
@@ -963,7 +419,7 @@ static void handle_connect(struct work_struct *work)
*(cur_byte++) = bss_param->uapsd_cap;
*(cur_byte++) = bss_param->ht_capable;
- hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable;
+ conn_attr->ht_capable = bss_param->ht_capable;
*(cur_byte++) = bss_param->rsn_found;
*(cur_byte++) = bss_param->rsn_grp_policy;
@@ -984,10 +440,8 @@ static void handle_connect(struct work_struct *work)
*(cur_byte++) = bss_param->noa_enabled;
if (bss_param->noa_enabled) {
- *(cur_byte++) = (bss_param->tsf) & 0xFF;
- *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF;
- *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF;
- *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF;
+ put_unaligned_le32(bss_param->tsf, cur_byte);
+ cur_byte += 4;
*(cur_byte++) = bss_param->opp_enabled;
*(cur_byte++) = bss_param->idx;
@@ -1013,49 +467,21 @@ static void handle_connect(struct work_struct *work)
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;
- result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
wid_cnt,
wilc_get_vif_idx(vif));
if (result) {
netdev_err(vif->ndev, "failed to send config packet\n");
- result = -EFAULT;
+ kfree(cur_byte);
goto error;
} else {
hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
}
-error:
- if (result) {
- struct connect_info conn_info;
-
- del_timer(&hif_drv->connect_timer);
-
- memset(&conn_info, 0, sizeof(struct connect_info));
-
- if (conn_attr->result) {
- if (conn_attr->bssid)
- memcpy(conn_info.bssid, conn_attr->bssid, 6);
-
- if (conn_attr->ies) {
- conn_info.req_ies_len = conn_attr->ies_len;
- conn_info.req_ies = kmalloc(conn_attr->ies_len,
- GFP_KERNEL);
- memcpy(conn_info.req_ies,
- conn_attr->ies,
- conn_attr->ies_len);
- }
-
- conn_attr->result(CONN_DISCONN_EVENT_CONN_RESP,
- &conn_info, MAC_STATUS_DISCONNECTED,
- NULL, conn_attr->arg);
- hif_drv->hif_state = HOST_IF_IDLE;
- kfree(conn_info.req_ies);
- conn_info.req_ies = NULL;
+ kfree(cur_byte);
+ return 0;
- } else {
- netdev_err(vif->ndev, "Connect callback is NULL\n");
- }
- }
+error:
kfree(conn_attr->bssid);
conn_attr->bssid = NULL;
@@ -1066,8 +492,7 @@ error:
kfree(conn_attr->ies);
conn_attr->ies = NULL;
- kfree(cur_byte);
- kfree(msg);
+ return result;
}
static void handle_connect_timeout(struct work_struct *work)
@@ -1106,7 +531,7 @@ static void handle_connect_timeout(struct work_struct *work)
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
&info,
- MAC_STATUS_DISCONNECTED,
+ WILC_MAC_STATUS_DISCONNECTED,
NULL,
hif_drv->usr_conn_req.arg);
@@ -1121,7 +546,7 @@ static void handle_connect_timeout(struct work_struct *work)
wid.val = (s8 *)&dummy_reason_code;
wid.size = sizeof(char);
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
netdev_err(vif->ndev, "Failed to send disconnect\n");
@@ -1305,6 +730,101 @@ static void *host_int_parse_join_bss_param(struct network_info *info)
return (void *)param;
}
+static inline u8 *get_bssid(struct ieee80211_mgmt *mgmt)
+{
+ if (ieee80211_has_fromds(mgmt->frame_control))
+ return mgmt->sa;
+ else if (ieee80211_has_tods(mgmt->frame_control))
+ return mgmt->da;
+ else
+ return mgmt->bssid;
+}
+
+static s32 wilc_parse_network_info(u8 *msg_buffer,
+ struct network_info **ret_network_info)
+{
+ struct network_info *info;
+ struct ieee80211_mgmt *mgt;
+ u8 *wid_val, *msa, *ies;
+ u16 wid_len, rx_len, ies_len;
+ u8 msg_type;
+ size_t offset;
+ const u8 *ch_elm, *tim_elm, *ssid_elm;
+
+ msg_type = msg_buffer[0];
+ if ('N' != msg_type)
+ return -EFAULT;
+
+ wid_len = get_unaligned_le16(&msg_buffer[6]);
+ wid_val = &msg_buffer[8];
+
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ info->rssi = wid_val[0];
+
+ msa = &wid_val[1];
+ mgt = (struct ieee80211_mgmt *)&wid_val[1];
+ rx_len = wid_len - 1;
+
+ if (ieee80211_is_probe_resp(mgt->frame_control)) {
+ info->cap_info = le16_to_cpu(mgt->u.probe_resp.capab_info);
+ info->beacon_period = le16_to_cpu(mgt->u.probe_resp.beacon_int);
+ info->tsf = le64_to_cpu(mgt->u.probe_resp.timestamp);
+ info->tsf_lo = (u32)info->tsf;
+ offset = offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
+ } else if (ieee80211_is_beacon(mgt->frame_control)) {
+ info->cap_info = le16_to_cpu(mgt->u.beacon.capab_info);
+ info->beacon_period = le16_to_cpu(mgt->u.beacon.beacon_int);
+ info->tsf = le64_to_cpu(mgt->u.beacon.timestamp);
+ info->tsf_lo = (u32)info->tsf;
+ offset = offsetof(struct ieee80211_mgmt, u.beacon.variable);
+ } else {
+ /* only process probe response and beacon frame */
+ kfree(info);
+ return -EIO;
+ }
+
+ ether_addr_copy(info->bssid, get_bssid(mgt));
+
+ ies = mgt->u.beacon.variable;
+ ies_len = rx_len - offset;
+ if (ies_len <= 0) {
+ kfree(info);
+ return -EIO;
+ }
+
+ info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
+ if (!info->ies) {
+ kfree(info);
+ return -ENOMEM;
+ }
+
+ info->ies_len = ies_len;
+
+ ssid_elm = cfg80211_find_ie(WLAN_EID_SSID, ies, ies_len);
+ if (ssid_elm) {
+ info->ssid_len = ssid_elm[1];
+ if (info->ssid_len <= IEEE80211_MAX_SSID_LEN)
+ memcpy(info->ssid, ssid_elm + 2, info->ssid_len);
+ else
+ info->ssid_len = 0;
+ }
+
+ ch_elm = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ies, ies_len);
+ if (ch_elm && ch_elm[1] > 0)
+ info->ch = ch_elm[2];
+
+ tim_elm = cfg80211_find_ie(WLAN_EID_TIM, ies, ies_len);
+ if (tim_elm && tim_elm[1] >= 2)
+ info->dtim_period = tim_elm[3];
+
+ *ret_network_info = info;
+
+ return 0;
+}
+
static void handle_rcvd_ntwrk_info(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -1387,7 +907,7 @@ static void host_int_get_assoc_res_info(struct wilc_vif *vif,
wid.val = assoc_resp_info;
wid.size = max_assoc_resp_info_len;
- result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
*rcvd_assoc_resp_info_len = 0;
@@ -1410,6 +930,28 @@ static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
hif_drv->usr_conn_req.ies = NULL;
}
+static s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+ struct connect_info *ret_conn_info)
+{
+ u8 *ies;
+ u16 ies_len;
+ struct assoc_resp *res = (struct assoc_resp *)buffer;
+
+ ret_conn_info->status = le16_to_cpu(res->status_code);
+ if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
+ ies = &buffer[sizeof(*res)];
+ ies_len = buffer_len - sizeof(*res);
+
+ ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL);
+ if (!ret_conn_info->resp_ies)
+ return -ENOMEM;
+
+ ret_conn_info->resp_ies_len = ies_len;
+ }
+
+ return 0;
+}
+
static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
u8 mac_status)
{
@@ -1418,13 +960,13 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
memset(&conn_info, 0, sizeof(struct connect_info));
- if (mac_status == MAC_STATUS_CONNECTED) {
+ if (mac_status == WILC_MAC_STATUS_CONNECTED) {
u32 assoc_resp_info_len;
- memset(hif_drv->assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
+ memset(hif_drv->assoc_resp, 0, WILC_MAX_ASSOC_RESP_FRAME_SIZE);
host_int_get_assoc_res_info(vif, hif_drv->assoc_resp,
- MAX_ASSOC_RESP_FRAME_SIZE,
+ WILC_MAX_ASSOC_RESP_FRAME_SIZE,
&assoc_resp_info_len);
if (assoc_resp_info_len != 0) {
@@ -1443,7 +985,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
if (hif_drv->usr_conn_req.bssid) {
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
- if (mac_status == MAC_STATUS_CONNECTED &&
+ if (mac_status == WILC_MAC_STATUS_CONNECTED &&
conn_info.status == WLAN_STATUS_SUCCESS) {
memcpy(hif_drv->assoc_bssid,
hif_drv->usr_conn_req.bssid, ETH_ALEN);
@@ -1463,7 +1005,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
&conn_info, mac_status, NULL,
hif_drv->usr_conn_req.arg);
- if (mac_status == MAC_STATUS_CONNECTED &&
+ if (mac_status == WILC_MAC_STATUS_CONNECTED &&
conn_info.status == WLAN_STATUS_SUCCESS) {
wilc_set_power_mgmt(vif, 0, 0);
@@ -1555,10 +1097,10 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work)
mac_status = rcvd_info->buffer[7];
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
host_int_parse_assoc_resp_info(vif, mac_status);
- } else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
+ } else if ((mac_status == WILC_MAC_STATUS_DISCONNECTED) &&
(hif_drv->hif_state == HOST_IF_CONNECTED)) {
host_int_handle_disconnect(vif);
- } else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
+ } else if ((mac_status == WILC_MAC_STATUS_DISCONNECTED) &&
(hif_drv->usr_scan_req.scan_result)) {
del_timer(&hif_drv->scan_timer);
if (hif_drv->usr_scan_req.scan_result)
@@ -1574,268 +1116,8 @@ free_msg:
kfree(msg);
}
-static int wilc_pmksa_key_copy(struct wilc_vif *vif, struct key_attr *hif_key)
-{
- int i;
- int ret;
- struct wid wid;
- u8 *key_buf;
-
- key_buf = kmalloc((hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1,
- GFP_KERNEL);
- if (!key_buf)
- return -ENOMEM;
-
- key_buf[0] = hif_key->attr.pmkid.numpmkid;
-
- for (i = 0; i < hif_key->attr.pmkid.numpmkid; i++) {
- memcpy(key_buf + ((PMKSA_KEY_LEN * i) + 1),
- hif_key->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
- memcpy(key_buf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1),
- hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
- }
-
- wid.id = WID_PMKID_INFO;
- wid.type = WID_STR;
- wid.val = (s8 *)key_buf;
- wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
-
- ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
- kfree(key_buf);
-
- return ret;
-}
-
-static void handle_key(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct key_attr *hif_key = &msg->body.key_info;
- int result = 0;
- struct wid wid;
- struct wid wid_list[5];
- u8 *key_buf;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- switch (hif_key->type) {
- case WEP:
-
- if (hif_key->action & ADDKEY_AP) {
- wid_list[0].id = WID_11I_MODE;
- wid_list[0].type = WID_CHAR;
- wid_list[0].size = sizeof(char);
- wid_list[0].val = (s8 *)&hif_key->attr.wep.mode;
-
- wid_list[1].id = WID_AUTH_TYPE;
- wid_list[1].type = WID_CHAR;
- wid_list[1].size = sizeof(char);
- wid_list[1].val = (s8 *)&hif_key->attr.wep.auth_type;
-
- key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
- GFP_KERNEL);
- if (!key_buf) {
- result = -ENOMEM;
- goto out_wep;
- }
-
- key_buf[0] = hif_key->attr.wep.index;
- key_buf[1] = hif_key->attr.wep.key_len;
-
- memcpy(&key_buf[2], hif_key->attr.wep.key,
- hif_key->attr.wep.key_len);
-
- wid_list[2].id = WID_WEP_KEY_VALUE;
- wid_list[2].type = WID_STR;
- wid_list[2].size = hif_key->attr.wep.key_len + 2;
- wid_list[2].val = (s8 *)key_buf;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- wid_list, 3,
- wilc_get_vif_idx(vif));
- kfree(key_buf);
- } else if (hif_key->action & ADDKEY) {
- key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
- GFP_KERNEL);
- if (!key_buf) {
- result = -ENOMEM;
- goto out_wep;
- }
- key_buf[0] = hif_key->attr.wep.index;
- memcpy(key_buf + 1, &hif_key->attr.wep.key_len, 1);
- memcpy(key_buf + 2, hif_key->attr.wep.key,
- hif_key->attr.wep.key_len);
-
- wid.id = WID_ADD_WEP_KEY;
- wid.type = WID_STR;
- wid.val = (s8 *)key_buf;
- wid.size = hif_key->attr.wep.key_len + 2;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- &wid, 1,
- wilc_get_vif_idx(vif));
- kfree(key_buf);
- } else if (hif_key->action & REMOVEKEY) {
- wid.id = WID_REMOVE_WEP_KEY;
- wid.type = WID_STR;
-
- wid.val = (s8 *)&hif_key->attr.wep.index;
- wid.size = 1;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- &wid, 1,
- wilc_get_vif_idx(vif));
- } else if (hif_key->action & DEFAULTKEY) {
- wid.id = WID_KEY_ID;
- wid.type = WID_CHAR;
- wid.val = (s8 *)&hif_key->attr.wep.index;
- wid.size = sizeof(char);
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- &wid, 1,
- wilc_get_vif_idx(vif));
- }
-out_wep:
- complete(&msg->work_comp);
- break;
-
- case WPA_RX_GTK:
- if (hif_key->action & ADDKEY_AP) {
- key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
- if (!key_buf) {
- result = -ENOMEM;
- goto out_wpa_rx_gtk;
- }
-
- if (hif_key->attr.wpa.seq)
- memcpy(key_buf + 6, hif_key->attr.wpa.seq, 8);
-
- memcpy(key_buf + 14, &hif_key->attr.wpa.index, 1);
- memcpy(key_buf + 15, &hif_key->attr.wpa.key_len, 1);
- memcpy(key_buf + 16, hif_key->attr.wpa.key,
- hif_key->attr.wpa.key_len);
-
- wid_list[0].id = WID_11I_MODE;
- wid_list[0].type = WID_CHAR;
- wid_list[0].size = sizeof(char);
- wid_list[0].val = (s8 *)&hif_key->attr.wpa.mode;
-
- wid_list[1].id = WID_ADD_RX_GTK;
- wid_list[1].type = WID_STR;
- wid_list[1].val = (s8 *)key_buf;
- wid_list[1].size = RX_MIC_KEY_MSG_LEN;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- wid_list, 2,
- wilc_get_vif_idx(vif));
-
- kfree(key_buf);
- } else if (hif_key->action & ADDKEY) {
- key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
- if (!key_buf) {
- result = -ENOMEM;
- goto out_wpa_rx_gtk;
- }
-
- if (hif_drv->hif_state == HOST_IF_CONNECTED)
- memcpy(key_buf, hif_drv->assoc_bssid, ETH_ALEN);
- else
- netdev_err(vif->ndev, "Couldn't handle\n");
-
- memcpy(key_buf + 6, hif_key->attr.wpa.seq, 8);
- memcpy(key_buf + 14, &hif_key->attr.wpa.index, 1);
- memcpy(key_buf + 15, &hif_key->attr.wpa.key_len, 1);
- memcpy(key_buf + 16, hif_key->attr.wpa.key,
- hif_key->attr.wpa.key_len);
-
- wid.id = WID_ADD_RX_GTK;
- wid.type = WID_STR;
- wid.val = (s8 *)key_buf;
- wid.size = RX_MIC_KEY_MSG_LEN;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- &wid, 1,
- wilc_get_vif_idx(vif));
-
- kfree(key_buf);
- }
-out_wpa_rx_gtk:
- complete(&msg->work_comp);
- break;
-
- case WPA_PTK:
- if (hif_key->action & ADDKEY_AP) {
- key_buf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL);
- if (!key_buf) {
- result = -ENOMEM;
- goto out_wpa_ptk;
- }
-
- memcpy(key_buf, hif_key->attr.wpa.mac_addr, 6);
- memcpy(key_buf + 6, &hif_key->attr.wpa.index, 1);
- memcpy(key_buf + 7, &hif_key->attr.wpa.key_len, 1);
- memcpy(key_buf + 8, hif_key->attr.wpa.key,
- hif_key->attr.wpa.key_len);
-
- wid_list[0].id = WID_11I_MODE;
- wid_list[0].type = WID_CHAR;
- wid_list[0].size = sizeof(char);
- wid_list[0].val = (s8 *)&hif_key->attr.wpa.mode;
-
- wid_list[1].id = WID_ADD_PTK;
- wid_list[1].type = WID_STR;
- wid_list[1].val = (s8 *)key_buf;
- wid_list[1].size = PTK_KEY_MSG_LEN + 1;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- wid_list, 2,
- wilc_get_vif_idx(vif));
- kfree(key_buf);
- } else if (hif_key->action & ADDKEY) {
- key_buf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
- if (!key_buf) {
- result = -ENOMEM;
- goto out_wpa_ptk;
- }
-
- memcpy(key_buf, hif_key->attr.wpa.mac_addr, 6);
- memcpy(key_buf + 6, &hif_key->attr.wpa.key_len, 1);
- memcpy(key_buf + 7, hif_key->attr.wpa.key,
- hif_key->attr.wpa.key_len);
-
- wid.id = WID_ADD_PTK;
- wid.type = WID_STR;
- wid.val = (s8 *)key_buf;
- wid.size = PTK_KEY_MSG_LEN;
-
- result = wilc_send_config_pkt(vif, SET_CFG,
- &wid, 1,
- wilc_get_vif_idx(vif));
- kfree(key_buf);
- }
-
-out_wpa_ptk:
- complete(&msg->work_comp);
- break;
-
- case PMKSA:
- result = wilc_pmksa_key_copy(vif, hif_key);
- /*free 'msg', this case it not a sync call*/
- kfree(msg);
- break;
- }
-
- if (result)
- netdev_err(vif->ndev, "Failed to send key config packet\n");
-
- /* free 'msg' data in caller sync call */
-}
-
-static void handle_disconnect(struct work_struct *work)
+int wilc_disconnect(struct wilc_vif *vif)
{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
struct disconnect_info disconn_info;
@@ -1852,12 +1134,11 @@ static void handle_disconnect(struct work_struct *work)
vif->obtaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
-
if (result) {
netdev_err(vif->ndev, "Failed to send dissconect\n");
- goto out;
+ return result;
}
memset(&disconn_info, 0, sizeof(struct disconnect_info));
@@ -1898,10 +1179,7 @@ static void handle_disconnect(struct work_struct *work)
kfree(conn_req->ies);
conn_req->ies = NULL;
-out:
-
- complete(&msg->work_comp);
- /* free 'msg' in caller after receiving completion */
+ return 0;
}
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
@@ -1910,37 +1188,13 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
return;
if (vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
vif->hif_drv->hif_state == HOST_IF_CONNECTING)
- wilc_disconnect(vif, 1);
-}
-
-static void handle_get_rssi(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- int result;
- struct wid wid;
-
- wid.id = WID_RSSI;
- wid.type = WID_CHAR;
- wid.val = msg->body.data;
- wid.size = sizeof(char);
-
- result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to get RSSI value\n");
-
- complete(&msg->work_comp);
- /* free 'msg' data in caller */
+ wilc_disconnect(vif);
}
-static void handle_get_statistics(struct work_struct *work)
+int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats)
{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
struct wid wid_list[5];
u32 wid_cnt = 0, result;
- struct rf_info *stats = (struct rf_info *)msg->body.data;
wid_list[wid_cnt].id = WID_LINKSPEED;
wid_list[wid_cnt].type = WID_CHAR;
@@ -1972,12 +1226,14 @@ static void handle_get_statistics(struct work_struct *work)
wid_list[wid_cnt].val = (s8 *)&stats->tx_fail_cnt;
wid_cnt++;
- result = wilc_send_config_pkt(vif, GET_CFG, wid_list,
+ result = wilc_send_config_pkt(vif, WILC_GET_CFG, wid_list,
wid_cnt,
wilc_get_vif_idx(vif));
- if (result)
+ if (result) {
netdev_err(vif->ndev, "Failed to send scan parameters\n");
+ return result;
+ }
if (stats->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH &&
stats->link_speed != DEFAULT_LINK_SPEED)
@@ -1985,293 +1241,47 @@ static void handle_get_statistics(struct work_struct *work)
else if (stats->link_speed != DEFAULT_LINK_SPEED)
wilc_enable_tcp_ack_filter(vif, false);
- /* free 'msg' for async command, for sync caller will free it */
- if (msg->is_sync)
- complete(&msg->work_comp);
- else
- kfree(msg);
-}
-
-static void handle_get_inactive_time(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct sta_inactive_t *hif_sta_inactive = &msg->body.mac_info;
- int result;
- struct wid wid;
-
- wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
- wid.type = WID_STR;
- wid.size = ETH_ALEN;
- wid.val = kmalloc(wid.size, GFP_KERNEL);
- if (!wid.val)
- goto out;
-
- ether_addr_copy(wid.val, hif_sta_inactive->mac);
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- kfree(wid.val);
-
- if (result) {
- netdev_err(vif->ndev, "Failed to set inactive mac\n");
- goto out;
- }
-
- wid.id = WID_GET_INACTIVE_TIME;
- wid.type = WID_INT;
- wid.val = (s8 *)&hif_sta_inactive->inactive_time;
- wid.size = sizeof(u32);
-
- result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
- if (result)
- netdev_err(vif->ndev, "Failed to get inactive time\n");
-
-out:
- /* free 'msg' data in caller */
- complete(&msg->work_comp);
-}
-
-static void handle_add_beacon(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct beacon_attr *param = &msg->body.beacon_info;
- int result;
- struct wid wid;
- u8 *cur_byte;
-
- wid.id = WID_ADD_BEACON;
- wid.type = WID_BIN;
- wid.size = param->head_len + param->tail_len + 16;
- wid.val = kmalloc(wid.size, GFP_KERNEL);
- if (!wid.val)
- goto error;
-
- cur_byte = wid.val;
- *cur_byte++ = (param->interval & 0xFF);
- *cur_byte++ = ((param->interval >> 8) & 0xFF);
- *cur_byte++ = ((param->interval >> 16) & 0xFF);
- *cur_byte++ = ((param->interval >> 24) & 0xFF);
-
- *cur_byte++ = (param->dtim_period & 0xFF);
- *cur_byte++ = ((param->dtim_period >> 8) & 0xFF);
- *cur_byte++ = ((param->dtim_period >> 16) & 0xFF);
- *cur_byte++ = ((param->dtim_period >> 24) & 0xFF);
-
- *cur_byte++ = (param->head_len & 0xFF);
- *cur_byte++ = ((param->head_len >> 8) & 0xFF);
- *cur_byte++ = ((param->head_len >> 16) & 0xFF);
- *cur_byte++ = ((param->head_len >> 24) & 0xFF);
-
- memcpy(cur_byte, param->head, param->head_len);
- cur_byte += param->head_len;
-
- *cur_byte++ = (param->tail_len & 0xFF);
- *cur_byte++ = ((param->tail_len >> 8) & 0xFF);
- *cur_byte++ = ((param->tail_len >> 16) & 0xFF);
- *cur_byte++ = ((param->tail_len >> 24) & 0xFF);
-
- if (param->tail)
- memcpy(cur_byte, param->tail, param->tail_len);
- cur_byte += param->tail_len;
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to send add beacon\n");
-
-error:
- kfree(wid.val);
- kfree(param->head);
- kfree(param->tail);
- kfree(msg);
-}
-
-static void handle_del_beacon(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- int result;
- struct wid wid;
- u8 del_beacon = 0;
-
- wid.id = WID_DEL_BEACON;
- wid.type = WID_CHAR;
- wid.size = sizeof(char);
- wid.val = &del_beacon;
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to send delete beacon\n");
- kfree(msg);
-}
-
-static u32 wilc_hif_pack_sta_param(u8 *buff, struct add_sta_param *param)
-{
- u8 *cur_byte;
-
- cur_byte = buff;
-
- memcpy(cur_byte, param->bssid, ETH_ALEN);
- cur_byte += ETH_ALEN;
-
- *cur_byte++ = param->aid & 0xFF;
- *cur_byte++ = (param->aid >> 8) & 0xFF;
-
- *cur_byte++ = param->rates_len;
- if (param->rates_len > 0)
- memcpy(cur_byte, param->rates, param->rates_len);
- cur_byte += param->rates_len;
-
- *cur_byte++ = param->ht_supported;
- memcpy(cur_byte, &param->ht_capa, sizeof(struct ieee80211_ht_cap));
- cur_byte += sizeof(struct ieee80211_ht_cap);
-
- *cur_byte++ = param->flags_mask & 0xFF;
- *cur_byte++ = (param->flags_mask >> 8) & 0xFF;
-
- *cur_byte++ = param->flags_set & 0xFF;
- *cur_byte++ = (param->flags_set >> 8) & 0xFF;
-
- return cur_byte - buff;
+ return result;
}
-static void handle_add_station(struct work_struct *work)
+static void handle_get_statistics(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
- struct add_sta_param *param = &msg->body.add_sta_info;
- int result;
- struct wid wid;
- u8 *cur_byte;
-
- wid.id = WID_ADD_STA;
- wid.type = WID_BIN;
- wid.size = WILC_ADD_STA_LENGTH + param->rates_len;
-
- wid.val = kmalloc(wid.size, GFP_KERNEL);
- if (!wid.val)
- goto error;
-
- cur_byte = wid.val;
- cur_byte += wilc_hif_pack_sta_param(cur_byte, param);
+ struct rf_info *stats = (struct rf_info *)msg->body.data;
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result != 0)
- netdev_err(vif->ndev, "Failed to send add station\n");
+ wilc_get_statistics(vif, stats);
-error:
- kfree(param->rates);
- kfree(wid.val);
kfree(msg);
}
-static void handle_del_all_sta(struct work_struct *work)
+static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac,
+ struct station_parameters *params)
{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct del_all_sta *param = &msg->body.del_all_sta_info;
- int result;
- struct wid wid;
- u8 *curr_byte;
- u8 i;
- u8 zero_buff[6] = {0};
+ ether_addr_copy(cur_byte, mac);
+ cur_byte += ETH_ALEN;
- wid.id = WID_DEL_ALL_STA;
- wid.type = WID_STR;
- wid.size = (param->assoc_sta * ETH_ALEN) + 1;
-
- wid.val = kmalloc((param->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL);
- if (!wid.val)
- goto error;
+ put_unaligned_le16(params->aid, cur_byte);
+ cur_byte += 2;
- curr_byte = wid.val;
+ *cur_byte++ = params->supported_rates_len;
+ if (params->supported_rates_len > 0)
+ memcpy(cur_byte, params->supported_rates,
+ params->supported_rates_len);
+ cur_byte += params->supported_rates_len;
- *(curr_byte++) = param->assoc_sta;
-
- for (i = 0; i < MAX_NUM_STA; i++) {
- if (memcmp(param->del_all_sta[i], zero_buff, ETH_ALEN))
- memcpy(curr_byte, param->del_all_sta[i], ETH_ALEN);
- else
- continue;
-
- curr_byte += ETH_ALEN;
+ if (params->ht_capa) {
+ *cur_byte++ = true;
+ memcpy(cur_byte, &params->ht_capa,
+ sizeof(struct ieee80211_ht_cap));
+ } else {
+ *cur_byte++ = false;
}
+ cur_byte += sizeof(struct ieee80211_ht_cap);
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to send delete all station\n");
-
-error:
- kfree(wid.val);
-
- /* free 'msg' data in caller */
- complete(&msg->work_comp);
-}
-
-static void handle_del_station(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct del_sta *param = &msg->body.del_sta_info;
- int result;
- struct wid wid;
-
- wid.id = WID_REMOVE_STA;
- wid.type = WID_BIN;
- wid.size = ETH_ALEN;
-
- wid.val = kmalloc(wid.size, GFP_KERNEL);
- if (!wid.val)
- goto error;
-
- ether_addr_copy(wid.val, param->mac_addr);
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to del station\n");
-
-error:
- kfree(wid.val);
- kfree(msg);
-}
-
-static void handle_edit_station(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct add_sta_param *param = &msg->body.edit_sta_info;
- int result;
- struct wid wid;
- u8 *cur_byte;
-
- wid.id = WID_EDIT_STA;
- wid.type = WID_BIN;
- wid.size = WILC_ADD_STA_LENGTH + param->rates_len;
-
- wid.val = kmalloc(wid.size, GFP_KERNEL);
- if (!wid.val)
- goto error;
-
- cur_byte = wid.val;
- cur_byte += wilc_hif_pack_sta_param(cur_byte, param);
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to send edit station\n");
-
-error:
- kfree(param->rates);
- kfree(wid.val);
- kfree(msg);
+ put_unaligned_le16(params->sta_flags_mask, cur_byte);
+ cur_byte += 2;
+ put_unaligned_le16(params->sta_flags_set, cur_byte);
}
static int handle_remain_on_chan(struct wilc_vif *vif,
@@ -2320,7 +1330,7 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
wid.val[0] = remain_on_chan_flag;
wid.val[1] = (s8)hif_remain_ch->ch;
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
kfree(wid.val);
if (result != 0)
@@ -2340,39 +1350,6 @@ error:
return result;
}
-static void handle_register_frame(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct reg_frame *hif_reg_frame = &msg->body.reg_frame;
- int result;
- struct wid wid;
- u8 *cur_byte;
-
- wid.id = WID_REGISTER_FRAME;
- wid.type = WID_STR;
- wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL);
- if (!wid.val)
- goto out;
-
- cur_byte = wid.val;
-
- *cur_byte++ = hif_reg_frame->reg;
- *cur_byte++ = hif_reg_frame->reg_id;
- memcpy(cur_byte, &hif_reg_frame->frame_type, sizeof(u16));
-
- wid.size = sizeof(u16) + 2;
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- kfree(wid.val);
- if (result)
- netdev_err(vif->ndev, "Failed to frame register\n");
-
-out:
- kfree(msg);
-}
-
static void handle_listen_state_expired(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -2397,7 +1374,7 @@ static void handle_listen_state_expired(struct work_struct *work)
wid.val[0] = remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
kfree(wid.val);
if (result != 0) {
@@ -2440,32 +1417,6 @@ static void listen_timer_cb(struct timer_list *t)
}
}
-static void handle_power_management(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- struct power_mgmt_param *pm_param = &msg->body.pwr_mgmt_info;
- int result;
- struct wid wid;
- s8 power_mode;
-
- wid.id = WID_POWER_MANAGEMENT;
-
- if (pm_param->enabled)
- power_mode = MIN_FAST_PS;
- else
- power_mode = NO_POWERSAVE;
-
- wid.val = &power_mode;
- wid.size = sizeof(char);
-
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
- netdev_err(vif->ndev, "Failed to send power management\n");
- kfree(msg);
-}
-
static void handle_set_mcast_filter(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -2497,7 +1448,7 @@ static void handle_set_mcast_filter(struct work_struct *work)
memcpy(cur_byte, hif_set_mc->mc_list,
((hif_set_mc->cnt) * ETH_ALEN));
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
netdev_err(vif->ndev, "Failed to send setup multicast\n");
@@ -2508,48 +1459,6 @@ error:
kfree(msg);
}
-static void handle_set_tx_pwr(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- u8 tx_pwr = msg->body.tx_power.tx_pwr;
- int ret;
- struct wid wid;
-
- wid.id = WID_TX_POWER;
- wid.type = WID_CHAR;
- wid.val = &tx_pwr;
- wid.size = sizeof(char);
-
- ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (ret)
- netdev_err(vif->ndev, "Failed to set TX PWR\n");
- kfree(msg);
-}
-
-/* Note: 'msg' will be free after using data */
-static void handle_get_tx_pwr(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
- struct wilc_vif *vif = msg->vif;
- u8 *tx_pwr = &msg->body.tx_power.tx_pwr;
- int ret;
- struct wid wid;
-
- wid.id = WID_TX_POWER;
- wid.type = WID_CHAR;
- wid.val = (s8 *)tx_pwr;
- wid.size = sizeof(char);
-
- ret = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (ret)
- netdev_err(vif->ndev, "Failed to get TX PWR\n");
-
- complete(&msg->work_comp);
-}
-
static void handle_scan_timer(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -2558,14 +1467,6 @@ static void handle_scan_timer(struct work_struct *work)
kfree(msg);
}
-static void handle_remain_on_chan_work(struct work_struct *work)
-{
- struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
-
- handle_remain_on_chan(msg->vif, &msg->body.remain_on_ch);
- kfree(msg);
-}
-
static void handle_scan_complete(struct work_struct *work)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -2579,7 +1480,8 @@ static void handle_scan_complete(struct work_struct *work)
handle_scan_done(msg->vif, SCAN_EVENT_DONE);
if (msg->vif->hif_drv->remain_on_ch_pending)
- handle_remain_on_chan(msg->vif, &msg->body.remain_on_ch);
+ handle_remain_on_chan(msg->vif,
+ &msg->vif->hif_drv->remain_on_ch);
kfree(msg);
}
@@ -2618,145 +1520,107 @@ static void timer_connect_cb(struct timer_list *t)
int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv) {
- result = -EFAULT;
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return result;
- }
- msg = wilc_alloc_work(vif, handle_key, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- msg->body.key_info.type = WEP;
- msg->body.key_info.action = REMOVEKEY;
- msg->body.key_info.attr.wep.index = index;
+ wid.id = WID_REMOVE_WEP_KEY;
+ wid.type = WID_STR;
+ wid.size = sizeof(char);
+ wid.val = &index;
- result = wilc_enqueue_work(msg);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- else
- wait_for_completion(&msg->work_comp);
-
- kfree(msg);
+ netdev_err(vif->ndev,
+ "Failed to send remove wep key config packet\n");
return result;
}
int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv) {
- result = -EFAULT;
- netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
- return result;
- }
-
- msg = wilc_alloc_work(vif, handle_key, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- msg->body.key_info.type = WEP;
- msg->body.key_info.action = DEFAULTKEY;
- msg->body.key_info.attr.wep.index = index;
- result = wilc_enqueue_work(msg);
+ wid.id = WID_KEY_ID;
+ wid.type = WID_CHAR;
+ wid.size = sizeof(char);
+ wid.val = &index;
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- else
- wait_for_completion(&msg->work_comp);
+ netdev_err(vif->ndev,
+ "Failed to send wep default key config packet\n");
- kfree(msg);
return result;
}
int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
u8 index)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return -EFAULT;
- }
+ struct wilc_wep_key *wep_key;
- msg = wilc_alloc_work(vif, handle_key, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_ADD_WEP_KEY;
+ wid.type = WID_STR;
+ wid.size = sizeof(*wep_key) + len;
+ wep_key = kzalloc(wid.size, GFP_KERNEL);
+ if (!wep_key)
+ return -ENOMEM;
- msg->body.key_info.type = WEP;
- msg->body.key_info.action = ADDKEY;
- msg->body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
- if (!msg->body.key_info.attr.wep.key) {
- result = -ENOMEM;
- goto free_msg;
- }
+ wid.val = (u8 *)wep_key;
- msg->body.key_info.attr.wep.key_len = len;
- msg->body.key_info.attr.wep.index = index;
+ wep_key->index = index;
+ wep_key->key_len = len;
+ memcpy(wep_key->key, key, len);
- result = wilc_enqueue_work(msg);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (result)
- goto free_key;
-
- wait_for_completion(&msg->work_comp);
-
-free_key:
- kfree(msg->body.key_info.attr.wep.key);
+ netdev_err(vif->ndev,
+ "Failed to add wep key config packet\n");
-free_msg:
- kfree(msg);
+ kfree(wep_key);
return result;
}
int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
u8 index, u8 mode, enum authtype auth_type)
{
+ struct wid wid_list[3];
int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
- return -EFAULT;
- }
-
- msg = wilc_alloc_work(vif, handle_key, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- msg->body.key_info.type = WEP;
- msg->body.key_info.action = ADDKEY_AP;
- msg->body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
- if (!msg->body.key_info.attr.wep.key) {
- result = -ENOMEM;
- goto free_msg;
- }
+ struct wilc_wep_key *wep_key;
+
+ wid_list[0].id = WID_11I_MODE;
+ wid_list[0].type = WID_CHAR;
+ wid_list[0].size = sizeof(char);
+ wid_list[0].val = &mode;
+
+ wid_list[1].id = WID_AUTH_TYPE;
+ wid_list[1].type = WID_CHAR;
+ wid_list[1].size = sizeof(char);
+ wid_list[1].val = (s8 *)&auth_type;
+
+ wid_list[2].id = WID_WEP_KEY_VALUE;
+ wid_list[2].type = WID_STR;
+ wid_list[2].size = sizeof(*wep_key) + len;
+ wep_key = kzalloc(wid_list[2].size, GFP_KERNEL);
+ if (!wep_key)
+ return -ENOMEM;
- msg->body.key_info.attr.wep.key_len = len;
- msg->body.key_info.attr.wep.index = index;
- msg->body.key_info.attr.wep.mode = mode;
- msg->body.key_info.attr.wep.auth_type = auth_type;
+ wid_list[2].val = (u8 *)wep_key;
- result = wilc_enqueue_work(msg);
+ wep_key->index = index;
+ wep_key->key_len = len;
+ memcpy(wep_key->key, key, len);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
+ ARRAY_SIZE(wid_list),
+ wilc_get_vif_idx(vif));
if (result)
- goto free_key;
-
- wait_for_completion(&msg->work_comp);
-
-free_key:
- kfree(msg->body.key_info.attr.wep.key);
+ netdev_err(vif->ndev,
+ "Failed to add wep ap key config packet\n");
-free_msg:
- kfree(msg);
+ kfree(wep_key);
return result;
}
@@ -2764,65 +1628,72 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
u8 mode, u8 cipher_mode, u8 index)
{
- int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
- u8 key_len = ptk_key_len;
-
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return -EFAULT;
- }
+ int result = 0;
+ u8 t_key_len = ptk_key_len + RX_MIC_KEY_LEN + TX_MIC_KEY_LEN;
- if (rx_mic)
- key_len += RX_MIC_KEY_LEN;
+ if (mode == WILC_AP_MODE) {
+ struct wid wid_list[2];
+ struct wilc_ap_wpa_ptk *key_buf;
- if (tx_mic)
- key_len += TX_MIC_KEY_LEN;
+ wid_list[0].id = WID_11I_MODE;
+ wid_list[0].type = WID_CHAR;
+ wid_list[0].size = sizeof(char);
+ wid_list[0].val = (s8 *)&cipher_mode;
- msg = wilc_alloc_work(vif, handle_key, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ key_buf = kzalloc(sizeof(*key_buf) + t_key_len, GFP_KERNEL);
+ if (!key_buf)
+ return -ENOMEM;
- msg->body.key_info.type = WPA_PTK;
- if (mode == AP_MODE) {
- msg->body.key_info.action = ADDKEY_AP;
- msg->body.key_info.attr.wpa.index = index;
- }
- if (mode == STATION_MODE)
- msg->body.key_info.action = ADDKEY;
+ ether_addr_copy(key_buf->mac_addr, mac_addr);
+ key_buf->index = index;
+ key_buf->key_len = t_key_len;
+ memcpy(&key_buf->key[0], ptk, ptk_key_len);
+
+ if (rx_mic)
+ memcpy(&key_buf->key[ptk_key_len], rx_mic,
+ RX_MIC_KEY_LEN);
+
+ if (tx_mic)
+ memcpy(&key_buf->key[ptk_key_len + RX_MIC_KEY_LEN],
+ tx_mic, TX_MIC_KEY_LEN);
+
+ wid_list[1].id = WID_ADD_PTK;
+ wid_list[1].type = WID_STR;
+ wid_list[1].size = sizeof(*key_buf) + t_key_len;
+ wid_list[1].val = (u8 *)key_buf;
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
+ ARRAY_SIZE(wid_list),
+ wilc_get_vif_idx(vif));
+ kfree(key_buf);
+ } else if (mode == WILC_STATION_MODE) {
+ struct wid wid;
+ struct wilc_sta_wpa_ptk *key_buf;
- msg->body.key_info.attr.wpa.key = kmemdup(ptk, ptk_key_len, GFP_KERNEL);
- if (!msg->body.key_info.attr.wpa.key) {
- result = -ENOMEM;
- goto free_msg;
- }
+ key_buf = kzalloc(sizeof(*key_buf) + t_key_len, GFP_KERNEL);
+ if (!key_buf)
+ return -ENOMEM;
- if (rx_mic)
- memcpy(msg->body.key_info.attr.wpa.key + 16, rx_mic,
- RX_MIC_KEY_LEN);
+ ether_addr_copy(key_buf->mac_addr, mac_addr);
+ key_buf->key_len = t_key_len;
+ memcpy(&key_buf->key[0], ptk, ptk_key_len);
- if (tx_mic)
- memcpy(msg->body.key_info.attr.wpa.key + 24, tx_mic,
- TX_MIC_KEY_LEN);
+ if (rx_mic)
+ memcpy(&key_buf->key[ptk_key_len], rx_mic,
+ RX_MIC_KEY_LEN);
- msg->body.key_info.attr.wpa.key_len = key_len;
- msg->body.key_info.attr.wpa.mac_addr = mac_addr;
- msg->body.key_info.attr.wpa.mode = cipher_mode;
+ if (tx_mic)
+ memcpy(&key_buf->key[ptk_key_len + RX_MIC_KEY_LEN],
+ tx_mic, TX_MIC_KEY_LEN);
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- goto free_key;
+ wid.id = WID_ADD_PTK;
+ wid.type = WID_STR;
+ wid.size = sizeof(*key_buf) + t_key_len;
+ wid.val = (s8 *)key_buf;
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ kfree(key_buf);
}
- wait_for_completion(&msg->work_comp);
-
-free_key:
- kfree(msg->body.key_info.attr.wpa.key);
-
-free_msg:
- kfree(msg);
return result;
}
@@ -2831,108 +1702,76 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
const u8 *rx_mic, const u8 *tx_mic, u8 mode,
u8 cipher_mode)
{
- int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
- u8 key_len = gtk_key_len;
-
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return -EFAULT;
- }
-
- msg = wilc_alloc_work(vif, handle_key, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- if (rx_mic)
- key_len += RX_MIC_KEY_LEN;
-
- if (tx_mic)
- key_len += TX_MIC_KEY_LEN;
-
- if (key_rsc) {
- msg->body.key_info.attr.wpa.seq = kmemdup(key_rsc,
- key_rsc_len,
- GFP_KERNEL);
- if (!msg->body.key_info.attr.wpa.seq) {
- result = -ENOMEM;
- goto free_msg;
- }
- }
+ int result = 0;
+ struct wilc_gtk_key *gtk_key;
+ int t_key_len = gtk_key_len + RX_MIC_KEY_LEN + TX_MIC_KEY_LEN;
- msg->body.key_info.type = WPA_RX_GTK;
+ gtk_key = kzalloc(sizeof(*gtk_key) + t_key_len, GFP_KERNEL);
+ if (!gtk_key)
+ return -ENOMEM;
- if (mode == AP_MODE) {
- msg->body.key_info.action = ADDKEY_AP;
- msg->body.key_info.attr.wpa.mode = cipher_mode;
- }
- if (mode == STATION_MODE)
- msg->body.key_info.action = ADDKEY;
+ /* fill bssid value only in station mode */
+ if (mode == WILC_STATION_MODE &&
+ vif->hif_drv->hif_state == HOST_IF_CONNECTED)
+ memcpy(gtk_key->mac_addr, vif->hif_drv->assoc_bssid, ETH_ALEN);
- msg->body.key_info.attr.wpa.key = kmemdup(rx_gtk, key_len, GFP_KERNEL);
- if (!msg->body.key_info.attr.wpa.key) {
- result = -ENOMEM;
- goto free_seq;
- }
+ if (key_rsc)
+ memcpy(gtk_key->rsc, key_rsc, 8);
+ gtk_key->index = index;
+ gtk_key->key_len = t_key_len;
+ memcpy(&gtk_key->key[0], rx_gtk, gtk_key_len);
if (rx_mic)
- memcpy(msg->body.key_info.attr.wpa.key + 16, rx_mic,
- RX_MIC_KEY_LEN);
+ memcpy(&gtk_key->key[gtk_key_len], rx_mic, RX_MIC_KEY_LEN);
if (tx_mic)
- memcpy(msg->body.key_info.attr.wpa.key + 24, tx_mic,
- TX_MIC_KEY_LEN);
+ memcpy(&gtk_key->key[gtk_key_len + RX_MIC_KEY_LEN],
+ tx_mic, TX_MIC_KEY_LEN);
- msg->body.key_info.attr.wpa.index = index;
- msg->body.key_info.attr.wpa.key_len = key_len;
- msg->body.key_info.attr.wpa.seq_len = key_rsc_len;
+ if (mode == WILC_AP_MODE) {
+ struct wid wid_list[2];
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- goto free_key;
- }
+ wid_list[0].id = WID_11I_MODE;
+ wid_list[0].type = WID_CHAR;
+ wid_list[0].size = sizeof(char);
+ wid_list[0].val = (s8 *)&cipher_mode;
- wait_for_completion(&msg->work_comp);
+ wid_list[1].id = WID_ADD_RX_GTK;
+ wid_list[1].type = WID_STR;
+ wid_list[1].size = sizeof(*gtk_key) + t_key_len;
+ wid_list[1].val = (u8 *)gtk_key;
-free_key:
- kfree(msg->body.key_info.attr.wpa.key);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
+ ARRAY_SIZE(wid_list),
+ wilc_get_vif_idx(vif));
+ kfree(gtk_key);
+ } else if (mode == WILC_STATION_MODE) {
+ struct wid wid;
-free_seq:
- kfree(msg->body.key_info.attr.wpa.seq);
+ wid.id = WID_ADD_RX_GTK;
+ wid.type = WID_STR;
+ wid.size = sizeof(*gtk_key) + t_key_len;
+ wid.val = (u8 *)gtk_key;
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ kfree(gtk_key);
+ }
-free_msg:
- kfree(msg);
return result;
}
-int wilc_set_pmkid_info(struct wilc_vif *vif,
- struct host_if_pmkid_attr *pmkid)
+int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- int i;
-
- msg = wilc_alloc_work(vif, handle_key, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
- msg->body.key_info.type = PMKSA;
- msg->body.key_info.action = ADDKEY;
-
- for (i = 0; i < pmkid->numpmkid; i++) {
- memcpy(msg->body.key_info.attr.pmkid.pmkidlist[i].bssid,
- &pmkid->pmkidlist[i].bssid, ETH_ALEN);
- memcpy(msg->body.key_info.attr.pmkid.pmkidlist[i].pmkid,
- &pmkid->pmkidlist[i].pmkid, PMKID_LEN);
- }
+ wid.id = WID_PMKID_INFO;
+ wid.type = WID_STR;
+ wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1;
+ wid.val = (u8 *)pmkid;
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
return result;
}
@@ -2940,21 +1779,17 @@ int wilc_set_pmkid_info(struct wilc_vif *vif,
int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
{
int result;
- struct host_if_msg *msg;
-
- msg = wilc_alloc_work(vif, handle_get_mac_address, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ struct wid wid;
- msg->body.get_mac_info.mac_addr = mac_addr;
+ wid.id = WID_MAC_ADDR;
+ wid.type = WID_STR;
+ wid.size = ETH_ALEN;
+ wid.val = mac_addr;
- result = wilc_enqueue_work(msg);
+ result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- else
- wait_for_completion(&msg->work_comp);
-
- kfree(msg);
+ netdev_err(vif->ndev, "Failed to get mac address\n");
return result;
}
@@ -2966,8 +1801,8 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
u8 channel, void *join_params)
{
int result;
- struct host_if_msg *msg;
struct host_if_drv *hif_drv = vif->hif_drv;
+ struct user_conn_req *con_info = &hif_drv->usr_conn_req;
if (!hif_drv || !connect_result) {
netdev_err(vif->ndev,
@@ -2981,50 +1816,45 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
return -EFAULT;
}
- msg = wilc_alloc_work(vif, handle_connect, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ if (hif_drv->usr_scan_req.scan_result) {
+ netdev_err(vif->ndev, "%s: Scan in progress\n", __func__);
+ return -EBUSY;
+ }
- msg->body.con_info.security = security;
- msg->body.con_info.auth_type = auth_type;
- msg->body.con_info.ch = channel;
- msg->body.con_info.result = connect_result;
- msg->body.con_info.arg = user_arg;
- msg->body.con_info.params = join_params;
+ con_info->security = security;
+ con_info->auth_type = auth_type;
+ con_info->ch = channel;
+ con_info->conn_result = connect_result;
+ con_info->arg = user_arg;
+ con_info->param = join_params;
if (bssid) {
- msg->body.con_info.bssid = kmemdup(bssid, 6, GFP_KERNEL);
- if (!msg->body.con_info.bssid) {
- result = -ENOMEM;
- goto free_msg;
- }
+ con_info->bssid = kmemdup(bssid, 6, GFP_KERNEL);
+ if (!con_info->bssid)
+ return -ENOMEM;
}
if (ssid) {
- msg->body.con_info.ssid_len = ssid_len;
- msg->body.con_info.ssid = kmemdup(ssid, ssid_len, GFP_KERNEL);
- if (!msg->body.con_info.ssid) {
+ con_info->ssid_len = ssid_len;
+ con_info->ssid = kmemdup(ssid, ssid_len, GFP_KERNEL);
+ if (!con_info->ssid) {
result = -ENOMEM;
goto free_bssid;
}
}
if (ies) {
- msg->body.con_info.ies_len = ies_len;
- msg->body.con_info.ies = kmemdup(ies, ies_len, GFP_KERNEL);
- if (!msg->body.con_info.ies) {
+ con_info->ies_len = ies_len;
+ con_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
+ if (!con_info->ies) {
result = -ENOMEM;
goto free_ssid;
}
}
- if (hif_drv->hif_state < HOST_IF_CONNECTING)
- hif_drv->hif_state = HOST_IF_CONNECTING;
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
+ result = wilc_send_connect_wid(vif);
+ if (result)
goto free_ies;
- }
hif_drv->connect_timer_vif = vif;
mod_timer(&hif_drv->connect_timer,
@@ -3033,181 +1863,141 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
return 0;
free_ies:
- kfree(msg->body.con_info.ies);
+ kfree(con_info->ies);
free_ssid:
- kfree(msg->body.con_info.ssid);
+ kfree(con_info->ssid);
free_bssid:
- kfree(msg->body.con_info.bssid);
-
-free_msg:
- kfree(msg);
- return result;
-}
-
-int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
-{
- int result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return -EFAULT;
- }
-
- msg = wilc_alloc_work(vif, handle_disconnect, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- result = wilc_enqueue_work(msg);
- if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- else
- wait_for_completion(&msg->work_comp);
+ kfree(con_info->bssid);
- kfree(msg);
return result;
}
int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- msg = wilc_alloc_work(vif, handle_set_channel, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- msg->body.channel_info.set_ch = channel;
+ wid.id = WID_CURRENT_CHANNEL;
+ wid.type = WID_CHAR;
+ wid.size = sizeof(char);
+ wid.val = &channel;
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to set channel\n");
return result;
}
int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
- u8 ifc_id, bool is_sync)
+ u8 ifc_id)
{
+ struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;
int result;
- struct host_if_msg *msg;
-
- msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ struct wilc_drv_handler drv;
- msg->body.drv.handler = index;
- msg->body.drv.mode = mode;
- msg->body.drv.name = ifc_id;
+ wid.id = WID_SET_DRV_HANDLER;
+ wid.type = WID_STR;
+ wid.size = sizeof(drv);
+ wid.val = (u8 *)&drv;
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- return result;
- }
+ drv.handler = cpu_to_le32(index);
+ drv.mode = (ifc_id | (mode << 1));
- if (is_sync)
- wait_for_completion(&msg->work_comp);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ hif_drv->driver_handler_id);
+ if (result)
+ netdev_err(vif->ndev, "Failed to set driver handler\n");
return result;
}
int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
{
+ struct wid wid;
+ struct wilc_op_mode op_mode;
int result;
- struct host_if_msg *msg;
- msg = wilc_alloc_work(vif, handle_set_operation_mode, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_SET_OPERATION_MODE;
+ wid.type = WID_INT;
+ wid.size = sizeof(op_mode);
+ wid.val = (u8 *)&op_mode;
- msg->body.mode.mode = mode;
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ op_mode.mode = cpu_to_le32(mode);
+
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to set operation mode\n");
return result;
}
-s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
- u32 *out_val)
+s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, u32 *out_val)
{
+ struct wid wid;
s32 result;
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return -EFAULT;
- }
-
- msg = wilc_alloc_work(vif, handle_get_inactive_time, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
+ wid.type = WID_STR;
+ wid.size = ETH_ALEN;
+ wid.val = kzalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ return -ENOMEM;
- memcpy(msg->body.mac_info.mac, mac, ETH_ALEN);
+ ether_addr_copy(wid.val, mac);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ kfree(wid.val);
+ if (result) {
+ netdev_err(vif->ndev, "Failed to set inactive mac\n");
+ return result;
+ }
- result = wilc_enqueue_work(msg);
+ wid.id = WID_GET_INACTIVE_TIME;
+ wid.type = WID_INT;
+ wid.val = (s8 *)out_val;
+ wid.size = sizeof(u32);
+ result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- else
- wait_for_completion(&msg->work_comp);
-
- *out_val = msg->body.mac_info.inactive_time;
- kfree(msg);
+ netdev_err(vif->ndev, "Failed to get inactive time\n");
return result;
}
int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
if (!rssi_level) {
netdev_err(vif->ndev, "%s: RSSI level is NULL\n", __func__);
return -EFAULT;
}
- msg = wilc_alloc_work(vif, handle_get_rssi, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- msg->body.data = kzalloc(sizeof(s8), GFP_KERNEL);
- if (!msg->body.data) {
- kfree(msg);
- return -ENOMEM;
- }
-
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- } else {
- wait_for_completion(&msg->work_comp);
- *rssi_level = *msg->body.data;
- }
-
- kfree(msg->body.data);
- kfree(msg);
+ wid.id = WID_RSSI;
+ wid.type = WID_CHAR;
+ wid.size = sizeof(char);
+ wid.val = rssi_level;
+ result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to get RSSI value\n");
return result;
}
-int
-wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync)
+int wilc_get_stats_async(struct wilc_vif *vif, struct rf_info *stats)
{
int result;
struct host_if_msg *msg;
- msg = wilc_alloc_work(vif, handle_get_statistics, is_sync);
+ msg = wilc_alloc_work(vif, handle_get_statistics, false);
if (IS_ERR(msg))
return PTR_ERR(msg);
@@ -3220,104 +2010,46 @@ wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync)
return result;
}
- if (is_sync) {
- wait_for_completion(&msg->work_comp);
- kfree(msg);
- }
-
return result;
}
-int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
- u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
- size_t ies_len, wilc_scan_result scan_result, void *user_arg,
- struct hidden_network *hidden_network)
+int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param)
{
+ struct wid wid_list[4];
+ int i = 0;
int result;
- struct host_if_msg *msg;
- struct scan_attr *scan_info;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv || !scan_result) {
- netdev_err(vif->ndev, "hif_drv or scan_result = NULL\n");
- return -EFAULT;
- }
-
- msg = wilc_alloc_work(vif, handle_scan, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
- scan_info = &msg->body.scan_info;
-
- if (hidden_network) {
- scan_info->hidden_network.net_info = hidden_network->net_info;
- scan_info->hidden_network.n_ssids = hidden_network->n_ssids;
- }
-
- scan_info->src = scan_source;
- scan_info->type = scan_type;
- scan_info->result = scan_result;
- scan_info->arg = user_arg;
-
- scan_info->ch_list_len = ch_list_len;
- scan_info->ch_freq_list = kmemdup(ch_freq_list,
- ch_list_len,
- GFP_KERNEL);
- if (!scan_info->ch_freq_list) {
- result = -ENOMEM;
- goto free_msg;
+ if (param->flag & WILC_CFG_PARAM_RETRY_SHORT) {
+ wid_list[i].id = WID_SHORT_RETRY_LIMIT;
+ wid_list[i].val = (s8 *)&param->short_retry_limit;
+ wid_list[i].type = WID_SHORT;
+ wid_list[i].size = sizeof(u16);
+ i++;
}
-
- scan_info->ies_len = ies_len;
- scan_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
- if (!scan_info->ies) {
- result = -ENOMEM;
- goto free_freq_list;
+ if (param->flag & WILC_CFG_PARAM_RETRY_LONG) {
+ wid_list[i].id = WID_LONG_RETRY_LIMIT;
+ wid_list[i].val = (s8 *)&param->long_retry_limit;
+ wid_list[i].type = WID_SHORT;
+ wid_list[i].size = sizeof(u16);
+ i++;
}
-
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- goto free_ies;
+ if (param->flag & WILC_CFG_PARAM_FRAG_THRESHOLD) {
+ wid_list[i].id = WID_FRAG_THRESHOLD;
+ wid_list[i].val = (s8 *)&param->frag_threshold;
+ wid_list[i].type = WID_SHORT;
+ wid_list[i].size = sizeof(u16);
+ i++;
}
-
- hif_drv->scan_timer_vif = vif;
- mod_timer(&hif_drv->scan_timer,
- jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
-
- return 0;
-
-free_ies:
- kfree(scan_info->ies);
-
-free_freq_list:
- kfree(scan_info->ch_freq_list);
-
-free_msg:
- kfree(msg);
- return result;
-}
-
-int wilc_hif_set_cfg(struct wilc_vif *vif,
- struct cfg_param_attr *cfg_param)
-{
- struct host_if_msg *msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
- int result;
-
- if (!hif_drv) {
- netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
- return -EFAULT;
+ if (param->flag & WILC_CFG_PARAM_RTS_THRESHOLD) {
+ wid_list[i].id = WID_RTS_THRESHOLD;
+ wid_list[i].val = (s8 *)&param->rts_threshold;
+ wid_list[i].type = WID_SHORT;
+ wid_list[i].size = sizeof(u16);
+ i++;
}
- msg = wilc_alloc_work(vif, handle_cfg_param, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- msg->body.cfg_info = *cfg_param;
- result = wilc_enqueue_work(msg);
- if (result)
- kfree(msg);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
+ i, wilc_get_vif_idx(vif));
return result;
}
@@ -3332,7 +2064,7 @@ static void get_periodic_rssi(struct timer_list *t)
}
if (vif->hif_drv->hif_state == HOST_IF_CONNECTED)
- wilc_get_statistics(vif, &vif->periodic_stat, false);
+ wilc_get_stats_async(vif, &vif->periodic_stat);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
}
@@ -3368,20 +2100,10 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
timer_setup(&hif_drv->connect_timer, timer_connect_cb, 0);
timer_setup(&hif_drv->remain_on_ch_timer, listen_timer_cb, 0);
- mutex_init(&hif_drv->cfg_values_lock);
- mutex_lock(&hif_drv->cfg_values_lock);
-
hif_drv->hif_state = HOST_IF_IDLE;
- hif_drv->cfg_values.site_survey_enabled = SITE_SURVEY_OFF;
- hif_drv->cfg_values.scan_source = DEFAULT_SCAN;
- hif_drv->cfg_values.active_scan_time = ACTIVE_SCAN_TIME;
- hif_drv->cfg_values.passive_scan_time = PASSIVE_SCAN_TIME;
- hif_drv->cfg_values.curr_tx_rate = AUTORATE;
hif_drv->p2p_timeout = 0;
- mutex_unlock(&hif_drv->cfg_values_lock);
-
wilc->clients_count++;
return 0;
@@ -3406,7 +2128,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer);
- wilc_set_wfi_drv_handler(vif, 0, 0, 0, true);
+ wilc_set_wfi_drv_handler(vif, 0, 0, 0);
if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
@@ -3564,25 +2286,19 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
wilc_remain_on_chan_ready ready,
void *user_arg)
{
+ struct remain_ch roc;
int result;
- struct host_if_msg *msg;
-
- msg = wilc_alloc_work(vif, handle_remain_on_chan_work, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
- msg->body.remain_on_ch.ch = chan;
- msg->body.remain_on_ch.expired = expired;
- msg->body.remain_on_ch.ready = ready;
- msg->body.remain_on_ch.arg = user_arg;
- msg->body.remain_on_ch.duration = duration;
- msg->body.remain_on_ch.id = session_id;
-
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ roc.ch = chan;
+ roc.expired = expired;
+ roc.ready = ready;
+ roc.arg = user_arg;
+ roc.duration = duration;
+ roc.id = session_id;
+ result = handle_remain_on_chan(vif, &roc);
+ if (result)
+ netdev_err(vif->ndev, "%s: failed to set remain on channel\n",
+ __func__);
return result;
}
@@ -3617,77 +2333,75 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)
void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
+ struct wilc_reg_frame reg_frame;
- msg = wilc_alloc_work(vif, handle_register_frame, false);
- if (IS_ERR(msg))
- return;
+ wid.id = WID_REGISTER_FRAME;
+ wid.type = WID_STR;
+ wid.size = sizeof(reg_frame);
+ wid.val = (u8 *)&reg_frame;
+
+ memset(&reg_frame, 0x0, sizeof(reg_frame));
+ reg_frame.reg = reg;
switch (frame_type) {
- case ACTION:
- msg->body.reg_frame.reg_id = ACTION_FRM_IDX;
+ case IEEE80211_STYPE_ACTION:
+ reg_frame.reg_id = WILC_FW_ACTION_FRM_IDX;
break;
- case PROBE_REQ:
- msg->body.reg_frame.reg_id = PROBE_REQ_IDX;
+ case IEEE80211_STYPE_PROBE_REQ:
+ reg_frame.reg_id = WILC_FW_PROBE_REQ_IDX;
break;
default:
break;
}
- msg->body.reg_frame.frame_type = frame_type;
- msg->body.reg_frame.reg = reg;
-
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ reg_frame.frame_type = cpu_to_le16(frame_type);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to frame register\n");
}
int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
- u32 head_len, u8 *head, u32 tail_len, u8 *tail)
+ struct cfg80211_beacon_data *params)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct beacon_attr *beacon_info;
+ u8 *cur_byte;
- msg = wilc_alloc_work(vif, handle_add_beacon, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_ADD_BEACON;
+ wid.type = WID_BIN;
+ wid.size = params->head_len + params->tail_len + 16;
+ wid.val = kzalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ return -ENOMEM;
- beacon_info = &msg->body.beacon_info;
- beacon_info->interval = interval;
- beacon_info->dtim_period = dtim_period;
- beacon_info->head_len = head_len;
- beacon_info->head = kmemdup(head, head_len, GFP_KERNEL);
- if (!beacon_info->head) {
- result = -ENOMEM;
- goto error;
- }
- beacon_info->tail_len = tail_len;
+ cur_byte = wid.val;
+ put_unaligned_le32(interval, cur_byte);
+ cur_byte += 4;
+ put_unaligned_le32(dtim_period, cur_byte);
+ cur_byte += 4;
+ put_unaligned_le32(params->head_len, cur_byte);
+ cur_byte += 4;
- if (tail_len > 0) {
- beacon_info->tail = kmemdup(tail, tail_len, GFP_KERNEL);
- if (!beacon_info->tail) {
- result = -ENOMEM;
- goto error;
- }
- } else {
- beacon_info->tail = NULL;
- }
+ if (params->head_len > 0)
+ memcpy(cur_byte, params->head, params->head_len);
+ cur_byte += params->head_len;
- result = wilc_enqueue_work(msg);
+ put_unaligned_le32(params->tail_len, cur_byte);
+ cur_byte += 4;
+
+ if (params->tail_len > 0)
+ memcpy(cur_byte, params->tail, params->tail_len);
+
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
+ netdev_err(vif->ndev, "Failed to send add beacon\n");
-error:
- if (result) {
- kfree(beacon_info->head);
- kfree(beacon_info->tail);
- kfree(msg);
- }
+ kfree(wid.val);
return result;
}
@@ -3695,170 +2409,158 @@ error:
int wilc_del_beacon(struct wilc_vif *vif)
{
int result;
- struct host_if_msg *msg;
+ struct wid wid;
+ u8 del_beacon = 0;
- msg = wilc_alloc_work(vif, handle_del_beacon, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_DEL_BEACON;
+ wid.type = WID_CHAR;
+ wid.size = sizeof(char);
+ wid.val = &del_beacon;
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to send delete beacon\n");
return result;
}
-int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)
+int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
+ struct station_parameters *params)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct add_sta_param *add_sta_info;
+ u8 *cur_byte;
- msg = wilc_alloc_work(vif, handle_add_station, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_ADD_STA;
+ wid.type = WID_BIN;
+ wid.size = WILC_ADD_STA_LENGTH + params->supported_rates_len;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ return -ENOMEM;
- add_sta_info = &msg->body.add_sta_info;
- memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
- if (add_sta_info->rates_len > 0) {
- add_sta_info->rates = kmemdup(sta_param->rates,
- add_sta_info->rates_len,
- GFP_KERNEL);
- if (!add_sta_info->rates) {
- kfree(msg);
- return -ENOMEM;
- }
- }
+ cur_byte = wid.val;
+ wilc_hif_pack_sta_param(cur_byte, mac, params);
+
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result != 0)
+ netdev_err(vif->ndev, "Failed to send add station\n");
+
+ kfree(wid.val);
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(add_sta_info->rates);
- kfree(msg);
- }
return result;
}
int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct del_sta *del_sta_info;
- msg = wilc_alloc_work(vif, handle_del_station, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- del_sta_info = &msg->body.del_sta_info;
+ wid.id = WID_REMOVE_STA;
+ wid.type = WID_BIN;
+ wid.size = ETH_ALEN;
+ wid.val = kzalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ return -ENOMEM;
if (!mac_addr)
- eth_broadcast_addr(del_sta_info->mac_addr);
+ eth_broadcast_addr(wid.val);
else
- memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN);
+ ether_addr_copy(wid.val, mac_addr);
+
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to del station\n");
+
+ kfree(wid.val);
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
return result;
}
int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN])
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct del_all_sta *del_all_sta_info;
- u8 zero_addr[ETH_ALEN] = {0};
int i;
u8 assoc_sta = 0;
+ struct del_all_sta del_sta;
- msg = wilc_alloc_work(vif, handle_del_all_sta, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
-
- del_all_sta_info = &msg->body.del_all_sta_info;
-
- for (i = 0; i < MAX_NUM_STA; i++) {
- if (memcmp(mac_addr[i], zero_addr, ETH_ALEN)) {
- memcpy(del_all_sta_info->del_all_sta[i], mac_addr[i],
- ETH_ALEN);
+ memset(&del_sta, 0x0, sizeof(del_sta));
+ for (i = 0; i < WILC_MAX_NUM_STA; i++) {
+ if (!is_zero_ether_addr(mac_addr[i])) {
assoc_sta++;
+ ether_addr_copy(del_sta.mac[i], mac_addr[i]);
}
}
- if (!assoc_sta) {
- kfree(msg);
+
+ if (!assoc_sta)
return 0;
- }
- del_all_sta_info->assoc_sta = assoc_sta;
- result = wilc_enqueue_work(msg);
+ del_sta.assoc_sta = assoc_sta;
- if (result)
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- else
- wait_for_completion(&msg->work_comp);
+ wid.id = WID_DEL_ALL_STA;
+ wid.type = WID_STR;
+ wid.size = (assoc_sta * ETH_ALEN) + 1;
+ wid.val = (u8 *)&del_sta;
- kfree(msg);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to send delete all station\n");
return result;
}
-int wilc_edit_station(struct wilc_vif *vif,
- struct add_sta_param *sta_param)
+int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
+ struct station_parameters *params)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
- struct add_sta_param *add_sta_info;
+ u8 *cur_byte;
- msg = wilc_alloc_work(vif, handle_edit_station, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_EDIT_STA;
+ wid.type = WID_BIN;
+ wid.size = WILC_ADD_STA_LENGTH + params->supported_rates_len;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ return -ENOMEM;
- add_sta_info = &msg->body.add_sta_info;
- memcpy(add_sta_info, sta_param, sizeof(*add_sta_info));
- if (add_sta_info->rates_len > 0) {
- add_sta_info->rates = kmemdup(sta_param->rates,
- add_sta_info->rates_len,
- GFP_KERNEL);
- if (!add_sta_info->rates) {
- kfree(msg);
- return -ENOMEM;
- }
- }
+ cur_byte = wid.val;
+ wilc_hif_pack_sta_param(cur_byte, mac, params);
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(add_sta_info->rates);
- kfree(msg);
- }
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to send edit station\n");
+ kfree(wid.val);
return result;
}
int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)
{
+ struct wid wid;
int result;
- struct host_if_msg *msg;
+ s8 power_mode;
if (wilc_wlan_get_num_conn_ifcs(vif->wilc) == 2 && enabled)
return 0;
- msg = wilc_alloc_work(vif, handle_power_management, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ if (enabled)
+ power_mode = WILC_FW_MIN_FAST_PS;
+ else
+ power_mode = WILC_FW_NO_POWERSAVE;
- msg->body.pwr_mgmt_info.enabled = enabled;
- msg->body.pwr_mgmt_info.timeout = timeout;
+ wid.id = WID_POWER_MANAGEMENT;
+ wid.val = &power_mode;
+ wid.size = sizeof(char);
+ result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (result)
+ netdev_err(vif->ndev, "Failed to send power management\n");
- result = wilc_enqueue_work(msg);
- if (result) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
return result;
}
@@ -3887,19 +2589,15 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, u32 count,
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
{
int ret;
- struct host_if_msg *msg;
-
- msg = wilc_alloc_work(vif, handle_set_tx_pwr, false);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ struct wid wid;
- msg->body.tx_power.tx_pwr = tx_power;
+ wid.id = WID_TX_POWER;
+ wid.type = WID_CHAR;
+ wid.val = &tx_power;
+ wid.size = sizeof(char);
- ret = wilc_enqueue_work(msg);
- if (ret) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- kfree(msg);
- }
+ ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
return ret;
}
@@ -3907,21 +2605,15 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
{
int ret;
- struct host_if_msg *msg;
+ struct wid wid;
- msg = wilc_alloc_work(vif, handle_get_tx_pwr, true);
- if (IS_ERR(msg))
- return PTR_ERR(msg);
+ wid.id = WID_TX_POWER;
+ wid.type = WID_CHAR;
+ wid.val = tx_power;
+ wid.size = sizeof(char);
- ret = wilc_enqueue_work(msg);
- if (ret) {
- netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
- } else {
- wait_for_completion(&msg->work_comp);
- *tx_power = msg->body.tx_power.tx_pwr;
- }
+ ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
- /* free 'msg' after copying data */
- kfree(msg);
return ret;
}
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 33fb7318734b..9b396a79b144 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -7,54 +7,84 @@
#ifndef HOST_INT_H
#define HOST_INT_H
#include <linux/ieee80211.h>
-#include "coreconfigurator.h"
-
-#define IDLE_MODE 0x00
-#define AP_MODE 0x01
-#define STATION_MODE 0x02
-#define GO_MODE 0x03
-#define CLIENT_MODE 0x04
-#define ACTION 0xD0
-#define PROBE_REQ 0x40
-#define PROBE_RESP 0x50
-
-#define ACTION_FRM_IDX 0
-#define PROBE_REQ_IDX 1
-#define MAX_NUM_STA 9
-#define ACTIVE_SCAN_TIME 10
-#define PASSIVE_SCAN_TIME 1200
-#define MIN_SCAN_TIME 10
-#define MAX_SCAN_TIME 1200
-#define DEFAULT_SCAN 0
-#define USER_SCAN BIT(0)
-#define OBSS_PERIODIC_SCAN BIT(1)
-#define OBSS_ONETIME_SCAN BIT(2)
-#define GTK_RX_KEY_BUFF_LEN 24
-#define ADDKEY 0x1
-#define REMOVEKEY 0x2
-#define DEFAULTKEY 0x4
-#define ADDKEY_AP 0x8
+#include "wilc_wlan_if.h"
+
+enum {
+ WILC_IDLE_MODE = 0x0,
+ WILC_AP_MODE = 0x1,
+ WILC_STATION_MODE = 0x2,
+ WILC_GO_MODE = 0x3,
+ WILC_CLIENT_MODE = 0x4
+};
+
+#define WILC_MAX_NUM_STA 9
#define MAX_NUM_SCANNED_NETWORKS 100
#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130
-#define MAX_NUM_PROBED_SSID 10
-#define CHANNEL_SCAN_TIME 250
+#define WILC_MAX_NUM_PROBED_SSID 10
#define TX_MIC_KEY_LEN 8
#define RX_MIC_KEY_LEN 8
-#define PTK_KEY_LEN 16
-
-#define TX_MIC_KEY_MSG_LEN 26
-#define RX_MIC_KEY_MSG_LEN 48
-#define PTK_KEY_MSG_LEN 39
-#define PMKSA_KEY_LEN 22
-#define ETH_ALEN 6
-#define PMKID_LEN 16
#define WILC_MAX_NUM_PMKIDS 16
#define WILC_ADD_STA_LENGTH 40
-#define NUM_CONCURRENT_IFC 2
-#define DRV_HANDLER_SIZE 5
-#define DRV_HANDLER_MASK 0x000000FF
+#define WILC_NUM_CONCURRENT_IFC 2
+
+#define NUM_RSSI 5
+
+enum {
+ WILC_SET_CFG = 0,
+ WILC_GET_CFG
+};
+
+#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;
+ u8 ssid[MAX_SSID_LEN];
+ u8 ssid_len;
+ u8 bssid[6];
+ 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;
+};
+
+struct connect_info {
+ u8 bssid[6];
+ u8 *req_ies;
+ size_t req_ies_len;
+ u8 *resp_ies;
+ u16 resp_ies_len;
+ u16 status;
+};
+
+struct disconnect_info {
+ u16 reason;
+ u8 *ie;
+ size_t ie_len;
+};
+
+struct assoc_resp {
+ __le16 capab_info;
+ __le16 status_code;
+ __le16 aid;
+} __packed;
struct rf_info {
u8 link_speed;
@@ -74,77 +104,29 @@ enum host_if_state {
HOST_IF_FORCE_32BIT = 0xFFFFFFFF
};
-struct host_if_pmkid {
+struct wilc_pmkid {
u8 bssid[ETH_ALEN];
- u8 pmkid[PMKID_LEN];
-};
+ u8 pmkid[WLAN_PMKID_LEN];
+} __packed;
-struct host_if_pmkid_attr {
+struct wilc_pmkid_attr {
u8 numpmkid;
- struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
-};
-
-enum current_tx_rate {
- AUTORATE = 0,
- MBPS_1 = 1,
- MBPS_2 = 2,
- MBPS_5_5 = 5,
- MBPS_11 = 11,
- MBPS_6 = 6,
- MBPS_9 = 9,
- MBPS_12 = 12,
- MBPS_18 = 18,
- MBPS_24 = 24,
- MBPS_36 = 36,
- MBPS_48 = 48,
- MBPS_54 = 54
-};
+ struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
+} __packed;
struct cfg_param_attr {
u32 flag;
- u8 ht_enable;
- u8 bss_type;
- u8 auth_type;
- u16 auth_timeout;
- u8 power_mgmt_mode;
u16 short_retry_limit;
u16 long_retry_limit;
u16 frag_threshold;
u16 rts_threshold;
- u16 preamble_type;
- u8 short_slot_allowed;
- u8 txop_prot_disabled;
- u16 beacon_interval;
- u16 dtim_period;
- enum site_survey site_survey_enabled;
- u16 site_survey_scan_time;
- u8 scan_source;
- u16 active_scan_time;
- u16 passive_scan_time;
- enum current_tx_rate curr_tx_rate;
-
};
enum cfg_param {
- RETRY_SHORT = BIT(0),
- RETRY_LONG = BIT(1),
- FRAG_THRESHOLD = BIT(2),
- RTS_THRESHOLD = BIT(3),
- BSS_TYPE = BIT(4),
- AUTH_TYPE = BIT(5),
- AUTHEN_TIMEOUT = BIT(6),
- POWER_MANAGEMENT = BIT(7),
- PREAMBLE = BIT(8),
- SHORT_SLOT_ALLOWED = BIT(9),
- TXOP_PROT_DISABLE = BIT(10),
- BEACON_INTERVAL = BIT(11),
- DTIM_PERIOD = BIT(12),
- SITE_SURVEY = BIT(13),
- SITE_SURVEY_SCAN_TIME = BIT(14),
- ACTIVE_SCANTIME = BIT(15),
- PASSIVE_SCANTIME = BIT(16),
- CURRENT_TX_RATE = BIT(17),
- HT_ENABLE = BIT(18),
+ WILC_CFG_PARAM_RETRY_SHORT = BIT(0),
+ WILC_CFG_PARAM_RETRY_LONG = BIT(1),
+ WILC_CFG_PARAM_FRAG_THRESHOLD = BIT(2),
+ WILC_CFG_PARAM_RTS_THRESHOLD = BIT(3)
};
struct found_net_info {
@@ -165,13 +147,6 @@ enum conn_event {
CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF
};
-enum KEY_TYPE {
- WEP,
- WPA_RX_GTK,
- WPA_PTK,
- PMKSA,
-};
-
typedef void (*wilc_scan_result)(enum scan_event, struct network_info *,
void *, void *);
@@ -216,28 +191,9 @@ struct user_conn_req {
size_t ies_len;
wilc_connect_result conn_result;
bool ht_capable;
+ u8 ch;
void *arg;
-};
-
-struct drv_handler {
- u32 handler;
- u8 mode;
- u8 name;
-};
-
-struct op_mode {
- u32 mode;
-};
-
-struct get_mac_addr {
- u8 *mac_addr;
-};
-
-struct ba_session_info {
- u8 bssid[ETH_ALEN];
- u8 tid;
- u16 buf_size;
- u16 time_out;
+ void *param;
};
struct remain_ch {
@@ -249,12 +205,6 @@ struct remain_ch {
u32 id;
};
-struct reg_frame {
- bool reg;
- u16 frame_type;
- u8 reg_id;
-};
-
struct wilc;
struct host_if_drv {
struct user_scan_req usr_scan_req;
@@ -267,9 +217,6 @@ struct host_if_drv {
enum host_if_state hif_state;
u8 assoc_bssid[ETH_ALEN];
- struct cfg_param_attr cfg_values;
- /*lock to protect concurrent setting of cfg params*/
- struct mutex cfg_values_lock;
struct timer_list scan_timer;
struct wilc_vif *scan_timer_vif;
@@ -282,7 +229,7 @@ struct host_if_drv {
bool ifc_up;
int driver_handler_id;
- u8 assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
+ u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE];
};
struct add_sta_param {
@@ -312,15 +259,14 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
u8 index, u32 key_rsc_len, const u8 *key_rsc,
const u8 *rx_mic, const u8 *tx_mic, u8 mode,
u8 cipher_mode);
-int wilc_set_pmkid_info(struct wilc_vif *vif,
- struct host_if_pmkid_attr *pmkid);
+int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid);
int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
size_t ssid_len, const u8 *ies, size_t ies_len,
wilc_connect_result connect_result, void *user_arg,
u8 security, enum authtype auth_type,
u8 channel, void *join_params);
-int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
+int wilc_disconnect(struct wilc_vif *vif);
int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
@@ -332,13 +278,14 @@ int wilc_hif_set_cfg(struct wilc_vif *vif,
int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
int wilc_deinit(struct wilc_vif *vif);
int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
- u32 head_len, u8 *head, u32 tail_len, u8 *tail);
+ struct cfg80211_beacon_data *params);
int wilc_del_beacon(struct wilc_vif *vif);
-int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
+int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
+ struct station_parameters *params);
int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
-int wilc_edit_station(struct wilc_vif *vif,
- struct add_sta_param *sta_param);
+int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
+ struct station_parameters *params);
int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, u32 count,
u8 *mc_list);
@@ -350,13 +297,14 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
- u8 ifc_id, bool is_sync);
+ u8 ifc_id);
int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
-int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats,
- bool is_sync);
+int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
int wilc_get_vif_idx(struct wilc_vif *vif);
int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
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);
#endif
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 76c901235e93..721689048648 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -46,7 +46,8 @@ static int dev_state_ev_handler(struct notifier_block *this,
switch (event) {
case NETDEV_UP:
- if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
+ if (vif->iftype == WILC_STATION_MODE ||
+ vif->iftype == WILC_CLIENT_MODE) {
hif_drv->ifc_up = 1;
vif->obtaining_ip = false;
del_timer(&vif->during_ip_timer);
@@ -65,7 +66,8 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;
case NETDEV_DOWN:
- if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
+ if (vif->iftype == WILC_STATION_MODE ||
+ vif->iftype == WILC_CLIENT_MODE) {
hif_drv->ifc_up = 0;
vif->obtaining_ip = false;
}
@@ -162,7 +164,7 @@ void wilc_mac_indicate(struct wilc *wilc)
s8 status;
wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1);
- if (wilc->mac_status == MAC_STATUS_INIT) {
+ if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
wilc->mac_status = status;
complete(&wilc->sync_event);
} else {
@@ -179,11 +181,11 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
bssid1 = mac_header + 4;
for (i = 0; i < wilc->vif_num; i++) {
- if (wilc->vif[i]->mode == STATION_MODE)
+ if (wilc->vif[i]->mode == WILC_STATION_MODE)
if (ether_addr_equal_unaligned(bssid,
wilc->vif[i]->bssid))
return wilc->vif[i]->ndev;
- if (wilc->vif[i]->mode == AP_MODE)
+ if (wilc->vif[i]->mode == WILC_AP_MODE)
if (ether_addr_equal_unaligned(bssid1,
wilc->vif[i]->bssid))
return wilc->vif[i]->ndev;
@@ -203,11 +205,10 @@ void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
{
u8 i = 0;
- u8 null_bssid[6] = {0};
u8 ret_val = 0;
for (i = 0; i < wilc->vif_num; i++)
- if (memcmp(wilc->vif[i]->bssid, null_bssid, 6))
+ if (!is_zero_ether_addr(wilc->vif[i]->bssid))
ret_val++;
return ret_val;
@@ -240,7 +241,7 @@ static int linux_wlan_txq_task(void *vp)
if (netif_queue_stopped(wl->vif[1]->ndev))
netif_wake_queue(wl->vif[1]->ndev);
}
- } while (ret == WILC_TX_ERR_NO_BUF && !wl->close);
+ } while (ret == -ENOBUFS && !wl->close);
}
return 0;
}
@@ -338,15 +339,15 @@ static int linux_wlan_init_test_config(struct net_device *dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = INFRASTRUCTURE;
+ c_val[0] = WILC_FW_BSS_TYPE_INFRA;
if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = AUTORATE;
+ c_val[0] = WILC_FW_TX_RATE_AUTO;
if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = G_MIXED_11B_2_MODE;
+ c_val[0] = WILC_FW_OPER_MODE_G_MIXED_11B_2;
if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
0))
goto fail;
@@ -355,19 +356,19 @@ static int linux_wlan_init_test_config(struct net_device *dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto fail;
- c_val[0] = G_SHORT_PREAMBLE;
+ c_val[0] = WILC_FW_PREAMBLE_SHORT;
if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = AUTO_PROT;
+ c_val[0] = WILC_FW_11N_PROT_AUTO;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto fail;
- c_val[0] = ACTIVE_SCAN;
+ c_val[0] = WILC_FW_ACTIVE_SCAN;
if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = SITE_SURVEY_OFF;
+ c_val[0] = WILC_FW_SITE_SURVEY_OFF;
if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto fail;
@@ -387,15 +388,15 @@ static int linux_wlan_init_test_config(struct net_device *dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = NO_POWERSAVE;
+ c_val[0] = WILC_FW_NO_POWERSAVE;
if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto fail;
- c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
+ c_val[0] = WILC_FW_SEC_NO;
if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = OPEN_SYSTEM;
+ c_val[0] = WILC_FW_AUTH_OPEN_SYSTEM;
if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
goto fail;
@@ -429,7 +430,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
goto fail;
- c_val[0] = NORMAL_ACK;
+ c_val[0] = WILC_FW_ACK_POLICY_NORMAL;
if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
goto fail;
@@ -452,7 +453,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
goto fail;
- c_val[0] = REKEY_DISABLE;
+ c_val[0] = WILC_FW_REKEY_POLICY_DISABLE;
if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
goto fail;
@@ -470,7 +471,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
0))
goto fail;
- c_val[0] = G_SELF_CTS_PROT;
+ c_val[0] = WILC_FW_ERP_PROT_SELF_CTS;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
goto fail;
@@ -478,7 +479,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
goto fail;
- c_val[0] = HT_MIXED_MODE;
+ c_val[0] = WILC_FW_11N_OP_MODE_HT_MIXED;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, c_val, 1, 0,
0))
goto fail;
@@ -488,12 +489,12 @@ static int linux_wlan_init_test_config(struct net_device *dev,
0))
goto fail;
- c_val[0] = DETECT_PROTECT_REPORT;
+ c_val[0] = WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1,
0, 0))
goto fail;
- c_val[0] = RTS_CTS_NONHT_PROT;
+ c_val[0] = WILC_FW_HT_PROT_RTS_CTS_NONHT;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
goto fail;
@@ -502,7 +503,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
0))
goto fail;
- c_val[0] = MIMO_MODE;
+ c_val[0] = WILC_FW_SMPS_MODE_MIMO;
if (!wilc_wlan_cfg_set(vif, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
goto fail;
@@ -529,6 +530,7 @@ static void wlan_deinit_locks(struct net_device *dev)
mutex_destroy(&wilc->hif_cs);
mutex_destroy(&wilc->rxq_cs);
+ mutex_destroy(&wilc->cfg_cmd_lock);
mutex_destroy(&wilc->txq_add_to_head_cs);
}
@@ -590,6 +592,7 @@ static void wlan_init_locks(struct net_device *dev)
mutex_init(&wl->hif_cs);
mutex_init(&wl->rxq_cs);
+ mutex_init(&wl->cfg_cmd_lock);
spin_lock_init(&wl->txq_spinlock);
mutex_init(&wl->txq_add_to_head_cs);
@@ -624,7 +627,7 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
struct wilc *wl = vif->wilc;
if (!wl->initialized) {
- wl->mac_status = MAC_STATUS_INIT;
+ wl->mac_status = WILC_MAC_STATUS_INIT;
wl->close = 0;
wlan_init_locks(dev);
@@ -751,8 +754,7 @@ static int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
- vif->iftype, vif->ifc_id,
- false);
+ vif->iftype, vif->ifc_id);
wilc_set_operation_mode(vif, vif->iftype);
break;
}
@@ -894,31 +896,11 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
static int wilc_mac_close(struct net_device *ndev)
{
- struct wilc_priv *priv;
struct wilc_vif *vif = netdev_priv(ndev);
- struct host_if_drv *hif_drv;
- struct wilc *wl;
-
- if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr ||
- !vif->ndev->ieee80211_ptr->wiphy)
- return 0;
-
- priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
- wl = vif->wilc;
-
- if (!priv)
- return 0;
-
- hif_drv = (struct host_if_drv *)priv->hif_drv;
+ struct wilc *wl = vif->wilc;
netdev_dbg(ndev, "Mac close\n");
- if (!wl)
- return 0;
-
- if (!hif_drv)
- return 0;
-
if (wl->open_ifcs > 0)
wl->open_ifcs--;
else
@@ -1021,12 +1003,12 @@ void wilc_netdev_cleanup(struct wilc *wilc)
}
if (wilc->vif[0]->ndev || wilc->vif[1]->ndev) {
- for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+ for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++)
if (wilc->vif[i]->ndev)
if (wilc->vif[i]->mac_opened)
wilc_mac_close(wilc->vif[i]->ndev);
- for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
+ for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++) {
unregister_netdev(wilc->vif[i]->ndev);
wilc_free_wiphy(wilc->vif[i]->ndev);
free_netdev(wilc->vif[i]->ndev);
@@ -1070,7 +1052,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
wl->io_type = io_type;
wl->hif_func = ops;
wl->enable_ps = true;
- wl->chip_ps_state = CHIP_WAKEDUP;
+ wl->chip_ps_state = WILC_CHIP_WAKEDUP;
INIT_LIST_HEAD(&wl->txq_head.list);
INIT_LIST_HEAD(&wl->rxq_head.list);
@@ -1082,7 +1064,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
register_inetaddr_notifier(&g_dev_notifier);
- for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
+ for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++) {
struct wireless_dev *wdev;
ndev = alloc_etherdev(sizeof(struct wilc_vif));
@@ -1130,7 +1112,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
if (ret)
goto free_ndev;
- vif->iftype = STATION_MODE;
+ vif->iftype = WILC_STATION_MODE;
vif->mac_opened = 0;
}
@@ -1139,7 +1121,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
free_ndev:
for (; i >= 0; i--) {
if (wl->vif[i]) {
- if (wl->vif[i]->iftype == STATION_MODE)
+ if (wl->vif[i]->iftype == WILC_STATION_MODE)
unregister_netdev(wl->vif[i]->ndev);
if (wl->vif[i]->ndev) {
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index ca351c950344..e2f739fef21c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -30,6 +30,25 @@ struct wilc_sdio {
int has_thrpt_enh3;
};
+struct sdio_cmd52 {
+ u32 read_write: 1;
+ u32 function: 3;
+ u32 raw: 1;
+ u32 address: 17;
+ u32 data: 8;
+};
+
+struct sdio_cmd53 {
+ u32 read_write: 1;
+ u32 function: 3;
+ u32 block_mode: 1;
+ u32 increment: 1;
+ u32 address: 17;
+ u32 count: 9;
+ u8 *buffer;
+ u32 block_size;
+};
+
static const struct wilc_hif_func wilc_hif_sdio;
static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
@@ -125,7 +144,8 @@ static int linux_sdio_probe(struct sdio_func *func,
}
dev_dbg(&func->dev, "Initializing netdev\n");
- ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, &wilc_hif_sdio);
+ ret = wilc_netdev_init(&wilc, &func->dev, WILC_HIF_SDIO,
+ &wilc_hif_sdio);
if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
kfree(sdio_priv);
@@ -841,6 +861,7 @@ static int sdio_read_int(struct wilc *wilc, u32 *int_status)
if (!sdio_priv->irq_gpio) {
int i;
+ cmd.read_write = 0;
cmd.function = 1;
cmd.address = 0x04;
cmd.data = 0;
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index cef127b249fb..153e120eff00 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -120,7 +120,7 @@ static int wilc_bus_probe(struct spi_device *spi)
dev_err(&spi->dev, "failed to get the irq gpio\n");
}
- ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, &wilc_hif_spi);
+ ret = wilc_netdev_init(&wilc, NULL, WILC_HIF_SPI, &wilc_hif_spi);
if (ret) {
kfree(spi_priv);
return ret;
@@ -927,7 +927,8 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
int ret;
u32 tmp;
u32 byte_cnt;
- int happened, j;
+ bool unexpected_irq;
+ int j;
u32 unknown_mask;
u32 irq_flags;
int k = IRG_FLAGS_OFFSET + 5;
@@ -947,8 +948,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
j = 0;
do {
- happened = 0;
-
wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
@@ -959,15 +958,15 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
unknown_mask = ~((1ul << spi_priv->nint) - 1);
- if ((tmp >> IRG_FLAGS_OFFSET) & unknown_mask) {
+ unexpected_irq = (tmp >> IRG_FLAGS_OFFSET) & unknown_mask;
+ if (unexpected_irq) {
dev_err(&spi->dev,
"Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
j, tmp, unknown_mask);
- happened = 1;
}
j++;
- } while (happened);
+ } while (unexpected_irq);
*int_status = tmp;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4fbbbbd5a64b..ac47dda510e0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -6,15 +6,6 @@
#include "wilc_wfi_cfgoperations.h"
-#define NO_ENCRYPT 0
-#define ENCRYPT_ENABLED BIT(0)
-#define WEP BIT(1)
-#define WEP_EXTENDED BIT(2)
-#define WPA BIT(3)
-#define WPA2 BIT(4)
-#define AES BIT(5)
-#define TKIP BIT(6)
-
#define FRAME_TYPE_ID 0
#define ACTION_CAT_ID 24
#define ACTION_SUBTYPE_ID 25
@@ -41,14 +32,6 @@
#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
#define SCAN_RESULT_EXPIRE (40 * HZ)
-static const u32 cipher_suites[] = {
- WLAN_CIPHER_SUITE_WEP40,
- WLAN_CIPHER_SUITE_WEP104,
- WLAN_CIPHER_SUITE_TKIP,
- WLAN_CIPHER_SUITE_CCMP,
- WLAN_CIPHER_SUITE_AES_CMAC,
-};
-
static const struct ieee80211_txrx_stypes
wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
[NL80211_IFTYPE_STATION] = {
@@ -82,53 +65,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
.flags = WIPHY_WOWLAN_ANY
};
-#define CHAN2G(_channel, _freq, _flags) { \
- .band = NL80211_BAND_2GHZ, \
- .center_freq = (_freq), \
- .hw_value = (_channel), \
- .flags = (_flags), \
- .max_antenna_gain = 0, \
- .max_power = 30, \
-}
-
-static struct ieee80211_channel ieee80211_2ghz_channels[] = {
- CHAN2G(1, 2412, 0),
- CHAN2G(2, 2417, 0),
- CHAN2G(3, 2422, 0),
- CHAN2G(4, 2427, 0),
- CHAN2G(5, 2432, 0),
- CHAN2G(6, 2437, 0),
- CHAN2G(7, 2442, 0),
- CHAN2G(8, 2447, 0),
- CHAN2G(9, 2452, 0),
- CHAN2G(10, 2457, 0),
- CHAN2G(11, 2462, 0),
- CHAN2G(12, 2467, 0),
- CHAN2G(13, 2472, 0),
- CHAN2G(14, 2484, 0),
-};
-
-#define RATETAB_ENT(_rate, _hw_value, _flags) { \
- .bitrate = (_rate), \
- .hw_value = (_hw_value), \
- .flags = (_flags), \
-}
-
-static struct ieee80211_rate ieee80211_bitrates[] = {
- RATETAB_ENT(10, 0, 0),
- RATETAB_ENT(20, 1, 0),
- RATETAB_ENT(55, 2, 0),
- RATETAB_ENT(110, 3, 0),
- RATETAB_ENT(60, 9, 0),
- RATETAB_ENT(90, 6, 0),
- RATETAB_ENT(120, 7, 0),
- RATETAB_ENT(180, 8, 0),
- RATETAB_ENT(240, 9, 0),
- RATETAB_ENT(360, 10, 0),
- RATETAB_ENT(480, 11, 0),
- RATETAB_ENT(540, 12, 0),
-};
-
struct p2p_mgmt_data {
int size;
u8 *buff;
@@ -139,13 +75,6 @@ static u8 curr_channel;
static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-static struct ieee80211_supported_band wilc_band_2ghz = {
- .channels = ieee80211_2ghz_channels,
- .n_channels = ARRAY_SIZE(ieee80211_2ghz_channels),
- .bitrates = ieee80211_bitrates,
- .n_bitrates = ARRAY_SIZE(ieee80211_bitrates),
-};
-
#define AGING_TIME (9 * 1000)
#define DURING_IP_TIME_OUT 15000
@@ -202,7 +131,7 @@ static void refresh_scan(struct wilc_priv *priv, bool direct_scan)
channel,
CFG80211_BSS_FTYPE_UNKNOWN,
network_info->bssid,
- network_info->tsf_hi,
+ network_info->tsf,
network_info->cap_info,
network_info->beacon_period,
(const u8 *)network_info->ies,
@@ -317,7 +246,7 @@ static void add_network_to_shadow(struct network_info *nw_info,
shadow_nw_info->beacon_period = nw_info->beacon_period;
shadow_nw_info->dtim_period = nw_info->dtim_period;
shadow_nw_info->ch = nw_info->ch;
- shadow_nw_info->tsf_hi = nw_info->tsf_hi;
+ shadow_nw_info->tsf = nw_info->tsf;
if (ap_found != -1)
kfree(shadow_nw_info->ies);
shadow_nw_info->ies = kmemdup(nw_info->ies, nw_info->ies_len,
@@ -381,7 +310,7 @@ static void cfg_scan_result(enum scan_event scan_event,
channel,
CFG80211_BSS_FTYPE_UNKNOWN,
network_info->bssid,
- network_info->tsf_hi,
+ network_info->tsf,
network_info->cap_info,
network_info->beacon_period,
(const u8 *)network_info->ies,
@@ -470,11 +399,11 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
connect_status = conn_info->status;
- if (mac_status == MAC_STATUS_DISCONNECTED &&
+ if (mac_status == WILC_MAC_STATUS_DISCONNECTED &&
conn_info->status == WLAN_STATUS_SUCCESS) {
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
- STATION_MODE);
+ WILC_STATION_MODE);
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -516,7 +445,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
priv->p2p.recv_random = 0x00;
priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss);
- wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
+ wilc_wlan_set_bssid(priv->dev, null_bssid, WILC_STATION_MODE);
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
@@ -618,18 +547,20 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
if (request->n_ssids >= 1) {
if (wilc_wfi_cfg_alloc_fill_ssid(request,
- &hidden_ntwk))
- return -ENOMEM;
+ &hidden_ntwk)) {
+ ret = -ENOMEM;
+ goto out;
+ }
- ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
- scan_ch_list,
+ ret = wilc_scan(vif, WILC_FW_USER_SCAN,
+ WILC_FW_ACTIVE_SCAN, scan_ch_list,
request->n_channels,
(const u8 *)request->ie,
request->ie_len, cfg_scan_result,
(void *)priv, &hidden_ntwk);
} else {
- ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
- scan_ch_list,
+ ret = wilc_scan(vif, WILC_FW_USER_SCAN,
+ WILC_FW_ACTIVE_SCAN, scan_ch_list,
request->n_channels,
(const u8 *)request->ie,
request->ie_len, cfg_scan_result,
@@ -639,8 +570,11 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
netdev_err(priv->dev, "Requested scanned channels over\n");
}
- if (ret != 0)
- ret = -EBUSY;
+out:
+ if (ret) {
+ priv->scan_req = NULL;
+ priv->cfg_scanning = false;
+ }
return ret;
}
@@ -655,8 +589,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
int ret;
u32 i;
u32 sel_bssi_idx = UINT_MAX;
- u8 security = NO_ENCRYPT;
- enum authtype auth_type = ANY;
+ u8 security = WILC_FW_SEC_NO;
+ enum authtype auth_type = WILC_FW_AUTH_ANY;
u32 cipher_group;
vif->connecting = true;
@@ -703,9 +637,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));
cipher_group = sme->crypto.cipher_group;
- if (cipher_group != NO_ENCRYPT) {
+ if (cipher_group != 0) {
if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
- security = ENCRYPT_ENABLED | WEP;
+ security = WILC_FW_SEC_WEP;
priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
@@ -715,7 +649,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
sme->key_idx);
} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
- security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
+ security = WILC_FW_SEC_WEP_EXTENDED;
priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
@@ -726,14 +660,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
- security = ENCRYPT_ENABLED | WPA2 | TKIP;
+ security = WILC_FW_SEC_WPA2_TKIP;
else
- security = ENCRYPT_ENABLED | WPA2 | AES;
+ security = WILC_FW_SEC_WPA2_AES;
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
- security = ENCRYPT_ENABLED | WPA | TKIP;
+ security = WILC_FW_SEC_WPA_TKIP;
else
- security = ENCRYPT_ENABLED | WPA | AES;
+ security = WILC_FW_SEC_WPA_AES;
} else {
ret = -ENOTSUPP;
netdev_err(dev, "%s: Unsupported cipher\n",
@@ -748,19 +682,19 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u32 ciphers_pairwise = sme->crypto.ciphers_pairwise[i];
if (ciphers_pairwise == WLAN_CIPHER_SUITE_TKIP)
- security = security | TKIP;
+ security |= WILC_FW_TKIP;
else
- security = security | AES;
+ security |= WILC_FW_AES;
}
}
switch (sme->auth_type) {
case NL80211_AUTHTYPE_OPEN_SYSTEM:
- auth_type = OPEN_SYSTEM;
+ auth_type = WILC_FW_AUTH_OPEN_SYSTEM;
break;
case NL80211_AUTHTYPE_SHARED_KEY:
- auth_type = SHARED_KEY;
+ auth_type = WILC_FW_AUTH_SHARED_KEY;
break;
default:
@@ -769,7 +703,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
if (sme->crypto.n_akm_suites) {
if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X)
- auth_type = IEEE8021;
+ auth_type = WILC_FW_AUTH_IEEE8021;
}
curr_channel = nw_info->ch;
@@ -777,7 +711,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
if (!wfi_drv->p2p_connect)
wlan_channel = nw_info->ch;
- wilc_wlan_set_bssid(dev, nw_info->bssid, STATION_MODE);
+ wilc_wlan_set_bssid(dev, nw_info->bssid, WILC_STATION_MODE);
ret = wilc_set_join_req(vif, nw_info->bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
@@ -790,7 +724,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
netdev_err(dev, "wilc_set_join_req(): Error\n");
ret = -ENOENT;
- wilc_wlan_set_bssid(dev, null_bssid, STATION_MODE);
+ if (!wfi_drv->p2p_connect)
+ wlan_channel = INVALID_CHANNEL;
+ wilc_wlan_set_bssid(dev, null_bssid, WILC_STATION_MODE);
goto out_error;
}
return 0;
@@ -824,14 +760,14 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
wfi_drv = (struct host_if_drv *)priv->hif_drv;
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
- wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
+ wilc_wlan_set_bssid(priv->dev, null_bssid, WILC_STATION_MODE);
priv->p2p.local_random = 0x01;
priv->p2p.recv_random = 0x00;
priv->p2p.is_wilc_ie = false;
wfi_drv->p2p_timeout = 0;
- ret = wilc_disconnect(vif, reason_code);
+ ret = wilc_disconnect(vif);
if (ret != 0) {
netdev_err(priv->dev, "Error in disconnecting\n");
ret = -EINVAL;
@@ -900,7 +836,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
struct wilc_priv *priv = wiphy_priv(wiphy);
const u8 *rx_mic = NULL;
const u8 *tx_mic = NULL;
- u8 mode = NO_ENCRYPT;
+ u8 mode = WILC_FW_SEC_NO;
u8 op_mode;
struct wilc_vif *vif = netdev_priv(netdev);
@@ -911,14 +847,14 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
- mode = ENCRYPT_ENABLED | WEP;
+ mode = WILC_FW_SEC_WEP;
else
- mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
+ mode = WILC_FW_SEC_WEP_EXTENDED;
ret = wilc_add_wep_key_bss_ap(vif, params->key,
params->key_len,
key_index, mode,
- OPEN_SYSTEM);
+ WILC_FW_AUTH_OPEN_SYSTEM);
break;
}
if (memcmp(params->key, priv->wep_key[key_index],
@@ -951,18 +887,18 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
if (!pairwise) {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
- mode = ENCRYPT_ENABLED | WPA | TKIP;
+ mode = WILC_FW_SEC_WPA_TKIP;
else
- mode = ENCRYPT_ENABLED | WPA2 | AES;
+ mode = WILC_FW_SEC_WPA2_AES;
priv->wilc_groupkey = mode;
key = priv->wilc_gtk[key_index];
} else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
- mode = ENCRYPT_ENABLED | WPA | TKIP;
+ mode = WILC_FW_SEC_WPA_TKIP;
else
- mode = priv->wilc_groupkey | AES;
+ mode = priv->wilc_groupkey | WILC_FW_AES;
key = priv->wilc_ptk[key_index];
}
@@ -970,7 +906,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
if (ret)
return -ENOMEM;
- op_mode = AP_MODE;
+ op_mode = WILC_AP_MODE;
} else {
if (params->key_len > 16 &&
params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -979,7 +915,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
keylen = params->key_len - 16;
}
- op_mode = STATION_MODE;
+ op_mode = WILC_STATION_MODE;
}
if (!pairwise)
@@ -1088,7 +1024,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
u32 associatedsta = ~0;
u32 inactive_time = 0;
- if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
+ if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
for (i = 0; i < NUM_STA_ASSOCIATED; i++) {
if (!(memcmp(mac,
priv->assoc_stainfo.sta_associated_bss[i],
@@ -1107,10 +1043,10 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
wilc_get_inactive_time(vif, mac, &inactive_time);
sinfo->inactive_time = 1000 * inactive_time;
- } else if (vif->iftype == STATION_MODE) {
+ } else if (vif->iftype == WILC_STATION_MODE) {
struct rf_info stats;
- wilc_get_statistics(vif, &stats, true);
+ wilc_get_statistics(vif, &stats);
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL) |
BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
@@ -1149,21 +1085,45 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
cfg_param_val.flag = 0;
if (changed & WIPHY_PARAM_RETRY_SHORT) {
- cfg_param_val.flag |= RETRY_SHORT;
+ netdev_dbg(vif->ndev,
+ "Setting WIPHY_PARAM_RETRY_SHORT %d\n",
+ wiphy->retry_short);
+ cfg_param_val.flag |= WILC_CFG_PARAM_RETRY_SHORT;
cfg_param_val.short_retry_limit = wiphy->retry_short;
}
if (changed & WIPHY_PARAM_RETRY_LONG) {
- cfg_param_val.flag |= RETRY_LONG;
+ netdev_dbg(vif->ndev,
+ "Setting WIPHY_PARAM_RETRY_LONG %d\n",
+ wiphy->retry_long);
+ cfg_param_val.flag |= WILC_CFG_PARAM_RETRY_LONG;
cfg_param_val.long_retry_limit = wiphy->retry_long;
}
if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
- cfg_param_val.flag |= FRAG_THRESHOLD;
- cfg_param_val.frag_threshold = wiphy->frag_threshold;
+ if (wiphy->frag_threshold > 255 &&
+ wiphy->frag_threshold < 7937) {
+ netdev_dbg(vif->ndev,
+ "Setting WIPHY_PARAM_FRAG_THRESHOLD %d\n",
+ wiphy->frag_threshold);
+ cfg_param_val.flag |= WILC_CFG_PARAM_FRAG_THRESHOLD;
+ cfg_param_val.frag_threshold = wiphy->frag_threshold;
+ } else {
+ netdev_err(vif->ndev,
+ "Fragmentation threshold out of range\n");
+ return -EINVAL;
+ }
}
if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
- cfg_param_val.flag |= RTS_THRESHOLD;
- cfg_param_val.rts_threshold = wiphy->rts_threshold;
+ if (wiphy->rts_threshold > 255) {
+ netdev_dbg(vif->ndev,
+ "Setting WIPHY_PARAM_RTS_THRESHOLD %d\n",
+ wiphy->rts_threshold);
+ cfg_param_val.flag |= WILC_CFG_PARAM_RTS_THRESHOLD;
+ cfg_param_val.rts_threshold = wiphy->rts_threshold;
+ } else {
+ netdev_err(vif->ndev, "RTS threshold out of range\n");
+ return -EINVAL;
+ }
}
ret = wilc_hif_set_cfg(vif, &cfg_param_val);
@@ -1193,7 +1153,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid,
ETH_ALEN);
memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid,
- PMKID_LEN);
+ WLAN_PMKID_LEN);
if (!(flag == PMKID_FOUND))
priv->pmkid_list.numpmkid++;
} else {
@@ -1218,7 +1178,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,
ETH_ALEN)) {
memset(&priv->pmkid_list.pmkidlist[i], 0,
- sizeof(struct host_if_pmkid));
+ sizeof(struct wilc_pmkid));
break;
}
}
@@ -1230,7 +1190,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
ETH_ALEN);
memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
priv->pmkid_list.pmkidlist[i + 1].pmkid,
- PMKID_LEN);
+ WLAN_PMKID_LEN);
}
priv->pmkid_list.numpmkid--;
} else {
@@ -1244,7 +1204,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
{
struct wilc_priv *priv = wiphy_priv(wiphy);
- memset(&priv->pmkid_list, 0, sizeof(struct host_if_pmkid_attr));
+ memset(&priv->pmkid_list, 0, sizeof(struct wilc_pmkid_attr));
return 0;
}
@@ -1676,12 +1636,12 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
return;
switch (frame_type) {
- case PROBE_REQ:
+ case IEEE80211_STYPE_PROBE_REQ:
vif->frame_reg[0].type = frame_type;
vif->frame_reg[0].reg = reg;
break;
- case ACTION:
+ case IEEE80211_STYPE_ACTION:
vif->frame_reg[1].type = frame_type;
vif->frame_reg[1].reg = reg;
break;
@@ -1706,13 +1666,16 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
{
struct wilc_priv *priv = wiphy_priv(wiphy);
struct wilc_vif *vif = netdev_priv(priv->dev);
+ int ret;
if (idx != 0)
return -ENOENT;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
- wilc_get_rssi(vif, &sinfo->signal);
+ ret = wilc_get_rssi(vif, &sinfo->signal);
+ if (ret)
+ return ret;
memcpy(mac, priv->associated_bss, ETH_ALEN);
return 0;
@@ -1753,11 +1716,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
vif->monitor_flag = 0;
- vif->iftype = STATION_MODE;
- wilc_set_operation_mode(vif, STATION_MODE);
+ vif->iftype = WILC_STATION_MODE;
+ wilc_set_operation_mode(vif, WILC_STATION_MODE);
memset(priv->assoc_stainfo.sta_associated_bss, 0,
- MAX_NUM_STA * ETH_ALEN);
+ WILC_MAX_NUM_STA * ETH_ALEN);
wl->enable_ps = true;
wilc_set_power_mgmt(vif, 1, 0);
@@ -1768,8 +1731,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
vif->monitor_flag = 0;
- vif->iftype = CLIENT_MODE;
- wilc_set_operation_mode(vif, STATION_MODE);
+ vif->iftype = WILC_CLIENT_MODE;
+ wilc_set_operation_mode(vif, WILC_STATION_MODE);
wl->enable_ps = false;
wilc_set_power_mgmt(vif, 0, 0);
@@ -1779,12 +1742,12 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wl->enable_ps = false;
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
- vif->iftype = AP_MODE;
+ vif->iftype = WILC_AP_MODE;
if (wl->initialized) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
- 0, vif->ifc_id, false);
- wilc_set_operation_mode(vif, AP_MODE);
+ 0, vif->ifc_id);
+ wilc_set_operation_mode(vif, WILC_AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
}
break;
@@ -1793,10 +1756,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
vif->obtaining_ip = true;
mod_timer(&vif->during_ip_timer,
jiffies + msecs_to_jiffies(DURING_IP_TIME_OUT));
- wilc_set_operation_mode(vif, AP_MODE);
+ wilc_set_operation_mode(vif, WILC_AP_MODE);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
- vif->iftype = GO_MODE;
+ vif->iftype = WILC_GO_MODE;
wl->enable_ps = false;
wilc_set_power_mgmt(vif, 0, 0);
@@ -1815,21 +1778,17 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
{
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wl = vif->wilc;
- struct cfg80211_beacon_data *beacon = &settings->beacon;
int ret;
ret = set_channel(wiphy, &settings->chandef);
-
if (ret != 0)
netdev_err(dev, "Error in setting channel\n");
- wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
+ wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, WILC_AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
return wilc_add_beacon(vif, settings->beacon_interval,
- settings->dtim_period, beacon->head_len,
- (u8 *)beacon->head, beacon->tail_len,
- (u8 *)beacon->tail);
+ settings->dtim_period, &settings->beacon);
}
static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
@@ -1838,9 +1797,7 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
struct wilc_priv *priv = wiphy_priv(wiphy);
struct wilc_vif *vif = netdev_priv(priv->dev);
- return wilc_add_beacon(vif, 0, 0, beacon->head_len,
- (u8 *)beacon->head, beacon->tail_len,
- (u8 *)beacon->tail);
+ return wilc_add_beacon(vif, 0, 0, beacon);
}
static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
@@ -1850,7 +1807,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
struct wilc_vif *vif = netdev_priv(priv->dev);
u8 null_bssid[ETH_ALEN] = {0};
- wilc_wlan_set_bssid(dev, null_bssid, AP_MODE);
+ wilc_wlan_set_bssid(dev, null_bssid, WILC_AP_MODE);
ret = wilc_del_beacon(vif);
@@ -1865,28 +1822,13 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
{
int ret = 0;
struct wilc_priv *priv = wiphy_priv(wiphy);
- struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif = netdev_priv(dev);
- if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
- memcpy(sta_params.bssid, mac, ETH_ALEN);
+ if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
memcpy(priv->assoc_stainfo.sta_associated_bss[params->aid], mac,
ETH_ALEN);
- sta_params.aid = params->aid;
- sta_params.rates_len = params->supported_rates_len;
- sta_params.rates = params->supported_rates;
-
- if (!params->ht_capa) {
- sta_params.ht_supported = false;
- } else {
- sta_params.ht_supported = true;
- sta_params.ht_capa = *params->ht_capa;
- }
-
- sta_params.flags_mask = params->sta_flags_mask;
- sta_params.flags_set = params->sta_flags_set;
- ret = wilc_add_station(vif, &sta_params);
+ ret = wilc_add_station(vif, mac, params);
if (ret)
netdev_err(dev, "Host add station fail\n");
}
@@ -1903,7 +1845,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
struct wilc_vif *vif = netdev_priv(dev);
struct sta_info *info;
- if (!(vif->iftype == AP_MODE || vif->iftype == GO_MODE))
+ if (!(vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE))
return ret;
info = &priv->assoc_stainfo;
@@ -1921,26 +1863,10 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
const u8 *mac, struct station_parameters *params)
{
int ret = 0;
- struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif = netdev_priv(dev);
- if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
- memcpy(sta_params.bssid, mac, ETH_ALEN);
- sta_params.aid = params->aid;
- sta_params.rates_len = params->supported_rates_len;
- sta_params.rates = params->supported_rates;
-
- if (!params->ht_capa) {
- sta_params.ht_supported = false;
- } else {
- sta_params.ht_supported = true;
- sta_params.ht_capa = *params->ht_capa;
- }
-
- sta_params.flags_mask = params->sta_flags_mask;
- sta_params.flags_set = params->sta_flags_set;
-
- ret = wilc_edit_station(vif, &sta_params);
+ if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
+ ret = wilc_edit_station(vif, mac, params);
if (ret)
netdev_err(dev, "Host edit station fail\n");
}
@@ -2095,14 +2021,6 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
if (!wdev->wiphy)
goto free_mem;
- wilc_band_2ghz.ht_cap.ht_supported = 1;
- wilc_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
- wilc_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
- wilc_band_2ghz.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K;
- wilc_band_2ghz.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE;
-
- wdev->wiphy->bands[NL80211_BAND_2GHZ] = &wilc_band_2ghz;
-
return wdev;
free_mem:
@@ -2126,15 +2044,33 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
priv = wdev_priv(wdev);
priv->wdev = wdev;
- wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID;
+
+ memcpy(priv->bitrates, wilc_bitrates, sizeof(wilc_bitrates));
+ memcpy(priv->channels, wilc_2ghz_channels, sizeof(wilc_2ghz_channels));
+ priv->band.bitrates = priv->bitrates;
+ priv->band.n_bitrates = ARRAY_SIZE(priv->bitrates);
+ priv->band.channels = priv->channels;
+ priv->band.n_channels = ARRAY_SIZE(wilc_2ghz_channels);
+
+ priv->band.ht_cap.ht_supported = 1;
+ priv->band.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
+ priv->band.ht_cap.mcs.rx_mask[0] = 0xff;
+ priv->band.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K;
+ priv->band.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE;
+
+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
+
+ wdev->wiphy->max_scan_ssids = WILC_MAX_NUM_PROBED_SSID;
#ifdef CONFIG_PM
wdev->wiphy->wowlan = &wowlan_support;
#endif
wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS;
wdev->wiphy->max_scan_ie_len = 1000;
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
- wdev->wiphy->cipher_suites = cipher_suites;
- wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
+ memcpy(priv->cipher_suites, wilc_cipher_suites,
+ sizeof(wilc_cipher_suites));
+ wdev->wiphy->cipher_suites = priv->cipher_suites;
+ wdev->wiphy->n_cipher_suites = ARRAY_SIZE(wilc_cipher_suites);
wdev->wiphy->mgmt_stypes = wilc_wfi_cfg80211_mgmt_types;
wdev->wiphy->max_remain_on_channel_duration = 500;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 4f05a16c778e..c6685c0c238b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -22,7 +22,6 @@
#define FLOW_CONTROL_UPPER_THRESHOLD 256
#define WILC_MAX_NUM_PMKIDS 16
-#define PMKID_LEN 16
#define PMKID_FOUND 1
#define NUM_STA_ASSOCIATED 8
@@ -58,7 +57,7 @@ struct wilc_wfi_wep_key {
};
struct sta_info {
- u8 sta_associated_bss[MAX_NUM_STA][ETH_ALEN];
+ u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN];
};
/*Parameters needed for host interface for remaining on channel*/
@@ -75,6 +74,61 @@ struct wilc_p2p_var {
bool is_wilc_ie;
};
+static const u32 wilc_cipher_suites[] = {
+ WLAN_CIPHER_SUITE_WEP40,
+ WLAN_CIPHER_SUITE_WEP104,
+ WLAN_CIPHER_SUITE_TKIP,
+ WLAN_CIPHER_SUITE_CCMP,
+ WLAN_CIPHER_SUITE_AES_CMAC
+};
+
+#define CHAN2G(_channel, _freq, _flags) { \
+ .band = NL80211_BAND_2GHZ, \
+ .center_freq = (_freq), \
+ .hw_value = (_channel), \
+ .flags = (_flags), \
+ .max_antenna_gain = 0, \
+ .max_power = 30, \
+}
+
+static const struct ieee80211_channel wilc_2ghz_channels[] = {
+ CHAN2G(1, 2412, 0),
+ CHAN2G(2, 2417, 0),
+ CHAN2G(3, 2422, 0),
+ CHAN2G(4, 2427, 0),
+ CHAN2G(5, 2432, 0),
+ CHAN2G(6, 2437, 0),
+ CHAN2G(7, 2442, 0),
+ CHAN2G(8, 2447, 0),
+ CHAN2G(9, 2452, 0),
+ CHAN2G(10, 2457, 0),
+ CHAN2G(11, 2462, 0),
+ CHAN2G(12, 2467, 0),
+ CHAN2G(13, 2472, 0),
+ CHAN2G(14, 2484, 0)
+};
+
+#define RATETAB_ENT(_rate, _hw_value, _flags) { \
+ .bitrate = (_rate), \
+ .hw_value = (_hw_value), \
+ .flags = (_flags), \
+}
+
+static struct ieee80211_rate wilc_bitrates[] = {
+ RATETAB_ENT(10, 0, 0),
+ RATETAB_ENT(20, 1, 0),
+ RATETAB_ENT(55, 2, 0),
+ RATETAB_ENT(110, 3, 0),
+ RATETAB_ENT(60, 9, 0),
+ RATETAB_ENT(90, 6, 0),
+ RATETAB_ENT(120, 7, 0),
+ RATETAB_ENT(180, 8, 0),
+ RATETAB_ENT(240, 9, 0),
+ RATETAB_ENT(360, 10, 0),
+ RATETAB_ENT(480, 11, 0),
+ RATETAB_ENT(540, 12, 0)
+};
+
struct wilc_priv {
struct wireless_dev *wdev;
struct cfg80211_scan_request *scan_req;
@@ -90,13 +144,13 @@ struct wilc_priv {
struct sk_buff *skb;
struct net_device *dev;
struct host_if_drv *hif_drv;
- struct host_if_pmkid_attr pmkid_list;
+ struct wilc_pmkid_attr pmkid_list;
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
u8 wep_key_len[4];
/* The real interface that the monitor is on */
struct net_device *real_ndev;
- struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
- struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
+ struct wilc_wfi_key *wilc_gtk[WILC_MAX_NUM_STA];
+ struct wilc_wfi_key *wilc_ptk[WILC_MAX_NUM_STA];
u8 wilc_groupkey;
/* mutexes */
struct mutex scan_req_lock;
@@ -105,6 +159,11 @@ struct wilc_priv {
struct network_info scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
int scanned_cnt;
struct wilc_p2p_var p2p;
+
+ struct ieee80211_channel channels[ARRAY_SIZE(wilc_2ghz_channels)];
+ struct ieee80211_rate bitrates[ARRAY_SIZE(wilc_bitrates)];
+ struct ieee80211_supported_band band;
+ u32 cipher_suites[ARRAY_SIZE(wilc_cipher_suites)];
};
struct frame_reg {
@@ -169,7 +228,7 @@ struct wilc {
int dev_irq_num;
int close;
u8 vif_num;
- struct wilc_vif *vif[NUM_CONCURRENT_IFC];
+ struct wilc_vif *vif[WILC_NUM_CONCURRENT_IFC];
u8 open_ifcs;
/*protect head of transmit queue*/
struct mutex txq_add_to_head_cs;
@@ -188,7 +247,8 @@ struct wilc {
struct task_struct *txq_thread;
int quit;
- int cfg_frame_in_use;
+ /* lock to protect issue of wid command to firmware */
+ struct mutex cfg_cmd_lock;
struct wilc_cfg_frame cfg_frame;
u32 cfg_frame_offset;
int cfg_seq_no;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a48c906b2443..3c5e9e030cad 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -17,13 +17,13 @@ static inline bool is_wilc1000(u32 id)
static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
{
mutex_lock(&wilc->hif_cs);
- if (acquire == ACQUIRE_AND_WAKEUP)
+ if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP)
chip_wakeup(wilc);
}
static inline void release_bus(struct wilc *wilc, enum bus_release release)
{
- if (release == RELEASE_ALLOW_SLEEP)
+ if (release == WILC_BUS_RELEASE_ALLOW_SLEEP)
chip_allow_sleep(wilc);
mutex_unlock(&wilc->hif_cs);
}
@@ -399,7 +399,7 @@ void chip_wakeup(struct wilc *wilc)
{
u32 reg, clk_status_reg;
- if ((wilc->io_type & 0x1) == HIF_SPI) {
+ if ((wilc->io_type & 0x1) == WILC_HIF_SPI) {
do {
wilc->hif_func->hif_read_reg(wilc, 1, &reg);
wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
@@ -410,7 +410,7 @@ void chip_wakeup(struct wilc *wilc)
wilc_get_chipid(wilc, true);
} while (wilc_get_chipid(wilc, true) == 0);
} while (wilc_get_chipid(wilc, true) == 0);
- } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
+ } else if ((wilc->io_type & 0x1) == WILC_HIF_SDIO) {
wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
usleep_range(200, 400);
wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
@@ -433,7 +433,7 @@ void chip_wakeup(struct wilc *wilc)
} while ((clk_status_reg & 0x1) == 0);
}
- if (wilc->chip_ps_state == CHIP_SLEEPING_MANUAL) {
+ if (wilc->chip_ps_state == WILC_CHIP_SLEEPING_MANUAL) {
if (wilc_get_chipid(wilc, false) < 0x1002b0) {
u32 val32;
@@ -446,37 +446,37 @@ void chip_wakeup(struct wilc *wilc)
wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
}
}
- wilc->chip_ps_state = CHIP_WAKEDUP;
+ wilc->chip_ps_state = WILC_CHIP_WAKEDUP;
}
EXPORT_SYMBOL_GPL(chip_wakeup);
void wilc_chip_sleep_manually(struct wilc *wilc)
{
- if (wilc->chip_ps_state != CHIP_WAKEDUP)
+ if (wilc->chip_ps_state != WILC_CHIP_WAKEDUP)
return;
- acquire_bus(wilc, ACQUIRE_ONLY);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
chip_allow_sleep(wilc);
wilc->hif_func->hif_write_reg(wilc, 0x10a8, 1);
- wilc->chip_ps_state = CHIP_SLEEPING_MANUAL;
- release_bus(wilc, RELEASE_ONLY);
+ wilc->chip_ps_state = WILC_CHIP_SLEEPING_MANUAL;
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
}
EXPORT_SYMBOL_GPL(wilc_chip_sleep_manually);
void host_wakeup_notify(struct wilc *wilc)
{
- acquire_bus(wilc, ACQUIRE_ONLY);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
wilc->hif_func->hif_write_reg(wilc, 0x10b0, 1);
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
}
EXPORT_SYMBOL_GPL(host_wakeup_notify);
void host_sleep_notify(struct wilc *wilc)
{
- acquire_bus(wilc, ACQUIRE_ONLY);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
wilc->hif_func->hif_write_reg(wilc, 0x10ac, 1);
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
}
EXPORT_SYMBOL_GPL(host_sleep_notify);
@@ -541,7 +541,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
goto out;
vmm_table[i] = 0x0;
- acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
counter = 0;
func = wilc->hif_func;
do {
@@ -584,7 +584,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
entries = ((reg >> 3) & 0x3f);
break;
}
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
} while (--timeout);
if (timeout <= 0) {
ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0);
@@ -611,11 +611,11 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
goto out_release_bus;
if (entries == 0) {
- ret = WILC_TX_ERR_NO_BUF;
+ ret = -ENOBUFS;
goto out_release_bus;
}
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
offset = 0;
i = 0;
@@ -667,7 +667,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
kfree(tqe);
} while (--entries);
- acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
ret = func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
if (!ret)
@@ -676,7 +676,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
ret = func->hif_block_tx_ext(wilc, 0, txb, offset);
out_release_bus:
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
out:
mutex_unlock(&wilc->txq_add_to_head_cs);
@@ -775,7 +775,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
wilc->hif_func->hif_clear_int_ext(wilc, PLL_INT_CLR);
- if (wilc->io_type == HIF_SDIO)
+ if (wilc->io_type == WILC_HIF_SDIO)
mdelay(WILC_PLL_TO_SDIO);
else
mdelay(WILC_PLL_TO_SPI);
@@ -835,7 +835,7 @@ void wilc_handle_isr(struct wilc *wilc)
{
u32 int_status;
- acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
wilc->hif_func->hif_read_int(wilc, &int_status);
if (int_status & PLL_INT_EXT)
@@ -850,7 +850,7 @@ void wilc_handle_isr(struct wilc *wilc)
if (!(int_status & (ALL_INT_EXT)))
wilc_unknown_isr_ext(wilc);
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
}
EXPORT_SYMBOL_GPL(wilc_handle_isr);
@@ -874,7 +874,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
memcpy(&size, &buffer[offset + 4], 4);
le32_to_cpus(&addr);
le32_to_cpus(&size);
- acquire_bus(wilc, ACQUIRE_ONLY);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
offset += 8;
while (((int)size) && (offset < buffer_size)) {
if (size <= blksz)
@@ -892,7 +892,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
offset += size2;
size -= size2;
}
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
if (!ret) {
ret = -EIO;
@@ -913,20 +913,20 @@ int wilc_wlan_start(struct wilc *wilc)
int ret;
u32 chipid;
- if (wilc->io_type == HIF_SDIO) {
+ if (wilc->io_type == WILC_HIF_SDIO) {
reg = 0;
reg |= BIT(3);
- } else if (wilc->io_type == HIF_SPI) {
+ } else if (wilc->io_type == WILC_HIF_SPI) {
reg = 1;
}
- acquire_bus(wilc, ACQUIRE_ONLY);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg);
if (!ret) {
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
return -EIO;
}
reg = 0;
- if (wilc->io_type == HIF_SDIO && wilc->dev_irq_num)
+ if (wilc->io_type == WILC_HIF_SDIO && wilc->dev_irq_num)
reg |= WILC_HAVE_SDIO_IRQ_GPIO;
#ifdef WILC_DISABLE_PMU
@@ -954,7 +954,7 @@ int wilc_wlan_start(struct wilc *wilc)
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_1, reg);
if (!ret) {
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
return -EIO;
}
@@ -962,7 +962,7 @@ int wilc_wlan_start(struct wilc *wilc)
ret = wilc->hif_func->hif_read_reg(wilc, 0x1000, &chipid);
if (!ret) {
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
return -EIO;
}
@@ -976,7 +976,7 @@ int wilc_wlan_start(struct wilc *wilc)
reg |= BIT(10);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
return (ret < 0) ? ret : 0;
}
@@ -987,18 +987,18 @@ int wilc_wlan_stop(struct wilc *wilc)
int ret;
u8 timeout = 10;
- acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
if (!ret) {
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return ret;
}
reg &= ~BIT(10);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
if (!ret) {
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1006,7 +1006,7 @@ int wilc_wlan_stop(struct wilc *wilc)
ret = wilc->hif_func->hif_read_reg(wilc,
WILC_GLB_RESET_0, &reg);
if (!ret) {
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1021,7 +1021,7 @@ int wilc_wlan_stop(struct wilc *wilc)
WILC_GLB_RESET_0,
&reg);
if (!ret) {
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return ret;
}
break;
@@ -1036,7 +1036,7 @@ int wilc_wlan_stop(struct wilc *wilc)
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1072,18 +1072,18 @@ void wilc_wlan_cleanup(struct net_device *dev)
kfree(wilc->tx_buffer);
wilc->tx_buffer = NULL;
- acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg);
if (!ret)
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
(reg | ABORT_INT));
if (!ret)
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
- release_bus(wilc, RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
wilc->hif_func->hif_deinit(NULL);
}
@@ -1122,8 +1122,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
int ret_size;
struct wilc *wilc = vif->wilc;
- if (wilc->cfg_frame_in_use)
- return 0;
+ mutex_lock(&wilc->cfg_cmd_lock);
if (start)
wilc->cfg_frame_offset = 0;
@@ -1134,11 +1133,12 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
offset += ret_size;
wilc->cfg_frame_offset = offset;
- if (!commit)
+ if (!commit) {
+ mutex_unlock(&wilc->cfg_cmd_lock);
return ret_size;
+ }
netdev_dbg(vif->ndev, "%s: seqno[%d]\n", __func__, wilc->cfg_seq_no);
- wilc->cfg_frame_in_use = 1;
if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler))
ret_size = 0;
@@ -1149,9 +1149,9 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
ret_size = 0;
}
- wilc->cfg_frame_in_use = 0;
wilc->cfg_frame_offset = 0;
wilc->cfg_seq_no += 1;
+ mutex_unlock(&wilc->cfg_cmd_lock);
return ret_size;
}
@@ -1163,8 +1163,7 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
int ret_size;
struct wilc *wilc = vif->wilc;
- if (wilc->cfg_frame_in_use)
- return 0;
+ mutex_lock(&wilc->cfg_cmd_lock);
if (start)
wilc->cfg_frame_offset = 0;
@@ -1174,10 +1173,10 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
offset += ret_size;
wilc->cfg_frame_offset = offset;
- if (!commit)
+ if (!commit) {
+ mutex_unlock(&wilc->cfg_cmd_lock);
return ret_size;
-
- wilc->cfg_frame_in_use = 1;
+ }
if (wilc_wlan_cfg_commit(vif, WILC_CFG_QUERY, drv_handler))
ret_size = 0;
@@ -1187,9 +1186,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__);
ret_size = 0;
}
- wilc->cfg_frame_in_use = 0;
wilc->cfg_frame_offset = 0;
wilc->cfg_seq_no += 1;
+ mutex_unlock(&wilc->cfg_cmd_lock);
return ret_size;
}
@@ -1205,7 +1204,7 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
int i;
int ret = 0;
- if (mode == GET_CFG) {
+ if (mode == WILC_GET_CFG) {
for (i = 0; i < count; i++) {
if (!wilc_wlan_cfg_get(vif, !i,
wids[i].id,
@@ -1221,7 +1220,7 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
wids[i].val,
wids[i].size);
}
- } else if (mode == SET_CFG) {
+ } else if (mode == WILC_SET_CFG) {
for (i = 0; i < count; i++) {
if (!wilc_wlan_cfg_set(vif, !i,
wids[i].id,
@@ -1245,7 +1244,7 @@ static u32 init_chip(struct net_device *dev)
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;
- acquire_bus(wilc, ACQUIRE_ONLY);
+ acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
chipid = wilc_get_chipid(wilc, true);
@@ -1268,7 +1267,7 @@ static u32 init_chip(struct net_device *dev)
}
}
- release_bus(wilc, RELEASE_ONLY);
+ release_bus(wilc, WILC_BUS_RELEASE_ONLY);
return ret;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index faa001c75681..8390766358da 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -7,7 +7,6 @@
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
#include "wilc_wlan_cfg.h"
-#include "coreconfigurator.h"
#include "wilc_wfi_netdevice.h"
enum cfg_cmd_type {
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index ce2066b74287..e2310d860291 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -15,8 +15,10 @@
*
********************************************/
-#define HIF_SDIO (0)
-#define HIF_SPI BIT(0)
+enum {
+ WILC_HIF_SDIO = 0,
+ WILC_HIF_SPI = BIT(0)
+};
/********************************************
*
@@ -24,29 +26,12 @@
*
********************************************/
-struct sdio_cmd52 {
- u32 read_write: 1;
- u32 function: 3;
- u32 raw: 1;
- u32 address: 17;
- u32 data: 8;
-};
-
-struct sdio_cmd53 {
- u32 read_write: 1;
- u32 function: 3;
- u32 block_mode: 1;
- u32 increment: 1;
- u32 address: 17;
- u32 count: 9;
- u8 *buffer;
- u32 block_size;
+enum {
+ WILC_MAC_STATUS_INIT = -1,
+ WILC_MAC_STATUS_DISCONNECTED = 0,
+ WILC_MAC_STATUS_CONNECTED = 1
};
-#define MAC_STATUS_INIT -1
-#define MAC_STATUS_CONNECTED 1
-#define MAC_STATUS_DISCONNECTED 0
-
struct tx_complete_data {
int size;
void *buff;
@@ -56,8 +41,6 @@ struct tx_complete_data {
typedef void (*wilc_tx_complete_func_t)(void *, int);
-#define WILC_TX_ERR_NO_BUF (-2)
-
/********************************************
*
* Wlan Configuration ID
@@ -68,133 +51,172 @@ typedef void (*wilc_tx_complete_func_t)(void *, int);
#define MAX_RATES_SUPPORTED 12
enum bss_types {
- INFRASTRUCTURE = 0,
- INDEPENDENT,
- AP,
+ WILC_FW_BSS_TYPE_INFRA = 0,
+ WILC_FW_BSS_TYPE_INDEPENDENT,
+ WILC_FW_BSS_TYPE_AP,
};
enum {
- B_ONLY_MODE = 0, /* 1, 2 M, otherwise 5, 11 M */
- G_ONLY_MODE, /* 6,12,24 otherwise 9,18,36,48,54 */
- G_MIXED_11B_1_MODE, /* 1,2,5.5,11 otherwise all on */
- G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
+ WILC_FW_OPER_MODE_B_ONLY = 0, /* 1, 2 M, otherwise 5, 11 M */
+ WILC_FW_OPER_MODE_G_ONLY, /* 6,12,24 otherwise 9,18,36,48,54 */
+ WILC_FW_OPER_MODE_G_MIXED_11B_1, /* 1,2,5.5,11 otherwise all on */
+ WILC_FW_OPER_MODE_G_MIXED_11B_2, /* 1,2,5,11,6,12,24 otherwise all on */
};
enum {
- G_SHORT_PREAMBLE = 0, /* Short Preamble */
- G_LONG_PREAMBLE = 1, /* Long Preamble */
- G_AUTO_PREAMBLE = 2, /* Auto Preamble Selection */
+ WILC_FW_PREAMBLE_SHORT = 0, /* Short Preamble */
+ WILC_FW_PREAMBLE_LONG = 1, /* Long Preamble */
+ WILC_FW_PREAMBLE_AUTO = 2, /* Auto Preamble Selection */
};
enum {
- PASSIVE_SCAN = 0,
- ACTIVE_SCAN = 1,
+ WILC_FW_PASSIVE_SCAN = 0,
+ WILC_FW_ACTIVE_SCAN = 1,
};
enum {
- NO_POWERSAVE = 0,
- MIN_FAST_PS = 1,
- MAX_FAST_PS = 2,
- MIN_PSPOLL_PS = 3,
- MAX_PSPOLL_PS = 4
+ WILC_FW_NO_POWERSAVE = 0,
+ WILC_FW_MIN_FAST_PS = 1,
+ WILC_FW_MAX_FAST_PS = 2,
+ WILC_FW_MIN_PSPOLL_PS = 3,
+ WILC_FW_MAX_PSPOLL_PS = 4
};
enum chip_ps_states {
- CHIP_WAKEDUP = 0,
- CHIP_SLEEPING_AUTO = 1,
- CHIP_SLEEPING_MANUAL = 2
+ WILC_CHIP_WAKEDUP = 0,
+ WILC_CHIP_SLEEPING_AUTO = 1,
+ WILC_CHIP_SLEEPING_MANUAL = 2
};
enum bus_acquire {
- ACQUIRE_ONLY = 0,
- ACQUIRE_AND_WAKEUP = 1,
+ WILC_BUS_ACQUIRE_ONLY = 0,
+ WILC_BUS_ACQUIRE_AND_WAKEUP = 1,
};
enum bus_release {
- RELEASE_ONLY = 0,
- RELEASE_ALLOW_SLEEP = 1,
+ WILC_BUS_RELEASE_ONLY = 0,
+ WILC_BUS_RELEASE_ALLOW_SLEEP = 1,
+};
+
+enum {
+ WILC_FW_NO_ENCRYPT = 0,
+ WILC_FW_ENCRYPT_ENABLED = BIT(0),
+ WILC_FW_WEP = BIT(1),
+ WILC_FW_WEP_EXTENDED = BIT(2),
+ WILC_FW_WPA = BIT(3),
+ WILC_FW_WPA2 = BIT(4),
+ WILC_FW_AES = BIT(5),
+ WILC_FW_TKIP = BIT(6)
};
enum {
- NO_SECURITY = 0,
- WEP_40 = 0x3,
- WEP_104 = 0x7,
- WPA_AES = 0x29,
- WPA_TKIP = 0x49,
- WPA_AES_TKIP = 0x69, /* Aes or Tkip */
- WPA2_AES = 0x31,
- WPA2_TKIP = 0x51,
- WPA2_AES_TKIP = 0x71, /* Aes or Tkip */
+ WILC_FW_SEC_NO = WILC_FW_NO_ENCRYPT,
+ WILC_FW_SEC_WEP = WILC_FW_WEP | WILC_FW_ENCRYPT_ENABLED,
+ WILC_FW_SEC_WEP_EXTENDED = WILC_FW_WEP_EXTENDED | WILC_FW_SEC_WEP,
+ WILC_FW_SEC_WPA = WILC_FW_WPA | WILC_FW_ENCRYPT_ENABLED,
+ WILC_FW_SEC_WPA_AES = WILC_FW_AES | WILC_FW_SEC_WPA,
+ WILC_FW_SEC_WPA_TKIP = WILC_FW_TKIP | WILC_FW_SEC_WPA,
+ WILC_FW_SEC_WPA2 = WILC_FW_WPA2 | WILC_FW_ENCRYPT_ENABLED,
+ WILC_FW_SEC_WPA2_AES = WILC_FW_AES | WILC_FW_SEC_WPA2,
+ WILC_FW_SEC_WPA2_TKIP = WILC_FW_TKIP | WILC_FW_SEC_WPA2
};
enum authtype {
- OPEN_SYSTEM = 1,
- SHARED_KEY = 2,
- ANY = 3,
- IEEE8021 = 5
+ WILC_FW_AUTH_OPEN_SYSTEM = 1,
+ WILC_FW_AUTH_SHARED_KEY = 2,
+ WILC_FW_AUTH_ANY = 3,
+ WILC_FW_AUTH_IEEE8021 = 5
};
enum site_survey {
- SITE_SURVEY_1CH = 0,
- SITE_SURVEY_ALL_CH = 1,
- SITE_SURVEY_OFF = 2
+ WILC_FW_SITE_SURVEY_1CH = 0,
+ WILC_FW_SITE_SURVEY_ALL_CH = 1,
+ WILC_FW_SITE_SURVEY_OFF = 2
};
enum {
- NORMAL_ACK = 0,
- NO_ACK,
+ WILC_FW_ACK_POLICY_NORMAL = 0,
+ WILC_FW_ACK_NO_POLICY,
};
enum {
- REKEY_DISABLE = 1,
- REKEY_TIME_BASE,
- REKEY_PKT_BASE,
- REKEY_TIME_PKT_BASE
+ WILC_FW_REKEY_POLICY_DISABLE = 1,
+ WILC_FW_REKEY_POLICY_TIME_BASE,
+ WILC_FW_REKEY_POLICY_PKT_BASE,
+ WILC_FW_REKEY_POLICY_TIME_PKT_BASE
};
enum {
- FILTER_NO = 0x00,
- FILTER_AP_ONLY = 0x01,
- FILTER_STA_ONLY = 0x02
+ WILC_FW_FILTER_NO = 0x00,
+ WILC_FW_FILTER_AP_ONLY = 0x01,
+ WILC_FW_FILTER_STA_ONLY = 0x02
};
enum {
- AUTO_PROT = 0, /* Auto */
- NO_PROT, /* Do not use any protection */
- ERP_PROT, /* Protect all ERP frame exchanges */
- HT_PROT, /* Protect all HT frame exchanges */
- GF_PROT, /* Protect all GF frame exchanges */
+ WILC_FW_11N_PROT_AUTO = 0, /* Auto */
+ WILC_FW_11N_NO_PROT, /* Do not use any protection */
+ WILC_FW_11N_PROT_ERP, /* Protect all ERP frame exchanges */
+ WILC_FW_11N_PROT_HT, /* Protect all HT frame exchanges */
+ WILC_FW_11N_PROT_GF /* Protect all GF frame exchanges */
};
enum {
- G_SELF_CTS_PROT,
- G_RTS_CTS_PROT,
+ WILC_FW_ERP_PROT_SELF_CTS,
+ WILC_FW_ERP_PROT_RTS_CTS,
};
enum {
- HT_MIXED_MODE = 1,
- HT_ONLY_20MHZ_MODE,
- HT_ONLY_20_40MHZ_MODE,
+ WILC_FW_11N_OP_MODE_HT_MIXED = 1,
+ WILC_FW_11N_OP_MODE_HT_ONLY_20MHZ,
+ WILC_FW_11N_OP_MODE_HT_ONLY_20_40MHZ,
};
enum {
- NO_DETECT = 0,
- DETECT_ONLY = 1,
- DETECT_PROTECT = 2,
- DETECT_PROTECT_REPORT = 3,
+ WILC_FW_OBBS_NONHT_NO_DETECT = 0,
+ WILC_FW_OBBS_NONHT_DETECT_ONLY = 1,
+ WILC_FW_OBBS_NONHT_DETECT_PROTECT = 2,
+ WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT = 3,
};
enum {
- RTS_CTS_NONHT_PROT = 0, /* RTS-CTS at non-HT rate */
- FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
- LSIG_TXOP_PROT, /* LSIG TXOP Protection */
- FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
+ WILC_FW_HT_PROT_RTS_CTS_NONHT = 0, /* RTS-CTS at non-HT rate */
+ WILC_FW_HT_PROT_FIRST_FRAME_NONHT, /* First frame at non-HT rate */
+ WILC_FW_HT_PROT_LSIG_TXOP, /* LSIG TXOP Protection */
+ WILC_FW_HT_PROT_FIRST_FRAME_MIXED, /* First frame at Mixed format */
};
enum {
- STATIC_MODE = 1,
- DYNAMIC_MODE = 2,
- MIMO_MODE = 3, /* power save disable */
+ WILC_FW_SMPS_MODE_STATIC = 1,
+ WILC_FW_SMPS_MODE_DYNAMIC = 2,
+ WILC_FW_SMPS_MODE_MIMO = 3, /* power save disable */
+};
+
+enum {
+ WILC_FW_TX_RATE_AUTO = 0,
+ WILC_FW_TX_RATE_MBPS_1 = 1,
+ WILC_FW_TX_RATE_MBPS_2 = 2,
+ WILC_FW_TX_RATE_MBPS_5_5 = 5,
+ WILC_FW_TX_RATE_MBPS_11 = 11,
+ WILC_FW_TX_RATE_MBPS_6 = 6,
+ WILC_FW_TX_RATE_MBPS_9 = 9,
+ WILC_FW_TX_RATE_MBPS_12 = 12,
+ WILC_FW_TX_RATE_MBPS_18 = 18,
+ WILC_FW_TX_RATE_MBPS_24 = 24,
+ WILC_FW_TX_RATE_MBPS_36 = 36,
+ WILC_FW_TX_RATE_MBPS_48 = 48,
+ WILC_FW_TX_RATE_MBPS_54 = 54
+};
+
+enum {
+ WILC_FW_DEFAULT_SCAN = 0,
+ WILC_FW_USER_SCAN = BIT(0),
+ WILC_FW_OBSS_PERIODIC_SCAN = BIT(1),
+ WILC_FW_OBSS_ONETIME_SCAN = BIT(2)
+};
+
+enum {
+ WILC_FW_ACTION_FRM_IDX = 0,
+ WILC_FW_PROBE_REQ_IDX = 1
};
enum wid_type {
@@ -698,13 +720,8 @@ enum {
WID_LONG_RETRY_LIMIT = 0x1003,
WID_BEACON_INTERVAL = 0x1006,
WID_MEMORY_ACCESS_16BIT = 0x1008,
- WID_RX_SENSE = 0x100B,
- WID_ACTIVE_SCAN_TIME = 0x100C,
- WID_PASSIVE_SCAN_TIME = 0x100D,
- WID_SITE_SURVEY_SCAN_TIME = 0x100E,
WID_JOIN_START_TIMEOUT = 0x100F,
- WID_AUTH_TIMEOUT = 0x1010,
WID_ASOC_TIMEOUT = 0x1011,
WID_11I_PROTOCOL_TIMEOUT = 0x1012,
WID_EAPOL_RESPONSE_TIMEOUT = 0x1013,
@@ -739,11 +756,8 @@ enum {
WID_HW_RX_COUNT = 0x2015,
WID_MEMORY_ADDRESS = 0x201E,
WID_MEMORY_ACCESS_32BIT = 0x201F,
- WID_RF_REG_VAL = 0x2021,
/* NMAC Integer WID list */
- WID_11N_PHY_ACTIVE_REG_VAL = 0x2080,
-
/* Custom Integer WID list */
WID_GET_INACTIVE_TIME = 0x2084,
WID_SET_OPERATION_MODE = 0X2086,
@@ -764,7 +778,6 @@ enum {
WID_SUPP_PASSWORD = 0x3011,
WID_SITE_SURVEY_RESULTS = 0x3012,
WID_RX_POWER_LEVEL = 0x3013,
- WID_DEL_ALL_RX_BA = 0x3014,
WID_SET_STA_MAC_INACTIVE_TIME = 0x3017,
WID_ADD_WEP_KEY = 0x3019,
WID_REMOVE_WEP_KEY = 0x301A,