openwrt/staging/blogic.git
11 years agowext: explicitly cast -110 to u8
Johannes Berg [Fri, 7 Dec 2012 10:58:26 +0000 (11:58 +0100)]
wext: explicitly cast -110 to u8

This doesn't generate any different code, but will
suppress a spurious smatch warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: warn only once if ampdu_action isn't assigned
Chaitanya [Fri, 7 Dec 2012 06:49:34 +0000 (12:19 +0530)]
mac80211: warn only once if ampdu_action isn't assigned

New drivers that might not support ampdu_action yet while in
development cause a lot of warnings, use WARN_ON_ONCE instead.

Signed-off-by: T Krushna Chaitanya <chaitanyatk@posedge.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: cancel work instead of waiting for it to do nothing
Johannes Berg [Wed, 5 Dec 2012 08:49:14 +0000 (09:49 +0100)]
mac80211: cancel work instead of waiting for it to do nothing

If the sdata work is pending while the interface is stopped,
we currently flush it. If it's not running this means waiting
for it to run, which could take a while if the workqueue is
backlogged. However, the work exits right away if it starts
to run while the interface is already stopping. There's no
point in waiting for that, so use cancel_work_sync() instead.

Reported-by: Ben Greear <greearb@candelatech.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: fix VHT max AMPDU exponent definition
Johannes Berg [Wed, 5 Dec 2012 15:45:31 +0000 (16:45 +0100)]
wireless: fix VHT max AMPDU exponent definition

This is really a 3-bit field, not a single bit,
so declare a mask and shift. Also fix hwsim, it
advertises the maximum possible.

While at it reindent all the defines using tabs
instead of spaces.

Change-Id: I7cd81c0d72f76deb5010aba5bfa3dd312006e898
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't drop mesh peering frames from unknown STA
Marco Porsch [Wed, 5 Dec 2012 23:04:26 +0000 (15:04 -0800)]
mac80211: don't drop mesh peering frames from unknown STA

Previously, mesh peering frames from a STA without a station
entry were being dropped.

Mesh Peering Open and other frames (WLAN_CATEGORY_SELF_PROTECTED)
are valid mesh peering frames even if received from a yet unknown
station; the STA entry will be created in mesh_peer_init later.

The problem didn't occur previously since both STAs receive each
other's beacons which created the STA entry. However, this causes
an unnecessary delay and beacons might not be received if either
node is in PS mode.

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
[reword commit log a bit]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: skip radiotap space calculation if no monitor exists
Helmut Schaa [Wed, 5 Dec 2012 13:36:12 +0000 (14:36 +0100)]
mac80211: skip radiotap space calculation if no monitor exists

The radiotap header length "needed_headroom" is only required if we're
sending the skb to a monitor interface. Hence, move the calculation a
bit later so the calculation can be skipped if no monitor interface is
present.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoRevert: "rt2x00: Don't let mac80211 send a BAR when an AMPDU subframe fails"
Stanislaw Gruszka [Mon, 3 Dec 2012 11:59:04 +0000 (12:59 +0100)]
Revert: "rt2x00: Don't let mac80211 send a BAR when an AMPDU subframe fails"

This revert:

commit be03d4a45c09ee5100d3aaaedd087f19bc20d01f
Author: Andreas Hartmann <andihartmann@01019freenet.de>
Date:   Tue Apr 17 00:25:28 2012 +0200

    rt2x00: Don't let mac80211 send a BAR when an AMPDU subframe fails

To fix problem workaround by above commit use
IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL flag (see change log for
"mac80211: introduce IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL" patch).

Resolve: https://bugzilla.kernel.org/show_bug.cgi?id=42828
Bisected-by: Francisco Pina Martins <f.pinamartins@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: introduce IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL
Stanislaw Gruszka [Mon, 3 Dec 2012 11:56:33 +0000 (12:56 +0100)]
mac80211: introduce IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL

Commit f0425beda4d404a6e751439b562100b902ba9c98 "mac80211: retry sending
failed BAR frames later instead of tearing down aggr" caused regression
on rt2x00 hardware (connection hangs). This regression was fixed by
commit be03d4a45c09ee5100d3aaaedd087f19bc20d01 "rt2x00: Don't let
mac80211 send a BAR when an AMPDU subframe fails". But the latter
commit caused yet another problem reported in
https://bugzilla.kernel.org/show_bug.cgi?id=42828#c22

After long discussion in this thread:
http://mid.gmane.org/20121018075615.GA18212@redhat.com
and testing various alternative solutions, which failed on one or other
setup, we have no other good fix for the issues like just revert both
mentioned earlier commits.

To do not affect other hardware which benefit from commit
f0425beda4d404a6e751439b562100b902ba9c98, instead of reverting it,
introduce flag that when used will restore mac80211 behaviour before
the commit.

Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
[replaced link with mid.gmane.org that has message-id]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add debug file for mic failure
Saravana [Tue, 4 Dec 2012 14:17:42 +0000 (19:47 +0530)]
mac80211: add debug file for mic failure

The mic failure count provides the number of mic failures that
have happened on a given key (without a countermeasure being
started, since that would remove the key).

Signed-off-by: Saravana <saravanad@posedge.com>
[fix NULL pointer issues]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: check no-OFDM flag for channels wider than 20 MHz
Johannes Berg [Tue, 4 Dec 2012 19:49:42 +0000 (20:49 +0100)]
cfg80211: check no-OFDM flag for channels wider than 20 MHz

