History log of /drivers/net/wireless/iwlwifi/mvm/power.c
Revision Date Author Comments
9474d444bd0e6590ba99d640fa5e4d28380c1f04 02-Sep-2014 Arik Nemtsov <arik@wizery.com> iwlwifi: mvm: fix PSM disable during TDLS

Simplify the code and check for TDLS stations just before sending the
MAC_POWER_TABLE command. The previous version of the code still allowed
PM in some multi-interface scenarios even with TDLS connected.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
49c6d8021f11a4e86ab2689c62fbfca2ea8cbd0d 27-Aug-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: Fix skip over dtim configuration in d0i3

There was some confusion concerning the units of the beacon interval.
The driver assumed that it was in msec where it was in TU - so fix that.
Skip over dtim was capped by 300TU where it should be by 306TU.
It should also be subjected to several conditions:
Not a DFS channel, dtim period < 10, and the multicast wake-lock
is off. Concerning multicast lock - there is an implementation gap
in the supplicant, so just leave a TODO.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
717e2390dc72e87380d6ccf62134b0ab84ee43d2 31-Jul-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwiwi: mvm: use bss_conf->dtim_period instead of conf.ps_dtim_period

The latter is meant for software implementation of power
save and is not per-virtual interface. Since our driver
supports multiple virtual interfaces, we need to use
vif->bss_conf.dtim_period.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8b4139dc9f2171f313fc703c08269f6f8a6f6fc4 24-Jul-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: add Intel Mobile Communications copyright

Our legal structure changed at some point (see wikipedia), but
we forgot to immediately switch over to the new copyright
notice.

For files that we have modified in the time since the change,
add the proper copyright notice now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2533edcee8aa311a24e5c0a7da955893ad65dc24 08-Aug-2014 Luciano Coelho <luciano.coelho@intel.com> iwlwifi: mvm: add option that allows a vif to disable PS

We need to disable PS when a monitor vif is active or, in the future,
when a channel switch is happening. Add a boolean to mvmvif that
allows PS to be disabled generically. Additionally, make the monitor
interface use this new flag when it gets activated.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
ef9203d23fecf11e02958de0988170a67adf7447 08-Aug-2014 Luciano Coelho <luciano.coelho@intel.com> iwlwifi: mvm: add function to update only ps

Add a new iwl_mvm_power_update_ps() function that allows only ps to be
updated according to changes in the vifs. This allows us to disable
ps only without affecting the pm values of the vifs (and to avoid
sending unnecessary MAC_PM_POWER_TABLE commands to the firmware).

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
128aa948d0606e537b743fb8e29ce09fc3473137 08-Aug-2014 Luciano Coelho <luciano.coelho@intel.com> iwlwifi: mvm: refactor iwl_mvm_power_set_pm() to spin the ps part off

Separate the ps part of iwl_mvm_power_set_pm() into a new
iwl_mvm_power_set_ps() function. This will enable us to update the ps
part independently from the rest, which is needed by CSA (at least).

This required a bit of refactoring and the creation of a new iterator
function.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
b1873300e15aff44c01f7c9bc275c2c6e414f2fa 08-Aug-2014 Luciano Coelho <luciano.coelho@intel.com> iwlwifi: mvm: re-enable ps when monitor interfaces are removed

If a monitor interface is added and then removed, we don't reset the
mvm->ps_disabled flag, so we never re-enable power saving. Fix that
and rearrange the code a bit.

Additionally, fix a small indentation mistake in the
iwl_mvm_power_set_pm() function declaration.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
84fd7608a0d7b9e7ce350aab278780a3e341628f 30-Jul-2014 Eliad Peller <eliad@wizery.com> iwlwifi: mvm: add use_ps-poll debugfs power option

By default, when uapsd is not used, the ucode uses
null data packet to exit power-save and get then
pending frames.

However, some tests require the explicit usage of ps-poll.
Allow setting use_ps_poll power option (through debugfs)
to configure the ucode to use ps-poll instead.

The ucode configuration is done by setting the advanced-pm
flag while setting all the ACs to non-upasd mode.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
fa3d07e47f2411aa9ccb54192c4f978c60a9e111 15-May-2014 Arik Nemtsov <arik@wizery.com> iwlwifi: disable PSM on vifs with associated TDLS peers

