platform/kernel/linux-stable.git
13 years agoBluetooth: Add set_io_capability management command
Johan Hedberg [Tue, 25 Jan 2011 11:28:33 +0000 (13:28 +0200)]
Bluetooth: Add set_io_capability management command

This patch adds a new set_io_capability management command which is used
to set the IO capability for Secure Simple Pairing (SSP) as well as the
Security Manager Protocol (SMP). The value is per hci_dev and each
hci_conn object inherits it upon creation.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for PIN code handling in the management interface
Johan Hedberg [Sat, 22 Jan 2011 04:10:07 +0000 (06:10 +0200)]
Bluetooth: Add support for PIN code handling in the management interface

This patch adds the necessary commands and events needed to communicate
PIN code related actions between the kernel and userspace. This includes
a pin_code_request event as well as pin_code_reply and
pin_code_negative_reply commands.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Create common cmd_complete function for mgmt.c
Johan Hedberg [Sat, 22 Jan 2011 04:46:43 +0000 (06:46 +0200)]
Bluetooth: Create common cmd_complete function for mgmt.c

A lot of management code needs to generate command complete events so it
makes sense to have a helper function for this.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add get_connections managment interface command
Johan Hedberg [Fri, 21 Jan 2011 11:56:35 +0000 (13:56 +0200)]
Bluetooth: Add get_connections managment interface command

This patch adds a get_connections command to the management interface.
With this command userspace can get the current list of connected
devices. Typically this command would only be used once when enumerating
existing adapters. After that the connected and disconnected events are
used to track connections.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for connect failed management event
Johan Hedberg [Sat, 22 Jan 2011 04:09:08 +0000 (06:09 +0200)]
Bluetooth: Add support for connect failed management event

This patch add a new connect failed management event to track failures
in connecting to remote devices. It is particularly useful for security
mode 3 scenarios when we don't have a connected state while pairing but
still need to detect when the connect attempt failed.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add disconnect managment command
Johan Hedberg [Thu, 20 Jan 2011 10:40:27 +0000 (12:40 +0200)]
Bluetooth: Add disconnect managment command

This patch adds a disconnect command to the managment interface. Using
this command user space is able to force the disconnection of connected
devices. The command maps directly to the Disconnect HCI command.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add connected/disconnected management events
Johan Hedberg [Thu, 20 Jan 2011 10:34:39 +0000 (12:34 +0200)]
Bluetooth: Add connected/disconnected management events

This patch adds connected and disconnected managment events to track the
connection status to remote devices. The events map directly to
successful connection complete and disconnection complete HCI events for
ACL links.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement link key handling for the management interface
Johan Hedberg [Mon, 17 Jan 2011 12:41:05 +0000 (14:41 +0200)]
Bluetooth: Implement link key handling for the management interface

This patch adds a management commands to feed the kernel with all stored
link keys as well as remove specific ones or all of them. Once the
load_keys command has been called the kernel takes over link key
replies. A new_key event is also added to inform userspace of newly
created link keys that should be stored permanently.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add class of device control to the management interface
Johan Hedberg [Thu, 13 Jan 2011 19:56:52 +0000 (21:56 +0200)]
Bluetooth: Add class of device control to the management interface

This patch adds the possibility for user space to fully control the
Class of Device value of local adapters. To control the service class
bits each UUID that's added comes with a service class "hint" which acts
as a mask of bits that the UUID needs to have enabled. The
set_service_cache management command is used to make sure we queue up
all UUID changes as user space initializes its drivers and then send a
single HCI_Write_Class_of_Device command when initialization is
complete.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement a more complete adapter initialization sequence
Johan Hedberg [Mon, 24 Jan 2011 23:19:58 +0000 (01:19 +0200)]
Bluetooth: Implement a more complete adapter initialization sequence

Using the managment interface means that user space doesn't need to do
any HCI command sending at all. This patch moves the remaining
initialization commands from user space to the kernel side. The patch
makes use of the new feature of __hci_request which allows the request
to be dynamically modified while it is ongoing (something that is needed
to react appropriately to the local features and the version of the
adapter).

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove page timeout setting from HCI init sequence
Johan Hedberg [Mon, 10 Jan 2011 12:28:45 +0000 (14:28 +0200)]
Bluetooth: Remove page timeout setting from HCI init sequence

User space should set the page timeout so there's no need to explicitly
set it in the HCI init sequence. Even if user space fails to set it the
controller default value will be used.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add controller side link key clearing to hci_init_req
Johan Hedberg [Mon, 10 Jan 2011 11:44:55 +0000 (13:44 +0200)]
Bluetooth: Add controller side link key clearing to hci_init_req

The controller may have link keys in its own memory and these keys could
be used for secure connections. However, since the interface to access
these keys doesn't provide information about the key types (which would
be needed to infer the level of security each key provides) using these
keys is rather useless. Therefore, simply clear the controller side list
in the initialization procedure.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add special handling with __hci_request and HCI_INIT
Johan Hedberg [Mon, 10 Jan 2011 11:28:59 +0000 (13:28 +0200)]
Bluetooth: Add special handling with __hci_request and HCI_INIT

To support a more dynamic HCI initialization sequence the __hci_request
behavior requires some more changes. Particularly, the init sequence
should be able to have conditionals in it (sending some HCI commands
depending on the outcome of a previous command) instead of being a fixed
list as it is right now.

The reasons for these additional requirements are the moving all
previously user space driven initialization commands to the kernel side
as well as the support the Low Energy controllers.

To fulfull these requirements the init sequence is made the only special
case for multi-command requests and req_last_cmd is renamed to
init_last_cmd. The hci_send_cmd function is changed to update
init_last_cmd as long as the HCI_INIT flag is set.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Reject pairing requests when in non-pairable mode
Johan Hedberg [Tue, 4 Jan 2011 13:40:05 +0000 (15:40 +0200)]
Bluetooth: Reject pairing requests when in non-pairable mode

This patch adds the necessary logic to act accordingly when the
HCI_PAIRABLE flag is not set. In that case PIN code replies as well as
Secure Simple Pairing requests without a NoBonding requirement need to
be rejected.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement debugfs support for listing UUIDs
Johan Hedberg [Tue, 4 Jan 2011 09:39:44 +0000 (11:39 +0200)]
Bluetooth: Implement debugfs support for listing UUIDs

