2016-02-04 09:22:50

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 00/70] staging: wilc1000: rebase and resend

I rebased all the pending patches which are not accepted yet and resend them.

Chris Park (13):
staging: wilc1000: fix warnings for line over 80 characters
staging: wilc1000: remove useless log message
staging: wilc1000: remove useless function
staging: wilc1000: remove unnecessary braces
staging: wilc1000: remove warnings missing a blank line after
declarations
staging: wilc1000: Optimize code of wilc_get_chipid function
staging: wilc1000: remove unused log message using the CORECONFIG_DBG
tag
staging: wilc1000: remove unused log message using the HOSTINF_DBG tag
staging: wilc1000: remove unused log message using the TX_DBG tag
staging: wilc1000: remove unnecessary wilc_rx_complete function
staging: wilc1000: remove unused log message using the RX_DBG tag
staging: wilc1000: remove unused debug tag
staging: wilc1000: remove unnecessary log message using GENERIC_DBG
tag

Glen Lee (14):
staging: wilc1000: wilc_set_wfi_drv_handler: add mac index
staging: wilc1000: remove unused functions
staging: wilc1000: ignore power save
staging: wilc1000: handle connecting error
staging: wilc1000: tcp_process: fix a build warning
staging: wilc1000: remove define TCP_ACK_FILTER
staging: wilc1000: increase link speed
staging: wilc1000: disable power save when AP mode
staging: wilc1000: fix bug on p2p connection
staging: wilc1000: add ops tx power in cfg80211
staging: wilc1000: fix WEP security bug
staging: wilc1000: get mac address after setting drv handler
staging: wilc1000: move wilc_send_config_pkt to wilc_wlan.c
staging: wilc1000: pass vif to wilc_send_config_pkt

Leo Kim (43):
staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure
staging: wilc1000: fixes missing a blank line after declarations
staging: wilc1000: rename pBssid of tx_complete_data structure
staging: wilc1000: remove warnings line over 80 characters
staging: wilc1000: removes unnecessary debug logs
staging: wilc1000: replaces PRINT_XXX with netdev_xxx
staging: wilc1000: removes void function return
staging: wilc1000: renames u8IfIdx of wilc_vif structure
staging: wilc1000: fixes variable dereferenced before check
staging: wilc1000: wilc_parse_network_info(): renames function
variables
staging: wilc1000: wilc_parse_network_info(): renames local variables
staging: wilc1000: wilc_parse_network_info(): renames local inner
variables
staging: wilc1000: rename variable s32Error
staging: wilc1000: wilc_parse_assoc_resp_info(): renames function
variables
staging: wilc1000: wilc_parse_assoc_resp_info(): renames local
variables
staging: wilc1000: wilc_dealloc_assoc_resp_info(): renames function
variables
staging: wilc1000: wilc_dealloc_network_info(): renames function
variables
staging: wilc1000: wilc_wfi_cfgoperations.c: replaces PRINT_ER with
netdev_err
staging: wilc1000: wilc_msgqueue.c: removes debug print log
staging: wilc1000: wilc_wlan.c: replaces PRINT_ER with netdev_err
staging: wilc1000: linux_mon.c: replaces PRINT_ER with netdev_err
staging: wilc1000: removes function 'wilc_dealloc_network_info()'
staging: wilc1000: removes function 'wilc_dealloc_assoc_resp_info()'
staging: wilc1000: remove typedef from tstrConnectRespInfo
staging: wilc1000: renames struct connect_resp_info variables
staging: wilc1000: remove typedef from pstrNetworkInfo
staging: wilc1000: renames s8rssi of connect_resp_info structure
staging: wilc1000: renames u16CapInfo of connect_resp_info structure
staging: wilc1000: renames au8ssid of connect_resp_info structure
staging: wilc1000: renames u8SsidLen of connect_resp_info structure
staging: wilc1000: renames au8bssid of connect_resp_info structure
staging: wilc1000: renames u16BeaconPeriod of connect_resp_info
structure
staging: wilc1000: renames u8DtimPeriod of connect_resp_info structure
staging: wilc1000: renames u8channel of connect_resp_info structure
staging: wilc1000: renames struct connect_resp_info variables
staging: wilc1000: renames bNewNetwork of connect_resp_info structure
staging: wilc1000: renames u8Found of connect_resp_info structure
staging: wilc1000: renames u32Tsf of connect_resp_info structure
staging: wilc1000: renames struct connect_resp_info variables
staging: wilc1000: renames pJoinParams of connect_resp_info structure
staging: wilc1000: renames strRssi of connect_resp_info structure
staging: wilc1000: renames u64Tsf of connect_resp_info structure
staging: wilc1000: remove warnings line over 80 characters

drivers/staging/wilc1000/Makefile | 1 -
drivers/staging/wilc1000/coreconfigurator.c | 251 +++------
drivers/staging/wilc1000/coreconfigurator.h | 73 ++-
drivers/staging/wilc1000/host_interface.c | 633 +++++++---------------
drivers/staging/wilc1000/host_interface.h | 13 +-
drivers/staging/wilc1000/linux_mon.c | 30 +-
drivers/staging/wilc1000/linux_wlan.c | 424 ++++++---------
drivers/staging/wilc1000/linux_wlan_common.h | 27 +-
drivers/staging/wilc1000/wilc_debugfs.c | 7 +-
drivers/staging/wilc1000/wilc_msgqueue.c | 18 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 481 ++++++++--------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 8 +-
drivers/staging/wilc1000/wilc_wlan.c | 355 +++++-------
drivers/staging/wilc1000/wilc_wlan.h | 10 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 16 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 14 +-
16 files changed, 883 insertions(+), 1478 deletions(-)

--
1.9.1



2016-02-04 09:26:21

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 31/70] staging: wilc1000: wilc_dealloc_network_info(): renames function variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pstrNetworkInfo to network_info

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 14 +++++++-------
drivers/staging/wilc1000/coreconfigurator.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index c78da2c..a0b80bf 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -354,20 +354,20 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
return 0;
}

-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc_dealloc_network_info(tstrNetworkInfo *network_info)
{
s32 result = 0;

- if (pstrNetworkInfo) {
- if (pstrNetworkInfo->pu8IEs) {
- kfree(pstrNetworkInfo->pu8IEs);
- pstrNetworkInfo->pu8IEs = NULL;
+ if (network_info) {
+ if (network_info->pu8IEs) {
+ kfree(network_info->pu8IEs);
+ network_info->pu8IEs = NULL;
} else {
result = -EFAULT;
}

- kfree(pstrNetworkInfo);
- pstrNetworkInfo = NULL;
+ kfree(network_info);
+ network_info = NULL;

} else {
result = -EFAULT;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index ec810b5..d801e58 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -121,7 +121,7 @@ typedef struct {
} tstrDisconnectNotifInfo;

s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc_dealloc_network_info(tstrNetworkInfo *network_info);
s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
tstrConnectRespInfo **ret_connect_resp_info);
s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info);
--
1.9.1


2016-02-04 09:23:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 04/70] staging: wilc1000: handle connecting error

If connection fails, wilc1000_connecting needs to be set false also and return
immediately because goto lable 'done' doesn't do anything. Remove lable 'done'
as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b0350da..4d63282 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -757,8 +757,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CFG80211_DBG, "No Scan results yet\n");
else
PRINT_D(CFG80211_DBG, "Required bss not in scan results: Error(%d)\n", s32Error);
-
- goto done;
+ wilc_connecting = 0;
+ return s32Error;
}

priv->WILC_WFI_wep_default = 0;
@@ -845,8 +845,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
} else {
s32Error = -ENOTSUPP;
PRINT_ER("Not supported cipher: Error(%d)\n", s32Error);
-
- goto done;
+ wilc_connecting = 0;
+ return s32Error;
}
}

@@ -912,11 +912,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
if (s32Error != 0) {
PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error);
s32Error = -ENOENT;
- goto done;
+ wilc_connecting = 0;
+ return s32Error;
}

-done:
-
return s32Error;
}

--
1.9.1


2016-02-04 09:27:20

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 36/70] staging: wilc1000: remove warnings missing a blank line after declarations

From: Chris Park <[email protected]>

This patch remove warnings reported by checkpatch.pl
for missing a blank line after declarations

Signed-off-by: Chris Park <[email protected]>
Signed-off-by: Leo Kim <[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 e2c84db..dc26322 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1143,6 +1143,7 @@ int wilc_wlan_stop(struct wilc *wilc)
u32 reg = 0;
int ret;
u8 timeout = 10;
+
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);

ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
--
1.9.1


2016-02-04 09:23:41

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 08/70] staging: wilc1000: disable power save when AP mode

This patch disables power save mode in case of AP mode.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4d63282..adca14c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2203,6 +2203,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
PRINT_ER("Error in setting channel\n");

wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+ wilc_set_power_mgmt(vif, 0, 0);

s32Error = wilc_add_beacon(vif, settings->beacon_interval,
settings->dtim_period, beacon->head_len,
--
1.9.1


2016-02-04 09:26:04

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 29/70] staging: wilc1000: wilc_parse_assoc_resp_info(): renames local variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pstrConnectRespInfo to connect_resp_info
- u16AssocRespLen to assoc_resp_len
- pu8IEs to ies
- u16IEsLen to ies_len

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 34 ++++++++++++++---------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 48c8573..c0be33d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -379,33 +379,33 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
tstrConnectRespInfo **ret_connect_resp_info)
{
- tstrConnectRespInfo *pstrConnectRespInfo = NULL;
- u16 u16AssocRespLen = 0;
- u8 *pu8IEs = NULL;
- u16 u16IEsLen = 0;
+ tstrConnectRespInfo *connect_resp_info = NULL;
+ u16 assoc_resp_len = 0;
+ u8 *ies = NULL;
+ u16 ies_len = 0;

- pstrConnectRespInfo = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
- if (!pstrConnectRespInfo)
+ connect_resp_info = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+ if (!connect_resp_info)
return -ENOMEM;

- u16AssocRespLen = (u16)buffer_len;
+ assoc_resp_len = (u16)buffer_len;

- pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(buffer);
- if (pstrConnectRespInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
- pstrConnectRespInfo->u16capability = get_assoc_resp_cap_info(buffer);
- pstrConnectRespInfo->u16AssocID = get_asoc_id(buffer);
+ connect_resp_info->u16ConnectStatus = get_asoc_status(buffer);
+ if (connect_resp_info->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
+ connect_resp_info->u16capability = get_assoc_resp_cap_info(buffer);
+ connect_resp_info->u16AssocID = get_asoc_id(buffer);

- pu8IEs = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
- u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN);
+ ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
+ ies_len = assoc_resp_len - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN);

- pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, GFP_KERNEL);
- if (!pstrConnectRespInfo->pu8RespIEs)
+ connect_resp_info->pu8RespIEs = kmemdup(ies, ies_len, GFP_KERNEL);
+ if (!connect_resp_info->pu8RespIEs)
return -ENOMEM;

- pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
+ connect_resp_info->u16RespIEsLen = ies_len;
}

- *ret_connect_resp_info = pstrConnectRespInfo;
+ *ret_connect_resp_info = connect_resp_info;

return 0;
}
--
1.9.1


2016-02-04 09:23:05

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 02/70] staging: wilc1000: remove unused functions

This patch removes unused following functions.
wilc_del_all_rx_ba_session
wilc_flush_join_req
wilc_wait_msg_queue_idle
wilc_set_mac_address

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 92 -------------------------------
drivers/staging/wilc1000/host_interface.h | 4 --
2 files changed, 96 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 7c75d0e..1dc6af0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3342,25 +3342,6 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
return result;
}

-int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr)
-{
- int result = 0;
- struct host_if_msg msg;
-
- PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", mac_addr[0], mac_addr[1], mac_addr[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, mac_addr, ETH_ALEN);
- msg.vif = vif;
-
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result)
- PRINT_ER("Failed to send message queue: Set mac address\n");
-
- return result;
-}
-
int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
size_t ssid_len, const u8 *ies, size_t ies_len,
wilc_connect_result connect_result, void *user_arg,
@@ -3431,32 +3412,6 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
return result;
}

-int wilc_flush_join_req(struct wilc_vif *vif)
-{
- int result = 0;
- struct host_if_msg msg;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!join_req)
- return -EFAULT;
-
- if (!hif_drv) {
- PRINT_ER("Driver is null\n");
- return -EFAULT;
- }
-
- msg.id = HOST_IF_MSG_FLUSH_CONNECT;
- msg.vif = vif;
-
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result) {
- PRINT_ER("Failed to send message queue: Flush join request\n");
- return -EFAULT;
- }
-
- return result;
-}
-
int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
{
int result = 0;
@@ -3539,24 +3494,6 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
return 0;
}

-int wilc_wait_msg_queue_idle(void)
-{
- int result = 0;
- struct host_if_msg msg;
-
- memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_Q_IDLE;
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result) {
- PRINT_ER("wilc mq send fail\n");
- result = -EINVAL;
- }
-
- down(&hif_sema_wait_response);
-
- return result;
-}
-
int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx)
{
int result = 0;
@@ -4606,35 +4543,6 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo)
return (void *)pNewJoinBssParam;
}

-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char tid)
-{
- int result = 0;
- struct host_if_msg msg;
- struct ba_session_info *ba_session_info = &msg.body.session_info;
- struct host_if_drv *hif_drv = vif->hif_drv;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- memset(&msg, 0, sizeof(struct host_if_msg));
-
- msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
-
- memcpy(ba_session_info->bssid, bssid, ETH_ALEN);
- ba_session_info->tid = tid;
- msg.vif = vif;
-
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result)
- PRINT_ER("wilc_mq_send fail\n");
-
- down(&hif_sema_wait_response);
-
- return result;
-}
-
int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
{
int result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index b828791..3302a5b 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -325,14 +325,11 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
int wilc_set_pmkid_info(struct wilc_vif *vif,
struct host_if_pmkid_attr *pmkid);
int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
-int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr);
-int wilc_wait_msg_queue_idle(void);
int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
size_t ssid_len, const u8 *ies, size_t ies_len,
wilc_connect_result connect_result, void *user_arg,
u8 security, enum AUTHTYPE auth_type,
u8 channel, void *join_params);
-int wilc_flush_join_req(struct wilc_vif *vif);
int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
@@ -356,7 +353,6 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
u32 count);
int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char tid);
int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
u32 duration, u16 chan,
wilc_remain_on_chan_expired expired,
--
1.9.1


2016-02-04 09:24:10

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 13/70] staging: wilc1000: move wilc_send_config_pkt to wilc_wlan.c

This patch moves the function wilc_send_config_pkt to wilc_wlan.c which
handles transport since the purpose of the function is sending/getting of
config information. coreconfiguator.[ch] will be rename with frame.[ch] later.
The print codes of the function is removed also and they will be implemented
with netdev_xx print format later.
struct wid need to be moved to wilc_wlan_if.h which defines configure
informations.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 59 -----------------------------
drivers/staging/wilc1000/coreconfigurator.h | 9 -----
drivers/staging/wilc1000/wilc_wlan.c | 39 +++++++++++++++++++
drivers/staging/wilc1000/wilc_wlan.h | 2 +
drivers/staging/wilc1000/wilc_wlan_if.h | 7 ++++
5 files changed, 48 insertions(+), 68 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 49ae9b1..6f17e2b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -433,62 +433,3 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)

