cascardo/linux.git
11 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Fri, 1 Feb 2013 19:21:56 +0000 (14:21 -0500)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

11 years agoBluetooth: Refactor mgmt_pending_foreach
Andre Guedes [Fri, 1 Feb 2013 14:21:30 +0000 (11:21 -0300)]
Bluetooth: Refactor mgmt_pending_foreach

This patch does a trivial refactor in mgmt_pending_foreach function.
It replaces list_for_each_safe by list_for_each_entry_safe, simplifying
the function.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove unneeded locking
Andre Guedes [Thu, 31 Jan 2013 23:12:10 +0000 (20:12 -0300)]
Bluetooth: Remove unneeded locking

This patch removes unneeded locking in hci_le_adv_report_evt. There
is no need to lock hdev before calling mgmt_device_found.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Reduce critical section in sco_conn_ready
Andre Guedes [Tue, 29 Jan 2013 22:59:56 +0000 (19:59 -0300)]
Bluetooth: Reduce critical section in sco_conn_ready

This patch reduces the critical section protected by sco_conn_lock in
sco_conn_ready function. The lock is acquired only when it is really
needed.

This patch fixes the following lockdep warning which is generated
when the host terminates a SCO connection.

Today, this warning is a false positive. There is no way those
two threads reported by lockdep are running at the same time since
hdev->workqueue (where rx_work is queued) is single-thread. However,
if somehow this behavior is changed in future, we will have a
potential deadlock.

======================================================
[ INFO: possible circular locking dependency detected ]
3.8.0-rc1+ #7 Not tainted
-------------------------------------------------------
kworker/u:1H/1018 is trying to acquire lock:
 (&(&conn->lock)->rlock){+.+...}, at: [<ffffffffa0033ba6>] sco_chan_del+0x66/0x190 [bluetooth]

but task is already holding lock:
 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [<ffffffffa0033d5a>] sco_conn_del+0x8a/0xe0 [bluetooth]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}:
       [<ffffffff81083011>] lock_acquire+0xb1/0xe0
       [<ffffffff813efd01>] _raw_spin_lock+0x41/0x80
       [<ffffffffa003436e>] sco_connect_cfm+0xbe/0x350 [bluetooth]
       [<ffffffffa0015d6c>] hci_event_packet+0xd3c/0x29b0 [bluetooth]
       [<ffffffffa0004583>] hci_rx_work+0x133/0x870 [bluetooth]
       [<ffffffff8104d65f>] process_one_work+0x2bf/0x4f0
       [<ffffffff81050022>] worker_thread+0x2b2/0x3e0
       [<ffffffff81056021>] kthread+0xd1/0xe0
       [<ffffffff813f14bc>] ret_from_fork+0x7c/0xb0

-> #0 (&(&conn->lock)->rlock){+.+...}:
       [<ffffffff81082215>] __lock_acquire+0x1465/0x1c70
       [<ffffffff81083011>] lock_acquire+0xb1/0xe0
       [<ffffffff813efd01>] _raw_spin_lock+0x41/0x80
       [<ffffffffa0033ba6>] sco_chan_del+0x66/0x190 [bluetooth]
       [<ffffffffa0033d6d>] sco_conn_del+0x9d/0xe0 [bluetooth]
       [<ffffffffa0034653>] sco_disconn_cfm+0x53/0x60 [bluetooth]
       [<ffffffffa000fef3>] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
       [<ffffffffa00150f7>] hci_event_packet+0xc7/0x29b0 [bluetooth]
       [<ffffffffa0004583>] hci_rx_work+0x133/0x870 [bluetooth]
       [<ffffffff8104d65f>] process_one_work+0x2bf/0x4f0
       [<ffffffff81050022>] worker_thread+0x2b2/0x3e0
       [<ffffffff81056021>] kthread+0xd1/0xe0
       [<ffffffff813f14bc>] ret_from_fork+0x7c/0xb0

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
                               lock(&(&conn->lock)->rlock);
                               lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
  lock(&(&conn->lock)->rlock);

 *** DEADLOCK ***

4 locks held by kworker/u:1H/1018:
 #0:  (hdev->name#2){.+.+.+}, at: [<ffffffff8104d5f8>] process_one_work+0x258/0x4f0
 #1:  ((&hdev->rx_work)){+.+.+.}, at: [<ffffffff8104d5f8>] process_one_work+0x258/0x4f0
 #2:  (&hdev->lock){+.+.+.}, at: [<ffffffffa000fbe9>] hci_disconn_complete_evt.isra.54+0x59/0x3c0 [bluetooth]
 #3:  (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [<ffffffffa0033d5a>] sco_conn_del+0x8a/0xe0 [bluetooth]

