The same sequence sending L2CAP Connection Request was used in several
places. Using subroutine makes those places easy to read.
Signed-off-by: Andrei Emeltchenko <[email protected]>
Reviewed-by: Ulisses Furquim <[email protected]>
Acked-by: Gustavo F. Padovan <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
Mark request status as done for Read Local Version HCI command. In AMP
initialization this HCI command is the last and needs to be completed.
Signed-off-by: Andrei Emeltchenko <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
With Bluetooth 1.1 controllers the last command in the HCI init sequence
will be a write_local_name, however there was no callback to indicate
init request completion in this case. This patch fixes the issue by
adding the necessary callback to the write_local_name_complete handler.
Signed-off-by: Johan Hedberg <[email protected]>
Marcell Zambo and Janos Farago noticed and reported that when
new conntrack entries are added via netlink and the conntrack table
gets full, soft lockup happens. This is because the nf_conntrack_lock
is held while nf_conntrack_alloc is called, which is in turn wants
to lock nf_conntrack_lock while evicting entries from the full table.
The patch fixes the soft lockup with limiting the holding of the
nf_conntrack_lock to the minimum, where it's absolutely required.
It required to extend (and thus change) nf_conntrack_hash_insert
so that it makes sure conntrack and ctnetlink do not add the same entry
twice to the conntrack table.
Signed-off-by: Jozsef Kadlecsik <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
This reverts commit af14cca162.
This patch contains a race condition between packets and ctnetlink
in the conntrack addition. A new patch to fix this issue follows up.
Signed-off-by: Pablo Neira Ayuso <[email protected]>
This flag requests that network devices pass all
received frames up the stack, even ones with errors
such as invalid FCS (frame check sum). This will
allow sniffers to see bad packets and perhaps
give the user some idea how to fix the problem.
Signed-off-by: Ben Greear <[email protected]>
Tested-by: Aaron Brown <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
This is useful for testing RX handling of frames with bad
CRCs.
Requires driver support to actually put the packet on the
wire properly.
Signed-off-by: Ben Greear <[email protected]>
Tested-by: Aaron Brown <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
When set on hardware that supports the feature,
this causes the Ethernet FCS to be appended
to the end of the skb.
Useful for sniffing packets.
Signed-off-by: Ben Greear <[email protected]>
Tested-by: Aaron Brown <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
So here's a boot tested patch on top of Jason's series that does
all the cleanups I talked about and turns jump labels into a
more intuitive to use facility. It should also address the
various misconceptions and confusions that surround jump labels.
Typical usage scenarios:
#include <linux/static_key.h>
struct static_key key = STATIC_KEY_INIT_TRUE;
if (static_key_false(&key))
do unlikely code
else
do likely code
Or:
if (static_key_true(&key))
do likely code
else
do unlikely code
The static key is modified via:
static_key_slow_inc(&key);
...
static_key_slow_dec(&key);
The 'slow' prefix makes it abundantly clear that this is an
expensive operation.
I've updated all in-kernel code to use this everywhere. Note
that I (intentionally) have not pushed through the rename
blindly through to the lowest levels: the actual jump-label
patching arch facility should be named like that, so we want to
decouple jump labels from the static-key facility a bit.
On non-jump-label enabled architectures static keys default to
likely()/unlikely() branches.
Signed-off-by: Ingo Molnar <[email protected]>
Acked-by: Jason Baron <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Linus Torvalds <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Since the clear_uuids operation doesn't send an immediate HCI command
but just sets off a timer to wait for subsequent add_uuid calls it
doesn't make sense to wait until the timer fires off to send the
response. Instead send the response immediately.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
All mgmt commands that may fire off a hci_write_class_of_device command
should wait for the completion of the HCI command before sending a
response to user space.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
This patch adds a flag to track pending changes to the class of device.
This is needed since we cannot cleanly handle multiple simultaneous
commands and need to return a "busy" error status in the mgmt commands
that might trigger a class change.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Unify return value of .ndo_set_mac_address if the given address
isn't valid. Return -EADDRNOTAVAIL as eth_mac_addr() already does
if is_valid_ether_addr() fails.
Signed-off-by: Danny Kukawka <[email protected]>
Acked-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This patch updates the Device Connected events to match the latest API
by adding a flags parameter to them.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
We also need to send a proper response when clearing UUIDs. This patch
adds fixes the missing response for this use case.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Since we can now add UUIDs when powered off we don't really need to
always use the service cache to avoid large bursts of HCI commands.
Instead, the only important use case is when we're already powered and
user space starts to initialize itself. This can be easiest detected by
a "clear UUIDs" operation which is where this patch moves the service
cache setting.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The Add/Remove UUID commands should return the device class instead of
an empty parameter list.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Gustavo F. Padovan <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
If we're powered but still have the HCI_AUTO_OFF flag set the
update_eir and update_class functions should not do anything.
Additionally these functions need to be called when the flag is finally
cleared through set_powered or when powering on for real.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Gustavo F. Padovan <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
If controller is reset during the discovery procedure, Start Discovery
command stops working. This can be easily reproduced by running
"hciconfig hci0 reset" while discovering devices, for instance.
We should force discovery state to DISCOVERY_STOPPED in case we receive
a reset command complete event. Otherwise we may stuck in one of the
active discovery states (DISCOVERY_INQUIRY, DISCOVERY_LE_SCAN and
DISCOVERY_RESOLVING) and subsequent Start Discovery commands will simply
fail.
Signed-off-by: Andre Guedes <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
This patch fixes the count parameter in the Get Connections reply
message. We cannot know the right number until iterating through all
connections so set the parameter value only after the loop.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Simplify code so that we do not need to check whether socket is locked.
Signed-off-by: Andrei Emeltchenko <[email protected]>
Acked-by: Gustavo F. Padovan <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
Change sk lock to chan lock in l2cap core and move sk locks
to l2cap sock code. bh_locks were used because of being RCU
critical section. When needed use explicit socket locks.
Signed-off-by: Andrei Emeltchenko <[email protected]>
Reviewed-by: Ulisses Furquim <[email protected]>
Acked-by: Gustavo F. Padovan <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
Add unlocked L2CAP channel add function. Unlocked version will
be used in later patches.
Signed-off-by: Andrei Emeltchenko <[email protected]>
Reviewed-by: Ulisses Furquim <[email protected]>
Acked-by: Gustavo F. Padovan <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
This patch makes sure that legacy pairing vs SSP infomation gets
properly propageted to the device_found events in the form of the legacy
pairing flag.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
According to the latest mgmt API there's a flags field instead of a
separate confirm_name paramter.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
This patch adds an error return when not powered and cleans up/simpifies
the function logic in the same go.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
This patch makes it possible to set the class when powered off. When
powering on the right class of device value will be automatically
writen to the controller.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
These functions should just silently fail when we're not powered on
instead of trying to send HCI commands.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The return parameters for Set Device Class should consist of the new
class value.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
We should assume a value of 0 for the device class when powered off.
The appropriate place to do this is in hci_dev_do_close().
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The short name is part of the Read Controller Info response and should
be appropriately filled in based on the value of hdev->short_name.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Since we can't reliably track the short name changes just assume that we
had a change whenever there's a pending mgmt command. In the worst case
we just get one unnecessary name_changed signal.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
This patch makes it possible to set the local name before powering on
the device. The name will be applied using the hci_write_local_name
command once the device gets powered on.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The local name should only be updated as a consequence of a
hci_read_local_name if we are in the HCI_SETUP state. In all other
scenarios it should only be updated through hci_write_local_name.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
It's possible to provide a short name through the mgmt interface and
this name can be used for EIR generation when the full name doesn't fit
there. This patch adds the preliminary tracking of the provided short
name.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Currently there are no events to other management sockets if the class of
device got changed. So make sure they are sent.
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
The current handling of the discoverable timeout was missing the proper
handling of the timeout when the mode was already set. Now the command
can be used to expire or retrigger the timeout.
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
Add one extra sanity check to ensure that the supplied timeout value is
actually valid in this context.
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
Whenever we update the local device name the EIR data also needs to be
updated to reflect this. The update_eir() function in mgmt.c depends on
hdev->dev_name to be up to date so the patch also makes sure that the
mgmt function is called from hci_event.c after the update has happened.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
When powering off we should assume that the EIR data isn't valid
anymore. This patch makes sure it gets cleared in hci_dev_do_close and
thereby ensures that a correct new EIR is recreated when powering on
again.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
This patch implements support for the Set LE mgmt command. Now, in
addition to the enable_le module parameter user space needs to send an
explicit Enable LE command to enable LE support.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The test for SSP support needs to be earlier in the set_ssp function so
that we return an error when SSP is not supported even when the device
is powered off.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The control channel can be also monitored, so include timestamps here
as well. And make sure management events get their timestamp when they
are created.
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
Some controllers preserve their EIR data even after a reset so we need
to explicitly clear this during the device setup procedure.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
The hdev->eir buffer needs to be cleared when clearing the EIR data.
Otherwise subsequent attempts at setting the EIR to something valid
again may fail because the code thinks that the EIR hasn't changed.
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
This patch fixes setting the EIR properly when the SSP flag has been set
when powered off (in such a case there is no pending Set_SSP command).
Signed-off-by: Johan Hedberg <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>