This patch adds a debugfs entry to list the UUIDs that have been
registered through the management interface.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement UUID handling through the management interface
Johan Hedberg [Tue, 4 Jan 2011 10:08:51 +0000 (12:08 +0200)]
Bluetooth: Implement UUID handling through the management interface

This patch adds methods to the management interface for userspace to
notify the kernel of which services have been registered for specific
adapters. This information is needed for setting the appropriate Class
of Device value as well as the Extended Inquiry Response value. This
patch doesn't actually implement setting of these values but just
provides the storage of the UUIDs so the needed functionality can be
built on top of it.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement set_pairable managment command
Johan Hedberg [Wed, 26 Jan 2011 11:11:03 +0000 (13:11 +0200)]
Bluetooth: Implement set_pairable managment command

This patch implements a new set_pairable management command to control
the pairable state of local adapters. The state is represented using a
new HCI_PAIRABLE flag in the hci_dev struct.

For backwards compatibility with older user space versions the
HCI_PAIRABLE flag gets automatically set when the existence of an
adapter is reported to user space through legacy methods and the
HCI_MGMT flag is not set.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add send_mode_rsp convenience function for mgmt.c
Johan Hedberg [Wed, 26 Jan 2011 11:07:10 +0000 (13:07 +0200)]
Bluetooth: Add send_mode_rsp convenience function for mgmt.c

Several management commands have similar responses but they are not
always sent asynchronously. To enable synchronous sending (from the
managment command handler function) a send_mode_rsp function is added.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add flag to track managment controlled adapters
Johan Hedberg [Tue, 4 Jan 2011 09:54:26 +0000 (11:54 +0200)]
Bluetooth: Add flag to track managment controlled adapters

This patch adds a HCI_MGMT flag to track adapters which are under the
control of the management interface. This is needed to make sure that
new kernels will work with old user space versions. I.e. behaviour which
could break old user space versions (but is needed by the management
interface) should not be exhibited when the HCI_MGMT flag is not set.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Unify mode related management messages to a single struct
Johan Hedberg [Wed, 29 Dec 2010 22:38:22 +0000 (00:38 +0200)]
Bluetooth: Unify mode related management messages to a single struct

The powered, connectable and discoverable messages all have the same
format. By using a single struct for all of them a lot of code can be
simplified and reused.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add set_connectable management command
Johan Hedberg [Wed, 29 Dec 2010 22:18:33 +0000 (00:18 +0200)]
Bluetooth: Add set_connectable management command

This patch adds a set_connectable command as well as a corresponding
event to the management interface. It's mainly useful for setting an
adapter as connectable from a non-initialized state as well as setting
an already initialized adapter as non-connectable (mostly useful for
qualification purposes).

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for set_discoverable management command
Johan Hedberg [Wed, 29 Dec 2010 14:00:25 +0000 (16:00 +0200)]
Bluetooth: Add support for set_discoverable management command

This patch adds a set_discoverable command to the management interface
as well as the corresponding event. The command is used to control the
discoverable state of adapters.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for set_powered management command
Johan Hedberg [Thu, 16 Dec 2010 08:17:38 +0000 (10:17 +0200)]
Bluetooth: Add support for set_powered management command

This patch adds a set_powered command to the management interface
through which the powered state of local adapters can be controlled.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for management powered event
Johan Hedberg [Thu, 16 Dec 2010 08:00:37 +0000 (10:00 +0200)]
Bluetooth: Add support for management powered event

This patch adds support for the powered event that's used to indicate to
userspace when the powered state of a local adapter changes.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement automatic setup procedure for local adapters
Johan Hedberg [Wed, 15 Dec 2010 11:53:18 +0000 (13:53 +0200)]
Bluetooth: Implement automatic setup procedure for local adapters

This patch implements automatic initialization of basic information
about newly registered Bluetooth adapters. E.g. the address and features
are always needed so it makes sense for the kernel to automatically
power on adapters and read this information. A new HCI_SETUP flag is
added to track this state.

In order to not consume unnecessary amounts of power if there isn't a
user space available that could switch the adapter back off, a timer is
added to do this automatically as long as no Bluetooth user space seems
to be present. A new HCI_AUTO_OFF flag is added that user space needs to
clear to avoid the automatic power off.

Additionally, the management interface index_added event is moved to the
end of the HCI_SETUP stage so a user space supporting the managment
inteface has all the necessary information available for fetching when
it gets notified of a new adapter. The HCI_DEV_REG event is kept in the
same place as before since existing HCI raw socket based user space
versions depend on seeing the kernels initialization sequence
(hci_init_req) to determine when the adapter is ready for use.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix setting of MTU for ERTM and Streaming Mode
Gustavo F. Padovan [Mon, 24 Jan 2011 18:01:43 +0000 (16:01 -0200)]
Bluetooth: Fix setting of MTU for ERTM and Streaming Mode

The desired MTU should be sent in an Config_Req for all modes.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Use non-flushable by default L2CAP data packets
Andrei Emeltchenko [Mon, 3 Jan 2011 09:14:36 +0000 (11:14 +0200)]
Bluetooth: Use non-flushable by default L2CAP data packets

Modification of Nick Pelly <npelly@google.com> patch.

With Bluetooth 2.1 ACL packets can be flushable or non-flushable. This commit
makes ACL data packets non-flushable by default on compatible chipsets, and
adds the BT_FLUSHABLE socket option to explicitly request flushable ACL
data packets for a given L2CAP socket. This is useful for A2DP data which can
be safely discarded if it can not be delivered within a short time (while
other ACL data should not be discarded).

Note that making ACL data flushable has no effect unless the automatic flush
timeout for that ACL link is changed from its default of 0 (infinite).

Default packet types (for compatible chipsets):
Frame 34: 13 bytes on wire (104 bits), 13 bytes captured (104 bits)
Bluetooth HCI H4
Bluetooth HCI ACL Packet
    .... 0000 0000 0010 = Connection Handle: 0x0002
    ..00 .... .... .... = PB Flag: First Non-automatically Flushable Packet (0)
    00.. .... .... .... = BC Flag: Point-To-Point (0)
    Data Total Length: 8
Bluetooth L2CAP Packet

