openwrt/staging/blogic.git
12 years agoiwlwifi: fix FW restart on init FW
Amit Beka [Mon, 6 Aug 2012 14:01:05 +0000 (17:01 +0300)]
iwlwifi: fix FW restart on init FW

When unregistered with mac80211, we can't call its functionality
for FW restart, so avoid it and prevent automatic FW restart for
the init firmware.

Signed-off-by: Amit Beka <amit.beka@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: fix the preparation of the card
Emmanuel Grumbach [Sun, 5 Aug 2012 13:55:06 +0000 (16:55 +0300)]
iwlwifi: fix the preparation of the card

There is no need to check if the ownership has been
relinquished but we should rather try to get it in a
loop.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: reduce max remain-on-channel duration
Johannes Berg [Wed, 25 Jul 2012 15:06:47 +0000 (17:06 +0200)]
iwlwifi: reduce max remain-on-channel duration

Due to the way the PAN parameters are set up, the
maximum duration isn't 1000 but much lower, set it
to 500 which is safe (somewhere around 550 might
be possible.)

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: get the correct HCMD in the response handler
Emmanuel Grumbach [Mon, 23 Jul 2012 22:58:32 +0000 (01:58 +0300)]
iwlwifi: get the correct HCMD in the response handler

Until now, the response handler of a Host Command got the
exact same pointer that was also given to the DMA engine.
We almost never need to the Host Command that was sent while
handling its response, but when we do need it, we see that
the command has been modified.

This mystery has been elucidated. The FH (our DMA engine)
writes its meta data on the buffer in the DRAM. Of course it
copies the buffer to the NIC first. This was known to happen
for Tx command, but as a matter of fact, it happens to all
TFD brought by the FH which doesn't care much about what it
brings from DRAM to internal SRAM.

So copy the Host Command to yet another buffer so that we
can properly pass the buffer that was sent originally to the
fw. Do that only if it was request by the user since very
few flows need to get the HCMD sent in the response handler.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: fix aggregation check indentation
Johannes Berg [Wed, 18 Jul 2012 14:36:57 +0000 (16:36 +0200)]
iwlwifi: fix aggregation check indentation

Align the code to inside the WARN_ON() as it should.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: rework the iwlwifi debugfs structure
Meenakshi Venkataraman [Tue, 17 Jul 2012 01:43:56 +0000 (18:43 -0700)]
iwlwifi: rework the iwlwifi debugfs structure

The generic part of the driver now creates all debugfs
directories. It creates a root directory directly in
the the root of the debugfs filesystem and within that
directories for each device, named after the device ID
of the devices iwlwifi is attached to.

In the cfg80211/mac80211 directory there's now a link
to the toplevel iwlwifi debugfs directory to make it
easier to find the debugfs files.

Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: clean up properly when registration with mac80211 fails
Meenakshi Venkataraman [Tue, 17 Jul 2012 20:05:03 +0000 (13:05 -0700)]
iwlwifi: clean up properly when registration with mac80211 fails

If registration with mac80211 fails, stop the thermal
throttling and testmode work that were previously started.

Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoiwlwifi: s/iwl_ucode_callback/iwl_req_fw_callback
Emmanuel Grumbach [Mon, 16 Jul 2012 09:31:28 +0000 (12:31 +0300)]
iwlwifi: s/iwl_ucode_callback/iwl_req_fw_callback