return s32Error;
}
-
-/**
- * @brief sends certain Configuration Packet based on the input WIDs pstrWIDs
- * using driver config layer
- *
- * @details
- * @param[in] pstrWIDs WIDs to be sent in the configuration packet
- * @param[in] u32WIDsCount number of WIDs to be sent in the configuration packet
- * @param[out] pu8RxResp The received Packet Response
- * @param[out] ps32RxRespLen Length of the received Packet Response
- * @return Error code indicating success/failure
- * @note
- * @author mabubakr
- * @date 1 Mar 2012
- * @version 1.0
- */
-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
- u32 count, u32 drv)
-{
- s32 counter = 0, ret = 0;
-
- if (mode == GET_CFG) {
- for (counter = 0; counter < count; counter++) {
- PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter,
- (counter == count - 1));
- if (!wilc_wlan_cfg_get(wilc, !counter,
- wids[counter].id,
- (counter == count - 1),
- drv)) {
- ret = -ETIMEDOUT;
- printk("[Sendconfigpkt]Get Timed out\n");
- break;
- }
- }
- counter = 0;
- for (counter = 0; counter < count; counter++) {
- wids[counter].size = wilc_wlan_cfg_get_val(
- wids[counter].id,
- wids[counter].val,
- wids[counter].size);
- }
- } else if (mode == SET_CFG) {
- for (counter = 0; counter < count; counter++) {
- PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id);
- if (!wilc_wlan_cfg_set(wilc, !counter,
- wids[counter].id,
- wids[counter].val,
- wids[counter].size,
- (counter == count - 1),
- drv)) {
- ret = -ETIMEDOUT;
- printk("[Sendconfigpkt]Set Timed out\n");
- break;
- }
- }
- }
-
- return ret;
-}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index fc43d04..ee107ac 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -70,13 +70,6 @@ typedef enum {
CONNECT_STS_FORCE_16_BIT = 0xFFFF
} tenuConnectSts;

-struct wid {
- u16 id;
- enum wid_type type;
- s32 size;
- s8 *val;
-};
-
typedef struct {
u8 u8Full;
u8 u8Index;
@@ -127,8 +120,6 @@ typedef struct {
size_t ie_len;
} tstrDisconnectNotifInfo;

-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
- u32 count, u32 drv);
s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 04d4c92..265ddfe 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1439,6 +1439,45 @@ int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size)
return ret;
}

+s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+ u32 count, u32 drv)
+{
+ s32 counter = 0, ret = 0;
+
+ if (mode == GET_CFG) {
+ for (counter = 0; counter < count; counter++) {
+ if (!wilc_wlan_cfg_get(wilc, !counter,
+ wids[counter].id,
+ (counter == count - 1),
+ drv)) {
+ ret = -ETIMEDOUT;
+ break;
+ }
+ }
+ counter = 0;
+ for (counter = 0; counter < count; counter++) {
+ wids[counter].size = wilc_wlan_cfg_get_val(
+ wids[counter].id,
+ wids[counter].val,
+ wids[counter].size);
+ }
+ } else if (mode == SET_CFG) {
+ for (counter = 0; counter < count; counter++) {
+ if (!wilc_wlan_cfg_set(wilc, !counter,
+ wids[counter].id,
+ wids[counter].val,
+ wids[counter].size,
+ (counter == count - 1),
+ drv)) {
+ ret = -ETIMEDOUT;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
static u32 init_chip(struct net_device *dev)
{
u32 chipid;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 7f04653..3ebaf0e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -299,4 +299,6 @@ void host_sleep_notify(struct wilc *wilc);
extern bool wilc_enable_ps;
void chip_allow_sleep(struct wilc *wilc);
void chip_wakeup(struct wilc *wilc);
+s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+ u32 count, u32 drv);
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index c446af6..455a98f 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -300,6 +300,13 @@ enum wid_type {
WID_TYPE_FORCE_32BIT = 0xFFFFFFFF
};

+struct wid {
+ u16 id;
+ enum wid_type type;
+ s32 size;
+ s8 *val;
+};
+
typedef enum {
WID_NIL = 0xffff,

--
1.9.1


2016-02-04 09:22:59

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 01/70] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index

Firmware supports sta/ap concurrency so mac index will be passed to wilc.
Remove wilc_set_wfi_drv_handler in scan and connect functions, and call
the function in ndo_open which is wilc_mac_open.
WID_SET_DRV_HANDLER value has been changed as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 11 ++++++-----
drivers/staging/wilc1000/host_interface.h | 3 ++-
drivers/staging/wilc1000/linux_wlan.c | 19 +++++++++++++++++++
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ++----
drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
5 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index d77e2b2..7c75d0e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -320,9 +320,9 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
struct wid wid;

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

result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
hif_drv_handler->handler);
@@ -3557,7 +3557,7 @@ int wilc_wait_msg_queue_idle(void)
return result;
}

-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx)
{
int result = 0;
struct host_if_msg msg;
@@ -3565,6 +3565,7 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
msg.body.drv.handler = index;
+ msg.body.drv.mac_idx = mac_idx;
msg.vif = vif;

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

del_timer_sync(&hif_drv->remain_on_ch_timer);

- wilc_set_wfi_drv_handler(vif, 0);
+ wilc_set_wfi_drv_handler(vif, 0, 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 4c02e6b..b828791 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -217,6 +217,7 @@ struct user_conn_req {

struct drv_handler {
u32 handler;
+ u8 mac_idx;
};

struct op_mode {
@@ -363,7 +364,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
void *user_arg);
int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index);
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx);
int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b368c2d..2fafcc4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1024,6 +1024,25 @@ 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);
+ if (vif->iftype == AP_MODE) {
+ wilc_set_wfi_drv_handler(vif,
+ wilc_get_vif_idx(vif),
+ 0);
+ } else if (!wilc_wlan_get_num_conn_ifcs(wilc)) {
+ wilc_set_wfi_drv_handler(vif,
+ wilc_get_vif_idx(vif),
+ wilc->open_ifcs);
+ } else {
+ if (memcmp(wilc->vif[i ^ 1]->bssid,
+ wilc->vif[i ^ 1]->src_addr, 6))
+ wilc_set_wfi_drv_handler(vif,
+ wilc_get_vif_idx(vif),
+ 0);
+ else
+ wilc_set_wfi_drv_handler(vif,
+ wilc_get_vif_idx(vif),
+ 1);
+ }
wilc_set_operation_mode(vif, vif->iftype);
break;
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4eede2b..b0350da 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -633,7 +633,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)

priv->u32RcvdChCount = 0;

- wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
reset_shadow_found();

priv->bCfgScanning = true;
@@ -714,8 +713,6 @@ 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, 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))) {
PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n");
@@ -2152,7 +2149,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
vif->iftype = AP_MODE;

if (wl->initialized) {
- wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
+ wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
+ 0);
wilc_set_operation_mode(vif, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 618903c..d306ec1a 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -832,7 +832,6 @@ typedef enum {

/* Custom Integer WID list */
WID_GET_INACTIVE_TIME = 0x2084,
- WID_SET_DRV_HANDLER = 0X2085,
WID_SET_OPERATION_MODE = 0X2086,
/* EMAC String WID list */
WID_SSID = 0x3000,
@@ -865,6 +864,7 @@ typedef enum {
WID_MODEL_NAME = 0x3027, /*Added for CAPI tool */
WID_MODEL_NUM = 0x3028, /*Added for CAPI tool */
WID_DEVICE_NAME = 0x3029, /*Added for CAPI tool */
+ WID_SET_DRV_HANDLER = 0x3030,

/* NMAC String WID list */
WID_11N_P_ACTION_REQ = 0x3080,
--
1.9.1


2016-02-04 09:23:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 05/70] staging: wilc1000: tcp_process: fix a build warning

This patch fixes build warning "flags is used uninitialized" when
TCP_ACK_FILTER is defined.

Fixes: 562ed3f1f78a ("staging/wilc1000: pass struct wilc to most linux_wlan.c functions")
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 5682581..25cf325 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -234,6 +234,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
vif = netdev_priv(dev);
wilc = vif->wilc;

+ spin_lock_irqsave(&wilc->txq_spinlock, flags);

eth_hdr_ptr = &buffer[0];
h_proto = ntohs(*((unsigned short *)&eth_hdr_ptr[12]));
--
1.9.1


2016-02-04 09:27:09

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 35/70] staging: wilc1000: remove unnecessary braces

From: Chris Park <[email protected]>

This patch remove warnings reported by checkpatch.pl
for unnecessary braces

Signed-off-by: Chris Park <[email protected]>
Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 8618e27..e2c84db 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -984,15 +984,15 @@ void wilc_handle_isr(struct wilc *wilc)
if (int_status & PLL_INT_EXT)
wilc_pllupdate_isr_ext(wilc, int_status);

- if (int_status & DATA_INT_EXT) {
+ if (int_status & DATA_INT_EXT)
wilc_wlan_handle_isr_ext(wilc, int_status);
- }
+
if (int_status & SLEEP_INT_EXT)
wilc_sleeptimer_isr_ext(wilc, int_status);

- if (!(int_status & (ALL_INT_EXT))) {
+ if (!(int_status & (ALL_INT_EXT)))
wilc_unknown_isr_ext(wilc);
- }
+
release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
EXPORT_SYMBOL_GPL(wilc_handle_isr);
--
1.9.1


2016-02-04 09:23:47

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 09/70] staging: wilc1000: fix bug on p2p connection

In case of action frame, size -7 is correct, but in this case, size should be
used as it is.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index adca14c..e178b1b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1728,7 +1728,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
}
}

- cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
+ cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, 0);
}
}

--
1.9.1


2016-02-04 09:25:57

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 28/70] staging: wilc1000: wilc_parse_assoc_resp_info(): renames function variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pu8Buffer to buffer
- u32BufferLen to buffer_len
- ppstrConnectRespInfo to ret_connect_resp_info

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 16 ++++++++--------
drivers/staging/wilc1000/coreconfigurator.h | 5 ++---
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 88e5661..48c8573 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -376,8 +376,8 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
return result;
}

-s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
- tstrConnectRespInfo **ppstrConnectRespInfo)
+s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+ tstrConnectRespInfo **ret_connect_resp_info)
{
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
@@ -388,14 +388,14 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
if (!pstrConnectRespInfo)
return -ENOMEM;

- u16AssocRespLen = (u16)u32BufferLen;
+ u16AssocRespLen = (u16)buffer_len;

- pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(pu8Buffer);
+ pstrConnectRespInfo->u16ConnectStatus = get_asoc_status(buffer);
if (pstrConnectRespInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
- pstrConnectRespInfo->u16capability = get_assoc_resp_cap_info(pu8Buffer);
- pstrConnectRespInfo->u16AssocID = get_asoc_id(pu8Buffer);
+ pstrConnectRespInfo->u16capability = get_assoc_resp_cap_info(buffer);
+ pstrConnectRespInfo->u16AssocID = get_asoc_id(buffer);

- pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
+ pu8IEs = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN);

pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, GFP_KERNEL);
@@ -405,7 +405,7 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
}

- *ppstrConnectRespInfo = pstrConnectRespInfo;
+ *ret_connect_resp_info = pstrConnectRespInfo;

return 0;
}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index aec0779..6a2c323 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -122,9 +122,8 @@ typedef struct {

s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info);
s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
-
-s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
- tstrConnectRespInfo **ppstrConnectRespInfo);
+s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
+ tstrConnectRespInfo **ret_connect_resp_info);
s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
u32 u32Length);
--
1.9.1


2016-02-04 09:25:45

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 26/70] staging: wilc1000: wilc_parse_network_info(): renames local inner variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pu8TimElm to tim_elm
- pu8IEs to ies
- u16IEsLen to ies_len
- u32Tsf_Lo to tsf_lo
- u32Tsf_Hi to tsf_hi

And, remove the prefix variable defined name, below are:
- u8index to index
- pu8msa to msa

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 54 ++++++++++++++---------------
1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 24afeb8..2a4e324 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -295,14 +295,14 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
wid_val = &msg_buffer[8];

{
- u8 *pu8msa = NULL;
+ u8 *msa = NULL;
u16 rx_len = 0;
- u8 *pu8TimElm = NULL;
- u8 *pu8IEs = NULL;
- u16 u16IEsLen = 0;
- u8 u8index = 0;
- u32 u32Tsf_Lo;
- u32 u32Tsf_Hi;
+ u8 *tim_elm = NULL;
+ u8 *ies = NULL;
+ u16 ies_len = 0;
+ u8 index = 0;
+ u32 tsf_lo;
+ u32 tsf_hi;

network_info = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
if (!network_info)
@@ -310,43 +310,43 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)

network_info->s8rssi = wid_val[0];

- pu8msa = &wid_val[1];
+ msa = &wid_val[1];

rx_len = wid_len - 1;
- network_info->u16CapInfo = get_cap_info(pu8msa);
- network_info->u32Tsf = get_beacon_timestamp_lo(pu8msa);
+ network_info->u16CapInfo = get_cap_info(msa);
+ network_info->u32Tsf = get_beacon_timestamp_lo(msa);
PRINT_D(CORECONFIG_DBG, "TSF :%x\n", network_info->u32Tsf);

- u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
- u32Tsf_Hi = get_beacon_timestamp_hi(pu8msa);
+ tsf_lo = get_beacon_timestamp_lo(msa);
+ tsf_hi = get_beacon_timestamp_hi(msa);

- network_info->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
+ network_info->u64Tsf = tsf_lo | ((u64)tsf_hi << 32);

- get_ssid(pu8msa, network_info->au8ssid, &network_info->u8SsidLen);
- get_BSSID(pu8msa, network_info->au8bssid);
+ get_ssid(msa, network_info->au8ssid, &network_info->u8SsidLen);
+ get_BSSID(msa, network_info->au8bssid);

- network_info->u8channel = get_current_channel_802_11n(pu8msa,
+ network_info->u8channel = get_current_channel_802_11n(msa,
rx_len + FCS_LEN);

- u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
+ index = MAC_HDR_LEN + TIME_STAMP_LEN;

- network_info->u16BeaconPeriod = get_beacon_period(pu8msa + u8index);
+ network_info->u16BeaconPeriod = get_beacon_period(msa + index);

- u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
+ index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;

- pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
- if (pu8TimElm)
- network_info->u8DtimPeriod = pu8TimElm[3];
- pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
- u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);
+ tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
+ if (tim_elm)
+ network_info->u8DtimPeriod = tim_elm[3];
+ ies = &msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
+ ies_len = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);

- if (u16IEsLen > 0) {
- network_info->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+ if (ies_len > 0) {
+ network_info->pu8IEs = kmemdup(ies, ies_len,
GFP_KERNEL);
if (!network_info->pu8IEs)
return -ENOMEM;
}
- network_info->u16IEsLen = u16IEsLen;
+ network_info->u16IEsLen = ies_len;
}

*ret_network_info = network_info;
--
1.9.1


2016-02-04 09:24:04

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 12/70] staging: wilc1000: get mac address after setting drv handler

This patch moves wilc_get_mac_address and address memcpy function after
calling wilc_set_wif_drv_handler to get selected mac address.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2fafcc4..9de57ae 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1018,12 +1018,8 @@ int wilc_mac_open(struct net_device *ndev)
return ret;
}

- 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++) {
if (ndev == wl->vif[i]->ndev) {
- memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
if (vif->iftype == AP_MODE) {
wilc_set_wfi_drv_handler(vif,
wilc_get_vif_idx(vif),
@@ -1044,6 +1040,11 @@ int wilc_mac_open(struct net_device *ndev)
1);
}
wilc_set_operation_mode(vif, vif->iftype);
+
+ wilc_get_mac_address(vif, mac_add);
+ netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
+ memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+
break;
}
}
--
1.9.1


2016-02-04 09:27:46

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 39/70] staging: wilc1000: wilc_msgqueue.c: removes debug print log

