kernel/kernel-generic.git
11 years agomac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates
Karl Beldan [Fri, 5 Apr 2013 10:06:24 +0000 (12:06 +0200)]
mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates

When the 1st rate control entry is a pre-HT rate we want to set
rts_cts_rate_idx "as the fastest basic rate that is not faster than the
data rate"(code comments).
But in case some bss allowed rate indexes are lower than the lowest bss
basic rate, if the rate control selects a rate among the formers for its
1st rate control entry, rts_cts_rate_idx remains 0 and is not a basic
rate index.
This commit sets rts_cts_rate_idx to the lowest bss basic rate index in
this situation.

Note that the code assumes that lowest indexes == lowest bitrates.

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix ieee80211_queue_stopped()
Thomas Pedersen [Wed, 10 Apr 2013 22:41:40 +0000 (15:41 -0700)]
mac80211: fix ieee80211_queue_stopped()

Johannes Berg notes mac80211 drivers which use
ieee80211_queue_stopped() really only want to know if they
previously requested a queue stop.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: provide SSID in IBSS mode
Marek Puzyniak [Wed, 10 Apr 2013 11:19:13 +0000 (13:19 +0200)]
mac80211: provide SSID in IBSS mode

Some drivers need SSID in AP and IBSS mode. AP SSID is provided
through BSS_CHANGED_SSID notification. There was no easy way to
do the same for IBSS. In IBSS mode SSID is known but was not
stored in BSS configuration. Extend the AP-mode functionality
to also work in IBSS mode.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: always advertise STBC/MCSes even if no AP support
Johannes Berg [Sun, 7 Apr 2013 17:32:47 +0000 (19:32 +0200)]
mac80211: always advertise STBC/MCSes even if no AP support

Advertise STBC capabilities and MCS rates even if the AP
doesn't support them. This has always been the right thing
to do, but used to be problematic with some APs. Now WFA
testing requires this so re-enable it, problematic APs
would then presumably not pass the test and be fixed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: clear SSID when stopping AP
Marek Puzyniak [Wed, 10 Apr 2013 11:47:45 +0000 (13:47 +0200)]
mac80211: clear SSID when stopping AP

When AP interface is stopped ssid_len in the BSS configuration
isn't cleared which can confuse drivers when switching modes.
Set the length to zero when stopping the AP interface.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix recalc_radar hwconf sync problem
Simon Wunderlich [Mon, 8 Apr 2013 20:43:16 +0000 (22:43 +0200)]
mac80211: fix recalc_radar hwconf sync problem

local->hw.conf maybe not be synced when recalcing whether radar is
enabled, sometimes leaving radar enabled even if it's not neccesary
anymore.

Fix this by:
 * setting radar_enabled when creating the chanctx
 * turning radar_enabled off before destroying the last channel context

Reported-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: stringify another plink state
Thomas Pedersen [Mon, 8 Apr 2013 18:06:16 +0000 (11:06 -0700)]
mac80211: stringify another plink state

The patch "mac80211: stringify mesh peering events" missed
an opportunity to print the peering state as a string.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: unset FC retry bit in mesh fwding path
Thomas Pedersen [Mon, 8 Apr 2013 18:06:12 +0000 (11:06 -0700)]
mac80211: unset FC retry bit in mesh fwding path

Otherwise forwarded frames would keep the retry bit set
from the previous link transmission.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211_hwsim: Register and bind to driver
Martin Pitt [Mon, 8 Apr 2013 09:30:01 +0000 (11:30 +0200)]
mac80211_hwsim: Register and bind to driver

Properly register our mac80211_hwsim_driver, attach it to the platform bus.
Bind newly created hwsim devices to that driver, so that our wlan devices get
a proper "driver" sysfs attribute.

This makes mac80211_hwsim interfaces work with NetworkManager.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
[fix an old and a new message to not be line-broken,
 also fix the driver_register error path]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: make ieee802_11_parse_elems an inline
Johannes Berg [Wed, 27 Mar 2013 13:55:31 +0000 (14:55 +0100)]
mac80211: make ieee802_11_parse_elems an inline

This (slightly) reduces the code size.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't start new netdev queues if driver stopped
Johannes Berg [Tue, 26 Mar 2013 21:23:20 +0000 (22:23 +0100)]
mac80211: don't start new netdev queues if driver stopped

If a new netdev (e.g. an AP VLAN) is created while the driver
has queues stopped, the new netdev queues will be started even
though they shouldn't. This will lead to frames accumulating
on the internal mac80211 pending queues instead of properly
being held on the netdev queues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: replace some dead code by a warning
Johannes Berg [Tue, 26 Mar 2013 21:10:02 +0000 (22:10 +0100)]
mac80211: replace some dead code by a warning

Given the (nested) switch statements, this code can't
be reached, so make it warn instead of manipulating
the carrier state which seems purposeful.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't fiddle with netdev queues in MLME code
Johannes Berg [Tue, 26 Mar 2013 21:02:42 +0000 (22:02 +0100)]
mac80211: don't fiddle with netdev queues in MLME code

The netdev queues should always represent the state that
the driver gave them, so fiddling with them isn't really
appropriate in the mlme code. Also, since we stop queues
for flushing now, this really isn't necessary any more.