This name emphasizes more the role of the function: the
callback called when the ASYNC call to request_firmware
completes.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agolibertas: firmware.c: remove duplicated include
Duan Jiong [Thu, 19 Jul 2012 16:36:34 +0000 (12:36 -0400)]
libertas: firmware.c: remove duplicated include

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
12 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Thu, 19 Jul 2012 16:35:00 +0000 (12:35 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

12 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth...
John W. Linville [Wed, 18 Jul 2012 18:53:10 +0000 (14:53 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/bluetooth/bluetooth-next

12 years agomac80211: flush stations before stop beaconing
Eliad Peller [Wed, 18 Jul 2012 12:36:04 +0000 (15:36 +0300)]
mac80211: flush stations before stop beaconing

When AP interface is going down, the stations
are flushed (in ieee80211_do_stop()) only after
the beaconing was stopped.

However, drivers might rely on stations being
removed before the beaconing was stopped, in
order to clean up properly.

Fix it by flushing the stations on ap stop.

(we already do the same for other interface
types, e.g. in ieee80211_set_disassoc())

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: Fix mutex locking in reg_last_request_cell_base
Mohammed Shafi Shajakhan [Wed, 18 Jul 2012 12:41:29 +0000 (18:11 +0530)]
cfg80211: Fix mutex locking in reg_last_request_cell_base

should fix the following issue

[ 3229.815012] [ BUG: lock held when returning to user space! ]
[ 3229.815016] 3.5.0-rc7-wl #28 Tainted: G        W  O
[ 3229.815017]
------------------------------------------------
[ 3229.815019] wpa_supplicant/5783 is leaving the kernel with locks still held!
[ 3229.815022] 1 lock held by wpa_supplicant/5783:
[ 3229.815023]  #0: (reg_mutex){+.+.+.}, at: [<fa65834d>]
reg_last_request_cell_base+0x1d/0x60 [cfg80211]

Cc: Luis Rodriguez <mcgrof@gmail.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Tested-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agowlcore: increase command completion timeout
Luciano Coelho [Wed, 18 Jul 2012 12:05:24 +0000 (15:05 +0300)]
wlcore: increase command completion timeout

In some rare cases, the CMD_ROC completion may take over 1 second.
The timeout had earlier been increased to 1000ms (from 750ms), but it
is still not enoug.  Increase it to 1500ms.

Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: wait for command completion event when sending CMD_ROLE_STOP
Luciano Coelho [Wed, 18 Jul 2012 11:58:59 +0000 (14:58 +0300)]
wlcore: wait for command completion event when sending CMD_ROLE_STOP

We need to wait for the command completion event when we send the
CMD_ROLE_STOP event otherwise we may try to send CMD_ROLE_START too
soon and get out-of-sync with the firmware.

In some cases, the firmware may not send the event, so we wait for the
event or for the timeout, whichever comes first.

This patch is based on an earlier version by Eliad.

Cc: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowl18xx: enable MIMO rates when connected as a MIMO STA
Arik Nemtsov [Thu, 12 Jul 2012 09:29:46 +0000 (12:29 +0300)]
wl18xx: enable MIMO rates when connected as a MIMO STA

Use this opportunity to consolidate the check for MIMO support into a
separate function.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: make usage of nla_put clearer
Yair Shapira [Wed, 11 Jul 2012 15:48:07 +0000 (18:48 +0300)]
wlcore: make usage of nla_put clearer

handle errors of nla_put() inside the if(nla_put...) {}

This makes the code simpler and clearer because:
we take advantage from the fact that we have only one nla_put
in our routines (so no real need for goto label).
this avoids ugly goto forward followed by goto backward.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore/wl12xx: calibrator fem detect implementation
Yair Shapira [Wed, 11 Jul 2012 15:48:06 +0000 (18:48 +0300)]
wlcore/wl12xx: calibrator fem detect implementation

this completes the calibrator based fem detect logic in driver:
driver starts (by calibrator) in plt_mode PLT_FEM_DETECT
wlcore inits and starts plt on wl12xx
wl12xx fetches fem number from firmware and stores it in wl->fem_manuf
wl12xx immediatly returns (doesn't start radio, etc...)
wlcore returns the fem_manuf to calibrator using WL1271_TM_ATTR_DATA
plt_mode is stopped

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowl18xx: disable calibrator based fem detect
Yair Shapira [Wed, 11 Jul 2012 15:48:05 +0000 (18:48 +0300)]
wl18xx: disable calibrator based fem detect

bip calibration is not required in wl18xx. Therefore we
disable also auto fem (using calibrator fem detect) mode.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: add plt_mode including new PLT_FEM_DETECT
Yair Shapira [Wed, 11 Jul 2012 15:48:04 +0000 (18:48 +0300)]
wlcore: add plt_mode including new PLT_FEM_DETECT

add wl->plt_mode that is used to indicate different plt
working modes: this will be used to implement calibrator side
auto fem detection where driver asks firmware to detect
the wlan fem radio type and returns it to calibrator.

this is not implemented yet and plt_modes: PLT_ON and
PLT_FEM_DETECT currently behave the same.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: use basic rates for non-data packets
Eliad Peller [Wed, 11 Jul 2012 15:01:49 +0000 (18:01 +0300)]
wlcore: use basic rates for non-data packets

After the latest mac80211 changes, the sta has
the ap's sta pointer even before association.

This cause the auth and assoc frames to be sent
with the standard ap's rates, rather than the
basic rates.

Change the tx rate policy logic to use the regular
ap rates only for data packets (so control and mgmt
packets will be sent with basic rates)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: don't issue SLEEP_AUTH command during recovery
Arik Nemtsov [Tue, 10 Jul 2012 07:45:01 +0000 (10:45 +0300)]
wlcore: don't issue SLEEP_AUTH command during recovery

During interface removal, don't adjust sleep_auth if we are during
recovery. Since the FW is potentially dead we shouldn't talk to it.

Reported-by: Yossi Wortzel <yossiw@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowl18xx: fix bogus compile warning on cc config option
Arik Nemtsov [Sun, 8 Jul 2012 14:41:22 +0000 (17:41 +0300)]
wl18xx: fix bogus compile warning on cc config option

Initialize val to 0, to remove the following warning with
CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler used was gcc 4.4.1
(Sourcery G++ Lite 2010q1-202).

drivers/net/wireless/ti/wl18xx/io.c: In function 'wl18xx_top_reg_read':
drivers/net/wireless/ti/wl18xx/io.c:57: warning: 'val' may be used uninitialized in this function

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: send EAPOLs using minimum basic rate for all roles
Igal Chernobelsky [Wed, 27 Jun 2012 08:09:34 +0000 (11:09 +0300)]
wlcore: send EAPOLs using minimum basic rate for all roles

Send EAPOLs using minimum basic rate for AP, STA, p2p GO and Client.
The patch fixes p2p connection issue with Realtek device in p2p
certification test 5.1.13 (DEVUT reinvokes Persistent Group).

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowl18xx: add support for ht_mode in conf.h
Yair Shapira [Thu, 5 Jul 2012 15:11:30 +0000 (15:11 +0000)]
wl18xx: add support for ht_mode in conf.h

ht_mode added to wl18xx conf struct in order to support different modes
from the configuration file, as well as module params, and by default
(working without a conf file and/or no module params).
the hack regarding conf.phy.low_band_component_type for each board
is now explicitly handled after parsing module params.
missing default values to wl18xx config added.
fix string module params not to have defaults (so if empty, param
can be taken from conf file).
update conf version to 3.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowlcore: don't re-configure wakeup conditions if not needed
Eyal Shapira [Thu, 5 Jul 2012 16:05:17 +0000 (19:05 +0300)]
wlcore: don't re-configure wakeup conditions if not needed

suspend and resume callbacks configure wakeup conditions to the FW
which may be different between suspend and resume.
This feature is currently not utilized as both in suspend and resume
FW wakeup every 1 DTIM. Avoid waking up the chip and doing the FW command
unless there's an actual difference in the wakeup conditions.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agowl18xx: alloc conf.phy memory to ensure alignemnt
Arik Nemtsov [Thu, 5 Jul 2012 14:30:58 +0000 (17:30 +0300)]
wl18xx: alloc conf.phy memory to ensure alignemnt

We get DMA alignment trouble if the beginning of the conf.phy struct is
not aligned to 4 bytes. Use kmemdup to ensure alignment.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
12 years agob43: fix crash with OpenFWWF
Johannes Berg [Tue, 17 Jul 2012 15:12:29 +0000 (17:12 +0200)]
b43: fix crash with OpenFWWF

b43 with open firmware crashes mac80211 because
it changes the number of queues at runtime which,
while it was never really supported, now crashes
mac80211 due to the new hardware queue logic.

Fix this by detecting open vs. proprietary fw
earlier and registering with mac80211 with the
right number of queues.

Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Cc: stable@vger.kernel.org (depends on commit a6f38ac3)
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Tue, 17 Jul 2012 19:31:33 +0000 (15:31 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

12 years agobcma: add place for flash memory support
Rafał Miłecki [Tue, 17 Jul 2012 14:26:41 +0000 (16:26 +0200)]
bcma: add place for flash memory support

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Fix race in reset-work usage
Rajkumar Manoharan [Tue, 17 Jul 2012 11:46:42 +0000 (17:16 +0530)]
ath9k: Fix race in reset-work usage

Using work_pending() to defer certain operations when
a HW-reset work has been queued is racy since the check
would return false when the work item is actually in
execution. Use SC_OP_HW_RESET instead to fix this race.
Also, unify the reset debug statistics maintenance.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Reconfigure VIF state properly
Sujith Manoharan [Tue, 17 Jul 2012 11:46:36 +0000 (17:16 +0530)]
ath9k: Reconfigure VIF state properly

When an interface in AP or P2P-GO mode is removed,
check whether a station interface is already present and
reconfigure the beacon timers etc. properly if it's
associated.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Fix ANI management
Sujith Manoharan [Tue, 17 Jul 2012 11:46:29 +0000 (17:16 +0530)]
ath9k: Fix ANI management

Currently, there are problems with how ANI is handled in
multi-VIF scenarios. This patch addresses them by unifying
the start/stop logic.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Cleanup the beacon tasklet
Sujith Manoharan [Tue, 17 Jul 2012 11:46:22 +0000 (17:16 +0530)]
ath9k: Cleanup the beacon tasklet

Remove unused variables, use a helper function to choose
the slot and reset beaconing status at one place.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Set the TSF adjust value properly
Sujith Manoharan [Tue, 17 Jul 2012 11:46:16 +0000 (17:16 +0530)]
ath9k: Set the TSF adjust value properly

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Cleanup beacon queue configuration
Sujith Manoharan [Tue, 17 Jul 2012 11:46:09 +0000 (17:16 +0530)]
ath9k: Cleanup beacon queue configuration

Setup the beacon queue parameters after disabling
interrupts. Also, remove the redundant call in conf_tx()
for IBSS mode since the queue would be configured
with the appropriate cwmin/cwmax values when beaconing
is enabled.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Remove is_bslot_active
Sujith Manoharan [Tue, 17 Jul 2012 11:46:03 +0000 (17:16 +0530)]
ath9k: Remove is_bslot_active

In the tx_last_beacon() callback, mac80211's beaconing
status can be used instead. The beacon tasklet doesn't require
it because it is disabled when removing a slot.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Cleanup beacon logic
Sujith Manoharan [Tue, 17 Jul 2012 11:45:56 +0000 (17:15 +0530)]
ath9k: Cleanup beacon logic

* The beaconing status routine is not required, since in
  multi-VIF cases the HW beacon parameters should not be
  re-configured.

* Remove SC_OP_TSF_RESET - when a beaconing interface comes
  up the first time, the TSF has to be reset.

* Simplify ath9k_allow_beacon_config().

* Handle setting/clearing the SWBA interrupt properly.

* Remove the TSF mangling in IBSS mode, it is not required.

* General code cleanup.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Simplify ASSOC handling
Sujith Manoharan [Tue, 17 Jul 2012 11:45:50 +0000 (17:15 +0530)]
ath9k: Simplify ASSOC handling

Cleanup the messy logic dealing with station association
and disassociation.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Cleanup interface handling
Sujith Manoharan [Tue, 17 Jul 2012 11:45:43 +0000 (17:15 +0530)]
ath9k: Cleanup interface handling

* Do not set/clear TSF when adding/deleting an interface.
  This should be done when the BSS is set up and should also
  take into account the existence of other interfaces.

* Set opmode explicitly.

* ANI setup needs to be decided based on multiple interfaces.
  This can be done via the bss_info_changed() callback.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: Cleanup ath9k_hw_set_tsfadjust
Sujith Manoharan [Tue, 17 Jul 2012 11:45:37 +0000 (17:15 +0530)]
ath9k_hw: Cleanup ath9k_hw_set_tsfadjust

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Fix beacon setup
Sujith Manoharan [Tue, 17 Jul 2012 11:45:30 +0000 (17:15 +0530)]
ath9k: Fix beacon setup

This patch revamps interface addition and deletion and simplifies
slot allocation. There is no need to setup the beacon buffer
in add/remove interface, remove this and use simple APIs for
assigning/deleting slots.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath5k: fix txop limit handling
Felix Fietkau [Mon, 16 Jul 2012 17:49:07 +0000 (19:49 +0200)]
ath5k: fix txop limit handling

Same as the recent ath9k fix

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobcma: cc: update defines
Rafał Miłecki [Mon, 16 Jul 2012 09:46:52 +0000 (11:46 +0200)]
bcma: cc: update defines

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agolibertas USB: don't set surpriseremoved flag
Daniel Drake [Sun, 15 Jul 2012 22:48:00 +0000 (23:48 +0100)]
libertas USB: don't set surpriseremoved flag

We found a deadlock in the handling of command failures/reset conditions.
For example:

 1. Two commands are in the queue.
 2. The first command is sent, but causes a timeout, which kicks off an
    asynchronous device reset
 3. The second command is queued (but not yet sent to the hardware)
 4. The device reset kicks in, causing the if_usb disconnect handler to
    set the "surprise removed" flag to be set as the device disappears
    from the bus. This causes lbs_thread to stop processing things
    ("adapter removed; waiting to die"), not processing any further
    commands, leaving the second queued command "in the air", causing a
    deadlock.

Fix this by removing the surpriseremoved flag setting in if_usb. I can't
see any reason why this needs to be done so early. lbs_remove_card will set
this flag at an appropriate time - i.e. after all pending commands have
been completed or cancelled, avoiding this deadlock.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agolibertas: handle command failure immediately
Daniel Drake [Sun, 15 Jul 2012 22:47:51 +0000 (23:47 +0100)]
libertas: handle command failure immediately

Fail commands immediately when the request cannot be sent to the hardware.

This solves the following deadlock:
 1. Two commands are in the queue.
 2. The first command is sent, but causes a timeout, which kicks off an
    asynchronous device reset
 3. The second command is submitted to the device, and fails. The failure
    is noted but the existing code waits for the timeout handler to take
    care of the failure.
 4. The device reset kicks in, causing the device "surprise removed" flag
    to be set as the device disappears from the bus.
 5. lbs_thread notes this and enters "adapter removed; waiting to die"
    mode, without processing any further command timeouts.

While adjusting lbs thread logic to handle this situation may be one way
to fix this, it seems more practical to simplify handling of host_to_card
failure so that the commands are failed immediately without waiting for
more compliated timeout logic to kick in.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agolibertas: Update 11d info only when interface is active
Daniel Drake [Sun, 15 Jul 2012 22:44:58 +0000 (23:44 +0100)]
libertas: Update 11d info only when interface is active

reg_notifier can be called before the interface is up.
Handle this correctly by storing the requested country code, then
apply the relevant configuration when the interface is brought up.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: fix SREV checks for applying tuning caps from EEPROM
Felix Fietkau [Sun, 15 Jul 2012 17:53:40 +0000 (19:53 +0200)]
ath9k_hw: fix SREV checks for applying tuning caps from EEPROM

AR9485, AR9330 and AR9340 are the chips that this is *NOT* supposed to be
applied on.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: apply XLNA bias settings from EEPROM
Felix Fietkau [Sun, 15 Jul 2012 17:53:39 +0000 (19:53 +0200)]
ath9k_hw: apply XLNA bias settings from EEPROM

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: clean up AR9003 EEPROM code
Felix Fietkau [Sun, 15 Jul 2012 17:53:38 +0000 (19:53 +0200)]
ath9k_hw: clean up AR9003 EEPROM code

- add an inline function for getting the correct modal EEPROM struct
- remove unnecessary indirection through ath9k_hw_ar9300_get_eeprom
  access the relevant fields directly

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: apply XPA timing control values from EEPROM
Felix Fietkau [Sun, 15 Jul 2012 17:53:37 +0000 (19:53 +0200)]
ath9k_hw: apply XPA timing control values from EEPROM

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: fix aggregate size limit based on queue TXOP limit
Felix Fietkau [Sun, 15 Jul 2012 17:53:36 +0000 (19:53 +0200)]
ath9k: fix aggregate size limit based on queue TXOP limit

If the aggregate size exceeds the TXOP limit, it leads to lots of unnecessary
hardware and software retries.

The previous 4ms frame limit table was completely undocumented, the commit
that updated it only vaguely referenced and equation from the standard,
but I've been unable to replicate its results.

Fix this by using a formula based on the code in ath_pkt_duration, which is
more likely to be correct for this case.

Reported-by: Dave Täht <dave.taht@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: make per-WMM-AC queue sizes configurable via debugfs
Felix Fietkau [Sun, 15 Jul 2012 17:53:35 +0000 (19:53 +0200)]
ath9k: make per-WMM-AC queue sizes configurable via debugfs

Prepare for using different queue size defaults for each AC.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k/ath9k_htc: fix txop limit handling
Felix Fietkau [Sun, 15 Jul 2012 17:53:34 +0000 (19:53 +0200)]
ath9k/ath9k_htc: fix txop limit handling

In all those years apparently nobody noticed that the txop limit programmed
into the chip was off by a factor of 32 (!), probably because the VI and VO
queues aren't used that much aside from mgmt frames on VO.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: remove redundant arguments to INIT_INI_ARRAY
Felix Fietkau [Sun, 15 Jul 2012 17:53:33 +0000 (19:53 +0200)]
ath9k_hw: remove redundant arguments to INIT_INI_ARRAY

The row/column sizes can be derived from the array argument within the macro
itself, which is less error prone. In a few cases the supplied column size
was actually wrong.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: fix tx gain tables for AR934x
Felix Fietkau [Sun, 15 Jul 2012 17:53:32 +0000 (19:53 +0200)]
ath9k_hw: fix tx gain tables for AR934x

Use the EEPROM information to choose the right tx gain table

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: enable ANI on AR934x
Felix Fietkau [Sun, 15 Jul 2012 17:53:31 +0000 (19:53 +0200)]
ath9k_hw: enable ANI on AR934x

It has been tested and works properly

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: validate rx antenna settings
Felix Fietkau [Sun, 15 Jul 2012 17:53:30 +0000 (19:53 +0200)]
ath9k: validate rx antenna settings

Many chips are not able to deal with non-consecutive rx antenna selections
and respond with calibration errors, reset errors, etc.
When an antenna is selected as a tx antenna, also flag it for rx to avoid
chip issues.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: fall back to OTP ROM when platform data has no valid eeprom data
Felix Fietkau [Sun, 15 Jul 2012 17:53:29 +0000 (19:53 +0200)]
ath9k_hw: fall back to OTP ROM when platform data has no valid eeprom data

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: improvement in cfg80211 set_bitrate_mask handler
Amitkumar Karwar [Sat, 14 Jul 2012 03:09:33 +0000 (20:09 -0700)]
mwifiex: improvement in cfg80211 set_bitrate_mask handler

This patch configures data rates to firmware using bitrate mask
provided by cfg80211.

Earlier we used to only update band information in this handler
which will be used later for ibss network. Due to recent
modifications in ibss join code we don't need to do that.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: add support to use basic rates in ibss join request
Amitkumar Karwar [Sat, 14 Jul 2012 03:09:32 +0000 (20:09 -0700)]
mwifiex: add support to use basic rates in ibss join request

In mwifiex_set_rf_channel() ibss specific flags were unnecessarily
getting modified for infra and AP mode. This patch removes
mwifiex_set_rf_channel() function and adds equivalant code in infra,
ibss and AP path.

For ibss, now we are chosing band based on channel type and basic
rates provided in ibss join request. We can start ibss network in
A only, B only, G only, BG, BGN, AN mode.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: remove unnecessary code in data rate configuration
Amitkumar Karwar [Sat, 14 Jul 2012 03:09:31 +0000 (20:09 -0700)]
mwifiex: remove unnecessary code in data rate configuration

1) Remove unnecessary wrapper functions.
2) Currently we don't have command to set Tx data rate, so
mwifiex_rate_ioctl_set_rate_value() function and related code
can be removed.
3) "ds_rate" filled by mwifiex_ret_tx_rate_cfg() is never used.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: remove redundant code in set channel path
Amitkumar Karwar [Sat, 14 Jul 2012 03:09:30 +0000 (20:09 -0700)]
mwifiex: remove redundant code in set channel path

1) Recently we removed set_channel cfg80211 handler. Also, cfg80211
blocks ibss connection requests if ibss network is already started
/joined. Hence the code to restart ibss network in new channel
(mwifiex_drv_change_adhoc_chan() function) becomes redundant.

2) mwifiex_bss_set_channel() function is redundant. It does some
error checking and calculate adhoc start band and adhoc channel.
Cfg80211 already takes care of error checking and provides correct
channel information to the driver. Adhoc start band is already
calculated in mwifiex_set_rf_channel() function.

