summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Bluetooth: Make better use of l2cap_chan reference countingMat Martineau2012-05-092-0/+9
| | | | | | | | | | | | | L2CAP sockets contain a pointer to l2cap_chan that needs to be reference counted in order to prevent a possible dangling pointer when the channel is freed. There were a few other cases where an l2cap_chan pointer on the stack was dereferenced after a call to l2cap_chan_del. Those pointers are also now reference counted. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Remove unused functionMat Martineau2012-05-091-11/+0
| | | | | | | | l2cap_get_chan_by_ident was not used, but didn't generate a compiler warning because it was an inline function. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Initialize new l2cap_chan structure membersMat Martineau2012-05-091-8/+17
| | | | | | | | | | Structure members used by ERTM or streaming mode need to be initialized when an ERTM or streaming mode link is configured. Some duplicate code is also eliminated by moving in to the ERTM init function. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Move recently-added ERTM header packing functionsMat Martineau2012-05-091-100/+100
| | | | | | | | | | Moving these functions simplifies future patches by eliminating forward declarations, makes future patches easier to review, and better preserves 'git blame' information. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Remove duplicate structure members from bt_skb_cbMat Martineau2012-05-092-22/+19
| | | | | | | | These values are now in the nested l2cap_ctrl struct. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Improve ERTM sequence number offset calculationMat Martineau2012-05-091-7/+4
| | | | | | | | | | | | Instead of using modular division, the offset can be calculated using only addition and subtraction. The previous calculation did not work as intended and was more difficult to understand, involving unsigned integer underflow and a check for a negative value where one was not possible. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: btmrvl: configure default host sleep parametersAmitkumar Karwar2012-05-093-22/+35
| | | | | | | | | | | | | | | Currently debugfs commands "hscfgcmd" and "gpiogap" are provided for host sleep configuration. But if user doesn't configure host sleep parameters using these commands, host sleep activation is failed during suspend (support for suspend and resume handlers is added in next patch). Default host sleep configuration is done during driver initialisation in this patch. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Remove advertising cacheAndre Guedes2012-05-093-90/+0
| | | | | | | | | | User-space pass the remote device address type to kernel through struct sockaddr_l2 what makes the advertising useless. This patch removes all advertising cache code. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Use address type info from user-spaceAndre Guedes2012-05-093-7/+8
| | | | | | | | | | | | | | In order to establish a LE connection we need the address type information. User-space already pass this information to kernel through struct sockaddr_l2. This patch adds the dst_type parameter to l2cap_chan_connect so we are able to pass the address type info from user-space down to hci_conn layer. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Add dst_type parameter to hci_connectAndre Guedes2012-05-095-18/+14
| | | | | | | | | | | | This patch adds the dst_type parameter to hci_connect function. Instead of searching the address type in advertising cache, we use the dst_type parameter to establish LE connections. The dst_type is ignored for BR/EDR connection establishment. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Move bdaddr_to_le to hci_coreAndre Guedes2012-05-093-12/+14
| | | | | | | | | This patch moves the helper function bdaddr_to_le to hci_core, so it can be used in mgmt.c and hci_conn.c. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Rename mgmt_to_le to bdaddr_to_leAndre Guedes2012-05-091-3/+3
| | | | | | | | | | Since address type macros are not only related to Management Interface anymore, it makes sense to rename the helper function mgmt_to_le to bdaddr_to_le. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Add address type to struct sockaddr_l2Andre Guedes2012-05-091-0/+1
| | | | | | | | | | | | | | This patch adds the address type info to struct sockaddr_l2 so user-space can inform the remote device address type required to establish LE connections. Soon, instead of looking the advertising cache up to discover the address type, we'll use this address type info to establish LE connections. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Rename link_to_mgmt to link_to_bdaddrAndre Guedes2012-05-091-14/+14
| | | | | | | | | | Since address type macros are not only related to Management Interface anymore, it makes sense to rename the helper function link_to_mgmt to link_to_bdaddr. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Move address type macros to bluetooth.hAndre Guedes2012-05-093-25/+26
| | | | | | | | | | This patch moves address type macros to bluetooth.h since they will be used by management interface and Bluetooth socket interface. It also replaces the macro prefix MGMT_ADDR_ by BDADDR_. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: trivial: Remove empty lineAndrei Emeltchenko2012-05-091-1/+0
| | | | | Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Remove useless code in hci_connectAndre Guedes2012-05-091-3/+0
| | | | | | | | | | This patch removes unneeded variable assignments in hci_connect. 'sec_level' is already assigned to BT_SECURITY_LOW in hci_le_connect and 'pending_sec_level' and 'auth_type' are assigned right after if statement. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Add support for reusing the same hci_conn for LE linksVinicius Costa Gomes2012-05-092-37/+58
| | | | | | | | | | | | | | | | | As most LE devices leave advertising mode when they enter the connected state, we may want to "pass" that connection to other users. The first user will be the pairing procedure, the connection is established without an associated socket, after the pairing is complete, userspace may want to discover via GATT what services the newly bonded device has. If userspace establishes the connection while the timeout still hasn't expired, the connection will be re-used. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Tested-by: João Paulo Rechi Vita <jprvita@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Search global l2cap channels by src/dst addressesIdo Yariv2012-05-091-12/+31
| | | | | | | | | | | | | | | | | The cid or psm and the source address might not be enough to uniquely identify a global channel, especially when the source address is our own. For instance, when trying to communicate with two LE devices in master mode, data received from the both devices is sent to the same socket. Fix this by taking the destination address into account when choosing the socket. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Arik Nemtsov <arik@wizery.com> Tested-by: João Paulo Rechi Vita <jprvita@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Remove unneeded initialization in hci_alloc_dev()David Herrmann2012-05-091-10/+0
| | | | | | | | We allocate memory with kzalloc() so there is no need to call memset(..., 0, ...) or similar. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Move device initialization to hci_alloc_dev()David Herrmann2012-05-091-63/+52
| | | | | | | | | | | | | | | | | | | | | | | We currently initialize locks, lists, works, etc. in hci_register_dev() (hci_alloc_dev() was added later) which is bogus because an hdev is in an invalid state if it is not registered. This patch moves all memory initialization to hci_alloc_dev(). Device registering and registration of sub-modules is still left in hci_register_dev() as it belongs there. The benefit is (despite cleaning up the code-base) we can now always be sure that an hdev is a valid object and can be locked and worked on even though it may not be registered. This patch also reorders the initialization to be easier to understand. First the memory is initialized, then all generic structures and as last step the sub-init functions are called. This guarantees that all dependencies are initialized in the right order and makes it also easier to find a specific line. We previously initialized it in the same order as the "struct hci_dev" is declared which seems pretty random. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Move hci_alloc/free_dev close to hci_register/unregister_devDavid Herrmann2012-05-091-26/+26
| | | | | | | | | | alloc() and register() (and free() and unregister()) are closely related so move them more closely together. This will also allow to move functionality from register() to alloc() without needing forward-declarations. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Restrict to one SCO listening socketMarcel Holtmann2012-05-091-7/+22
| | | | | | | | The SCO sockets are only identified by its address. So only allow one SCO socket in listening state per address or BDADDR_ANY. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Don't check source address in SCO bind functionMarcel Holtmann2012-05-091-10/+6
| | | | | | | | | Checking the source address in SCO bind function will prevent from having an incoming and outgoing SCO socket. However that might be needed in case of multiple SCO connections on a single device. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Fix registering hci with duplicate nameUlisses Furquim2012-05-091-6/+10
| | | | | | | | | | | | | | | | | | | | | | When adding HCI devices hci_register_dev assigns the same name hci1 for subsequently added AMP devices. ... [ 6958.381886] sysfs: cannot create duplicate filename '/devices/virtual/bluetooth/hci1 ... We assume id starts with the number we'll try to add the new device and keep iterating until we find the proper place. The only difference is we start with 0 for BR/EDR device and 1 for AMP devices (thus AMP devices will never receive register as index 0). Then every hdev->id in the _ordered_ list <= to the id we want we increment id and move the variable head. In the end we'll have id as the first available one and head is where you need to add hdev after to keep the list ordered. Reported-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Ulisses Furquim <ulisses@profusion.mobi> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Remove not needed status parameterLukasz Rymanowski2012-05-091-4/+4
| | | | | | | Sco_conn_add is called from two places and always with status = 0. Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Split error handling for SCO listen socketsMarcel Holtmann2012-05-091-1/+6
| | | | | | | | Split the checks for sk->sk_state and sk->sk_type for SCO listen sockets. This makes the code more readable. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Split error handling for L2CAP listen socketsMarcel Holtmann2012-05-091-2/+6
| | | | | | | | Split the checks for sk->sk_state and sk->sk_type for L2CAP listen sockets. This makes the code more readable. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Don't distribute keys in case of Encryption FailureHemant Gupta2012-05-091-1/+2
| | | | | | | SMP Keys should only be distributeed when encryption is successful. Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: btusb: Dynamic alternate settingMikel Astiz2012-05-091-2/+11
| | | | | | | | | | | The alternate setting must be dynamically set according to the number of active SCO links, and the bit depth of the audio. The possible values for the alternate setting are described in the Bluetooth Core Specification, Volume 4, Part B, section 2.1.1. Signed-off-by: Mikel Astiz <mikel.astiz.oss@gmail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Fix debug printing unallocated nameAndrei Emeltchenko2012-05-091-2/+3
| | | | | | | It does make sense to print hdev name after allocation. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Remove strtoba header declared but not definedSyam Sidhardhan2012-05-091-1/+0
| | | | | | | No one is using strtoba() in the bluetooth subsystem. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: remove header declared but not definedSyam Sidhardhan2012-05-091-2/+0
| | | | | | | hci_del_off_timer() doesn't exist anymore. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: mgmt: Fix address type while loading Long Term KeyHemant Gupta2012-05-091-1/+14
| | | | | | | | | This patch fixes the address type while loading long term keys when BT is switched on. Without this fix pairing is reinitated even though LTK exists for remote device because of mismatch of address type. Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: mgmt: Remove unwanted goto statementsSyam Sidhardhan2012-05-091-12/+4
| | | | | | | | Remove goto statements that do nothing else than jump to the next line of code. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: remove unneeded declaration of sco_conn_del()Gustavo Padovan2012-05-091-2/+0
| | | | | | By some reason this is not needed anymore. Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Remove unnecessary checkMikel Astiz2012-05-091-6/+4
| | | | | | | | | The function already fails if the given size is greater than the MTU, so there is no need to consider that case afterwards. Signed-off-by: Mikel Astiz <mikel.astiz.oss@gmail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Use unsigned int instead of signed intMikel Astiz2012-05-091-2/+2
| | | | | | | | | | | | | | | The involved values are all unsigned and thus unsigned int should be used instead of signed int. Assigning ~0 to a signed int results in -1, which is confusing and error-prone, while the code is trying to set the maximum value possible. The code still works because the C standard defines that unsigned comparison will be performed in these cases, when comparing an unsigned int and a signed int. Signed-off-by: Mikel Astiz <mikel.astiz.oss@gmail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: btmrvl_sdio: remove pointless conditional before release_firmware()Jesper Juhl2012-05-091-7/+2
| | | | | | | | release_firmware() deals gracefullt with NULL pointers so there's no reason to test for one prior to calling the function. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Functions for handling ERTM control fieldsMat Martineau2012-05-091-0/+113
| | | | | | | | | These functions encode or decode ERTM control fields (extended or enhanced) to or from the new l2cap_ctrl structure. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Add the l2cap_seq_list structure for tracking framesMat Martineau2012-05-092-8/+154
| | | | | | | | | | | | A sequence list is a data structure used to track frames that need to be retransmitted, and frames that have been requested for retransmission by the remote device. It can compactly represent a list of sequence numbers within the ERTM transmit window. Memory for the list is allocated once at connection time, and common operations in ERTM are O(1). Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Remove err parameter from alloc_skb()Gustavo Padovan2012-05-093-22/+22
| | | | | | | | Use ERR_PTR maginc instead. Signed-off-by: Gustavo Padovan <gustavo@padovan.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Adds set_default function in L2CAP setupAndrei Emeltchenko2012-05-093-6/+14
| | | | | | | | | Some parameters in L2CAP chan are set to default similar way in socket based channels and A2MP channels. Adds common function which sets all defaults. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: Add Read Local AMP Info to initAndrei Emeltchenko2012-05-091-0/+3
| | | | | | | AMP Info will be used in Discovery Response. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: mgmt: Fix missing connect failed event for LEHemant Gupta2012-05-091-0/+2
| | | | | | | | | This patch adds management connect failed event when LE Create Connection Command fails to inform user space that LE Connection failed to get established. Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Fix clearing discovery type when stopping discoveryHemant Gupta2012-05-091-1/+0
| | | | | | | | | | | This patch prevents resetting of discovery type while stopping discovery, since otherwise the wrong type might be send in case of discovery failure. It also doesn't matter that we are "lazy" with updating the type since it is anyway reset when starting discovery again and it's not needed to know the current discovery state. Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Remove MGMT_ADDR_INVALID macroAndre Guedes2012-05-092-8/+7
| | | | | | | | This patch removes the MGMT_ADDR_INVALID macro. If the address type isn't LE, we consider it is BR/EDR type. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Send correct address type for LTKHemant Gupta2012-05-091-1/+1
| | | | | | | | This patch updates the address type sent from kernel to management interface of BlueZ while sending the Long Term Key. Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Remove unneeded zero initializationAndrei Emeltchenko2012-05-091-1/+0
| | | | | | | | | Remove zero initialization since channel is allocated with kzalloc in l2cap_chan_create. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
* Bluetooth: vhci: Ignore return code of nonseekable_open()David Herrmann2012-05-091-1/+2
| | | | | | | | | | | | | | The comment in ./fs/open.c clearly states that nonseekable_open() will never fail. Therefore, we can safely ignore the return code. This is the recommended way to deal with nonseekable_open(). Our current code looks like nonseekable_open() is checked for the return code. However, if we check the return code, we must also kfree() our private data if the open fails. To avoid this overhead and to avoid confusion, we simply drop the return code and return 0. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
OpenPOWER on IntegriCloud