As the scan/offchannel code has also been modified to no
longer do this a while ago, remove the outdated smp_mb()
and comments about it.

While at it, also add a pair of braces that was missing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: disable uAPSD if all ACs are under ACM
Alexander Bondar [Tue, 2 Apr 2013 12:30:14 +0000 (15:30 +0300)]
mac80211: disable uAPSD if all ACs are under ACM

It's unlikely that an AP requires WMM mandatory admission control
for all access categories, and if it does then we still transmit
on the background AC without requesting admission. However, avoid
using uAPSD in this case since the implementation could run into
issues and might use other ACs etc.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix do_stop handling while suspended
Johannes Berg [Wed, 27 Mar 2013 22:24:53 +0000 (23:24 +0100)]
mac80211: fix do_stop handling while suspended

When a device is unplugged while suspended, mac80211 is
de-initialized and all interfaces are removed while no
state is actually present in the driver. This can cause
warnings and driver confusion.

Fix this by reordering the do_stop code to not call the
driver when it is suspended, i.e. when there's no state
in the driver anyway.

The previous patches removed a few corner cases in ROC
and virtual monitor interfaces so that now this is safe
to do and no state should be left over.

Reported-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: destroy virtual monitor interface across suspend
Johannes Berg [Wed, 27 Mar 2013 22:20:27 +0000 (23:20 +0100)]
mac80211: destroy virtual monitor interface across suspend

It has to be removed from the driver, but completely
destroying it helps handle unplug of a device during
suspend since then the channel context handling etc.
doesn't have to happen later when it's removed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: purge remain-on-channel items when suspending
Johannes Berg [Wed, 27 Mar 2013 21:49:19 +0000 (22:49 +0100)]
mac80211: purge remain-on-channel items when suspending

They can't really be executed while suspended and could
trigger work warnings, so abort all ROC items. When the
system resumes the notifications about this will be
delivered to userspace which can then act accordingly
(though it will assume they were canceled/finished.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove outdated comment referring to master interface
Johannes Berg [Wed, 27 Mar 2013 21:40:22 +0000 (22:40 +0100)]
mac80211: remove outdated comment referring to master interface

The code now explicitly calls ieee80211_configure_filter()
anyway, so nothing needs to be explained.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: return new mpath from mesh_path_add()
Bob Copeland [Fri, 29 Mar 2013 13:38:39 +0000 (09:38 -0400)]
mac80211: return new mpath from mesh_path_add()

Most times that mesh_path_add() is called, it is followed by
a lookup to get the just-added mpath.  We can instead just
return the new mpath in the case that we allocated one (or the
existing one if already there), so do that.  Also, reorder the
code in mesh_path_add a bit so that we don't need to allocate
in the pre-existing case.

Signed-off-by: Bob Copeland <bob@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix the PREP mesh hwmp debug message
Chun-Yeow Yeoh [Wed, 3 Apr 2013 09:49:53 +0000 (17:49 +0800)]
mac80211: fix the PREP mesh hwmp debug message

The mesh hwmp debug message is a bit confusing. The "sending PREP
to %p" should be the MAC address of mesh STA that has originated
the PREQ message and the "received PREP from %pM" should be the MAC
address of the mesh STA that has originated the PREP message.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: parse Timeout Interval Element using a struct
Johannes Berg [Wed, 27 Mar 2013 13:38:07 +0000 (14:38 +0100)]
mac80211: parse Timeout Interval Element using a struct

Instead of open-coding the accesses and length check do
the length check in the IE parser and assign a struct
pointer for use in the remaining code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: check ERP info IE length in parser
Johannes Berg [Wed, 27 Mar 2013 13:31:53 +0000 (14:31 +0100)]
mac80211: check ERP info IE length in parser

It's always just one byte, so check for that and
remove the length field from the parser struct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: check DSSS params IE length in parser
Johannes Berg [Wed, 27 Mar 2013 13:30:12 +0000 (14:30 +0100)]
mac80211: check DSSS params IE length in parser

It's always just one byte, so check for that and
remove the length field from the parser struct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove unused IE pointers from parser
Johannes Berg [Wed, 27 Mar 2013 13:27:01 +0000 (14:27 +0100)]
mac80211: remove unused IE pointers from parser

There's no need to parse IEs that aren't used
so just remove them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove ancient reference to master interface
Johannes Berg [Tue, 26 Mar 2013 20:54:24 +0000 (21:54 +0100)]
mac80211: remove ancient reference to master interface

The master interface no longer exists ... and hasn't for
a few years now, so remove this reference :-)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: be more careful about sending beacon-loss-events
Ben Greear [Mon, 25 Mar 2013 18:19:35 +0000 (11:19 -0700)]
mac80211: be more careful about sending beacon-loss-events

I don't think we should send the events unless it was actually
a beacon that was lost...not just any probe of an AP.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add beacon stats to debugfs
Ben Greear [Mon, 25 Mar 2013 18:19:34 +0000 (11:19 -0700)]
mac80211: add beacon stats to debugfs

Beacon-timeout and number of beacon loss events.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211_hwsim: advertise VHT support also when channels == 1
Karl Beldan [Mon, 25 Mar 2013 15:26:59 +0000 (16:26 +0100)]
mac80211_hwsim: advertise VHT support also when channels == 1

