2015-12-14 05:43:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH 00/12] Use index of interface to communicate with wilc device

Wilc device now use index of wfidrv_list which is list of host_if_drv pointers.
Each host_if_drv correspond with each wilc_vif interface, so we can use index
of vif. Therefore, so no need to make another list, wfidrv_list, to lookup
which interface the device is communicating.

Here are brief steps,
Firstly, Pass wilc_vif, currently being used, as msg argument to host interface
thread to use index of vif.
Secondly, Remove argument hif_drv since wilc_vif has it in it's member.
Thirdly, use index of vif to communicate with wilc device.
Lastly, remove unused structure and functions related with wfidrv_list
because it is not used anymore.

Last patch is bug fix which was found during patching this.

Glen Lee (12):
staging: wilc1000: pass vif to hostIFthread
staging: wilc1000: remove argument hif_drv
staging: wilc1000: take vif instead of drv in hostIFthread
staging: wilc1000: pass struct wilc
staging: wilc1000: use vif index to communicate with wilc device
staging: wilc1000: wilc_set_wfi_drv_handler: pass vif index
staging: wilc1000: change join_req_drv type and it's name
staging: wilc1000: remove used functions
staging: wilc1000: remove drv of struct host_if_msg
staging: wilc1000: remove wilc of struct host_if_drv
staging: wilc1000: set hif_drv before it is used
staging: wilc1000: bug fix on memory free

drivers/staging/wilc1000/coreconfigurator.h | 11 +-
drivers/staging/wilc1000/host_interface.c | 790 +++++++++++-----------
drivers/staging/wilc1000/host_interface.h | 144 ++--
drivers/staging/wilc1000/linux_wlan.c | 23 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 265 ++++----
drivers/staging/wilc1000/wilc_wlan.c | 3 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 9 +-
drivers/staging/wilc1000/wilc_wlan_cfg.h | 4 +-
8 files changed, 643 insertions(+), 606 deletions(-)

--
1.9.1



2015-12-19 00:44:29

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 01/12] staging: wilc1000: pass vif to hostIFthread

On Mon, Dec 14, 2015 at 02:46:52PM +0900, Glen Lee wrote:
> We will pass vif, which is currently being used as net_device, instead of
> hif_dev. This is the first step to use index of vif to pass to the driver.
> Add new argument vif to all the functions that send message to hostIFthread and
> set vif to msg.vif. As a result, hostIfthread will get vif.
> In later patch, we will remove drv of host_if_msg and use vif instead of it.
>
> Signed-off-by: Glen Lee <[email protected]>

Series did not apply :(

Please rebase all of your pending patches against my staging-testing
branch now and resend what I did not apply.

thanks,

greg k-h

2015-12-14 05:44:22

by Glen Lee

[permalink] [raw]
Subject: [PATCH 10/12] staging: wilc1000: remove wilc of struct host_if_drv

vif has wilc in it's members so no need to have wilc in host_if_drv.
It is redundant so just remove it and use wilc of vif.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 100 ++++++++++++------------------
drivers/staging/wilc1000/host_interface.h | 1 -
2 files changed, 41 insertions(+), 60 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 39e93fa..f97ea49 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -293,7 +293,6 @@ static s32 handle_set_channel(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -302,7 +301,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,

PRINT_D(HOSTINF_DBG, "Setting channel\n");

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -343,14 +342,13 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_SET_OPERATION_MODE;
wid.type = WID_INT;
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if ((hif_op_mode->mode) == IDLE_MODE)
@@ -388,7 +386,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx);
@@ -407,14 +405,13 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
{
s32 result = 0;
struct wid wid;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -443,7 +440,6 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- struct host_if_drv *hif_drv = vif->hif_drv;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);

if (!mac_buf) {
@@ -458,7 +454,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
wid.size = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -474,14 +470,13 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -777,7 +772,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif,
wid_cnt++;
}

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, wid_list,
wid_cnt, wilc_get_vif_idx(vif));

if (result)
@@ -901,7 +896,7 @@ static s32 Handle_Scan(struct wilc_vif *vif,
else if (hif_drv->hif_state == HOST_IF_IDLE)
scan_while_connected = false;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList,
u32WidsCount,
wilc_get_vif_idx(vif));

@@ -947,7 +942,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,
wid.val = (s8 *)&u8abort_running_scan;
wid.size = sizeof(char);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -1203,7 +1198,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_ssid);
}

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList,
u32WidsCount,
wilc_get_vif_idx(vif));
if (result) {
@@ -1271,7 +1266,6 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif)
struct wid strWIDList[5];
u32 u32WidsCount = 0;
u8 *pu8CurrByte = NULL;
- struct host_if_drv *hif_drv = vif->hif_drv;

strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
@@ -1302,7 +1296,7 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif)

u32WidsCount++;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList,
u32WidsCount,
wilc_get_vif_idx(join_req_vif));
if (result) {
@@ -1365,7 +1359,7 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)

PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send dissconect config packet\n");
@@ -1750,7 +1744,7 @@ static int Handle_Key(struct wilc_vif *vif,
strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len;
strWIDList[3].val = (s8 *)pu8keybuf;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
strWIDList, 4,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
@@ -1772,7 +1766,7 @@ static int Handle_Key(struct wilc_vif *vif,
wid.val = (s8 *)pu8keybuf;
wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
@@ -1785,7 +1779,7 @@ static int Handle_Key(struct wilc_vif *vif,
wid.val = s8idxarray;
wid.size = 1;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
} else {
@@ -1796,7 +1790,7 @@ static int Handle_Key(struct wilc_vif *vif,

PRINT_D(HOSTINF_DBG, "Setting default key index\n");

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
}
@@ -1830,7 +1824,7 @@ static int Handle_Key(struct wilc_vif *vif,
strWIDList[1].val = (s8 *)pu8keybuf;
strWIDList[1].size = RX_MIC_KEY_MSG_LEN;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
strWIDList, 2,
wilc_get_vif_idx(vif));

@@ -1862,7 +1856,7 @@ static int Handle_Key(struct wilc_vif *vif,
wid.val = (s8 *)pu8keybuf;
wid.size = RX_MIC_KEY_MSG_LEN;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));

@@ -1902,7 +1896,7 @@ _WPARxGtk_end_case_:
strWIDList[1].val = (s8 *)pu8keybuf;
strWIDList[1].size = PTK_KEY_MSG_LEN + 1;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
strWIDList, 2,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
@@ -1925,7 +1919,7 @@ _WPARxGtk_end_case_:
wid.val = (s8 *)pu8keybuf;
wid.size = PTK_KEY_MSG_LEN;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
@@ -1961,7 +1955,7 @@ _WPAPtk_end_case_:
wid.val = (s8 *)pu8keybuf;
wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

kfree(pu8keybuf);
@@ -1994,7 +1988,7 @@ static void Handle_Disconnect(struct wilc_vif *vif)

eth_zero_addr(wilc_connected_ssid);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -2082,7 +2076,7 @@ static s32 Handle_GetChnl(struct wilc_vif *vif)

PRINT_D(HOSTINF_DBG, "Getting channel value\n");

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -2107,7 +2101,7 @@ static void Handle_GetRssi(struct wilc_vif *vif)

PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");

- result = wilc_send_config_pkt(vif->hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to get RSSI value\n");
@@ -2132,7 +2126,7 @@ static void Handle_GetLinkspeed(struct wilc_vif *vif)

PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to get LINKSPEED value\n");
@@ -2147,7 +2141,6 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
{
struct wid strWIDList[5];
u32 u32WidsCount = 0, result = 0;
- struct host_if_drv *hif_drv = vif->hif_drv;

strWIDList[u32WidsCount].id = WID_LINKSPEED;
strWIDList[u32WidsCount].type = WID_CHAR;
@@ -2179,7 +2172,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
u32WidsCount++;

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, strWIDList,
u32WidsCount,
wilc_get_vif_idx(vif));

@@ -2208,7 +2201,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,

PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -2221,7 +2214,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
wid.val = (s8 *)&inactive_time;
wid.size = sizeof(u32);

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

if (result) {
@@ -2242,7 +2235,6 @@ static void Handle_AddBeacon(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Adding BEACON\n");

@@ -2281,7 +2273,7 @@ static void Handle_AddBeacon(struct wilc_vif *vif,
memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
pu8CurrByte += pstrSetBeaconParam->tail_len;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add beacon config packet\n");
@@ -2297,7 +2289,6 @@ static void Handle_DelBeacon(struct wilc_vif *vif)
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_DEL_BEACON;
wid.type = WID_CHAR;
@@ -2311,7 +2302,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif)

PRINT_D(HOSTINF_DBG, "Deleting BEACON\n");

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send delete beacon config packet\n");
@@ -2371,7 +2362,6 @@ static void Handle_AddStation(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Handling add station\n");
wid.id = (u16)WID_ADD_STA;
@@ -2385,7 +2375,7 @@ static void Handle_AddStation(struct wilc_vif *vif,
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result != 0)
PRINT_ER("Failed to send add station config packet\n");
@@ -2403,7 +2393,6 @@ static void Handle_DelAllSta(struct wilc_vif *vif,
u8 *pu8CurrByte;
u8 i;
u8 au8Zero_Buff[6] = {0};
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_DEL_ALL_STA;
wid.type = WID_STR;
@@ -2428,7 +2417,7 @@ static void Handle_DelAllSta(struct wilc_vif *vif,
pu8CurrByte += ETH_ALEN;
}

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2445,7 +2434,6 @@ static void Handle_DelStation(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_REMOVE_STA;
wid.type = WID_BIN;
@@ -2461,7 +2449,7 @@ static void Handle_DelStation(struct wilc_vif *vif,

memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2476,7 +2464,6 @@ static void Handle_EditStation(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_EDIT_STA;
wid.type = WID_BIN;
@@ -2490,7 +2477,7 @@ static void Handle_EditStation(struct wilc_vif *vif,
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send edit station config packet\n");
@@ -2552,7 +2539,7 @@ static int Handle_RemainOnChan(struct wilc_vif *vif,
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = (s8)pstrHostIfRemainOnChan->ch;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result != 0)
PRINT_ER("Failed to set remain on channel\n");
@@ -2581,7 +2568,6 @@ static int Handle_RegisterFrame(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n",
pstrHostIfRegisterFrame->reg,
@@ -2601,7 +2587,7 @@ static int Handle_RegisterFrame(struct wilc_vif *vif,

wid.size = sizeof(u16) + 2;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to frame register config packet\n");
@@ -2636,7 +2622,7 @@ static u32 Handle_ListenStateExpired(struct wilc_vif *vif,
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result != 0) {
PRINT_ER("Failed to set remain on channel\n");
@@ -2681,7 +2667,6 @@ static void Handle_PowerManagement(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
s8 s8PowerMode;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_POWER_MANAGEMENT;

@@ -2695,7 +2680,7 @@ static void Handle_PowerManagement(struct wilc_vif *vif,

PRINT_D(HOSTINF_DBG, "Handling Power Management\n");

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send power management config packet\n");
@@ -2707,7 +2692,6 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
- struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n");

@@ -2733,7 +2717,7 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif,
memcpy(pu8CurrByte, wilc_multicast_mac_addr_list,
((strHostIfSetMulti->cnt) * ETH_ALEN));

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send setup multicast config packet\n");
@@ -2748,7 +2732,6 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
s32 result = 0;
struct wid wid;
char *ptr = NULL;
- struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
strHostIfBASessionInfo->bssid[0],
@@ -2770,7 +2753,7 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
*ptr++ = 0;
*ptr++ = 32;

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
@@ -3512,7 +3495,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
wid.val = pu8AssocRespInfo;
wid.size = u32MaxAssocRespInfoLen;

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
*pu32RcvdAssocRespInfoLen = 0;
@@ -3807,7 +3790,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
result = -ENOMEM;
goto _fail_;
}
- hif_drv->wilc = wilc;
*hif_drv_handler = hif_drv;

wilc_optaining_ip = false;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 8922f29..8faac27 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -261,7 +261,6 @@ enum p2p_listen_state {

struct wilc;
struct host_if_drv {
- struct wilc *wilc;
struct user_scan_req usr_scan_req;
struct user_conn_req usr_conn_req;
struct remain_ch remain_on_ch;
--
1.9.1


2015-12-14 05:44:15

by Glen Lee

[permalink] [raw]
Subject: [PATCH 09/12] staging: wilc1000: remove drv of struct host_if_msg

This patch remove drv of struct host_if msg and it's related codes.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 50 ++-----------------------------
1 file changed, 3 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 5bf2a47..39e93fa 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -193,7 +193,6 @@ union message_body {
struct host_if_msg {
u16 id;
union message_body body;
- struct host_if_drv *drv;
struct wilc_vif *vif;
};

@@ -2787,7 +2786,6 @@ static int hostIFthread(void *pvArg)
{
u32 u32Ret;
struct host_if_msg msg;
- struct host_if_drv *hif_drv;
struct wilc *wilc = (struct wilc*)pvArg;
struct wilc_vif *vif;

@@ -2795,7 +2793,6 @@ static int hostIFthread(void *pvArg)

while (1) {
wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), &u32Ret);
- hif_drv = (struct host_if_drv *)msg.drv;
vif = msg.vif;
if (msg.id == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
@@ -2810,7 +2807,7 @@ static int hostIFthread(void *pvArg)
}

if (msg.id == HOST_IF_MSG_CONNECT &&
- hif_drv->usr_scan_req.scan_result) {
+ vif->hif_drv->usr_scan_req.scan_result) {
PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n");
wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
usleep_range(2 * 1000, 2 * 1000);
@@ -2860,7 +2857,7 @@ static int hostIFthread(void *pvArg)
break;

case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
- del_timer(&hif_drv->scan_timer);
+ del_timer(&vif->hif_drv->scan_timer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");

if (!wilc_wlan_get_num_conn_ifcs(wilc))
@@ -2868,7 +2865,7 @@ static int hostIFthread(void *pvArg)

Handle_ScanDone(msg.vif, SCAN_EVENT_DONE);

- if (hif_drv->remain_on_ch_pending)
+ if (vif->hif_drv->remain_on_ch_pending)
Handle_RemainOnChan(msg.vif,
&msg.body.remain_on_ch);

@@ -3052,7 +3049,6 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = REMOVEKEY;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.index = index;

@@ -3081,7 +3077,6 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = DEFAULTKEY;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.index = index;

@@ -3110,7 +3105,6 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
if (!msg.body.key_info.attr.wep.key)
@@ -3149,7 +3143,6 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY_AP;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
if (!msg.body.key_info.attr.wep.key)
@@ -3222,7 +3215,6 @@ s32 wilc_add_ptk(struct wilc_vif *vif, const u8 *pu8Ptk, u8 u8PtkKeylen,
msg.body.key_info.attr.wpa.key_len = u8KeyLen;
msg.body.key_info.attr.wpa.mac_addr = mac_addr;
msg.body.key_info.attr.wpa.mode = u8Ciphermode;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3264,7 +3256,6 @@ s32 wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *pu8RxGtk, u8 u8GtkKeylen,

msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WPA_RX_GTK;
- msg.drv = hif_drv;
msg.vif = vif;

if (mode == AP_MODE) {
@@ -3316,7 +3307,6 @@ s32 wilc_set_pmkid_info(struct wilc_vif *vif,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = PMKSA;
msg.body.key_info.action = ADDKEY;
- msg.drv = hif_drv;
msg.vif = vif;

for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) {
@@ -3337,13 +3327,11 @@ s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
- struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_GET_MAC_ADDRESS;
msg.body.get_mac_info.mac_addr = pu8MacAddress;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3360,14 +3348,12 @@ s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
- struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]);

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_MAC_ADDRESS;
memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN);
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3419,7 +3405,6 @@ s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
msg.body.con_info.result = pfConnectResult;
msg.body.con_info.arg = pvUserArg;
msg.body.con_info.params = pJoinParams;
- msg.drv = hif_drv ;
msg.vif = vif;

if (pu8bssid) {
@@ -3472,7 +3457,6 @@ s32 wilc_flush_join_req(struct wilc_vif *vif)
}

msg.id = HOST_IF_MSG_FLUSH_CONNECT;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3498,7 +3482,6 @@ s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode)
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_DISCONNECT;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3556,7 +3539,6 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_CHANNEL;
msg.body.channel_info.set_ch = channel;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3609,12 +3591,10 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
{
int result = 0;
struct host_if_msg msg;
- struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_OPERATION_MODE;
msg.body.mode.mode = mode;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3642,7 +3622,6 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
memcpy(msg.body.mac_info.mac, mac, ETH_ALEN);

msg.id = HOST_IF_MSG_GET_INACTIVETIME;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3664,7 +3643,6 @@ s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi)

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_GET_RSSI;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3689,12 +3667,10 @@ s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics)
{
s32 result = 0;
struct host_if_msg msg;
- struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_GET_STATISTICS;
msg.body.data = (char *)pstrStatistics;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3732,7 +3708,6 @@ s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType,
} else
PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n");

- msg.drv = hif_drv;
msg.vif = vif;
msg.body.scan_info.src = u8ScanSource;
msg.body.scan_info.type = u8ScanType;
@@ -3776,7 +3751,6 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_CFG_PARAMS;
msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3957,7 +3931,6 @@ s32 wilc_deinit(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");

msg.id = HOST_IF_MSG_EXIT;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4000,7 +3973,6 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO;
- msg.drv = hif_drv;
msg.vif = vif;

msg.body.net_info.len = u32Length;
@@ -4048,7 +4020,6 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO;
- msg.drv = hif_drv;
msg.vif = vif;

msg.body.async_info.len = u32Length;
@@ -4086,7 +4057,6 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4121,7 +4091,6 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
msg.body.remain_on_ch.arg = pvUserArg;
msg.body.remain_on_ch.u32duration = u32duration;
msg.body.remain_on_ch.id = u32SessionID;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4146,7 +4115,6 @@ s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID)

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.remain_on_ch.id = u32SessionID;

@@ -4188,7 +4156,6 @@ s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg)
}
msg.body.reg_frame.frame_type = u16FrameType;
msg.body.reg_frame.reg = bReg;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4216,7 +4183,6 @@ s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n");

msg.id = HOST_IF_MSG_ADD_BEACON;
- msg.drv = hif_drv;
msg.vif = vif;
pstrSetBeaconParam->interval = u32Interval;
pstrSetBeaconParam->dtim_period = u32DTIMPeriod;
@@ -4265,7 +4231,6 @@ int wilc_del_beacon(struct wilc_vif *vif)
}

msg.id = HOST_IF_MSG_DEL_BEACON;
- msg.drv = hif_drv;
msg.vif = vif;
PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n");

@@ -4293,7 +4258,6 @@ int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)
PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n");

msg.id = HOST_IF_MSG_ADD_STATION;
- msg.drv = hif_drv;
msg.vif = vif;

memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
@@ -4328,7 +4292,6 @@ int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr)
PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n");

msg.id = HOST_IF_MSG_DEL_STATION;
- msg.drv = hif_drv;
msg.vif = vif;

if (!mac_addr)
@@ -4362,7 +4325,6 @@ s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN])
PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n");

msg.id = HOST_IF_MSG_DEL_ALL_STA;
- msg.drv = hif_drv;
msg.vif = vif;

for (i = 0; i < MAX_NUM_STA; i++) {
@@ -4412,7 +4374,6 @@ s32 wilc_edit_station(struct wilc_vif *vif,
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_EDIT_STATION;
- msg.drv = hif_drv;
msg.vif = vif;

memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
@@ -4453,7 +4414,6 @@ s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout)
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_POWER_MGMT;
- msg.drv = hif_drv;
msg.vif = vif;

pstrPowerMgmtParam->enabled = bIsEnabled;
@@ -4483,7 +4443,6 @@ s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled,
memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER;
- msg.drv = hif_drv;
msg.vif = vif;

pstrMulticastFilterParam->enabled = bIsEnabled;
@@ -4678,7 +4637,6 @@ s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID)

memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN);
pBASessionInfo->tid = TID;
- msg.drv = hif_drv;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4708,7 +4666,6 @@ s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx)
msg.id = HOST_IF_MSG_SET_IPADDRESS;

msg.body.ip_info.ip_addr = u16ipadd;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.ip_info.idx = idx;

@@ -4736,7 +4693,6 @@ static s32 host_int_get_ipaddress(struct wilc_vif *vif,
msg.id = HOST_IF_MSG_GET_IPADDRESS;

msg.body.ip_info.ip_addr = u16ipadd;
- msg.drv = hif_drv;
msg.vif = vif;
msg.body.ip_info.idx = idx;

--
1.9.1


2015-12-14 05:43:39

by Glen Lee

[permalink] [raw]
Subject: [PATCH 03/12] staging: wilc1000: take vif instead of drv in hostIFthread

In the first patch, we sent vif to hostIFthread. we can use vif instead of
drv in the all functions which handle the commands from cfg operations.
Change first argument host_if_drv with wilc_vif and use hif_drv of wilc_vif.
Pass vif to the functions as well.
In case of timer callback functions, set vif to the data and use vif instead
of hif_drv.
Lastly, initialize u32RcvdAssocRespInfoLen since changing hif_drv with vif
causes one uninitialied build warning.
Now we have vif that currently being used so we can use interface index of
wilc_vif to send to wilc device.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 238 +++++++++++++++++-------------
1 file changed, 135 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index d4bcf39..e8c14cc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -316,11 +316,12 @@ static struct host_if_drv *get_handler_from_id(int id)
return wfidrv_list[id];
}

-static s32 handle_set_channel(struct host_if_drv *hif_drv,
+static s32 handle_set_channel(struct wilc_vif *vif,
struct channel_attr *hif_set_ch)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -340,11 +341,12 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv,
return result;
}

-static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv,
+static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
struct drv_handler *hif_drv_handler)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_SET_DRV_HANDLER;
wid.type = WID_INT;
@@ -365,11 +367,12 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv,
return result;
}

-static s32 handle_set_operation_mode(struct host_if_drv *hif_drv,
+static s32 handle_set_operation_mode(struct wilc_vif *vif,
struct op_mode *hif_op_mode)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_SET_OPERATION_MODE;
wid.type = WID_INT;
@@ -394,13 +397,12 @@ static s32 host_int_get_ipaddress(struct wilc_vif *vif,
struct host_if_drv *hif_drv,
u8 *u16ipadd, u8 idx);

-static s32 handle_set_ip_address(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u8 *ip_addr,
- u8 idx)
+static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
{
s32 result = 0;
struct wid wid;
char firmware_ip_addr[4] = {0};
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (ip_addr[0] < 192)
ip_addr[0] = 0;
@@ -430,11 +432,11 @@ static s32 handle_set_ip_address(struct wilc_vif *vif,
return result;
}

-static s32 handle_get_ip_address(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
@@ -465,11 +467,12 @@ static s32 handle_get_ip_address(struct wilc_vif *vif,
return result;
}

-static s32 handle_set_mac_address(struct host_if_drv *hif_drv,
+static s32 handle_set_mac_address(struct wilc_vif *vif,
struct set_mac_addr *set_mac_addr)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);

if (!mac_buf) {
@@ -495,11 +498,12 @@ static s32 handle_set_mac_address(struct host_if_drv *hif_drv,
return result;
}

-static s32 handle_get_mac_address(struct host_if_drv *hif_drv,
+static s32 handle_get_mac_address(struct wilc_vif *vif,
struct get_mac_addr *get_mac_addr)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
@@ -518,11 +522,12 @@ static s32 handle_get_mac_address(struct host_if_drv *hif_drv,
return result;
}

-static s32 handle_cfg_param(struct host_if_drv *hif_drv,
+static s32 handle_cfg_param(struct wilc_vif *vif,
struct cfg_param_attr *cfg_param_attr)
{
s32 result = 0;
struct wid wid_list[32];
+ struct host_if_drv *hif_drv = vif->hif_drv;
u8 wid_cnt = 0;

down(&hif_drv->sem_cfg_values);
@@ -818,10 +823,10 @@ static void Handle_wait_msg_q_empty(void)
up(&hif_sema_wait_response);
}

-static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+static s32 Handle_ScanDone(struct wilc_vif *vif,
enum scan_event enuEvent);

-static s32 Handle_Scan(struct host_if_drv *hif_drv,
+static s32 Handle_Scan(struct wilc_vif *vif,
struct scan_attr *pstrHostIFscanAttr)
{
s32 result = 0;
@@ -831,6 +836,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
u8 *pu8Buffer;
u8 valuesize = 0;
u8 *pu8HdnNtwrksWidVal = NULL;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Setting SCAN params\n");
PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state);
@@ -936,7 +942,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
ERRORHANDLER:
if (result) {
del_timer(&hif_drv->scan_timer);
- Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
+ Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
}

kfree(pstrHostIFscanAttr->ch_freq_list);
@@ -952,12 +958,13 @@ ERRORHANDLER:
return result;
}

-static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+static s32 Handle_ScanDone(struct wilc_vif *vif,
enum scan_event enuEvent)
{
s32 result = 0;
u8 u8abort_running_scan;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n");

@@ -993,7 +1000,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
}

u8 wilc_connected_ssid[6] = {0};
-static s32 Handle_Connect(struct host_if_drv *hif_drv,
+static s32 Handle_Connect(struct wilc_vif *vif,
struct connect_attr *pstrHostIFconnectAttr)
{
s32 result = 0;
@@ -1001,6 +1008,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32 u32WidsCount = 0, dummyval = 0;
u8 *pu8CurrByte = NULL;
struct join_bss_param *ptstrJoinBssParam;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(GENERIC_DBG, "Handling connect request\n");

@@ -1286,12 +1294,13 @@ ERRORHANDLER:
return result;
}

-static s32 Handle_FlushConnect(struct host_if_drv *hif_drv)
+static s32 Handle_FlushConnect(struct wilc_vif *vif)
{
s32 result = 0;
struct wid strWIDList[5];
u32 u32WidsCount = 0;
u8 *pu8CurrByte = NULL;
+ struct host_if_drv *hif_drv = vif->hif_drv;

strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
@@ -1333,12 +1342,13 @@ static s32 Handle_FlushConnect(struct host_if_drv *hif_drv)
return result;
}

-static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
+static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
{
s32 result = 0;
tstrConnectInfo strConnectInfo;
struct wid wid;
u16 u16DummyReasonCode = 0;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
@@ -1410,7 +1420,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
return result;
}

-static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv,
+static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,
struct rcvd_net_info *pstrRcvdNetworkInfo)
{
u32 i;
@@ -1418,6 +1428,7 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv,
s32 result = 0;
tstrNetworkInfo *pstrNetworkInfo = NULL;
void *pJoinParams = NULL;
+ struct host_if_drv *hif_drv = vif->hif_drv;

bNewNtwrkFound = true;
PRINT_INFO(HOSTINF_DBG, "Handling received network info\n");
@@ -1491,13 +1502,12 @@ done:
return result;
}

-static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
u8 *pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen,
u32 *pu32RcvdAssocRespInfoLen);

static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
- struct host_if_drv *hif_drv,
struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
{
s32 result = 0;
@@ -1512,6 +1522,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
tstrConnectInfo strConnectInfo;
tstrDisconnectNotifInfo strDisconnectNotifInfo;
s32 s32Err = 0;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
@@ -1545,7 +1556,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9];
PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo);
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
- u32 u32RcvdAssocRespInfoLen;
+ u32 u32RcvdAssocRespInfoLen = 0;
tstrConnectRespInfo *pstrConnectRespInfo = NULL;

PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo);
@@ -1555,7 +1566,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
if (u8MacStatus == MAC_CONNECTED) {
memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);

- host_int_get_assoc_res_info(hif_drv,
+ host_int_get_assoc_res_info(vif,
rcv_assoc_resp,
MAX_ASSOC_RESP_FRAME_SIZE,
&u32RcvdAssocRespInfoLen);
@@ -1660,7 +1671,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
if (hif_drv->usr_scan_req.scan_result) {
PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n");
del_timer(&hif_drv->scan_timer);
- Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED);
+ Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
}

strDisconnectNotifInfo.u16reason = 0;
@@ -1708,7 +1719,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,

del_timer(&hif_drv->scan_timer);
if (hif_drv->usr_scan_req.scan_result)
- Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
+ Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
}
}

@@ -1718,7 +1729,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
return result;
}

-static int Handle_Key(struct host_if_drv *hif_drv,
+static int Handle_Key(struct wilc_vif *vif,
struct key_attr *pstrHostIFkeyAttr)
{
s32 result = 0;
@@ -1728,6 +1739,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
u8 *pu8keybuf;
s8 s8idxarray[1];
s8 ret = 0;
+ struct host_if_drv *hif_drv = vif->hif_drv;

switch (pstrHostIFkeyAttr->type) {
case WEP:
@@ -1991,10 +2003,10 @@ _WPAPtk_end_case_:
return result;
}

-static void Handle_Disconnect(struct wilc_vif *vif,
- struct host_if_drv *hif_drv)
+static void Handle_Disconnect(struct wilc_vif *vif)
{
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

s32 result = 0;
u16 u16DummyReasonCode = 0;
@@ -2086,10 +2098,11 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
}
}

-static s32 Handle_GetChnl(struct host_if_drv *hif_drv)
+static s32 Handle_GetChnl(struct wilc_vif *vif)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -2111,7 +2124,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv)
return result;
}

-static void Handle_GetRssi(struct host_if_drv *hif_drv)
+static void Handle_GetRssi(struct wilc_vif *vif)
{
s32 result = 0;
struct wid wid;
@@ -2123,20 +2136,21 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv)

PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");

- result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ result = wilc_send_config_pkt(vif->hif_drv->wilc, GET_CFG, &wid, 1,
+ get_id_from_handler(vif->hif_drv));
if (result) {
PRINT_ER("Failed to get RSSI value\n");
result = -EFAULT;
}

- up(&hif_drv->sem_get_rssi);
+ up(&vif->hif_drv->sem_get_rssi);
}

-static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
+static void Handle_GetLinkspeed(struct wilc_vif *vif)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

link_speed = 0;

@@ -2157,10 +2171,12 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
up(&hif_drv->sem_get_link_speed);
}

-static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+static s32 Handle_GetStatistics(struct wilc_vif *vif,
+ struct rf_info *pstrStatistics)
{
struct wid strWIDList[5];
u32 u32WidsCount = 0, result = 0;
+ struct host_if_drv *hif_drv = vif->hif_drv;

strWIDList[u32WidsCount].id = WID_LINKSPEED;
strWIDList[u32WidsCount].type = WID_CHAR;
@@ -2203,12 +2219,13 @@ static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pst
return 0;
}

-static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
+static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
struct sta_inactive_t *strHostIfStaInactiveT)
{
s32 result = 0;
u8 *stamac;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME;
wid.type = WID_STR;
@@ -2248,12 +2265,13 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
return result;
}

-static void Handle_AddBeacon(struct host_if_drv *hif_drv,
+static void Handle_AddBeacon(struct wilc_vif *vif,
struct beacon_attr *pstrSetBeaconParam)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Adding BEACON\n");

@@ -2303,11 +2321,12 @@ ERRORHANDLER:
kfree(pstrSetBeaconParam->tail);
}

-static void Handle_DelBeacon(struct host_if_drv *hif_drv)
+static void Handle_DelBeacon(struct wilc_vif *vif)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_DEL_BEACON;
wid.type = WID_CHAR;
@@ -2375,12 +2394,13 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer,
return pu8CurrByte - pu8Buffer;
}

-static void Handle_AddStation(struct host_if_drv *hif_drv,
+static void Handle_AddStation(struct wilc_vif *vif,
struct add_sta_param *pstrStationParam)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Handling add station\n");
wid.id = (u16)WID_ADD_STA;
@@ -2404,7 +2424,7 @@ ERRORHANDLER:
kfree(wid.val);
}

-static void Handle_DelAllSta(struct host_if_drv *hif_drv,
+static void Handle_DelAllSta(struct wilc_vif *vif,
struct del_all_sta *pstrDelAllStaParam)
{
s32 result = 0;
@@ -2412,6 +2432,7 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv,
u8 *pu8CurrByte;
u8 i;
u8 au8Zero_Buff[6] = {0};
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_DEL_ALL_STA;
wid.type = WID_STR;
@@ -2447,12 +2468,13 @@ ERRORHANDLER:
up(&hif_sema_wait_response);
}

-static void Handle_DelStation(struct host_if_drv *hif_drv,
+static void Handle_DelStation(struct wilc_vif *vif,
struct del_sta *pstrDelStaParam)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_REMOVE_STA;
wid.type = WID_BIN;
@@ -2477,12 +2499,13 @@ ERRORHANDLER:
kfree(wid.val);
}

-static void Handle_EditStation(struct host_if_drv *hif_drv,
+static void Handle_EditStation(struct wilc_vif *vif,
struct add_sta_param *pstrStationParam)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_EDIT_STA;
wid.type = WID_BIN;
@@ -2506,12 +2529,13 @@ ERRORHANDLER:
kfree(wid.val);
}

-static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
+static int Handle_RemainOnChan(struct wilc_vif *vif,
struct remain_ch *pstrHostIfRemainOnChan)
{
s32 result = 0;
u8 u8remain_on_chan_flag;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv->remain_on_ch_pending) {
hif_drv->remain_on_ch.arg = pstrHostIfRemainOnChan->arg;
@@ -2565,7 +2589,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
ERRORHANDLER:
{
P2P_LISTEN_STATE = 1;
- hif_drv->remain_on_ch_timer.data = (unsigned long)hif_drv;
+ hif_drv->remain_on_ch_timer.data = (unsigned long)vif;
mod_timer(&hif_drv->remain_on_ch_timer,
jiffies +
msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration));
@@ -2580,12 +2604,13 @@ ERRORHANDLER:
return result;
}

-static int Handle_RegisterFrame(struct host_if_drv *hif_drv,
+static int Handle_RegisterFrame(struct wilc_vif *vif,
struct reg_frame *pstrHostIfRegisterFrame)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n",
pstrHostIfRegisterFrame->reg,
@@ -2615,12 +2640,13 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv,
return result;
}

-static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
+static u32 Handle_ListenStateExpired(struct wilc_vif *vif,
struct remain_ch *pstrHostIfRemainOnChan)
{
u8 u8remain_on_chan_flag;
struct wid wid;
s32 result = 0;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n");

@@ -2664,26 +2690,27 @@ static void ListenTimerCB(unsigned long arg)
{
s32 result = 0;
struct host_if_msg msg;
- struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
+ struct wilc_vif *vif = (struct wilc_vif *)arg;

- del_timer(&hif_drv->remain_on_ch_timer);
+ del_timer(&vif->hif_drv->remain_on_ch_timer);

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
- msg.drv = hif_drv;
- msg.body.remain_on_ch.id = hif_drv->remain_on_ch.id;
+ msg.vif = vif;
+ msg.body.remain_on_ch.id = vif->hif_drv->remain_on_ch.id;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
PRINT_ER("wilc_mq_send fail\n");
}

-static void Handle_PowerManagement(struct host_if_drv *hif_drv,
+static void Handle_PowerManagement(struct wilc_vif *vif,
struct power_mgmt_param *strPowerMgmtParam)
{
s32 result = 0;
struct wid wid;
s8 s8PowerMode;
+ struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_POWER_MANAGEMENT;

@@ -2703,12 +2730,13 @@ static void Handle_PowerManagement(struct host_if_drv *hif_drv,
PRINT_ER("Failed to send power management config packet\n");
}

-static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,
+static void Handle_SetMulticastFilter(struct wilc_vif *vif,
struct set_multicast *strHostIfSetMulti)
{
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n");

@@ -2743,12 +2771,13 @@ ERRORHANDLER:
kfree(wid.val);
}

-static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
+static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
struct ba_session_info *strHostIfBASessionInfo)
{
s32 result = 0;
struct wid wid;
char *ptr = NULL;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
strHostIfBASessionInfo->bssid[0],
@@ -2822,40 +2851,40 @@ static int hostIFthread(void *pvArg)
break;

case HOST_IF_MSG_SCAN:
- Handle_Scan(msg.drv, &msg.body.scan_info);
+ Handle_Scan(msg.vif, &msg.body.scan_info);
break;

case HOST_IF_MSG_CONNECT:
- Handle_Connect(msg.drv, &msg.body.con_info);
+ Handle_Connect(msg.vif, &msg.body.con_info);
break;

case HOST_IF_MSG_FLUSH_CONNECT:
- Handle_FlushConnect(msg.drv);
+ Handle_FlushConnect(msg.vif);
break;

case HOST_IF_MSG_RCVD_NTWRK_INFO:
- Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info);
+ Handle_RcvdNtwrkInfo(msg.vif, &msg.body.net_info);
break;

case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO:
- Handle_RcvdGnrlAsyncInfo(vif, msg.drv,
+ Handle_RcvdGnrlAsyncInfo(vif,
&msg.body.async_info);
break;

case HOST_IF_MSG_KEY:
- Handle_Key(msg.drv, &msg.body.key_info);
+ Handle_Key(msg.vif, &msg.body.key_info);
break;

case HOST_IF_MSG_CFG_PARAMS:
- handle_cfg_param(msg.drv, &msg.body.cfg_info);
+ handle_cfg_param(msg.vif, &msg.body.cfg_info);
break;

case HOST_IF_MSG_SET_CHANNEL:
- handle_set_channel(msg.drv, &msg.body.channel_info);
+ handle_set_channel(msg.vif, &msg.body.channel_info);
break;

case HOST_IF_MSG_DISCONNECT:
- Handle_Disconnect(vif, msg.drv);
+ Handle_Disconnect(msg.vif);
break;

case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
@@ -2865,124 +2894,126 @@ static int hostIFthread(void *pvArg)
if (!wilc_wlan_get_num_conn_ifcs(wilc))
wilc_chip_sleep_manually(wilc);

- Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
+ Handle_ScanDone(msg.vif, SCAN_EVENT_DONE);

if (hif_drv->remain_on_ch_pending)
- Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch);
+ Handle_RemainOnChan(msg.vif,
+ &msg.body.remain_on_ch);

break;

case HOST_IF_MSG_GET_RSSI:
- Handle_GetRssi(msg.drv);
+ Handle_GetRssi(msg.vif);
break;

case HOST_IF_MSG_GET_LINKSPEED:
- Handle_GetLinkspeed(msg.drv);
+ Handle_GetLinkspeed(msg.vif);
break;

case HOST_IF_MSG_GET_STATISTICS:
- Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data);
+ Handle_GetStatistics(msg.vif,
+ (struct rf_info *)msg.body.data);
break;

case HOST_IF_MSG_GET_CHNL:
- Handle_GetChnl(msg.drv);
+ Handle_GetChnl(msg.vif);
break;

case HOST_IF_MSG_ADD_BEACON:
- Handle_AddBeacon(msg.drv, &msg.body.beacon_info);
+ Handle_AddBeacon(msg.vif, &msg.body.beacon_info);
break;

case HOST_IF_MSG_DEL_BEACON:
- Handle_DelBeacon(msg.drv);
+ Handle_DelBeacon(msg.vif);
break;

case HOST_IF_MSG_ADD_STATION:
- Handle_AddStation(msg.drv, &msg.body.add_sta_info);
+ Handle_AddStation(msg.vif, &msg.body.add_sta_info);
break;

case HOST_IF_MSG_DEL_STATION:
- Handle_DelStation(msg.drv, &msg.body.del_sta_info);
+ Handle_DelStation(msg.vif, &msg.body.del_sta_info);
break;

case HOST_IF_MSG_EDIT_STATION:
- Handle_EditStation(msg.drv, &msg.body.edit_sta_info);
+ Handle_EditStation(msg.vif, &msg.body.edit_sta_info);
break;

case HOST_IF_MSG_GET_INACTIVETIME:
- Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info);
+ Handle_Get_InActiveTime(msg.vif, &msg.body.mac_info);
break;

case HOST_IF_MSG_SCAN_TIMER_FIRED:
PRINT_D(HOSTINF_DBG, "Scan Timeout\n");

- Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED);
+ Handle_ScanDone(msg.vif, SCAN_EVENT_ABORTED);
break;

case HOST_IF_MSG_CONNECT_TIMER_FIRED:
PRINT_D(HOSTINF_DBG, "Connect Timeout\n");
- Handle_ConnectTimeout(msg.drv);
+ Handle_ConnectTimeout(msg.vif);
break;

case HOST_IF_MSG_POWER_MGMT:
- Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info);
+ Handle_PowerManagement(msg.vif,
+ &msg.body.pwr_mgmt_info);
break;

case HOST_IF_MSG_SET_WFIDRV_HANDLER:
- handle_set_wfi_drv_handler(msg.drv, &msg.body.drv);
+ handle_set_wfi_drv_handler(msg.vif, &msg.body.drv);
break;

case HOST_IF_MSG_SET_OPERATION_MODE:
- handle_set_operation_mode(msg.drv, &msg.body.mode);
+ handle_set_operation_mode(msg.vif, &msg.body.mode);
break;

case HOST_IF_MSG_SET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
- handle_set_ip_address(vif, msg.drv,
+ handle_set_ip_address(vif,
msg.body.ip_info.ip_addr,
msg.body.ip_info.idx);
break;

case HOST_IF_MSG_GET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
- handle_get_ip_address(vif, msg.drv,
- msg.body.ip_info.idx);
+ handle_get_ip_address(vif, msg.body.ip_info.idx);
break;

case HOST_IF_MSG_SET_MAC_ADDRESS:
- handle_set_mac_address(msg.drv,
+ handle_set_mac_address(msg.vif,
&msg.body.set_mac_info);
break;

case HOST_IF_MSG_GET_MAC_ADDRESS:
- handle_get_mac_address(msg.drv,
+ handle_get_mac_address(msg.vif,
&msg.body.get_mac_info);
break;

case HOST_IF_MSG_REMAIN_ON_CHAN:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n");
- Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch);
+ Handle_RemainOnChan(msg.vif, &msg.body.remain_on_ch);
break;

case HOST_IF_MSG_REGISTER_FRAME:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n");
- Handle_RegisterFrame(msg.drv, &msg.body.reg_frame);
+ Handle_RegisterFrame(msg.vif, &msg.body.reg_frame);
break;

case HOST_IF_MSG_LISTEN_TIMER_FIRED:
- Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch);
+ Handle_ListenStateExpired(msg.vif, &msg.body.remain_on_ch);
break;

case HOST_IF_MSG_SET_MULTICAST_FILTER:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n");
- Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info);
+ Handle_SetMulticastFilter(msg.vif, &msg.body.multicast_info);
break;

case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS:
- Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info);
+ Handle_DelAllRxBASessions(msg.vif, &msg.body.session_info);
break;