The FW does not support PSM on a vif with associated TDLS peers. Disable
PSM when the first peer joins and re-enable it when the last leaves.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
cf7b491dbbac0e25f24265b005bc0ceff622d387 15-May-2014 Arik Nemtsov <arik@wizery.com> iwlwifi: mvm: disallow new TDLS stations when appropriate

HW/FW constraints dictate that TDLS should only be used when a single
phy ctx is active. We also support at most 4 TDLS peers. We don't
support TDLS on a P2P vif.

Unify and move a phy-ctx counting implementation from the power-mgmt code
in order to simplify implementation.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
999609f1206a14039db534058b251c6d5ab39322 15-May-2014 Arik Nemtsov <arik@wizery.com> iwlwifi: mvm: remove vif argument from power_update_mac

The power update function looks at all current vifs to determine the power
policy. It doesn't use the current vif. Instead the value was overwritten
and used internally.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
13b7232225749cb339a545edaa3f053e5e219d31 20-May-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: make iwl_mvm_update_beacon_abort static

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
fa7b2e7fd09f17c47ac312ade3aae48247a528f6 20-May-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: don't filter out the first beacon

Enabling beacon filtering should be done only after a beacon
has been received. Doing that too early will cause
disconnections.
This has already been fixed, but the fix didn't take care
about the case where the beacon is received after the
association, it waited only for association which is not
enough.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
894981ed43fc5e706330469e27972f7c2dd046cb 19-May-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: Remove redundant initialization

This value is being set few lines under in set_cqm_params.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
6f3610588174ef0cb73a4e604ae62ecf6eb8b9f9 12-May-2014 Eliad Peller <eliad@wizery.com> iwlwifi: mvm: set SKIP_OVER_DTIM flag only if needed

setting SKIP_OVER_DTIM when skip_dtim_periods is 0
causes a ucode assert. set the flag only if needed.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
a10229271946731959b2269370d0492d88cfab23 12-May-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: remove CMD_SYNC

CMD_SYNC is really 0 which is confusing:

if (cmd.flags & CMD_SYNC) is always false.
Fix this by simply removing its definition.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
0534528ec36313731eddf4b11a2de033e54c0cfe 08-May-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: Disable uAPSD for a DCM client

A binding object associates virtual MACs to a Phy.
Binding object can ask (and get) air time, thus
allowing several MACs to share the medium.
A binding object can be in either one of 3 states:
1) standalone - A single active MAC
2) Different Channel Mode (DCM) - There are 2 active
MACs or more (not necessarily just clients), but each
has its own channel.
3) Same Channel Mode (SCM) - There are 2 active
MACs or more (not necessarily just clients), that
share the same channel.
This patch introduces an additional condition for enabling uAPSD:
uAPSD should be disabled for a client in DCM.
The reason for that is a low latency issue in Miracast.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
63ef81cfb6e57b1a4a351bb8d0aad908fdf9d2c6 02-Apr-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: Add power management support for P2P DCM

If two clients are active while each one is alone on its channel,
and the applicable flags are set, power management should be enabled.
This condition is referred to as Different Channel Mode (DCM).
Up to now, in DCM power management was supported only on BSS.
This patch adds support for P2P power management in DCM as well.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
c6e37a686e02f5859000c0a01428e375d5e59d65 31-Mar-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: Re-factor enabling uAPSD logic

The driver can enable uAPSD and specify some of its related parameters.
This patch organizes this logic in a separate function.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
639eabad3ab4ce4872d6bcaf19e88685769e8d28 30-Mar-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: remove IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD flag

All the supported firmwares have this flag set.

Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
73e5f2c5d76264743ec75f96f3dc3932fff52171 30-Mar-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: remove IWL_UCODE_TLV_FLAGS_BF_UPDATED flag

All the supported firmwares have this flag set.

Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
ad2549d8edf8f10a6330ab60bfbdaea096281a79 30-Mar-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: remove IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT flag

All the supported firmwares have this flag set.

Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
198890258fc0f9e3270ed1c1794b7610dad92ada 19-Mar-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: Handle power management constraints for additional use-cases

Today, the driver logic looks for the conditions to disable
power management albeit power management should be enabled
in a very few distinct cases.
This patch changes the driver logic to enable power
management once the required conditions met.
While at it, make some housekeeping and support a few
additional use cases:

a) Add support for a standalone p2p client:
Power management should be enabled for a P2P client
MAC only if the firmware supports it (TLV flag is set).
Instead we used the DCM flag, therefore we didn't cover
use cases that did not include the DCM flag.

b) Add support to Same-Channel-Mode (SCM):
If both clients share the same channel (SCM), and there
are no other active vifs in the system, power management
should be enabled only if the firmware supports this
(TLV flag is set).

c) Fix power management logic for GO/AP:
Today, when we detect an active GO / AP MAC - we disable
power management for all the vifs altogether.
Actually, the correct behavior is to enable power
management on a client if on a different channel
(based on the firmware capabilities).

d) Housekeeping - Along with that, this patch includes some
code-reorganizing: Today the logic of disabling power is
scattered across several functions, specifically in the
iterator. For the sake of both readability and
scalability, we moved this logic to its applicable
function, leaving the iterator gather information only.
Furthermore, as power management is a MAC-related
attribute, we moved the power management member to the
iwl_mvm_vif structure.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8ea0c68fe56983f40256d0407ecf19530fd31442 20-Feb-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: disable power on P2P client when BSS is added

When power update is initiated on BSS STA while P2P client
exists, the power command will be sent only on BSS STA vif
ignoring P2P client.

Since the firmware has symmetric constraints on the power
save enablement we can simplify the code a bit.

The current firmware doesn't know how to enable power
management on P2P client. Even BSS power management must
be disabled when a P2P client is added.

Future firmware will support power save on BSS and P2P client
as long as they are on different channels.
This was buggy since we didn't disable power management on
P2P client interface if BSS added on the same channel.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
7303dd7f312f0d07a4bf45c62608d5233b5e8062 03-Feb-2014 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Enable power save on BSS and P2P client in DCM

New FW enables support for power save on BSS and P2P client MACs
simultaneously when they function on different channels (DCM).
Enable this case in the driver after examining new TLV flag -
IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM. Still power management is not
allowed on both MACs if they function on a same channel.
Remove another redundant TLV flag - IWL_UCODE_TLV_FLAGS_P2P_PS that
is not in use anymore. Remove bound_vif_cnt as redundant.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
e5e7aa8e2561019fb3f417041d50e1c0df8f5e42 27-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: refactor power code

The main complexity of the power code is that it needs to
take into account the firmware limitations.
These limitations state that we need to have a global
picture of the vifs present in the system to be able to
decide if we can enable power management on a specific vif.

Even device power save (as opposed to vif power management)
must be disabled in certain circumstances (monitor vif).

Refactor the current code to make this clearer by defining
a function that explicitely computes these constraints.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
6345061fda7766b937bc0e52e3467071a640c6c4 28-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: remove iwl_mvm_power_mac_disable

Its logic can be implemented with
iwl_mvm_power_mac_update_mode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
c1cb92fc1ecd2159b7fb148ed8d5f09d511ae030 28-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: remove support for legacy power API

If the driver detects old firmware, we disable support for
power management.
This greatly simplifies the code.

Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
474b50c30864a342d47e5d4a4a69df5750fa4254 28-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: store latest power command for debugfs read

Instead of re-building the power command upon debugfs read,
store the latest command sent to the firmware.
This reduces the code complexity by reducing the number of
entries in the power code.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
06280a2ba9050cd8bc15a03aa22b24698a3ea742 27-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: don't send the beacon filtering command from iterator

The firmware doesn't allow per-vif beacon filtering: we can
use beacon filtering for one vif only. So remember which
vif has beacon filtering enabled in the iterator, and send
the command outside the iterator.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
dcefeec05be5821a82f9ee66f6fcb9849d3f7568 26-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: don't look at power commmand to decide if power is enabled

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
d623d24a77b266caf46aa3652baadb646576e89a 25-Jan-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: clean up in power code

Reduce indentation where it is possible.
Make a function static - it wasn't used outside its file
anyway.
Remove the unneeded pm_prevent state.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
3dd37d05240459da8445d358760db31564d926f3 07-Jan-2014 Eliad Peller <eliad@wizery.com> iwlwifi: mvm: add D0i3 power configurations

Configure skip-over-dtim and beacon filtering on D0i3
enter/exit.

Since the D0i3 entry/exit commands require different
command flags (e.g. CMD_HIGH_PRIORITY), add a new parameter
to the functions being called, and make the current users
pass CMD_SYNC.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
e03f9bef2f9de4295df91a235c6b521dd64ef655 13-Nov-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: disable powersave in low-latency