After setting BT_FLUSHABLE
(sock.setsockopt(274 /*SOL_BLUETOOTH*/, 8 /* BT_FLUSHABLE */, 1 /* flush */))
Frame 34: 13 bytes on wire (104 bits), 13 bytes captured (104 bits)
Bluetooth HCI H4
Bluetooth HCI ACL Packet
    .... 0000 0000 0010 = Connection Handle: 0x0002
    ..10 .... .... .... = PB Flag: First Automatically Flushable Packet (2)
    00.. .... .... .... = BC Flag: Point-To-Point (0)
    Data Total Length: 8
Bluetooth L2CAP Packet

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix failure to release lock in read_index_list()
Jesper Juhl [Thu, 13 Jan 2011 23:18:49 +0000 (00:18 +0100)]
Bluetooth: Fix failure to release lock in read_index_list()

If alloc_skb() fails in read_index_list() we'll return -ENOMEM without
releasing 'hci_dev_list_lock'.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/blueto...
Gustavo F. Padovan [Tue, 8 Feb 2011 03:38:50 +0000 (01:38 -0200)]
Merge branch 'master' of git://git./linux/kernel/git/padovan/bluetooth-2.6 into wireless

13 years agomac80211: remove unneeded check
Dan Carpenter [Mon, 7 Feb 2011 19:03:35 +0000 (22:03 +0300)]
mac80211: remove unneeded check

"ap" is the address of sdata->u.ap so it can never be NULL here.  Also
we dereferenced it on the previous line.  I removed the check.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: Update comments for not parsing DTIM period
Mohammed Shafi Shajakhan [Mon, 7 Feb 2011 15:38:28 +0000 (21:08 +0530)]
ath9k: Update comments for not parsing DTIM period

Add few comments for not parsing DTIM period from mac80211

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Update comments on radiotap MCS index
Mohammed Shafi Shajakhan [Mon, 7 Feb 2011 04:40:04 +0000 (10:10 +0530)]
mac80211: Update comments on radiotap MCS index

mac80211 now supports passing MCS index to radiotap, so update the
comments regarding this

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: as a 4-addr station, do not receive packets for other stations
Felix Fietkau [Sat, 5 Feb 2011 22:48:37 +0000 (23:48 +0100)]
mac80211: as a 4-addr station, do not receive packets for other stations

Since 4-addr frames completely override the source address which will
make it into the converted 802.3 frames, receiving frames for other
4-addr stations will confuse the bridging code.

To be able to handle traffic for all connected devices, the bridge
code will automatically turn on promiscuous mode, which triggers
this problem.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Steve Brown <sbrown@cortland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Make some mlme timers module paramaters.
Ben Greear [Fri, 4 Feb 2011 23:30:24 +0000 (15:30 -0800)]
mac80211: Make some mlme timers module paramaters.

This allows users to tune the connection-loss algorithms
to be more or less lenient.  In particular, larger
null-func retries helps when using lots of virtual
stations on a loaded network.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath5k: Fix fast channel switching
Nick Kossifidis [Thu, 3 Feb 2011 23:41:02 +0000 (01:41 +0200)]
ath5k: Fix fast channel switching

Fast channel change fixes:

a) Always set OFDM timings
b) Don't re-activate PHY
c) Enable only NF calibration, not AGC

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoiwlwifi: fix compiling error with different configuration
Wey-Yi Guy [Fri, 4 Feb 2011 18:46:41 +0000 (10:46 -0800)]
iwlwifi: fix compiling error with different configuration

When .config has different configuration, it might fail to compile
iwlwifi. fix it

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlwifi: remove unnecessary locking
Johannes Berg [Fri, 4 Feb 2011 14:57:45 +0000 (06:57 -0800)]
iwlwifi: remove unnecessary locking

This code, and the places that set the variable
is_internal_short_scan and the vif pointers are
all protected by the mutex, there's no point in
locking the spinlock here as well (any more).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agomac80211: Optimize scans on current operating channel.
Ben Greear [Fri, 4 Feb 2011 19:54:17 +0000 (11:54 -0800)]
mac80211: Optimize scans on current operating channel.

This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.

* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
  and is-scanning flags instead.

* Add helper method to determine if we are currently configured
  for the operating channel.

* Do no blindly go off/on channel in work.c  Instead, only call
  appropriate on/off code when we really need to change channels.
  Always enable offchannel-ps mode when starting work,
  and disable it when we are done.

* Consolidate ieee80211_offchannel_stop_station and
  ieee80211_offchannel_stop_beaconing, call it
  ieee80211_offchannel_stop_vifs instead.

* Accept non-beacon frames when scanning on operating channel.

* Scan state machine optimized to minimize on/off channel
  transitions.  Also, when going on-channel, go ahead and
  re-enable beaconing.  We're going to be there for 200ms,
  so seems like some useful beaconing could happen.
  Always enable offchannel-ps mode when starting software
  scan, and disable it when we are done.

* Grab local->mtx earlier in __ieee80211_scan_completed_finish
  so that we are protected when calling hw_config(), etc.

* Pass probe-responses up the stack if scanning on local
  channel, so that mlme can take a look.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: add additional checks for the baseband hang detection
Felix Fietkau [Fri, 4 Feb 2011 19:09:25 +0000 (20:09 +0100)]
ath9k: add additional checks for the baseband hang detection

Since even with the latest changes the false positive issue of the baseband
hang check is not fully solved yet, additional checks are needed.
If the baseband hang occurs, the rx_clear signal will be stuck to high, so
we can use the cycle counters to confirm it.
With this patch, a hardware reset is only triggered if the baseband hang
check returned true three times in a row, with a beacon interval between
each check and if the busy time was also 99% or more during the check
intervals.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: do not send duplicate data frames to the cooked monitor interface
Felix Fietkau [Fri, 4 Feb 2011 18:20:08 +0000 (19:20 +0100)]
mac80211: do not send duplicate data frames to the cooked monitor interface

I can't think of a valid use case for this aside from debugging (which can
also be done with a real monitor interface), and dropping these frames saves
some precious CPU cycles.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath: Fix clearing of secondary key cache entry for TKIP
Jouni Malinen [Fri, 4 Feb 2011 11:51:28 +0000 (13:51 +0200)]
ath: Fix clearing of secondary key cache entry for TKIP

All register writes to the key cache have to be done in pairs. However,
the clearing of a separate MIC entry with hardware revisions that use
combined MIC key layout did not do that with one of the registers. Add
the matching register write to the following register to make the KEY4
register write actually complete.