case HOST_IF_MSG_DEL_ALL_STA:
- Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info);
+ Handle_DelAllSta(msg.vif, &msg.body.del_all_sta_info);
break;

default:
@@ -2998,11 +3029,11 @@ static int hostIFthread(void *pvArg)

static void TimerCB_Scan(unsigned long arg)
{
- void *pvArg = (void *)arg;
+ struct wilc_vif *vif = (struct wilc_vif *)arg;
struct host_if_msg msg;

memset(&msg, 0, sizeof(struct host_if_msg));
- msg.drv = pvArg;
+ msg.vif = vif;
msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED;

wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3010,11 +3041,11 @@ static void TimerCB_Scan(unsigned long arg)

static void TimerCB_Connect(unsigned long arg)
{
- void *pvArg = (void *)arg;
+ struct wilc_vif *vif = (struct wilc_vif *)arg;
struct host_if_msg msg;

memset(&msg, 0, sizeof(struct host_if_msg));
- msg.drv = pvArg;
+ msg.vif = vif;
msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED;

wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3447,7 +3478,7 @@ s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
return -EFAULT;
}

- hif_drv->connect_timer.data = (unsigned long)hif_drv;
+ hif_drv->connect_timer.data = (unsigned long)vif;
mod_timer(&hif_drv->connect_timer,
jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT));

@@ -3507,13 +3538,14 @@ s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode)
return result;
}

-static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
u8 *pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen,
u32 *pu32RcvdAssocRespInfoLen)
{
s32 result = 0;
struct wid wid;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("Driver is null\n");
@@ -3751,7 +3783,7 @@ s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType,
}

PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n");
- hif_drv->scan_timer.data = (unsigned long)hif_drv;
+ hif_drv->scan_timer.data = (unsigned long)vif;
mod_timer(&hif_drv->scan_timer,
jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));

@@ -3783,21 +3815,21 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,

static void GetPeriodicRSSI(unsigned long arg)
{
- struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
+ struct wilc_vif *vif = (struct wilc_vif *)arg;

- if (!hif_drv) {
+ if (!vif->hif_drv) {
PRINT_ER("Driver handler is NULL\n");
return;
}

- if (hif_drv->hif_state == HOST_IF_CONNECTED) {
+ if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) {
s32 result = 0;
struct host_if_msg msg;

memset(&msg, 0, sizeof(struct host_if_msg));

msg.id = HOST_IF_MSG_GET_RSSI;
- msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3805,7 +3837,7 @@ static void GetPeriodicRSSI(unsigned long arg)
return;
}
}
- periodic_rssi.data = (unsigned long)hif_drv;
+ periodic_rssi.data = (unsigned long)vif;
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
}

@@ -3874,7 +3906,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
goto _fail_mq_;
}
setup_timer(&periodic_rssi, GetPeriodicRSSI,
- (unsigned long)hif_drv);
+ (unsigned long)vif);
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
}

--
1.9.1


2015-12-14 05:43:56

by Glen Lee

[permalink] [raw]
Subject: [PATCH 06/12] staging: wilc1000: wilc_set_wfi_drv_handler: pass vif index

Pass index of vif instead of hif_drv. wilc_get_vif_idx is used to get correct
index of vif.
In the handler function handle_set_wfi_drv_handler, use vif instead of hif_drv,
and use hif_drv_handler->handler instead of hif_drv when deinitialize wilc
device.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 14 ++++++--------
drivers/staging/wilc1000/host_interface.h | 3 ++-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 +++++++-----
3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0893331..840253b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -313,7 +313,7 @@ static int get_id_from_handler(struct host_if_drv *handler)
* special purpose in wilc device, so we add 1 to the index to starts from 1.
* As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
*/
-static int wilc_get_vif_idx(struct wilc_vif *vif)
+int wilc_get_vif_idx(struct wilc_vif *vif)
{
return vif->u8IfIdx + 1;
}
@@ -363,17 +363,16 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- struct host_if_drv *hif_drv = vif->hif_drv;

wid.id = (u16)WID_SET_DRV_HANDLER;
wid.type = WID_INT;
wid.val = (s8 *)&hif_drv_handler->handler;
wid.size = sizeof(u32);

- result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
hif_drv_handler->handler);

- if (!hif_drv)
+ if (!hif_drv_handler->handler)
up(&hif_sema_driver);

if (result) {
@@ -3631,15 +3630,14 @@ int wilc_wait_msg_queue_idle(void)
return result;
}

-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv)
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
{
int result = 0;
struct host_if_msg msg;

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
- msg.body.drv.handler = get_id_from_handler(hif_drv);
- msg.drv = hif_drv;
+ msg.body.drv.handler = index;
msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3994,7 +3992,7 @@ s32 wilc_deinit(struct wilc_vif *vif)

del_timer_sync(&hif_drv->remain_on_ch_timer);

- wilc_set_wfi_drv_handler(vif, NULL);
+ wilc_set_wfi_drv_handler(vif, 0);
down(&hif_sema_driver);

if (hif_drv->usr_scan_req.scan_result) {
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 9716bc8..8922f29 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -367,13 +367,14 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
void *pvUserArg);
s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID);
s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg);
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv);
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index);
int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);

void wilc_free_join_params(void *pJoinParams);

s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics);
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
+int wilc_get_vif_idx(struct wilc_vif *vif);

extern bool wilc_optaining_ip;
extern u8 wilc_connected_ssid[6];
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index da4c4ad..53fb2d4 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -628,7 +628,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)

priv->u32RcvdChCount = 0;

- wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
+ wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
reset_shadow_found();

priv->bCfgScanning = true;
@@ -709,7 +709,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
vif = netdev_priv(priv->dev);
pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);

- wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
+ wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));

PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
@@ -2142,7 +2142,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_initialized = 1;
vif->iftype = interface_type;

- wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+ wilc_set_wfi_drv_handler(vif,
+ wilc_get_vif_idx(wl->vif[0]));
wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
wilc_set_operation_mode(vif, STATION_MODE);

@@ -2217,7 +2218,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc1000_wlan_init(dev, vif);
wilc_initialized = 1;

- wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+ wilc_set_wfi_drv_handler(vif,
+ wilc_get_vif_idx(wl->vif[0]));
wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
wilc_set_operation_mode(vif, STATION_MODE);

@@ -2320,7 +2322,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc1000_wlan_init(dev, vif);
wilc_initialized = 1;

- wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+ wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(wl->vif[0]));
wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
wilc_set_operation_mode(vif, AP_MODE);

--
1.9.1


2015-12-14 05:44:08

by Glen Lee

[permalink] [raw]
Subject: [PATCH 08/12] staging: wilc1000: remove used functions

This patch remove unused functions add_handler_in_list and
remove_handler_in_list, and it's related global variable wfidrv_list and codes.
label fail_timer_2 and it's codes are removed since label is not used anymore.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 44 -------------------------------
1 file changed, 44 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 76e891c..5bf2a47 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -226,7 +226,6 @@ struct join_bss_param {
u8 start_time[4];
};

-static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
struct host_if_drv *terminated_handle;
bool wilc_optaining_ip;
static u8 P2P_LISTEN_STATE;
@@ -266,34 +265,6 @@ static struct wilc_vif *join_req_vif;

static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);

-static int add_handler_in_list(struct host_if_drv *handler)
-{
- int i;
-
- for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
- if (!wfidrv_list[i]) {
- wfidrv_list[i] = handler;
- return 0;
- }
- }
-
- return -ENOBUFS;
-}
-
-static int remove_handler_in_list(struct host_if_drv *handler)
-{
- int i;
-
- for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
- if (wfidrv_list[i] == handler) {
- wfidrv_list[i] = NULL;
- return 0;
- }
- }
-
- return -EINVAL;
-}
-
/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
* special purpose in wilc device, so we add 1 to the index to starts from 1.
* As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
@@ -3845,7 +3816,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
{
s32 result = 0;
struct host_if_drv *hif_drv;
- int err;
struct wilc_vif *vif;
struct wilc *wilc;

@@ -3865,11 +3835,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
}
hif_drv->wilc = wilc;
*hif_drv_handler = hif_drv;
- err = add_handler_in_list(hif_drv);
- if (err) {
- result = -EFAULT;
- goto _fail_timer_2;
- }

wilc_optaining_ip = false;

@@ -3939,10 +3904,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)

return result;

-_fail_timer_2:
- del_timer_sync(&hif_drv->connect_timer);
- del_timer_sync(&hif_drv->scan_timer);
- kthread_stop(hif_thread_handler);
_fail_mq_:
wilc_mq_destroy(&hif_msg_q);
_fail_:
@@ -3954,7 +3915,6 @@ s32 wilc_deinit(struct wilc_vif *vif)
s32 result = 0;
struct host_if_msg msg;
struct host_if_drv *hif_drv = vif->hif_drv;
- int ret;

if (!hif_drv) {
PRINT_ER("hif_drv = NULL\n");
@@ -4009,10 +3969,6 @@ s32 wilc_deinit(struct wilc_vif *vif)
wilc_mq_destroy(&hif_msg_q);
}

- ret = remove_handler_in_list(hif_drv);
- if (ret)
- result = -ENOENT;
-
kfree(hif_drv);

clients_count--;
--
1.9.1


2015-12-14 05:44:33

by Glen Lee

[permalink] [raw]
Subject: [PATCH 12/12] staging: wilc1000: bug fix on memory free

Set tx_buffer to NULL not to free again the memory that is already freed,
which could cause system crash when device is failed.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 00f3464..83af51b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1374,6 +1374,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
kfree(wilc->rx_buffer);
wilc->rx_buffer = NULL;
kfree(wilc->tx_buffer);
+ wilc->tx_buffer = NULL;

acquire_bus(wilc, ACQUIRE_AND_WAKEUP);

--
1.9.1


2015-12-14 05:43:51

by Glen Lee

[permalink] [raw]
Subject: [PATCH 05/12] staging: wilc1000: use vif index to communicate with wilc device

We now have vif index in all functions related with host interface thread.
wilc_get_vif_idx and wilc_get_vif_from_idx are added to get id and vif
respectively.
Relace get_id_from_handler with wilc_get_vif_idx and get_handler_from_id with
wilc_get_vif_from_idx. Remove unused function get_handler_from_id as well.
We get vif where wilc_get_vif_from_idx is called, so pass vif to msg.vif.

There are two get_id_from_handler left. They will be removed in later patch.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 127 +++++++++++++++++++-----------
1 file changed, 81 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 259cefc..0893331 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -309,11 +309,28 @@ static int get_id_from_handler(struct host_if_drv *handler)
return 0;
}

