summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ti/wlcore/testmode.c
AgeCommit message (Collapse)Author
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 51 franklin st fifth floor boston ma 02110 1301 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 246 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27netlink: make validation more configurable for future strictnessJohannes Berg
We currently have two levels of strict validation: 1) liberal (default) - undefined (type >= max) & NLA_UNSPEC attributes accepted - attribute length >= expected accepted - garbage at end of message accepted 2) strict (opt-in) - NLA_UNSPEC attributes accepted - attribute length >= expected accepted Split out parsing strictness into four different options: * TRAILING - check that there's no trailing data after parsing attributes (in message or nested) * MAXTYPE - reject attrs > max known type * UNSPEC - reject attributes with NLA_UNSPEC policy entries * STRICT_ATTRS - strictly validate attribute size The default for future things should be *everything*. The current *_strict() is a combination of TRAILING and MAXTYPE, and is renamed to _deprecated_strict(). The current regular parsing has none of this, and is renamed to *_parse_deprecated(). Additionally it allows us to selectively set one of the new flags even on old policies. Notably, the UNSPEC flag could be useful in this case, since it can be arranged (by filling in the policy) to not be an incompatible userspace ABI change, but would then going forward prevent forgetting attribute entries. Similar can apply to the POLICY flag. We end up with the following renames: * nla_parse -> nla_parse_deprecated * nla_parse_strict -> nla_parse_deprecated_strict * nlmsg_parse -> nlmsg_parse_deprecated * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict * nla_parse_nested -> nla_parse_nested_deprecated * nla_validate_nested -> nla_validate_nested_deprecated Using spatch, of course: @@ expression TB, MAX, HEAD, LEN, POL, EXT; @@ -nla_parse(TB, MAX, HEAD, LEN, POL, EXT) +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression TB, MAX, NLA, POL, EXT; @@ -nla_parse_nested(TB, MAX, NLA, POL, EXT) +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT) @@ expression START, MAX, POL, EXT; @@ -nla_validate_nested(START, MAX, POL, EXT) +nla_validate_nested_deprecated(START, MAX, POL, EXT) @@ expression NLH, HDRLEN, MAX, POL, EXT; @@ -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT) +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT) For this patch, don't actually add the strict, non-renamed versions yet so that it breaks compile if I get it wrong. Also, while at it, make nla_validate and nla_parse go down to a common __nla_validate_parse() function to avoid code duplication. Ultimately, this allows us to have very strict validation for every new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the next patch, while existing things will continue to work as is. In effect then, this adds fully strict validation for any new command. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-27wlcore: Enable runtime PM autosuspend supportTony Lindgren
With runtime PM tested working for wlcore with no autosuspend, we can now enable autosuspend to cut down on enable/disable for interrupts. Basically we just replace pm_runtime_put() with the autosuspend variants. Let's use autosuspend delay of 50ms that MMC drivers typically use. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-06-27wlcore: Add support for runtime PMTony Lindgren
We can update wlcore to use PM runtime by adding functions for wlcore_runtime_suspend() and wlcore_runtime_resume() and replacing calls to wl1271_ps_elp_wakeup() and wl1271_ps_elp_sleep() with calls to pm_runtime_get_sync() and pm_runtime_put(). Note that the new wlcore_runtime_suspend() and wlcore_runtime_resume() functions are based on simplified versions of wl1271_ps_elp_sleep() and wl1271_ps_elp_wakeup(). We don't want to use the old functions as we can now take advantage of the runtime PM usage count. And we don't need the old elp_work at all. And we can also remove WL1271_FLAG_ELP_REQUESTED that is no longer needed. Pretty much the only place where we are not just converting the existing functions is wl1271_op_suspend() where we add pm_runtime_put_noidle() to keep the calls paired. As the next step is to implement runtime PM autosuspend, let's not add wrapper functions for the generic runtime PM calls. We would be getting rid of any wrapper functions anyways. After autoidle we should be able to start using Linux generic wakeirqs for the padconf interrupt. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2017-04-13netlink: pass extended ACK struct to parsing functionsJohannes Berg
Pass the new extended ACK reporting struct to all of the generic netlink parsing functions. For now, pass NULL in almost all callers (except for some in the core.) Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-23wlcore: fix interrogate command lengthIgal Chernobelsky
Change interrogate command prototype to have command size and returned buffer length. This fixes the issue when command parameters are needed to be passed to FW in addition to acx header as in the case with get RSSI command, where role_id has to be passed. Signed-off-by: Igal Chernobelsky <igalc@ti.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
2013-09-30wlcore: add new plt power-mode: CHIP_AWAKEYair Shapira
Under this mode the chip is powered on including sdio but no FW is downloaded and run, interrupts are not enabled, etc... This mode is intended to allow RTTT to bridge sdio as a transport to the chip. Driver only provides sdio access using the dev_mem debugfs file. Some fixes done to the code that ensures that PLT mode and normal driver power mode (ifconfig/add_interface) are mutually excluded. Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
2013-08-12mac80211: add vif to testmode cmdDavid Spinadel
Pass the wdev from cfg80211 on to the driver as the vif if given and it's valid for the driver. Signed-off-by: David Spinadel <david.spinadel@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2012-09-27wlcore: Prevent interaction with HW after recovery is queuedIdo Yariv
When a function requests to recover, it would normally abort and will not send any additional commands to the HW. However, other threads may not be aware of the failure and could try to communicate with the HW after a recovery was queued, but before the recovery work began. Fix this by introducing an intermediate state which is set when recovery is queued, and modify all state checks accordingly. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Luciano Coelho <luca@coelho.fi>
2012-07-18wlcore: make usage of nla_put clearerYair Shapira
handle errors of nla_put() inside the if(nla_put...) {} This makes the code simpler and clearer because: we take advantage from the fact that we have only one nla_put in our routines (so no real need for goto label). this avoids ugly goto forward followed by goto backward. Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-07-18wlcore/wl12xx: calibrator fem detect implementationYair Shapira
this completes the calibrator based fem detect logic in driver: driver starts (by calibrator) in plt_mode PLT_FEM_DETECT wlcore inits and starts plt on wl12xx wl12xx fetches fem number from firmware and stores it in wl->fem_manuf wl12xx immediatly returns (doesn't start radio, etc...) wlcore returns the fem_manuf to calibrator using WL1271_TM_ATTR_DATA plt_mode is stopped Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-07-18wlcore: add plt_mode including new PLT_FEM_DETECTYair Shapira
add wl->plt_mode that is used to indicate different plt working modes: this will be used to implement calibrator side auto fem detection where driver asks firmware to detect the wlan fem radio type and returns it to calibrator. this is not implemented yet and plt_modes: PLT_ON and PLT_FEM_DETECT currently behave the same. Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-07-10wlcore: remove recover cmd from testmodeArik Nemtsov
This command is buggy (doesn't take the mutex) and unused. Instead, the "start_recovery" file is used for the same purpose. Remove the code but keep the command constant to avoid breaking the testmode ABI. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-06-13wlcore: add print logs of radio_status in case of BIP calibrationYair Shapira
FEM BIP calibration may fail with fw/phy radio status. In order to recognize these failures a log is added to the calibration answer (TEST_CMD_P2G_CAL) Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-04-18Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: drivers/net/wireless/iwlwifi/iwl-testmode.c include/net/nfc/nfc.h net/nfc/netlink.c net/wireless/nl80211.c
2012-04-12wlcore/wl12xx: implement chip-specific register tablesLuciano Coelho
Add register tables support in wlcore, add some new IO functions to read and write to chip-specific register and data addresses. Move some common register values from wl12xx to wlcore and add the registers table to wl12xx. Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-04-12wl12xx/wlcore: move wl1271 struct to wlcore and add opsLuciano Coelho
In order to add chip-specific operations and prepare for future elements that need to be set by the lower driver, move the wl1271 structure to the wlcore.h file and add an empty placeholder for the operations structure. Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-04-12wl12xx/wlcore: rename wl12xx to wlcoreLuciano Coelho
Rename the wl12xx driver directory to wlcore as an initial step towards the split of the driver into wlcore and wl12xx. We just rename the directory first to keep git blame happy. Signed-off-by: Luciano Coelho <coelho@ti.com>