This is mostly a fix for a theoretical issue since the incorrect entry
that could potentially be left behind in the key cache would not match
with received frames. Anyway, better make this code clean the entry
correctly using paired register writes.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: do not restart ps timer during scan or offchannel
Rajkumar Manoharan [Wed, 2 Feb 2011 17:27:53 +0000 (22:57 +0530)]
mac80211: do not restart ps timer during scan or offchannel

While leaving oper channel, STA informs sleep state to AP to
stop sending data. Till sending ack for the nullfunc, AP
continues to send the data to STA which restarts ps_timer that
is causing unnecessary nullfunc exchange on timer expiry
when the STA was already moved to offchannel. So don't restart ps_timer
on data reception during scan. This issue was identified by
the following warning.

WARNING: at net/mac80211/tx.c:661 invoke_tx_handlers+0xf07/0x1330 [mac80211]
wlan0: Dropped data frame as no usable bitrate found while scanning and
associated. Target station: 00:03:7f:0b:a6:1b on 5 GHz band
Call Trace:
  [<ffffffffa0413ba7>] invoke_tx_handlers+0xf07/0x1330 [mac80211]
  [<ffffffffa0414056>] ieee80211_tx+0x86/0x2c0 [mac80211]
  [<ffffffffa0414345>] ieee80211_xmit+0xb5/0x1d0 [mac80211]
  [<ffffffffa04037e0>] ieee80211_dynamic_ps_enable_work+0x0/0xb0 [mac80211]
  [<ffffffffa04158cf>] ieee80211_tx_skb+0x4f/0x60 [mac80211]
  [<ffffffffa04026e6>] ieee80211_send_nullfunc+0x46/0x60 [mac80211]
  [<ffffffffa0403885>] ieee80211_dynamic_ps_enable_work+0xa5/0xb0 [mac80211]

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: add useful debug output
Jussi Kivilinna [Mon, 31 Jan 2011 18:50:31 +0000 (20:50 +0200)]
zd1211rw: add useful debug output

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: enable NL80211_IFTYPE_AP
Jussi Kivilinna [Mon, 31 Jan 2011 18:50:21 +0000 (20:50 +0200)]
zd1211rw: enable NL80211_IFTYPE_AP

It should be safe to enable AP-mode now.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: reset rx urbs after idle period of 30 seconds
Jussi Kivilinna [Mon, 31 Jan 2011 18:50:12 +0000 (20:50 +0200)]
zd1211rw: reset rx urbs after idle period of 30 seconds

RX appears to freeze while idle. Resetting rx-urbs appears to be enough to fix
this. Do reset 30 seconds after last rx.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: reset device when CR_BCN_FIFO_SEMAPHORE freezes in beacon setup
Jussi Kivilinna [Mon, 31 Jan 2011 18:50:02 +0000 (20:50 +0200)]
zd1211rw: reset device when CR_BCN_FIFO_SEMAPHORE freezes in beacon setup

When driver fails to acquire device semaphore lock, device usually
freezes soon afterwards. So failing to acquire lock indicates us that
not everything is going right in device/fw. So reset device when
this happens.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: add TX watchdog and device resetting
Jussi Kivilinna [Mon, 31 Jan 2011 18:49:52 +0000 (20:49 +0200)]
zd1211rw: add TX watchdog and device resetting

When doing transfers at high speed for long time, tx queue can freeze. So add
tx watchdog. TX-watchdog checks for locked tx-urbs and reset hardware when
such is detected. Merely unlinking urb was not enough, device have to be
reseted. Hw settings are restored so that any open link will stay on after
reset.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: collect driver settings and add function to restore theim
Jussi Kivilinna [Mon, 31 Jan 2011 18:49:43 +0000 (20:49 +0200)]
zd1211rw: collect driver settings and add function to restore theim

We need HW hard reset later in patchset to reset device after TX-stall.
Collect all settings that we have set to driver for later reset and
add restore function.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: lower hw command timeouts
Jussi Kivilinna [Mon, 31 Jan 2011 18:49:33 +0000 (20:49 +0200)]
zd1211rw: lower hw command timeouts

Device command timeouts are set up very high (1 sec) and this causes
AP beacon to lock up for long for example. Checking timeouts on device
it's easy to see that 1 sec timeout is not needed, when device fails
to response longer timeout doesn't help:

[  473.074419] zd1211rw 1-1:1.0: print_times() Read times:
[  473.175163] zd1211rw 1-1:1.0: print_time()     0 - 10 msec: 1506
[  473.176429] zd1211rw 1-1:1.0: print_time()    11 - 50 msec: 0
[  473.177955] zd1211rw 1-1:1.0: print_time()   51 - 100 msec: 0
[  473.180703] zd1211rw 1-1:1.0: print_time()  101 - 250 msec: 0
[  473.182101] zd1211rw 1-1:1.0: print_time()  251 - 500 msec: 0
[  473.183221] zd1211rw 1-1:1.0: print_time() 500 - 1000 msec: 20
[  473.184381] zd1211rw 1-1:1.0: print_time() 1000 - ... msec: 18

Also vendor driver doesn't use this long timeout. Therefore change
timeout to 50msec.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: change interrupt URB buffer to DMA buffer
Jussi Kivilinna [Mon, 31 Jan 2011 18:49:24 +0000 (20:49 +0200)]
zd1211rw: change interrupt URB buffer to DMA buffer

As might lower beacon update CPU usage.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: use stack and preallocated memory for small cmd-buffers
Jussi Kivilinna [Mon, 31 Jan 2011 18:49:14 +0000 (20:49 +0200)]
zd1211rw: use stack and preallocated memory for small cmd-buffers

Use stack for allocing small < 64 byte arrays in zd_chip.c and preallocated
buffer in zd_usb.c. This might lower CPU usage for beacon setup.

v2:
 - Do not use stack buffers in zd_usb.c as they would be used for urb
   transfer_buffer.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: batch beacon config commands together
Jussi Kivilinna [Mon, 31 Jan 2011 18:49:05 +0000 (20:49 +0200)]
zd1211rw: batch beacon config commands together

Beacon config function writes beacon to hw one write per byte. This is very
slow (usually taking more than 100ms to finish) and causes high CPU usage
when in AP-mode (kworker at ~50% on Intel Atom N270). By batching commands
together zd_mac_config_beacon() runtime can be lowered to 1/5th and lower
CPU usage to saner levels (<10% on Atom).

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: add beacon watchdog and setting HW beacon more failsafe
Jussi Kivilinna [Mon, 31 Jan 2011 18:48:55 +0000 (20:48 +0200)]
zd1211rw: add beacon watchdog and setting HW beacon more failsafe