-static struct host_if_drv *get_handler_from_id(int id)
+/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
+ * special purpose in wilc device, so we add 1 to the index to starts from 1.
+ * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
+ */
+static int wilc_get_vif_idx(struct wilc_vif *vif)
{
- if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list))
+ return vif->u8IfIdx + 1;
+}
+
+/* We need to minus 1 from idx which is from wilc device to get real index
+ * of wilc->vif[], because we add 1 when pass to wilc device in the function
+ * wilc_get_vif_idx.
+ * As a result, the index should be between 0 and NUM_CONCURRENT_IFC -1.
+ */
+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)
return NULL;
- return wfidrv_list[id];
+
+ return wilc->vif[index];
}

static s32 handle_set_channel(struct wilc_vif *vif,
@@ -331,7 +348,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,
PRINT_D(HOSTINF_DBG, "Setting channel\n");

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to set channel\n");
@@ -380,7 +397,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
wid.size = sizeof(u32);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if ((hif_op_mode->mode) == IDLE_MODE)
up(&hif_sema_driver);
@@ -418,7 +435,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
wid.size = IP_ALEN;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx);

@@ -444,7 +461,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
wid.size = IP_ALEN;

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);

@@ -488,7 +505,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
result = -EFAULT;
@@ -511,7 +528,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
wid.size = ETH_ALEN;

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to get mac address\n");
@@ -807,7 +824,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif,
}

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list,
- wid_cnt, get_id_from_handler(hif_drv));
+ wid_cnt, wilc_get_vif_idx(vif));

if (result)
PRINT_ER("Error in setting CFG params\n");
@@ -932,7 +949,7 @@ static s32 Handle_Scan(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
u32WidsCount,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
@@ -977,7 +994,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,
wid.size = sizeof(char);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to set abort running scan\n");
@@ -1234,7 +1251,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
u32WidsCount,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("failed to send config packet\n");
result = -EFAULT;
@@ -1395,7 +1412,7 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send dissconect config packet\n");

@@ -1781,7 +1798,7 @@ static int Handle_Key(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
strWIDList, 4,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
@@ -1803,7 +1820,7 @@ static int Handle_Key(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
&wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & REMOVEKEY) {
PRINT_D(HOSTINF_DBG, "Removing key\n");
@@ -1816,7 +1833,7 @@ static int Handle_Key(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
&wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
} else {
wid.id = (u16)WID_KEY_ID;
wid.type = WID_CHAR;
@@ -1827,7 +1844,7 @@ static int Handle_Key(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
&wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
}
up(&hif_drv->sem_test_key_block);
break;
@@ -1861,7 +1878,7 @@ static int Handle_Key(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
strWIDList, 2,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
@@ -1893,7 +1910,7 @@ static int Handle_Key(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
&wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
@@ -1933,7 +1950,7 @@ _WPARxGtk_end_case_:

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
strWIDList, 2,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
} else if (pstrHostIFkeyAttr->action & ADDKEY) {
@@ -1956,7 +1973,7 @@ _WPARxGtk_end_case_:

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG,
&wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
}
@@ -1991,7 +2008,7 @@ _WPAPtk_end_case_:
wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

kfree(pu8keybuf);
break;
@@ -2024,7 +2041,7 @@ static void Handle_Disconnect(struct wilc_vif *vif)
eth_zero_addr(wilc_connected_ssid);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to send dissconect config packet\n");
@@ -2112,7 +2129,7 @@ static s32 Handle_GetChnl(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, "Getting channel value\n");

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to get channel number\n");
@@ -2137,7 +2154,7 @@ static void Handle_GetRssi(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");

result = wilc_send_config_pkt(vif->hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(vif->hif_drv));
+ wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to get RSSI value\n");
result = -EFAULT;
@@ -2162,7 +2179,7 @@ static void Handle_GetLinkspeed(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to get LINKSPEED value\n");
result = -EFAULT;
@@ -2210,7 +2227,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, strWIDList,
u32WidsCount,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
@@ -2238,7 +2255,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to SET incative time\n");
@@ -2251,7 +2268,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
wid.size = sizeof(u32);

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));

if (result) {
PRINT_ER("Failed to get incative time\n");
@@ -2311,7 +2328,7 @@ static void Handle_AddBeacon(struct wilc_vif *vif,
pu8CurrByte += pstrSetBeaconParam->tail_len;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add beacon config packet\n");

@@ -2341,7 +2358,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, "Deleting BEACON\n");

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send delete beacon config packet\n");
}
@@ -2415,7 +2432,7 @@ static void Handle_AddStation(struct wilc_vif *vif,
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result != 0)
PRINT_ER("Failed to send add station config packet\n");

@@ -2458,7 +2475,7 @@ static void Handle_DelAllSta(struct wilc_vif *vif,
}

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add station config packet\n");

@@ -2491,7 +2508,7 @@ static void Handle_DelStation(struct wilc_vif *vif,
memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add station config packet\n");

@@ -2520,7 +2537,7 @@ static void Handle_EditStation(struct wilc_vif *vif,
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send edit station config packet\n");

@@ -2582,7 +2599,7 @@ static int Handle_RemainOnChan(struct wilc_vif *vif,
wid.val[1] = (s8)pstrHostIfRemainOnChan->ch;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result != 0)
PRINT_ER("Failed to set remain on channel\n");

@@ -2631,7 +2648,7 @@ static int Handle_RegisterFrame(struct wilc_vif *vif,
wid.size = sizeof(u16) + 2;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to frame register config packet\n");
result = -EINVAL;
@@ -2666,7 +2683,7 @@ static u32 Handle_ListenStateExpired(struct wilc_vif *vif,
wid.val[1] = FALSE_FRMWR_CHANNEL;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result != 0) {
PRINT_ER("Failed to set remain on channel\n");
goto _done_;
@@ -2725,7 +2742,7 @@ static void Handle_PowerManagement(struct wilc_vif *vif,
PRINT_D(HOSTINF_DBG, "Handling Power Management\n");

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send power management config packet\n");
}
@@ -2763,7 +2780,7 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif,
((strHostIfSetMulti->cnt) * ETH_ALEN));

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send setup multicast config packet\n");

@@ -2800,7 +2817,7 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
*ptr++ = 32;

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");

@@ -3558,7 +3575,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
wid.size = u32MaxAssocRespInfoLen;

result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
+ wilc_get_vif_idx(vif));
if (result) {
*pu32RcvdAssocRespInfoLen = 0;
PRINT_ER("Failed to send association response config packet\n");
@@ -4028,9 +4045,13 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
struct host_if_msg msg;
int id;
struct host_if_drv *hif_drv = NULL;
+ struct wilc_vif *vif;

id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
- hif_drv = get_handler_from_id(id);
+ vif = wilc_get_vif_from_idx(wilc, id);
+ if (!vif)
+ return;
+ hif_drv = vif->hif_drv;

if (!hif_drv || hif_drv == terminated_handle) {
PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv);
@@ -4041,6 +4062,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,

msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO;
msg.drv = hif_drv;
+ msg.vif = vif;

msg.body.net_info.len = u32Length;
msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL);
@@ -4058,11 +4080,18 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
struct host_if_msg msg;
int id;
struct host_if_drv *hif_drv = NULL;
+ struct wilc_vif *vif;

down(&hif_sema_deinit);

id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
- hif_drv = get_handler_from_id(id);
+ vif = wilc_get_vif_from_idx(wilc, id);
+ if (!vif) {
+ up(&hif_sema_deinit);
+ return;
+ }
+
+ hif_drv = vif->hif_drv;
PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n");

if (!hif_drv || hif_drv == terminated_handle) {
@@ -4081,6 +4110,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,

msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO;
msg.drv = hif_drv;
+ msg.vif = vif;

msg.body.async_info.len = u32Length;
msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL);
@@ -4100,9 +4130,13 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
struct host_if_msg msg;
int id;
struct host_if_drv *hif_drv = NULL;
+ struct wilc_vif *vif;

id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
- hif_drv = get_handler_from_id(id);
+ vif = wilc_get_vif_from_idx(wilc, id);
+ if (!vif)
+ return;
+ hif_drv = vif->hif_drv;

PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv);

@@ -4114,6 +4148,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,

msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
--
1.9.1


2015-12-14 05:43:24

by Glen Lee

[permalink] [raw]
Subject: [PATCH 01/12] staging: wilc1000: pass vif to hostIFthread

We will pass vif, which is currently being used as net_device, instead of
hif_dev. This is the first step to use index of vif to pass to the driver.
Add new argument vif to all the functions that send message to hostIFthread and
set vif to msg.vif. As a result, hostIfthread will get vif.
In later patch, we will remove drv of host_if_msg and use vif instead of it.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 235 ++++++++++++++--------
drivers/staging/wilc1000/host_interface.h | 165 +++++++--------
drivers/staging/wilc1000/linux_wlan.c | 22 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 166 ++++++++-------
4 files changed, 342 insertions(+), 246 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index f7e560e..c52a8e1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -194,6 +194,7 @@ struct host_if_msg {
u16 id;
union message_body body;
struct host_if_drv *drv;
+ struct wilc_vif *vif;
};

struct join_bss_param {
@@ -389,9 +390,13 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv,
return result;
}

-static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx);
+static s32 host_int_get_ipaddress(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ u8 *u16ipadd, u8 idx);

-static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
+static s32 handle_set_ip_address(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u8 *ip_addr,
+ u8 idx)
{
s32 result = 0;
struct wid wid;
@@ -413,7 +418,7 @@ static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 id
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

- host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx);
+ host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx);

if (result) {
PRINT_ER("Failed to set IP address\n");
@@ -425,7 +430,8 @@ static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 id
return result;
}

-static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u8 idx)
{
s32 result = 0;
struct wid wid;
@@ -445,7 +451,7 @@ static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
kfree(wid.val);

if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
- wilc_setup_ipaddress(hif_drv, set_ip[idx], idx);
+ wilc_setup_ipaddress(vif, hif_drv, set_ip[idx], idx);

if (result != 0) {
PRINT_ER("Failed to get IP address\n");
@@ -1490,7 +1496,8 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
u32 u32MaxAssocRespInfoLen,
u32 *pu32RcvdAssocRespInfoLen);

-static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
+static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
{
s32 result = 0;
@@ -1619,7 +1626,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,

if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- wilc_set_power_mgmt(hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, hif_drv, 0, 0);

PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n");
hif_drv->hif_state = HOST_IF_CONNECTED;
@@ -1662,7 +1669,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,

if (hif_drv->usr_conn_req.conn_result) {
wilc_optaining_ip = false;
- wilc_set_power_mgmt(hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, hif_drv, 0, 0);

hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
NULL,
@@ -1984,7 +1991,8 @@ _WPAPtk_end_case_:
return result;
}

-static void Handle_Disconnect(struct host_if_drv *hif_drv)
+static void Handle_Disconnect(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv)
{
struct wid wid;

@@ -1999,7 +2007,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");

wilc_optaining_ip = false;
- wilc_set_power_mgmt(hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, hif_drv, 0, 0);

eth_zero_addr(wilc_connected_ssid);

@@ -2067,14 +2075,15 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
up(&hif_drv->sem_test_disconn_block);
}

-void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv)
+void wilc_resolve_disconnect_aberration(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv)
{
if (!hif_drv)
return;
if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
(hif_drv->hif_state == HOST_IF_CONNECTING)) {
PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n");
- wilc_disconnect(hif_drv, 1);
+ wilc_disconnect(vif, hif_drv, 1);
}
}

@@ -2780,12 +2789,14 @@ static int hostIFthread(void *pvArg)
struct host_if_msg msg;
struct host_if_drv *hif_drv;
struct wilc *wilc = (struct wilc*)pvArg;
+ struct wilc_vif *vif;

memset(&msg, 0, sizeof(struct host_if_msg));

while (1) {
wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), &u32Ret);
hif_drv = (struct host_if_drv *)msg.drv;
+ vif = msg.vif;
if (msg.id == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
break;
@@ -2828,7 +2839,8 @@ static int hostIFthread(void *pvArg)
break;

case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO:
- Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info);
+ Handle_RcvdGnrlAsyncInfo(vif, msg.drv,
+ &msg.body.async_info);
break;

case HOST_IF_MSG_KEY:
@@ -2844,7 +2856,7 @@ static int hostIFthread(void *pvArg)
break;

case HOST_IF_MSG_DISCONNECT:
- Handle_Disconnect(msg.drv);
+ Handle_Disconnect(vif, msg.drv);
break;

case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
@@ -2926,14 +2938,15 @@ static int hostIFthread(void *pvArg)

case HOST_IF_MSG_SET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
- handle_set_ip_address(msg.drv,
+ handle_set_ip_address(vif, msg.drv,
msg.body.ip_info.ip_addr,
msg.body.ip_info.idx);
break;

case HOST_IF_MSG_GET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
- handle_get_ip_address(msg.drv, msg.body.ip_info.idx);
+ handle_get_ip_address(vif, msg.drv,
+ msg.body.ip_info.idx);
break;

case HOST_IF_MSG_SET_MAC_ADDRESS:
@@ -3020,7 +3033,8 @@ s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
return 0;
}

-int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
+int wilc_remove_wep_key(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u8 index)
{
int result = 0;
struct host_if_msg msg;
@@ -3037,6 +3051,7 @@ int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
msg.body.key_info.type = WEP;
msg.body.key_info.action = REMOVEKEY;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.key_info.attr.wep.index = index;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3047,7 +3062,8 @@ int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
return result;
}

-int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index)
+int wilc_set_wep_default_keyid(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u8 index)
{
int result = 0;
struct host_if_msg msg;
@@ -3064,6 +3080,7 @@ int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index)
msg.body.key_info.type = WEP;
msg.body.key_info.action = DEFAULTKEY;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.key_info.attr.wep.index = index;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3074,10 +3091,8 @@ int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index)
return result;
}

-int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
- const u8 *key,
- u8 len,
- u8 index)
+int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *key, u8 len, u8 index)
{
int result = 0;
struct host_if_msg msg;
@@ -3093,6 +3108,7 @@ int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
if (!msg.body.key_info.attr.wep.key)
return -ENOMEM;
@@ -3108,11 +3124,8 @@ int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
return result;
}

-int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
- const u8 *key,
- u8 len,
- u8 index,
- u8 mode,
+int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *key, u8 len, u8 index, u8 mode,
enum AUTHTYPE auth_type)
{
int result = 0;
@@ -3134,6 +3147,7 @@ int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY_AP;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
if (!msg.body.key_info.attr.wep.key)
return -ENOMEM;
@@ -3152,10 +3166,10 @@ int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
- u8 u8PtkKeylen, const u8 *mac_addr,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
- u8 mode, u8 u8Ciphermode, u8 u8Idx)
+s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode, u8 u8Idx)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3206,6 +3220,7 @@ s32 wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
msg.body.key_info.attr.wpa.mac_addr = mac_addr;
msg.body.key_info.attr.wpa.mode = u8Ciphermode;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));

@@ -3217,11 +3232,11 @@ s32 wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
return result;
}

-s32 wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
- u8 u8GtkKeylen, u8 u8KeyIdx,
- u32 u32KeyRSClen, const u8 *KeyRSC,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
- u8 mode, u8 u8Ciphermode)
+s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx,
+ u32 u32KeyRSClen, const u8 *KeyRSC,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3247,6 +3262,7 @@ s32 wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WPA_RX_GTK;
msg.drv = hif_drv;
+ msg.vif = vif;

if (mode == AP_MODE) {
msg.body.key_info.action = ADDKEY_AP;
@@ -3279,7 +3295,8 @@ s32 wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
return result;
}

-s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
+s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ struct host_if_pmkid_attr *pu8PmkidInfoArray)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3296,6 +3313,7 @@ s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *
msg.body.key_info.type = PMKSA;
msg.body.key_info.action = ADDKEY;
msg.drv = hif_drv;
+ msg.vif = vif;

for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) {
memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid,
@@ -3311,7 +3329,8 @@ s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *
return result;
}

-s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
+s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3321,6 +3340,7 @@ s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
msg.id = HOST_IF_MSG_GET_MAC_ADDRESS;
msg.body.get_mac_info.mac_addr = pu8MacAddress;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3332,7 +3352,8 @@ s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
return result;
}

-s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
+s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3343,6 +3364,7 @@ s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
msg.id = HOST_IF_MSG_SET_MAC_ADDRESS;
memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN);
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
@@ -3363,12 +3385,12 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
return 0;
}

-s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
- const u8 *pu8ssid, size_t ssidLen,
- const u8 *pu8IEs, size_t IEsLen,
- wilc_connect_result pfConnectResult, void *pvUserArg,
- u8 u8security, enum AUTHTYPE tenuAuth_type,
- u8 u8channel, void *pJoinParams)
+s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen,
+ const u8 *pu8IEs, size_t IEsLen,
+ wilc_connect_result pfConnectResult, void *pvUserArg,
+ u8 u8security, enum AUTHTYPE tenuAuth_type,
+ u8 u8channel, void *pJoinParams)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3394,6 +3416,7 @@ s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
msg.body.con_info.arg = pvUserArg;
msg.body.con_info.params = pJoinParams;
msg.drv = hif_drv ;
+ msg.vif = vif;

if (pu8bssid) {
msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL);
@@ -3430,7 +3453,7 @@ s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
return result;
}

-s32 wilc_flush_join_req(struct host_if_drv *hif_drv)
+s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3445,6 +3468,7 @@ s32 wilc_flush_join_req(struct host_if_drv *hif_drv)

msg.id = HOST_IF_MSG_FLUSH_CONNECT;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3455,7 +3479,8 @@ s32 wilc_flush_join_req(struct host_if_drv *hif_drv)
return result;
}

-s32 wilc_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
+s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u16 u16ReasonCode)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3469,6 +3494,7 @@ s32 wilc_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)

msg.id = HOST_IF_MSG_DISCONNECT;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
@@ -3510,7 +3536,8 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
return result;
}

-int wilc_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
+int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 channel)
{
int result;
struct host_if_msg msg;
@@ -3524,6 +3551,7 @@ int wilc_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
msg.id = HOST_IF_MSG_SET_CHANNEL;
msg.body.channel_info.set_ch = channel;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3552,7 +3580,7 @@ int wilc_wait_msg_queue_idle(void)
return result;
}

