summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
Commit message (Collapse)AuthorAgeFilesLines
...
| * | net: rename SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATAEric Dumazet2015-12-011-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a cleanup to make following patch easier to review. Goal is to move SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA from (struct socket)->flags to a (struct socket_wq)->flags to benefit from RCU protection in sock_wake_async() To ease backports, we rename both constants. Two new helpers, sk_set_bit(int nr, struct sock *sk) and sk_clear_bit(int net, struct sock *sk) are added so that following patch can change their implementation. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | Bluetooth: Increment management interface revisionJohan Hedberg2015-11-231-1/+1
| | | | | | | | | | | | | | | | | | This patch increments the management interface revision due to introduction of a new Get Advertising Size Information command and various other fixes & improvements. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Fix powering on with privacy and advertisingAndrzej Kaczmarek2015-11-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to enable advertising with privacy enabled, SMP has to be registered in order to generate new RPA. During power on, it will be registered at the very end which is the reason why advertising is not enabled and it's not possible to enable it anymore due to mismatch between hci_dev settings and actual controller state. This fixes this problem by moving SMP registration earlier, just after controller is powered (which is ok, because LE SMP will be already able to decide on identity address to be used), but before advertising is enabled. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Fix returning proper HCI status from __hci_req_syncJohan Hedberg2015-11-231-1/+7
| | | | | | | | | | | | | | | | | | There were a couple of code paths missed by the previous patch that added a HCI status return parameter to __hci_req_sync. This patch adds the missing assignments for them. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add support for Get Advertising Size Information commandMarcel Holtmann2015-11-221-0/+58
| | | | | | | | | | | | | | | | | | | | The Get Advertising Size Information command allows to retrieve size information for advertising data and scan response data fields depending on the selected flags. This is useful if applications want to know the available size ahead of time. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Simplify if statements in tlv_data_is_valid functionMarcel Holtmann2015-11-221-9/+11
| | | | | | | | | | | | | | | | | | The if statements for checking the flags parameter could be written a bit easier to read. This changes this. No functional behavior has been changed. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Add instance range check for Add Advertising commandMarcel Holtmann2015-11-221-0/+4
| | | | | | | | | | | | | | | | | | | | The instance range check for Add Advertising command is missing. If the provided instance is out of range an Invalid Parameters error should be returned. At the moment, the generic Failed error is returned. This extra check ensures that clear error messages are returned. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: remove unneeded variable in l2cap_stream_rxPrasanna Karthik2015-11-191-3/+1
| | | | | | | | | | | | | | | | Remove unneeded variable used to store return value. Error reported by coccicheck. Signed-off-by: Prasanna Karthik <mkarthi3@visteon.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Clean up hci_core codePrasanna Karthik2015-11-191-3/+4
| | | | | | | | | | | | | | | | | | Fix errors reported by checkpatch. - ERROR: spaces required around that ':' (ctx:VxW) - ERROR: open brace '{' following function declarations go on the next line Signed-off-by: Prasanna Karthik <mkarthi3@visteon.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: clean up af_bluetooth codePrasanna Karthik2015-11-191-2/+2
| | | | | | | | | | | | | | | | Fix error reported by checkpatch. ERROR:"foo* bar" should be "foo *bar" Signed-off-by: Prasanna Karthik <mkarthi3@visteon.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Delete an unnecessary check before the function call "kfree_skb"Markus Elfring2015-11-191-2/+1
| | | | | | | | | | | | | | | | | | | | The kfree_skb() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Simplify request cleanup codeJohan Hedberg2015-11-192-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The hci_req_sync_cancel() is just as much related to the request cleanup as hci_request_cancel_all() is. Just move the former into the latter and do the cleanup from a single place in hci_dev_do_close(). The important thing is to avoid deadlocks by holding the req_sync lock: previously hci_request_cancel_all was done right after releasing the lock and with this patch it's right before taking it. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Remove conn_unfinished variable from hci_connect_le()Johan Hedberg2015-11-191-36/+12
| | | | | | | | | | | | | | | | | | | | The conn_unfinished variable makes the entire logic of hci_connect_le() rather confusing. By restructuring and clarifying the logic we can actually remove the conn_unfinished variable and still keep the same behavior. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Move check for ongoing connect earlier in hci_connect_le()Johan Hedberg2015-11-191-6/+6
| | | | | | | | | | | | | | | | This helps simplify the logic in further patches (less cleanups to do in this failure branch). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Fix specifying role for LE connectionsJohan Hedberg2015-11-193-12/+10
| | | | | | | | | | | | | | | | | | | | | | The hci_connect_le_scan() is (as the name implies) a master/central role API, so it makes no sense in passing a role parameter to it. At the same time this patch also fixes the direct advertising support for LE L2CAP sockets where we now call the more appropriate hci_le_connect() API if slave/peripheral role is desired. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Remove unnecessary le_scan_restart_work_complete() functionJohan Hedberg2015-11-191-36/+24
| | | | | | | | | | | | | | | | The only user of this, le_scan_restart_work(), is so short and simple that it makes sense to just merge the code there. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Simplify le_scan_disable_work()Johan Hedberg2015-11-191-91/+57
| | | | | | | | | | | | | | | | | | Merge le_scan_disable_work_complete into the main le_scan_disable_work function and take advantage of the updated bredr_inquiry() to run the Inquiry through hci_req_sync(). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Pass inquiry length to bredr_inquiry()Johan Hedberg2015-11-191-3/+5
| | | | | | | | | | | | | | | | | | Passing the needed inquiry length to bredr_inquiry() makes it possible to also use this helper for interleaved discovery where the controller doesn't support simultaneous Inquiry & LE scan. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Fix BR/EDR Page Scan update with Add DeviceJohan Hedberg2015-11-191-13/+1
| | | | | | | | | | | | | | | | | | The recent changes to remove dependency on HCI in Add Device missed out relevant changes for BR/EDR. This patch removes the left-overs and ensures the right HCI command gets queued for BR/EDR. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Move Stop Discovery to req_workqueueJohan Hedberg2015-11-193-67/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since discovery also deals with LE scanning it makes sense to move it behind the same req_workqueue as other LE scanning changes. This also simplifies the logic since we do many of the actions in a synchronous manner. Part of this refactoring is moving hci_req_stop_discovery() to hci_request.c. At the same time the function receives support for properly handling the STOPPING state since that's the state we'll be in when stopping through the req_workqueue. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Move Start Discovery to req_workqueueJohan Hedberg2015-11-192-229/+211
| | | | | | | | | | | | | | | | | | | | Since discovery also deals with LE scanning it makes sense to move it behind the same req_workqueue as other LE scanning changes. This also simplifies the logic since we do many of the actions in a synchronous manner. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add error return value to hci_req_sync callbackJohan Hedberg2015-11-193-26/+54
| | | | | | | | | | | | | | | | | | | | In some circumstances it may be useful to abort the request through checks done in the request callback. To make the feature possible this patch changes the return value of the request callback from void to int and aborts the request if a non-zero value is returned. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add discovery type validity helperJohan Hedberg2015-11-191-0/+40
| | | | | | | | | | | | | | | | | | | | As preparation for moving the discovery HCI commands behind req_workqueue, add a helper and do the validity checks of the given discovery type before proceeding further. This way we don't need to do them again in hci_request.c. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Move LE scan disable/restart behind req_workqueueJohan Hedberg2015-11-193-170/+181
| | | | | | | | | | | | | | | | | | To avoid any risks of races, place also these LE scan modification work callbacks behind the same work queue as the other LE scan changes. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Make __hci_update_background_scan private to hci_request.cJohan Hedberg2015-11-192-3/+1
| | | | | | | | | | | | | | There are no more external users so this API can be made private. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Use req_workqueue for background scanning when powering onJohan Hedberg2015-11-191-6/+4
| | | | | | | | | | | | | | | | | | We can easily use the new req_workqueue based background scan update for the power on case. This also removes the last external user of __hci_update_background_scan(). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Use req_workqueue for explicit connect requestsJohan Hedberg2015-11-192-36/+18
| | | | | | | | | | | | | | | | | | Since explicit connect requests are also a sub-category of passive scan updates, run them through the same workqueue as the other passive scan changes. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add HCI status return parameter to hci_req_sync()Johan Hedberg2015-11-193-18/+24
| | | | | | | | | | | | | | | | | | | | | | In some cases it may be important to get the exact HCI status rather than the converted HCI-to-errno value. Add an optional return parameter to the hci_req_sync() API to allow for this. Since there are no good HCI translation candidates for cancelation and timeout, use the "unknown" status code for those cases. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Don't wait for HCI in Add/Remove DeviceJohan Hedberg2015-11-191-111/+50
| | | | | | | | | | | | | | | | | | There's no point in waiting for HCI activity in Add/Remove Device since the effects of these calls are long-lasting and we can anyway not report up to the application all HCI failures. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Run all background scan updates through req_workqueueJohan Hedberg2015-11-193-24/+23
| | | | | | | | | | | | | | | | | | Instead of firing off a simple async request queue all background scan updates through req_workqueue and use hci_req_sync() there to ensure that no two updates overlap with each other. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add stubs for synchronous HCI request functionalityJohan Hedberg2015-11-193-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Prepare hci_request.c to have code for doing synchronous HCI requests, such as LE scanning or advertising changes. The necessary work callbacks will be set up in hci_request_setup() and cleaned up in hci_request_cancel_all(). The former is used when an HCI device get registered, and the latter each time it is powered off (or unregistered). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add 'sync' specifier to synchronous request APIsJohan Hedberg2015-11-193-20/+20
| | | | | | | | | | | | | | | | To make it clear which HCI request APIs target specifically synchronous requests, add 'sync' to the API names. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Move synchronous request handling into hci_request.cJohan Hedberg2015-11-193-193/+195
| | | | | | | | | | | | | | | | | | hci_request.c is a more natural place for the synchronous request handling. Furthermore, we will soon need access to some of the previously private-to-hci_core.c functions from hci_request.c. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Remove unnecessary call to hci_update_background_scanJohan Hedberg2015-11-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | The hci_conn_params_clear_all() function is only called from hci_unregister_dev() at which point it's completely futile to try to do any LE scanning updates. Simply remove this unnecessary function call. At the same time we can make the function static since it's only accessed from within the same c-file. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add support for controller specific loggingMarcel Holtmann2015-11-191-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To enable controller specific logging, the userspace daemon has to have the ability to log per controller. To facilitate this support, provide a dedicated logging channel. Messages in this channel will be included in the monitor queue and with that also forwarded to monitoring tools along with the actual hardware traces. All messages from the logging channel are timestamped and with that allow an easy correlation between userspace messages and hardware events. This will increase the ability to debug problems faster. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Add support for sending system notes to monitor channelMarcel Holtmann2015-11-192-5/+32
| | | | | | | | | | | | | | | | | | The monitor channel can be used to send generic system notes as text strings for debugging purposes. This adds the system note monitor code and uses it for including kernel and subsystem version into traces. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Fix casting coding style within HCI socketsMarcel Holtmann2015-11-191-13/+13
| | | | | | | | | | | | | | | | The HCI sockets code has still some old casting coding style. Fix this to match with the rest of the code. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Add clarifying comment why schedule_work is usedJohan Hedberg2015-11-191-0/+4
| | | | | | | | | | | | | | | | It's not obvious why schedule_work is used instead of queue_work. Add a comment explaining why. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Add missing hci_skb_opcode for raw socket commandsMarcel Holtmann2015-11-191-0/+5
| | | | | | | | | | | | | | | | When HCI commands are injected via the raw socket, the core was not including the decoded opcode value. So ensure that it is actually set. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Compress the size of struct hci_ctrlJohan Hedberg2015-11-193-11/+15
| | | | | | | | | | | | | | | | | | We can reduce the size of the hci_ctrl struct by converting 'bool req_start' to 'u8 req_flags' and making the two function pointers a union (since only one is ever set at a time). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* | Bluetooth: Use new hci_skb_pkt_* wrappers for core packet handlingMarcel Holtmann2015-11-193-32/+33
| | | | | | | | | | | | | | | | The new hci_skb_pkt_* wrappers only help if they are used consistently in the Bluetooth subsystem. So first convert the core packet handling. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Make LE only events conditional on supported commandsMarcel Holtmann2015-11-191-4/+18
| | | | | | | | | | | | | | | | For the LE only controllers, there are events that should not be enabled if the corresponding command is not supported. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Fix issue with HCI_QUIRK_FIXUP_INQUIRY_MODE and event maskMarcel Holtmann2015-11-191-1/+2
| | | | | | | | | | | | | | | | | | When setting the event mask, the HCI_QUIRK_FIXUP_INQUIRY_MODE quirk is required to be checked so that the Inquiry Result with RSSI event gets actually enabled. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Build LE event mask based on supported commandsMarcel Holtmann2015-11-191-1/+28
| | | | | | | | | | | | | | | | The LE event mask should be created based on the commands that are actually supported by the controller. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* | Bluetooth: Move BR/EDR default events behind its featuresMarcel Holtmann2015-11-191-4/+8
|/ | | | | | | | There are some BR/EDR default events for Bluetooth 1.2 or later controllers that are not conditional on their features being present. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: L2CAP: Add missing checks for invalid LE DCIDJohan Hedberg2015-11-051-1/+8
| | | | | | | | | When receiving a connect response we should make sure that the DCID is within the valid range and that we don't already have another channel allocated for the same DCID. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: L2CAP: Fix checked range when allocating new CIDJohan Hedberg2015-11-051-1/+1
| | | | | | | | The 'dyn_end' value is also a valid CID so it should be included in the range of values checked. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: L2CAP: Fix returning correct LE CoC response codesJohan Hedberg2015-11-051-1/+8
| | | | | | | | | The core spec defines specific response codes for situations when the received CID is incorrect. Add the defines for these and return them as appropriate from the LE Connect Request handler function. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Check for supported white list before issuing commandsMarcel Holtmann2015-11-051-6/+11
| | | | | | | | | | The white list commands might not be implemented if the controller does not actually support the white list. So check the supported commands first before issuing these commands. Not supporting the white list is the same as supporting a white list with zero size. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* bluetooth: 6lowpan: fix NOHZ: local_softirq_pendingAlexander Aring2015-10-271-1/+1
| | | | | | | | | | | | | | | | | | | Jukka reported about the following warning: "NOHZ: local_softirq_pending 08" I remember this warning and we had a similar issue when using workqueues and calling netif_rx. See commit 5ff3fec ("mac802154: fix NOHZ local_softirq_pending 08 warning"). This warning occurs when calling "netif_rx" inside the wrong context (non softirq context). The net core api offers "netif_rx_ni" to call netif_rx inside the correct softirq context. Reported-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
OpenPOWER on IntegriCloud