When doing tx/rx at high packet rate (for example simply using ping -f),
device starts to fail to respond to control messages. On non-AP modes
this only causes problems for LED updating code but when we are running
in AP-mode we are writing new beacon to HW usually every 100ms. Now if
control message fails in HW beacon setup, device lock is kept locked
and beacon data partially written. This can and usually does cause:

 1. HW beacon setup fail now on, as driver cannot acquire device lock.
 2. Beacon-done interrupt stop working as device has incomplete beacon.

Therefore make zd_mac_config_beacon() always try to release device lock
and add beacon watchdog to restart beaconing when stall is detected.

Also fix zd_mac_config_beacon() try acquiring device lock for max 500ms,
as what old code appeared to be trying to do using loop and msleep(1).

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: fix race between next beacon dtim and ieee80211_get_buffered_bc
Christian Lamparter [Mon, 31 Jan 2011 18:48:44 +0000 (20:48 +0200)]
mac80211: fix race between next beacon dtim and ieee80211_get_buffered_bc

On review of 'zd1211rw: implement beacon fetching and handling
ieee80211_get_buffered_bc()', Christian Lamparter noted that [1]:

   Since zd_beacon_done also uploads the next beacon so long in advance,
   there could be an equally long race between the outdated state of the
   next beacon's DTIM broadcast traffic indicator (802.11-2007 7.3.2.6)
   which -in your case- was uploaded almost a beacon interval ago and
   the xmit of ieee80211_get_buffered_bc *now*.

   The dtim bc/mc bit might be not set, when a mc/bc arrived after the
   beacon was uploaded, but before the "beacon done event" from the
   hardware. So, dozing stations don't expect the broadcast traffic
   and of course, they might miss it completely.

   It's probably better to fix this in mac80211 (see the attached hack).

[1] http://marc.info/?l=linux-wireless&m=129435041117256&w=2

CC: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: implement beacon fetching and handling ieee80211_get_buffered_bc()
Jussi Kivilinna [Mon, 31 Jan 2011 18:48:35 +0000 (20:48 +0200)]
zd1211rw: implement beacon fetching and handling ieee80211_get_buffered_bc()

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: let zd_set_beacon_interval() set dtim_period and add AP-beacon flag
Jussi Kivilinna [Mon, 31 Jan 2011 18:48:25 +0000 (20:48 +0200)]
zd1211rw: let zd_set_beacon_interval() set dtim_period and add AP-beacon flag

Add support for AP-mode beacon. Also disable beacon when interface is set
down as otherwise hw will keep flooding NEXT_BCN interrupts.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: fix ack_pending in filter_ack causing tx-packet ordering problem on monitor
Jussi Kivilinna [Mon, 31 Jan 2011 18:48:16 +0000 (20:48 +0200)]
zd1211rw: fix ack_pending in filter_ack causing tx-packet ordering problem on monitor

For reasons not very clear yet to me, filter_ack leaves matching tx-packet
pending with 'ack_pending'. This causes tx-packet to be passed back to upper
layer after next packet has been transfered and tx-packets might end up
coming come out of monitor interface in wrong order vs. rx.

Because of this when enable AP-mode, hostapd monitor interface would get
packets in wrong order causing problems in WPA association.

So don't use mac->ack_pending when in AP-mode.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: support setting BSSID for AP mode
Jussi Kivilinna [Mon, 31 Jan 2011 18:48:06 +0000 (20:48 +0200)]
zd1211rw: support setting BSSID for AP mode

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: move set_rts_cts_work to bss_info_changed
Jussi Kivilinna [Mon, 31 Jan 2011 18:47:56 +0000 (20:47 +0200)]
zd1211rw: move set_rts_cts_work to bss_info_changed

As bss_info_changed may sleep, we can as well set RTS_CTS register right away.
Keep mac->short_preamble for later use (hw reset).

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: move set_multicast_hash and set_rx_filter from workers to configure_filter
Jussi Kivilinna [Mon, 31 Jan 2011 18:47:46 +0000 (20:47 +0200)]
zd1211rw: move set_multicast_hash and set_rx_filter from workers to configure_filter

Workers not needed anymore since configure_filter may sleep. Keep
mac->multicast_hash for later use (hw reset).

Signed-off-by: Jussi Kivilinna <jussi.kivilina@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: fix beacon interval setup
Jussi Kivilinna [Mon, 31 Jan 2011 18:47:36 +0000 (20:47 +0200)]
zd1211rw: fix beacon interval setup

Vendor driver uses CR_BNC_INTERVAL at various places, one is HW_EnableBeacon()
that combinies beacon interval with BSS-type flag and DTIM value in upper 16bit
of u32. The other one is HW_UpdateBcnInterval() that set_aw_pt_bi()
appears to be based on. HW_UpdateBcnInterval() takes interval argument as u16
and uses that for calculations, set_aw_pt_bi() uses u32 value that has flags
and dtim in upper part. This clearly seems wrong. Also HW_UpdateBcnInterval()
updates only lower 16bit part of CR_BNC_INTERVAL. So make set_aw_pt_bi() do
calculations on only lower u16 part of s->beacon_interval.

Also set 32bit beacon interval register before reading values from device,
as HW_EnableBeacon() on vendor driver does. This is required to make beacon
work on AP-mode, simply reading and then writing updated values is not enough
at least with zd1211b.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: add locking for mac->process_intr
Jussi Kivilinna [Mon, 31 Jan 2011 18:47:27 +0000 (20:47 +0200)]
zd1211rw: add locking for mac->process_intr

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: cancel process_intr work on zd_chip_disable_int()
Jussi Kivilinna [Mon, 31 Jan 2011 18:47:17 +0000 (20:47 +0200)]
zd1211rw: cancel process_intr work on zd_chip_disable_int()

OOPS if worker is running and disconnect() is called (triggered
by unpluging device). Much harder to trigger at this stage but
later when we have AP beacon work in process_intr it happens very
easy.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agozd1211rw: use urb anchors for tx and fix tx-queue disabling
Jussi Kivilinna [Mon, 31 Jan 2011 18:47:08 +0000 (20:47 +0200)]
zd1211rw: use urb anchors for tx and fix tx-queue disabling