stack backtrace:
Pid: 1018, comm: kworker/u:1H Not tainted 3.8.0-rc1+ #7
Call Trace:
 [<ffffffff813e92f9>] print_circular_bug+0x1fb/0x20c
 [<ffffffff81082215>] __lock_acquire+0x1465/0x1c70
 [<ffffffff81083011>] lock_acquire+0xb1/0xe0
 [<ffffffffa0033ba6>] ? sco_chan_del+0x66/0x190 [bluetooth]
 [<ffffffff813efd01>] _raw_spin_lock+0x41/0x80
 [<ffffffffa0033ba6>] ? sco_chan_del+0x66/0x190 [bluetooth]
 [<ffffffffa0033ba6>] sco_chan_del+0x66/0x190 [bluetooth]
 [<ffffffffa0033d6d>] sco_conn_del+0x9d/0xe0 [bluetooth]
 [<ffffffffa0034653>] sco_disconn_cfm+0x53/0x60 [bluetooth]
 [<ffffffffa000fef3>] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
 [<ffffffffa000fbd0>] ? hci_disconn_complete_evt.isra.54+0x40/0x3c0 [bluetooth]
 [<ffffffffa00150f7>] hci_event_packet+0xc7/0x29b0 [bluetooth]
 [<ffffffff81202e90>] ? __dynamic_pr_debug+0x80/0x90
 [<ffffffff8133ff7d>] ? kfree_skb+0x2d/0x40
 [<ffffffffa0021644>] ? hci_send_to_monitor+0x1a4/0x1c0 [bluetooth]
 [<ffffffffa0004583>] hci_rx_work+0x133/0x870 [bluetooth]
 [<ffffffff8104d5f8>] ? process_one_work+0x258/0x4f0
 [<ffffffff8104d65f>] process_one_work+0x2bf/0x4f0
 [<ffffffff8104d5f8>] ? process_one_work+0x258/0x4f0
 [<ffffffff8104fdc1>] ? worker_thread+0x51/0x3e0
 [<ffffffffa0004450>] ? hci_tx_work+0x800/0x800 [bluetooth]
 [<ffffffff81050022>] worker_thread+0x2b2/0x3e0
 [<ffffffff8104fd70>] ? busy_worker_rebind_fn+0x100/0x100
 [<ffffffff81056021>] kthread+0xd1/0xe0
 [<ffffffff81055f50>] ? flush_kthread_worker+0xc0/0xc0
 [<ffffffff813f14bc>] ret_from_fork+0x7c/0xb0
 [<ffffffff81055f50>] ? flush_kthread_worker+0xc0/0xc0

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Increment Management interface revision
Johan Hedberg [Sun, 27 Jan 2013 14:32:01 +0000 (08:32 -0600)]
Bluetooth: Increment Management interface revision

This patch increments the management interface revision due to the
various fixes, improvements and other changes that have gone in lately.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix link security setting when powering on
Johan Hedberg [Sun, 27 Jan 2013 14:32:00 +0000 (08:32 -0600)]
Bluetooth: Fix link security setting when powering on

If a controller is powered on while the HCI_AUTO_OFF flag is set the
link security setting (HCI_LINK_SECURITY) might not be in sync with the
actual state of the controller (HCI_AUTH). This patch fixes the issue by
checking for inequality between the intended and actual settings and
sends a HCI_Write_Auth_Enable command if necessary.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Add support for 128-bit UUIDs in EIR data
Johan Hedberg [Sat, 26 Jan 2013 22:31:35 +0000 (00:31 +0200)]
Bluetooth: Add support for 128-bit UUIDs in EIR data

This patch adds the necessary code for encoding a list of 128-bit UUIDs
into the EIR data.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Add support for 32-bit UUIDs in EIR data
Johan Hedberg [Sat, 26 Jan 2013 22:31:34 +0000 (00:31 +0200)]
Bluetooth: Add support for 32-bit UUIDs in EIR data

This patch adds the necessary code for inserting a list of 32-bit UUIDs
into the EIR data.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Refactor UUID-16 list generation into its own function
Johan Hedberg [Sat, 26 Jan 2013 22:31:33 +0000 (00:31 +0200)]
Bluetooth: Refactor UUID-16 list generation into its own function

We will need to create three separate UUID lists in the EIR data (for
16, 32 and 128 bit UUIDs) so the code is easier to follow if each list
is generated in their own function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove useless eir_len variable from EIR creation
Johan Hedberg [Sat, 26 Jan 2013 22:31:32 +0000 (00:31 +0200)]
Bluetooth: Remove useless eir_len variable from EIR creation

The amount of data encoded so far in the create_eir() function can be
calculated simply through the difference between the data and ptr
pointer variables. The eir_len variable then becomes essentially
useless.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Simplify UUID16 list generation for EIR
Johan Hedberg [Sat, 26 Jan 2013 22:31:31 +0000 (00:31 +0200)]
Bluetooth: Simplify UUID16 list generation for EIR

There's no need to use two separate loops to generate a UUID list for
the EIR data. This patch merges the two loops previously used for the
16-bit UUID list generation into a single loop, thus simplifying the
code a great deal.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Simplify UUID removal code
Johan Hedberg [Sat, 26 Jan 2013 22:31:30 +0000 (00:31 +0200)]
Bluetooth: Simplify UUID removal code

The UUID removal code can be simplified by using
list_for_each_entry_safe instead of list_for_each_safe.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Keep track of UUID type upon addition
Johan Hedberg [Sat, 26 Jan 2013 22:31:29 +0000 (00:31 +0200)]
Bluetooth: Keep track of UUID type upon addition

