Mat Martineau [Tue, 13 Dec 2011 23:06:02 +0000 (15:06 -0800)]
Bluetooth: Incoming ACL packets do not force active mode
Incoming sk_buffs always have bt_cb(skb)->force_active set to 0, so
it's misleading to use that value from the control block when calling
hci_conn_enter_active_mode() for incoming data. The destination socket
is not known in the HCI layer, so the force_active setting for each
socket isn't known either. Hard-coding the force_active parameter does
not change any behavior, but makes it obvious that incoming ACL data
never exits sniff mode.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Wed, 7 Dec 2011 13:56:52 +0000 (15:56 +0200)]
Bluetooth: Simplify num_comp_pkts_evt function
Simplify function and remove fourth level of indentation.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Wed, 7 Dec 2011 13:56:51 +0000 (15:56 +0200)]
Bluetooth: Add HCI Read Data Block Size function
Implement block size read function. Use different variables for
packet-based and block-based flow control.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:41 +0000 (00:47 +0200)]
Bluetooth: Use correct struct for user_confirm_neg_reply
This patch fixes user_confirm_neg_reply to use the appropriate struct
for accessing the call parameters.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:40 +0000 (00:47 +0200)]
Bluetooth: Update ordering and opcodes of mgmt messages
This patch updates the ordering and opcodes of mgmt messages to match
the latest API specification.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:39 +0000 (00:47 +0200)]
Bluetooth: Add timer for automatically disabling the service cache
We do not want the service cache to be enabled indefinitely after
mgmt_read_info is called. To solve this a timer is added which will
automatically disable the cache if mgmt_set_dev_class isn't called
within 5 seconds of calling mgmt_read_info.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:38 +0000 (00:47 +0200)]
Bluetooth: Move EIR and CoD update functions to a better position
Due to the upcoming addition of a service cache timer the functions to
update the EIR and CoD need to be higher up in mgmt.c in order to avoid
unnecessary forward-declarations. This patch simply moves code around
without any other changes in order to make subsequent patches more
readable.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:37 +0000 (00:47 +0200)]
Bluetooth: Remove mgmt_set_service_cache
Instead of having an explicit service cache command we can make the mgmt
API simpler by implicitly enabling the cache when mgmt_read_info is
called for the first time and disabling it when mgmt_set_dev_class is
called.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:36 +0000 (00:47 +0200)]
Bluetooth: Move mgmt_set_fast_connectable to the right location
Fast connectable is logically after the connectable property so that's
where it should show up in the code as well (it's also after connectable
in the settings bitfield).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 14 Dec 2011 22:47:35 +0000 (00:47 +0200)]
Bluetooth: Update mgmt_read_info and related mgmt messages
This patch updates the mgmt_read_info and related messages to the latest
management API which uses a bitfield of settings instead of individual
boolean values.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sun, 18 Dec 2011 15:39:33 +0000 (13:39 -0200)]
Bluetooth: Add ProFUSION's copyright
Add ProFUSION's copyright to some files I've been touching recently.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sun, 18 Dec 2011 14:40:32 +0000 (12:40 -0200)]
Bluetooth: Use system workqueue to schedule power_on
hdev->workqueue should be only for rx/tx, so move this one out.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 17 Dec 2011 20:53:02 +0000 (18:53 -0200)]
Bluetooth: Remove work_add and work_del from hci_sysfs
As we run in process context now we don't need worqueue to add e del from
sysfs.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 17 Dec 2011 19:47:30 +0000 (17:47 -0200)]
Bluetooth: Use new alloc_workqueue()
Update hdev workqueue API usage to use the new interface, this new
interface also allow us to mark this workqueue as WQ_HIGHPRI, so now rx
and tx work gets higher priority when running.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 17 Dec 2011 16:52:27 +0000 (14:52 -0200)]
Bluetooth: move power_off to system workqueue
hdev->workqueue will be only for for rx/tx/cmd processing, all other small
works should go to the system workqueue for now.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 17 Dec 2011 12:56:45 +0000 (10:56 -0200)]
Bluetooth: Change l2cap chan_list to use RCU
This list has much more reads than writes, so RCU makes senses here, also
it avoid deadlock against the socket lock.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 9 Dec 2011 06:48:17 +0000 (04:48 -0200)]
Bluetooth: invert locking order in connect path
This move some checking code that was in l2cap_sock_connect() to
l2cap_chan_connect(). Thus we can invert the lock calls, i.e., call
lock_sock() before hci_dev_lock() to avoid a deadlock scenario.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 15 Dec 2011 03:16:14 +0000 (01:16 -0200)]
Bluetooth: convert info timer to delayed_work
Another step of remove interrupt context from Bluetooth Core.
Use the system workqueue.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 15 Dec 2011 02:50:02 +0000 (00:50 -0200)]
Bluetooth: convert tx_task to workqueue
This should simplify Bluetooth core processing a lot.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 15 Dec 2011 01:53:47 +0000 (23:53 -0200)]
Bluetooth: Move command task to workqueue
As part of the moving on all the Bluetooth processing to Process context.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 15 Dec 2011 00:58:44 +0000 (22:58 -0200)]
Bluetooth: Don't disable tasklets to call hdev->notify()
It's pointless, we aren't protecting anything since btusb_notify()
schedules a work to run, then all it operation happens without protection.
If protection is really needed here, we will fix it further.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 15 Dec 2011 00:54:12 +0000 (22:54 -0200)]
Bluetooth: convert conn hash to RCU
Handling hci_conn_hash with RCU make us avoid some locking and disable
tasklets.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Wed, 14 Dec 2011 17:08:48 +0000 (15:08 -0200)]
Bluetooth: Use RCU to manipulate chan_list
Instead of using tasklet_disable() to prevent acess to the channel use, we
can use RCU and improve the performance of our code.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 9 Dec 2011 06:45:12 +0000 (04:45 -0200)]
Bluetooth: convert chan_lock to mutex
spin lock doesn't fit ok anymore on the new code based on workqueues.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 9 Dec 2011 06:41:30 +0000 (04:41 -0200)]
Bluetooth: move hci_task_lock to mutex
Now we can sleep in any path inside Bluetooth core, so mutex can make
sense here.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 24 Jun 2011 04:54:50 +0000 (01:54 -0300)]
Bluetooth: Remove sk_backlog usage from L2CAP
We run everything in the same lock now. The backlog queue is useless now
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 24 Jun 2011 04:53:01 +0000 (01:53 -0300)]
Bluetooth: Don't use spin_lock socket lock anymore
We now run everything in process context, so the mutex lock is the best
option. But in some places we still need the bh_lock_sock()
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 23 Jun 2011 22:29:58 +0000 (19:29 -0300)]
Bluetooth: Move L2CAP timers to workqueue
L2CAP timers also need to run in process context. As the works in l2cap
are small we are using the system worqueue.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 17 Jun 2011 15:58:41 +0000 (12:58 -0300)]
Bluetooth: hci_conn_auto_accept() doesn't need locking
It doesn't really touch any sensitive information about hdev. So no need
to lock here.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Mon, 20 Jun 2011 19:39:29 +0000 (16:39 -0300)]
Bluetooth: Use delayed work for advertisiment cache timeout
As HCI rx path is now done in process context it makes sense to do all the
timer in process context as well.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 17 Jun 2011 16:03:21 +0000 (13:03 -0300)]
Bluetooth: Use delayed_work for connection timeout
Bluetooth rx task runs now in a workqueue, so it a good approach run any
timer that share locking with process context code also in a workqueue.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 17 Jun 2011 16:03:21 +0000 (13:03 -0300)]
Bluetooth: Replace spin_lock by mutex in hci_dev
Now we run everything in HCI in process context, so it's a better idea use
mutex instead spin_lock. The macro remains hci_dev_lock() (and I got rid
of hci_dev_lock_bh()), of course.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Marcel Holtmann [Mon, 9 Aug 2010 03:06:53 +0000 (23:06 -0400)]
Bluetooth: Process recv path in a workqueue instead of a tasklet
Run recv process in workqueue helps a lot with our processing as the recv
path will also be in the process context, i.e., now all our tx and rx are
in process context.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Wed, 7 Dec 2011 15:24:33 +0000 (13:24 -0200)]
Bluetooth: make hci_conn_enter_sniff_mode static
It isn't used outside hci_conn.c
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 15 Dec 2011 00:52:31 +0000 (22:52 -0200)]
Bluetooth: Use list_for_each_entry in hci_conn_hash_flush()
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 9 Dec 2011 06:40:10 +0000 (04:40 -0200)]
Bluetooth: Use chan instead of l2cap_pi macro
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Wed, 14 Dec 2011 22:56:12 +0000 (20:56 -0200)]
Bluetooth: Initialize LE connection count
le_num needs to be set to zero.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Wed, 14 Dec 2011 17:10:41 +0000 (15:10 -0200)]
Bluetooth: remove lock from struct conn_hash
It isn't used anywhere.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Wed, 14 Dec 2011 15:02:51 +0000 (13:02 -0200)]
Bluetooth: remove struct hci_chan_hash
Only the list member of the struct was used, so we now fold it into
hci_conn.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 1 Dec 2011 12:33:28 +0000 (14:33 +0200)]
Bluetooth: trivial: correct check for LMP version
Make sure that code match exactly what comment says about pre 1.2
bluetooth version. Since this is HCI detail lmp_ver changed to hci_ver.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 1 Dec 2011 12:33:27 +0000 (14:33 +0200)]
Bluetooth: Remove magic bluetooth version numbers
Use bluetooth names instead of BT SIG assigned numbers
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 2 Dec 2011 23:26:25 +0000 (08:26 +0900)]
Merge branch 'master' of git://git./linux/kernel/git/padovan/bluetooth
Andrei Emeltchenko [Wed, 23 Nov 2011 09:23:34 +0000 (11:23 +0200)]
Bluetooth: Correct version check in hci_setup
Check for hci_ver instead of lmp_ver
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Cong Wang [Tue, 22 Nov 2011 01:32:57 +0000 (09:32 +0800)]
btusb: fix a memory leak in btusb_send_frame()
This patch fixes the following memory leak reported by kmemleak:
unreferenced object 0xffff880060a53840 (size 192):
comm "softirq", pid 0, jiffies
4320571771 (age 1406.569s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<
ffffffff81138a1c>] create_object+0x187/0x28b
[<
ffffffff814be12e>] kmemleak_alloc+0x73/0x98
[<
ffffffff811289d3>] __kmalloc+0xfc/0x123
[<
ffffffff81386546>] usb_alloc_urb+0x1e/0x48
[<
ffffffffa0130274>] btusb_send_frame+0x86/0x385 [btusb]
[<
ffffffffa02d8230>] hci_send_frame+0xa0/0xa5 [bluetooth]
[<
ffffffffa02d8a4e>] hci_cmd_task+0xa0/0xfb [bluetooth]
[<
ffffffff81058548>] tasklet_action+0x8f/0xef
[<
ffffffff81058a4c>] __do_softirq+0xf4/0x1db
[<
ffffffff81058bb7>] run_ksoftirqd+0x84/0x129
[<
ffffffff8106f1c4>] kthread+0xa0/0xa8
[<
ffffffff814dd144>] kernel_thread_helper+0x4/0x10
[<
ffffffffffffffff>] 0xffffffffffffffff
The problem is that when inc_tx() returns non-zero, we forgot
to call usb_free_urb().
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: "Gustavo F. Padovan" <padovan@profusion.mobi>
Signed-off-by: WANG Cong <amwang@redhat.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 1 Dec 2011 12:42:08 +0000 (14:42 +0200)]
Bluetooth: remove old code
Remove old code not touched for several years.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Fri, 2 Dec 2011 12:13:31 +0000 (21:13 +0900)]
Bluetooth: LE Set Scan Parameter Command
This patch adds the parameter struct and the command complete event
handler to the LE Set Scan Parameter HCI command.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Fri, 25 Nov 2011 23:53:38 +0000 (20:53 -0300)]
Bluetooth: Add dev_flags to struct hci_dev
This patch adds the dev_flags field to struct hci_dev. This new
flags variable should be used to define flags related to BR/EDR
and/or LE controller itself. It should be used to define flags
which represents states from the controller. The dev_flags is
cleared in case the controller sends a Reset Command Complete
Event to the host.
Also, this patch adds the HCI_LE_SCAN flag which was created to
track if the controller is performing LE scan or not. The flag
is set/cleared when the controller starts/stops scanning.
This is an initial effort to stop using hdev->flags to define
internal flags since it is exported to userspace by an ioctl.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 24 Nov 2011 12:52:02 +0000 (14:52 +0200)]
Bluetooth: Add HCI Read Flow Control Mode function
Upstream Code Aurora function with minor trivial fixes.
Origin: git://codeaurora.org/kernel/msm.git
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 23 Nov 2011 16:28:36 +0000 (08:28 -0800)]
Bluetooth: Centralize SMP pairing failure handling
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 23 Nov 2011 16:28:35 +0000 (08:28 -0800)]
Bluetooth: Cleanup blkcipher on SMP termination
The blkcipher must be freed to avoid memory leak.
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 23 Nov 2011 16:28:34 +0000 (08:28 -0800)]
Bluetooth: Add HCI User Passkey Req Evt handling
Some MITM scenarios require handling of the User Passkey Request event,
by querying the user, and passing the response back.
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 23 Nov 2011 16:28:33 +0000 (08:28 -0800)]
Bluetooth: Add User Passkey Response handling
For some MITM protection pairing scenarios, the user is
required to enter or accept a 6 digit passkey.
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Wed, 23 Nov 2011 22:11:46 +0000 (20:11 -0200)]
Bluetooth: Add user readable debug for state changes
I did this as a part of a testing course at university, but it might be
useful upstream as well.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Wed, 16 Nov 2011 15:30:20 +0000 (17:30 +0200)]
Bluetooth: Use queue in the device list
Use queue instead of stack discipline for device list. When processing
dev_list with list_for_each* devices will be prosessed in order they
were added (Usually BR/EDR first and AMP later).
Also output from hciconfig looks nicer :-)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 16 Nov 2011 21:53:14 +0000 (13:53 -0800)]
Bluetooth: Differentiate LE User Pairing Responses
Low Energy (LE) pairing responses must be recognized and handled
differently from BR/EDR pairing responses. BR/EDR responses are
handled via HCI commands by the LMP layer, and LE responses are
handled by the Host.
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 16 Nov 2011 21:53:13 +0000 (13:53 -0800)]
Bluetooth: User Pairing Response restructuring
There are 4 possible User Responses to pairing requests,
and they all share the same checks and handling. This
restructures the handling of the two Confirm responses
in preperation for the second two.
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Fri, 18 Nov 2011 11:35:42 +0000 (13:35 +0200)]
Bluetooth: making enable_hs independent from L2CAP
Fixes bluetooth compiling when CONFIG_BT_L2CAP is not enabled
net/built-in.o: In function `hci_dev_open':
(.text+0xdce9a): undefined reference to `enable_hs'
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Wed, 16 Nov 2011 21:53:12 +0000 (13:53 -0800)]
Bluetooth: Add MGMT event for Passkey Entry
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Sat, 19 Nov 2011 12:23:33 +0000 (13:23 +0100)]
Bluetooth: bnep: Fix module reference
We cannot call module_put(THIS_MODULE) if this is our last reference. Otherwise,
this call may cleanup our module before it returns.
Gladly, the kthread API provides a simple wrapper for us. So lets use
module_put_and_exit() to avoid a race condition with the module cleanup code.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Sat, 19 Nov 2011 12:23:32 +0000 (13:23 +0100)]
Bluetooth: cmtp: Fix module reference
We cannot call module_put(THIS_MODULE) if this is our last reference. Otherwise,
this call may cleanup our module before it returns.
Gladly, the kthread API provides a simple wrapper for us. So lets use
module_put_and_exit() to avoid a race condition with the module cleanup code.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Bing Zhao [Thu, 17 Nov 2011 04:40:42 +0000 (20:40 -0800)]
Bluetooth: btmrvl: support Marvell Bluetooth device SD8797
The SD8797 firmware image is shared with mwifiex driver.
Whoever gets loaded first will be responsible for firmware
downloading.
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Frank Huang <frankh@marvell.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Wed, 16 Nov 2011 08:32:21 +0000 (09:32 +0100)]
Bluetooth: Fix some checkpatch.pl errors and warnings
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Wed, 16 Nov 2011 08:32:22 +0000 (09:32 +0100)]
Bluetooth: Simplify __l2cap_global_chan_by_addr
Make __l2cap_global_chan_by_addr similar to other find functions.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Wed, 16 Nov 2011 08:32:20 +0000 (09:32 +0100)]
Bluetooth: Refactor loop in l2cap_retransmit_one_frame
This make it easier to see what is the real reason for loop to exit.
skb_queue_next return valid skb or garbage, not NULL.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Wed, 16 Nov 2011 08:32:19 +0000 (09:32 +0100)]
Bluetooth: Simplify l2cap_add_to_srej_queue
Make it easier to see what is loop break condition.
skb_queue_next return valid skb or garbage, not NULL.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Wed, 16 Nov 2011 08:32:18 +0000 (09:32 +0100)]
Bluetooth: Fix possible NULL pointer derefence in l2cap code
Due to ERTM reliability L2CAP channel needs to be disconnected if
adding to srej list failed.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 14 Nov 2011 10:42:48 +0000 (12:42 +0200)]
Bluetooth: Allow to set AMP type for virtual HCI
Type can be changed during re-opening device /dev/vhci.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Fri, 11 Nov 2011 15:02:15 +0000 (17:02 +0200)]
Bluetooth: Do not set HCI_RAW when HS enabled
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Fri, 11 Nov 2011 15:02:14 +0000 (17:02 +0200)]
Bluetooth: Move scope of kernel parameter enable_hs
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Sun, 13 Nov 2011 06:01:12 +0000 (22:01 -0800)]
Bluetooth: Add MGMT opcodes for Passkey Entry
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Brian Gix [Sun, 13 Nov 2011 06:01:11 +0000 (22:01 -0800)]
Bluetooth: Add HCI defines for User Passkey entry
Signed-off-by: Brian Gix <bgix@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Sat, 12 Nov 2011 09:58:22 +0000 (11:58 +0200)]
Bluetooth: Pass all message parameters to mgmt_start_discovery
The mgmt_start_discovery command contains the type of discovery that
should be started so this should be passed to the start_discovery
function. This patch doesn't yet add any action depending on the type of
the requested discovery.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Fri, 11 Nov 2011 14:18:54 +0000 (16:18 +0200)]
Bluetooth: Add missing cmd_complete for mgmt_load_link_keys
The command complete event was completely missing for this command.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Fri, 11 Nov 2011 16:10:00 +0000 (18:10 +0200)]
Bluetooth: Create a unique mgmt error code hierarchy
The management protocol uses a single byte for error codes (aka command
status). In some places this value is directly copied from HCI and in
other a POSIX error number is used. This makes it impossible for
user-space to uniquily decipher the meaning of an error.
To solve this issue a new mgmt-specific set of error codes is added
along with a conversion table for HCI status values.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Fri, 11 Nov 2011 14:18:52 +0000 (16:18 +0200)]
Bluetooth: Return success instead of EALREADY for mgmt commands
When the adapter state is already what is requested it's more friendly
to user-space to simply report success than to send a EALREADY error
message.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 10 Nov 2011 22:07:35 +0000 (00:07 +0200)]
Bluetooth: Fix mgmt_pair_device imediate error responses
When possible cmd_complete should be returned instead of cmd_status
since it contains the remote address (this helps user-space track what
exactly failed).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 10 Nov 2011 22:07:34 +0000 (00:07 +0200)]
Bluetooth: Add address type to mgmt_pair_device
The kernel needs to know whether it should connect to a device over
BR/EDR or over LE. This is particularly important in the future when
dual-mode device may be connectable also over LE. It is also important
if/when we decide to move the LE advertisement cache from the kernel
into user-space. Adding the type to the mgmt command also ensures
conformance with the latest mgmt API spec.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Wed, 9 Nov 2011 20:14:26 +0000 (17:14 -0300)]
Bluetooth: mgmt_stop_discovery_failed()
This patches creates mgmt_stop_discovery_failed() which removes
pending MGMT_OP_STOP_DISCOVERY commands and sends proper command
status events.
This patch also fixes the MGMT_OP_STOP_DISCOVERY command leak in
case cancel inquiry fails.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Wed, 9 Nov 2011 20:14:25 +0000 (17:14 -0300)]
Bluetooth: Rename mgmt_inquiry_failed()
This patch renames the function mgmt_inquiry_failed() to
mgmt_start_discovery_failed(). This function is more related
to MGMT_OP_START_DISCOVERY command handling than to inquiry.
Besides, this functions will be reused by LE based discovery
procedures in case of failure.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 23 Jun 2011 22:30:48 +0000 (19:30 -0300)]
Bluetooth: Only set ack_timer if we didn't send and ack
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 5 Nov 2011 21:58:31 +0000 (19:58 -0200)]
Bluetooth: Allow L2CAP to increase the security level
Some incomming connections needs to increase the security level by
requesting encryption for example (HID keyboard case). This change allows
the userspace to change it through setsockopt with defer_setup enabled.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 5 Nov 2011 21:54:24 +0000 (19:54 -0200)]
Bluetooth: Rename l2cap_check_security()
rename to l2cap_chan_check_security() to make it consistent with other
l2cap_exported functions. This function will be exported in a later
commit.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 10 Nov 2011 13:54:39 +0000 (15:54 +0200)]
Bluetooth: Add status parameter to mgmt_disconnect response
Since disconnecting may fail the status needs to be communicated to user
space. This also updates the implementation to match the latest mgmt API
specification.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 10 Nov 2011 13:54:38 +0000 (15:54 +0200)]
Bluetooth: Add proper response to mgmt_remove_keys command
Since the command can fail we need to have a proper response with the
remote address and a failure status for it. This also updates it to
conform to the latest mgmt API spec.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 10 Nov 2011 13:54:37 +0000 (15:54 +0200)]
Bluetooth: Fix deadlock with mgmt_pair_device
The hci_conn callbacks are called with the hci_dev lock already held so
no locking should be attempted in them.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Wed, 9 Nov 2011 11:58:58 +0000 (13:58 +0200)]
Bluetooth: Add public/random LE address information to mgmt messages
It's necessary to know the distinction between public and random LE
addresses so the mgmt interface also needs to distinguish between them.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Dan Carpenter [Tue, 8 Nov 2011 03:31:47 +0000 (19:31 -0800)]
mwifiex: prevent corruption instead of just warning
Probably we never hit this condition, but in case we do, we may as
well put a return here instead of just printing a warning message and
then corrupting memory. The caller doesn't check the return code.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Amitkumar Karwar [Tue, 8 Nov 2011 03:31:46 +0000 (19:31 -0800)]
mwifiex: enable SDIO multiport aggregation
By default SDIO multiport aggregation is disabled. It's useful to
get good throughput results. This patch enables it.
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>
Dan Carpenter [Tue, 8 Nov 2011 03:31:45 +0000 (19:31 -0800)]
mwifiex: remove an unneeded NULL check
We dereference adapter in the error handling code so this needed to
be fixed. This function is always called like:
adapter->if_ops.host_to_card(adapter, ...);
so adapter can never be NULL and I've removed the NULL check.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Dan Carpenter [Tue, 8 Nov 2011 03:31:44 +0000 (19:31 -0800)]
mwifiex: remove unneeded kfree(NULL);
The previous if statement means this that pointer is NULL so there
is no need to free it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Julia Lawall [Sun, 6 Nov 2011 13:26:49 +0000 (14:26 +0100)]
net/rfkill/core.c: use kstrtoul, etc
Use kstrtoul, etc instead of the now deprecated strict_strtoul, etc.
A semantic patch rule for the kstrtoul case is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression a,b;
{int,long} *c;
@@
-strict_strtoul
+kstrtoul
(a,b,c)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Julia Lawall [Sun, 6 Nov 2011 13:26:48 +0000 (14:26 +0100)]
net/mac80211/debugfs.c: use kstrtoul, etc
Use kstrtoul, etc instead of the now deprecated strict_strtoul, etc.
A semantic patch rule for the kstrtoul case is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression a,b;
{int,long} *c;
@@
-strict_strtoul
+kstrtoul
(a,b,c)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Johannes Berg [Sun, 6 Nov 2011 13:13:34 +0000 (14:13 +0100)]
mac80211: implement wifi TX status
Implement the socket wifi TX status error
queue reflection in mac80211.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Johannes Berg [Sun, 6 Nov 2011 13:13:33 +0000 (14:13 +0100)]
nl80211: advertise socket TX status capability
The new wifi socket TX capability should be
supported by wifi drivers, let them advertise
whether they do or not.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Helmut Schaa [Sat, 5 Nov 2011 13:15:24 +0000 (14:15 +0100)]
mac80211: Also report the STA's TDLS flag via nl80211
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 4 Nov 2011 21:23:42 +0000 (22:23 +0100)]
brcm80211: fmac: optimize chip core info management
Prepare for adding backplane interconnect type support
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 4 Nov 2011 21:23:41 +0000 (22:23 +0100)]
brcm80211: fmac: replace private SB macros with ssb_regs version
Use SSB macros in order to clean up brcmfmac code
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 4 Nov 2011 21:23:40 +0000 (22:23 +0100)]
brcm80211: fmac: move chip drive strength related code to sdio_chip.c
This patch is part of the abstracting chip backplane handle code
series.
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 4 Nov 2011 21:23:39 +0000 (22:23 +0100)]
brcm80211: fmac: move chip detach function to sdio_chip.c
This patch is part of the abstracting chip backplane handle code
series.
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 4 Nov 2011 21:23:38 +0000 (22:23 +0100)]
brcm80211: fmac: move chip reset core function to sdio_chip.c
This patch is part of the abstracting chip backplane handle code
series.
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>