From: Leo Kim <[email protected]>

This patches removes unnecessary debug print logs.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_msgqueue.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c
index 5fe85eb..780ddd3 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -60,15 +60,11 @@ int wilc_mq_send(struct message_queue *mq,
unsigned long flags;
struct message *new_msg = NULL;

- if ((!mq) || (send_buf_size == 0) || (!send_buf)) {
- PRINT_ER("mq or send_buf is null\n");
+ if (!mq || (send_buf_size == 0) || !send_buf)
return -EINVAL;
- }

- if (mq->exiting) {
- PRINT_ER("mq fail\n");
+ if (mq->exiting)
return -EFAULT;
- }

/* construct a new message */
new_msg = kmalloc(sizeof(*new_msg), GFP_ATOMIC);
@@ -107,15 +103,11 @@ int wilc_mq_recv(struct message_queue *mq,
struct message *msg;
unsigned long flags;

- if ((!mq) || (recv_buf_size == 0) || (!recv_buf) || (!recv_len)) {
- PRINT_ER("mq or recv_buf is null\n");
+ if (!mq || (recv_buf_size == 0) || !recv_buf || !recv_len)
return -EINVAL;
- }

- if (mq->exiting) {
- PRINT_ER("mq fail\n");
+ if (mq->exiting)
return -EFAULT;
- }

spin_lock_irqsave(&mq->lock, flags);
mq->recv_count++;
@@ -127,7 +119,6 @@ int wilc_mq_recv(struct message_queue *mq,
if (list_empty(&mq->msg_list)) {
spin_unlock_irqrestore(&mq->lock, flags);
up(&mq->sem);
- PRINT_ER("msg is null\n");
return -EFAULT;
}
/* check buffer size */
@@ -135,7 +126,6 @@ int wilc_mq_recv(struct message_queue *mq,
if (recv_buf_size < msg->len) {
spin_unlock_irqrestore(&mq->lock, flags);
up(&mq->sem);
- PRINT_ER("recv_buf_size overflow\n");
return -EOVERFLOW;
}

--
1.9.1


2016-02-04 09:26:58

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 34/70] staging: wilc1000: remove useless function

From: Chris Park <[email protected]>

This patch remove useless function remove_TCP_related
in wilc_wlan.c file

Signed-off-by: Chris Park <[email protected]>
Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 400d311..8618e27 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -206,15 +206,6 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
}
return 0;
}
-static inline int remove_TCP_related(struct wilc *wilc)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&wilc->txq_spinlock, flags);
-
- spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
- return 0;
-}

static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
{
--
1.9.1


2016-02-04 09:24:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 14/70] staging: wilc1000: pass vif to wilc_send_config_pkt

This patch passes vif instead of wilc to wilc_send_config_pkt and it's related
functions as well, because we need vif which is currently being used and
vif has wilc as well.
Change custom print with netdev_xxx format if there are custom print inside
the functions we have changed.

Function parameter of following functions are modified to vif.
wilc_send_config_pkt
wilc_wlan_cfg_set
wilc_wlan_cfg_get
wilc_wlan_cfg_commit
wilc_wlan_txq_add_cfg_pkt
wilc_wlan_txq_add_to_head

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 94 +++++++++++++++----------------
drivers/staging/wilc1000/linux_wlan.c | 88 ++++++++++++++---------------
drivers/staging/wilc1000/wilc_wlan.c | 57 +++++++++++--------
drivers/staging/wilc1000/wilc_wlan.h | 7 ++-
4 files changed, 128 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 67bcf88..6f583a4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -312,7 +312,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,

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

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

if (result) {
@@ -334,7 +334,7 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
wid.val = (s8 *)hif_drv_handler;
wid.size = sizeof(*hif_drv_handler);

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

if (!hif_drv_handler->handler)
@@ -359,7 +359,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);

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

if ((hif_op_mode->mode) == IDLE_MODE)
@@ -392,7 +392,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(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

host_int_get_ipaddress(vif, firmware_ip_addr, idx);
@@ -417,7 +417,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;

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

PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -460,7 +460,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(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -482,7 +482,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;

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

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

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

if (result)
@@ -902,7 +902,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(vif->wilc, SET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif, SET_CFG, strWIDList,
u32WidsCount,
wilc_get_vif_idx(vif));

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

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

if (result) {
@@ -1204,7 +1204,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(vif->wilc, SET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif, SET_CFG, strWIDList,
u32WidsCount,
wilc_get_vif_idx(vif));
if (result) {
@@ -1302,7 +1302,7 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif)

u32WidsCount++;

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

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

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

- result = wilc_send_config_pkt(vif->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif, SET_CFG,
strWIDList, 3,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
@@ -1780,7 +1780,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(vif->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
@@ -1793,7 +1793,7 @@ static int Handle_Key(struct wilc_vif *vif,
wid.val = s8idxarray;
wid.size = 1;

- result = wilc_send_config_pkt(vif->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
} else if (pstrHostIFkeyAttr->action & DEFAULTKEY) {
@@ -1804,7 +1804,7 @@ static int Handle_Key(struct wilc_vif *vif,

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

- result = wilc_send_config_pkt(vif->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
}
@@ -1838,7 +1838,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(vif->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif, SET_CFG,
strWIDList, 2,
wilc_get_vif_idx(vif));

@@ -1870,7 +1870,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(vif->wilc, SET_CFG,
+ result = wilc_send_config_pkt(vif, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));

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

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

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

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

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

eth_zero_addr(wilc_connected_ssid);

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

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

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

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

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

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

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

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

- result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to get LINKSPEED value\n");
@@ -2189,7 +2189,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
u32WidsCount++;

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

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

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

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

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

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

if (result) {
@@ -2297,8 +2297,8 @@ static void Handle_AddBeacon(struct wilc_vif *vif,
memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
pu8CurrByte += pstrSetBeaconParam->tail_len;

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

@@ -2326,7 +2326,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif)

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

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

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result != 0)
PRINT_ER("Failed to send add station config packet\n");
@@ -2441,7 +2441,7 @@ static void Handle_DelAllSta(struct wilc_vif *vif,
pu8CurrByte += ETH_ALEN;
}

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2473,7 +2473,7 @@ static void Handle_DelStation(struct wilc_vif *vif,

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

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2501,7 +2501,7 @@ static void Handle_EditStation(struct wilc_vif *vif,
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send edit station config packet\n");
@@ -2563,7 +2563,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(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result != 0)
PRINT_ER("Failed to set remain on channel\n");
@@ -2611,7 +2611,7 @@ static int Handle_RegisterFrame(struct wilc_vif *vif,

wid.size = sizeof(u16) + 2;

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to frame register config packet\n");
@@ -2646,7 +2646,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(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result != 0) {
PRINT_ER("Failed to set remain on channel\n");
@@ -2704,7 +2704,7 @@ static void Handle_PowerManagement(struct wilc_vif *vif,

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

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send power management config packet\n");
@@ -2741,7 +2741,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(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send setup multicast config packet\n");
@@ -2777,7 +2777,7 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
*ptr++ = 0;
*ptr++ = 32;

- result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
@@ -2799,8 +2799,8 @@ static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
wid.val = &tx_pwr;
wid.size = sizeof(char);

- ret = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
+ ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (ret)
netdev_err(vif->ndev, "Failed to set TX PWR\n");
}
@@ -2815,8 +2815,8 @@ static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr)
wid.val = (s8 *)tx_pwr;
wid.size = sizeof(char);

- ret = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
+ ret = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
if (ret)
netdev_err(vif->ndev, "Failed to get TX PWR\n");

@@ -3513,7 +3513,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
wid.val = pu8AssocRespInfo;
wid.size = u32MaxAssocRespInfoLen;

- result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(vif, GET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
*pu32RcvdAssocRespInfoLen = 0;
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9de57ae..a3b4939 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -526,86 +526,86 @@ static int linux_wlan_init_test_config(struct net_device *dev,

*(int *)c_val = 1;

- if (!wilc_wlan_cfg_set(wilc, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_;

c_val[0] = 0;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = INFRASTRUCTURE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = RATE_AUTO;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = G_MIXED_11B_2_MODE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = G_SHORT_PREAMBLE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_PREAMBLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = AUTO_PROT;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = ACTIVE_SCAN;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = SITE_SURVEY_OFF;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_;

*((int *)c_val) = 0xffff;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;

*((int *)c_val) = 2346;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;

c_val[0] = 0;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = NO_POWERSAVE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = OPEN_SYSTEM;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
goto _fail_;

strcpy(c_val, "123456790abcdef1234567890");
- if (!wilc_wlan_cfg_set(wilc, 0, WID_WEP_KEY_VALUE, c_val,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_WEP_KEY_VALUE, c_val,
(strlen(c_val) + 1), 0, 0))
goto _fail_;

strcpy(c_val, "12345678");
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0,
0))
goto _fail_;

strcpy(c_val, "password");
- if (!wilc_wlan_cfg_set(wilc, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1),
+ if (!wilc_wlan_cfg_set(vif, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1),
0, 0))
goto _fail_;

@@ -613,106 +613,106 @@ static int linux_wlan_init_test_config(struct net_device *dev,
c_val[1] = 168;
c_val[2] = 1;
c_val[3] = 112;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
goto _fail_;

c_val[0] = 3;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 3;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = NORMAL_ACK;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 0;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1,
0, 0))
goto _fail_;

c_val[0] = 48;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0,
0))
goto _fail_;

c_val[0] = 28;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0,
0))
goto _fail_;

*((int *)c_val) = 100;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
goto _fail_;

c_val[0] = REKEY_DISABLE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
goto _fail_;

*((int *)c_val) = 84600;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
goto _fail_;

*((int *)c_val) = 500;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0,
0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0,
0))
goto _fail_;

c_val[0] = G_SELF_CTS_PROT;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = HT_MIXED_MODE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_OPERATING_MODE, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, c_val, 1, 0,
0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0,
0))
goto _fail_;

memcpy(c_val, mac_add, 6);

- if (!wilc_wlan_cfg_set(wilc, 0, WID_MAC_ADDR, c_val, 6, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_MAC_ADDR, c_val, 6, 0, 0))
goto _fail_;

c_val[0] = DETECT_PROTECT_REPORT;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1,
0, 0))
goto _fail_;

c_val[0] = RTS_CTS_NONHT_PROT;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 0;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0,
0))
goto _fail_;

c_val[0] = MIMO_MODE;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 7;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0,
0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1,
+ if (!wilc_wlan_cfg_set(vif, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1,
1, 1))
goto _fail_;

@@ -927,7 +927,7 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
goto _fail_irq_enable_;
}

- if (wilc_wlan_cfg_get(wl, 1, WID_FIRMWARE_VERSION, 1, 0)) {
+ if (wilc_wlan_cfg_get(vif, 1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 265ddfe..392ef16 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -113,9 +113,11 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
up(&wilc->txq_event);
}

-static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
+static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, struct txq_entry_t *tqe)
{
unsigned long flags;
+ struct wilc *wilc = vif->wilc;
+
if (wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT))
return -1;
@@ -134,12 +136,12 @@ static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
wilc->txq_head = tqe;
}
wilc->txq_entries += 1;
- PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries);
+ netdev_dbg(vif->ndev, "Number of entries in TxQ = %d\n", wilc->txq_entries);

spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
up(&wilc->txq_add_to_head_cs);
up(&wilc->txq_event);
- PRINT_D(TX_DBG, "Wake up the txq_handler\n");
+ netdev_dbg(vif->ndev, "Wake up the txq_handler\n");

return 0;
}
@@ -351,20 +353,22 @@ static bool is_tcp_ack_filter_enabled(void)
return enabled;
}

-static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size)
+static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
+ u32 buffer_size)
{
struct txq_entry_t *tqe;
+ struct wilc *wilc = vif->wilc;

- PRINT_D(TX_DBG, "Adding config packet ...\n");
+ netdev_dbg(vif->ndev, "Adding config packet ...\n");
if (wilc->quit) {
- PRINT_D(TX_DBG, "Return due to clear function\n");
+ netdev_dbg(vif->ndev, "Return due to clear function\n");
up(&wilc->cfg_event);
return 0;
}

tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC);
if (!tqe) {
- PRINT_ER("Failed to allocate memory\n");
+ netdev_err(vif->ndev, "Failed to allocate memory\n");
return 0;
}

@@ -374,9 +378,9 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_s
tqe->tx_complete_func = NULL;
tqe->priv = NULL;
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
- PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
+ netdev_dbg(vif->ndev, "Adding the config packet at the Queue tail\n");

- if (wilc_wlan_txq_add_to_head(wilc, tqe))
+ if (wilc_wlan_txq_add_to_head(vif, tqe))
return 0;
return 1;
}
@@ -1326,8 +1330,10 @@ void wilc_wlan_cleanup(struct net_device *dev)
wilc->hif_func->hif_deinit(NULL);
}

-static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
+static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
+ u32 drv_handler)
{
+ struct wilc *wilc = vif->wilc;
struct wilc_cfg_frame *cfg = &wilc->cfg_frame;
int total_len = wilc->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
int seq_no = wilc->cfg_seq_no % 256;
@@ -1346,17 +1352,18 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
cfg->wid_header[7] = (u8)(driver_handler >> 24);
wilc->cfg_seq_no = seq_no;

- if (!wilc_wlan_txq_add_cfg_pkt(wilc, &cfg->wid_header[0], total_len))
+ if (!wilc_wlan_txq_add_cfg_pkt(vif, &cfg->wid_header[0], total_len))
return -1;

return 0;
}

-int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
+int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u32 wid, u8 *buffer,
u32 buffer_size, int commit, u32 drv_handler)
{
u32 offset;
int ret_size;
+ struct wilc *wilc = vif->wilc;

if (wilc->cfg_frame_in_use)
return 0;
@@ -1371,17 +1378,18 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
wilc->cfg_frame_offset = offset;

if (commit) {
- PRINT_D(TX_DBG, "[WILC]PACKET Commit with sequence number %d\n",
- wilc->cfg_seq_no);
- PRINT_D(RX_DBG, "Processing cfg_set()\n");
+ netdev_dbg(vif->ndev,
+ "[WILC]PACKET Commit with sequence number %d\n",
+ wilc->cfg_seq_no);
+ netdev_dbg(vif->ndev, "Processing cfg_set()\n");
wilc->cfg_frame_in_use = 1;

- if (wilc_wlan_cfg_commit(wilc, WILC_CFG_SET, drv_handler))
+ if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler))
ret_size = 0;

if (wilc_lock_timeout(wilc, &wilc->cfg_event,
CFG_PKTS_TIMEOUT)) {
- PRINT_D(TX_DBG, "Set Timed Out\n");
+ netdev_dbg(vif->ndev, "Set Timed Out\n");
ret_size = 0;
}
wilc->cfg_frame_in_use = 0;
@@ -1392,11 +1400,12 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
return ret_size;
}

-int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
+int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u32 wid, int commit,
u32 drv_handler)
{
u32 offset;
int ret_size;
+ struct wilc *wilc = vif->wilc;

if (wilc->cfg_frame_in_use)
return 0;
@@ -1413,15 +1422,15 @@ int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
if (commit) {
wilc->cfg_frame_in_use = 1;

- if (wilc_wlan_cfg_commit(wilc, WILC_CFG_QUERY, drv_handler))
+ if (wilc_wlan_cfg_commit(vif, WILC_CFG_QUERY, drv_handler))
ret_size = 0;

if (wilc_lock_timeout(wilc, &wilc->cfg_event,
CFG_PKTS_TIMEOUT)) {
- PRINT_D(TX_DBG, "Get Timed Out\n");
+ netdev_dbg(vif->ndev, "Get Timed Out\n");
ret_size = 0;
}
- PRINT_D(GENERIC_DBG, "[WILC]Get Response received\n");
+ netdev_dbg(vif->ndev, "[WILC]Get Response received\n");
wilc->cfg_frame_in_use = 0;
wilc->cfg_frame_offset = 0;
wilc->cfg_seq_no += 1;
@@ -1439,14 +1448,14 @@ int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size)
return ret;
}