Other associated code is also removed in this patch.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: fix 5 GHz frequency selection on AR934x/AR955x with 25 MHz refclock
Felix Fietkau [Fri, 13 Jul 2012 23:26:54 +0000 (01:26 +0200)]
ath9k_hw: fix 5 GHz frequency selection on AR934x/AR955x with 25 MHz refclock

The old code was an accidental copy&paste of the 2.4 GHz version,
which doesn't work.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agortlwifi: rtl8192de: Fix phy-based version calculation
Forest Bond [Fri, 13 Jul 2012 16:26:06 +0000 (12:26 -0400)]
rtlwifi: rtl8192de: Fix phy-based version calculation

Commit d83579e2a50ac68389e6b4c58b845c702cf37516 incorporated some
changes from the vendor driver that made it newly important that the
calculated hardware version correctly include the CHIP_92D bit, as all
of the IS_92D_* macros were changed to depend on it.  However, this bit
was being unset for dual-mac, dual-phy devices.  The vendor driver
behavior was modified to not do this, but unfortunately this change was
not picked up along with the others.  This caused scanning in the 2.4GHz
band to be broken, and possibly other bugs as well.

This patch brings the version calculation logic in parity with the
vendor driver in this regard, and in doing so fixes the regression.
However, the version calculation code in general continues to be largely
incoherent and messy, and needs to be cleaned up.