For channels wider than 20 MHz OFDM will be used, so when
checking whether or not a channel is usable, check for the
no-OFDM flag if the channel is wider than 20 MHz.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: adapt slot time in IBSS mode
Simon Wunderlich [Mon, 3 Dec 2012 21:21:30 +0000 (22:21 +0100)]
mac80211: adapt slot time in IBSS mode

In 5GHz/802.11a, we are allowed to use short slot times. Doing this
may increases performance by 20% for legacy connections (54 MBit/s).
I can confirm this in my tests (27% more throughput using iperf), and
also have a small positive effect (5% more throughput) for HT rates,
tested on 1 stream.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix channel error on mesh join
Marco Porsch [Mon, 3 Dec 2012 10:23:37 +0000 (11:23 +0100)]
cfg80211: fix channel error on mesh join

Fix an error on mesh join when no channel has been
explicitly set beforehand.

Also remove a double semicolon.

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: return if CSA is not handle
Simon Wunderlich [Fri, 30 Nov 2012 18:17:27 +0000 (19:17 +0100)]
mac80211: return if CSA is not handle

If channel contexts are enabled, the CSA should not be processed
further. A return is missing here.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Fix typo in mac80211.h
Simon Wunderlich [Fri, 30 Nov 2012 18:17:28 +0000 (19:17 +0100)]
mac80211: Fix typo in mac80211.h

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: simplify loop in minstrel_ht
Johannes Berg [Tue, 13 Nov 2012 20:36:27 +0000 (21:36 +0100)]
mac80211: simplify loop in minstrel_ht

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix BSS struct IE access races
Johannes Berg [Thu, 29 Nov 2012 00:25:20 +0000 (01:25 +0100)]
cfg80211: fix BSS struct IE access races

When a BSS struct is updated, the IEs are currently
overwritten or freed. This can lead to races if some
other CPU is accessing the BSS struct and using the
IEs concurrently.

Fix this by always allocating the IEs in a new struct
that holds the data and length and protecting access
to this new struct with RCU.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove probe response temporary buffer allocation
Johannes Berg [Thu, 29 Nov 2012 12:00:10 +0000 (13:00 +0100)]
mac80211: remove probe response temporary buffer allocation

Instead of allocating a temporary buffer to build IEs
build them right into the SKB.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: make ieee80211_build_preq_ies safer
Johannes Berg [Thu, 29 Nov 2012 11:45:18 +0000 (12:45 +0100)]
mac80211: make ieee80211_build_preq_ies safer

Instead of assuming 200 bytes are always enough for
all the IEs we add, give the length of the buffer
to the function and warn instead of overrunning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix cmp_hidden_bss
Johannes Berg [Wed, 28 Nov 2012 21:42:34 +0000 (22:42 +0100)]
cfg80211: fix cmp_hidden_bss

The cmp_bss() comparator function uses memcmp() to
compare the SSID. This means that cmp_hidden_bss()
needs to similarly return a number bigger than zero
(use 1) instead of -1 when ie1 is bigger than ie2,
which is the case if an ie2 byte is non-zero.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix whitespace in scan handling
Johannes Berg [Wed, 28 Nov 2012 21:39:37 +0000 (22:39 +0100)]
cfg80211: fix whitespace in scan handling

Fix a number of indentation and similar issues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: don't BUG_ON BSS struct issues
Johannes Berg [Wed, 28 Nov 2012 21:14:56 +0000 (22:14 +0100)]
cfg80211: don't BUG_ON BSS struct issues

There's no need to stop the machine, just leak
the BSS entry if there's an issue with its hold
counter when freeing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: allow userspace registration for probe requests in IBSS
Antonio Quartulli [Thu, 29 Nov 2012 23:18:12 +0000 (00:18 +0100)]
mac80211: allow userspace registration for probe requests in IBSS

This change allows userspace to register for probe request
frames on an IBSS interface. Userspace then has to handle
them and send replies.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix for mesh sync to indicate TBTT adjustment
Marco Porsch [Fri, 23 Nov 2012 20:23:18 +0000 (12:23 -0800)]
mac80211: fix for mesh sync to indicate TBTT adjustment

Currently the mesh sync code checks, whether peers indicate TBTT adjustment,
but it never sets the corresponding flag itself.

By setting ifmsh->tbtt_adjusting to true, it will set the corresponding field
in the mesh configuration IE of own beacons.
This indication will be set in the current beacon. The TBTT adjustment will be
performed afterwards, affecting the next beacon. Thus, the first beacon with
stable TBTT will not indicate adjustment anymore and peers will continue
tracking the new offset.

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agonl80211: Fix HT_IBSS feature check in ibss_join
Simon Wunderlich [Thu, 29 Nov 2012 17:37:22 +0000 (18:37 +0100)]
nl80211: Fix HT_IBSS feature check in ibss_join

There is a standalone if, seems to be a regression of commit
"nl80211/cfg80211: add VHT MCS support".

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add debugfs file for last rx rate
Saravana [Thu, 29 Nov 2012 14:24:19 +0000 (19:54 +0530)]
mac80211: add debugfs file for last rx rate

Add a debugfs file showing the rate at which
the last packet is received.