The primary purpose of the UUIDs is to enable generation of EIR and AD
data. In these data formats the UUIDs are split into separate fields
based on whether they're 16, 32 or 128 bit UUIDs. To make the generation
of these data fields simpler this patch adds a type member to the
bt_uuid struct and assigns a value to it as soon as the UUID is added to
the kernel. This way the type doesn't need to be calculated each time
the UUID list is later iterated.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Simplify UUIDs clearing code
Johan Hedberg [Sat, 26 Jan 2013 22:31:28 +0000 (00:31 +0200)]
Bluetooth: Simplify UUIDs clearing code

The code for clearing the UUIDs list can be simplified by using
list_for_each_entry_safe instead of list_for_each_safe.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Store UUIDs in the same order that they were added
Johan Hedberg [Sat, 26 Jan 2013 22:31:27 +0000 (00:31 +0200)]
Bluetooth: Store UUIDs in the same order that they were added

We should be encoding UUIDs to the EIR data in the same order that they
were added to the kernel, i.e. each UUID should be added to the end of
the UUIDs list. This patch fixes the issue by using list_add_tail
instead of list_add for storing the UUIDs.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoiwlwifi: move register access lock into transport
Lilach Edelstein [Wed, 16 Jan 2013 09:34:49 +0000 (11:34 +0200)]
iwlwifi: move register access lock into transport

Move the reg_lock that protects HW register access
into the transport implementation. Locking is no
longer exposed, but handled internally in grab and
release NIC access. This simplifies the users.

Signed-off-by: Lilach Edelstein <lilach.edelstein@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: add iwl_set_bits_mask to transport API
Lilach Edelstein [Sun, 13 Jan 2013 11:31:10 +0000 (13:31 +0200)]
iwlwifi: add iwl_set_bits_mask to transport API

Express iwl_set_bit() and iwl_clear_bit() through iwl_set_bits_mask()
and add the latter to the transport's API in order to allow different
implementation for different transport types in the future.

Signed-off-by: Lilach Edelstein <lilach.edelstein@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: lower BT coex aggregation message severity
Johannes Berg [Mon, 28 Jan 2013 08:58:31 +0000 (09:58 +0100)]
iwlwifi: lower BT coex aggregation message severity

As the rate scaling algorithm will attempt to enable
aggregation over and over again, the message will
flood the log if there is, for example, Bluetooth
streaming music. Make it a debug messages instead of
printing it all the time.

Reported-by: Jan-Michael Brummer <jan.brummer@tabos.org>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: add the MVM driver
Johannes Berg [Thu, 24 Jan 2013 13:25:36 +0000 (14:25 +0100)]
iwlwifi: add the MVM driver

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

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

Cc: Alexander Bondar <alexander.bondar@intel.com>
Cc: Amit Beka <amit.beka@intel.com>
Cc: Amnon Paz <amnonx.paz@intel.com>
Cc: Assaf Krauss <assaf.krauss@intel.com>
Cc: David Spinadel <david.spinadel@intel.com>
Cc: Dor Shaish <dor.shaish@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Eytan Lifshitz <eytan.lifshitz@intel.com>
Cc: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: add NVM and PHY DB code for new MVM driver
Johannes Berg [Thu, 24 Jan 2013 13:14:22 +0000 (14:14 +0100)]
iwlwifi: add NVM and PHY DB code for new MVM driver

The new MVM (multi-virtual MAC) firmware driver
requires NVM (non-volatile memory) parsing code
and some PHY information database code. Add this
separately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: fix calibration parser
Johannes Berg [Thu, 24 Jan 2013 13:12:07 +0000 (14:12 +0100)]
iwlwifi: fix calibration parser

The firmware TLV for calibration data isn't
really a u64, but two u32 values. Define a
struct for that and change the parser.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: clean up CMD_MODE enum
Johannes Berg [Thu, 24 Jan 2013 13:05:43 +0000 (14:05 +0100)]
iwlwifi: clean up CMD_MODE enum

Just format the enum better.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: add 7000 series device configuration
Johannes Berg [Thu, 24 Jan 2013 12:52:01 +0000 (13:52 +0100)]
iwlwifi: add 7000 series device configuration

Add configuration and detection code for the new
7000 series, with 7260 and 3160 devices.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoMerge remote-tracking branch 'wireless-next/master' into iwlwifi-next
Johannes Berg [Wed, 30 Jan 2013 20:39:54 +0000 (21:39 +0100)]
Merge remote-tracking branch 'wireless-next/master' into iwlwifi-next

11 years agowil6210: fix wil_vring_init_tx status
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:09 +0000 (18:31 +0200)]
wil6210: fix wil_vring_init_tx status

In case vring setup with the firmware failed,
success status was returned. fix it.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Never delete Rx chain with firmware
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:08 +0000 (18:31 +0200)]
wil6210: Never delete Rx chain with firmware

Firmware crash on attempt to delete Rx chain.
Driver part of Rx chain removed only in preparation for the target reset;
as reset is the only flow that removes Rx chain in the firmware.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: checkpatch warnings
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:07 +0000 (18:31 +0200)]
wil6210: checkpatch warnings

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: fix checkpatch CamelCase warnings
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:06 +0000 (18:31 +0200)]
wil6210: fix checkpatch CamelCase warnings

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Reorder reset preparation sequence
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:05 +0000 (18:31 +0200)]
wil6210: Reorder reset preparation sequence