-int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv)
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv)
{
int result = 0;
struct host_if_msg msg;
@@ -3561,6 +3589,7 @@ int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv)
msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
msg.body.drv.handler = get_id_from_handler(hif_drv);
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3571,7 +3600,8 @@ int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv)
return result;
}

-int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
+int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u32 mode)
{
int result = 0;
struct host_if_msg msg;
@@ -3580,6 +3610,7 @@ int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
msg.id = HOST_IF_MSG_SET_OPERATION_MODE;
msg.body.mode.mode = mode;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3590,7 +3621,7 @@ int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
return result;
}

-s32 wilc_get_inactive_time(struct host_if_drv *hif_drv,
+s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv,
const u8 *mac, u32 *pu32InactiveTime)
{
s32 result = 0;
@@ -3606,6 +3637,7 @@ s32 wilc_get_inactive_time(struct host_if_drv *hif_drv,

msg.id = HOST_IF_MSG_GET_INACTIVETIME;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
@@ -3618,7 +3650,8 @@ s32 wilc_get_inactive_time(struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
+s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ s8 *ps8Rssi)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3626,6 +3659,7 @@ s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_GET_RSSI;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3645,7 +3679,8 @@ s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
return result;
}

-s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ struct rf_info *pstrStatistics)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3654,6 +3689,7 @@ s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatist
msg.id = HOST_IF_MSG_GET_STATISTICS;
msg.body.data = (char *)pstrStatistics;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result) {
@@ -3665,11 +3701,11 @@ s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatist
return result;
}

-s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
- u8 u8ScanType, u8 *pu8ChnlFreqList,
- u8 u8ChnlListLen, const u8 *pu8IEs,
- size_t IEsLen, wilc_scan_result ScanResult,
- void *pvUserArg, struct hidden_network *pstrHiddenNetwork)
+s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList,
+ u8 u8ChnlListLen, const u8 *pu8IEs,
+ size_t IEsLen, wilc_scan_result ScanResult,
+ void *pvUserArg, struct hidden_network *pstrHiddenNetwork)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3691,6 +3727,7 @@ s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n");

msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.scan_info.src = u8ScanSource;
msg.body.scan_info.type = u8ScanType;
msg.body.scan_info.result = ScanResult;
@@ -3718,7 +3755,7 @@ s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
return result;
}

-s32 wilc_hif_set_cfg(struct host_if_drv *hif_drv,
+s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv,
struct cfg_param_val *pstrCfgParamVal)
{
s32 result = 0;
@@ -3733,6 +3770,7 @@ s32 wilc_hif_set_cfg(struct host_if_drv *hif_drv,
msg.id = HOST_IF_MSG_CFG_PARAMS;
msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));

@@ -3875,7 +3913,7 @@ _fail_:
return result;
}

-s32 wilc_deinit(struct host_if_drv *hif_drv)
+s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3902,7 +3940,7 @@ s32 wilc_deinit(struct host_if_drv *hif_drv)

del_timer_sync(&hif_drv->remain_on_ch_timer);

- wilc_set_wfi_drv_handler(NULL);
+ wilc_set_wfi_drv_handler(vif, NULL);
down(&hif_sema_driver);

if (hif_drv->usr_scan_req.scan_result) {
@@ -3923,6 +3961,7 @@ s32 wilc_deinit(struct host_if_drv *hif_drv)

msg.id = HOST_IF_MSG_EXIT;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result != 0)
@@ -4044,11 +4083,11 @@ void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length)
return;
}

-s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
- u32 u32duration, u16 chan,
- wilc_remain_on_chan_expired RemainOnChanExpired,
- wilc_remain_on_chan_ready RemainOnChanReady,
- void *pvUserArg)
+s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u32 u32SessionID, u32 u32duration, u16 chan,
+ wilc_remain_on_chan_expired RemainOnChanExpired,
+ wilc_remain_on_chan_ready RemainOnChanReady,
+ void *pvUserArg)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4068,6 +4107,7 @@ s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
msg.body.remain_on_ch.u32duration = u32duration;
msg.body.remain_on_ch.id = u32SessionID;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
@@ -4076,7 +4116,8 @@ s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
return result;
}

-s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID)
+s32 wilc_listen_state_expired(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u32 u32SessionID)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4091,6 +4132,7 @@ s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID)
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.remain_on_ch.id = u32SessionID;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4100,7 +4142,8 @@ s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID)
return result;
}

-s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
+s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u16 u16FrameType, bool bReg)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4131,6 +4174,7 @@ s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg
msg.body.reg_frame.frame_type = u16FrameType;
msg.body.reg_frame.reg = bReg;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
@@ -4139,9 +4183,10 @@ s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg
return result;
}

-s32 wilc_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
- u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
- u32 u32TailLen, u8 *pu8Tail)
+s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u32 u32Interval,
+ u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
+ u32 u32TailLen, u8 *pu8Tail)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4158,6 +4203,7 @@ s32 wilc_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,

msg.id = HOST_IF_MSG_ADD_BEACON;
msg.drv = hif_drv;
+ msg.vif = vif;
pstrSetBeaconParam->interval = u32Interval;
pstrSetBeaconParam->dtim_period = u32DTIMPeriod;
pstrSetBeaconParam->head_len = u32HeadLen;
@@ -4193,7 +4239,7 @@ ERRORHANDLER:
return result;
}

-int wilc_del_beacon(struct host_if_drv *hif_drv)
+int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv)
{
int result = 0;
struct host_if_msg msg;
@@ -4205,6 +4251,7 @@ int wilc_del_beacon(struct host_if_drv *hif_drv)

msg.id = HOST_IF_MSG_DEL_BEACON;
msg.drv = hif_drv;
+ msg.vif = vif;
PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n");

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4214,7 +4261,7 @@ int wilc_del_beacon(struct host_if_drv *hif_drv)
return result;
}

-int wilc_add_station(struct host_if_drv *hif_drv,
+int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
struct add_sta_param *sta_param)
{
int result = 0;
@@ -4232,6 +4279,7 @@ int wilc_add_station(struct host_if_drv *hif_drv,

msg.id = HOST_IF_MSG_ADD_STATION;
msg.drv = hif_drv;
+ msg.vif = vif;

memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
if (add_sta_info->rates_len > 0) {
@@ -4248,7 +4296,8 @@ int wilc_add_station(struct host_if_drv *hif_drv,
return result;
}

-int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
+int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *mac_addr)
{
int result = 0;
struct host_if_msg msg;
@@ -4265,6 +4314,7 @@ int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)

msg.id = HOST_IF_MSG_DEL_STATION;
msg.drv = hif_drv;
+ msg.vif = vif;

if (!mac_addr)
eth_broadcast_addr(del_sta_info->mac_addr);
@@ -4277,7 +4327,7 @@ int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
return result;
}

-s32 wilc_del_allstation(struct host_if_drv *hif_drv,
+s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv,
u8 pu8MacAddr[][ETH_ALEN])
{
s32 result = 0;
@@ -4298,6 +4348,7 @@ s32 wilc_del_allstation(struct host_if_drv *hif_drv,

msg.id = HOST_IF_MSG_DEL_ALL_STA;
msg.drv = hif_drv;
+ msg.vif = vif;

for (i = 0; i < MAX_NUM_STA; i++) {
if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) {
@@ -4328,7 +4379,7 @@ s32 wilc_del_allstation(struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_edit_station(struct host_if_drv *hif_drv,
+s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
struct add_sta_param *pstrStaParams)
{
s32 result = 0;
@@ -4346,6 +4397,7 @@ s32 wilc_edit_station(struct host_if_drv *hif_drv,

msg.id = HOST_IF_MSG_EDIT_STATION;
msg.drv = hif_drv;
+ msg.vif = vif;

memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
if (pstrAddStationMsg->rates_len > 0) {
@@ -4366,9 +4418,8 @@ s32 wilc_edit_station(struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv,
- bool bIsEnabled,
- u32 u32Timeout)
+s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ bool bIsEnabled, u32 u32Timeout)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4387,6 +4438,7 @@ s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv,

msg.id = HOST_IF_MSG_POWER_MGMT;
msg.drv = hif_drv;
+ msg.vif = vif;

pstrPowerMgmtParam->enabled = bIsEnabled;
pstrPowerMgmtParam->timeout = u32Timeout;
@@ -4397,9 +4449,10 @@ s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_setup_multicast_filter(struct host_if_drv *hif_drv,
- bool bIsEnabled,
- u32 u32count)
+s32 wilc_setup_multicast_filter(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ bool bIsEnabled,
+ u32 u32count)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4416,6 +4469,7 @@ s32 wilc_setup_multicast_filter(struct host_if_drv *hif_drv,

msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER;
msg.drv = hif_drv;
+ msg.vif = vif;

pstrMulticastFilterParam->enabled = bIsEnabled;
pstrMulticastFilterParam->cnt = u32count;
@@ -4591,9 +4645,10 @@ void wilc_free_join_params(void *pJoinParams)
PRINT_ER("Unable to FREE null pointer\n");
}

-s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv,
- char *pBSSID,
- char TID)
+s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ char *pBSSID,
+ char TID)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4611,6 +4666,7 @@ s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv,
memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN);
pBASessionInfo->tid = TID;
msg.drv = hif_drv;
+ msg.vif = vif;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
if (result)
@@ -4621,7 +4677,8 @@ s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *u16ipadd, u8 idx)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4639,6 +4696,7 @@ s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)

msg.body.ip_info.ip_addr = u16ipadd;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.ip_info.idx = idx;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4648,7 +4706,9 @@ s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
return result;
}

-static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+static s32 host_int_get_ipaddress(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ u8 *u16ipadd, u8 idx)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4664,6 +4724,7 @@ static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8

msg.body.ip_info.ip_addr = u16ipadd;
msg.drv = hif_drv;
+ msg.vif = vif;
msg.body.ip_info.idx = idx;

result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 4f5300d..ccbbe73 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -305,97 +305,104 @@ struct add_sta_param {
u16 flags_set;
};

+struct wilc_vif;
s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
-int wilc_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
-int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index);
-int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
- const u8 *key, u8 len, u8 index);
-int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
- const u8 *key, u8 len, u8 index, u8 mode,
- enum AUTHTYPE auth_type);
-s32 wilc_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk,
- u8 u8PtkKeylen, const u8 *mac_addr,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
- u8 mode, u8 u8Ciphermode, u8 u8Idx);
-s32 wilc_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac,
- u32 *pu32InactiveTime);
-s32 wilc_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk,
- u8 u8GtkKeylen, u8 u8KeyIdx,
- u32 u32KeyRSClen, const u8 *KeyRSC,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
- u8 mode, u8 u8Ciphermode);
+int wilc_remove_wep_key(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u8 index);
+int wilc_set_wep_default_keyid(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u8 index);
+int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *key, u8 len, u8 index);
+int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *key, u8 len, u8 index, u8 mode,
+ enum AUTHTYPE auth_type);
+s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode, u8 u8Idx);
+s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *mac, u32 *pu32InactiveTime);
+s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx,
+ u32 u32KeyRSClen, const u8 *KeyRSC,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode);
s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen,
u8 *pu8TxGtk, u8 u8KeyIdx);
-s32 wilc_set_pmkid_info(struct host_if_drv *hWFIDrv,
- struct host_if_pmkid_attr *pu8PmkidInfoArray);
-s32 wilc_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
-s32 wilc_set_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
+s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ struct host_if_pmkid_attr *pu8PmkidInfoArray);
+s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *pu8MacAddress);
+s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *pu8MacAddress);
int wilc_wait_msg_queue_idle(void);
s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
-s32 wilc_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
- const u8 *pu8ssid, size_t ssidLen,
- const u8 *pu8IEs, size_t IEsLen,
- wilc_connect_result pfConnectResult, void *pvUserArg,
- u8 u8security, enum AUTHTYPE tenuAuth_type,
- u8 u8channel, void *pJoinParams);
-s32 wilc_flush_join_req(struct host_if_drv *hWFIDrv);
-s32 wilc_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
-int wilc_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
-s32 wilc_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
-s32 wilc_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
- u8 u8ScanType, u8 *pu8ChnlFreqList,
- u8 u8ChnlListLen, const u8 *pu8IEs,
- size_t IEsLen, wilc_scan_result ScanResult,
- void *pvUserArg, struct hidden_network *pstrHiddenNetwork);
-s32 wilc_hif_set_cfg(struct host_if_drv *hWFIDrv,
+s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen,
+ const u8 *pu8IEs, size_t IEsLen,
+ wilc_connect_result pfConnectResult, void *pvUserArg,
+ u8 u8security, enum AUTHTYPE tenuAuth_type,
+ u8 u8channel, void *pJoinParams);
+s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv);
+s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u16 u16ReasonCode);
+int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 channel);
+s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ s8 *ps8Rssi);
+s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList,
+ u8 u8ChnlListLen, const u8 *pu8IEs,
+ size_t IEsLen, wilc_scan_result ScanResult,
+ void *pvUserArg, struct hidden_network *pstrHiddenNetwork);
+s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv,
struct cfg_param_val *pstrCfgParamVal);
s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
-s32 wilc_deinit(struct host_if_drv *hWFIDrv);
-s32 wilc_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
- u32 u32DTIMPeriod,
- u32 u32HeadLen,
- u8 *pu8Head,
- u32 u32TailLen,
- u8 *pu8tail);
-int wilc_del_beacon(struct host_if_drv *hif_drv);
-int wilc_add_station(struct host_if_drv *hif_drv,
- struct add_sta_param *sta_param);
-s32 wilc_del_allstation(struct host_if_drv *hWFIDrv,
+s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv);
+s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u32 u32Interval,
+ u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
+ u32 u32TailLen, u8 *pu8Tail);
+int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv);
+int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ struct add_sta_param *sta_param);
+s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv,
u8 pu8MacAddr[][ETH_ALEN]);
-int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr);
-s32 wilc_edit_station(struct host_if_drv *hWFIDrv,
+int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ const u8 *mac_addr);
+s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
struct add_sta_param *pstrStaParams);
-s32 wilc_set_power_mgmt(struct host_if_drv *hWFIDrv,
- bool bIsEnabled,
- u32 u32Timeout);
-s32 wilc_setup_multicast_filter(struct host_if_drv *hWFIDrv,
- bool bIsEnabled,
- u32 u32count);
-s32 wilc_setup_ipaddress(struct host_if_drv *hWFIDrv,
- u8 *pu8IPAddr,
- u8 idx);
-s32 wilc_del_all_rx_ba_session(struct host_if_drv *hWFIDrv,
- char *pBSSID,
- char TID);
-s32 wilc_remain_on_channel(struct host_if_drv *hWFIDrv,
- u32 u32SessionID,
- u32 u32duration,
- u16 chan,
- wilc_remain_on_chan_expired RemainOnChanExpired,
- wilc_remain_on_chan_ready RemainOnChanReady,
- void *pvUserArg);
-s32 wilc_listen_state_expired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
-s32 wilc_frame_register(struct host_if_drv *hWFIDrv,
- u16 u16FrameType,
- bool bReg);
-int wilc_set_wfi_drv_handler(struct host_if_drv *address);
-int wilc_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
+s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ bool bIsEnabled, u32 u32Timeout);
+s32 wilc_setup_multicast_filter(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ bool bIsEnabled,
+ u32 u32count);
+s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u8 *u16ipadd, u8 idx);
+s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ char *pBSSID,
+ char TID);
+s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u32 u32SessionID, u32 u32duration, u16 chan,
+ wilc_remain_on_chan_expired RemainOnChanExpired,
+ wilc_remain_on_chan_ready RemainOnChanReady,
+ void *pvUserArg);
+s32 wilc_listen_state_expired(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv, u32 u32SessionID);
+s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u16 u16FrameType, bool bReg);
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv);
+int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ u32 mode);

void wilc_free_join_params(void *pJoinParams);

-s32 wilc_get_statistics(struct host_if_drv *hWFIDrv,
- struct rf_info *pstrStatistics);
-void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv);
+s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+ struct rf_info *pstrStatistics);
+void wilc_resolve_disconnect_aberration(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv);

extern bool wilc_optaining_ip;
extern u8 wilc_connected_ssid[6];
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index bb3ff49..6074996 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -112,7 +112,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
}

if (wilc_enable_ps)
- wilc_set_power_mgmt(hif_drv, 1, 0);
+ wilc_set_power_mgmt(vif, hif_drv, 1, 0);

PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);

@@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
- wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx);

break;

@@ -134,9 +134,9 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
}

if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0)
- wilc_set_power_mgmt(hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, hif_drv, 0, 0);

- wilc_resolve_disconnect_aberration(hif_drv);
+ wilc_resolve_disconnect_aberration(vif, hif_drv);

PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);

@@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);

- wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx);

break;

@@ -1030,7 +1030,7 @@ int wilc_mac_open(struct net_device *ndev)

wilc_set_machw_change_vir_if(ndev, false);

- wilc_get_mac_address(priv->hWILCWFIDrv, mac_add);
+ wilc_get_mac_address(vif, priv->hWILCWFIDrv, mac_add);
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);

for (i = 0; i < wl->vif_num; i++) {
@@ -1076,9 +1076,11 @@ static void wilc_set_multicast_list(struct net_device *dev)
struct netdev_hw_addr *ha;
struct wilc_priv *priv;
struct host_if_drv *hif_drv;
+ struct wilc_vif *vif;
int i = 0;

priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
+ vif = netdev_priv(dev);
hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;

if (!dev)
@@ -1095,13 +1097,13 @@ static void wilc_set_multicast_list(struct net_device *dev)
if ((dev->flags & IFF_ALLMULTI) ||
(dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
- wilc_setup_multicast_filter(hif_drv, false, 0);
+ wilc_setup_multicast_filter(vif, hif_drv, false, 0);
return;
}

if ((dev->mc.count) == 0) {
PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
- wilc_setup_multicast_filter(hif_drv, true, 0);
+ wilc_setup_multicast_filter(vif, hif_drv, true, 0);
return;
}

@@ -1117,7 +1119,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
i++;
}

- wilc_setup_multicast_filter(hif_drv, true, (dev->mc.count));
+ wilc_setup_multicast_filter(vif, hif_drv, true, (dev->mc.count));

return;
}
@@ -1289,7 +1291,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)