-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+s32 wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
u32 count, u32 drv)
{
s32 counter = 0, ret = 0;

if (mode == GET_CFG) {
for (counter = 0; counter < count; counter++) {
- if (!wilc_wlan_cfg_get(wilc, !counter,
+ if (!wilc_wlan_cfg_get(vif, !counter,
wids[counter].id,
(counter == count - 1),
drv)) {
@@ -1463,7 +1472,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
}
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
- if (!wilc_wlan_cfg_set(wilc, !counter,
+ if (!wilc_wlan_cfg_set(vif, !counter,
wids[counter].id,
wids[counter].val,
wids[counter].size,
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 3ebaf0e..e913ae7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -268,6 +268,7 @@ struct wilc_cfg_rsp {
};

struct wilc;
+struct wilc_vif;

int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size);
int wilc_wlan_start(struct wilc *);
@@ -277,9 +278,9 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count);
void wilc_handle_isr(struct wilc *wilc);
void wilc_wlan_cleanup(struct net_device *dev);
-int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
+int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u32 wid, u8 *buffer,
u32 buffer_size, int commit, u32 drv_handler);
-int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
+int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u32 wid, int commit,
u32 drv_handler);
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
@@ -299,6 +300,6 @@ void host_sleep_notify(struct wilc *wilc);
extern bool wilc_enable_ps;
void chip_allow_sleep(struct wilc *wilc);
void chip_wakeup(struct wilc *wilc);
-s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+s32 wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
u32 count, u32 drv);
#endif
--
1.9.1


2016-02-04 09:26:15

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 30/70] staging: wilc1000: wilc_dealloc_assoc_resp_info(): renames function variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pstrConnectRespInfo to connect_resp_info

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 14 +++++++-------
drivers/staging/wilc1000/coreconfigurator.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index c0be33d..c78da2c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -410,20 +410,20 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
return 0;
}

-s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info)
{
s32 result = 0;

- if (pstrConnectRespInfo) {
- if (pstrConnectRespInfo->pu8RespIEs) {
- kfree(pstrConnectRespInfo->pu8RespIEs);
- pstrConnectRespInfo->pu8RespIEs = NULL;
+ if (connect_resp_info) {
+ if (connect_resp_info->pu8RespIEs) {
+ kfree(connect_resp_info->pu8RespIEs);
+ connect_resp_info->pu8RespIEs = NULL;
} else {
result = -EFAULT;
}

- kfree(pstrConnectRespInfo);
- pstrConnectRespInfo = NULL;
+ kfree(connect_resp_info);
+ connect_resp_info = NULL;

} else {
result = -EFAULT;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 6a2c323..ec810b5 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -124,7 +124,7 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info);
s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
tstrConnectRespInfo **ret_connect_resp_info);
-s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *connect_resp_info);
void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
u32 u32Length);
void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
--
1.9.1


2016-02-04 09:23:53

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 10/70] staging: wilc1000: add ops tx power in cfg80211

This patch implements set_tx_power and get_tx_power of cfg80211_ops.
In addition, Id of HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS is changed with 37.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 88 ++++++++++++++++++++++-
drivers/staging/wilc1000/host_interface.h | 2 +
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 35 +++++++++
drivers/staging/wilc1000/wilc_wlan_if.h | 1 +
4 files changed, 125 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4bbf38c..4b1d92c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -46,7 +46,9 @@
#define HOST_IF_MSG_DEL_BA_SESSION 34
#define HOST_IF_MSG_Q_IDLE 35
#define HOST_IF_MSG_DEL_ALL_STA 36
-#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34
+#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 37
+#define HOST_IF_MSG_SET_TX_POWER 38
+#define HOST_IF_MSG_GET_TX_POWER 39
#define HOST_IF_MSG_EXIT 100

#define HOST_IF_SCAN_TIMEOUT 4000
@@ -166,6 +168,10 @@ struct sta_inactive_t {
u8 mac[6];
};

+struct tx_power {
+ u8 tx_pwr;
+};
+
union message_body {
struct scan_attr scan_info;
struct connect_attr con_info;
@@ -191,6 +197,7 @@ union message_body {
struct reg_frame reg_frame;
char *data;
struct del_all_sta del_all_sta_info;
+ struct tx_power tx_power;
};

struct host_if_msg {
@@ -2783,6 +2790,40 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
return result;
}

+static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
+{
+ int ret;
+ struct wid wid;
+
+ wid.id = (u16)WID_TX_POWER;
+ wid.type = WID_CHAR;
+ wid.val = &tx_pwr;
+ wid.size = sizeof(char);
+
+ ret = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (ret)
+ netdev_err(vif->ndev, "Failed to set TX PWR\n");
+}
+
+static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr)
+{
+ s32 ret = 0;
+ struct wid wid;
+
+ wid.id = (u16)WID_TX_POWER;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)tx_pwr;
+ wid.size = sizeof(char);
+
+ ret = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (ret)
+ netdev_err(vif->ndev, "Failed to get TX PWR\n");
+
+ up(&hif_sema_wait_response);
+}
+
static int hostIFthread(void *pvArg)
{
u32 u32Ret;
@@ -2986,6 +3027,13 @@ static int hostIFthread(void *pvArg)
Handle_DelAllSta(msg.vif, &msg.body.del_all_sta_info);
break;

+ case HOST_IF_MSG_SET_TX_POWER:
+ handle_set_tx_pwr(msg.vif, msg.body.tx_power.tx_pwr);
+ break;
+
+ case HOST_IF_MSG_GET_TX_POWER:
+ handle_get_tx_pwr(msg.vif, &msg.body.tx_power.tx_pwr);
+ break;
default:
PRINT_ER("[Host Interface] undefined Received Msg ID\n");
break;
@@ -4596,3 +4644,41 @@ static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)

return result;
}
+
+int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
+{
+ int ret = 0;
+ struct host_if_msg msg;
+
+ memset(&msg, 0, sizeof(struct host_if_msg));
+
+ msg.id = HOST_IF_MSG_SET_TX_POWER;
+ msg.body.tx_power.tx_pwr = tx_power;
+ msg.vif = vif;
+
+ ret = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (ret)
+ netdev_err(vif->ndev, "wilc_mq_send fail\n");
+
+ return ret;
+}
+
+int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
+{
+ int ret = 0;
+ struct host_if_msg msg;
+
+ memset(&msg, 0, sizeof(struct host_if_msg));
+
+ msg.id = HOST_IF_MSG_GET_TX_POWER;
+ msg.vif = vif;
+
+ ret = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (ret)
+ netdev_err(vif->ndev, "Failed to get TX PWR\n");
+
+ down(&hif_sema_wait_response);
+ *tx_power = msg.body.tx_power.tx_pwr;
+
+ return ret;
+}
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 3302a5b..69c36a7 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -365,6 +365,8 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
int wilc_get_vif_idx(struct wilc_vif *vif);
+int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
+int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);

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 e178b1b..e6133fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2504,6 +2504,39 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled);
}