Signed-off-by: Saravana <saravanad@posedge.com>
[fix whitespace]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: re-organize the rx rate calculation logic
Saravana [Wed, 28 Nov 2012 12:59:38 +0000 (18:29 +0530)]
mac80211: re-organize the rx rate calculation logic

Currently the logic to fill a struct rate_info with
a STA's last RX rate is accessible only in the cfg.c.
As the RX rate calculation might be needed elsewhere,
split this out into a separate function.

Signed-off-by: Saravana <saravanad@posedge.com>
[fix various whitespace issues, reword commit log]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add debugfs file for current tx rate
Saravana [Thu, 29 Nov 2012 13:52:37 +0000 (19:22 +0530)]
mac80211: add debugfs file for current tx rate

Add a debugfs file showing the current tx rate.
The information available in the rc_stats file
doesn't evidently provides us the current tx rate.
This patch adds the support for the same.

Signed-off-by: Saravana <saravanad@posedge.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add debugfs file for last ack signal
Saravana [Wed, 28 Nov 2012 12:57:09 +0000 (18:27 +0530)]
mac80211: add debugfs file for last ack signal

Add a debugfs file showing the signal strength
of the ack frame that is received for the
currently sent tx packet

Signed-off-by: Saravana <saravanad@posedge.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: Remove unused VHT chan code
Mahesh Palivela [Thu, 29 Nov 2012 08:41:07 +0000 (14:11 +0530)]
cfg80211: Remove unused VHT chan code

Cleanup of unused VHT channel config related code.

Signed-off-by: Mahesh Palivela <maheshp@posedge.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't reinit rate control when mesh sta exists
Helmut Schaa [Tue, 27 Nov 2012 17:03:13 +0000 (18:03 +0100)]
mac80211: don't reinit rate control when mesh sta exists

This fixes some unintended resets of the rate control statistics
when minstrel_ht is used resulting in non-optimal throughput on mesh
links.

Tested-by: Emanuel Taube <emanuel.taube@gmail.com>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: reject setting masked mac addresses
Helmut Schaa [Tue, 27 Nov 2012 17:23:06 +0000 (18:23 +0100)]
mac80211: reject setting masked mac addresses

If a driver registers an address mask we should ensure that no
interface gets an address assigned that isn't covered by the
registered address mask. This prevents invalid configurations
from reaching the device and causing problems.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
[change function flow to reduce indentation, fix locking]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix potential NULL dereference
Dan Carpenter [Tue, 27 Nov 2012 17:31:19 +0000 (20:31 +0300)]
mac80211: fix potential NULL dereference

Smatch complains that we could dereference skb later in the function.
It's probably unlikely, but we may as well return here and avoid it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[change summary]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agonl80211: remove unnecessary checks
Johannes Berg [Mon, 26 Nov 2012 11:51:52 +0000 (12:51 +0100)]
nl80211: remove unnecessary checks

The CQM TX-error rate/interval can't be less than
zero since they're unsigned values, remove checks.
Also fix indentation of the function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support P2P GO powersave configuration
Johannes Berg [Wed, 14 Nov 2012 14:21:17 +0000 (15:21 +0100)]
mac80211: support P2P GO powersave configuration

If the low-level driver wants to support P2P GO
powersave configuration, it must set the cfg80211
flags and mac80211 will pass the parameters to it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211: support P2P GO powersave configuration
Johannes Berg [Wed, 14 Nov 2012 14:17:28 +0000 (15:17 +0100)]
nl80211: support P2P GO powersave configuration

If a driver supports P2P GO powersave, allow it to
set the new feature flags for it and allow userspace
to configure the parameters for it. This can be done
at GO startup and later changed with SET_BSS.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support (partial) VHT radiotap information
Johannes Berg [Thu, 22 Nov 2012 22:00:18 +0000 (23:00 +0100)]
mac80211: support (partial) VHT radiotap information

Add some information that we have about VHT to radiotap.
This at least lets one see the MCS and NSS information.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support VHT association
Johannes Berg [Thu, 22 Nov 2012 13:11:39 +0000 (14:11 +0100)]
mac80211: support VHT association

Determine the VHT channel from the AP's VHT operation IE
(if present) and configure the hardware to that channel
if it is supported. If channel contexts cause a channel
to not be usable, try a smaller bandwidth.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: rework chandef checking and export it
Johannes Berg [Thu, 22 Nov 2012 15:59:45 +0000 (16:59 +0100)]
cfg80211: rework chandef checking and export it

Some of the chandef checking that we do in cfg80211
to check if a channel is supported or not is also
needed in mac80211, so rework that a bit and export
the functions that are needed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: fix some tracing output issues
Johannes Berg [Fri, 16 Nov 2012 16:22:28 +0000 (17:22 +0100)]
cfg80211: fix some tracing output issues

In some cases, e.g. probe_status, there were spaces
missing so the trace output was confusing. Also make
it more like mac80211 when printing netdevs/wiphys
to make reading a combined log easier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211_hwsim: remove printing scan config
Johannes Berg [Tue, 20 Nov 2012 16:34:10 +0000 (17:34 +0100)]
mac80211_hwsim: remove printing scan config