if (strncasecmp(buff, "RSSI", length) == 0) {
priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
- ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi);
+ ret = wilc_get_rssi(vif, priv->hWILCWFIDrv, &rssi);
if (ret)
PRINT_ER("Failed to send get rssi param's message queue ");
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 87f8d0d..309a0cc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -595,14 +595,16 @@ static int set_channel(struct wiphy *wiphy,
u32 channelnum = 0;
struct wilc_priv *priv;
int result = 0;
+ struct wilc_vif *vif;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq);
PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);

curr_channel = channelnum;
- result = wilc_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+ result = wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, channelnum);

if (result != 0)
PRINT_ER("Error in setting channel %d\n", channelnum);
@@ -617,14 +619,16 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
s32 s32Error = 0;
u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
struct hidden_network strHiddenNetwork;
+ struct wilc_vif *vif;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

priv->pstrScanReq = request;

priv->u32RcvdChCount = 0;

- wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
+ wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
reset_shadow_found();

priv->bCfgScanning = true;
@@ -656,13 +660,13 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
}
}
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+ s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList, request->n_channels,
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, &strHiddenNetwork);
} else {
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+ s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList, request->n_channels,
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, NULL);
@@ -694,13 +698,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
struct wilc_priv *priv;
struct host_if_drv *pstrWFIDrv;
tstrNetworkInfo *pstrNetworkInfo = NULL;
-
+ struct wilc_vif *vif;

wilc_connecting = 1;
priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);
pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);

- wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
+ wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);

PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
@@ -787,8 +792,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;

- wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
- wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx);
+ wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
pcgroup_encrypt_val = "WEP104";
@@ -804,8 +809,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;

- wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
- wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx);
+ wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) {
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
@@ -890,7 +895,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,

wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);

- s32Error = wilc_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
+ s32Error = wilc_set_join_req(vif, priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
CfgConnectResult, (void *)priv, u8security,
tenuAuth_type, pstrNetworkInfo->u8channel,
@@ -911,10 +916,12 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
s32 s32Error = 0;
struct wilc_priv *priv;
struct host_if_drv *pstrWFIDrv;
+ struct wilc_vif *vif;
u8 NullBssid[ETH_ALEN] = {0};

wilc_connecting = 0;
priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (!pstrWFIDrv->p2p_connect)
@@ -928,7 +935,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
wilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;

- s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code);
+ s32Error = wilc_disconnect(vif, priv->hWILCWFIDrv, reason_code);
if (s32Error != 0) {
PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
s32Error = -EINVAL;
@@ -988,7 +995,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
else
u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

- wilc_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
+ wilc_add_wep_key_bss_ap(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
break;
}
if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
@@ -1002,7 +1009,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
for (i = 0; i < params->key_len; i++)
PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]);
}
- wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index);
+ wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index);
}

break;
@@ -1059,7 +1066,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}


- wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+ wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode);

} else {
@@ -1103,7 +1110,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
priv->wilc_ptk[key_index]->key_len = params->key_len;
priv->wilc_ptk[key_index]->seq_len = params->seq_len;

- wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+ wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index);
}
break;
@@ -1143,7 +1150,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
g_gtk_keys_saved = true;
}

- wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+ wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode);
} else {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -1177,7 +1184,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
g_ptk_keys_saved = true;
}

- wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+ wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index);
PRINT_D(CFG80211_DBG, "Adding pairwise key\n");
if (INFO) {
@@ -1254,7 +1261,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv->WILC_WFI_wep_key_len[key_index] = 0;

PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index);
- wilc_remove_wep_key(priv->hWILCWFIDrv, key_index);
+ wilc_remove_wep_key(vif, priv->hWILCWFIDrv, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
@@ -1305,14 +1312,15 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke
bool unicast, bool multicast)
{
struct wilc_priv *priv;
-
+ struct wilc_vif *vif;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index);

if (key_index != priv->WILC_WFI_wep_default) {
- wilc_set_wep_default_keyid(priv->hWILCWFIDrv, key_index);
+ wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, key_index);
}

return 0;
@@ -1348,7 +1356,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,

sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);

- wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
+ wilc_get_inactive_time(vif, priv->hWILCWFIDrv, mac, &(inactive_time));
sinfo->inactive_time = 1000 * inactive_time;
PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);
}
@@ -1356,7 +1364,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
if (vif->iftype == STATION_MODE) {
struct rf_info strStatistics;

- wilc_get_statistics(priv->hWILCWFIDrv, &strStatistics);
+ wilc_get_statistics(vif, priv->hWILCWFIDrv, &strStatistics);

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
BIT(NL80211_STA_INFO_RX_PACKETS) |
@@ -1394,8 +1402,10 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
s32 s32Error = 0;
struct cfg_param_val pstrCfgParamVal;
struct wilc_priv *priv;
+ struct wilc_vif *vif;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

pstrCfgParamVal.flag = 0;
PRINT_D(CFG80211_DBG, "Setting Wiphy params\n");
@@ -1425,7 +1435,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
}

PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n");
- s32Error = wilc_hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal);
+ s32Error = wilc_hif_set_cfg(vif, priv->hWILCWFIDrv, &pstrCfgParamVal);
if (s32Error)
PRINT_ER("Error in setting WIPHY PARAMS\n");

@@ -1439,9 +1449,10 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
u32 i;
s32 s32Error = 0;
u8 flag = 0;
-
+ struct wilc_vif *vif;
struct wilc_priv *priv = wiphy_priv(wiphy);

+ vif = netdev_priv(priv->dev);
PRINT_D(CFG80211_DBG, "Setting PMKSA\n");


@@ -1468,7 +1479,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,

if (!s32Error) {
PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n");
- s32Error = wilc_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
+ s32Error = wilc_set_pmkid_info(vif, priv->hWILCWFIDrv, &priv->pmkid_list);
}
return s32Error;
}
@@ -1758,8 +1769,10 @@ static int remain_on_channel(struct wiphy *wiphy,
{
s32 s32Error = 0;
struct wilc_priv *priv;
+ struct wilc_vif *vif;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

PRINT_D(GENERIC_DBG, "Remaining on channel %d\n", chan->hw_value);

@@ -1776,7 +1789,7 @@ static int remain_on_channel(struct wiphy *wiphy,
priv->strRemainOnChanParams.u32ListenDuration = duration;
priv->strRemainOnChanParams.u32ListenSessionID++;

- s32Error = wilc_remain_on_channel(priv->hWILCWFIDrv
+ s32Error = wilc_remain_on_channel(vif, priv->hWILCWFIDrv
, priv->strRemainOnChanParams.u32ListenSessionID
, duration
, chan->hw_value
@@ -1793,12 +1806,14 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
{
s32 s32Error = 0;
struct wilc_priv *priv;
+ struct wilc_vif *vif;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

PRINT_D(CFG80211_DBG, "Cancel remain on channel\n");

- s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
+ s32Error = wilc_listen_state_expired(vif, priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
return s32Error;
}

@@ -1846,7 +1861,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
PRINT_D(GENERIC_DBG, "TX: Probe Response\n");
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+ wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value);
curr_channel = chan->hw_value;
} else if (ieee80211_is_action(mgmt->frame_control)) {
PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control);
@@ -1856,7 +1871,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC ||
buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) {
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+ wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value);
curr_channel = chan->hw_value;
}
switch (buf[ACTION_SUBTYPE_ID]) {
@@ -2002,7 +2017,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
- wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg);
+ wilc_frame_register(vif, priv->hWILCWFIDrv, frame_type, reg);
}

static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
@@ -2016,6 +2031,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
int idx, u8 *mac, struct station_info *sinfo)
{
struct wilc_priv *priv;
+ struct wilc_vif *vif;

PRINT_D(CFG80211_DBG, "Dumping station information\n");

@@ -2023,10 +2039,11 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
return -ENOENT;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);

- wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));
+ wilc_get_rssi(vif, priv->hWILCWFIDrv, &(sinfo->signal));

return 0;
}
@@ -2035,6 +2052,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
bool enabled, int timeout)
{
struct wilc_priv *priv;
+ struct wilc_vif *vif;

PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout);

@@ -2042,13 +2060,14 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
return -ENOENT;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);
if (!priv->hWILCWFIDrv) {
PRINT_ER("Driver is NULL\n");
return -EIO;
}

if (wilc_enable_ps)
- wilc_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);
+ wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, enabled, timeout);


return 0;
@@ -2096,7 +2115,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
vif->iftype = STATION_MODE;

if (wl->initialized) {
- wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+ wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
wl->vif[0]->bssid, TID);
wilc_wait_msg_queue_idle();

@@ -2107,21 +2126,21 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_initialized = 1;
vif->iftype = interface_type;

- wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv);
- wilc_set_mac_address(wl->vif[0]->hif_drv,
+ wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+ wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
wl->vif[0]->src_addr);
- wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+ wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE);

if (g_wep_keys_saved) {
- wilc_set_wep_default_keyid(wl->vif[0]->hif_drv,
+ wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
g_key_wep_params.key_idx);
- wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv,
+ wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
}

- wilc_flush_join_req(priv->hWILCWFIDrv);
+ wilc_flush_join_req(vif, priv->hWILCWFIDrv);

if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
@@ -2149,24 +2168,24 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(vif, priv->hWILCWFIDrv,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
}

wilc_enable_ps = true;
- wilc_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
+ wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 1, 0);
}
break;

case NL80211_IFTYPE_P2P_CLIENT:
wilc_enable_ps = false;
- wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
+ wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0);
wilc_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");

- wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+ wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
wl->vif[0]->bssid, TID);

dev->ieee80211_ptr->iftype = type;
@@ -2184,21 +2203,21 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc1000_wlan_init(dev, vif);
wilc_initialized = 1;

- wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv);
- wilc_set_mac_address(wl->vif[0]->hif_drv,
+ wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+ wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
wl->vif[0]->src_addr);
- wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+ wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE);

if (g_wep_keys_saved) {
- wilc_set_wep_default_keyid(wl->vif[0]->hif_drv,
+ wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
g_key_wep_params.key_idx);
- wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv,
+ wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
}

- wilc_flush_join_req(priv->hWILCWFIDrv);
+ wilc_flush_join_req(vif, priv->hWILCWFIDrv);

if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
@@ -2229,7 +2248,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(vif, priv->hWILCWFIDrv,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
@@ -2256,7 +2275,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(vif, priv->hWILCWFIDrv,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
@@ -2269,8 +2288,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_optaining_ip = true;
mod_timer(&wilc_during_ip_timer,
jiffies + msecs_to_jiffies(during_ip_time));
- wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
- wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+ wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0);
+ wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
wl->vif[0]->bssid, TID);
wilc_enable_ps = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
@@ -2289,21 +2308,21 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc1000_wlan_init(dev, vif);
wilc_initialized = 1;

- wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv);
- wilc_set_mac_address(wl->vif[0]->hif_drv,
+ wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
+ wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
wl->vif[0]->src_addr);
- wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
+ wilc_set_operation_mode(vif, priv->hWILCWFIDrv, AP_MODE);

if (g_wep_keys_saved) {
- wilc_set_wep_default_keyid(wl->vif[0]->hif_drv,
+ wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
g_key_wep_params.key_idx);
- wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv,
+ wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
}

- wilc_flush_join_req(priv->hWILCWFIDrv);
+ wilc_flush_join_req(vif, priv->hWILCWFIDrv);

if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0],
@@ -2333,7 +2352,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(vif, priv->hWILCWFIDrv,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
@@ -2372,7 +2391,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,

wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr);

- s32Error = wilc_add_beacon(priv->hWILCWFIDrv,
+ s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv,
settings->beacon_interval,
settings->dtim_period,
beacon->head_len, (u8 *)beacon->head,
@@ -2385,13 +2404,15 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_beacon_data *beacon)
{
struct wilc_priv *priv;
+ struct wilc_vif *vif;
s32 s32Error = 0;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);
PRINT_D(HOSTAPD_DBG, "Setting beacon\n");


- s32Error = wilc_add_beacon(priv->hWILCWFIDrv,
+ s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv,
0,
0,
beacon->head_len, (u8 *)beacon->head,
@@ -2404,18 +2425,20 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
{
s32 s32Error = 0;
struct wilc_priv *priv;
+ struct wilc_vif *vif;
u8 NullBssid[ETH_ALEN] = {0};

if (!wiphy)
return -EFAULT;

priv = wiphy_priv(wiphy);
+ vif = netdev_priv(priv->dev);

PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");

wilc_wlan_set_bssid(dev, NullBssid);

- s32Error = wilc_del_beacon(priv->hWILCWFIDrv);
+ s32Error = wilc_del_beacon(vif, priv->hWILCWFIDrv);

if (s32Error)
PRINT_ER("Host delete beacon fail\n");
@@ -2486,7 +2509,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
strStaParams.flags_set);

- s32Error = wilc_add_station(priv->hWILCWFIDrv, &strStaParams);
+ s32Error = wilc_add_station(vif, priv->hWILCWFIDrv,
+ &strStaParams);
if (s32Error)
PRINT_ER("Host add station fail\n");
}
@@ -2514,12 +2538,12 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,

if (!mac) {
PRINT_D(HOSTAPD_DBG, "All associated stations\n");
- s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
+ s32Error = wilc_del_allstation(vif, priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
} else {
PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}

- s32Error = wilc_del_station(priv->hWILCWFIDrv, mac);
+ s32Error = wilc_del_station(vif, priv->hWILCWFIDrv, mac);

if (s32Error)
PRINT_ER("Host delete station fail\n");
@@ -2592,7 +2616,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
strStaParams.flags_set);

- s32Error = wilc_edit_station(priv->hWILCWFIDrv, &strStaParams);
+ s32Error = wilc_edit_station(vif, priv->hWILCWFIDrv,
+ &strStaParams);
if (s32Error)
PRINT_ER("Host edit station fail\n");
}
@@ -2825,10 +2850,11 @@ int wilc_init_host_int(struct net_device *net)
int wilc_deinit_host_int(struct net_device *net)
{
int s32Error = 0;
-
+ struct wilc_vif *vif;
struct wilc_priv *priv;

priv = wdev_priv(net->ieee80211_ptr);
+ vif = netdev_priv(priv->dev);

priv->gbAutoRateAdjusted = false;

@@ -2836,7 +2862,7 @@ int wilc_deinit_host_int(struct net_device *net)

op_ifcs--;

- s32Error = wilc_deinit(priv->hWILCWFIDrv);
+ s32Error = wilc_deinit(vif, priv->hWILCWFIDrv);

clear_shadow_scan();
if (op_ifcs == 0) {
--
1.9.1


2015-12-14 05:43:45

by Glen Lee

[permalink] [raw]
Subject: [PATCH 04/12] staging: wilc1000: pass struct wilc

Pass struct wilc to the following functions. The functions need wilc to
get proper vif using id from wilc device.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.h | 11 ++++++-----
drivers/staging/wilc1000/host_interface.c | 9 ++++++---
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 9 +++++----
drivers/staging/wilc1000/wilc_wlan_cfg.h | 4 +++-
5 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 3f2a7d3..fc43d04 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -135,9 +135,10 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo);
s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
-
-void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length);
-void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length);
-void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length);
-
+void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
+ u32 u32Length);
+void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
+ u32 u32Length);
+void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
+ u32 u32Length);
#endif
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index e8c14cc..259cefc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4021,7 +4021,8 @@ s32 wilc_deinit(struct wilc_vif *vif)
return result;
}

-void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length)
+void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
+ u32 u32Length)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4050,7 +4051,8 @@ void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length)
PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result);
}

-void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length)
+void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
+ u32 u32Length)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4091,7 +4093,8 @@ void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length)
up(&hif_sema_deinit);
}

-void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length)
+void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
+ u32 u32Length)
{
s32 result = 0;
struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 768a42c..00f3464 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -988,7 +988,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
} else {
struct wilc_cfg_rsp rsp;

- wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp);
+ wilc_wlan_cfg_indicate_rx(wilc, &buffer[pkt_offset + offset], pkt_len, &rsp);
if (rsp.type == WILC_CFG_RSP) {
PRINT_D(RX_DBG, "wilc->cfg_seq_no = %d - rsp.seq_no = %d\n", wilc->cfg_seq_no, rsp.seq_no);
if (wilc->cfg_seq_no == rsp.seq_no)
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index f62c0e6..b72c77b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -495,7 +495,8 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
return ret;
}

-int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp)
+int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+ struct wilc_cfg_rsp *rsp)
{
int ret = 1;
u8 msg_type;
@@ -522,17 +523,17 @@ int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp)
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
PRINT_INFO(RX_DBG, "Info message received\n");
- wilc_gnrl_async_info_received(frame - 4, size + 4);
+ wilc_gnrl_async_info_received(wilc, frame - 4, size + 4);
break;

case 'N':
- wilc_network_info_received(frame - 4, size + 4);
+ wilc_network_info_received(wilc, frame - 4, size + 4);
rsp->type = 0;
break;

case 'S':
PRINT_INFO(RX_DBG, "Scan Notification Received\n");
- wilc_scan_complete_received(frame - 4, size + 4);
+ wilc_scan_complete_received(wilc, frame - 4, size + 4);
break;

default:
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 443b2d5..5f74eb8 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -30,10 +30,12 @@ typedef struct {
u8 *str;
} wilc_cfg_str_t;

+struct wilc;
int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
-int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp);
+int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+ struct wilc_cfg_rsp *rsp);
int wilc_wlan_cfg_init(wilc_debug_func func);

#endif
--
1.9.1


2015-12-14 05:43:32

by Glen Lee