Disable interrupts first to prevent spurious WMI events arrival

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Separate common code for mbox regs caching to function
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:04 +0000 (18:31 +0200)]
wil6210: Separate common code for mbox regs caching to function

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Fix "don't scan after connect" logic
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:03 +0000 (18:31 +0200)]
wil6210: Fix "don't scan after connect" logic

When connect times out, scan was not re-enabled.

Strictly say, it is firmware issue - it should issue "disconnect"
event but it does not. Compensate in the driver.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Call skb_orphan() right before Rx indication
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:02 +0000 (18:31 +0200)]
wil6210: Call skb_orphan() right before Rx indication

Other parts of Rx path (BACK logic) will need to access associated data

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Fix: Tx stall
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:01 +0000 (18:31 +0200)]
wil6210: Fix: Tx stall

Due to multi-tx-queue design, wil_start_xmit() used to be executed
concurrently for different queues. Then, these transmits delivered
to the same queue, creating race.

As result, Tx descriptor may be skipped, causing stall in hardware.

Convert to single Tx queue fixes it.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Count Tx statistics on Tx completion
Vladimir Kondratiev [Mon, 28 Jan 2013 16:31:00 +0000 (18:31 +0200)]
wil6210: Count Tx statistics on Tx completion

This allows to account for Tx errors

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Refactor rx init/fini
Vladimir Kondratiev [Mon, 28 Jan 2013 16:30:59 +0000 (18:30 +0200)]
wil6210: Refactor rx init/fini

Move WMI related operations to wmi.c as helper functions

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: remove raw wil_dbg() calls
Vladimir Kondratiev [Mon, 28 Jan 2013 16:30:58 +0000 (18:30 +0200)]
wil6210: remove raw wil_dbg() calls

Introduce debug category "MISC", convert all raw wil_dbg() to this category.
This improves dynamic debug manageability

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: rearrange IRQ debug printing
Vladimir Kondratiev [Mon, 28 Jan 2013 16:30:57 +0000 (18:30 +0200)]
wil6210: rearrange IRQ debug printing

Make printings from IRQ appears in dmesg in chronological order

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowil6210: Detect FW error
Vladimir Kondratiev [Mon, 28 Jan 2013 16:30:56 +0000 (18:30 +0200)]
wil6210: Detect FW error

In the firmware, added is ability to report internal errors using IRQ.

Catch this IRQ and notify user space via netlink

User space get notified like (udevadm monitor --kernel --property):

KERNEL[12660.320520] change   /devices/pci0000:00/0000:00:1c.1/0000:02:00.0/0000:03:01.0/0000:05:00.0/net/wlan12 (net)
ACTION=change
DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:02:00.0/0000:03:01.0/0000:05:00.0/net/wlan12
DEVTYPE=wlan
EVENT=FW_ERROR
IFINDEX=6
INTERFACE=wlan12
SEQNUM=2489
SOURCE=wil6210
SUBSYSTEM=net

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: avoid out of bounds access in mwifiex_get_common_rates.
Cyril Roelandt [Sun, 27 Jan 2013 22:42:48 +0000 (23:42 +0100)]
mwifiex: avoid out of bounds access in mwifiex_get_common_rates.

Check that the array indexes are in-bounds before accessing the rate2 and tmp
arrays.

Found with the following semantic patch:

<smpl>
@@
identifier t;
identifier idx;
expression E;
statement S;
@@
* for (... ; <+... t[idx] ...+> && idx < E ; ...)
S
</smpl>

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agortlwifi: Eliminate two empty routines
Larry Finger [Sun, 27 Jan 2013 22:40:34 +0000 (16:40 -0600)]
rtlwifi: Eliminate two empty routines

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agonet: iwlegacy: remove unused variable
Guenter Roeck [Sun, 27 Jan 2013 18:55:41 +0000 (10:55 -0800)]
net: iwlegacy: remove unused variable

Fix:

drivers/net/wireless/iwlegacy/4965.c: In function â€˜il4965_post_associate’:
drivers/net/wireless/iwlegacy/4965.c:1751:25: warning: variable â€˜conf’ set but
not used [-Wunused-but-set-variable]

seen when building allmodconfig on x86_64 with W=1 by removing the unused
variable.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoiwlegacy: fix antenna bitmask
Christian Lamparter [Sat, 26 Jan 2013 21:19:35 +0000 (22:19 +0100)]
iwlegacy: fix antenna bitmask

This patch is based on "iwlwifi: fix antenna bitmask".
(362b0563b28506d53)

Like the new iwlagn devices, the old 4965N device only
supports a maximum of three antennas. Hence only three
bits are used, the fourth bit is likely the A-MPDU
indicator.

Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: add gpio_to_irq
Hauke Mehrtens [Sat, 26 Jan 2013 20:39:44 +0000 (21:39 +0100)]
bcma: add gpio_to_irq

The old bcm47xx gpio code had support for gpio_to_irq, but the new
code did not provide this function, but returned -ENXIO all the time.
This patch adds the missing function.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: add gpio_to_irq
Hauke Mehrtens [Sat, 26 Jan 2013 20:38:35 +0000 (21:38 +0100)]
ssb: add gpio_to_irq

The old bcm47xx gpio code had support for gpio_to_irq, but the new
code did not provide this function, but returned -ENXIO all the time.
This patch adds the missing function.