+static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+ enum nl80211_tx_power_setting type, int mbm)
+{
+ int ret;
+ s32 tx_power = MBM_TO_DBM(mbm);
+ struct wilc_priv *priv = wiphy_priv(wiphy);
+ struct wilc_vif *vif = netdev_priv(priv->dev);
+
+ if (tx_power < 0)
+ tx_power = 0;
+ else if (tx_power > 18)
+ tx_power = 18;
+ ret = wilc_set_tx_power(vif, tx_power);
+ if (ret)
+ netdev_err(vif->ndev, "Failed to set tx power\n");
+
+ return ret;
+}
+
+static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+ int *dbm)
+{
+ int ret;
+ struct wilc_priv *priv = wiphy_priv(wiphy);
+ struct wilc_vif *vif = netdev_priv(priv->dev);
+
+ ret = wilc_get_tx_power(vif, (u8 *)dbm);
+ if (ret)
+ netdev_err(vif->ndev, "Failed to get tx power\n");
+
+ return ret;
+}
+
static struct cfg80211_ops wilc_cfg80211_ops = {
.set_monitor_channel = set_channel,
.scan = scan,
@@ -2542,6 +2575,8 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
.suspend = wilc_suspend,
.resume = wilc_resume,
.set_wakeup = wilc_set_wakeup,
+ .set_tx_power = set_tx_power,
+ .get_tx_power = get_tx_power,

};

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index d306ec1a..c446af6 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -761,6 +761,7 @@ typedef enum {
WID_DEL_BEACON = 0x00CA,

WID_LOGTerminal_Switch = 0x00CD,
+ WID_TX_POWER = 0x00CE,
/* EMAC Short WID list */
/* RTS Threshold */
/*
--
1.9.1


2016-02-04 09:25:21

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 24/70] staging: wilc1000: wilc_parse_network_info(): renames function variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pu8MsgBuffer to msg_buffer
- ppstrNetworkInfo to ret_network_info

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 16 ++++++++--------
drivers/staging/wilc1000/coreconfigurator.h | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 6f17e2b..43f0a29 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -270,7 +270,7 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 rx_len)
return 0;
}

-s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
+s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
{
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
@@ -281,18 +281,18 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo
u16 u16WidLen = 0;
u8 *pu8WidVal = NULL;

- u8MsgType = pu8MsgBuffer[0];
+ u8MsgType = msg_buffer[0];

if ('N' != u8MsgType) {
PRINT_ER("Received Message format incorrect.\n");
return -EFAULT;
}

- u8MsgID = pu8MsgBuffer[1];
- u16MsgLen = MAKE_WORD16(pu8MsgBuffer[2], pu8MsgBuffer[3]);
- u16WidID = MAKE_WORD16(pu8MsgBuffer[4], pu8MsgBuffer[5]);
- u16WidLen = MAKE_WORD16(pu8MsgBuffer[6], pu8MsgBuffer[7]);
- pu8WidVal = &pu8MsgBuffer[8];
+ u8MsgID = msg_buffer[1];
+ u16MsgLen = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
+ u16WidID = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
+ u16WidLen = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
+ pu8WidVal = &msg_buffer[8];

{
u8 *pu8msa = NULL;
@@ -350,7 +350,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo

}

- *ppstrNetworkInfo = pstrNetworkInfo;
+ *ret_network_info = pstrNetworkInfo;

return 0;
}
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index ee107ac..aec0779 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -120,7 +120,7 @@ typedef struct {
size_t ie_len;
} tstrDisconnectNotifInfo;

-s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
+s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info);
s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);

s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
--
1.9.1


2016-02-04 09:24:43

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 18/70] staging: wilc1000: remove warnings line over 80 characters

From: Leo Kim <[email protected]>

This patch removes the warnings reported by checkpatch.pl
for line over 80 characters.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index f5f787e..1446b19 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,7 +25,8 @@

#include <linux/semaphore.h>

-static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
+static int dev_state_ev_handler(struct notifier_block *this,
+ unsigned long event, void *ptr);

static struct notifier_block g_dev_notifier = {
.notifier_call = dev_state_ev_handler
@@ -57,7 +58,8 @@ static const struct net_device_ops wilc_netdev_ops = {

};

-static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr)
+static int dev_state_ev_handler(struct notifier_block *this,
+ unsigned long event, void *ptr)
{
struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
struct wilc_priv *priv;
--
1.9.1


2016-02-04 09:27:31

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 37/70] staging: wilc1000: Optimize code of wilc_get_chipid function

From: Chris Park <[email protected]>

This patch optimize code of wilc_get_chipid function.
u8 type changed to boolean type and removed unnecessary if statement.

Signed-off-by: Chris Park <[email protected]>
Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
drivers/staging/wilc1000/wilc_wlan.c | 19 +++++++------------
drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 22a2f98..9e5dea4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -388,7 +388,7 @@ int wilc_wlan_get_firmware(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- chip_id = wilc_get_chipid(wilc, 0);
+ chip_id = wilc_get_chipid(wilc, false);

if (chip_id < 0x1003a0)
firmware = FIRMWARE_1002;
@@ -475,7 +475,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,
wilc_get_mac_address(vif, mac_add);

netdev_dbg(dev, "MAC address is : %pM\n", mac_add);
- wilc_get_chipid(wilc, 0);
+ wilc_get_chipid(wilc, false);

*(int *)c_val = 1;

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index dc26322..46087e2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1441,36 +1441,31 @@ static u32 init_chip(struct net_device *dev)
return ret;
}

-u32 wilc_get_chipid(struct wilc *wilc, u8 update)
+u32 wilc_get_chipid(struct wilc *wilc, bool update)
{
static u32 chipid;
u32 tempchipid = 0;
- u32 rfrevid;
+ u32 rfrevid = 0;

- if (chipid == 0 || update != 0) {
+ if (chipid == 0 || update) {
wilc->hif_func->hif_read_reg(wilc, 0x1000, &tempchipid);
wilc->hif_func->hif_read_reg(wilc, 0x13f4, &rfrevid);
if (!ISWILC1000(tempchipid)) {
chipid = 0;
- goto _fail_;
+ return chipid;
}
if (tempchipid == 0x1002a0) {
- if (rfrevid == 0x1) {
- } else {
+ if (rfrevid != 0x1)
tempchipid = 0x1002a1;
- }
} else if (tempchipid == 0x1002b0) {
- if (rfrevid == 3) {
- } else if (rfrevid == 4) {
+ if (rfrevid == 0x4)
tempchipid = 0x1002b1;
- } else {
+ else if (rfrevid != 0x3)
tempchipid = 0x1002b2;
- }
}

chipid = tempchipid;
}
-_fail_:
return chipid;
}

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 294552d..269c56e 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -921,6 +921,6 @@ struct wilc;
int wilc_wlan_init(struct net_device *dev);
void wilc_bus_set_max_speed(void);
void wilc_bus_set_default_speed(void);
-u32 wilc_get_chipid(struct wilc *wilc, u8 update);
+u32 wilc_get_chipid(struct wilc *wilc, bool update);

#endif
--
1.9.1


2016-02-04 09:27:38

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 38/70] staging: wilc1000: wilc_wfi_cfgoperations.c: replaces PRINT_ER with netdev_err

From: Leo Kim <[email protected]>

This patches replaces PRINT_ER with netdev_err.
Removes unnecessary debug logs as well.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 86 ++++++++---------------
1 file changed, 31 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a9181d3..dbbf7bf 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -405,10 +405,8 @@ static void CfgScanResult(enum scan_event scan_event,

if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
(((s32)network_info->s8rssi * 100) < 0 ||
- ((s32)network_info->s8rssi * 100) > 100)) {
- PRINT_ER("wiphy signal type fial\n");
+ ((s32)network_info->s8rssi * 100) > 100))
return;
- }

if (network_info) {
s32Freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ);
@@ -436,10 +434,6 @@ static void CfgScanResult(enum scan_event scan_event,
(size_t)network_info->u16IEsLen, (((s32)network_info->s8rssi) * 100), GFP_KERNEL);
cfg80211_put_bss(wiphy, bss);
}
-
-
- } else {
- PRINT_ER("Discovered networks exceeded the max limit\n");
}
} else {
u32 i;
@@ -531,7 +525,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
if (!pstrWFIDrv->p2p_connect)
wlan_channel = INVALID_CHANNEL;

- PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus);
+ netdev_err(dev, "Unspecified failure\n");
}

if (u16ConnectStatus == WLAN_STATUS_SUCCESS) {
@@ -572,8 +566,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
u16ConnectStatus, GFP_KERNEL);
} else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
wilc_optaining_ip = false;
- PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n",
- pstrDisconnectNotifInfo->u16reason, priv->dev);
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
wilc_ie = false;
@@ -612,7 +604,7 @@ static int set_channel(struct wiphy *wiphy,
result = wilc_set_mac_chnl_num(vif, channelnum);

if (result != 0)
- PRINT_ER("Error in setting channel %d\n", channelnum);
+ netdev_err(priv->dev, "Error in setting channel\n");

return result;
}
@@ -680,8 +672,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
(void *)priv, NULL);
}
} else {
- PRINT_ER("Requested num of scanned channels is greater than the max, supported"
- " channels\n");
+ netdev_err(priv->dev, "Requested scanned channels over\n");
}

if (s32Error != 0) {
@@ -843,7 +834,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,

} else {
s32Error = -ENOTSUPP;
- PRINT_ER("Not supported cipher: Error(%d)\n", s32Error);
+ netdev_err(dev, "Not supported cipher\n");
wilc_connecting = 0;
return s32Error;
}
@@ -909,7 +900,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
pstrNetworkInfo->u8channel,
pstrNetworkInfo->pJoinParams);
if (s32Error != 0) {
- PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error);
+ netdev_err(dev, "wilc_set_join_req(): Error\n");
s32Error = -ENOENT;
wilc_connecting = 0;
return s32Error;
@@ -944,7 +935,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co

s32Error = wilc_disconnect(vif, reason_code);
if (s32Error != 0) {
- PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
+ netdev_err(priv->dev, "Error in disconnecting\n");
s32Error = -EINVAL;
}

@@ -1211,7 +1202,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
break;

default:
- PRINT_ER("Not supported cipher: Error(%d)\n", s32Error);
+ netdev_err(netdev, "Not supported cipher\n");
s32Error = -ENOTSUPP;
}

@@ -1362,7 +1353,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
}

if (associatedsta == -1) {
- PRINT_ER("Station required is not associated\n");
+ netdev_err(dev, "sta required is not associated\n");
return -ENOENT;
}

@@ -1449,8 +1440,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, &pstrCfgParamVal);
if (s32Error)
- PRINT_ER("Error in setting WIPHY PARAMS\n");
-
+ netdev_err(priv->dev, "Error in setting WIPHY PARAMS\n");

return s32Error;
}
@@ -1485,7 +1475,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
if (!(flag == PMKID_FOUND))
priv->pmkid_list.numpmkid++;
} else {
- PRINT_ER("Invalid PMKID index\n");
+ netdev_err(netdev, "Invalid PMKID index\n");
s32Error = -EINVAL;
}

@@ -1854,16 +1844,14 @@ static int mgmt_tx(struct wiphy *wiphy,

if (ieee80211_is_mgmt(mgmt->frame_control)) {
mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
- if (!mgmt_tx) {
- PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
+ if (!mgmt_tx)
return -EFAULT;
- }
+
mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
- if (!mgmt_tx->buff) {
- PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
+ if (!mgmt_tx->buff)
kfree(mgmt_tx);
return -EFAULT;
- }
+
memcpy(mgmt_tx->buff, buf, len);
mgmt_tx->size = len;

@@ -2072,10 +2060,8 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,

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

if (wilc_enable_ps)
wilc_set_power_mgmt(vif, enabled, timeout);
@@ -2168,7 +2154,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
break;

default:
- PRINT_ER("Unknown interface type= %d\n", type);
+ netdev_err(dev, "Unknown interface type= %d\n", type);
return -EINVAL;
}

@@ -2195,7 +2181,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
s32Error = set_channel(wiphy, &settings->chandef);

if (s32Error != 0)
- PRINT_ER("Error in setting channel\n");
+ netdev_err(dev, "Error in setting channel\n");

wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
@@ -2247,7 +2233,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
s32Error = wilc_del_beacon(vif);

if (s32Error)
- PRINT_ER("Host delete beacon fail\n");
+ netdev_err(dev, "Host delete beacon fail\n");

return s32Error;
}
@@ -2317,7 +2303,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,

s32Error = wilc_add_station(vif, &strStaParams);
if (s32Error)
- PRINT_ER("Host add station fail\n");
+ netdev_err(dev, "Host add station fail\n");
}

return s32Error;
@@ -2352,7 +2338,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
s32Error = wilc_del_station(vif, mac);

if (s32Error)
- PRINT_ER("Host delete station fail\n");
+ netdev_err(dev, "Host delete station fail\n");
}
return s32Error;
}
@@ -2424,7 +2410,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,

s32Error = wilc_edit_station(vif, &strStaParams);
if (s32Error)
- PRINT_ER("Host edit station fail\n");
+ netdev_err(dev, "Host edit station fail\n");
}
return s32Error;
}
@@ -2457,8 +2443,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n");
vif = netdev_priv(priv->wdev->netdev);
vif->monitor_flag = 1;
- } else
- PRINT_ER("Error in initializing monitor interface\n ");
+ }
}
return priv->wdev;
}
@@ -2612,16 +2597,12 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)
PRINT_D(CFG80211_DBG, "Allocating wireless device\n");

wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
- if (!wdev) {
- PRINT_ER("Cannot allocate wireless device\n");
+ if (!wdev)
goto _fail_;
- }

wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv));
- if (!wdev->wiphy) {
- PRINT_ER("Cannot allocate wiphy\n");
+ if (!wdev->wiphy)
goto _fail_mem_;
- }

WILC_WFI_band_2ghz.ht_cap.ht_supported = 1;
WILC_WFI_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
@@ -2649,7 +2630,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de

wdev = WILC_WFI_CfgAlloc();
if (!wdev) {
- PRINT_ER("CfgAlloc Failed\n");
+ netdev_err(net, "wiphy new allocate failed\n");
return NULL;
}

@@ -2682,11 +2663,10 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
set_wiphy_dev(wdev->wiphy, dev);

s32Error = wiphy_register(wdev->wiphy);
- if (s32Error) {
- PRINT_ER("Cannot register wiphy device\n");
- } else {
+ if (s32Error)
+ netdev_err(net, "Cannot register wiphy device\n");
+ else
PRINT_D(CFG80211_DBG, "Successful Registering\n");
- }

priv->dev = net;
return wdev;
@@ -2705,10 +2685,6 @@ int wilc_init_host_int(struct net_device *net)
setup_timer(&wilc_during_ip_timer, clear_duringIP, 0);
}
op_ifcs++;
- if (s32Error < 0) {
- PRINT_ER("Failed to creat refresh Timer\n");
- return s32Error;
- }

priv->gbAutoRateAdjusted = false;

@@ -2717,7 +2693,7 @@ int wilc_init_host_int(struct net_device *net)
sema_init(&(priv->hSemScanReq), 1);
s32Error = wilc_init(net, &priv->hif_drv);
if (s32Error)
- PRINT_ER("Error while initializing hostinterface\n");
+ netdev_err(net, "Error while initializing hostinterface\n");

return s32Error;
}
@@ -2746,7 +2722,7 @@ int wilc_deinit_host_int(struct net_device *net)
}

if (s32Error)
- PRINT_ER("Error while deintializing host interface\n");
+ netdev_err(net, "Error while deintializing host interface\n");

return s32Error;
}
--
1.9.1


2016-02-04 09:24:49

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 19/70] staging: wilc1000: removes unnecessary debug logs

From: Leo Kim <[email protected]>

This patch removes unnecessary debug logs.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 154 ++++++----------------------------
1 file changed, 24 insertions(+), 130 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1446b19..13c6cb2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -70,47 +70,32 @@ static int dev_state_ev_handler(struct notifier_block *this,
u8 null_ip[4] = {0};
char wlan_dev_name[5] = "wlan0";

- if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) {
- PRINT_D(GENERIC_DBG, "dev_iface = NULL\n");
+ if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
return NOTIFY_DONE;
- }

if (memcmp(dev_iface->ifa_label, "wlan0", 5) &&
- memcmp(dev_iface->ifa_label, "p2p0", 4)) {
- PRINT_D(GENERIC_DBG, "Interface is neither WLAN0 nor P2P0\n");
+ memcmp(dev_iface->ifa_label, "p2p0", 4))
return NOTIFY_DONE;
- }

dev = (struct net_device *)dev_iface->ifa_dev->dev;
- if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) {
- PRINT_D(GENERIC_DBG, "No Wireless registerd\n");
+ if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
return NOTIFY_DONE;
- }
+
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- if (!priv) {
- PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+ if (!priv)
return NOTIFY_DONE;
- }
+
hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
- if (!vif || !hif_drv) {
- PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+ if (!vif || !hif_drv)
return NOTIFY_DONE;
- }
-
- PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n");

switch (event) {
case NETDEV_UP:
- PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP %p\n", dev);
-
- PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n");
-
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 1;
wilc_optaining_ip = false;
del_timer(&wilc_during_ip_timer);
- PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
}

if (wilc_enable_ps)
@@ -127,9 +112,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;

case NETDEV_DOWN:
- PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev);
-
- PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 0;
wilc_optaining_ip = false;
@@ -152,9 +134,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;

default:
- PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n");
- PRINT_INFO(GENERIC_DBG, "[%s] unknown dev event: %lu\n", dev_iface->ifa_label, event);
-
break;
}

@@ -169,7 +148,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)

vif = netdev_priv(dev);
wilc = vif->wilc;
- PRINT_D(INT_DBG, "Interrupt received UH\n");

if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
@@ -191,7 +169,6 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
return IRQ_HANDLED;
}

- PRINT_D(INT_DBG, "Interrupt received BH\n");
wilc_handle_isr(wilc);

return IRQ_HANDLED;
@@ -255,12 +232,9 @@ int wilc_lock_timeout(struct wilc *nic, void *vp, u32 timeout)
/* FIXME: replace with mutex_lock or wait_for_completion */
int error = -1;

- PRINT_D(LOCK_DBG, "Locking %p\n", vp);
if (vp)
error = down_timeout((struct semaphore *)vp,
msecs_to_jiffies(timeout));
- else
- PRINT_ER("Failed, mutex is NULL\n");
return error;
}

@@ -358,28 +332,21 @@ static int linux_wlan_txq_task(void *vp)

up(&wl->txq_thread_started);
while (1) {
- PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
down(&wl->txq_event);
- PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");

if (wl->close) {
up(&wl->txq_thread_started);

while (!kthread_should_stop())
schedule();
-
- PRINT_D(TX_DBG, "TX thread stopped\n");
break;
}
- PRINT_D(TX_DBG, "txq_task handle the sending packet and let me go to sleep.\n");
#if !defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
ret = wilc_wlan_handle_txq(dev, &txq_count);
#else
do {
ret = wilc_wlan_handle_txq(dev, &txq_count);
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) {
- PRINT_D(TX_DBG, "Waking up queue\n");
-
if (netif_queue_stopped(wl->vif[0]->ndev))
netif_wake_queue(wl->vif[0]->ndev);
if (netif_queue_stopped(wl->vif[1]->ndev))
@@ -428,15 +395,11 @@ int wilc_wlan_get_firmware(struct net_device *dev)

netdev_info(dev, "loading firmware %s\n", firmware);

- if (!vif) {
- PRINT_ER("vif is NULL\n");
+ if (!vif)
goto _fail_;
- }

- if (!(&vif->ndev->dev)) {
- PRINT_ER("&vif->ndev->dev is NULL\n");
+ if (!(&vif->ndev->dev))
goto _fail_;
- }

if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
@@ -459,20 +422,13 @@ static int linux_wlan_start_firmware(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- PRINT_D(INIT_DBG, "Starting Firmware ...\n");
ret = wilc_wlan_start(wilc);
- if (ret < 0) {
- PRINT_ER("Failed to start Firmware\n");
+ if (ret < 0)
return ret;
- }

- PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = wilc_lock_timeout(wilc, &wilc->sync_event, 5000);
- if (ret) {
- PRINT_D(INIT_DBG, "Firmware start timed out");
+ if (ret)
return ret;
- }
- PRINT_D(INIT_DBG, "Firmware successfully started\n");

return 0;
}
@@ -490,14 +446,12 @@ static int wilc1000_firmware_download(struct net_device *dev)
PRINT_ER("Firmware buffer is NULL\n");
return -ENOBUFS;
}
- PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
+
ret = wilc_wlan_firmware_download(wilc, wilc->firmware->data,
wilc->firmware->size);
if (ret < 0)
return ret;

- PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
- PRINT_D(INIT_DBG, "Releasing firmware\n");
release_firmware(wilc->firmware);
wilc->firmware = NULL;

@@ -740,7 +694,6 @@ void wilc1000_wlan_deinit(struct net_device *dev)
if (wl->initialized) {
netdev_info(dev, "Deinitializing wilc1000...\n");

- PRINT_D(INIT_DBG, "Disabling IRQ\n");
if (!wl->dev_irq_num &&
wl->hif_func->disable_interrupt) {
mutex_lock(&wl->hif_cs);
@@ -750,29 +703,19 @@ void wilc1000_wlan_deinit(struct net_device *dev)
if (&wl->txq_event)
up(&wl->txq_event);

- PRINT_D(INIT_DBG, "Deinitializing Threads\n");
wlan_deinitialize_threads(dev);
-
- PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);

wilc_wlan_stop(wl);
-
- PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup(dev);
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
if (!wl->dev_irq_num &&
wl->hif_func->disable_interrupt) {
-
- PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
-
mutex_lock(&wl->hif_cs);
wl->hif_func->disable_interrupt(wl);
mutex_unlock(&wl->hif_cs);
}
#endif
-
- PRINT_D(INIT_DBG, "Deinitializing Locks\n");
wlan_deinit_locks(dev);

wl->initialized = false;
@@ -792,8 +735,6 @@ static int wlan_init_locks(struct net_device *dev)
vif = netdev_priv(dev);
wl = vif->wilc;

- PRINT_D(INIT_DBG, "Initializing Locks ...\n");
-
mutex_init(&wl->hif_cs);
mutex_init(&wl->rxq_cs);

@@ -818,8 +759,6 @@ static int wlan_deinit_locks(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- PRINT_D(INIT_DBG, "De-Initializing Locks\n");
-
if (&wilc->hif_cs)
mutex_destroy(&wilc->hif_cs);

@@ -837,8 +776,6 @@ static int wlan_initialize_threads(struct net_device *dev)
vif = netdev_priv(dev);
wilc = vif->wilc;

- PRINT_D(INIT_DBG, "Initializing Threads ...\n");
- PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
"K_TXQ_TASK");
if (!wilc->txq_thread) {
@@ -860,7 +797,6 @@ static void wlan_deinitialize_threads(struct net_device *dev)
wl = vif->wilc;

wl->close = 1;
- PRINT_D(INIT_DBG, "Deinitializing Threads\n");

if (&wl->txq_event)
up(&wl->txq_event);
@@ -884,20 +820,17 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)

ret = wilc_wlan_init(dev);
if (ret < 0) {
- PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
goto _fail_locks_;
}

if (wl->gpio >= 0 && init_irq(dev)) {
- PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
}

ret = wlan_initialize_threads(dev);
if (ret < 0) {
- PRINT_ER("Initializing Threads FAILED\n");
ret = -EIO;
goto _fail_wilc_wlan_;
}
@@ -905,27 +838,23 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
if (!wl->dev_irq_num &&
wl->hif_func->enable_interrupt &&
wl->hif_func->enable_interrupt(wl)) {
- PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
}

if (wilc_wlan_get_firmware(dev)) {
- PRINT_ER("Can't get firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}

ret = wilc1000_firmware_download(dev);
if (ret < 0) {
- PRINT_ER("Failed to download firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}

ret = linux_wlan_start_firmware(dev);
if (ret < 0) {
- PRINT_ER("Failed to start firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}
@@ -1007,16 +936,11 @@ int wilc_mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);

ret = wilc_init_host_int(ndev);
- if (ret < 0) {
- PRINT_ER("Failed to initialize host interface\n");
-
+ if (ret < 0)
return ret;
- }

- PRINT_D(INIT_DBG, "*** re-init ***\n");
ret = wilc1000_wlan_init(ndev, vif);
if (ret < 0) {
- PRINT_ER("Failed to initialize wilc1000\n");
wilc_deinit_host_int(ndev);
return ret;
}
@@ -1097,23 +1021,16 @@ static void wilc_set_multicast_list(struct net_device *dev)
if (!dev)
return;

- PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n",
- dev->mc.count);
-
- if (dev->flags & IFF_PROMISC) {
- PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n");
+ if (dev->flags & IFF_PROMISC)
return;
- }

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, 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, true, 0);
return;
}
@@ -1160,8 +1077,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
vif = netdev_priv(ndev);
wilc = vif->wilc;

- PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
-
if (skb->dev != ndev) {
PRINT_ER("Packet not destined to this device\n");
return 0;
@@ -1169,7 +1084,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)

tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
if (!tx_data) {
- PRINT_ER("Failed to allocate memory for tx_data structure\n");
dev_kfree_skb(skb);
netif_wake_queue(ndev);
return 0;
@@ -1191,8 +1105,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n",
udp_buf[248], udp_buf[249], udp_buf[250]);

- PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb);
- PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
@@ -1218,39 +1130,29 @@ int wilc_mac_close(struct net_device *ndev)
vif = netdev_priv(ndev);

if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr ||
- !vif->ndev->ieee80211_ptr->wiphy) {
- PRINT_ER("vif = NULL\n");
+ !vif->ndev->ieee80211_ptr->wiphy)
return 0;
- }

priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
wl = vif->wilc;

- if (!priv) {
- PRINT_ER("priv = NULL\n");
+ if (!priv)
return 0;
- }

hif_drv = (struct host_if_drv *)priv->hif_drv;

PRINT_D(GENERIC_DBG, "Mac close\n");

- if (!wl) {
- PRINT_ER("wl = NULL\n");
+ if (!wl)
return 0;
- }

- if (!hif_drv) {
- PRINT_ER("hif_drv = NULL\n");
+ if (!hif_drv)
return 0;
- }

- if ((wl->open_ifcs) > 0) {
+ if ((wl->open_ifcs) > 0)
wl->open_ifcs--;
- } else {
- PRINT_ER("ERROR: MAC close called while number of opened interfaces is zero\n");
+ else
return 0;
- }

if (vif->ndev) {
netif_stop_queue(vif->ndev);
@@ -1303,8 +1205,6 @@ 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, &rssi);
- if (ret)
- PRINT_ER("Failed to send get rssi param's message queue ");
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);