When stress testing AP-mode I hit OOPS when unpluging or rmmodding
driver.

It appears that when tx-queue is disabled, tx-urbs might be left pending.
These can cause ehci to call non-existing tx_urb_complete() (after rmmod)
or uninitialized/reseted private structure (after disconnect()). Add skb
queue for submitted packets and unlink pending urbs on zd_usb_disable_tx().

Part of the problem seems to be usb->free_urb_list that isn't always
working as it should, causing machine freeze when trying to free the list
in zd_usb_disable_tx(). Caching free urbs isn't what other drivers seem
to be doing (usbnet for example) so strip free_usb_list.

Patch makes tx-urb handling saner with use of urb anchors.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Add testing functionality for TKIP
Jouni Malinen [Thu, 3 Feb 2011 16:35:19 +0000 (18:35 +0200)]
mac80211: Add testing functionality for TKIP

TKIP countermeasures depend on devices being able to detect Michael
MIC failures on received frames and for stations to report errors to
the AP. In order to test that behavior, it is useful to be able to
send out TKIP frames with incorrect Michael MIC. This testing behavior
has minimal effect on the TX path, so it can be added to mac80211 for
convenient use.

The interface for using this functionality is a file in mac80211
netdev debugfs (tkip_mic_test). Writing a MAC address to the file
makes mac80211 generate a dummy data frame that will be sent out using
invalid Michael MIC value. In AP mode, the address needs to be for one
of the associated stations or ff:ff:ff:ff:ff:ff to use a broadcast
frame. In station mode, the address can be anything, e.g., the current
BSSID. It should be noted that this functionality works correctly only
when associated and using TKIP.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Remove obsolete TKIP flexibility
Jouni Malinen [Thu, 3 Feb 2011 16:34:28 +0000 (18:34 +0200)]
mac80211: Remove obsolete TKIP flexibility

The TKIP implementation was originally prepared to be a bit more
flexible in the way Michael MIC TX/RX keys are configured. However, we
are now taking care of the TX/RX MIC key swapping in user space, so
this code will not be needed. Similarly, there were some remaining WPA
testing code that won't be used in their current form. Remove the
unneeded extra complexity.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agodrivers:net:ipw2100.c change a typo comamnd to command
Justin P. Mattock [Wed, 2 Feb 2011 05:06:21 +0000 (21:06 -0800)]
drivers:net:ipw2100.c change a typo comamnd to command

The below patch fixes a typo comamnd to command.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: reserve a beacon slot on beaconing vif addition
Rajkumar Manoharan [Tue, 1 Feb 2011 17:35:36 +0000 (23:05 +0530)]
ath9k: reserve a beacon slot on beaconing vif addition

The beaconing vif addition is based on max beacon slot
available. So it is better to reserve a beacon slot
on interface addition and let it be configured properly
on bss_info change.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: allow GO to scan like AP
Johannes Berg [Tue, 1 Feb 2011 14:35:36 +0000 (15:35 +0100)]
mac80211: allow GO to scan like AP

There's no point in disallowing scanning for a
GO interface when it's not beaconing yet.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: pass up beacons from external BSS when operating as AP
Arik Nemtsov [Tue, 1 Feb 2011 11:23:05 +0000 (13:23 +0200)]
mac80211: pass up beacons from external BSS when operating as AP

Beacons from external BSSes are required for updating overlapping BSS
info (i.e. ERP protection). Pass them up unconditionally.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: add HW flag for disabling auto link-PS in AP mode
Arik Nemtsov [Mon, 31 Jan 2011 20:29:13 +0000 (22:29 +0200)]
mac80211: add HW flag for disabling auto link-PS in AP mode

When operating in AP mode the wl1271 hardware filters out null-data
packets as well as management packets. This makes it impossible for
mac80211 to monitor the PS mode by using the PM bit of incoming frames.

Implement a HW flag to indicate that mac80211 should ignore the PM bit.
In addition, expose ieee80211_sta_ps_transition() to make low-level
drivers capable of controlling PS-mode.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: do not calc frame duration when using HW rate-control
Arik Nemtsov [Mon, 31 Jan 2011 20:29:12 +0000 (22:29 +0200)]
mac80211: do not calc frame duration when using HW rate-control

When rate-control is performed in HW, we cannot calculate frame
duration as we do not have the skb transmission rate in SW.

ieee80211_tx_h_calculate_duration() should only be called when
ieee80211_tx_h_rate_ctrl() has been called before to initialize data
in skb->cb. This doesn't happen for drivers with HW rate-control.

Fixes the following warning when operating in AP-mode
in a driver with HW rate-control.

WARNING: at net/mac80211/tx.c:57 ieee80211_duration+0x54/0x1d8 [mac80211]()
Modules linked in: wl1271_sdio wl1271 firmware_class crc7 mac80211 cfg80211
[<c0046090>] (unwind_backtrace+0x0/0x124) from [<c0064c10>] (warn_slowpath_common+0x4c/0x64)
[<c0064c10>] (warn_slowpath_common+0x4c/0x64) from [<c0064c40>] (warn_slowpath_null+0x18/0x1c)
[<c0064c40>] (warn_slowpath_null+0x18/0x1c) from [<bf040e34>] (ieee80211_duration+0x54/0x1d8 [mac80211])
[<bf040e34>] (ieee80211_duration+0x54/0x1d8 [mac80211]) from [<bf04200c>] (invoke_tx_handlers+0xfa0/0x1088 [mac80211])
[<bf04200c>] (invoke_tx_handlers+0xfa0/0x1088 [mac80211]) from [<bf042178>] (ieee80211_tx+0x84/0x248 [mac80211])
[<bf042178>] (ieee80211_tx+0x84/0x248 [mac80211]) from [<bf042f44>] (ieee80211_tx_pending+0x12c/0x278 [mac80211])
[<bf042f44>] (ieee80211_tx_pending+0x12c/0x278 [mac80211]) from [<c0069a9c>] (tasklet_action+0x68/0xbc)
[<c0069a9c>] (tasklet_action+0x68/0xbc) from [<c006a044>] (__do_softirq+0x84/0x114)
[<c006a044>] (__do_softirq+0x84/0x114) from [<c006a1b8>] (do_softirq+0x48/0x54)
[<c006a1b8>] (do_softirq+0x48/0x54) from [<c006a4f8>] (local_bh_enable+0x98/0xcc)
[<c006a4f8>] (local_bh_enable+0x98/0xcc) from [<bf074e60>] (wl1271_rx+0x2e8/0x3a4 [wl1271])
[<bf074e60>] (wl1271_rx+0x2e8/0x3a4 [wl1271]) from [<bf071ae4>] (wl1271_irq_work+0x230/0x310 [wl1271])
[<bf071ae4>] (wl1271_irq_work+0x230/0x310 [wl1271]) from [<c0076864>] (process_one_work+0x208/0x350)
[<c0076864>] (process_one_work+0x208/0x350) from [<c0076e14>] (worker_thread+0x1cc/0x300)
[<c0076e14>] (worker_thread+0x1cc/0x300) from [<c007bb88>] (kthread+0x84/0x8c)
[<c007bb88>] (kthread+0x84/0x8c) from [<c0041494>] (kernel_thread_exit+0x0/0x8)

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Recalculate channel-type on iface removal.
Ben Greear [Mon, 31 Jan 2011 19:30:09 +0000 (11:30 -0800)]
mac80211: Recalculate channel-type on iface removal.