arch/mips/bcm47xx/wgt634u.c calls gpio_to_irq() and got the correct irq
number with the old gpio handling code. With this patch the code in
wgt634u.c should work again. I do not have a wgt634u to test this.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: do not overwrite error code from lower layer driver
Bing Zhao [Sat, 26 Jan 2013 02:23:00 +0000 (18:23 -0800)]
mwifiex: do not overwrite error code from lower layer driver

Instead of converting it to a bogus error code -1, we should
return the original error code from lower layer driver. This
error code will be printed so it may give user some clues on
what has happened.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: don't return zero on failure paths in mwifiex_pcie_init()
Alexey Khoroshilov [Fri, 25 Jan 2013 20:56:03 +0000 (00:56 +0400)]
mwifiex: don't return zero on failure paths in mwifiex_pcie_init()

If pci_iomap() fails in mwifiex_pcie_init(), it breaks off initialization,
deallocates all resources, but returns zero.
The patch adds -EIO as return value in this case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agortl8723ae: Fix misspellings sucess->success
Anatol Pomozov [Fri, 25 Jan 2013 18:32:30 +0000 (10:32 -0800)]
rtl8723ae: Fix misspellings sucess->success

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Do not call STA specific cmds not supported by the AP fw
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:50:50 +0000 (16:20 +0530)]
mwl8k: Do not call STA specific cmds not supported by the AP fw

While using STA mode in the AP firmware, avoid
calling some firmware commands which are not
supported by the AP firmware.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Choose interface specific calls on vif type
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:50:42 +0000 (16:20 +0530)]
mwl8k: Choose interface specific calls on vif type

Choose interface specific function calls
based on interface type instead of
firmware types.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Add/Del self entry for AP interface only
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:50:35 +0000 (16:20 +0530)]
mwl8k: Add/Del self entry for AP interface only

Add and delete self entry in the firmware sta database
for AP interface only. We do not need such an entry for
STA interface.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Enable hw encryption for STA mode on AP fw
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:50:28 +0000 (16:20 +0530)]
mwl8k: Enable hw encryption for STA mode on AP fw

Firmware supports hardware encryption feature
for the station interface running on AP
firmware.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: set mac type to MWL8K_MAC_TYPE_SECONDARY_CLIENT
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:50:12 +0000 (16:20 +0530)]
mwl8k: set mac type to MWL8K_MAC_TYPE_SECONDARY_CLIENT

Set mac type for station interface on AP firmware
as secondary. This allows the firmware to set specific
characteristics for the STA interface.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Allow adding station interface on AP firmware
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:50:03 +0000 (16:20 +0530)]
mwl8k: Allow adding station interface on AP firmware

When user wants to add a station interface when
AP firmware is loaded & in-use, allow creating
it and also notify user about the same.

Allow adding max one STA interface for AP fw.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Announce simultaneous AP-STA support on AP fw
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:49:55 +0000 (16:19 +0530)]
mwl8k: Announce simultaneous AP-STA support on AP fw

Specify the STA support in iface_limit and
in wihpy->interface_modes

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Move tx/rx antenna configuration to mwl8k_probe_hw
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:47:56 +0000 (16:17 +0530)]
mwl8k: Move tx/rx antenna configuration to mwl8k_probe_hw

This avoids calling mwl8k_cmd_rf_antenna functions every
time mwl8k_config function is called.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Do not call mwl8k_cmd_set_rf_channel unconditionally
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:47:45 +0000 (16:17 +0530)]
mwl8k: Do not call mwl8k_cmd_set_rf_channel unconditionally

Avoid calling mwl8k_cmd_set_rf_channel unconditionally
by checking IEEE80211_CONF_CHANGE_CHANNEL.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwl8k: Stop bsses before hw specific commands
Yogesh Ashok Powar [Fri, 25 Jan 2013 10:47:32 +0000 (16:17 +0530)]
mwl8k: Stop bsses before hw specific commands

For the commands, that might change the hw characteristics
of the PHY device, stop the running bsses and resume them
once command is complete.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: register platform device for parallel flash
Rafał Miłecki [Fri, 25 Jan 2013 10:37:26 +0000 (11:37 +0100)]
bcma: register platform device for parallel flash

Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: register platform device for parallel flash
Rafał Miłecki [Fri, 25 Jan 2013 10:36:26 +0000 (11:36 +0100)]
ssb: register platform device for parallel flash

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: trivial: use pflash helper variable
Rafał Miłecki [Fri, 25 Jan 2013 10:36:25 +0000 (11:36 +0100)]
ssb: trivial: use pflash helper variable

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: allow AP and mesh mode to operate simultaneously
Chun-Yeow Yeoh [Fri, 25 Jan 2013 04:47:50 +0000 (12:47 +0800)]
rt2x00: allow AP and mesh mode to operate simultaneously

Allow AP and Mesh mode to operate concurrently using
single radio. Verify this using fonera 2.0n featuring
RT3052 chipset and also TP-LINK TL-WN727N featuring
RT5370 chipset.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemal.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: remove NOTICE
Stanislaw Gruszka [Sat, 26 Jan 2013 17:13:50 +0000 (18:13 +0100)]
rt2x00: remove NOTICE

We use this macro only on 3 places - remove it and replace by other
appropriate macros for printing messages.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800usb: move "TX status missed" messages to debug level
Stanislaw Gruszka [Thu, 24 Jan 2013 21:01:10 +0000 (22:01 +0100)]
rt2800usb: move "TX status missed" messages to debug level