The frequencies will be printed when actually
doing the scan, and the IEs can be captured
on the hwsim0 monitor.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211_hwsim: advertise VHT support
Johannes Berg [Mon, 12 Nov 2012 10:51:50 +0000 (11:51 +0100)]
mac80211_hwsim: advertise VHT support

If the number of channels is > 1, which means that
hwsim will use mac80211 channel contexts, it can
also advertise VHT support.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agowireless: add definitions for VHT MCS support
Johannes Berg [Mon, 12 Nov 2012 10:44:18 +0000 (11:44 +0100)]
wireless: add definitions for VHT MCS support

Add definitions for the VHT MCS support values that
are used to indicate, for each number of streams
(1 through 8) which MCSes are supported.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support VHT rates in TX info
Johannes Berg [Fri, 9 Nov 2012 17:38:32 +0000 (18:38 +0100)]
mac80211: support VHT rates in TX info

To achieve this, limit the number of retries to
31 (instead of 255) and use the three bits that
are then free for VHT flags.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support drivers reporting VHT RX
Johannes Berg [Fri, 9 Nov 2012 14:07:02 +0000 (15:07 +0100)]
mac80211: support drivers reporting VHT RX

Add support to mac80211 for having drivers report
received VHT MCS information.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211/cfg80211: add VHT MCS support
Johannes Berg [Fri, 9 Nov 2012 13:56:41 +0000 (14:56 +0100)]
nl80211/cfg80211: add VHT MCS support

Add support for reporting and calculating VHT MCSes.

Note that I'm not completely sure that the bitrate
calculations are correct, nor that they can't be
simplified.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: convert to channel definition struct
Johannes Berg [Fri, 9 Nov 2012 10:39:59 +0000 (11:39 +0100)]
mac80211: convert to channel definition struct

Convert mac80211 (and where necessary, some drivers a
little bit) to the new channel definition struct.

This will allow extending mac80211 for VHT, which is
currently restricted to channel contexts since there
are no drivers using that which makes it easier. As
I also don't care about VHT for drivers not using the
channel context API, I won't convert the previous API
to VHT support.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211/cfg80211: support VHT channel configuration
Johannes Berg [Thu, 8 Nov 2012 22:14:50 +0000 (23:14 +0100)]
nl80211/cfg80211: support VHT channel configuration

Change nl80211 to support specifying a VHT (or HT)
using the control channel frequency (as before) and
new attributes for the channel width and first and
second center frequency. The old channel type is of
course still supported for HT.

Also change the cfg80211 channel definition struct
to support these by adding the relevant fields to
it (and removing the _type field.)

This also adds new helper functions:
 - cfg80211_chandef_create to create a channel def
   struct given the control channel and channel type,
 - cfg80211_chandef_identical to check if two channel
   definitions are identical
 - cfg80211_chandef_compatible to check if the given
   channel definitions are compatible, and return the
   wider of the two