When a vif goes away, it could cause the super-chan
to be recalculated differently, so do that calculation
on iface removal.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: Show channel type and frequency in debugfs.
Ben Greear [Mon, 31 Jan 2011 18:37:36 +0000 (10:37 -0800)]
ath9k: Show channel type and frequency in debugfs.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: do not access hw registers in FULL SLEEP
Rajkumar Manoharan [Mon, 31 Jan 2011 18:17:46 +0000 (23:47 +0530)]
ath9k: do not access hw registers in FULL SLEEP

The opmode recalculation is accessing hw registers.
When it is called from remove interface callback and
if there are no vifs present then hw is moved to FULL SLEEP
by radio disable. So use power save wrappers before
accessing hw registers in calculating opmode state.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: make use common of function to update txpower
Rajkumar Manoharan [Mon, 31 Jan 2011 18:17:45 +0000 (23:47 +0530)]
ath9k_htc: make use common of function to update txpower

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: move update tx power to common
Rajkumar Manoharan [Mon, 31 Jan 2011 18:17:44 +0000 (23:47 +0530)]
ath9k: move update tx power to common

move ath_update_txpow to common to remove code duplication
in both ath9k & ath9k_htc.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: use common get current channel function
Rajkumar Manoharan [Mon, 31 Jan 2011 18:17:43 +0000 (23:47 +0530)]
ath9k: use common get current channel function

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: cancel ani work in ath9k_htc_stop
Rajkumar Manoharan [Mon, 31 Jan 2011 18:17:42 +0000 (23:47 +0530)]
ath9k_htc: cancel ani work in ath9k_htc_stop

ani work is cancelled in dissaoctiation. But in some cases
during suspend, deauthention never be called. So we failed
to stop ani work which was identified by the following
warning.

Call Trace:
 [<ffffffffa0454a1d>] ieee80211_can_queue_work.clone.17+0x2d/0x40 [mac80211]
 [<ffffffffa0454a60>] ieee80211_queue_delayed_work+0x30/0x60 [mac80211]
 [<ffffffffa0567f82>] ath9k_ani_work+0x142/0x250 [ath9k_htc]
 [<ffffffff81073c70>] async_run_entry_fn+0x0/0x180
 [<ffffffffa0567e40>] ath9k_ani_work+0x0/0x250 [ath9k_htc]

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agocfg80211: Fix power save state after interface type change
Juuso Oikarinen [Mon, 31 Jan 2011 13:52:58 +0000 (15:52 +0200)]
cfg80211: Fix power save state after interface type change

Currently cfg80211 only configures the PSM state to the driver upon creation
of a new virtual interface, but not after interface type change. The mac80211
on the other hand reinitializes its sdata structure every time the interface
type is changed, losing the PSM configuration.

Hence, if the interface type is changed to, say, ad-hoc and then back to
managed, "iw wlan0 get power_save" will claim that PSM is enabled, when in
fact on mac80211 level it is not.

Fix this in cfg80211 by configuring the PSM state to the driver each time
the interface is brought up instead of just when the interface is created.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowl1251: set rate index and preamble flag on received packets
David Gnedt [Sun, 30 Jan 2011 19:11:10 +0000 (20:11 +0100)]
wl1251: set rate index and preamble flag on received packets

Set the rate index rate_idx and preamble flag RX_FLAG_SHORTPRE on received
packets.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowl1251: enable adhoc mode
David Gnedt [Sun, 30 Jan 2011 19:11:04 +0000 (20:11 +0100)]
wl1251: enable adhoc mode

Enable adhoc support in wl1251 driver.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowl1251: implement connection quality monitoring
David Gnedt [Sun, 30 Jan 2011 19:11:00 +0000 (20:11 +0100)]
wl1251: implement connection quality monitoring

Implement connection quality monitoring similar to the wl1271 driver.
It triggers ieee80211_cqm_rssi_notify with the corresponding event when
RSSI drops blow RSSI threshold or rises again above the RSSI threshold.
It should be noted that wl1251 doesn't support RSSI hysteresis, instead it
uses RSSI averageing and delays events until a certain count of frames
proved RSSI change.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowl1251: enable beacon early termination while in power-saving mode
David Gnedt [Sun, 30 Jan 2011 19:10:57 +0000 (20:10 +0100)]
wl1251: enable beacon early termination while in power-saving mode

Port the beacon early termination feature from wl1251 driver version
included in the Maemo Fremantle kernel.
It is enabled when going to power-saving mode and disabled when leaving
power-saving mode.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowl1251: fix 4-byte TX buffer alignment
David Gnedt [Sun, 30 Jan 2011 19:10:48 +0000 (20:10 +0100)]
wl1251: fix 4-byte TX buffer alignment

This implements TX buffer alignment for cloned or too small skb by
copying and replacing the original skb.
Recent changes in wireless-testing seems to make this really necessary.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowl1251: fix queue stopping/waking for TX path
David Gnedt [Sun, 30 Jan 2011 19:10:46 +0000 (20:10 +0100)]
wl1251: fix queue stopping/waking for TX path

The queue stopping/waking functionality was broken in a way that could
cause the TX to stall if the right circumstances are met.