Drivers can now advertise VHT support even if they don't use channel
contexts.

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: let drivers not supporting channel contexts use VHT
Karl Beldan [Mon, 25 Mar 2013 15:26:58 +0000 (16:26 +0100)]
mac80211: let drivers not supporting channel contexts use VHT

It is possible since the global hw config and local switched to
cfg80211_chan_def.

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Use a cfg80211_chan_def in ieee80211_hw_conf_chan
Karl Beldan [Mon, 25 Mar 2013 15:26:57 +0000 (16:26 +0100)]
mac80211: Use a cfg80211_chan_def in ieee80211_hw_conf_chan

Drivers that don't use chanctxes cannot perform VHT association because
they still use a "backward compatibility" pair of {ieee80211_channel,
nl80211_channel_type} in ieee80211_conf and ieee80211_local.

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
[fix kernel-doc]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: allow drivers to set default uAPSD parameters
Alexander Bondar [Tue, 22 Jan 2013 14:52:23 +0000 (16:52 +0200)]
mac80211: allow drivers to set default uAPSD parameters

mac80211 currently sets uAPSD parameters to have VO AC trigger-
and delivery-enabled, with maximum service period length.

Allow drivers to change these default settings since different
uAPSD client implementations may handle errors differently and
be able to recover from some errors.

Note: some APs may not function correctly if one or all ACs are
trigger- and delivery-enabled, see
http://thread.gmane.org/gmane.linux.kernel.wireless.general/93577.
We retested with this AP and later firmware doesn't have this
bug any more.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: ibss: use beacon_data struct for beacon and probe response
Johannes Berg [Thu, 7 Mar 2013 19:54:29 +0000 (20:54 +0100)]
mac80211: ibss: use beacon_data struct for beacon and probe response

Instead of having an SKB all the time, use a beacon_data struct
with just the information required. This also allows removing a
synchronize_rcu() and using kfree_rcu() instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: ibss: disable beaconing before freeing beacon
Johannes Berg [Thu, 7 Mar 2013 19:22:28 +0000 (20:22 +0100)]
mac80211: ibss: disable beaconing before freeing beacon

If we don't disable beaconing, the driver might attempt
to continue, but would fail to request a beacon. That's
strange, so disable beaconing first.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: Document update_ft_ies() cfg80211_ops
Jouni Malinen [Mon, 25 Mar 2013 09:15:59 +0000 (11:15 +0200)]
cfg80211: Document update_ft_ies() cfg80211_ops

This was forgotten from the commit that added support for FT
operations with drivers that implement SME.

Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add P2P NoA settings
Janusz Dziedzic [Thu, 21 Mar 2013 14:47:56 +0000 (15:47 +0100)]
mac80211: add P2P NoA settings

Add P2P NoA settings for STA mode.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
[fix docs]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: use ieee80211_p2p_noa_attr structure
Janusz Dziedzic [Thu, 21 Mar 2013 14:47:55 +0000 (15:47 +0100)]
mac80211: use ieee80211_p2p_noa_attr structure

Use ieee80211_p2p_noa_attr structure during
P2P_PS (oppps) detection.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add P2P Notice of Absence attribute
Janusz Dziedzic [Thu, 21 Mar 2013 14:47:54 +0000 (15:47 +0100)]
cfg80211: add P2P Notice of Absence attribute

Add P2P Notice of Absence attribute structure.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: make beacon-loss-count configurable
Ben Greear [Tue, 19 Mar 2013 21:19:56 +0000 (14:19 -0700)]
mac80211: make beacon-loss-count configurable

On loaded systems with lots of VIFs, I see lots of beacon
timeouts, even though the connection to the AP is very
good.  Allow tuning the beacon-loss-count variable to
give the system longer to process beacons if the user
prefers.