This isn't entirely complete, but that doesn't matter
until we have a driver using it. In particular, it's
missing
 - regulatory checks on the usable bandwidth (if that
   even makes sense)
 - regulatory TX power (database can't deal with it)
 - a proper channel compatibility calculation for the
   new channel types

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: pass a channel definition struct
Johannes Berg [Thu, 8 Nov 2012 20:25:48 +0000 (21:25 +0100)]
cfg80211: pass a channel definition struct

Instead of passing a channel pointer and channel type
to all functions and driver methods, pass a new channel
definition struct. Right now, this struct contains just
the control channel and channel type, but for VHT this
will change.

Also, add a small inline cfg80211_get_chandef_type() so
that drivers don't need to use the _type field of the
new structure all the time, which will change.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211: add documentation for channel type
Johannes Berg [Thu, 8 Nov 2012 18:20:56 +0000 (19:20 +0100)]
nl80211: add documentation for channel type

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: remove remain-on-channel channel type
Johannes Berg [Thu, 8 Nov 2012 17:31:02 +0000 (18:31 +0100)]
cfg80211: remove remain-on-channel channel type

As mwifiex (and mac80211 in the software case) are the
only drivers actually implementing remain-on-channel
with channel type, userspace can't be relying on it.
This is the case, as it's used only for P2P operations
right now.

Rather than adding a flag to tell userspace whether or
not it can actually rely on it, simplify all the code
by removing the ability to use different channel types.
Leave only the validation of the attribute, so that if
we extend it again later (with the needed capability
flag), it can't break userspace sending invalid data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix managed mode channel flags handling
Johannes Berg [Mon, 26 Nov 2012 10:57:41 +0000 (11:57 +0100)]
mac80211: fix managed mode channel flags handling

If ieee80211_prep_channel() decides that HT should be
disabled (because the HT IEs from the AP were invalid)
it will set the IEEE80211_STA_DISABLE_HT to not send
HT capabilities to the AP when associating. If this
happens during authentication, the flag will be lost
and we send HT frames, even if the channel config was
set up for non-HT. This can lead to issues.

Fix this by always resetting the ifmgd flags to zero
when the channel context is released so that the flag
resetting in ieee80211_mgd_assoc() isn't necessary.

To make the code a bit easier move the call to release
the channel in ieee80211_set_disassoc() to the end of
the function together with the flag resetting (which
needs to be at the end to avoid timers setting flags.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: remove mesh config macros from mesh_plink.c
Marco Porsch [Thu, 22 Nov 2012 02:40:32 +0000 (18:40 -0800)]
mac80211: remove mesh config macros from mesh_plink.c

Use shortcut pointer instead where it is appropriate.

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: refactor ieee80211_set_qos_hdr
Marco Porsch [Thu, 22 Nov 2012 02:40:31 +0000 (18:40 -0800)]
mac80211: refactor ieee80211_set_qos_hdr

Return early if not a QoS Data frame.
Give proper documentation.

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: move Mesh Capability field definition to ieee80211.h
Marco Porsch [Thu, 22 Nov 2012 02:40:30 +0000 (18:40 -0800)]
mac80211: move Mesh Capability field definition to ieee80211.h

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
[prefix with IEEE80211_]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: in ADHOC print debug message for every Auth message
Antonio Quartulli [Sun, 25 Nov 2012 22:24:27 +0000 (23:24 +0100)]
mac80211: in ADHOC print debug message for every Auth message

The debug message has to be printed also for an Auth message with
auth_sequence != 1. This helps understanding whether the two Auth
messages are exchanged correctly or not.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: in ADHOC don't update last_rx if sta is not authorized
Antonio Quartulli [Sun, 25 Nov 2012 22:13:42 +0000 (23:13 +0100)]
mac80211: in ADHOC don't update last_rx if sta is not authorized

It does not make sense to keep a station alive if it is not authorised
at all. If IBSS/RSN is used it could also be the case that something
went wrong during the keys exchange and the stations ended up in a not
recoverable state.

By not updating last_rx we are giving the station a chance to be
deleted and to start the key exchange once again from scratch.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: change function signature of cfg80211_get_p2p_attr()
Arend van Spriel [Sun, 25 Nov 2012 18:13:28 +0000 (19:13 +0100)]
cfg80211: change function signature of cfg80211_get_p2p_attr()

The function cfg80211_get_p2p_attr() can fail and returns
a negative error code. However, the return type is unsigned
int. The largest positive number is determined by desired_len
variable in the function, which is u16. So changing the return
type to int to allow easy error checking. Also change the type
for the attribute to enum for improved type checking.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
[fix indentation, don't use u8 attr variable]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: use DS or HT operation IEs to determine BSS channel
Johannes Berg [Fri, 23 Nov 2012 13:23:30 +0000 (14:23 +0100)]
cfg80211: use DS or HT operation IEs to determine BSS channel

Currently, mac80211 checks the DS params IE if present and
uses it for the (primary) BSS channel, instead of the one
that the frame was received on. This is particularly useful
in the 2.4 GHz band since a frame is often received on one
of the adjacent channels due to overlap.

Move this code to cfg80211 so other drivers also do this.

Additionally, on 5 GHz, in particular with some (possibly)
upcoming changes in 802.11ai and duplicate transmissions
when wider channels are used, something similar happens.
So if present, also use the (primary) channel information
contained in the HT operation IE.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: disable HT advertising unless AP supports it
Johannes Berg [Thu, 22 Nov 2012 13:34:05 +0000 (14:34 +0100)]
mac80211: disable HT advertising unless AP supports it

If the AP doesn't support HT, or more importantly if
it does but we have to disable it because its IEs are
broken, don't advertise HT support in our association
request. Otherwise, we configure our channel to be a
20 MHz non-HT channel but the AP might still think we
support HT, or even 40 MHz.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: rename IEEE80211_STA_DISABLE_11N to HT
Johannes Berg [Thu, 22 Nov 2012 13:32:09 +0000 (14:32 +0100)]
mac80211: rename IEEE80211_STA_DISABLE_11N to HT

Since the 11n spec amendment was rolled into the
2012 version, "11n" no longer makes sense. Use
"HT" instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix RX chains configuration
Johannes Berg [Thu, 22 Nov 2012 13:17:23 +0000 (14:17 +0100)]
mac80211: fix RX chains configuration

If the driver doesn't support 40 MHz channels, then
mac80211 erroneously sets number of RX chains to one
although the number of chains is independent of the
support for 40 MHz channels.

Fix this by checking the 40 MHz support only for the
code that sets the 40 MHz channel not the complete
HT code block.

This also means the HT20 channel type will always be
set in the changed code block so there's no need to
set it in case we override the AP due to invalid IEs
in the probe response/beacon.

The indentation is a bit quirky, but I'm rewriting
this code for VHT support so this will change again
very soon.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix radiotap vendor area skipping
Johannes Berg [Thu, 22 Nov 2012 09:20:58 +0000 (10:20 +0100)]
mac80211: fix radiotap vendor area skipping

The radiotap vendor area in the skb head must be skipped
and accounted for in a few functions until it is removed.
I missed this in my patch, so a few places use this data
as though it was the 802.11 header, fix these places.

Reported-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Tested-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: Add debugfs callbacks for station addition/removal
Sujith Manoharan [Tue, 20 Nov 2012 03:16:02 +0000 (08:46 +0530)]
mac80211: Add debugfs callbacks for station addition/removal

Provide drivers with hooks to create debugfs files when
a new station is added. This would help drivers to take
advantage of mac80211's station list infrastructure and not maintain
tedious station management code internally.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
[ifdef inline wrapper functions]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix channel context suspend/reconfig handling
Johannes Berg [Mon, 19 Nov 2012 21:19:08 +0000 (22:19 +0100)]
mac80211: fix channel context suspend/reconfig handling

Sujith reported warnings with suspend/resume due to
channel contexts. When I looked into it, I realised
that the code was completely broken as it unassigned
the channel contexts when suspending, which actually
means they are destroyed.

Eliad Peller then pointed out that we also need to
remove the channel contexts from the driver. When I
looked into this, I also noticed that the code isn't
handling the virtual monitor interface correctly (if
it exists.)

Fix this by calling just the driver methods (if they
are implemented) instead of using the channel context
management code. Also add reconfiguration for the
virtual monitor interface.

Reported-by: Sujith Manoharan <sujith@msujith.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: make remain_on_channel() op pass vif param
Eliad Peller [Mon, 19 Nov 2012 15:05:09 +0000 (17:05 +0200)]
mac80211: make remain_on_channel() op pass vif param

Drivers (e.g. wl12xx) might need to know the vif
to roc on (mainly in order to configure the
rx filters correctly).

Add the vif to the op params, and update the current
users (iwlwifi) to use the new api.

Signed-off-by: Eliad Peller <eliad@wizery.com>
[fix hwsim]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: Add TDLS event to allow drivers to request operations
Jouni Malinen [Fri, 16 Nov 2012 20:49:57 +0000 (22:49 +0200)]
cfg80211: Add TDLS event to allow drivers to request operations

The NL80211_CMD_TDLS_OPER command was previously used only for userspace
request for the kernel code to perform TDLS operations. However, there
are also cases where the driver may need to request operations from
userspace, e.g., when using security on the AP path. Add a new cfg80211
function for generating a TDLS operation event for drivers to request a
new link to be set up (NL80211_TDLS_SETUP) or an existing link to be
torn down (NL80211_TDLS_TEARDOWN). Drivers can optionally use these
events, e.g., based on noticing data traffic being sent to a peer
station that is seen with good signal strength.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support radiotap vendor namespace RX data
Johannes Berg [Fri, 16 Nov 2012 09:09:08 +0000 (10:09 +0100)]
mac80211: support radiotap vendor namespace RX data

In some cases, in particular for experimentation, it
can be useful to be able to add vendor namespace data
to received frames in addition to the normal radiotap
data.

Allow doing this through mac80211 by adding fields to
the RX status descriptor that describe the data while
the data itself is prepended to the frame.

Also add some example code to hwsim, but don't enable
it because it doesn't use a proper OUI identifier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: introduce IEEE80211_NUM_TIDS and use it
Johannes Berg [Wed, 14 Nov 2012 22:22:21 +0000 (23:22 +0100)]
mac80211: introduce IEEE80211_NUM_TIDS and use it

Introduce IEEE80211_NUM_TIDS in the generic 802.11
header file and use it in place of STA_TID_NUM and
NUM_RX_DATA_QUEUES which are both really the number
of TIDs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: use CMAC_PN_LEN
Johannes Berg [Wed, 14 Nov 2012 22:15:11 +0000 (23:15 +0100)]
mac80211: use CMAC_PN_LEN

Instead of hardcoding its value (6), use the constant.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: check add_chanctx callback before use in ieee80211_reconfig
Arend van Spriel [Mon, 19 Nov 2012 11:01:05 +0000 (12:01 +0100)]
mac80211: check add_chanctx callback before use in ieee80211_reconfig

During testing our mac80211 driver a fatal error occurred which was
signalled to mac80211. Upon performing the reconfiguration of the
device a WARN_ON was triggered. This warning checked the return value
of drv_add_chanctx(). However, this returns -EOPNOTSUPP when the
driver does not provide the callback. As the callback is optional
better check it is defined before calling drv_add_chanctx().

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: support RX_FLAG_MACTIME_END
Thomas Pedersen [Tue, 13 Nov 2012 18:46:27 +0000 (10:46 -0800)]
mac80211: support RX_FLAG_MACTIME_END

Allow drivers to indicate their mactime is at RX completion and adjust
for this in mac80211. Also rename the existing RX_FLAG_MACTIME_MPDU to
RX_FLAG_MACTIME_START to clarify its intent. Based on similar code by
Johannes Berg.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
[fix docs, atheros drivers]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl/cfg80211: advertise OBSS scan requirement
Amitkumar Karwar [Sat, 10 Nov 2012 01:51:30 +0000 (17:51 -0800)]
nl/cfg80211: advertise OBSS scan requirement

wpa_supplicant will do OBSS scan for drivers that implement
auth/assoc API. Drivers that implement nl80211 connect API
(rather than auth/assoc) may need wpa_supplicant to do this
as well.

Add a new feature flag to inform it (wpa_s) that a driver
needs wpa_supplicant to do OBSS scans.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: reassign channel contexts before stations
Johannes Berg [Wed, 7 Nov 2012 11:40:41 +0000 (12:40 +0100)]
mac80211: reassign channel contexts before stations

Since channel contexts are usually present before
stations can be added to an interface, reassign
before stations them in reconfiguration as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: clarify interface iteration and make it configurable
Johannes Berg [Tue, 6 Nov 2012 19:23:30 +0000 (20:23 +0100)]
mac80211: clarify interface iteration and make it configurable

During hardware restart, all interfaces are iterated even
though they haven't been re-added to the driver, document
this behaviour. The same also happens during resume, which
is even more confusing since all of the interfaces were
previously removed from the driver. Make this optional so
drivers relying on the current behaviour can still use it,
but to let drivers that don't want this behaviour disable
it.

Also convert all API users, keeping the old semantics
except in hwsim, where the new normal ones are desired.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: call driver method when restart completes
Johannes Berg [Tue, 6 Nov 2012 18:18:13 +0000 (19:18 +0100)]
mac80211: call driver method when restart completes

When the driver requests a restart (reconfiguration) it
gets all the normal method calls, but can't really tell
why they're happening. Call a new restart_complete op
in the driver when the restart completes, so it could
keep its own state about the restart and clear it there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: remove unused tracepoint
Johannes Berg [Thu, 8 Nov 2012 17:16:48 +0000 (18:16 +0100)]
mac80211: remove unused tracepoint

Clearly the tracepoint drv_offchannel_tx was
forgotten when that functionality was removed,
remove it now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: add debugfs file for HW queues
Johannes Berg [Thu, 8 Nov 2012 14:29:28 +0000 (15:29 +0100)]
mac80211: add debugfs file for HW queues

Add a debugfs file showing which HW queues were
allocated to a virtual interface, including the
CAB queue for AP interfaces.

Change-Id: I486924e961b6ad6785a79db09620919ee644e703
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix TX error path
Johannes Berg [Wed, 7 Nov 2012 13:02:30 +0000 (14:02 +0100)]
mac80211: fix TX error path

One error path in ieee80211_subif_start_xmit() will
double-free the SKB. Set it to NULL to prevent that.

This issue was introduced by my channel context
changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: include export.h in aes_cmac
Emmanuel Grumbach [Wed, 7 Nov 2012 09:13:58 +0000 (11:13 +0200)]
mac80211: include export.h in aes_cmac

This is needed since this file exports functions.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: use kstrtoull return value
Johannes Berg [Mon, 5 Nov 2012 19:30:39 +0000 (20:30 +0100)]
mac80211: use kstrtoull return value

If kstrtoull() returns an error code (a value
smaller than zero), use it since it can be an
error other than -EINVAL.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix race in TKIP MIC test debugfs file
Johannes Berg [Mon, 5 Nov 2012 19:27:57 +0000 (20:27 +0100)]
mac80211: fix race in TKIP MIC test debugfs file

Accessing sdata->vif.bss_conf.bssid without any
protection here is racy, use u.mgd.associated
instead and lock the correct mutex for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: use mac_pton
Johannes Berg [Mon, 5 Nov 2012 19:24:38 +0000 (20:24 +0100)]
mac80211: use mac_pton

Instead of implementing practically the same
function (hwaddr_aton) use mac_pton.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211: send the NL80211_ATTR_SSID in nl80211_send_iface()
Antonio Quartulli [Wed, 7 Nov 2012 11:52:20 +0000 (12:52 +0100)]
nl80211: send the NL80211_ATTR_SSID in nl80211_send_iface()

The userspace may want to know what is the current ssid that a given
interface is using. This patch enables nl80211 to send the
NL80211_ATTR_SSID attribute in nl80211_send_iface().

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: store the ssid into wirless_dev in AP mode
Antonio Quartulli [Wed, 7 Nov 2012 11:52:19 +0000 (12:52 +0100)]
cfg80211: store the ssid into wirless_dev in AP mode

Store the configured ssid in wdev->ssid when starting an AP

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: pass P2P powersave parameters to driver
Johannes Berg [Mon, 29 Oct 2012 19:08:01 +0000 (20:08 +0100)]
mac80211: pass P2P powersave parameters to driver

While connected to a GO, parse the P2P NoA attribute
and pass the CT Window and opportunistic powersave
parameters to the driver.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agowireless: add utility function to get P2P attribute
Johannes Berg [Mon, 29 Oct 2012 18:48:40 +0000 (19:48 +0100)]
wireless: add utility function to get P2P attribute

Parsing the P2P attributes can be tricky as their
contents can be split across multiple (vendor) IEs.
Thus, it's not possible to parse them like IEs (by
returning a pointer to the data.) Instead, provide
a function that copies the attribute data into a
caller-provided buffer and returns the size needed
(useful in case the buffer was too small.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: allow registering more than one beacon listener
Ben Greear [Fri, 26 Oct 2012 21:49:25 +0000 (14:49 -0700)]
cfg80211: allow registering more than one beacon listener

The commit:

commit 5e760230e42cf759bd923457ca2753aacf2e656e
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Nov 4 11:18:17 2011 +0100

    cfg80211: allow registering to beacons

allowed only a single process to register for beacon events
per wiphy.  This breaks cases where a user may want two or
more VIFs on a wiphy and run a seperate hostapd process on
each vif.

This patch allows multiple beacon listeners, fixing the
regression.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: implement set_mcast_rate() callback
Antonio Quartulli [Fri, 2 Nov 2012 12:27:49 +0000 (13:27 +0100)]
mac80211: implement set_mcast_rate() callback

This new callback can be used to tune the rate to be used to send
multicast frames.

In the current state the multicast rate can be specified on IBSS/MESH
joining only. This makes it impossible to select a custom multicast
rate when then join command is sent by an external program (e.g.
wpa_supplicant)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl/cfg80211: add the NL80211_CMD_SET_MCAST_RATE command
Antonio Quartulli [Fri, 2 Nov 2012 12:27:48 +0000 (13:27 +0100)]
nl/cfg80211: add the NL80211_CMD_SET_MCAST_RATE command

This command triggers a new callback: set_mcast_rate(). It enables
the user to change the rate used to send multicast frames for vif
configured as IBSS or MESH_POINT

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agowireless: add peer-to-peer related definitions
Arend van Spriel [Mon, 5 Nov 2012 14:29:09 +0000 (15:29 +0100)]
wireless: add peer-to-peer related definitions

The Peer-to-Peer IE is vendor-specific IE identified by WiFi Alliance
OUI and specific P2P OUI type. The payload of this IE consists of
so-called P2P attributes. This patch adds definitions for processing
these attributes.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: send deauth only with channel context
Johannes Berg [Mon, 29 Oct 2012 08:46:31 +0000 (09:46 +0100)]
mac80211: send deauth only with channel context

When userspace asks to deauthenticate and we're just
authenticated (or still authenticating) send a deauth
frame instead of deleting the auth request.

On the other hand, if we've just disassociated and
therefore deleted all our state already, drop the
deauth request because we no longer have a channel
context to send it on.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: use a counter for remain-on-channel cookie
Johannes Berg [Fri, 26 Oct 2012 14:13:06 +0000 (16:13 +0200)]
mac80211: use a counter for remain-on-channel cookie

Instead of using the pointer which can be re-used
fairly quickly due to allocator patterns and then
makes debugging difficult, maintain a counter and
use its value. Since it's a 64-bit value it can't
really wrap, but catch that case anyway since it
most likely points to a bug somewhere.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: combine status/drop reporting
Johannes Berg [Fri, 26 Oct 2012 13:53:06 +0000 (15:53 +0200)]
mac80211: combine status/drop reporting

The TX status reporting is done for both the
nl80211 report as well as the socket option.
The socket option is also reported when an
skb is dropped to guarantee that the copy in
the IDR tree is freed and status is reported
to userspace.

However, when a frame is dropped, no nl80211
status is reported. This can cause userspace
to stop making progress while waiting for a
status notification.

Combine the nl80211 and socket option status
reporting into a new function and call it in
both places -- when the status comes in from
the driver and when the skb is dropped.

While at it, also simplify the code in the
nl80211 portion a bit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211_hwsim: print per interface TX power
Johannes Berg [Wed, 24 Oct 2012 09:54:31 +0000 (11:54 +0200)]
mac80211_hwsim: print per interface TX power

Just for debugging, print the interface TX
power whenever it changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: handle TX power per virtual interface
Johannes Berg [Wed, 24 Oct 2012 08:59:25 +0000 (10:59 +0200)]
mac80211: handle TX power per virtual interface

Even before channel contexts/multi-channel, having a
single global TX power limit was already problematic,
in particular if two managed interfaces connected to
two APs with different power constraints. The channel
context introduction completely broke this though and
in fact I had disabled TX power configuration there
for drivers using channel contexts.

Change everything to track TX power per interface so
that different user settings and different channel
maxima are treated correctly. Also continue tracking
the global TX power though for compatibility with
applications that attempt to configure the wiphy's
TX power globally.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: allow per interface TX power setting
Johannes Berg [Wed, 24 Oct 2012 08:17:18 +0000 (10:17 +0200)]
cfg80211: allow per interface TX power setting

The TX power setting is currently per wiphy (hardware
device) but with multi-channel capabilities that doesn't
make much sense any more.

Allow drivers (and mac80211) to advertise support for
per-interface TX power configuration. When the TX power
is configured for the wiphy, the wdev will be NULL and
the driver can still handle that, but when a wdev is
given the TX power can be set only for that wdev now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211: move "can set channel" check
Johannes Berg [Wed, 24 Oct 2012 08:04:58 +0000 (10:04 +0200)]
nl80211: move "can set channel" check

Setting the wdev to NULL when the channel can't be
set for that interface type (to treat the channel
setting for the wiphy/monitor) currently works, but
is confusing in the code if netdev/wdev aren't both
set/unset in the same way. Move the check whether
the channel can be set to where it's needed so that
wdev and netdev are always both assigned or NULL.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211_hwsim: allow using channel contexts
Johannes Berg [Fri, 27 Jul 2012 17:48:26 +0000 (19:48 +0200)]
mac80211_hwsim: allow using channel contexts

To use mac80211_hwsim for testing channel contexts it
has to support them, and for that it has to support
hw scan and hw-remain-on-channel.

Since it's pure software, the off-channel activities
are really not off-channel but listening and sending
on a second channel. Also, the multi-channel isn't
really doing TDM, it's just on both channels at the
same time.

For testing purposes, you can specify the number of
concurrent channels with a module parameter, it is
set to one by default. When set to two or more, the
userspace API for wmediumd is disabled as it has no
provisions for multi-channel yet.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoMerge remote-tracking branch 'wireless-next/master' into mac80211-next
Johannes Berg [Tue, 30 Oct 2012 08:09:48 +0000 (09:09 +0100)]
Merge remote-tracking branch 'wireless-next/master' into mac80211-next

12 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Mon, 29 Oct 2012 20:05:51 +0000 (16:05 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

Conflicts:
drivers/net/wireless/mwifiex/cfg80211.c