Those messages can flood in dmesg, so do not print them by default.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: print warning, notice and info as default
Stanislaw Gruszka [Thu, 24 Jan 2013 20:59:32 +0000 (21:59 +0100)]
rt2x00: print warning, notice and info as default

Some messages provide useful information, but are disabled without
CONFIG_RT2X00_DEBUG=y, so enable them by default

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Update spectral scan output data
Sven Eckelmann [Wed, 23 Jan 2013 19:12:39 +0000 (20:12 +0100)]
ath9k: Update spectral scan output data

The sample data received through the spectral scan can be either in big or
little endian byteorder. This information isn't stored in the output file.
Therefore it is not possible for the analyzer software to find the correct byte
order.

It is relative common to get the data from a low end AP in big endian mode and
transfer it to another computer in little endian mode to analyze it. Therefore,
it would be better to store it in network (big endian) byte order.

The extension of the 8 bit bins for each bin to 16 bit is not necessary. This
operation can be done in userspace or on a different machine. Instead the
max_exp defining the amount of shifting required for each bin is exported to
userspace.

The change of the output format requires a change of the type in the sample
tlv to allow the userspace program to correctly detect the bin format.

Reported-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
[siwu@hrz.tu-chemnitz.de: squashed patches, update commit message, rebase, fix endianess bug]
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: reorder error codes for spectral
Simon Wunderlich [Wed, 23 Jan 2013 16:38:06 +0000 (17:38 +0100)]
ath9k: reorder error codes for spectral

When using the spectral scan feature, frames with phy errors are
returned for further processing to the driver. However, if the frames
also have an invalid CRC (which seems to happen quite often), the frame
is marked with bad CRC and not with the PHY error bit. The FFT
processing function will thus miss the frames.

Fix this by changing the precedence in error marking.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: drop spectral packets after processing them
Simon Wunderlich [Wed, 23 Jan 2013 16:38:05 +0000 (17:38 +0100)]
ath9k: drop spectral packets after processing them

Spectral packets are "bogus" packets and should not be further evaluated
by the RX path.

Statistics are added to keep track of these packets.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add debug parameters for spectral scan
Simon Wunderlich [Wed, 23 Jan 2013 16:38:04 +0000 (17:38 +0100)]
ath9k: add debug parameters for spectral scan

Export the various parameters to userspace.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: fix invalid access of PCIe RxBD ring buffer descriptor
Avinash Patil [Wed, 23 Jan 2013 00:29:03 +0000 (16:29 -0800)]
mwifiex: fix invalid access of PCIe RxBD ring buffer descriptor

This patch fixes invalid access of RxBD ring buffer descriptor's
length and flag inside PCIe send_data_complete() routine. We are
supposed to modify TxBD buffer descriptor's length and flag here.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: print chip and firmware version by default
Stanislaw Gruszka [Tue, 22 Jan 2013 16:49:14 +0000 (17:49 +0100)]
rt2x00: print chip and firmware version by default

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Tested-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agodrivers/net/wireless/iwlegacy/4965-mac.c: adjust duplicate test
Julia Lawall [Mon, 21 Jan 2013 13:02:50 +0000 (14:02 +0100)]
drivers/net/wireless/iwlegacy/4965-mac.c: adjust duplicate test

Delete successive tests to the same location.  This looks like simple code
duplication.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@s exists@
local idexpression y;
expression x,e;
@@

*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
    when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Wed, 30 Jan 2013 19:23:08 +0000 (14:23 -0500)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Wed, 30 Jan 2013 19:22:19 +0000 (14:22 -0500)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

11 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Wed, 30 Jan 2013 19:21:04 +0000 (14:21 -0500)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

11 years agoMerge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca...
John W. Linville [Tue, 29 Jan 2013 19:03:20 +0000 (14:03 -0500)]
Merge branch 'for-linville' of git://git./linux/kernel/git/luca/wl12xx

Conflicts:
drivers/net/wireless/ti/wlcore/main.c

11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Mon, 28 Jan 2013 18:54:03 +0000 (13:54 -0500)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

Conflicts:
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/iwlwifi/dvm/tx.c

11 years agomac80211: fix mesh_sta_info_get() reshuffle damage
Thomas Pedersen [Sun, 27 Jan 2013 01:00:02 +0000 (17:00 -0800)]
mac80211: fix mesh_sta_info_get() reshuffle damage

Before "mac80211: clean up mesh sta allocation warning"
was applied, mesh_sta_info_get() was reshuffled to please
sparse. As a result we neglect to initialize newly created
STAs. Fix this.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211/nl80211: add API for MAC address ACLs
Vasanthakumar Thiagarajan [Fri, 18 Jan 2013 05:48:45 +0000 (11:18 +0530)]
cfg80211/nl80211: add API for MAC address ACLs

Add API to enable drivers to implement MAC address based
access control in AP/P2P GO mode. Capable drivers advertise
this capability by setting the maximum number of MAC
addresses in such a list in wiphy->max_acl_mac_addrs.

An initial ACL may be given to the NL80211_CMD_START_AP
command and/or changed later with NL80211_CMD_SET_MAC_ACL.