[permalink] [raw]
Subject: [PATCH 02/12] staging: wilc1000: remove argument hif_drv

In previous patch we add new argument vif which has hif_drv in it's member.
Therefore, no need to pass hif_drv in those functions. Remove argument
struct host_if_drv and use hif_drv of vif.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 176 ++++++++---------
drivers/staging/wilc1000/host_interface.h | 127 +++++-------
drivers/staging/wilc1000/linux_wlan.c | 20 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 223 +++++++++++-----------
4 files changed, 264 insertions(+), 282 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c52a8e1..d4bcf39 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -451,7 +451,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif,
kfree(wid.val);

if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
- wilc_setup_ipaddress(vif, hif_drv, set_ip[idx], idx);
+ wilc_setup_ipaddress(vif, set_ip[idx], idx);

if (result != 0) {
PRINT_ER("Failed to get IP address\n");
@@ -1626,7 +1626,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,

if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, 0, 0);

PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n");
hif_drv->hif_state = HOST_IF_CONNECTED;
@@ -1669,7 +1669,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,

if (hif_drv->usr_conn_req.conn_result) {
wilc_optaining_ip = false;
- wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, 0, 0);

hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
NULL,
@@ -2007,7 +2007,7 @@ static void Handle_Disconnect(struct wilc_vif *vif,
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");

wilc_optaining_ip = false;
- wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, 0, 0);

eth_zero_addr(wilc_connected_ssid);

@@ -2075,15 +2075,14 @@ static void Handle_Disconnect(struct wilc_vif *vif,
up(&hif_drv->sem_test_disconn_block);
}

-void wilc_resolve_disconnect_aberration(struct wilc_vif *vif,
- struct host_if_drv *hif_drv)
+void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
{
- if (!hif_drv)
+ if (!vif->hif_drv)
return;
- if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
- (hif_drv->hif_state == HOST_IF_CONNECTING)) {
+ if ((vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
+ (vif->hif_drv->hif_state == HOST_IF_CONNECTING)) {
PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n");
- wilc_disconnect(vif, hif_drv, 1);
+ wilc_disconnect(vif, 1);
}
}

@@ -3033,11 +3032,11 @@ s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
return 0;
}

-int wilc_remove_wep_key(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u8 index)
+int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
{
int result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
result = -EFAULT;
@@ -3062,11 +3061,11 @@ int wilc_remove_wep_key(struct wilc_vif *vif,
return result;
}

-int wilc_set_wep_default_keyid(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u8 index)
+int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
{
int result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
result = -EFAULT;
@@ -3091,11 +3090,12 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif,
return result;
}

-int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *key, u8 len, u8 index)
+int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
+ u8 index)
{
int result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -3124,12 +3124,12 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *key, u8 len, u8 index, u8 mode,
- enum AUTHTYPE auth_type)
+int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
+ u8 index, u8 mode, enum AUTHTYPE auth_type)
{
int result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;
int i;

if (!hif_drv) {
@@ -3166,13 +3166,13 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
+s32 wilc_add_ptk(struct wilc_vif *vif, const u8 *pu8Ptk, u8 u8PtkKeylen,
+ const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic,
u8 mode, u8 u8Ciphermode, u8 u8Idx)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;
u8 u8KeyLen = u8PtkKeylen;
u32 i;

@@ -3232,14 +3232,14 @@ s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx,
- u32 u32KeyRSClen, const u8 *KeyRSC,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
- u8 mode, u8 u8Ciphermode)
+s32 wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *pu8RxGtk, u8 u8GtkKeylen,
+ u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
+ const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode,
+ u8 u8Ciphermode)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;
u8 u8KeyLen = u8GtkKeylen;

if (!hif_drv) {
@@ -3295,11 +3295,12 @@ s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+s32 wilc_set_pmkid_info(struct wilc_vif *vif,
struct host_if_pmkid_attr *pu8PmkidInfoArray)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;
u32 i;

if (!hif_drv) {
@@ -3329,11 +3330,11 @@ s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *pu8MacAddress)
+s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));

@@ -3352,11 +3353,11 @@ s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *pu8MacAddress)
+s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]);

@@ -3385,15 +3386,15 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
return 0;
}

-s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen,
- const u8 *pu8IEs, size_t IEsLen,
+s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
+ size_t ssidLen, const u8 *pu8IEs, size_t IEsLen,
wilc_connect_result pfConnectResult, void *pvUserArg,
u8 u8security, enum AUTHTYPE tenuAuth_type,
u8 u8channel, void *pJoinParams)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv || !pfConnectResult) {
PRINT_ER("Driver is null\n");
@@ -3453,10 +3454,11 @@ s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv)
+s32 wilc_flush_join_req(struct wilc_vif *vif)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!join_req)
return -EFAULT;
@@ -3479,11 +3481,11 @@ s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv)
return result;
}

-s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u16 u16ReasonCode)
+s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("Driver is null\n");
@@ -3536,11 +3538,11 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
return result;
}

-int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 channel)
+int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
{
int result;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -3600,11 +3602,11 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv)
return result;
}

-int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u32 mode)
+int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
{
int result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_OPERATION_MODE;
@@ -3621,11 +3623,12 @@ int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *mac, u32 *pu32InactiveTime)
+s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
+ u32 *pu32InactiveTime)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -3650,11 +3653,11 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- s8 *ps8Rssi)
+s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_GET_RSSI;
@@ -3679,11 +3682,11 @@ s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct rf_info *pstrStatistics)
+s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_GET_STATISTICS;
@@ -3701,14 +3704,14 @@ s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList,
- u8 u8ChnlListLen, const u8 *pu8IEs,
- size_t IEsLen, wilc_scan_result ScanResult,
- void *pvUserArg, struct hidden_network *pstrHiddenNetwork)
+s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType,
+ u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs,
+ size_t IEsLen, wilc_scan_result ScanResult, void *pvUserArg,
+ struct hidden_network *pstrHiddenNetwork)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv || !ScanResult) {
PRINT_ER("hif_drv or ScanResult = NULL\n");
@@ -3755,11 +3758,12 @@ s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct cfg_param_val *pstrCfgParamVal)
+s32 wilc_hif_set_cfg(struct wilc_vif *vif,
+ struct cfg_param_val *pstrCfgParamVal)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("hif_drv NULL\n");
@@ -3913,10 +3917,11 @@ _fail_:
return result;
}

-s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv)
+s32 wilc_deinit(struct wilc_vif *vif)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;
int ret;

if (!hif_drv) {
@@ -4083,14 +4088,15 @@ void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length)
return;
}

-s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u32 u32SessionID, u32 u32duration, u16 chan,
+s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
+ u32 u32duration, u16 chan,
wilc_remain_on_chan_expired RemainOnChanExpired,
wilc_remain_on_chan_ready RemainOnChanReady,
void *pvUserArg)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4116,11 +4122,11 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_listen_state_expired(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u32 u32SessionID)
+s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4142,11 +4148,11 @@ s32 wilc_listen_state_expired(struct wilc_vif *vif,
return result;
}

-s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u16 u16FrameType, bool bReg)
+s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4183,14 +4189,13 @@ s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u32 u32Interval,
- u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
- u32 u32TailLen, u8 *pu8Tail)
+s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
+ u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
{
s32 result = 0;
struct host_if_msg msg;
struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4239,10 +4244,11 @@ ERRORHANDLER:
return result;
}

-int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv)
+int wilc_del_beacon(struct wilc_vif *vif)
{
int result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4261,12 +4267,12 @@ int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv)
return result;
}

-int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct add_sta_param *sta_param)
+int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)
{
int result = 0;
struct host_if_msg msg;
struct add_sta_param *add_sta_info = &msg.body.add_sta_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4296,12 +4302,12 @@ int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *mac_addr)
+int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr)
{
int result = 0;
struct host_if_msg msg;
struct del_sta *del_sta_info = &msg.body.del_sta_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4327,12 +4333,12 @@ int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 pu8MacAddr[][ETH_ALEN])
+s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN])
{
s32 result = 0;
struct host_if_msg msg;
struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;
u8 au8Zero_Buff[ETH_ALEN] = {0};
u32 i;
u8 u8AssocNumb = 0;
@@ -4379,12 +4385,13 @@ s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct add_sta_param *pstrStaParams)
+s32 wilc_edit_station(struct wilc_vif *vif,
+ struct add_sta_param *pstrStaParams)
{
s32 result = 0;
struct host_if_msg msg;
struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4418,12 +4425,12 @@ s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- bool bIsEnabled, u32 u32Timeout)
+s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout)
{
s32 result = 0;
struct host_if_msg msg;
struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled);

@@ -4449,14 +4456,13 @@ s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv,
return result;
}

-s32 wilc_setup_multicast_filter(struct wilc_vif *vif,
- struct host_if_drv *hif_drv,
- bool bIsEnabled,
+s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled,
u32 u32count)
{
s32 result = 0;
struct host_if_msg msg;
struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4645,14 +4651,12 @@ void wilc_free_join_params(void *pJoinParams)
PRINT_ER("Unable to FREE null pointer\n");
}

-s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif,
- struct host_if_drv *hif_drv,
- char *pBSSID,
- char TID)
+s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID)
{
s32 result = 0;
struct host_if_msg msg;
struct ba_session_info *pBASessionInfo = &msg.body.session_info;
+ struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4677,11 +4681,11 @@ s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif,
return result;
}

-s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *u16ipadd, u8 idx)
+s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx)
{
s32 result = 0;
struct host_if_msg msg;
+ struct host_if_drv *hif_drv = vif->hif_drv;

return 0;

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index ccbbe73..9716bc8 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -307,102 +307,73 @@ struct add_sta_param {

struct wilc_vif;
s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
-int wilc_remove_wep_key(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u8 index);
-int wilc_set_wep_default_keyid(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u8 index);
-int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *key, u8 len, u8 index);
-int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *key, u8 len, u8 index, u8 mode,
- enum AUTHTYPE auth_type);
-s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
+int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
+int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
+int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
+ u8 index);
+int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
+ u8 index, u8 mode, enum AUTHTYPE auth_type);
+s32 wilc_add_ptk(struct wilc_vif *vif, const u8 *pu8Ptk, u8 u8PtkKeylen,
+ const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic,
u8 mode, u8 u8Ciphermode, u8 u8Idx);
-s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *mac, u32 *pu32InactiveTime);
-s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx,
- u32 u32KeyRSClen, const u8 *KeyRSC,
- const u8 *pu8RxMic, const u8 *pu8TxMic,
- u8 mode, u8 u8Ciphermode);
+s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
+ u32 *pu32InactiveTime);
+s32 wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *pu8RxGtk, u8 u8GtkKeylen,
+ u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
+ const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode,
+ u8 u8Ciphermode);
s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen,
u8 *pu8TxGtk, u8 u8KeyIdx);
-s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv,
+s32 wilc_set_pmkid_info(struct wilc_vif *vif,
struct host_if_pmkid_attr *pu8PmkidInfoArray);
-s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *pu8MacAddress);
-s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *pu8MacAddress);
+s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress);
+s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress);
int wilc_wait_msg_queue_idle(void);
s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
-s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen,
- const u8 *pu8IEs, size_t IEsLen,
+s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
+ size_t ssidLen, const u8 *pu8IEs, size_t IEsLen,
wilc_connect_result pfConnectResult, void *pvUserArg,
u8 u8security, enum AUTHTYPE tenuAuth_type,
u8 u8channel, void *pJoinParams);
-s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv);
-s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u16 u16ReasonCode);
-int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 channel);
-s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- s8 *ps8Rssi);
-s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList,
- u8 u8ChnlListLen, const u8 *pu8IEs,
- size_t IEsLen, wilc_scan_result ScanResult,
- void *pvUserArg, struct hidden_network *pstrHiddenNetwork);
-s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct cfg_param_val *pstrCfgParamVal);
+s32 wilc_flush_join_req(struct wilc_vif *vif);
+s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode);
+int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
+s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi);
+s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType,
+ u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs,
+ size_t IEsLen, wilc_scan_result ScanResult, void *pvUserArg,
+ struct hidden_network *pstrHiddenNetwork);
+s32 wilc_hif_set_cfg(struct wilc_vif *vif,
+ struct cfg_param_val *pstrCfgParamVal);
s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
-s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv);
-s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u32 u32Interval,
- u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
- u32 u32TailLen, u8 *pu8Tail);
-int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv);
-int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct add_sta_param *sta_param);
-s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 pu8MacAddr[][ETH_ALEN]);
-int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- const u8 *mac_addr);
-s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct add_sta_param *pstrStaParams);
-s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- bool bIsEnabled, u32 u32Timeout);
-s32 wilc_setup_multicast_filter(struct wilc_vif *vif,
- struct host_if_drv *hif_drv,
- bool bIsEnabled,
+s32 wilc_deinit(struct wilc_vif *vif);
+s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
+ u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
+int wilc_del_beacon(struct wilc_vif *vif);
+int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
+s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]);
+int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
+s32 wilc_edit_station(struct wilc_vif *vif,
+ struct add_sta_param *pstrStaParams);
+s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout);
+s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled,
u32 u32count);
-s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u8 *u16ipadd, u8 idx);
-s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif,
- struct host_if_drv *hif_drv,
- char *pBSSID,
- char TID);
-s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u32 u32SessionID, u32 u32duration, u16 chan,
+s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx);
+s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
+s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
+ u32 u32duration, u16 chan,
wilc_remain_on_chan_expired RemainOnChanExpired,
wilc_remain_on_chan_ready RemainOnChanReady,
void *pvUserArg);
-s32 wilc_listen_state_expired(struct wilc_vif *vif,
- struct host_if_drv *hif_drv, u32 u32SessionID);
-s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u16 u16FrameType, bool bReg);
+s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID);
+s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg);
int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv);
-int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- u32 mode);
+int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);

void wilc_free_join_params(void *pJoinParams);

-s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv,
- struct rf_info *pstrStatistics);
-void wilc_resolve_disconnect_aberration(struct wilc_vif *vif,
- struct host_if_drv *hif_drv);
+s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics);
+void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);

extern bool wilc_optaining_ip;
extern u8 wilc_connected_ssid[6];
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 6074996..a50e3ff 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -112,7 +112,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
}

if (wilc_enable_ps)
- wilc_set_power_mgmt(vif, hif_drv, 1, 0);
+ wilc_set_power_mgmt(vif, 1, 0);

PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);

@@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
- wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);

break;

@@ -134,9 +134,9 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
}

if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0)
- wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+ wilc_set_power_mgmt(vif, 0, 0);

- wilc_resolve_disconnect_aberration(vif, hif_drv);
+ wilc_resolve_disconnect_aberration(vif);

PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);

@@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);

- wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);

break;

@@ -1030,7 +1030,7 @@ int wilc_mac_open(struct net_device *ndev)

wilc_set_machw_change_vir_if(ndev, false);

- wilc_get_mac_address(vif, priv->hWILCWFIDrv, mac_add);
+ wilc_get_mac_address(vif, mac_add);
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);

for (i = 0; i < wl->vif_num; i++) {
@@ -1097,13 +1097,13 @@ static void wilc_set_multicast_list(struct net_device *dev)
if ((dev->flags & IFF_ALLMULTI) ||
(dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
- wilc_setup_multicast_filter(vif, hif_drv, false, 0);
+ wilc_setup_multicast_filter(vif, false, 0);
return;
}

if ((dev->mc.count) == 0) {
PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
- wilc_setup_multicast_filter(vif, hif_drv, true, 0);
+ wilc_setup_multicast_filter(vif, true, 0);
return;
}

@@ -1119,7 +1119,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
i++;
}

- wilc_setup_multicast_filter(vif, hif_drv, true, (dev->mc.count));
+ wilc_setup_multicast_filter(vif, true, (dev->mc.count));

return;
}
@@ -1291,7 +1291,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)

if (strncasecmp(buff, "RSSI", length) == 0) {
priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
- ret = wilc_get_rssi(vif, priv->hWILCWFIDrv, &rssi);
+ ret = wilc_get_rssi(vif, &rssi);
if (ret)
PRINT_ER("Failed to send get rssi param's message queue ");
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 309a0cc..da4c4ad 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -604,7 +604,7 @@ static int set_channel(struct wiphy *wiphy,
PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);

curr_channel = channelnum;
- result = wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, channelnum);
+ result = wilc_set_mac_chnl_num(vif, channelnum);

if (result != 0)
PRINT_ER("Error in setting channel %d\n", channelnum);
@@ -660,16 +660,20 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
}
}
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
- au8ScanChanList, request->n_channels,
- (const u8 *)request->ie, request->ie_len,
- CfgScanResult, (void *)priv, &strHiddenNetwork);
+ s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
+ au8ScanChanList,
+ request->n_channels,
+ (const u8 *)request->ie,
+ request->ie_len, CfgScanResult,
+ (void *)priv, &strHiddenNetwork);
} else {
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
- au8ScanChanList, request->n_channels,
- (const u8 *)request->ie, request->ie_len,
- CfgScanResult, (void *)priv, NULL);
+ s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
+ au8ScanChanList,
+ request->n_channels,
+ (const u8 *)request->ie,
+ request->ie_len, CfgScanResult,
+ (void *)priv, NULL);
}
} else {
PRINT_ER("Requested num of scanned channels is greater than the max, supported"
@@ -792,8 +796,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;

- wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx);
- wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc_set_wep_default_keyid(vif, sme->key_idx);
+ wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
+ sme->key_idx);
} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
pcgroup_encrypt_val = "WEP104";
@@ -809,8 +814,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;

- wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx);
- wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc_set_wep_default_keyid(vif, sme->key_idx);
+ wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
+ sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) {
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
@@ -895,11 +901,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,

wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);