rssi += 5;
@@ -1360,10 +1260,9 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
buff_to_send = buff;

skb = dev_alloc_skb(frame_len);
- if (!skb) {
- PRINT_ER("Low memory - packet droped\n");
+ if (!skb)
return;
- }
+
skb->dev = wilc_netdev;

memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);
@@ -1453,10 +1352,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,

for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
ndev = alloc_etherdev(sizeof(struct wilc_vif));
- if (!ndev) {
- PRINT_ER("Failed to allocate ethernet dev\n");
+ if (!ndev)
return -1;
- }

vif = netdev_priv(ndev);
memset(vif, 0, sizeof(struct wilc_vif));
@@ -1495,11 +1392,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
vif->netstats.tx_bytes = 0;
}

- if (register_netdev(ndev)) {
- PRINT_ER("Device couldn't be registered - %s\n",
- ndev->name);
+ if (register_netdev(ndev))
return -1;
- }

vif->iftype = STATION_MODE;
vif->mac_opened = 0;
--
1.9.1


2016-02-04 09:23:12

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 03/70] staging: wilc1000: ignore power save

If two interfaces are connected and it is required to enable power save then
ignore the request.

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 1dc6af0..7e1b5a0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4341,6 +4341,9 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)
return -EFAULT;
}

+ if (wilc_wlan_get_num_conn_ifcs(vif->wilc) == 2 && enabled)
+ return 0;
+
PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n");

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


2016-02-04 09:23:29

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 06/70] staging: wilc1000: remove define TCP_ACK_FILTER

This patch removes define TCP_ACK_FILTER and use it's feature codes.
Add argument wilc to wilc_wlan_txq_remove because compile error happens.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/Makefile | 1 -
drivers/staging/wilc1000/wilc_wlan.c | 22 ++--------------------
2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 90c3760..acc3f3e 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,7 +4,6 @@ ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"

ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
-#ccflags-y += -DTCP_ACK_FILTER

wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
wilc_msgqueue.o \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 25cf325..9442016 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -36,8 +36,7 @@ static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
mutex_unlock(&wilc->hif_cs);
}

-#ifdef TCP_ACK_FILTER
-static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
+static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe)
{

if (tqe == wilc->txq_head) {
@@ -54,7 +53,6 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
}
wilc->txq_entries -= 1;
}
-#endif

static struct txq_entry_t *
wilc_wlan_txq_remove_from_head(struct net_device *dev)
@@ -146,7 +144,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
return 0;
}

-#ifdef TCP_ACK_FILTER
struct ack_session_info;
struct ack_session_info {
u32 seq_num;
@@ -308,7 +305,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
pending_acks_info[i].ack_num);
tqe = pending_acks_info[i].txqe;
if (tqe) {
- wilc_wlan_txq_remove(tqe);
+ wilc_wlan_txq_remove(wilc, tqe);
tqe->status = 1;
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv,
@@ -335,7 +332,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)

return 1;
}
-#endif

static bool enabled = false;

@@ -344,12 +340,10 @@ void wilc_enable_tcp_ack_filter(bool value)
enabled = value;
}

-#ifdef TCP_ACK_FILTER
static bool is_tcp_ack_filter_enabled(void)
{
return enabled;
}
-#endif

static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size)
{
@@ -373,9 +367,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_s
tqe->buffer_size = buffer_size;
tqe->tx_complete_func = NULL;
tqe->priv = NULL;
-#ifdef TCP_ACK_FILTER
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-#endif
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");

if (wilc_wlan_txq_add_to_head(wilc, tqe))
@@ -406,11 +398,9 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe->priv = priv;

PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
-#ifdef TCP_ACK_FILTER
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
if (is_tcp_ack_filter_enabled())
tcp_process(dev, tqe);
-#endif
wilc_wlan_txq_add_to_tail(dev, tqe);
return wilc->txq_entries;
}
@@ -436,9 +426,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe->buffer_size = buffer_size;
tqe->tx_complete_func = func;
tqe->priv = priv;
-#ifdef TCP_ACK_FILTER
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-#endif
PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
wilc_wlan_txq_add_to_tail(dev, tqe);
return 1;
@@ -643,9 +631,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)

wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
-#ifdef TCP_ACK_FILTER
wilc_wlan_txq_filter_dup_tcp_ack(dev);
-#endif
PRINT_D(TX_DBG, "Getting the head of the TxQ\n");
tqe = wilc_wlan_txq_get_first(wilc);
i = 0;
@@ -829,10 +815,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv,
tqe->status);
- #ifdef TCP_ACK_FILTER
if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK)
pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL;
- #endif
kfree(tqe);
} else {
break;
@@ -1564,9 +1548,7 @@ int wilc_wlan_init(struct net_device *dev)
ret = -EIO;
goto _fail_;
}
-#ifdef TCP_ACK_FILTER
init_tcp_tracking();
-#endif

return 1;

--
1.9.1


2016-02-04 09:24:24

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 15/70] staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure

From: Leo Kim <[email protected]>

This patch renames hWILCWFIDrv pointer variable of wilc_priv structure
to hif_drv to avoid camelcase.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 8 ++++----
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 ++++++++++++----------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index a3b4939..06c79dd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -89,7 +89,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
if (!vif || !hif_drv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
@@ -515,7 +515,7 @@ static int linux_wlan_init_test_config(struct net_device *dev,

PRINT_D(TX_DBG, "Start configuring Firmware\n");
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;
PRINT_D(INIT_DBG, "Host = %p\n", hif_drv);
wilc_get_mac_address(vif, mac_add);

@@ -1089,7 +1089,7 @@ static void wilc_set_multicast_list(struct net_device *dev)

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

if (!dev)
return;
@@ -1228,7 +1228,7 @@ int wilc_mac_close(struct net_device *ndev)
return 0;
}

- hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ hif_drv = (struct host_if_drv *)priv->hif_drv;

PRINT_D(GENERIC_DBG, "Mac close\n");

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1907331..d1cb0b2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -512,7 +512,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
dev = priv->dev;
vif = netdev_priv(dev);
wl = vif->wilc;
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
u16 u16ConnectStatus;
@@ -711,9 +711,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
wilc_connecting = 1;
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
- pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

- PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
+ PRINT_D(CFG80211_DBG,
+ "Connecting to SSID [%s] on netdev [%p] host if [%p]\n",
+ sme->ssid, dev, priv->hif_drv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n");
pstrWFIDrv->p2p_connect = 1;
@@ -928,7 +930,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);

- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
if (!pstrWFIDrv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
@@ -1276,7 +1278,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
wilc_remove_wep_key(vif, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
- wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
+ wilc_remove_key(priv->hif_drv, mac_addr);
}

return 0;
@@ -1632,7 +1634,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
s32 s32Freq;

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

memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);

@@ -1844,7 +1846,7 @@ static int mgmt_tx(struct wiphy *wiphy,

vif = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;

*cookie = (unsigned long)buf;
priv->u64tx_cookie = *cookie;
@@ -1970,7 +1972,7 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
struct host_if_drv *pstrWFIDrv;

priv = wiphy_priv(wiphy);
- pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;


PRINT_D(GENERIC_DBG, "Tx Cancel wait :%lu\n", jiffies);
@@ -2070,7 +2072,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,

priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
- if (!priv->hWILCWFIDrv) {
+ if (!priv->hif_drv) {
PRINT_ER("Driver is NULL\n");
return -EIO;
}
@@ -2713,7 +2715,7 @@ int wilc_init_host_int(struct net_device *net)
priv->bInP2PlistenState = false;

sema_init(&(priv->hSemScanReq), 1);
- s32Error = wilc_init(net, &priv->hWILCWFIDrv);
+ s32Error = wilc_init(net, &priv->hif_drv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 07eda4d..64fcb77 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -121,7 +121,7 @@ struct wilc_priv {
spinlock_t lock;
struct net_device *dev;
struct napi_struct napi;
- struct host_if_drv *hWILCWFIDrv;
+ struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
struct WILC_WFI_stats netstats;
u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
--
1.9.1


2016-02-04 09:23:35

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 07/70] staging: wilc1000: increase link speed

This patch increases throughput by enabling tcp ack filter base on checking
statistics and also handling tcp session.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 31 +++++++++++++--------------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 ++
drivers/staging/wilc1000/wilc_wlan.c | 27 ++++++++++++++---------
3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 7e1b5a0..4bbf38c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -57,6 +57,9 @@
#define BLOCK_ACK_REQ_SIZE 0x14
#define FALSE_FRMWR_CHANNEL 100

+#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
+#define DEFAULT_LINK_SPEED 72
+
struct cfg_param_attr {
struct cfg_param_val cfg_attr_info;
};
@@ -2187,7 +2190,14 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
if (result)
PRINT_ER("Failed to send scan paramters config packet\n");

- up(&hif_sema_wait_response);
+ if (pstrStatistics->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH &&
+ pstrStatistics->link_speed != DEFAULT_LINK_SPEED)
+ wilc_enable_tcp_ack_filter(true);
+ else if (pstrStatistics->link_speed != DEFAULT_LINK_SPEED)
+ wilc_enable_tcp_ack_filter(false);
+
+ if (pstrStatistics != &vif->wilc->dummy_statistics)
+ up(&hif_sema_wait_response);
return 0;
}

@@ -3606,7 +3616,8 @@ int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats)
return -EFAULT;
}

- down(&hif_sema_wait_response);
+ if (stats != &vif->wilc->dummy_statistics)
+ down(&hif_sema_wait_response);
return result;
}

@@ -3698,21 +3709,9 @@ static void GetPeriodicRSSI(unsigned long arg)
return;
}

- 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.vif = vif;
+ if (vif->hif_drv->hif_state == HOST_IF_CONNECTED)
+ wilc_get_statistics(vif, &vif->wilc->dummy_statistics);

- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result) {
- PRINT_ER("Failed to send get host channel param's message queue ");
- return;
- }
- }
periodic_rssi.data = (unsigned long)vif;
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 54e762ec..9f8c79e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -217,6 +217,8 @@ struct wilc {

struct device *dev;
bool suspend_event;
+
+ struct rf_info dummy_statistics;
};

struct WILC_WFI_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 9442016..04d4c92 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -178,19 +178,21 @@ static inline int init_tcp_tracking(void)

static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq)
{
- ack_session_info[tcp_session].seq_num = seq;
- ack_session_info[tcp_session].bigger_ack_num = 0;
- ack_session_info[tcp_session].src_port = src_prt;
- ack_session_info[tcp_session].dst_port = dst_prt;
- tcp_session++;
-
+ if (tcp_session < 2 * MAX_TCP_SESSION) {
+ ack_session_info[tcp_session].seq_num = seq;
+ ack_session_info[tcp_session].bigger_ack_num = 0;
+ ack_session_info[tcp_session].src_port = src_prt;
+ ack_session_info[tcp_session].dst_port = dst_prt;
+ tcp_session++;
+ }
PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", tcp_session, seq);
return 0;
}

static inline int update_tcp_session(u32 index, u32 ack)
{
- if (ack > ack_session_info[index].bigger_ack_num)
+ if (index < 2 * MAX_TCP_SESSION &&
+ ack > ack_session_info[index].bigger_ack_num)
ack_session_info[index].bigger_ack_num = ack;
return 0;
}
@@ -198,7 +200,7 @@ static inline int update_tcp_session(u32 index, u32 ack)
static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
struct txq_entry_t *txqe)
{
- if (pending_acks < MAX_PENDING_ACKS) {
+ if (pending_base + pending_acks < MAX_PENDING_ACKS) {
pending_acks_info[pending_base + pending_acks].ack_num = ack;
pending_acks_info[pending_base + pending_acks].txqe = txqe;
pending_acks_info[pending_base + pending_acks].session_index = session_index;
@@ -265,7 +267,8 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
(u32)tcp_hdr_ptr[11];

for (i = 0; i < tcp_session; i++) {
- if (ack_session_info[i].seq_num == seq_no) {
+ if (i < 2 * MAX_TCP_SESSION &&
+ ack_session_info[i].seq_num == seq_no) {
update_tcp_session(i, ack_no);
break;
}
@@ -298,6 +301,9 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)

spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags);
for (i = pending_base; i < (pending_base + pending_acks); i++) {
+ if (i >= MAX_PENDING_ACKS ||
+ pending_acks_info[i].session_index >= 2 * MAX_TCP_SESSION)
+ break;
if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) {
struct txq_entry_t *tqe;

@@ -815,7 +821,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv,
tqe->status);
- if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK)
+ if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK &&
+ tqe->tcp_pending_ack_idx < MAX_PENDING_ACKS)
pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL;
kfree(tqe);
} else {
--
1.9.1


2016-02-04 09:24:31

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 16/70] staging: wilc1000: fixes missing a blank line after declarations