While an interface is in low-latency mode, for now powersave
should be disabled for it, so take low-latency into account
in the powersave code and force powersave recalculation when
low-latency mode changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
c8bf40ad4f8f5d26f6744020ad51be420a707385 03-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com> wireless: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
51368bf792c79eb917694a4155d62f04359e3734 30-Dec-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: Update Copyright to 2014

Happy new year!

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
752096727cdec42c2fa91242dbc341c8f360e167 12-Nov-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add and examine TLV flag for P2P client uAPSD support

Current firmware doesn't handle well uAPSD in P2P Client.
When it will be fixed, the firmware will set a TLV flag to notify
the driver that uAPSD is supported in P2P client mode.
Check this flag when sending power command for P2P client.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
e45a941deb24b956c9b5a06461810b45882c3e1c 04-Dec-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: add per-vif power debugfs hooks

This allows to tweak the power parameters per vif.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
51498cf6d8b42e89be77d48a2158825ca9bbd3bf 02-Sep-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Enable power save on a single P2P client interface

Enable power save on P2P client interface only if it is the
only bound interface.
Avoid using uAPSD if P2P client is associated to GO that uses
opportunistic power save. This is due to current FW limitation.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
92d8556250c81bd6d4df522926a2cb3711dd01e2 23-Oct-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Disable power save for monitor interface

When monitor interface is activated device power save needs
to be disabled.
Re-consider power management status on other active
interfaces when monitor interface is bound or unbound.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
1c2abf724b3397830e60596a6a41e2d9f870d1a6 27-Aug-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Change power management dependency on multi MAC

FW still does not support power management on multiple MAC interfaces.
Currently the driver enforce this limitation by disabling PM if second
interface is added. Change this behavior to allow PM on a single interface
even if other interfaces exist but not bound to any specific PHY.
PM will be enabled if only one single interface is bound.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
175a70b7f22894cda03e1608f075c548656024f8 14-Apr-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add uAPSD misbehaving AP notification handling

FW implements protective algorithm to identify AP's improper uAPSD
behavior. FW sends misbehaving AP notification in this case.
Add this notification handling. Avoid using uAPSD in next association
to the exactly same AP. Refactor iwl_mvm_power_build_cmd() to move
uAPSD related code to a separate function.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
64b928c4e2898dea07d5850a0708dceeb118fa3b 03-Sep-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add device wide power command

FW starts using legacy power table command (0x77) for device wide power
settings. Currently this command contains only option flags field.
It can configure the following: CAM (Continuous Active Mode) and
POWER_SAVE_ENABLE debug option. Send this command when firmware is
loaded - D0 and D3.
Note: Setting this command is important to avoid unwanted FW behavior.
It particularly fixes a bug when a device does not drop to low power
after disassociation from AP.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
b34b912f2c60e70ce76468d8e8e617cdbc736c94 18-Aug-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Adjust some power management constants

Adjust the following:

- RX/TX AP-to-PSM timeout in case of uAPSD and PBW snoozing
- PSM-to-AM TX/RX heavy traffic thresholds
- Beacon abort escape timer for D3/D0i3

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
01ea748cd5bfb88e2d3eaf2ded0f047d37b11484 30-Aug-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Disable uAPSD for D3 image

The D3 firmware image doesn't support uAPSD, so disable it.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Guy Cohen <guy.cohen@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
89716344806bd49d213ad5960661e8c2d38c4982 04-Aug-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add PBW snoozing enablement

The Performance Based Window snooze mechanism is based on uAPSD and is
used in low-medium traffic scenarios, in order to provide better power
performance while insuring low latency and jitter for the incoming traffic.
This patch enables PBW snoozing in case uAPSD is enabled and all ACs are
uAPSD trigger and delivery enabled.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
a20fd398666dbf5cdee3fe97722350cc10619c84 21-Jul-2013 Andrei Otcheretianski <andrei.otcheretianski@intel.com> iwlwifi: mvm: Implement CQM offloading

Use beacon statistics notification to track RSSI.
Notify mac80211 when the tresholds are crossed.
The roaming treshold is configured to be
equal to cqm_thold. If the beacon filtering command
is not supported by fw fall back and use mac80211
mechanism.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
e3c588ec0d9ef4e52caf0704a007440fb381d97f 07-Apr-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add basic uAPSD client support

