Commit Graph

2219 Commits

Author SHA1 Message Date
Dan Carpenter 0a9019cc8a Staging: wilc1000: unlock on error in init_chip()
When there is an error in init_bus() then we need to call release_bus()
before we return.

Fixes: c5c77ba18e ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-15 16:31:09 +01:00
Gustavo A. R. Silva fe2570fbf3 staging: wilc1000: fix memory leak in wilc_add_rx_gtk
In case *mode* happens to be different than WILC_AP_MODE and
WILC_STATION_MODE, gtk_key is not released, hence leanding
to a memory leak. So, in this case it is safer to release
gtk_key just before returning to callers.

Addresses-Coverity-ID: 1476020 ("Resource leak")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-15 16:31:09 +01:00
Július Milan b62ce02e15 staging: wilc1000: fix registration frame size
Fixes the following sparse warnings:

drivers/staging/wilc1000/host_interface.c:2360:30: warning:
 incorrect type in assignment (different base types)
    expected restricted __le32 [addressable] [assigned] [usertype] frame_type
    got restricted __le16 [usertype] <noident>

Fixes: 147ccfd451 ("staging: wilc1000: handle mgmt_frame_register ops from cfg82011 context")
Signed-off-by: Július Milan <jmilan.dev@gmail.com>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-15 16:31:09 +01:00
Colin Ian King c58eef061d staging: wilc1000: fix missing read_write setting when reading data
Currently the cmd.read_write setting is not initialized so it contains
garbage from the stack.  Fix this by setting it to 0 to indicate a
read is required.

Detected by CoverityScan, CID#1357925 ("Uninitialized scalar variable")

Fixes: c5c77ba18e ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 16:32:13 +01:00
Ajay Singh 0b7b9b6c3d staging: wilc1000: fix NULL dereference inside wilc_scan()
Added NULL check before accessing 'hidden_net' pointer inside
wilc_scan() to fix the issue found by static code checker.

