summaryrefslogtreecommitdiffstats
path: root/drivers/staging/wfx/scan.c
AgeCommit message (Collapse)Author
2020-01-16staging: wfx: simplify wfx_scan_complete()Jérôme Pouiller
wfx_scan_complete() do nothing with argument hif_ind_scan_cmpl. In add, hif_ind_scan_cmpl come from hardware API and is not expected to be used with upper layers of the driver. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200115135338.14374-40-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-16staging: wfx: drop wdev->output_powerJérôme Pouiller
mac80211 and the device are both able to control tx power per vif. But, the current code retrieve tx power from wfx_config(). So, it does not allow to setup the tx power independently for each vif. Driver just has to rely on bss_conf->txpower to get the correct information. In add, it is no more necessary to protect access to wdev->output_power with scan_lock. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200115135338.14374-15-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-16staging: wfx: simplify hif_set_output_power() usageJérôme Pouiller
Hardware API use 10th of dBm for output power unit. Upper layers should use same units than mac80211 and the conversion should be done by low level layer of the driver (hif_set_output_power()) In add, current code of hif_set_output_power() use a __le32 while the device API specify a specific structure for this. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200115135338.14374-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-16staging: wfx: make hif_scan() usage clearerJérôme Pouiller
hif_scan() return max number of jiffies to wait before the completion indication. However, if this value is negative, an error has occurred. Reword the code to reflect that behavior. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200115135338.14374-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: implement cancel_hw_scan()Jérôme Pouiller
The device provides an API to abort a scan request. Expose this feature to mac80211. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-55-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: delayed_link_loss cannot happenJérôme Pouiller
Original code allows to detect an BSS loss during a scan and delaying the handling of BSS loss. However, there it is no real problem to just make these two events mutually exclusive (there is just a performance penalty). Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-54-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: delayed_unjoin cannot happenJérôme Pouiller
Original code allows to detect an unjoin request during a scan and delaying the unjoin request. However, it is far easier to just block the unjoin request until the end of the scan request. In fact, it is already the case since scan and unjoin are protected by conf_mutex. So, currently, the handling of delayed_unjoin is just dead code. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-53-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: workaround bug with "iw scan"Jérôme Pouiller
mac80211 specification does not forbid hw_scan() to call ieee80211_scan_completed(). However, from userspace point of view, not all applications support this behavior. In particular, the code of iw contains a big fat warning: /* * This code has a bug, which requires creating a separate * nl80211 socket to fix: * It is possible for a NL80211_CMD_NEW_SCAN_RESULTS or * NL80211_CMD_SCAN_ABORTED message to be sent by the kernel * before (!) we listen to it, because we only start listening * after we send our scan request. [...] * Alas, the kernel doesn't do that (yet). */ So, we have to avoid to call ieee80211_scan_completed() from hw_scan() (it's a kind of unwritten rule). This patch relocates the hw_scan() process to a work_struct to fix the problem. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-52-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: rewrite wfx_hw_scan()Jérôme Pouiller
Scan requests from mac80211 must be splitted in a few hardware requests (it is necessary to split channels with active scan and channels with passive scan). Current code schedules a work_struct for each hardware request and one delayed_work to handle scan timeout. It is far simpler to run send all the hardware requests synchronously and replace delayed_work with a simple wait_for_completion_timeout(). Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-51-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: simplify hif_set_template_frame() usageJérôme Pouiller
The structure hif_mib_template_frame come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, the current code for hif_set_template_frame() is dumb. All the difficult task is left to the caller. So, there is code to factorize here. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-50-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: introduce update_probe_tmpl()Jérôme Pouiller
Simplify wfx_hw_scan() by splitting out the update of the probe request. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-49-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: simplify hif_scan() usageJérôme Pouiller
The structures hif_req_start_scan and hif_ssid_def come from hardware API. It is not intended to be manipulated in upper layers of the driver. So, this patch relocate handling of theses structures to hif_scan() (the low level function). This change also allows to drop struct wfx_scan_params. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-48-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: drop useless wfx_scan_complete()Jérôme Pouiller
Since wfx_scan_complete() is now only called from wfx_scan_complete_cb(), it make sense to merge the both functions. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-47-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: device already handle sleep mode during scanJérôme Pouiller
The device is not allowed to enter in sleep mode during scan. However, this is already handled by the device. So driver does not have to care about it. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-46-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: hif_scan() never failsJérôme Pouiller
If scan fails, status is returned in hif_ind_scan_cmpl. hif_scan always return a success. So, we can simplify the code. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-45-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: firmware already handle powersave mode during scanJérôme Pouiller
When user try to launch scan while connected, it is necessary to notify the AP that we cannot receive data (using power save mode). Firmware already handles this automatically so the code in the driver is redundant and can be dropped. By edge effect, hack of scan status in wfx_set_pm() is now useless. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-31-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: fix typo in "num_of_ssi_ds"Jérôme Pouiller
The script that has imported API headers has made a mistake in "num_of_ssi_ds". Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-24-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: ensure that received hif messages are never modifiedJérôme Pouiller
There are no real reason to modify the data received from device. So, let's mark the arguments constant. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-23-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-18staging: wfx: simplify variable assignmentJérôme Pouiller
Attribute "aborted" and argument "aborted" are both booleans. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191217161318.31402-20-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-14staging: align to fix warnings of line over 80 charactersJules Irenge
Align to fix multiple warnings of line over 80 characters. Issue detected by checkpatch tool. Signed-off-by: Jules Irenge <jbi.octave@gmail.com> Link: https://lore.kernel.org/r/20191113110052.14855-1-jbi.octave@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-08staging: wfx: drop calls to BUG_ON()Jérôme Pouiller
Most of calls to BUG_ON() could replaced by WARN(). By the way, this patch also try to favor WARN() (that include a comment about the problem) instead of WARN_ON(). Reported-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191008094232.10014-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-04staging: wfx: implement the rest of mac80211 APIJérôme Pouiller
Finish to fill struct ieee80211_ops with necessary callbacks. Driver is now ready to be registered to mac80211. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20190919142527.31797-21-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-04staging: wfx: allow to scan networksJérôme Pouiller
Chip can make foreground scan or background, but both can't be mixed in same request. So, we need to split each mac80211 requests into multiple HIF requests. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20190919142527.31797-19-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>