Implement basic uAPSD client support adding the following:

- Advertise uAPSD support in HW capabilities
- Set all ACs trigger- and delivery-enabled
- Set max SP length to 2 buffered frames
- Assign QNDP with the highest TID with no mandatory admission
control required
- Set uAPSD related parameters in Power Table command

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8434925f20fbcac3c2699f33f069c8071bad1214 22-Jul-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Change beacon abort escape time value

Set beacon abort escape timer values - 6 beacons in D0 state,
9 beacons in D3 and D0i3.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5dca7c241e92a5c619260ad969b53b2c4849c340 16-Jul-2013 Hila Gonen <hila.gonen@intel.com> iwlwifi: mvm: Change beacon filtering command

Change beacon filtering command due to a change in the API.

In case the FW supports the old API, we do not send the
BF HCMD and assume that since the corresponding struct in
the FW is zeroed by default then we don't need to disable
it in the FW actively.

Signed-off-by: Hila Gonen <hila.gonen@intel.com>
Signed-off-by: Dor Shaish <dor.shaish@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
99545924a10c2c8ee2cc04a0d1be38a4c5b3ef66 14-Jun-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: split constants into separate file

To make maintaining some constant default values in the
driver easier, declare them in a separate file.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
e811ada7a6a3f720c178ba29998ce9f9685f9df3 10-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Upgrade to a new power management uAPSD API

Change power management implementation to support new host-device API
containing uAPSD parameters. Verify FW support for this new API.
Use the new power table command (0xA9) to configure power management.
Use the legacy command (0x77) if FW does not support the new API.
New file power_legacy.c is introduced for legacy implementation.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
bd4ace2a36e7c87bb5f3eceb54d3b304d395dcf0 21-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add support for Low Power RX

To improve power consumption in idle associated mode FW may lower
RX power. This low linearity mode is acceptable for listening low rate
RX such as beacons and groupcast. The driver enables LPRX only if PM
is enabled and associated AP's beacon TX rate is 1Mbps or 6Mbps.
LPRX RSSI threshold is used to limit a range where LPRX is applied.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5ec42ecf497f9c5e55fbe57e894efc5ce91c47cd 27-May-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: enable PM always in unassociated mode

In unassociated BSS STA mode FW verifies both power save and power
management flags to decide on switching power off. The driver currently
sets power management flag according to mac80211 decision. As result, in
unassociated mode power management flag is down and power consumption is
high. Change power management enablement. When unassociated in BPS and
LP power save modes enable power management regardless of mac80211
decision. Rely on mac80211 decision if associated. Add power management
state update during associated/disassociated modes transitions.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4bf881f5d55c2bb704771287613c8807ef181b3c 29-May-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Change location of vif_count verification for PM

Currently vif_count verification for power management enablement appear
in different places. Move these verifications to one place in
iwl_mvm_update_power_mode().

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
b571a69745dc90aec3d0505a7ceac2702a93861b 21-May-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: add debugfs for powersave

Add debugfs files to control powersave parameters for testing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1bd2d1755054c0cc13e2dc7766f2f2ead7d15444 21-May-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Change number of DTIMs to skip semantics

If skip over DTIMs is enabled the driver can specify number of DTIMs
to skip. This parameter in host-device API implies number of DTIM
periods to skip. For example, to skip one DTIM means sleep over two
DTIM periods. Change semantics accordingly. Change this parameter's
default value.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
071d4990fd9fe6fe27b47f1587ba11db3111c3fd 06-May-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add beacon abort enablement

Beacon abort is used by device to increase idle dwell time when system
is idle. This algorithm is on top of beacon filtering feature. Enable
beacon abort only if power management is enabled.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
ee1e84225f779386858702872fb299457e7941f9 23-Apr-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: configure power management in D3

Configure power management in the D3 firmware by sending
the power table command to it when suspending; this uses
some values that are more suitable to a low power state.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5b1dbfc3aa26327dede4cf7a88d7c1e71728e024 23-Apr-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Add number of DTIMs to skip

New host-device API provides the ability to set the number
of DTIMs to skip. Add this parameter to the command and set
it (to a sane default value.)

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7df15b1e6f5994115bee369a527b50ec3521a39b 12-Dec-2012 Hila Gonen <hila.gonen@intel.com> iwlwifi: mvm: Add beacon filtering support