Black- and whitelists are supported, but not simultaneously.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
[rewrite commit log, many cleanups]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: Move the definition of struct mac_address up
Vasanthakumar Thiagarajan [Fri, 18 Jan 2013 05:48:44 +0000 (11:18 +0530)]
cfg80211: Move the definition of struct mac_address up

struct mac_address will be used by ACL related configuration ops.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: avoid a build warning
Arnd Bergmann [Fri, 25 Jan 2013 14:14:33 +0000 (14:14 +0000)]
mac80211: avoid a build warning

gcc cannot prove that the value of sdata->vif.type does not
change between the switch() statement and the second
comparison to NL80211_IFTYPE_AP, causing a harmless
warning.
Slightly reordering the code makes the warning go away
with no functional change.

Without this patch, building ARM at91sam9g45_defconfig with
gcc-4.6 results in:

net/mac80211/tx.c: In function 'ieee80211_subif_start_xmit':
net/mac80211/tx.c:1797:22: warning: 'chanctx_conf' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: include debugfs.h
Johannes Berg [Thu, 24 Jan 2013 15:43:48 +0000 (16:43 +0100)]
iwlwifi: include debugfs.h

The iwl-op-mode.h file uses a struct dentry for debugfs
so should include debugfs.h.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove redundant check
Johannes Berg [Fri, 18 Jan 2013 20:21:31 +0000 (21:21 +0100)]
mac80211: remove redundant check

There's no need to have two checks for "associated"
in ieee80211_sta_restart(), make the first one locked
to not race (unlikely at this point during resume)
and remove the second check.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: fix channel check in cfg80211_can_use_iftype_chan
Simon Wunderlich [Wed, 23 Jan 2013 14:15:57 +0000 (15:15 +0100)]
cfg80211: fix channel check in cfg80211_can_use_iftype_chan

In commit "cfg80211: check radar interface combinations" a regression
was introduced which might lead to NULL dereference if the argument
chan = NULL, which might happen in IBSS/wext case (and probably
others).

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: support mesh rate updates
Thomas Pedersen [Wed, 23 Jan 2013 20:18:13 +0000 (12:18 -0800)]
mac80211: support mesh rate updates

An existing mesh station entry may change its rate
capabilities, so call rate_control_rate_update() to notify
the rate control.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
[fix compilation]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: clean up mesh sta allocation warning
Thomas Pedersen [Wed, 23 Jan 2013 20:18:12 +0000 (12:18 -0800)]
mac80211: clean up mesh sta allocation warning

This refactoring fixes a "scheduling while atomic" warning
when allocating a mesh station entry while holding the RCU
read lock. Fix this by creating a new function
mesh_sta_info_get(), which correctly handles the locking
and returns under RCU.

Also move some unnecessarily #ifdefed mesh station init
code from sta_info_alloc() to __mesh_sta_info_alloc().

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
[change code flow to make sparse happy]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoieee80211: define AKM suite selectors type 5, 6 and 7
Bing Zhao [Thu, 24 Jan 2013 04:33:58 +0000 (20:33 -0800)]
ieee80211: define AKM suite selectors type 5, 6 and 7

Reference: IEEE 802.11-2012 8.4.2.27.3 "AKM suites"

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix aggregation state with current drivers
Johannes Berg [Fri, 18 Jan 2013 22:47:05 +0000 (23:47 +0100)]
mac80211: fix aggregation state with current drivers

For drivers that don't actually flush their queues when
aggregation stop with the IEEE80211_AMPDU_TX_STOP_FLUSH
or IEEE80211_AMPDU_TX_STOP_FLUSH_CONT reasons is done,
like iwlwifi or iwlegacy, mac80211 can then transmit on
a TID that the driver still considers busy. This happens
in the following way:

 - IEEE80211_AMPDU_TX_STOP_FLUSH requested
 - driver marks TID as emptying
 - mac80211 removes tid_tx data, this can copy packets
   to the TX pending queues and also let new packets
   through to the driver
 - driver gets unexpected TX as it wasn't completely
   converted to the new API

In iwlwifi, this lead to the following warning:

WARNING: at drivers/net/wireless/iwlwifi/dvm/tx.c:442 iwlagn_tx_skb+0xc47/0xce0
Tx while agg.state = 4
Modules linked in: [...]
Pid: 0, comm: kworker/0:0 Tainted: G        W   3.1.0 #1
Call Trace:
 [<c1046e42>] warn_slowpath_common+0x72/0xa0
 [<c1046f13>] warn_slowpath_fmt+0x33/0x40
 [<fddffa17>] iwlagn_tx_skb+0xc47/0xce0 [iwldvm]
 [<fddfcaa3>] iwlagn_mac_tx+0x23/0x40 [iwldvm]
 [<fd8c98b6>] __ieee80211_tx+0xf6/0x3c0 [mac80211]
 [<fd8cbe00>] ieee80211_tx+0xd0/0x100 [mac80211]
 [<fd8cc176>] ieee80211_xmit+0x96/0xe0 [mac80211]
 [<fd8cc578>] ieee80211_subif_start_xmit+0x348/0xc80 [mac80211]
 [<c1445207>] dev_hard_start_xmit+0x337/0x6d0
 [<c145eee9>] sch_direct_xmit+0xa9/0x210
 [<c14462c0>] dev_queue_xmit+0x1b0/0x8e0