- s32Error = wilc_set_join_req(vif, priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
- sme->ssid_len, sme->ie, sme->ie_len,
- CfgConnectResult, (void *)priv, u8security,
- tenuAuth_type, pstrNetworkInfo->u8channel,
- pstrNetworkInfo->pJoinParams);
+ s32Error = wilc_set_join_req(vif, pstrNetworkInfo->au8bssid, sme->ssid,
+ sme->ssid_len, sme->ie, sme->ie_len,
+ CfgConnectResult, (void *)priv,
+ u8security, tenuAuth_type,
+ pstrNetworkInfo->u8channel,
+ pstrNetworkInfo->pJoinParams);
if (s32Error != 0) {
PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error);
s32Error = -ENOENT;
@@ -935,7 +942,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
wilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;

- s32Error = wilc_disconnect(vif, priv->hWILCWFIDrv, reason_code);
+ s32Error = wilc_disconnect(vif, reason_code);
if (s32Error != 0) {
PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
s32Error = -EINVAL;
@@ -995,7 +1002,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
else
u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

- wilc_add_wep_key_bss_ap(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
+ wilc_add_wep_key_bss_ap(vif, params->key,
+ params->key_len, key_index,
+ u8mode, tenuAuth_type);
break;
}
if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
@@ -1009,7 +1018,8 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
for (i = 0; i < params->key_len; i++)
PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]);
}
- wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index);
+ wilc_add_wep_key_bss_sta(vif, params->key,
+ params->key_len, key_index);
}

break;
@@ -1066,8 +1076,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}


- wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen,
- key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode);
+ wilc_add_rx_gtk(vif, params->key, KeyLen,
+ key_index, params->seq_len,
+ params->seq, pu8RxMic,
+ pu8TxMic, AP_MODE, u8gmode);

} else {
PRINT_INFO(CFG80211_DBG, "STA Address: %x%x%x%x%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4]);
@@ -1110,8 +1122,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
priv->wilc_ptk[key_index]->key_len = params->key_len;
priv->wilc_ptk[key_index]->seq_len = params->seq_len;

- wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
- pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index);
+ wilc_add_ptk(vif, params->key, KeyLen,
+ mac_addr, pu8RxMic, pu8TxMic,
+ AP_MODE, u8pmode, key_index);
}
break;
}
@@ -1150,8 +1163,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
g_gtk_keys_saved = true;
}

- wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen,
- key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode);
+ wilc_add_rx_gtk(vif, params->key, KeyLen,
+ key_index, params->seq_len,
+ params->seq, pu8RxMic,
+ pu8TxMic, STATION_MODE,
+ u8mode);
} else {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
pu8RxMic = params->key + 24;
@@ -1184,8 +1200,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
g_ptk_keys_saved = true;
}

- wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
- pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index);
+ wilc_add_ptk(vif, params->key, KeyLen,
+ mac_addr, pu8RxMic, pu8TxMic,
+ STATION_MODE, u8mode, key_index);
PRINT_D(CFG80211_DBG, "Adding pairwise key\n");
if (INFO) {
for (i = 0; i < params->key_len; i++)
@@ -1261,7 +1278,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv->WILC_WFI_wep_key_len[key_index] = 0;

PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index);
- wilc_remove_wep_key(vif, priv->hWILCWFIDrv, key_index);
+ wilc_remove_wep_key(vif, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
@@ -1320,7 +1337,7 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke
PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index);

if (key_index != priv->WILC_WFI_wep_default) {
- wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, key_index);
+ wilc_set_wep_default_keyid(vif, key_index);
}

return 0;
@@ -1356,7 +1373,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,

sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);

- wilc_get_inactive_time(vif, priv->hWILCWFIDrv, mac, &(inactive_time));
+ wilc_get_inactive_time(vif, mac, &inactive_time);
sinfo->inactive_time = 1000 * inactive_time;
PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);
}
@@ -1364,7 +1381,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
if (vif->iftype == STATION_MODE) {
struct rf_info strStatistics;

- wilc_get_statistics(vif, priv->hWILCWFIDrv, &strStatistics);
+ wilc_get_statistics(vif, &strStatistics);

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
BIT(NL80211_STA_INFO_RX_PACKETS) |
@@ -1435,7 +1452,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
}

PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n");
- s32Error = wilc_hif_set_cfg(vif, priv->hWILCWFIDrv, &pstrCfgParamVal);
+ s32Error = wilc_hif_set_cfg(vif, &pstrCfgParamVal);
if (s32Error)
PRINT_ER("Error in setting WIPHY PARAMS\n");

@@ -1479,7 +1496,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,

if (!s32Error) {
PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n");
- s32Error = wilc_set_pmkid_info(vif, priv->hWILCWFIDrv, &priv->pmkid_list);
+ s32Error = wilc_set_pmkid_info(vif, &priv->pmkid_list);
}
return s32Error;
}
@@ -1789,13 +1806,11 @@ static int remain_on_channel(struct wiphy *wiphy,
priv->strRemainOnChanParams.u32ListenDuration = duration;
priv->strRemainOnChanParams.u32ListenSessionID++;

- s32Error = wilc_remain_on_channel(vif, priv->hWILCWFIDrv
- , priv->strRemainOnChanParams.u32ListenSessionID
- , duration
- , chan->hw_value
- , WILC_WFI_RemainOnChannelExpired
- , WILC_WFI_RemainOnChannelReady
- , (void *)priv);
+ s32Error = wilc_remain_on_channel(vif,
+ priv->strRemainOnChanParams.u32ListenSessionID,
+ duration, chan->hw_value,
+ WILC_WFI_RemainOnChannelExpired,
+ WILC_WFI_RemainOnChannelReady, (void *)priv);

return s32Error;
}
@@ -1813,7 +1828,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,

PRINT_D(CFG80211_DBG, "Cancel remain on channel\n");

- s32Error = wilc_listen_state_expired(vif, priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
+ s32Error = wilc_listen_state_expired(vif, priv->strRemainOnChanParams.u32ListenSessionID);
return s32Error;
}

@@ -1861,7 +1876,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
PRINT_D(GENERIC_DBG, "TX: Probe Response\n");
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value);
+ wilc_set_mac_chnl_num(vif, chan->hw_value);
curr_channel = chan->hw_value;
} else if (ieee80211_is_action(mgmt->frame_control)) {
PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control);
@@ -1871,7 +1886,8 @@ static int mgmt_tx(struct wiphy *wiphy,
if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC ||
buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) {
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value);
+ wilc_set_mac_chnl_num(vif,
+ chan->hw_value);
curr_channel = chan->hw_value;
}
switch (buf[ACTION_SUBTYPE_ID]) {
@@ -2017,7 +2033,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
- wilc_frame_register(vif, priv->hWILCWFIDrv, frame_type, reg);
+ wilc_frame_register(vif, frame_type, reg);
}

static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
@@ -2043,7 +2059,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);

- wilc_get_rssi(vif, priv->hWILCWFIDrv, &(sinfo->signal));
+ wilc_get_rssi(vif, &sinfo->signal);

return 0;
}
@@ -2067,7 +2083,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
}

if (wilc_enable_ps)
- wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, enabled, timeout);
+ wilc_set_power_mgmt(vif, enabled, timeout);


return 0;
@@ -2115,8 +2131,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
vif->iftype = STATION_MODE;

if (wl->initialized) {
- wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
- wl->vif[0]->bssid, TID);
+ wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid,
+ TID);
wilc_wait_msg_queue_idle();

up(&wl->cfg_event);
@@ -2127,20 +2143,19 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
vif->iftype = interface_type;

wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
- wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
- wl->vif[0]->src_addr);
- wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE);
+ wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
+ wilc_set_operation_mode(vif, STATION_MODE);

if (g_wep_keys_saved) {
- wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
- g_key_wep_params.key_idx);
- wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
- g_key_wep_params.key,
- g_key_wep_params.key_len,
- g_key_wep_params.key_idx);
+ wilc_set_wep_default_keyid(wl->vif[0],
+ g_key_wep_params.key_idx);
+ wilc_add_wep_key_bss_sta(wl->vif[0],
+ g_key_wep_params.key,
+ g_key_wep_params.key_len,
+ g_key_wep_params.key_idx);
}

- wilc_flush_join_req(vif, priv->hWILCWFIDrv);
+ wilc_flush_join_req(vif);

if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
@@ -2168,25 +2183,24 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(vif, priv->hWILCWFIDrv,
+ wilc_frame_register(vif,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
}

wilc_enable_ps = true;
- wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 1, 0);
+ wilc_set_power_mgmt(vif, 1, 0);
}
break;

case NL80211_IFTYPE_P2P_CLIENT:
wilc_enable_ps = false;
- wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0);
+ wilc_set_power_mgmt(vif, 0, 0);
wilc_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");

- wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
- wl->vif[0]->bssid, TID);
+ wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID);

dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2204,20 +2218,19 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_initialized = 1;

wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
- wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
- wl->vif[0]->src_addr);
- wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE);
+ wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
+ wilc_set_operation_mode(vif, STATION_MODE);

if (g_wep_keys_saved) {
- wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
- g_key_wep_params.key_idx);
- wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
- g_key_wep_params.key,
- g_key_wep_params.key_len,
- g_key_wep_params.key_idx);
+ wilc_set_wep_default_keyid(wl->vif[0],
+ g_key_wep_params.key_idx);
+ wilc_add_wep_key_bss_sta(wl->vif[0],
+ g_key_wep_params.key,
+ g_key_wep_params.key_len,
+ g_key_wep_params.key_idx);
}

- wilc_flush_join_req(vif, priv->hWILCWFIDrv);
+ wilc_flush_join_req(vif);

if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
@@ -2248,7 +2261,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(vif, priv->hWILCWFIDrv,
+ wilc_frame_register(vif,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
@@ -2275,7 +2288,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(vif, priv->hWILCWFIDrv,
+ wilc_frame_register(vif,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
@@ -2288,9 +2301,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_optaining_ip = true;
mod_timer(&wilc_during_ip_timer,
jiffies + msecs_to_jiffies(during_ip_time));
- wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0);
- wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv,
- wl->vif[0]->bssid, TID);
+ wilc_set_power_mgmt(vif, 0, 0);
+ wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID);
wilc_enable_ps = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
dev->ieee80211_ptr->iftype = type;
@@ -2309,20 +2321,19 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wilc_initialized = 1;

wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv);
- wilc_set_mac_address(vif, wl->vif[0]->hif_drv,
- wl->vif[0]->src_addr);
- wilc_set_operation_mode(vif, priv->hWILCWFIDrv, AP_MODE);
+ wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
+ wilc_set_operation_mode(vif, AP_MODE);

if (g_wep_keys_saved) {
- wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv,
+ wilc_set_wep_default_keyid(wl->vif[0],
g_key_wep_params.key_idx);
- wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv,
- g_key_wep_params.key,
- g_key_wep_params.key_len,
- g_key_wep_params.key_idx);
+ wilc_add_wep_key_bss_sta(wl->vif[0],
+ g_key_wep_params.key,
+ g_key_wep_params.key_len,
+ g_key_wep_params.key_idx);
}

- wilc_flush_join_req(vif, priv->hWILCWFIDrv);
+ wilc_flush_join_req(vif);

if (g_ptk_keys_saved && g_gtk_keys_saved) {
PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0],
@@ -2352,7 +2363,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
- wilc_frame_register(vif, priv->hWILCWFIDrv,
+ wilc_frame_register(vif,
vif->g_struct_frame_reg[i].frame_type,
vif->g_struct_frame_reg[i].reg);
}
@@ -2391,11 +2402,10 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,

wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr);

- s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv,
- settings->beacon_interval,
- settings->dtim_period,
- beacon->head_len, (u8 *)beacon->head,
- beacon->tail_len, (u8 *)beacon->tail);
+ s32Error = wilc_add_beacon(vif, settings->beacon_interval,
+ settings->dtim_period, beacon->head_len,
+ (u8 *)beacon->head, beacon->tail_len,
+ (u8 *)beacon->tail);

return s32Error;
}
@@ -2412,11 +2422,9 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Setting beacon\n");


- s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv,
- 0,
- 0,
- beacon->head_len, (u8 *)beacon->head,
- beacon->tail_len, (u8 *)beacon->tail);
+ s32Error = wilc_add_beacon(vif, 0, 0, beacon->head_len,
+ (u8 *)beacon->head, beacon->tail_len,
+ (u8 *)beacon->tail);

return s32Error;
}
@@ -2438,7 +2446,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)

wilc_wlan_set_bssid(dev, NullBssid);

- s32Error = wilc_del_beacon(vif, priv->hWILCWFIDrv);
+ s32Error = wilc_del_beacon(vif);

if (s32Error)
PRINT_ER("Host delete beacon fail\n");
@@ -2509,8 +2517,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
strStaParams.flags_set);

- s32Error = wilc_add_station(vif, priv->hWILCWFIDrv,
- &strStaParams);
+ s32Error = wilc_add_station(vif, &strStaParams);
if (s32Error)
PRINT_ER("Host add station fail\n");
}
@@ -2538,12 +2545,13 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,

if (!mac) {
PRINT_D(HOSTAPD_DBG, "All associated stations\n");
- s32Error = wilc_del_allstation(vif, priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
+ s32Error = wilc_del_allstation(vif,
+ priv->assoc_stainfo.au8Sta_AssociatedBss);
} else {
PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}

- s32Error = wilc_del_station(vif, priv->hWILCWFIDrv, mac);
+ s32Error = wilc_del_station(vif, mac);

if (s32Error)
PRINT_ER("Host delete station fail\n");
@@ -2616,8 +2624,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
strStaParams.flags_set);

- s32Error = wilc_edit_station(vif, priv->hWILCWFIDrv,
- &strStaParams);
+ s32Error = wilc_edit_station(vif, &strStaParams);
if (s32Error)
PRINT_ER("Host edit station fail\n");
}
@@ -2862,7 +2869,7 @@ int wilc_deinit_host_int(struct net_device *net)

op_ifcs--;

- s32Error = wilc_deinit(vif, priv->hWILCWFIDrv);
+ s32Error = wilc_deinit(vif);

clear_shadow_scan();
if (op_ifcs == 0) {
--
1.9.1


2015-12-14 05:44:27

by Glen Lee

[permalink] [raw]
Subject: [PATCH 11/12] staging: wilc1000: set hif_drv before it is used

We are using hif_drv of vif, so it needs to be set before it is used.
Set hif_drv to vif->hifdrv soon after it is allocated.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 6 ++++++
drivers/staging/wilc1000/linux_wlan.c | 1 -
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index f97ea49..0125e3d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3775,6 +3775,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
struct host_if_drv *hif_drv;
struct wilc_vif *vif;
struct wilc *wilc;
+ int i;

vif = netdev_priv(dev);
wilc = vif->wilc;
@@ -3791,6 +3792,11 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
goto _fail_;
}
*hif_drv_handler = hif_drv;
+ for (i = 0; i < wilc->vif_num; i++)
+ if (dev == wilc->vif[i]->ndev) {
+ wilc->vif[i]->hif_drv = hif_drv;
+ break;
+ }

wilc_optaining_ip = false;

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index a50e3ff..54fe9d7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1036,7 +1036,6 @@ int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
- wl->vif[i]->hif_drv = priv->hWILCWFIDrv;
break;
}
}
--
1.9.1


2015-12-14 05:44:02

by Glen Lee

[permalink] [raw]
Subject: [PATCH 07/12] staging: wilc1000: change join_req_drv type and it's name

To use wilc_get_vif_idx instead of the last get_id_from_handler, join_req_drv
needs to be changed it's type with wilc_vif and name as well.
As a result, get_id_from_handler is not used anymore, so remove it.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 33 +++++++++----------------------
1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 840253b..76e891c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -259,7 +259,7 @@ static u8 mode_11i;
static u8 auth_type;
static u32 join_req_size;
static u32 info_element_size;
-static struct host_if_drv *join_req_drv;
+static struct wilc_vif *join_req_vif;
#define REAL_JOIN_REQ 0
#define FLUSHED_JOIN_REQ 1
#define FLUSHED_BYTE_POS 79
@@ -294,21 +294,6 @@ static int remove_handler_in_list(struct host_if_drv *handler)
return -EINVAL;
}

-static int get_id_from_handler(struct host_if_drv *handler)
-{
- int i;
-
- if (!handler)
- return 0;
-
- for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
- if (wfidrv_list[i] == handler)
- return i;
- }
-
- return 0;
-}
-
/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
* special purpose in wilc device, so we add 1 to the index to starts from 1.
* As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
@@ -1235,7 +1220,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
memcpy(join_req, pu8CurrByte, join_req_size);
- join_req_drv = hif_drv;
+ join_req_vif = vif;
}

PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
@@ -1349,7 +1334,7 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif)

result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
u32WidsCount,
- get_id_from_handler(join_req_drv));
+ wilc_get_vif_idx(join_req_vif));
if (result) {
PRINT_ER("failed to send config packet\n");
result = -EINVAL;
@@ -1423,12 +1408,12 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)

eth_zero_addr(wilc_connected_ssid);

- if (join_req && join_req_drv == hif_drv) {
+ if (join_req && join_req_vif == vif) {
kfree(join_req);
join_req = NULL;
}

- if (info_element && join_req_drv == hif_drv) {
+ if (info_element && join_req_vif == vif) {
kfree(info_element);
info_element = NULL;
}
@@ -1715,12 +1700,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);

- if (join_req && join_req_drv == hif_drv) {
+ if (join_req && join_req_vif == vif) {
kfree(join_req);
join_req = NULL;
}

- if (info_element && join_req_drv == hif_drv) {
+ if (info_element && join_req_vif == vif) {
kfree(info_element);
info_element = NULL;
}
@@ -2089,12 +2074,12 @@ static void Handle_Disconnect(struct wilc_vif *vif)
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);

- if (join_req && join_req_drv == hif_drv) {
+ if (join_req && join_req_vif == vif) {
kfree(join_req);
join_req = NULL;
}

- if (info_element && join_req_drv == hif_drv) {
+ if (info_element && join_req_vif == vif) {
kfree(info_element);
info_element = NULL;
}
--
1.9.1