Add iwl_beacon_filter_cmd struct, disable and enable beacon
filtering as needed.

Signed-off-by: Hila Gonen <hila.gonen@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
ade50652fc60314f433c6d28322a605874fb3996 03-Apr-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: remove usage of power_save module parameter

Make power management in MVM driver enabled by default and
remove using the power_save module parameter. Rely only on
the power_scheme parameter to decide if power management
should be used.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
0aed849f61c1235041f98e4178d0a60aaa1dc548 14-Apr-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: change TX/RX AM-to-PSM transition time for LP mode

Recently in low power (LP) mode FW moved from active to power save mode
after TX/RX completion faster than in balanced power mode (BPS).
Change AM-to-PSM transition time so that it will be the same as for BPS.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4d1c4b1a635afa1a67d17efe11600c38fb2806e7 06-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: remove redundant iwl_power_get_params()

The function just wraps an existing one, remove it.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
614ee33632d6def4cbe6aeca5308bae0545778cd 06-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: change active-to-powersave transition time for BPS

The requirement for TX/RX active to powersave transition time for
the Balanced Power Save (BPS) scheme changed. Change the driver
accordingly and set transition time to 100 msec.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3f0b2b3ec84b4e90e6980793fc0dd0ec183aeb60 05-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: encapsulate power table command log message

Encapsulate the power table command logging in a separate
function to print the same information in both cases.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
e16cf7ec6ffbcf96ef3c322b76ff90c2611254d9 05-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: set keepalive period regardless of PM state

The firmware starts sending nulldata frames for keepalive immediately
after association, regardless of power management state. The driver
thus needs to configure keep alive period unconditionally.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9a6130485ec929a97eaef3f55aa40055a9c6b2b3 04-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: always send power table command

The driver distinguishes between power management and device's power
down enablement. Power management enablement depends both on driver's
module power parameters and mac80211 decision. The device's power down
depends only on driver's module power parameters. Change the driver to
always send Power Table command to enable or disable both power
management and device's power down.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7c1bf93fb299b739d2ca145b7f2a129c8d7a84c1 05-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Fix active-to-powersave transition time units

Active to power save mode transition time for TX/RX in the power
table command is in microseconds, fix the units in the driver.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
f4a3e2fefec24c92c803e709b8cf1ef005118b8e 05-Mar-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: Rename some power management definitions and methods

Replace SLEEP_OVER_DTIM by SKIP_OVER_DTIM.
Add iwl_mvm prefix to a function name.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
83bdad52a3430d0f6c35b64012062ffc4e7ceb13 03-Feb-2013 Alexander Bondar <alexander.bondar@intel.com> iwlwifi: mvm: downgrade to old power management API

Current available FW still doesn't support new PM API.
Therefore, to enable basic power management with the
existing firmware, change the API in the driver back
to the API used in the current firmware.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
410dc5aa5906ed49e2733b451a5287884e8a16dc 18-Feb-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: a few fixes in license

7000.c was released as GPL only by mistake: it should be
dual licensed - GPL / BSD.
The file that contains the license in the kernel is COPYING
and not LICENSE.GPL.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5360cfb2bcbdd7a906cf290036bd406985973e88 11-Feb-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: use atomic interface iteration to avoid deadlock

Using the non-atomic version creates a dependency between
mac80211's iflist_mtx and mvm->mutex. Use the atomic version
instead which doesn't take iflist_mtx but can't sleep, so
send the HCMD in ASYNC.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8ca151b568b67a7b72dcfc6ee6ea7c107ddd795c 24-Jan-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: add the MVM driver

Newer firmware revisions have a completely new
firmware API. This is the new driver for this
new API.

I've listed the people who directly contributed
code, but many others from various teams have
contributed in other ways.

Cc: Alexander Bondar <alexander.bondar@intel.com>
Cc: Amit Beka <amit.beka@intel.com>
Cc: Amnon Paz <amnonx.paz@intel.com>
Cc: Assaf Krauss <assaf.krauss@intel.com>
Cc: David Spinadel <david.spinadel@intel.com>
Cc: Dor Shaish <dor.shaish@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Eytan Lifshitz <eytan.lifshitz@intel.com>
Cc: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>