From: Leo Kim <[email protected]>

This patch fixes the warnings reported by checkpatch.pl
for Missing a blank line after declarations.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 06c79dd..5992478 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -853,6 +853,7 @@ static void wlan_deinitialize_threads(struct net_device *dev)
{
struct wilc_vif *vif;
struct wilc *wl;
+
vif = netdev_priv(dev);
wl = vif->wilc;

@@ -1472,6 +1473,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,

{
struct wireless_dev *wdev;
+
wdev = wilc_create_wiphy(ndev, dev);

if (dev)
--
1.9.1


2016-02-04 09:25:51

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 27/70] staging: wilc1000: rename variable s32Error

From: Leo Kim <[email protected]>

This patch renames variable s32Error to result
to avoid CamelCase naming convention.
Also, remove the unused variable s32Error and replace with direct return.

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 2a4e324..88e5661 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -356,30 +356,29 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)

s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
{
- s32 s32Error = 0;
+ s32 result = 0;

if (pstrNetworkInfo) {
if (pstrNetworkInfo->pu8IEs) {
kfree(pstrNetworkInfo->pu8IEs);
pstrNetworkInfo->pu8IEs = NULL;
} else {
- s32Error = -EFAULT;
+ result = -EFAULT;
}

kfree(pstrNetworkInfo);
pstrNetworkInfo = NULL;

} else {
- s32Error = -EFAULT;
+ result = -EFAULT;
}

- return s32Error;
+ return result;
}

s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo)
{
- s32 s32Error = 0;
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
u8 *pu8IEs = NULL;
@@ -408,27 +407,27 @@ s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,

*ppstrConnectRespInfo = pstrConnectRespInfo;

- return s32Error;
+ return 0;
}

s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
{
- s32 s32Error = 0;
+ s32 result = 0;

if (pstrConnectRespInfo) {
if (pstrConnectRespInfo->pu8RespIEs) {
kfree(pstrConnectRespInfo->pu8RespIEs);
pstrConnectRespInfo->pu8RespIEs = NULL;
} else {
- s32Error = -EFAULT;
+ result = -EFAULT;
}

kfree(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;

} else {
- s32Error = -EFAULT;
+ result = -EFAULT;
}

- return s32Error;
+ return result;
}
--
1.9.1


2016-02-04 09:26:33

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 32/70] staging: wilc1000: fix warnings for line over 80 characters

From: Chris Park <[email protected]>

This patch fixes warnings reported by checkpatch.pl
for line over 80 characters

Signed-off-by: Chris Park <[email protected]>
Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 33 ++++++++++++++++++++-------------
drivers/staging/wilc1000/wilc_wlan.h | 3 ++-
2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index ebf38a5..a6f4e15 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -113,7 +113,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
up(&wilc->txq_event);
}

-static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, struct txq_entry_t *tqe)
+static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+ struct txq_entry_t *tqe)
{
unsigned long flags;
struct wilc *wilc = vif->wilc;
@@ -695,8 +696,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
counter = 0;
do {
- ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL,
- &reg);
+ ret = wilc->hif_func->hif_read_reg(wilc,
+ WILC_HOST_TX_CTRL,
+ &reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n");
break;
@@ -728,8 +730,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
break;
}

- ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL,
- 0x2);
+ ret = wilc->hif_func->hif_write_reg(wilc,
+ WILC_HOST_VMM_CTL,
+ 0x2);
if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n");
break;
@@ -1063,7 +1066,8 @@ void wilc_handle_isr(struct wilc *wilc)
}
EXPORT_SYMBOL_GPL(wilc_handle_isr);

-int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size)
+int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
+ u32 buffer_size)
{
u32 offset;
u32 addr, size, size2, blksz;
@@ -1096,8 +1100,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_
size2 = blksz;

memcpy(dma_buffer, &buffer[offset], size2);
- ret = wilc->hif_func->hif_block_tx(wilc, addr, dma_buffer,
- size2);
+ ret = wilc->hif_func->hif_block_tx(wilc, addr,
+ dma_buffer, size2);
if (!ret)
break;

@@ -1233,7 +1237,8 @@ int wilc_wlan_stop(struct wilc *wilc)
}

do {
- ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
+ ret = wilc->hif_func->hif_read_reg(wilc,
+ WILC_GLB_RESET_0, &reg);
if (!ret) {
PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
@@ -1246,14 +1251,16 @@ int wilc_wlan_stop(struct wilc *wilc)
PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n",
timeout);
reg &= ~BIT(10);
- ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0,
- reg);
+ ret = wilc->hif_func->hif_write_reg(wilc,
+ WILC_GLB_RESET_0,
+ reg);
timeout--;
} else {
PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n",
timeout);
- ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0,
- &reg);
+ ret = wilc->hif_func->hif_read_reg(wilc,
+ WILC_GLB_RESET_0,
+ &reg);
if (!ret) {
PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index e913ae7..d362fa8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -270,7 +270,8 @@ struct wilc_cfg_rsp {
struct wilc;
struct wilc_vif;

-int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size);
+int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
+ u32 buffer_size);
int wilc_wlan_start(struct wilc *);
int wilc_wlan_stop(struct wilc *);
int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
--
1.9.1


2016-02-04 09:26:46

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 33/70] staging: wilc1000: remove useless log message

From: Chris Park <[email protected]>

This patch remove useless log message in wilc_wlan.c file

Signed-off-by: Chris Park <[email protected]>
Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 128 ++++++-----------------------------
1 file changed, 22 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a6f4e15..400d311 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -104,12 +104,9 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
wilc->txq_tail = tqe;
}
wilc->txq_entries += 1;
- PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries);

spin_unlock_irqrestore(&wilc->txq_spinlock, flags);

- PRINT_D(TX_DBG, "Wake the txq_handling\n");
-
up(&wilc->txq_event);
}

@@ -137,12 +134,10 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
wilc->txq_head = tqe;
}
wilc->txq_entries += 1;
- netdev_dbg(vif->ndev, "Number of entries in TxQ = %d\n", wilc->txq_entries);

spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
up(&wilc->txq_add_to_head_cs);
up(&wilc->txq_event);
- netdev_dbg(vif->ndev, "Wake up the txq_handler\n");

return 0;
}
@@ -188,7 +183,6 @@ static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq)
ack_session_info[tcp_session].dst_port = dst_prt;
tcp_session++;
}
- PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", tcp_session, seq);
return 0;
}

@@ -310,8 +304,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) {
struct txq_entry_t *tqe;

- PRINT_D(TCP_ENH, "DROP ACK: %u\n",
- pending_acks_info[i].ack_num);
tqe = pending_acks_info[i].txqe;
if (tqe) {
wilc_wlan_txq_remove(wilc, tqe);
@@ -379,7 +371,6 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
tqe->tx_complete_func = NULL;
tqe->priv = NULL;
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
- netdev_dbg(vif->ndev, "Adding the config packet at the Queue tail\n");

if (wilc_wlan_txq_add_to_head(vif, tqe))
return 0;
@@ -408,7 +399,6 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe->tx_complete_func = func;
tqe->priv = priv;

- PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
if (is_tcp_ack_filter_enabled())
tcp_process(dev, tqe);
@@ -438,7 +428,6 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe->tx_complete_func = func;
tqe->priv = priv;
tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
- PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
wilc_wlan_txq_add_to_tail(dev, tqe);
return 1;
}
@@ -478,18 +467,15 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)

mutex_lock(&wilc->rxq_cs);
if (!wilc->rxq_head) {
- PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
wilc->rxq_head = rqe;
wilc->rxq_tail = rqe;
} else {
- PRINT_D(RX_DBG, "Add to Queue tail\n");
wilc->rxq_tail->next = rqe;
rqe->next = NULL;
wilc->rxq_tail = rqe;
}
wilc->rxq_entries += 1;
- PRINT_D(RX_DBG, "Number of queue entries: %d\n", wilc->rxq_entries);
mutex_unlock(&wilc->rxq_cs);
return wilc->rxq_entries;
}
@@ -497,7 +483,6 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
{

- PRINT_D(RX_DBG, "Getting rxQ element\n");
if (wilc->rxq_head) {
struct rxq_entry_t *rqe;

@@ -505,11 +490,9 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
rqe = wilc->rxq_head;
wilc->rxq_head = wilc->rxq_head->next;
wilc->rxq_entries -= 1;
- PRINT_D(RX_DBG, "RXQ entries decreased\n");
mutex_unlock(&wilc->rxq_cs);
return rqe;
}
- PRINT_D(RX_DBG, "Nothing to get from Q\n");
return NULL;
}

@@ -643,7 +626,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
wilc_wlan_txq_filter_dup_tcp_ack(dev);
- PRINT_D(TX_DBG, "Getting the head of the TxQ\n");
tqe = wilc_wlan_txq_get_first(wilc);
i = 0;
sum = 0;
@@ -659,27 +641,20 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
vmm_sz = HOST_HDR_OFFSET;

vmm_sz += tqe->buffer_size;
- PRINT_D(TX_DBG, "VMM Size before alignment = %d\n", vmm_sz);
+
if (vmm_sz & 0x3)
vmm_sz = (vmm_sz + 4) & ~0x3;

if ((sum + vmm_sz) > LINUX_TX_SIZE)
break;

- PRINT_D(TX_DBG, "VMM Size AFTER alignment = %d\n", vmm_sz);
vmm_table[i] = vmm_sz / 4;
- PRINT_D(TX_DBG, "VMMTable entry size = %d\n",
- vmm_table[i]);
-
- if (tqe->type == WILC_CFG_PKT) {
+ if (tqe->type == WILC_CFG_PKT)
vmm_table[i] |= BIT(10);
- PRINT_D(TX_DBG, "VMMTable entry changed for CFG packet = %d\n", vmm_table[i]);
- }
vmm_table[i] = cpu_to_le32(vmm_table[i]);

i++;
sum += vmm_sz;
- PRINT_D(TX_DBG, "sum = %d\n", sum);
tqe = wilc_wlan_txq_get_next(wilc, tqe);
} else {
break;
@@ -699,23 +674,18 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
ret = wilc->hif_func->hif_read_reg(wilc,
WILC_HOST_TX_CTRL,
&reg);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n");
+ if (!ret)
break;
- }

if ((reg & 0x1) == 0) {
- PRINT_D(TX_DBG, "Writing VMM table ... with Size = %d\n", ((i + 1) * 4));
break;
} else {
counter++;
if (counter > 200) {
counter = 0;
- PRINT_D(TX_DBG, "Looping in tx ctrl , forcce quit\n");
ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0);
break;
}
- PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
}
} while (!wilc->quit);

@@ -725,25 +695,19 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
timeout = 200;
do {
ret = wilc->hif_func->hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4));
- if (!ret) {
- wilc_debug(N_ERR, "ERR block TX of VMM table.\n");
+ if (!ret)
break;
- }

ret = wilc->hif_func->hif_write_reg(wilc,
WILC_HOST_VMM_CTL,
0x2);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n");
+ if (!ret)
break;
- }

do {
ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't read reg host_vmm_ctl..\n");
+ if (!ret)
break;
- }
if ((reg >> 2) & 0x1) {
entries = ((reg >> 3) & 0x3f);
break;
@@ -763,16 +727,12 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]);

ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n");
+ if (!ret)
break;
- }
reg &= ~BIT(0);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n");
+ if (!ret)
break;
- }
break;
} else {
break;
@@ -840,16 +800,12 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);

ret = wilc->hif_func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't start tx VMM ...\n");
+ if (!ret)
goto _end_;
- }

ret = wilc->hif_func->hif_block_tx_ext(wilc, 0, txb, offset);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n");
+ if (!ret)
goto _end_;
- }

_end_:

@@ -875,19 +831,15 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)

do {
if (wilc->quit) {
- PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n");
up(&wilc->cfg_event);
break;
}
rqe = wilc_wlan_rxq_remove(wilc);
- if (!rqe) {
- PRINT_D(RX_DBG, "nothing in the queue - exit 1st do-while\n");
+ if (!rqe)
break;
- }
+
buffer = rqe->buffer;
size = rqe->buffer_size;
- PRINT_D(RX_DBG, "rxQ entery Size = %d - Address = %p\n",
- size, buffer);
offset = 0;

do {
@@ -906,10 +858,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
tp_len = (header >> 11) & 0x7ff;
pkt_len = header & 0x7ff;

- if (pkt_len == 0 || tp_len == 0) {
- wilc_debug(N_RXQ, "[wilc rxq]: data corrupt, packet len or tp_len is 0 [%d][%d]\n", pkt_len, tp_len);
+ if (pkt_len == 0 || tp_len == 0)
break;
- }

#define IS_MANAGMEMENT 0x100
#define IS_MANAGMEMENT_CALLBACK 0x080
@@ -935,7 +885,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)

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)
up(&wilc->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
@@ -977,10 +926,8 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
else
mdelay(WILC_PLL_TO_SPI);

- while (!(ISWILC1000(wilc_get_chipid(wilc, true)) && --trials)) {
- PRINT_D(TX_DBG, "PLL update retrying\n");
+ while (!(ISWILC1000(wilc_get_chipid(wilc, true)) && --trials))
mdelay(1);
- }
}

static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1)
@@ -1000,9 +947,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
size = ((int_status & 0x7fff) << 2);

while (!size && retries < 10) {
- u32 time = 0;
-
- wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++);
wilc->hif_func->hif_read_size(wilc, &size);
size = ((size & 0x7fff) << 2);
retries++;
@@ -1012,21 +956,17 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
if (LINUX_RX_SIZE - offset < size)
offset = 0;

- if (wilc->rx_buffer) {
+ if (wilc->rx_buffer)
buffer = &wilc->rx_buffer[offset];
- } else {
- wilc_debug(N_ERR, "[wilc isr]: fail Rx Buffer is NULL...drop the packets (%d)\n", size);
+ else
goto _end_;
- }

wilc->hif_func->hif_clear_int_ext(wilc,
DATA_INT_CLR | ENABLE_RX_VMM);
ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);

- if (!ret) {
- wilc_debug(N_ERR, "[wilc isr]: fail block rx...\n");
+ if (!ret)
goto _end_;
- }
_end_:
if (ret) {
offset += size;
@@ -1079,12 +1019,9 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
dma_buffer = kmalloc(blksz, GFP_KERNEL);
if (!dma_buffer) {
ret = -EIO;
- PRINT_ER("Can't allocate buffer for firmware download IO error\n ");
goto _fail_1;
}

- PRINT_D(INIT_DBG, "Downloading firmware size = %d ...\n", buffer_size);
-
offset = 0;
do {
memcpy(&addr, &buffer[offset], 4);
@@ -1113,7 +1050,6 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,

if (!ret) {
ret = -EIO;
- PRINT_ER("Can't download firmware IO error\n ");
goto _fail_;
}
PRINT_D(INIT_DBG, "Offset = %d\n", offset);
@@ -1143,7 +1079,6 @@ int wilc_wlan_start(struct wilc *wilc)
acquire_bus(wilc, ACQUIRE_ONLY);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg);
if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n");
release_bus(wilc, RELEASE_ONLY);
ret = -EIO;
return ret;
@@ -1177,7 +1112,6 @@ int wilc_wlan_start(struct wilc *wilc)

ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_1, reg);
if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n");
release_bus(wilc, RELEASE_ONLY);
ret = -EIO;
return ret;
@@ -1187,7 +1121,6 @@ int wilc_wlan_start(struct wilc *wilc)