The problem was caused by tx_work, which is scheduled on each TX operation.
If the firmware buffer is full, tx_work does nothing. In combinition with
stopped queues or non-continues transfers, tx_work is never scheduled again.
Moreover the low watermark introduced by
9df86e2e702c6d5547aced7f241addd2d698bb11 never takes effect because of some
old code.

Solve this by scheduling tx_work every time tx_queue is non-empty and
firmware buffer is freed on tx_complete.

This also solves a possible but unlikely case: If less frames than the high
watermark are queued, but more than firmware buffer can hold. This results
in queues staying awake but the only scheduled tx_work doesn't transfer all
frames, so the remaining frames are stuck in the queue until more frames
get queued and tx_work is scheduled again.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Warn users if HT fails because of freq mismatch.
Ben Greear [Sat, 29 Jan 2011 01:05:43 +0000 (17:05 -0800)]
mac80211: Warn users if HT fails because of freq mismatch.

I have a netgear WNDR3700 that appears to have an off-by-four
bug in how it fills out the hti->control_chan (I configure the
AP to channel 11, it reports 15 as control_chan).

Poke a message into the kernel logs to give users a
clue as to why they are not getting the expected
channel-type or rate.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Show configured channel-type in netdev debugfs.
Ben Greear [Sat, 29 Jan 2011 01:05:42 +0000 (17:05 -0800)]
mac80211: Show configured channel-type in netdev debugfs.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: Be more careful when changing channels.
Ben Greear [Fri, 28 Jan 2011 18:20:47 +0000 (10:20 -0800)]
mac80211: Be more careful when changing channels.

If we cannot set the channel type, set the channel back to the
original.

Don't update the driver hardware if nothing actually changed.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agolibertas: Prepare stuff for if_spi.c pm support
Vasily Khoruzhick [Fri, 21 Jan 2011 20:44:49 +0000 (22:44 +0200)]
libertas: Prepare stuff for if_spi.c pm support

To support suspend/resume in if_spi we need two things:
- re-setup fw in lbs_resume(), because if_spi powercycles card;
- don't touch hwaddr on second lbs_update_hw_spec() call for same
  reason;

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agolibertas_spi: Use workqueue in hw_host_to_card
Vasily Khoruzhick [Fri, 21 Jan 2011 20:44:48 +0000 (22:44 +0200)]
libertas_spi: Use workqueue in hw_host_to_card

Use workqueue to perform SPI xfers, it's necessary to fix
nasty "BUG: scheduling while atomic", because
spu_write() calls spi_sync() and spi_sync() may sleep, but
hw_host_to_card() callback can be called from atomic context.
Remove kthread completely, workqueue now does its job.
Restore intermediate buffers which were removed in commit
86c34fe89e9cad9e1ba4d1a8bbf98259035f4caf that introduced
mentioned bug.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoMerge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
John W. Linville [Thu, 3 Feb 2011 21:35:20 +0000 (16:35 -0500)]
Merge branch 'wireless-next-2.6' of git://git./linux/kernel/git/iwlwifi/iwlwifi-2.6

13 years agoBluetooth: Set conn state to BT_DISCONN to avoid multiple responses
Bao Liang [Sat, 29 Jan 2011 13:39:37 +0000 (21:39 +0800)]
Bluetooth: Set conn state to BT_DISCONN to avoid multiple responses

This patch fixes a minor issue that two connection responses will be sent
for one L2CAP connection request. If the L2CAP connection request is first
blocked due to security reason and responded with reason "security block",
the state of the connection remains BT_CONNECT2. If a pairing procedure
completes successfully before the ACL connection is down, local host will
send another connection complete response. See the following packets
captured by hcidump.

2010-12-07 22:21:24.928096 < ACL data: handle 12 flags 0x00 dlen 16
    0000: 0c 00 01 00 03 19 08 00  41 00 53 00 03 00 00 00  ........A.S.....
... ...

2010-12-07 22:21:35.791747 > HCI Event: Auth Complete (0x06) plen 3
    status 0x00 handle 12
... ...

2010-12-07 22:21:35.872372 > ACL data: handle 12 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0054 scid 0x0040 result 0 status 0
      Connection successful

Signed-off-by: Liang Bao <tim.bao@gmail.com>
Acked-by: Ville Tervo <ville.tervo@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
John W. Linville [Tue, 1 Feb 2011 17:01:27 +0000 (12:01 -0500)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-2.6

Conflicts:
drivers/net/wireless/wl12xx/spi.c

13 years agoath9k: Fix memory leak due to failed PAPRD frames
Mohammed Shafi Shajakhan [Mon, 31 Jan 2011 07:55:29 +0000 (13:25 +0530)]
ath9k: Fix memory leak due to failed PAPRD frames

free the skb's when the Tx of PAPRD frames fails and also add a debug
message indicating that.

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoiiwlagn: remove unused parameter
Wey-Yi Guy [Sat, 29 Jan 2011 16:13:27 +0000 (08:13 -0800)]
iiwlagn: remove unused parameter

sco_cmd is not being used, remove it

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: remove unsupported BT SCO command
Wey-Yi Guy [Thu, 27 Jan 2011 21:01:33 +0000 (13:01 -0800)]
iwlagn: remove unsupported BT SCO command

During the period of BT coex changes, REPLY_BT_COEX_SCO host command
is no longer needed to support SCO/eSCO type of traffic. delete it.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: use 2030 macro for 2030 devices
Wey-Yi Guy [Mon, 24 Jan 2011 19:44:42 +0000 (11:44 -0800)]
iwlagn: use 2030 macro for 2030 devices

For 2030 series of devices, 2030 macro need to be used.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlwifi: fix beacon notification parsing
Johannes Berg [Wed, 19 Jan 2011 19:11:22 +0000 (11:11 -0800)]
iwlwifi: fix beacon notification parsing

The beacon notification changed between 4965 and
agn because the embedded TX response changed, but
iwlwifi was never updated to know about this.
Update it now so the IBSS manager status will be
tracked correctly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlwifi: use maximum aggregation size
Johannes Berg [Wed, 19 Jan 2011 10:53:54 +0000 (02:53 -0800)]
iwlwifi: use maximum aggregation size

Use the values from the peer to set up the ucode
for the right maximum number of subframes in an
aggregate. Since the ucode only tracks this per
station, use the minimum across all aggregation
sessions with this peer.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>