Signed-off-by: Ben Greear <greearb@candelatech.com>
[add the number of beacons to the message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: return the RSSI in dBm
Emmanuel Grumbach [Wed, 20 Mar 2013 15:05:45 +0000 (17:05 +0200)]
mac80211: return the RSSI in dBm

For the sake of speed of calculation and number accuracy,
mac80211 tracks the RSSI in dBm * 16. But it forgot to
divide back by 16 when the RSSI is asked by the driver.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix error return code in cfg80211_init()
Wei Yongjun [Wed, 20 Mar 2013 12:22:54 +0000 (20:22 +0800)]
cfg80211: fix error return code in cfg80211_init()

Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix potential connection work crash
Johannes Berg [Wed, 20 Mar 2013 13:05:52 +0000 (14:05 +0100)]
cfg80211: fix potential connection work crash

If wpa_supplicant and iw/iwconfig are used together, very
rarely the system crashes. It seems to be related to the
connection parameters not being set up, but it's not all
clear to me how this happens. In any case, checking that
the conn pointer exists here is probably a good idea.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211_hwsim: assign CAB queue properly on interface type change
Johannes Berg [Mon, 18 Mar 2013 21:13:18 +0000 (22:13 +0100)]
mac80211_hwsim: assign CAB queue properly on interface type change

When an interface change type, the CAB queue must be reassigned,
do this in hwsim to avoid warnings/crashes.

Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: stop queues temporarily for flushing
Johannes Berg [Wed, 13 Feb 2013 11:25:28 +0000 (12:25 +0100)]
mac80211: stop queues temporarily for flushing

Sometimes queues are flushed in the middle of
operation, which can lead to driver issues.
Stop queues temporarily, while flushing, to
avoid transmitting new packets while they are
being flushed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: pass queue bitmap to flush operation
Johannes Berg [Wed, 13 Feb 2013 11:11:00 +0000 (12:11 +0100)]
mac80211: pass queue bitmap to flush operation

There are a number of situations in which mac80211 only
really needs to flush queues for one virtual interface,
and in fact during this frames might be transmitted on
other virtual interfaces. Calculate and pass a queue
bitmap to the driver so it knows which queues to flush.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: do not sample actively used rates
Felix Fietkau [Sat, 16 Mar 2013 16:00:27 +0000 (17:00 +0100)]
mac80211/minstrel_ht: do not sample actively used rates

max_tp_rate2 and max_prob_rate tend to get used occasionally during
retransmission, which is more useful for the statistics than probing
with individual probe packets.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: avoid useless sampling of high-probability slower rates
Felix Fietkau [Sat, 16 Mar 2013 16:00:26 +0000 (17:00 +0100)]
mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates

Slow rates that have >95% success probability do not need to be
monitored continuously. When the channel conditions change rapidly, the
slow sampling results are useless anyway. When conditions change slowly,
they will be monitored by gradual downgrading of the actively used
rates. This patch slightly improves throughput under good conditions.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: improve rate selection stability
Felix Fietkau [Sat, 16 Mar 2013 16:00:25 +0000 (17:00 +0100)]
mac80211/minstrel_ht: improve rate selection stability

Under load, otherwise stable rates can easily fluctuate because of
collisions. In my tests on a clean channel, the success probability of
the max throughput rate often stays somewhere between 90% and 100% under
load. This can cause some unnecessary switching to lower rates.
This patch improves stability by treating success probability values
between 90% and 100% the same.
In my tests on a 3x3 HT20 link with lots of TCP traffic, it improves the
average throughput by a few mbit/s.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove vif debugfs driver callbacks
Stanislaw Gruszka [Fri, 8 Mar 2013 13:46:15 +0000 (14:46 +0100)]
mac80211: remove vif debugfs driver callbacks

This basically reverts commit b207cdb07f3f01ec1adaac62e9d0cc918c60a81a.

Now is possible to use drv_{add,remove}_interface() and vif->debugfs_dir
to create/remove per interface debugfs files. Remove redundant
callbacks.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: move sdata debugfs dir to vif
Stanislaw Gruszka [Fri, 8 Mar 2013 13:46:14 +0000 (14:46 +0100)]
mac80211: move sdata debugfs dir to vif

There is need create driver own per interface debugfs files. This is
currently done by drv_{add,remove}_interface_debugfs() callbacks. But it
is possible that after we remove interface from the driver (i.e.
on suspend) we call drv_remove_interface_debugfs() function. Fixing this
problem will require to add call drv_{add,remove}_interface_debugfs()
anytime we create and remove interface in mac80211. So it's better to
add debugfs dir dentry to vif structure to allow to create/remove
custom debugfs driver files on drv_{add,remove}_interface().

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add driver callback for per-interface multicast filter
Alexander Bondar [Mon, 11 Feb 2013 12:56:29 +0000 (14:56 +0200)]
mac80211: add driver callback for per-interface multicast filter

Some devices have multicast filter capability for each individual
virtual interface rather than just a global one. Add an interface
specific driver callback allowing such drivers to configure this.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove a few set but unused variables
Johannes Berg [Thu, 7 Mar 2013 21:47:00 +0000 (22:47 +0100)]
mac80211: remove a few set but unused variables

Found by compiling with W=1.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: batch key free synchronize_net()
Johannes Berg [Wed, 6 Mar 2013 22:09:11 +0000 (23:09 +0100)]
mac80211: batch key free synchronize_net()

Instead of calling synchronize_net() for every key
on an interface or when a station is removed, do it
only once for all keys in both of these cases.

As a side-effect, removing station keys now always
calls synchronize_net() even if there are no keys,
which fixes an issue with station removal happening
in the driver while the station could still be used
for TX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove underscores from some key functions
Johannes Berg [Wed, 6 Mar 2013 21:58:23 +0000 (22:58 +0100)]
mac80211: remove underscores from some key functions

Some key function don't exist without underscores, so
remove the underscores from those.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: clean up key freeing a bit
Johannes Berg [Wed, 6 Mar 2013 21:53:52 +0000 (22:53 +0100)]
mac80211: clean up key freeing a bit

When a key is allocated but not really added, there's no
need to go through the entire teardown process. Also, if
adding a key fails, ieee80211_key_link() can take care of
freeing it instead of the (only) caller.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Call drv_set_tim only if there is a change
Ilan Peer [Tue, 5 Mar 2013 13:27:20 +0000 (15:27 +0200)]
mac80211: Call drv_set_tim only if there is a change

It is possible that sta_info_recalc_tim() is called consecutively
without changing the station's tim bit. In such cases there is no
need to call the driver's set_tim() callback.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: provide ieee80211_sta_eosp()
Johannes Berg [Fri, 15 Feb 2013 20:38:08 +0000 (21:38 +0100)]
mac80211: provide ieee80211_sta_eosp()

The irqsafe version ieee80211_sta_eosp_irqsafe() exists, but
drivers must not mix calls to any irqsafe/non-irqsafe function.
Both ath9k and iwlwifi, the likely first users of this interface,
use non-irqsafe RX/TX/TX status so must also use a non-irqsafe
version of this function. Since no driver uses the _irqsafe()
version, remove that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: provide race-free 64-bit traffic counters
Johannes Berg [Tue, 5 Feb 2013 09:55:21 +0000 (10:55 +0100)]
mac80211: provide race-free 64-bit traffic counters

Make the TX bytes/packets counters race-free by keeping
them per AC so concurrent TX on queues can't cause lost
or wrong updates. This works since each station belongs
to a single interface. While at it also make the bytes
counters 64-bit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: init mesh timer for user authed STAs
Thomas Pedersen [Sat, 2 Mar 2013 06:02:52 +0000 (22:02 -0800)]
mac80211: init mesh timer for user authed STAs

There is a corner case which wasn't being covered:
userspace may authenticate and allocate stations,
but still leave the peering up to the kernel.

Initialize the peering timer if the MPM is not in
userspace, in a path which is taken by both the kernel and
userspace when allocating stations.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: disallow changing auto_open_plinks
Thomas Pedersen [Mon, 4 Mar 2013 21:06:14 +0000 (13:06 -0800)]
mac80211: disallow changing auto_open_plinks

while user MPM is running.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agonl80211: user_mpm overrides auto_open_plinks
Thomas Pedersen [Mon, 4 Mar 2013 21:06:13 +0000 (13:06 -0800)]
nl80211: user_mpm overrides auto_open_plinks

If the user requested a userspace MPM, automatically
disable auto_open_plinks to fully disable the kernel MPM.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: support userspace MPM
Thomas Pedersen [Mon, 4 Mar 2013 21:06:12 +0000 (13:06 -0800)]
mac80211: support userspace MPM

Earlier mac80211 would check whether some kind of mesh
security was enabled, when the real question was "is the
MPM in userspace"?

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: rename mesh station types
Thomas Pedersen [Mon, 4 Mar 2013 21:06:11 +0000 (13:06 -0800)]
cfg80211: rename mesh station types

The mesh station types used to refer to whether the
station was secure or nonsecure. Really the salient
information is whether it is managed by the kernel or
userspace

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agonl80211: explicit userspace MPM
Thomas Pedersen [Mon, 4 Mar 2013 21:06:10 +0000 (13:06 -0800)]
nl80211: explicit userspace MPM

Secure mesh had the implicit requirement that the Mesh
Peering Management entity be in userspace.  However
userspace might want to implement an open MPM as well, so
specify a mesh setup parameter to indicate this.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: improve minstrels rate sorting by means of throughput & probability
Thomas Huehn [Mon, 4 Mar 2013 22:30:07 +0000 (23:30 +0100)]
mac80211: improve minstrels rate sorting by means of throughput & probability

This patch improves the way minstrel sorts rates according to throughput
and success probability. 3 FOR-loops across the entire rate set in function
minstrel_update_stats() which where used to determine the fastest, second
fastest and most robust rate are reduced to 1 FOR-loop.

The sorted list of rates according throughput is extended to the best four
rates as we need them in upcoming joint rate and power control. The sorting
is done via the new function minstrel_sort_best_tp_rates().

The most robust rate selection is aligned with minstrel_ht's approach.
Once any success probability is above 95% the one with the highest
throughput is chosen as most robust rate. If success probabilities of all
rates are below 95%, the rate with the highest succ. prob. is elected as
most robust one

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: treat minstrel success probabilities below 10% as implausible
Thomas Huehn [Mon, 4 Mar 2013 22:30:06 +0000 (23:30 +0100)]
mac80211: treat minstrel success probabilities below 10% as implausible

Based on minstrel_ht this patch treats success probabilities below 10% as
implausible values for throughput calculation in minstrel's statistics.
Current throughput per rate with such a low success probability is reset
to 0 MBit/s.

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add lowest rate into minstrel's random rate sampling table
Thomas Huehn [Mon, 4 Mar 2013 22:30:05 +0000 (23:30 +0100)]
mac80211: add lowest rate into minstrel's random rate sampling table

While minstrel bootstraps and fills the success probabilities of each
rate the lowest rate has typically a very high success probability
(often 100% in our tests).
Its statistics are never updated but considered to setup the mrr chain.
In our tests we see that especially the 3rd mrr stage (which is that
rate providing highest success probability) is filled with the lowest rate
because its initial high sucess probability is never updated. By design
the 4th mrr stage is filled with the lowest rate so often 3rd and 4th
mrr stage are equal.

This patch follows minstrels general approach of assuming as little
as possible about rate dependencies. Consequently we include the
lowest rate into the random sampling table to get balanced up-to-date
statistics of all rates and therefore balanced decisions.

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: extend minstrel's rate sampling to avoid unsampled rates
Thomas Huehn [Mon, 4 Mar 2013 22:30:04 +0000 (23:30 +0100)]
mac80211: extend minstrel's rate sampling to avoid unsampled rates

Minstrel's decision which rate should be directly sampled within the
1st mrr stage is limited to such rates faster than the current max
throughput rate. All rates below the current max. throughput rate
are indirectly sampled via the 2nd mrr stage.
This approach leads to deprecated per rate statistics and therfore
a deprecated mrr chain setup.

This patch uses the sampling approach from minstrel_ht. A counter is
added to sum all indirect sample attempts per rate. After 20 indirect
sampling attempts the rate is directly sampled within the 1st mrr stage.
Therefore more up-to-date statistics for all rates are maintained and
used to setup the mrr chain.

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add documentation and verbose variable names in
Thomas Huehn [Mon, 4 Mar 2013 22:30:03 +0000 (23:30 +0100)]
mac80211: add documentation and verbose variable names in

Add documentation and more verbose variable names to minstrel's
multi-rate-retry setup within function minstrel_get_rate() to
increase the readability of the algorithm.

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: merge value scaling macros of minstrel_ht and minstrel
Thomas Huehn [Mon, 4 Mar 2013 22:30:02 +0000 (23:30 +0100)]
mac80211: merge value scaling macros of minstrel_ht and minstrel

Both minstrel versions use individual ways to scale up integer values
to perform calculations. Merge minstrel_ht's scaling macros into
minstrels header file and use them in both minstrel versions.

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: merge EWMA calculation of minstrel_ht and minstrel
Thomas Huehn [Mon, 4 Mar 2013 22:30:01 +0000 (23:30 +0100)]
mac80211: merge EWMA calculation of minstrel_ht and minstrel

Both rate control algorithms (minstrel and minstrel_ht) calculate
averages based on EWMA. Shift function minstrel_ewma() into
rc80211_minstrel.h and make use of it in both minstrel version.
Also shift the default EWMA level (75%) definition to the header file
and clean up variable usage.

Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: disable multiple consecutive sample attempts
Felix Fietkau [Tue, 5 Mar 2013 13:20:19 +0000 (14:20 +0100)]
mac80211/minstrel_ht: disable multiple consecutive sample attempts

The last minstrel_ht changes increased the sampling frequency for
potentially useful rates to decrease the response time to rate
fluctuations. This caused an increase in sampling frequency that can
slightly reduce throughput, so this patch limits the sampling attempts
to one per rate instead of two.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: allow VHT channels in world roaming
Johannes Berg [Mon, 3 Dec 2012 21:09:22 +0000 (22:09 +0100)]
regulatory: allow VHT channels in world roaming

For VHT, the wider bandwidths (up to 160 MHz) need
to be allowed. Since world roaming only covers the
case of connecting to an AP, it can be opened up
there, we will rely on the AP to know the local
regulations.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: enable TDLS on P2P client interfaces
Johannes Berg [Mon, 4 Mar 2013 08:29:46 +0000 (09:29 +0100)]
cfg80211: enable TDLS on P2P client interfaces

There's no reason TDLS should be prevented on P2P client
interfaces, and most of the code already handles it, so
allow adding stations for it.

Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add VHT capabilities station debugfs file
Johannes Berg [Fri, 1 Mar 2013 12:36:24 +0000 (13:36 +0100)]
mac80211: add VHT capabilities station debugfs file

Add a new debugfs file to view a station's VHT capabilities.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: restrict peer's VHT capabilities to own
Johannes Berg [Fri, 1 Mar 2013 12:07:48 +0000 (13:07 +0100)]
mac80211: restrict peer's VHT capabilities to own

Implement restricting peer VHT capabilities to the device's own
capabilities. This is useful when a single driver supports more
than one device and the devices have different capabilities
(often they will differ in the number of spatial streams), but
in particular is also necessary for VHT capability overrides to
work correctly -- otherwise it'd be possible to e.g. advertise,
due to overrides, that TX-STBC is not supported, but then still
use it to TX to the AP because it supports RX-STBC.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix HT capability overrides for AP station
Johannes Berg [Fri, 1 Mar 2013 10:54:43 +0000 (11:54 +0100)]
mac80211: fix HT capability overrides for AP station

HT capabilites are asymmetric -- e.g. beamforming is both an
RX and TX capability. If, for example, we support RX but not
TX, the RX capability of the AP station is masked out (if it
supports it). This works correctly if it's really the driver
capability.

If, on the other hand, the reason for not supporting TX BF
is that it was removed by HT capability overrides then the
wrong thing happens: the AP's TX capability will be removed
rather than its RX capability, because the override function
works on own capabilities, not remote ones, and doesn't take
the asymmetry into account.

To fix this make a copy of our own capabilities, apply the
overrides to them (where needed) and then use that to set up
the peer's capabilities.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't apply HT overrides to TDLS peers
Johannes Berg [Fri, 1 Mar 2013 10:43:30 +0000 (11:43 +0100)]
mac80211: don't apply HT overrides to TDLS peers

The HT overrides are intended only for the connection
to the AP, not for any other purpose. Therefore, don't
apply them to TDLS peers that are also stations added
to a managed station interface.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: simplify AP interface stop
Johannes Berg [Sat, 23 Feb 2013 00:17:56 +0000 (01:17 +0100)]
mac80211: simplify AP interface stop

For AP interfaces, there's no need to flush stations
or keys again when the interface is stopped as already
happened when the BSS was stopped on the interface.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: flush keys when stopping AP
Johannes Berg [Sat, 23 Feb 2013 00:14:20 +0000 (01:14 +0100)]
mac80211: flush keys when stopping AP

Since hostapd will remove keys this isn't usually
an issue, but we shouldn't leak keys to the next
BSS started on the same interface. For VLANs this
also fixes a bug, keys that aren't removed would
otherwise be leaked.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: defer tailroom counter manipulation when roaming
Johannes Berg [Fri, 22 Feb 2013 23:59:03 +0000 (00:59 +0100)]
mac80211: defer tailroom counter manipulation when roaming

During roaming, the crypto_tx_tailroom_needed_cnt counter
will often take values 2,1,0,1,2 because first keys are
removed and then new keys are added. This is inefficient
because during the 0->1 transition, synchronize_net must
be called to avoid packet races, although typically no
packets would be flowing during that time.

To avoid that, defer the decrement (2->1, 1->0) when keys
are removed (by half a second). This means the counter
will really have the values 2,2,2,3,4 ... 2, thus never
reaching 0 and having to do the 0->1 transition.

Note that this patch entirely disregards the drivers for
which this optimisation was done to start with, for them
the key removal itself will be expensive because it has
to synchronize_net() after the counter is incremented to
remove the key from HW crypto. For them the sequence will
look like this: 0,1,0,1,0,1,0,1,0 (*) which is clearly a
lot more inefficient. This could be addressed separately,
during key removal the 0->1->0 sequence isn't necessary.

(*) it starts at 0 because HW crypto is on, then goes to
    1 when HW crypto is disabled for a key, then back to
    0 because the key is deleted; this happens for both
    keys in the example. When new keys are added, it goes
    to 1 first because they're added in software; when a
    key is moved to hardware it goes back to 0

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove IEEE80211_KEY_FLAG_WMM_STA
Johannes Berg [Fri, 22 Feb 2013 23:22:44 +0000 (00:22 +0100)]
mac80211: remove IEEE80211_KEY_FLAG_WMM_STA

There's no driver using this flag, so it seems
that all drivers support HW crypto with WMM or
don't support it at all. Remove the flag and
code setting it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: merge reconfig assign chanctx code
Stanislaw Gruszka [Thu, 28 Feb 2013 09:55:30 +0000 (10:55 +0100)]
mac80211: merge reconfig assign chanctx code

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: cleanup suspend/resume on mesh mode
Stanislaw Gruszka [Thu, 28 Feb 2013 09:55:29 +0000 (10:55 +0100)]
mac80211: cleanup suspend/resume on mesh mode

Remove not used any longer suspend/resume code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: cleanup suspend/resume on ibss mode
Stanislaw Gruszka [Thu, 28 Feb 2013 09:55:28 +0000 (10:55 +0100)]
mac80211: cleanup suspend/resume on ibss mode

Remove not used any longer suspend/resume code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: cleanup suspend/resume on managed mode
Stanislaw Gruszka [Thu, 28 Feb 2013 09:55:27 +0000 (10:55 +0100)]
mac80211: cleanup suspend/resume on managed mode

Remove not used any longer suspend/resume code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: cleanup generic suspend/resume procedures
Stanislaw Gruszka [Thu, 28 Feb 2013 09:55:26 +0000 (10:55 +0100)]
mac80211: cleanup generic suspend/resume procedures

Since now we disconnect before suspend, various code which save
connection state can now be removed from suspend and resume
procedure. Cleanup on resume side is smaller as ieee80211_reconfig()
is also used for H/W restart.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211/mac80211: disconnect on suspend
Stanislaw Gruszka [Thu, 28 Feb 2013 09:55:25 +0000 (10:55 +0100)]
cfg80211/mac80211: disconnect on suspend

If possible that after suspend, cfg80211 will receive request to
disconnect what require action on interface that was removed during
suspend.

Problem can manifest itself by various warnings similar to below one:

WARNING: at net/mac80211/driver-ops.h:12 ieee80211_bss_info_change_notify+0x2f9/0x300 [mac80211]()
wlan0:  Failed check-sdata-in-driver check, flags: 0x4
Call Trace:
 [<c043e0b3>] warn_slowpath_fmt+0x33/0x40
 [<f83707c9>] ieee80211_bss_info_change_notify+0x2f9/0x300 [mac80211]
 [<f83a660a>] ieee80211_recalc_ps_vif+0x2a/0x30 [mac80211]
 [<f83a6706>] ieee80211_set_disassoc+0xf6/0x500 [mac80211]
 [<f83a9441>] ieee80211_mgd_deauth+0x1f1/0x280 [mac80211]
 [<f8381b36>] ieee80211_deauth+0x16/0x20 [mac80211]
 [<f8261e70>] cfg80211_mlme_down+0x70/0xc0 [cfg80211]
 [<f8264de1>] __cfg80211_disconnect+0x1b1/0x1d0 [cfg80211]

To fix the problem disconnect from any associated network before
suspend. User space is responsible to establish connection again
after resume. This basically need to be done by user space anyway,
because associated stations can go away during suspend (for example
NetworkManager disconnects on suspend and connect on resume by default).

Patch also handle situation when driver refuse to suspend with wowlan
configured and try to suspend again without it.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove napi
Stanislaw Gruszka [Thu, 28 Feb 2013 08:49:11 +0000 (09:49 +0100)]
mac80211: remove napi

Since two years no mac80211 driver implement support for NAPI. Looks
this feature is unneeded, so remove it from generic mac80211 code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: fix spacing between sample attempts
Felix Fietkau [Sun, 3 Mar 2013 11:49:52 +0000 (12:49 +0100)]
mac80211/minstrel_ht: fix spacing between sample attempts

A sample attempt should only count in mi->sample_tries if the sample
attempt wasn't skipped based on slower rate criteria.
This patch increases the sampling frequency for potentially desirable
rates and thus enables faster recovery from interference or collisions.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: increase sampling frequency of some slower rates
Felix Fietkau [Sun, 3 Mar 2013 11:49:51 +0000 (12:49 +0100)]
mac80211/minstrel_ht: increase sampling frequency of some slower rates

If a rate is below the max_tp_rate, sample it frequently if:
- it is above max_tp_rate2, or
- it is above max_prob_rate and is a candidate for max_prob_rate
  (has fewer streams than max_tp_rate).
This helps the retry chain recover more quickly from bad statistics
caused by collisions or interference, and slightly reduces throughput
fluctuations with higher rates.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agominstrel_ht: increase sampling frequency
Felix Fietkau [Sat, 2 Mar 2013 20:20:14 +0000 (21:20 +0100)]
minstrel_ht: increase sampling frequency

Try to sample all available rates, as sample attempts do not cost much
airtime and are appropriately spaced based on the average A-MPDU length.
This helps with faster recovery on rate fluctuations.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: improve max_prob_rate selection
Felix Fietkau [Sat, 2 Mar 2013 20:20:13 +0000 (21:20 +0100)]
mac80211/minstrel_ht: improve max_prob_rate selection

max_prob_rate should be selected to be very reliable, however limiting
it to single-stream on 3-stream devices is a bit much.
Allow max_prob_rate to use one stream less than the max_tp_rate.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211/minstrel_ht: improve accuracy of throughput metric at high data rates
Felix Fietkau [Sat, 2 Mar 2013 20:20:12 +0000 (21:20 +0100)]
mac80211/minstrel_ht: improve accuracy of throughput metric at high data rates

At high data rates the average frame transmission durations are small
enough for rounding errors to matter, sometimes causing minstrel to use
slightly lower transmit rates than necessary.
To fix this, change the unit of the duration value to nanoseconds
instead of microseconds, and reorder the multiplications/divisions when
calculating the throughput metric so that they don't overflow or
truncate prematurely.
At 2-stream HT40 this makes TCP throughput a bit more stable.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: Extend support for IEEE 802.11r Fast BSS Transition
Jouni Malinen [Wed, 27 Feb 2013 15:14:27 +0000 (17:14 +0200)]
cfg80211: Extend support for IEEE 802.11r Fast BSS Transition

Add NL80211_CMD_UPDATE_FT_IES to support update of FT IEs to the WLAN
driver and NL80211_CMD_FT_EVENT to send FT events from the WLAN driver.
This will carry the target AP's MAC address along with the relevant
Information Elements. This event is used to report received FT IEs
(MDIE, FTIE, RSN IE, TIE, RICIE). These changes allow FT to be supported
with drivers that use an internal SME instead of user space option (like
FT implementation in wpa_supplicant with mac80211-based drivers).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: prohibit zero keepalive interval
Johannes Berg [Tue, 26 Feb 2013 12:56:40 +0000 (13:56 +0100)]
cfg80211: prohibit zero keepalive interval

It's not useful to specify a 0 keepalive interval, this
would send too much data. Prohibit this to also avoid
device issues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Allow drivers to differentiate between ROC types
Ilan Peer [Tue, 12 Feb 2013 07:34:13 +0000 (09:34 +0200)]
mac80211: Allow drivers to differentiate between ROC types

Some devices can handle remain on channel requests differently
based on the request type/priority. Add support to
differentiate between different ROC types, i.e., indicate that
the ROC is required for sending managment frames.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: refactor association parameters
Johannes Berg [Thu, 21 Feb 2013 19:09:09 +0000 (20:09 +0100)]
cfg80211: refactor association parameters

cfg80211_mlme_assoc() has grown far too many arguments,
make the caller build almost all of the driver struct
and pass that to the function instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: support VHT capability overrides
Johannes Berg [Thu, 21 Feb 2013 16:40:19 +0000 (17:40 +0100)]
mac80211: support VHT capability overrides

Support the cfg80211 API to override VHT capabilities
on association.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add ability to override VHT capabilities
Johannes Berg [Thu, 21 Feb 2013 16:36:01 +0000 (17:36 +0100)]
cfg80211: add ability to override VHT capabilities

For testing it's sometimes useful to be able to
override certain VHT capability advertisement,
add the ability to do that in cfg80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: remove unused VHT MCS defines
Johannes Berg [Thu, 21 Feb 2013 16:26:44 +0000 (17:26 +0100)]
wireless: remove unused VHT MCS defines

There's an enum with the same values (but slightly
different names except for NOT_SUPPORTED) that is
actually used, so remove the defines.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>