ret = wilc->hif_func->hif_read_reg(wilc, 0x1000, &chipid);
if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n");
release_bus(wilc, RELEASE_ONLY);
ret = -EIO;
return ret;
@@ -1223,7 +1156,6 @@ int wilc_wlan_stop(struct wilc *wilc)

ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
if (!ret) {
- PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1231,7 +1163,6 @@ int wilc_wlan_stop(struct wilc *wilc)
reg &= ~BIT(10);
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
if (!ret) {
- PRINT_ER("Error while writing reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1240,34 +1171,24 @@ int wilc_wlan_stop(struct wilc *wilc)
ret = wilc->hif_func->hif_read_reg(wilc,
WILC_GLB_RESET_0, &reg);
if (!ret) {
- PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
- PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n",
- reg, timeout);

if ((reg & BIT(10))) {
- PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n",
- timeout);
reg &= ~BIT(10);
ret = wilc->hif_func->hif_write_reg(wilc,
WILC_GLB_RESET_0,
reg);
timeout--;
} else {
- PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n",
- timeout);
ret = wilc->hif_func->hif_read_reg(wilc,
WILC_GLB_RESET_0,
&reg);
if (!ret) {
- PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
- PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n",
- reg, timeout);
break;
}

@@ -1322,17 +1243,14 @@ void wilc_wlan_cleanup(struct net_device *dev)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);

ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg);
- if (!ret) {
- PRINT_ER("Error while reading reg\n");
+ if (!ret)
release_bus(wilc, RELEASE_ALLOW_SLEEP);
- }
- PRINT_ER("Writing ABORT reg\n");
+
ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
(reg | ABORT_INT));
- if (!ret) {
- PRINT_ER("Error while writing reg\n");
+ if (!ret)
release_bus(wilc, RELEASE_ALLOW_SLEEP);
- }
+
release_bus(wilc, RELEASE_ALLOW_SLEEP);
wilc->hif_func->hif_deinit(NULL);
}
@@ -1437,7 +1355,6 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u32 wid, int commit,
netdev_dbg(vif->ndev, "Get Timed Out\n");
ret_size = 0;
}
- netdev_dbg(vif->ndev, "[WILC]Get Response received\n");
wilc->cfg_frame_in_use = 0;
wilc->cfg_frame_offset = 0;
wilc->cfg_seq_no += 1;
@@ -1589,7 +1506,6 @@ int wilc_wlan_init(struct net_device *dev)

if (!wilc->tx_buffer)
wilc->tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
- PRINT_D(TX_DBG, "wilc->tx_buffer = %p\n", wilc->tx_buffer);

if (!wilc->tx_buffer) {
ret = -ENOBUFS;
@@ -1599,7 +1515,7 @@ int wilc_wlan_init(struct net_device *dev)

if (!wilc->rx_buffer)
wilc->rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
- PRINT_D(TX_DBG, "wilc->rx_buffer =%p\n", wilc->rx_buffer);
+
if (!wilc->rx_buffer) {
ret = -ENOBUFS;
PRINT_ER("Can't allocate Rx Buffer");
--
1.9.1


2016-02-04 09:25:09

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 22/70] staging: wilc1000: renames u8IfIdx of wilc_vif structure

From: Leo Kim <[email protected]>

This patch renames u8IfIdx variable of wilc_vif structure to idx
to avoid camelcase.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 2 +-
drivers/staging/wilc1000/linux_wlan.c | 8 ++++----
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 6f583a4..2022deb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -281,7 +281,7 @@ static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
*/
int wilc_get_vif_idx(struct wilc_vif *vif)
{
- return vif->u8IfIdx + 1;
+ return vif->idx + 1;
}

/* We need to minus 1 from idx which is from wilc device to get real index
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5c87105..9ca33536 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -107,7 +107,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
netdev_dbg(dev, "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, ip_addr_buf, vif->u8IfIdx);
+ wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);

break;

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

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

break;

@@ -1104,7 +1104,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)

vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
- tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
+ tx_data->bssid = wilc->vif[vif->idx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
@@ -1360,7 +1360,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
else
strcpy(ndev->name, "p2p%d");

- vif->u8IfIdx = wl->vif_num;
+ vif->idx = wl->vif_num;
vif->wilc = *wilc;
wl->vif[i] = vif;
wl->vif[wl->vif_num]->ndev = ndev;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index d1cb0b2..a9181d3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2197,7 +2197,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");

- wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+ wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);

s32Error = wilc_add_beacon(vif, settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 64fcb77..07a4ff1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -148,7 +148,7 @@ typedef struct {
} struct_frame_reg;

struct wilc_vif {
- u8 u8IfIdx;
+ u8 idx;
u8 iftype;
int monitor_flag;
int mac_opened;
--
1.9.1


2016-02-04 09:24:37

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 17/70] staging: wilc1000: rename pBssid of tx_complete_data structure

From: Leo Kim <[email protected]>

This patch renames pBssid variable of tx_complete_data structure to bssid
to avoid camelcase.

Signed-off-by: Leo Kim <[email protected]>
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5992478..f5f787e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1193,7 +1193,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = wilc->vif[vif->u8IfIdx]->bssid;
+ tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 392ef16..ebf38a5 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -809,7 +809,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (tqe->type == WILC_CFG_PKT) {
buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
} else if (tqe->type == WILC_NET_PKT) {
- char *bssid = ((struct tx_complete_data *)(tqe->priv))->pBssid;
+ char *bssid = ((struct tx_complete_data *)(tqe->priv))->bssid;

buffer_offset = ETH_ETHERNET_HDR_OFFSET;
memcpy(&txb[offset + 4], bssid, 6);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 455a98f..294552d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -82,7 +82,7 @@ typedef struct {
struct tx_complete_data {
int size;
void *buff;
- u8 *pBssid;
+ u8 *bssid;
struct sk_buff *skb;
};

--
1.9.1


2016-02-04 09:25:15

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 23/70] staging: wilc1000: fixes variable dereferenced before check

From: Leo Kim <[email protected]>

This patch fixes the warning reported by smatch.
- wilc_wlan_get_firmware() warn: variable dereferenced before check 'vif'
- wilc_set_multicast_list() warn: variable dereferenced before check 'dev'

Just delete them and no need add null check since they are net_device from
ndo_set_rx_mode of net_device_ops and vif of netdev_priv.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9ca33536..22a2f98 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -397,9 +397,6 @@ int wilc_wlan_get_firmware(struct net_device *dev)

netdev_info(dev, "loading firmware %s\n", firmware);

- if (!vif)
- goto _fail_;
-
if (!(&vif->ndev->dev))
goto _fail_;

@@ -1017,9 +1014,6 @@ static void wilc_set_multicast_list(struct net_device *dev)
vif = netdev_priv(dev);
hif_drv = (struct host_if_drv *)priv->hif_drv;

- if (!dev)
- return;
-
if (dev->flags & IFF_PROMISC)
return;

--
1.9.1


2016-02-04 09:23:59

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 11/70] staging: wilc1000: fix WEP security bug

Station cannot connect to soft AP mode wilc when it is configured for WEP
security. This patch fixes it by setting the key index within the key value and
change the last else condition with DEFAULTKEY action case, and also do not use
WILC_WFI_wep_default index to set wep key id.

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4b1d92c..67bcf88 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1737,14 +1737,7 @@ static int Handle_Key(struct wilc_vif *vif,
strWIDList[1].size = sizeof(char);
strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type;

- strWIDList[2].id = (u16)WID_KEY_ID;
- strWIDList[2].type = WID_CHAR;
-
- strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index;
- strWIDList[2].size = sizeof(char);
-
- pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key,
- pstrHostIFkeyAttr->attr.wep.key_len,
+ pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2,
GFP_KERNEL);

if (pu8keybuf == NULL) {
@@ -1752,15 +1745,21 @@ static int Handle_Key(struct wilc_vif *vif,
return -ENOMEM;
}

+ pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
+ pu8keybuf[1] = pstrHostIFkeyAttr->attr.wep.key_len;
+
+ memcpy(&pu8keybuf[2], pstrHostIFkeyAttr->attr.wep.key,
+ pstrHostIFkeyAttr->attr.wep.key_len);
+
kfree(pstrHostIFkeyAttr->attr.wep.key);

- strWIDList[3].id = (u16)WID_WEP_KEY_VALUE;
- strWIDList[3].type = WID_STR;
- strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len;
- strWIDList[3].val = (s8 *)pu8keybuf;
+ strWIDList[2].id = (u16)WID_WEP_KEY_VALUE;
+ strWIDList[2].type = WID_STR;
+ strWIDList[2].size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
+ strWIDList[2].val = (s8 *)pu8keybuf;

result = wilc_send_config_pkt(vif->wilc, SET_CFG,
- strWIDList, 4,
+ strWIDList, 3,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & ADDKEY) {
@@ -1797,7 +1796,7 @@ static int Handle_Key(struct wilc_vif *vif,
result = wilc_send_config_pkt(vif->wilc, SET_CFG,
&wid, 1,
wilc_get_vif_idx(vif));
- } else {
+ } else if (pstrHostIFkeyAttr->action & DEFAULTKEY) {
wid.id = (u16)WID_KEY_ID;
wid.type = WID_CHAR;
wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e6133fd..1907331 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -761,7 +761,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
return s32Error;
}

- priv->WILC_WFI_wep_default = 0;
memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key));
memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len));

@@ -788,7 +787,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < sme->key_len; i++)
PRINT_D(CORECONFIG_DBG, "WEP Key Value[%d] = %d\n", i, sme->key[i]);
}
- priv->WILC_WFI_wep_default = sme->key_idx;
priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len);

@@ -806,7 +804,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
pcgroup_encrypt_val = "WEP104";
pccipher_group = "WLAN_CIPHER_SUITE_WEP104";

- priv->WILC_WFI_wep_default = sme->key_idx;
priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len);

@@ -986,7 +983,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
- priv->WILC_WFI_wep_default = key_index;
priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);

@@ -1009,7 +1005,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
break;
}
if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
- priv->WILC_WFI_wep_default = key_index;
priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);

@@ -1336,9 +1331,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, key_index);
- }
+ wilc_set_wep_default_keyid(vif, key_index);

return 0;
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 9f8c79e..07eda4d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -124,7 +124,6 @@ struct wilc_priv {
struct host_if_drv *hWILCWFIDrv;
struct host_if_pmkid_attr pmkid_list;
struct WILC_WFI_stats netstats;
- u8 WILC_WFI_wep_default;
u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
u8 WILC_WFI_wep_key_len[4];
/* The real interface that the monitor is on */
--
1.9.1


2016-02-04 09:25:03

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 21/70] staging: wilc1000: removes void function return

From: Leo Kim <[email protected]>

This patch removes the warning reported by checkpatch.pl
for void function return statements are not generally useful.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index c16cc40..5c87105 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1047,8 +1047,6 @@ static void wilc_set_multicast_list(struct net_device *dev)
}

wilc_setup_multicast_filter(vif, true, (dev->mc.count));
-
- return;
}

static void linux_wlan_tx_complete(void *priv, int status)
--
1.9.1


2016-02-04 09:25:29

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 25/70] staging: wilc1000: wilc_parse_network_info(): renames local variables

From: Leo Kim <[email protected]>

This patch renames to avoid camelcase, changes follow are:
- pstrNetworkInfo to network_info
- u8MsgType to msg_type
- u8MsgID to msg_id
- u16MsgLen to msg_len
- u16WidID to wid_id
- u16WidLen to wid_len
- pu8WidVal to wid_val

Signed-off-by: Leo Kim <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 67 ++++++++++++++---------------
1 file changed, 33 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 43f0a29..24afeb8 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -272,27 +272,27 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 rx_len)

s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
{
- tstrNetworkInfo *pstrNetworkInfo = NULL;
- u8 u8MsgType = 0;
- u8 u8MsgID = 0;
- u16 u16MsgLen = 0;
+ tstrNetworkInfo *network_info = NULL;
+ u8 msg_type = 0;
+ u8 msg_id = 0;
+ u16 msg_len = 0;

- u16 u16WidID = (u16)WID_NIL;
- u16 u16WidLen = 0;
- u8 *pu8WidVal = NULL;
+ u16 wid_id = (u16)WID_NIL;
+ u16 wid_len = 0;
+ u8 *wid_val = NULL;

- u8MsgType = msg_buffer[0];
+ msg_type = msg_buffer[0];

- if ('N' != u8MsgType) {
+ if ('N' != msg_type) {
PRINT_ER("Received Message format incorrect.\n");
return -EFAULT;
}

- u8MsgID = msg_buffer[1];
- u16MsgLen = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
- u16WidID = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
- u16WidLen = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
- pu8WidVal = &msg_buffer[8];
+ msg_id = msg_buffer[1];
+ msg_len = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
+ wid_id = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
+ wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
+ wid_val = &msg_buffer[8];

{
u8 *pu8msa = NULL;
@@ -304,53 +304,52 @@ s32 wilc_parse_network_info(u8 *msg_buffer, tstrNetworkInfo **ret_network_info)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;

- pstrNetworkInfo = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
- if (!pstrNetworkInfo)
+ network_info = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+ if (!network_info)
return -ENOMEM;

- pstrNetworkInfo->s8rssi = pu8WidVal[0];
+ network_info->s8rssi = wid_val[0];

- pu8msa = &pu8WidVal[1];
+ pu8msa = &wid_val[1];

- rx_len = u16WidLen - 1;
- pstrNetworkInfo->u16CapInfo = get_cap_info(pu8msa);
- pstrNetworkInfo->u32Tsf = get_beacon_timestamp_lo(pu8msa);
- PRINT_D(CORECONFIG_DBG, "TSF :%x\n", pstrNetworkInfo->u32Tsf);
+ rx_len = wid_len - 1;
+ network_info->u16CapInfo = get_cap_info(pu8msa);
+ network_info->u32Tsf = get_beacon_timestamp_lo(pu8msa);
+ PRINT_D(CORECONFIG_DBG, "TSF :%x\n", network_info->u32Tsf);

u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
u32Tsf_Hi = get_beacon_timestamp_hi(pu8msa);

- pstrNetworkInfo->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
+ network_info->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);

- get_ssid(pu8msa, pstrNetworkInfo->au8ssid, &pstrNetworkInfo->u8SsidLen);
- get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
+ get_ssid(pu8msa, network_info->au8ssid, &network_info->u8SsidLen);
+ get_BSSID(pu8msa, network_info->au8bssid);

- pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
+ network_info->u8channel = get_current_channel_802_11n(pu8msa,
rx_len + FCS_LEN);

u8index = MAC_HDR_LEN + TIME_STAMP_LEN;

- pstrNetworkInfo->u16BeaconPeriod = get_beacon_period(pu8msa + u8index);
+ network_info->u16BeaconPeriod = get_beacon_period(pu8msa + u8index);

u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;

pu8TimElm = get_tim_elm(pu8msa, rx_len + FCS_LEN, u8index);
if (pu8TimElm)
- pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
+ network_info->u8DtimPeriod = pu8TimElm[3];
pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
u16IEsLen = rx_len - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);

if (u16IEsLen > 0) {
- pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
- GFP_KERNEL);
- if (!pstrNetworkInfo->pu8IEs)
+ network_info->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+ GFP_KERNEL);
+ if (!network_info->pu8IEs)
return -ENOMEM;
}
- pstrNetworkInfo->u16IEsLen = u16IEsLen;
-
+ network_info->u16IEsLen = u16IEsLen;
}

- *ret_network_info = pstrNetworkInfo;
+ *ret_network_info = network_info;

return 0;
}
--
1.9.1