Signed-off-by: Forest Bond <forest.bond@rapidrollout.com>
Cc: Stable <stable@vger.kernel.org> [v3.2+]
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agob43: use temporary rate_index for error checking
Johannes Berg [Fri, 13 Jul 2012 08:57:36 +0000 (10:57 +0200)]
b43: use temporary rate_index for error checking

The mac80211 rate_index changed to be a u8, so
can't hold the negative error value properly.
Use a temporary variable for error checking.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: make CONFIG_ATH9K_DFS_CERTIFIED depend on CFG80211_CERTIFICATION_ONUS
Luis R. Rodriguez [Tue, 10 Jul 2012 17:24:54 +0000 (10:24 -0700)]
ath9k: make CONFIG_ATH9K_DFS_CERTIFIED depend on CFG80211_CERTIFICATION_ONUS

Turns out every most standard Linux distributions enable
CONFIG_EXPERT, so use the shiny new CFG80211_CERTIFICATION_ONUS
which is meant by design to not be enabled by all Linux
distributions.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Tue, 17 Jul 2012 19:07:31 +0000 (15:07 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

12 years agoBluetooth: Introduce a flags variable to Three-wire UART state
Johan Hedberg [Mon, 16 Jul 2012 13:12:19 +0000 (16:12 +0300)]
Bluetooth: Introduce a flags variable to Three-wire UART state

This patch introduces a flags variable to the Three-wire UART state
struct and converts the two existing bools in the struct into flags.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Improve Three-wire UART configuration handling
Johan Hedberg [Mon, 16 Jul 2012 13:12:18 +0000 (16:12 +0300)]
Bluetooth: Improve Three-wire UART configuration handling

The configuration request/response messages contain a configuration
field which contains the sliding window size (amount of unacked reliable
packets that can be pending). This patch makes sure that we configure
the correct size (minimum of local and remote values) and use it when
determining whether to send new packets or not.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Remove unnecessary h5_build_pkt function
Johan Hedberg [Mon, 16 Jul 2012 13:12:17 +0000 (16:12 +0300)]
Bluetooth: Remove unnecessary h5_build_pkt function

The implementation of h5_build_packet can be moved into
h5_prepare_pkt since all h5_prepare_pkt does is determine whether the
packet is reliable and then call h5_build_packet.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Implement proper low-power support for Three-wire UART
Johan Hedberg [Mon, 16 Jul 2012 13:12:16 +0000 (16:12 +0300)]
Bluetooth: Implement proper low-power support for Three-wire UART

This patch adds on-demand wakeup request sending (and re-sendind) when
we are in low-power state. When the controller enters this state it will
send a sleep message after which the host is not allowed to send any
other packets until a wakeup request has been sent and the woken message
received as a response to it. The wakeup requests are re-sent
periodically until a woken message is received.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add initialization tracking to HCI Three-wire driver
Johan Hedberg [Mon, 16 Jul 2012 13:12:15 +0000 (16:12 +0300)]
Bluetooth: Add initialization tracking to HCI Three-wire driver

This patch adds tracking for the uninitialized, initialized and active
states for Three-wire UART. This is needed so we can handle periodic
sending of the Link Establishment messages before reaching active state
and so that we do not try to do any higher level HCI data transmission
before reaching active state.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add initial sleep support to Three-wire UART
Johan Hedberg [Mon, 16 Jul 2012 13:12:14 +0000 (16:12 +0300)]
Bluetooth: Add initial sleep support to Three-wire UART

This patch adds very basic support for the sleep related messages. The
only thing the code does right now is send a wakeup message as soon as
receiving a sleep one, essentially preventing the controller from going
to sleep.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Improve rx debug logs for Three-wire UART
Johan Hedberg [Mon, 16 Jul 2012 13:12:13 +0000 (16:12 +0300)]
Bluetooth: Improve rx debug logs for Three-wire UART

Remove unnecessary debug logs and add some to more centralized places.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Use delayed init for Three-wire UART
Johan Hedberg [Mon, 16 Jul 2012 13:12:12 +0000 (16:12 +0300)]
Bluetooth: Use delayed init for Three-wire UART

This patch takes into use the delayed initialization feature that the
Bluetooth UART framework provides.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add delayed init sequence support for UART controllers
Johan Hedberg [Mon, 16 Jul 2012 13:12:11 +0000 (16:12 +0300)]
Bluetooth: Add delayed init sequence support for UART controllers

This patch makes it possible to have UART drivers perform an internal
initialization before calling hci_register_dev. This allows moving a lot
of init code from user space (hciattach) to the kernel side, thereby
creating a more controlled/robust initialization process.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Simplify hci_uart_tty_close logic
Johan Hedberg [Mon, 16 Jul 2012 13:12:10 +0000 (16:12 +0300)]
Bluetooth: Simplify hci_uart_tty_close logic

This patch cleans up and reduces indentation in the hci_uart_tty_close
function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add support for Three-wire Link Control packets
Johan Hedberg [Mon, 16 Jul 2012 13:12:09 +0000 (16:12 +0300)]
Bluetooth: Add support for Three-wire Link Control packets

This patch adds basic support for parsing and sending Three-wire UART
Link Control packets.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Fix/implement Three-wire reliable packet sending
Johan Hedberg [Mon, 16 Jul 2012 13:12:08 +0000 (16:12 +0300)]
Bluetooth: Fix/implement Three-wire reliable packet sending

This patch should complete the necessary code for sending reliable
Three-wire packets.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add Three-wire header value convenience macros
Johan Hedberg [Mon, 16 Jul 2012 13:12:07 +0000 (16:12 +0300)]
Bluetooth: Add Three-wire header value convenience macros

This patch adds convenience macros for reading Three-wire header values.
This will help make the code more readable.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add initial packet sending support to Three-wire UART
Johan Hedberg [Mon, 16 Jul 2012 13:12:06 +0000 (16:12 +0300)]
Bluetooth: Add initial packet sending support to Three-wire UART

This patch adds initial packed encoding and sending support to the
Three-wire UART HCI transport driver.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add basic packet parsing to Three-wire UART driver
Johan Hedberg [Mon, 16 Jul 2012 13:12:05 +0000 (16:12 +0300)]
Bluetooth: Add basic packet parsing to Three-wire UART driver

This patch adds basic packet parsing to the Three-wire UART HCI driver
for packets received from the controller.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add initial reliable packet support for Three-wire UART
Johan Hedberg [Mon, 16 Jul 2012 13:12:04 +0000 (16:12 +0300)]
Bluetooth: Add initial reliable packet support for Three-wire UART

This patch adds initial support for reliable packets along with the
necessary retransmission timer for the Three-wire UART HCI driver.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Add basic state tracking to Three-wire UART driver
Johan Hedberg [Mon, 16 Jul 2012 13:12:03 +0000 (16:12 +0300)]
Bluetooth: Add basic state tracking to Three-wire UART driver

This patch adds basic state tracking and socket buffer handling to the
Three-wire UART (H5) HCI driver.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Initial skeleton for Three-wire UART (H5) support
Johan Hedberg [Mon, 16 Jul 2012 13:12:02 +0000 (16:12 +0300)]
Bluetooth: Initial skeleton for Three-wire UART (H5) support

This patch adds the initial skeleton for Three-wire UART (H5) support
and hooks it up to the HCI UART framework.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agomac80211: go out of PS before sending disassoc
Eliad Peller [Thu, 12 Jul 2012 14:35:33 +0000 (17:35 +0300)]
mac80211: go out of PS before sending disassoc

on disassoc, ieee80211_set_disassoc() goes out of PS
before indicating BSS_CHANGED_ASSOC (not sure why this
is needed, but some drivers might count on the current
behavior).

However, it does it after sending the disassoc
frame, which results in null-data frame being sent
(in order to go out of ps) after we were already sent
the disassoc, which is invalid.

Fix it by going out of ps before sending the disassoc.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: remove regulatory_update()
Luis R. Rodriguez [Thu, 12 Jul 2012 18:49:21 +0000 (11:49 -0700)]
cfg80211: remove regulatory_update()

regulatory_update() just calls wiphy_update_regulatory().
wiphy_update_regulatory() assumes you already have
the reg_mutex held so just move the call within locking
context and kill the superfluous regulatory_update().

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: make regulatory_update() static
Luis R. Rodriguez [Thu, 12 Jul 2012 18:49:20 +0000 (11:49 -0700)]
cfg80211: make regulatory_update() static

Now that we have wiphy_regulatory_register() we can
tuck away the core's regulatory_update() call there
and make it static.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: rename reg_device_remove() to wiphy_regulatory_deregister()
Luis R. Rodriguez [Thu, 12 Jul 2012 18:49:19 +0000 (11:49 -0700)]
cfg80211: rename reg_device_remove() to wiphy_regulatory_deregister()

This makes it clearer what we're doing. This now makes a bit
more sense given that regardless of the wiphy if the cell
base station hint feature is supported we will be modifying the
way the regulatory core behaves.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: add cellular base station regulatory hint support
Luis R. Rodriguez [Thu, 12 Jul 2012 18:49:18 +0000 (11:49 -0700)]
cfg80211: add cellular base station regulatory hint support

Cellular base stations can provide hints to cfg80211 about
where they think we are. This can be done for example on
a cell phone. To enable these hints we simply allow them
through as user regulatory hints but we allow userspace
to clasify the hint as either coming directly from the
user or coming from a cellular base station. This option
is only available when you enable
CONFIG_CFG80211_CERTIFICATION_ONUS.

The base station hints themselves will not be processed
by the core unless at least one device on the system
supports this feature.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: add CONFIG_CFG80211_CERTIFICATION_ONUS
Luis R. Rodriguez [Thu, 12 Jul 2012 18:49:17 +0000 (11:49 -0700)]
cfg80211: add CONFIG_CFG80211_CERTIFICATION_ONUS

This adds CONFIG_CFG80211_CERTIFICATION_ONUS which is to
be used for features / code which require a bit of work on
the system integrator's part to ensure that the system will
still pass 802.11 regulatory certification. This option is
also usable for researchers and experimenters looking to add
code in the kernel without impacting compliant code.

We'd use CONFIG_EXPERT alone but it seems that most standard
Linux distributions are enabling CONFIG_EXPERT already. This
allows us to define 802.11 specific kernel features under a
flag that is intended by design to be disabled by standard
Linux distributions, and only enabled by system integrators
or distributions that have done work to ensure regulatory
certification on the system with the enabled features.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: fix set_regdom() to cancel requests with same alpha2
Kalle Valo [Thu, 12 Jul 2012 12:33:58 +0000 (15:33 +0300)]
cfg80211: fix set_regdom() to cancel requests with same alpha2

While adding regulatory support to ath6kl I noticed that I easily
got the regulatory code confused. The way to reproduce the bug was:

1. iw reg set FI (in userspace)
2. cfg80211 calls ath6kl_reg_notify(FI)
3. ath6kl sets regdomain in firmware
4. firmware sends regdomain event to notify about the new regdomain (FI)
5. ath6kl calls regulatory_hint(FI)

And this (from FI to FI transition) confuses cfg80211 and after that I
only get "Pending regulatory request, waiting for it to be
processed...." messages and regdomain changes won't work anymore.

The reason why ath6kl calls regulatory_hint() is that firmware can change
the regulatory domain by it's own, for example due to 11d IEs. I could
of course workaround this in ath6kl but I think it's better to handle
the case in cfg80211.

The fix is pretty simple, use a different error code if the regdomain is
same and then just set the request processed so that it doesn't block new
requests.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agocfg80211: support TX error rate CQM
Thomas Pedersen [Thu, 12 Jul 2012 23:17:33 +0000 (16:17 -0700)]
cfg80211: support TX error rate CQM

Let the user configure serveral TX error conection quality monitoring
parameters: % error rate, survey interval, and # of attempted packets.

On exceeding the TX failure rate over the given interval, the driver
will send a CQM notify event with the actual TX failure rate and
packets attempted.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agonl80211: add wdev ID as u64 as it should
Johannes Berg [Tue, 17 Jul 2012 09:53:12 +0000 (11:53 +0200)]
nl80211: add wdev ID as u64 as it should

In one of my previous patches I erroneously
used nla_put_u32 for the wdev_id, fix that
to use nla_put_u64.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211_hwsim: fix race condition with sta/vif pointers
Thomas Huehn [Fri, 13 Jul 2012 18:52:24 +0000 (20:52 +0200)]
mac80211_hwsim: fix race condition with sta/vif pointers

info->control.sta and control.vif may only be dereferenced
during the drv_tx call otherwise could lead to use-after-free
bugs.

Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
[reword commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agomac80211: fix tx-mgmt cookie value being left uninitialized
Nicolas Cavallari [Mon, 16 Jul 2012 16:36:52 +0000 (18:36 +0200)]
mac80211: fix tx-mgmt cookie value being left uninitialized

commit "mac80211: unify SW/offload remain-on-channel"
moved the cookie assignment from ieee80211_mgmt_tx()
to ieee80211_start_roc_work().  But the latter is only
called where offchannel is needed.  If offchannel isn't
needed/used, a uninitialized cookie value would be returned
to userspace.

This patch sets the cookie value when offchannel isn't used.

Signed-off-by: Nicolas Cavallari <cavallar@lri.fr>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoBluetooth: Change page scan interval in fast connectable mode
Johan Hedberg [Thu, 28 Jun 2012 10:44:30 +0000 (13:44 +0300)]
Bluetooth: Change page scan interval in fast connectable mode

This patch is based on a user space (hciops) patch which never made it
upstream but does make sense to include in the mgmt part of the kernel.

(User space) commit message from Dmitriy Paliy:
"
Page scan interval in fast connectable mode is changed from 22.5 msec to
160 msec to perform less aggressive page scanning. This is done
accordingly to controller vendor recommendation.

Primary concern is that current parameters 22.5 interval, 11.25 window,
and interleaved scanning occupy whole radio bandwidth. Changing interval
to 160 msec should be sufficient for both speeding up connection
establishment and leaving space for other activities, like inquiry scan,
e.g.
"

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agoBluetooth: Use tx window from config response for ack timing
Mat Martineau [Tue, 10 Jul 2012 12:47:07 +0000 (05:47 -0700)]
Bluetooth: Use tx window from config response for ack timing

This change addresses an L2CAP ERTM throughput problem when a remote
device does not fully utilize the available transmit window.

The L2CAP ERTM transmit window size determines the maximum number of
unacked frames that may be outstanding at any time. It is configured
separately for each direction of an ERTM connection. Each side sends a
configuration request with a tx_win field indicating how many unacked
frames it is capable of receiving before sending an ack. The
configuration response's tx_win field shows how many frames the
transmitter will actually send before waiting for an ack.

It's important to trace both the actual transmit window (to check for
validity of incoming frames) and the number of frames that the
transmitter will send before waiting (to send acks at the appropriate
time). Now there are separate tx_win and ack_win values. ack_win is
updated based on configuration responses, and is used to determine
when acks are sent.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
12 years agocfg80211: reduce monitor interface tracking
Johannes Berg [Thu, 12 Jul 2012 20:19:48 +0000 (22:19 +0200)]
cfg80211: reduce monitor interface tracking

Revert commit b78e8ceac23655e1e06b30aa95ab11742d1ac7c0
("cfg80211: track monitor channel") and remove the
set_monitor_enabled() callback.

Due to the tracking happening in NETDEV_PRE_UP, it had
introduced bugs because the monitor interface callback
would be called before the device was started. It looks
like there's no way to fix this, and using NETDEV_PRE_UP
is broken anyway (since there's no NETDEV_UP_FAIL), so
remove all that code, track interfaces in NETDEV_UP and
also stop tracking the monitor channel in cfg80211.

This mostly reverts to before the tracking, except that
we keep the interface count tracking so that setting the
monitor channel can be rejected properly.

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