Fortunately, solving this problem is easy as the station
is being destroyed, so such transmit packets can only
happen due to races. Instead of trying to close the race
just let the race not reach the drivers by making two
changes:
 1) remove the explicit aggregation session teardown in
    the managed mode code, the same thing will be done
    when the station is removed, in __sta_info_destroy.
 2) When aggregation stop with AGG_STOP_DESTROY_STA is
    requested, leave the tid_tx data around as stopped.
    It will be cleared and freed in cleanup_single_sta
    later, but until then any racy packets will be put
    onto the tid_tx pending queue instead of transmitted
    which is fine since the station is being removed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: provide the vif in rssi_callback
Emmanuel Grumbach [Sun, 20 Jan 2013 15:32:41 +0000 (17:32 +0200)]
mac80211: provide the vif in rssi_callback

Since drivers can support several BSS / P2P Client
interfaces, the rssi callback needs to inform the driver
about the interface teh rssi event relates to.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: provide RX page order
Emmanuel Grumbach [Wed, 23 Jan 2013 08:59:29 +0000 (10:59 +0200)]
iwlwifi: provide RX page order

When the pages are to be used by front-end, it may need
to know the page order, provide it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: update copyright
Johannes Berg [Mon, 21 Jan 2013 20:39:26 +0000 (21:39 +0100)]
iwlwifi: update copyright

Update Copyright notices to 2013.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoBluetooth: Add support for reading LE supported states
Johan Hedberg [Tue, 22 Jan 2013 12:02:01 +0000 (14:02 +0200)]
Bluetooth: Add support for reading LE supported states

The LE supported states indicate the states and state combinations that
the link layer supports. This is important information for knowing what
operations are possible when dealing with multiple connected devices.
This patch adds reading of the supported states to the HCI init
sequence.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Add support for reading LE White List Size
Johan Hedberg [Tue, 22 Jan 2013 12:02:00 +0000 (14:02 +0200)]
Bluetooth: Add support for reading LE White List Size

The LE White List Size is necessary to be known before attempting to
feed the controller with any addresses intended for the white list. This
patch adds the necessary HCI command sending to the HCI init sequence.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Add LE Local Features reading support
Johan Hedberg [Tue, 22 Jan 2013 12:01:59 +0000 (14:01 +0200)]
Bluetooth: Add LE Local Features reading support

To be able to make the appropriate decisions for some LE procedures we
need to know the LE features that the local controller supports.
Therefore, it's important to have the LE Read Local Supported Features
HCI comand as part of the HCI init sequence.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix returning proper cmd_complete for mgmt_block/unblock
Johan Hedberg [Sun, 20 Jan 2013 12:27:22 +0000 (14:27 +0200)]
Bluetooth: Fix returning proper cmd_complete for mgmt_block/unblock

The Block/Unblock Device Management commands should return Command
Complete instead of Command Status whenever possible so that user space
can distinguish exactly which command failed in the case of multiple
commands. This patch does the necessary changes in the command handler
to return the right event to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix returning proper cmd_complete for mgmt_disconnect
Johan Hedberg [Sun, 20 Jan 2013 12:27:21 +0000 (14:27 +0200)]
Bluetooth: Fix returning proper cmd_complete for mgmt_disconnect

The Disconnect Management command should return Command Complete instead
of Command Status whenever possible so that user space can distinguish
exactly which command failed in the case of multiple commands. This
patch does the necessary changes in the disconnect command handler to
return the right event to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix checking for valid disconnect parameters in unpair_device
Johan Hedberg [Sun, 20 Jan 2013 12:27:20 +0000 (14:27 +0200)]
Bluetooth: Fix checking for valid disconnect parameters in unpair_device

The valid values for the Disconnect parameter in the Unpair Device
command are 0x00 and 0x01. If any other value is encountered the command
should fail with the appropriate invalid params response.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix checking for valid address type values in mgmt commands
Johan Hedberg [Sun, 20 Jan 2013 12:27:19 +0000 (14:27 +0200)]
Bluetooth: Fix checking for valid address type values in mgmt commands

This patch adds checks for valid address type values passed to mgmt
commands. If an invalid address type is encountered the code will return
a proper invalid params response.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Add helper functions for testing bdaddr types
Johan Hedberg [Sun, 20 Jan 2013 12:27:18 +0000 (14:27 +0200)]
Bluetooth: Add helper functions for testing bdaddr types

This patch adds two helper functions to test for valid bdaddr type
values. These will be particularely useful in the mgmt code to check
that user space has passed valid values to the kernel.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Check for valid key->authenticated value for LTKs
Johan Hedberg [Sun, 20 Jan 2013 12:27:17 +0000 (14:27 +0200)]
Bluetooth: Check for valid key->authenticated value for LTKs

This patch adds necessary checks for the two allowed values of the
authenticated parameter of each Long Term Key, i.e. 0x00 and 0x01. If
any other value is encountered the valid response is to return invalid
params to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Refactor valid LTK data testing into its own function
Johan Hedberg [Sun, 20 Jan 2013 12:27:16 +0000 (14:27 +0200)]
Bluetooth: Refactor valid LTK data testing into its own function

This patch refactors valid LTK data testing into its own function. This
will help keep the code readable since there are several tests still
missing that need to be done on the LTK data.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>