Fixes: 8f1a0ac1eb ("staging: wilc1000: handle scan operation callback from cfg80211 context")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:24:06 +01:00
Michael Straube 6bbb77a811 staging: wilc1000: correct inconsistent indenting
Correct inconsistent indenting reported by smatch.
Instead of simply remove indentation, refactor the
loop to also improve readabilitiy.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:51:15 +01:00
Ajay Singh 8f1a0ac1eb staging: wilc1000: handle scan operation callback from cfg80211 context
Refactor code to handle scan operation callback from cfg80211 context.
No need to maintain 'scan_attr' struct as the wid command is directly
sent to firmware from cfg80211 context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh a343cf5d32 staging: wilc1000: avoid extra buffer copy while connect cfg ops
Refactor the code to avoid the use of an extra buffer to store the
connection related parameter. No need to call cfg80211_disconnected in
case of failure to send the wid command to firmware, an error status is
directly returned in cfg80211 connect callback.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh e559681279 staging: wilc1000: handle connect ops callback from cfg80211 context
Refactor the connect related cfg callback to be called from cfg80211
context. No need to post connect command internally in case scan is in
progress instead simply return the error status in connect ops callback.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 8e6d6cf0f2 staging: wilc1000: avoid deferred handling of cfg80211 disconnect callback
Refactor disconnect operation callback to handle from the cfg80211
context. The reason code is not required to pass as parameter to the
function, so remove it.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 19cb25e1e6 staging: wilc1000: handle get_station() ops callback in cfg80211 context
Refactor code to handle the get_station() callback from cfg80211
context. Provided different API's to fetch the station statistics
information in sync or async call. From cfg80211 get_station() ops
callback calls the sync version of API.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 05d3bcb0f4 staging: wilc1000: handle remain on channel cfg ops from cfg80211 context
Refactor wilc_remain_on_channel() to handle remain_on_channel callback
from cfg80211 context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 530975f317 staging: wilc1000: use correct 'struct remain_ch' variable in scan complete
Use the correct reference to remain_ch variable in scan complete.
Passing 'msg->body.remain_on_ch' to handle_remain_on_chan is not
correct. So used the correct reference used to store roc related
information during the scan.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 153068b9d1 staging: wilc1000: refactor wilc_get_mac_address() to avoid deferred handling
Avoid handling of WID_MAC_ADDR wid command in deferred approach. Instead
of posting the wid to workqueue now handle directly from the caller
context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh b7afe35032 staging: wilc1000: delete the unused code after code refactor
After code refactor some of the macro and variables are not required any
more, so deleted the unused code.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh b61c8064f5 staging: wilc1000: handle key related cfg operation from cfg80211 context
Refactor add/delete key operation to handle directly from cfg80211
context. Also, avoid an extra copy of the information in hif layer and
directly fill the buffer in firmware format.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 98651ca0a1 staging: wilc1000: refactor wilc_get_inactive_time() to avoid deferred handling
Avoid handling of inactive time related wid command in deferred manner.
Instead of posting the wid to workqueue now handle directly from the
caller context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 04a61fbc40 staging: wilc1000: refactor wilc_set_wfi_drv_handler() to avoid deferred handling
Avoid handling of WID_SET_DRV_HANDLER wid command in deferred approach.
Instead of posting the wid to work queue now handle directly from the
caller context. Remove 'is_sync' parameter from the API as it's not
required anymore.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 5dea026441 staging: wilc1000: refactor wilc_set_operation_mode() to avoid deferred handling
Avoid handling of WID_CURRENT_CHANNEL wid command in deferred approach.
Instead of posting the wid to work queue now handle directly from the
caller context. Use structure to fill in the firmware specific format.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh daf0483e1c staging: wilc1000: handle station dump cfg ops from cfg80211 context
Refactor code to handle dump_station() callback from cfg80211 context.
Instead of deferring issue of wid command now send it directly from cfg
context. Also making use of wilc_get_rssi() error status in case there
is a failure to post the wid command to the firmware.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:45 +01:00
Ajay Singh 532391714d staging: wilc1000: refactor wilc_hif_set_cfg() to avoid deferred handling
Avoid handling configuration params wid command in deferred approach.
Instead of posting to workqueue now handle directly from the caller
context. Reduce the size of wid array from 32 to 4 as maximum only 4 wid
used at a time.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:44 +01:00
Ajay Singh 77506d42fe staging: wilc1000: refactor wilc_set_mac_chnl_num() to avoid deferred handling
Avoid handling of WID_CURRENT_CHANNEL wid command in deferred approach.
Instead of posting the wid to workqueue now handle directly from the
caller context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:44 +01:00
Ajay Singh 147ccfd451 staging: wilc1000: handle mgmt_frame_register ops from cfg82011 context
Avoid handling of mgmt_frame_register operation callback in a deferred
manner. Now set the wid command to firmware directly from caller
context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:44 +01:00
Ajay Singh 976c89b562 staging: wilc1000: handle add beacon operation callback from cfg80211 context
Refactor add/change beacon cfg80211 operation callback to handle from
cfg context. Also avoided extra copy of information by packing directly
in firmware expected format.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:49:44 +01:00
Ajay Singh 38b3ffa0ae staging: wilc1000: handle delete beacon cfg ops from cfg80211 context()
Refactor the code to handle delete beacon cfg operation from cfg80211
context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:46 +01:00
Ajay Singh 4c00f7052f staging: wilc1000: use is_zero_ether_addr() API to check mac address
Use is_zero_ether_addr() API to check if mac address value is zero.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:46 +01:00
Ajay Singh 9f1bdb7138 staging: wilc1000: handle delete station related callback ops from cfg80211 context
Refactor the code to handle delete/delete_all station operation callback
from cfg80211 context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:46 +01:00
Ajay Singh 6133ed9f63 staging: wilc1000: use void return for wilc_hif_pack_sta_param()
Change the return type from u32 to void for wilc_hif_pack_sta_param() as
its value is not used. Also remove the use of extra pointer as it's not
required now.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh 78c0c4e845 staging: wilc1000: handle add and edit station from the cfg80211 context
Refactor the code to avoid handling of add/edit stations using work
queue and now set the wid value from caller context.
Avoid making an extra copy of buffer and directly copy the data in
firmware expected format.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh cf6d06002d staging: wilc1000: handle setting power management from cfg80211 context
Refactor the code to handle the power management cfg operation from the
caller context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh 430d0ec49d staging: wilc1000: handle tx power related callback from cfg80211 context
Avoid the use of internal work queue to defer the handling of tx power
related cfg operations callback. Now issuing the wid command to firmware
directly from the caller context.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh 6dea33021f staging: wilc1000: use mutex lock to synchronized sending 'wid' cmd to firmware
Use mutex lock to protect the issuing of wid cmd to the firmware.
Currently the wid commands are synchronized by use of hif_workqueue work
queue.
Now, these changes are required to synchronize the access to wid
command, so the commands can be issued directly from cfg80211 context
and 'WILC_wq' thread.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh f78d5db98b staging: wilc1000: avoid the use of the static variable to configure wiphy struct
Refactor code to avoid the use of static variables to configure the
'wiphy' structure. Now move static variables as part of 'priv' data so
it helped to maintain this information per interface.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh 21728f2e72 staging: wilc1000: make use of put_unaligned_le32 in handle_set_wfi_drv_handler()
Make use of put_unaligned_le32() function to pack the wid command buffer
for firmware.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh 440592df86 staging: wilc1000: remove unnecessary checks in wilc_mac_close()
Remove unnecessary 'if' check in wilc_mac_close() as those conditions
will not happen.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:48:45 +01:00
Ajay Singh e0f7d41e17 staging: wilc1000: rename tsf_hi element of network_info struct
Rename 'tsf_hi' element in network_info struct as it's not used to store
only the higher 32-bit value but the complete 64-bit tsf value.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:46:51 -08:00
Ajay Singh 68b4f745cf staging: wilc1000: use ENOBUFS error code instead of WILC_TX_ERR_NO_BUF macro
Make use of 'ENOBUFS' instead of WILC_TX_ERR_NO_BUF macro. The value of
WILC_TX_ERR_NO_BUF is -2, which is confusing with ENOENT error code.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:46:51 -08:00
Ajay Singh d0e41eff4c staging: wilc1000: added 'WILC_' prefix for constants to have clear namespace
For better namespace added 'WILC_' prefix for driver specific constants.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:46:51 -08:00
Ajay Singh d378599a6b staging: wilc1000: rename firmware related constants to follow better namespace
Rename the firmware related macro by prefix with 'WILC_FW_' prefix for
a better namespace. Also, move them to wilc_wlan_if.h file along with other
FW related macros.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:46:51 -08:00
Ajay Singh c140dd91ce staging: wilc1000: move current_tx_rate enum to wilc_wlan_if.h file
Move 'current_tx_rate' enum to wilc_wlan_if.h, to have it along with the
other FW related to constants. Also added prefix to have a better
namespace.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:16 -08:00
Ajay Singh b997b84ffc staging: wilc1000: use proper namespace for macros in wilc_wlan_if.h header
Rename the macros defined in wilc_wlan_if.h header to have clear
namespace. As convention used 'WILC_FW_' prefix for constants defined for
firmware and 'WILC_' prefix for driver constants.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:16 -08:00
Ajay Singh 00d54198a7 staging: wilc1000: restructure macros used to handle security type
Restructure the code to have a proper namespace for macro defined to
handle the security types. Move them as part of wilc_wlan_if.h header as
along with other macro defined for firmware.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:16 -08:00
Ajay Singh 8c4574d6c8 staging: wilc1000: use enum contants for mac status & added 'WILC_' prefix
Clubbed mac status constants inside the enum constant and also added
'WILC_' prefix to have better namespace.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:16 -08:00
Ajay Singh 065a69a922 staging: wilc1000: move sdio_cmd52 & sdio_cmd53 struct to source file
Moved sdio_cmd52 & sdio_cmd53 struct from wilc_wlan_if.h, as its used in
wilc_sdio.cfile.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:16 -08:00
Ajay Singh b02aab8fb0 staging: wilc1000: remove unused macros and struct members in host_interface.h
Cleanup patch to remove the unused macros and struct members in
host_interface.h header file.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:15 -08:00
Ajay Singh 7e7e278fe3 staging: wilc1000: use WLAN_PMKID_LEN macro from ieee80211.h header
Make use of WLAN_PMKID_LEN macro provided by ieee80211.h header instead
of PMKID_LEN.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:15 -08:00
Ajay Singh 2bae293a4c staging: wilc1000: use macro from ieee80211.h in register frame api's
Make use of ieee80211.h provided macros and removed the extra macro
defined for the same purpose.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:15 -08:00
Adham Abozaeid 46f9172ef8 staging: wilc1000: Remove unused mutex cfg_values_lock
After removing cfg_values member, cfg_values_lock that was used to protect
it can also be removed.

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11 11:38:54 -08:00
Adham Abozaeid 2a200d6c38 staging: wilc1000: Don't keep a copy of wiphy parameters in the driver
host_if_drv.cfg_values is a write only member, and can be removed

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11 11:38:54 -08:00
Adham Abozaeid 6eb7207384 staging: wilc1000: validate cfg parameters before scheduling the work
Validate cfg parameters after being called by cfg80211 in set_wiphy_params
before scheduling the work executed in handle_cfg_param

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11 11:38:54 -08:00