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.
Andre Guedes [Wed, 25 Apr 2012 00:02:56 +0000 (21:02 -0300)]
Bluetooth: Remove advertising cache
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>
Andre Guedes [Wed, 25 Apr 2012 00:02:55 +0000 (21:02 -0300)]
Bluetooth: Use address type info from user-space
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>
Andre Guedes [Wed, 25 Apr 2012 00:02:54 +0000 (21:02 -0300)]
Bluetooth: Add dst_type parameter to hci_connect
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>
Andre Guedes [Wed, 25 Apr 2012 00:02:51 +0000 (21:02 -0300)]
Bluetooth: Rename mgmt_to_le to bdaddr_to_le
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>
Andre Guedes [Wed, 25 Apr 2012 00:02:52 +0000 (21:02 -0300)]
Bluetooth: Add address type to struct sockaddr_l2
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>
Andre Guedes [Wed, 25 Apr 2012 00:02:50 +0000 (21:02 -0300)]
Bluetooth: Rename link_to_mgmt to link_to_bdaddr
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>
Andre Guedes [Wed, 25 Apr 2012 00:02:49 +0000 (21:02 -0300)]
Bluetooth: Move address type macros to bluetooth.h
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>
Andre Guedes [Tue, 24 Apr 2012 19:11:11 +0000 (16:11 -0300)]
Bluetooth: Remove useless code in hci_connect
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 links
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>
David Herrmann [Sun, 22 Apr 2012 12:39:58 +0000 (14:39 +0200)]
Bluetooth: Move device initialization to hci_alloc_dev()
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>
David Herrmann [Sun, 22 Apr 2012 12:39:57 +0000 (14:39 +0200)]
Bluetooth: Move hci_alloc/free_dev close to hci_register/unregister_dev
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: Don't check source address in SCO bind function
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.
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.
Mikel Astiz [Wed, 11 Apr 2012 06:48:51 +0000 (08:48 +0200)]
Bluetooth: btusb: Dynamic alternate setting
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.
Bluetooth: mgmt: Fix address type while loading Long Term Key
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>
Mikel Astiz [Wed, 11 Apr 2012 06:48:47 +0000 (08:48 +0200)]
Bluetooth: Use unsigned int instead of signed int
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.
Mat Martineau [Wed, 11 Apr 2012 17:48:42 +0000 (10:48 -0700)]
Bluetooth: Add the l2cap_seq_list structure for tracking frames
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: mgmt: Fix missing connect failed event for LE
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 discovery
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>
David Herrmann [Wed, 28 Mar 2012 09:48:42 +0000 (11:48 +0200)]
Bluetooth: vhci: Ignore return code of nonseekable_open()
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>
Marcel Holtmann [Tue, 27 Mar 2012 16:49:02 +0000 (18:49 +0200)]
Bluetooth: Update management interface revision
For each kernel release where commands or events are added to the
management interface, the revision field should be increment by one.
The increment should only happen once per kernel release and not
for every command/event that gets added. The revision value is for
informational purposes only, but this simple policy would make any
future debugging a lot simple.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
...
net/bluetooth/l2cap_core.c:302:6: warning: symbol '__l2cap_chan_add' was
not declared. Should it be static?
net/bluetooth/l2cap_core.c:351:6: warning: symbol 'l2cap_chan_add' was
not declared. Should it be static?
...
Mat Martineau [Fri, 23 Mar 2012 23:56:56 +0000 (16:56 -0700)]
Bluetooth: Add a structure to carry ERTM data in skb control blocks
Every field from ERTM control headers is now carried in the control
block so it only has to be parsed or generated once, and can be
efficiently accessed throughout the ERTM code.
Mat Martineau [Fri, 23 Mar 2012 23:56:55 +0000 (16:56 -0700)]
Bluetooth: Add definitions and struct members for new ERTM state machine
Adds some missing values for control field parsing, additional data
for the new state machine, and enumerations for states, incoming
packet classification, and state machine events.
Andre Guedes [Wed, 21 Mar 2012 03:03:37 +0000 (00:03 -0300)]
Bluetooth: Check HCI_PERIODIC_INQ in start_discovery
This patch adds a HCI_PERIODIC_INQ check to start_discovery.
If periodic inquiry is enabled, we fail MGMT Start Discovery
command with MGMT_STATUS_BUSY code.
Fix sparse warnings related to incorrect type in assignment and static
symbol. Also use const keyword. Warnings are shown below:
...
net/bluetooth/mgmt.c:305:28: warning: incorrect type in assignment
(different base types)
net/bluetooth/mgmt.c:305:28: expected unsigned short [usertype] *opcode
net/bluetooth/mgmt.c:305:28: got restricted __le16 *<noident>
...
net/bluetooth/mgmt.c:2609:3: warning: symbol 'mgmt_handlers' was not declared.
Should it be static?
...
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Marcel Holtmann [Wed, 14 Mar 2012 16:08:46 +0000 (18:08 +0200)]
Bluetooth: Fix broken usage of put_unaligned_le16
In case the struct is already __packed, there is no need to use
unaligned access to the data. So just use cpu_to_le16 or
__constant_cpu_to_le16 in these cases.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
David Herrmann [Fri, 9 Mar 2012 14:53:42 +0000 (15:53 +0100)]
Bluetooth: Remove redundant hdev->parent field
We initialize the "struct device" in hci_alloc_dev() for a long time now
so we can access hdev->dev.parent directly. Hence, we can drop the
temporary field hdev->parent which is used in no other place than
hci_add_sysfs().
SET_HCIDEV_DEV() is never called after registering a device by the
drivers so we do not overwrite internal device-state. Furthermore,
hdev->dev is initialized to 0 by kzalloc() inside hci_alloc_dev() so the
default behavior with dev.parent = NULL is kept.
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>
{nl,cfg,mac}80211: Allow user to see/configure HT protection mode
This patch introduces a new mesh configuration parameter "ht_opmode" and will
allow user to check the current HT protection mode selected. Users could
configure the protection mode by the command "iw mesh_iface set mesh_param
mesh_ht_protection_mode=2". The default protection mode of mesh is set to
non-HT mixed mode.
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> Reviewed-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Now that we have protection enabled, allow non-HT and HT20 stations to peer
with HT40+/- stations. Peering is still disallowed for HT40+/- mismatch.
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> Reviewed-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Section 9.23.3.5 of IEEE 80211s standard describes the protection rules for
HT mesh STA in a MBSS. Three HT protection modes are supported for now:
non-HT mixed mode - is selected if any non-HT peers are present in our MBSS.
20MHz-protection mode - is selected if all peers in our 20/40MHz MBSS support
HT and atleast one HT20 peer is present.
no-protection mode - is selected otherwise.
This is a limited implementation of 9.23.3.5, which only considers mesh peers
when determining the HT protection mode. Station's channel_type needs to be
maintained.
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> Reviewed-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> Reviewed-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Since the BSS table is organized in a RB tree, the BSSs need to be
comparable. This means that we must define a < and > operator to
the BSS object.
compare_ethr_addr isn't enough since it returns only a binary value.
Since Felix's
cfg80211: use compare_ether_addr on MAC addresses instead of memcmp
Because of the constant size and guaranteed 16 bit alignment, the inline
compare_ether_addr function is much cheaper than calling memcmp.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
The BSS table is corrupted: rb_find_bss can't find the bss.
As a result BSSes are duplicated in the BSS table, and we get stuck
while probing an AP before associating (in STA mode).
Change-Id: I85928756f4328028230832c1565ece7f412f3843 CC: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Acked-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Sat, 28 Apr 2012 01:56:59 +0000 (18:56 -0700)]
brcmfmac: add out of band interrupt support
Some sdio host controllers do not support real in band interrupt.
Software polling mode as a replacement is not fast enough for
high throughput and new features. Also some in band interrupts
do not support host wake up on embedded platform even when they
are real physical interrupts. Therefore out of band (oob)
interrupt mechanism is implemented for these scenarios.
To provide oob irq number and flags used for irq registration in
brcmfmac, a platform device contains irq resource must be
registered in board specific code.
Here is an example of platform device structure:
struct resource brcmf_sdio_res[] = {
{
.start = GPIO_BRCMF_SDIO_OOB_NUM,
.end = GPIO_BRCMF_SDIO_OOB_NUM,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
}
};
struct platform_device brcmf_sdio_device = {
.name = "brcmf_sdio_pd",
.id = -1,
.num_resources = ARRAY_SIZE(brcmf_sdio_res),
.resource = brcmf_sdio_res,
};
Reviewed-by: pieter-paul giesberts <pieterpg@broadcom.com> Reviewed-by: arend van spriel <arend@broadcom.com> Signed-off-by: franky lin <frankyl@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Sat, 28 Apr 2012 01:56:58 +0000 (18:56 -0700)]
brcmfmac: postpone interrupt register function
For out of band interrupt which is going to be introduced shortly,
the interrupt register function must be called after firmware is
downloaded. This patch moves it from brcmf_sdbrcm_probe to
brcmf_sdbrcm_bus_init.
Reviewed-by: pieter-paul giesberts <pieterpg@broadcom.com> Reviewed-by: arend van spriel <arend@broadcom.com> Signed-off-by: franky lin <frankyl@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Sat, 28 Apr 2012 01:56:57 +0000 (18:56 -0700)]
brcmfmac: check bus state for status
Bus state should be the correct flag for bus status. Use it instead
of result from previous function call for backplane clock switch.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Sat, 28 Apr 2012 01:56:56 +0000 (18:56 -0700)]
brcmfmac: stop releasing sdio host in irq handler
brcmf_sdbrcm_isr doesn't access to the dongle through SDIO bus.
Stop releasing and claiming host in irq handler to eliminate
any potential risk.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Ben Greear [Mon, 23 Apr 2012 19:50:32 +0000 (12:50 -0700)]
mac80211: Add more ethtools stats: survey, rates, etc
The signal and noise are forced to be positive since ethtool
deals in unsigned 64-bit values and this number should be human
readable. This gives easy access to some of the data formerly
exposed in the deprecated /proc/net/wireless file.
Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Wey-Yi Guy [Wed, 25 Apr 2012 15:10:08 +0000 (08:10 -0700)]
iwlwifi: use 6000G2B for 6030 device series
"iwlwifi: use correct released ucode version" change
the ucode api ok from 6000G2 to 6000G2B, but it shall belong
to 6030 device series, not the 6005 device series. Fix it
Cc: stable@vger.kernel.org #3.3+ Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>