08 Oct, 2015
17 commits
-
This patch moves values for all lowpan interface to the shared
implementation of 6lowpan. This patch also quietly fixes the forgotten
IFF_NO_QUEUE flag for the bluetooth 6LoWPAN interface. An identically
commit is 4afbc0d ("net: 6lowpan: convert to using IFF_NO_QUEUE") which
wasn't changed for bluetooth 6lowpan.All 6lowpan interfaces should be virtual with IFF_NO_QUEUE, using EUI64
address length, the mtu size is 1280 (IPV6_MIN_MTU) and the netdev type
is ARPHRD_6LOWPAN.Signed-off-by: Alexander Aring
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
The chan_get() function just adds unnecessary indirection to calling
the chan_create() call. The only added value it gives is the chan->ops
assignment, but that can equally well be done in the calling code.Signed-off-by: Johan Hedberg
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
The typical convention when having both a child and a parent channel
variable is to call the former 'chan' and the latter 'pchan'. When
there's only one variable it's called chan. Rename the 'pchan'
variables in the 6lowpan code to follow this convention.Signed-off-by: Johan Hedberg
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
All the chan_open() function now does is to call chan_create() so it
doesn't really add any value.Signed-off-by: Johan Hedberg
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
The L2CAP core code makes sure of setting the channel state to
BT_CONNECTED, so there's no need for the implementation code (6lowpan
in this case) to do it.Signed-off-by: Johan Hedberg
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
The L2CAP core code already sets the local MPS to a sane value. The
remote MPS value otoh comes from the remote side so there's no point
in trying to hard-code it to any value.Signed-off-by: Johan Hedberg
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
The omtu value is determined by the remote peer so there's no point in
trying to hard-code it to any value. The IPSP specification otoh gives
a more reasonable value for the imtu, i.e. 1280.Signed-off-by: Johan Hedberg
Acked-by: Jukka Rissanen
Signed-off-by: Marcel Holtmann -
When calling the hci_recv_frame driver function check for valid packet
types that the core should process. This should catch issues with
drivers trying to feed vendor packet types through this interface.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The manually coded frame reassembly is actually broken. The h4_recv_buf
helper from the UART driver is a perfect fit for frame reassembly for
this driver. So just export that function and use it here as well.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The BPA-10x devices support tracing operation. Use the set_diag driver
callback to allow enabling and disabling that functionality.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
For debugging pruposes, read the revision string of the BPA-10x devices
and print it. For example one of the latest devices respond with the
string SNIF_102,BB930,02/01/18,10:37:56.< HCI Command: Vendor (0x3f|0x000e) plen 1
07 .
> HCI Event: Command Complete (0x0e) plen 49
Vendor (0x3f|0x000e) ncmd 1
Status: Success (0x00)
53 4e 49 46 5f 31 30 32 2c 42 42 39 33 30 2c 30 SNIF_102,BB930,0
32 2f 30 31 2f 31 38 2c 31 30 3a 33 37 3a 35 36 2/01/18,10:37:56
00 00 00 00 00 00 00 00 00 00 00 00 00 .............Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
When the controller requires the HCI Reset command to be send when
closing the transport, the HCI_AUTO_OFF needs to be accounted for. The
current code tries to actually do that, but the flag gets cleared to
early. So store its value and use it that stored value instead of
checking for a flag that is always cleared.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The set_diag driver callback allows enabling and disabling the vendor
specific diagnostic information. Since Broadcom chips have support for
a dedicated LM_DIAG channel, hook it up accordingly.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
This adds a new debugfs entry for enabling and disabling the vendor
diagnostic mode. It is only exposed for drivers that provide the
set_diag driver callback and actually have an option for vendor
specific diagnostic information.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The Broadcom UART based controllers can send LM_DIAG messages with the
identifier 0x07 inside the HCI stream. These messages are 63 octets in
size and have no variable payload or length indicator.This patch adds correct parsing information for the h4_recv_buf handler
and in case these packets are received, they are forwarded to the
Bluetooth core via hci_recv_diag interface.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Introduce hci_recv_diag function for HCI drivers to allow sending vendor
specific diagnostic messages into the Bluetooth core stack. The messages
are not processed, but they are forwarded to the monitor channel and can
be retrieved by user space diagnostic tools.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The Bluetooth public device address might change during controller setup
and it makes it a lot simpler for monitoring tools if they just get told
what the new address is. In addition include the manufacturer / company
information of the controller. That allows for easy vendor specific HCI
command and event handling.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
07 Oct, 2015
1 commit
-
The Broadcom Bluetooth controllers have the chip name included in the
ROM firmware or later in the patchram firmware. For debugging purposes
read the local name and print it out. This is only done during setup
stage and only once before loading the firmware and once after loading
the firmware.For the Broadcom based controllers from Apple, the name is only read once
after determining the chip id.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
05 Oct, 2015
6 commits
-
When the core starts or shuts down the actual HCI transport, send a new
monitor event that indicates that this is happening. These new events
correspond to HCI_DEV_OPEN and HCI_DEV_CLOSE events.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Setting and clearing of HCI_RUNNING flag in each and every driver is
just duplicating the same code all over the place. So instead of having
the driver do it in their hdev->open and hdev->close callbacks, set it
globally in the core transport handling.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
In all callbacks for hdev->send the status of HCI_RUNNING is checked. So
instead of repeating that code in every driver, move the check into the
hci_send_frame function before calling hdev->send.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
When opening the HCI transport via hdev->open send HCI_DEV_OPEN event
and when closing the HCI transport via hdev->close send HCI_DEV_CLOSE.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The stack internal events that are exposed to userspace should be
limited to HCI_DEV_REG, HCI_DEV_UNREG, HCI_DEV_UP and HCI_DEV_DOWN.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The commit 7bee8b08c428 allows the Read Verbose Config Info to fail
gracefully and not cause the controller setup to abort. It seems the
reason that command failed in the first place was the missing HCI Reset
to bring the controller in full Bluetooth mode.Apple Bluetooth controllers start out in HID mode and when in that mode
the Read Verbose Config Info command is not allowed. Sending HCI Reset
switches the controller into full HCI mode.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
04 Oct, 2015
1 commit
-
Add regmap ibt to support Intel Bluetooth silicon register access
over HCI. Intel BT/FM combo chip allows to read/write some registers
(e.g. FM registers) via its HCI interface.Read/Write operations are performed via a HCI transaction composed of
a HCI command (host->controller) followed by a HCI command complete
event (controller->host). Read/Write Command opcodes can be specified
to the regmap init function.
We define data formats which are intel/vendor specific.Register Read/Write HCI command payload (Host):
Field: | REG ADDR | MODE | DATA_LEN | DATA... |
size: | 32b | 8b | 8b | 8b* |Register Read HCI command complete event payload (Controller):
Field: | CMD STATUS | REG ADDR | DATA... |
size: | 8b | 32b | 8b* |Register Write HCI command complete event payload (Controller):
Field: | CMD_STATUS |
size: | 8b |Since this payload is HCI encapsulated, Little Endian byte order is
used.Write/Read Example:
If we write 0x0000002a at address 0x00008c04, with opcode_write 0xfc5d,
The resulting transaction is (btmon trace):< HCI Command (0x3f|0x005d) plen 10 [hci0]
04 8c 00 00 02 04 2a 00 00 00
> HCI Event (0x0e) plen 4
Unknown (0x3f|0x005d) ncmd 1
00Then, if we read the same register with opcode_read 0xfc5e:
< HCI Command (0x3f|0x005e) plen 6 [hci0]
04 8c 00 00 02 04
> HCI Event (0x0e) plen 12 [hci0]
Unknown (0x3f|0x005e) ncmd 1
00 04 8c 00 00 2a 00 00 00Signed-off-by: Loic Poulain
Signed-off-by: Marcel Holtmann
03 Oct, 2015
1 commit
-
There was a missing return here so it meant that often
ieee802154_llsec_parse_key_id() was not called.Fixes: a26c5fd7622d ('nl802154: add support for security layer')
Signed-off-by: Dan Carpenter
Acked-by: Alexander Aring
Signed-off-by: Marcel Holtmann
01 Oct, 2015
7 commits
-
This reverts commit 9abc378c66e3d6f437eed77c1c534cbc183523f7
("ieee802154: 6lowpan: change datagram var types").The reason is that I forgot the IPv6 fragmentation here. Our MTU of
lowpan interface is 1280 and skb->len should not above of that. If we
reach a payload above 1280 in IPv6 header then we have a IPv6
fragmentation above 802.15.4 6LoWPAN fragmentation. The type "u16" was
fine, instead I added now a WARN_ON_ONCE if skb->len is above MTU which
should never happen otherwise IPv6 on minimum MTU size is broken.Signed-off-by: Alexander Aring
Signed-off-by: Marcel Holtmann -
This device has always ACPI companion because driver supports only ACPI
enumeration. Therefore there is no need to test it in bcm_acpi_probe() and
we can pass it directly to acpi_dev_get_resources() (which will return
-EINVAL in case of NULL argument is passed).Signed-off-by: Jarkko Nikula
Signed-off-by: Marcel Holtmann -
Tree wide grep for "hci_bcm" doesn't reveal there is any code registering
this platform device and "struct acpi_device_id" use for passing the
platform data looks a debug/test code leftover to me.I'm assuming this driver effectively supports only ACPI enumeration and
thus test for ACPI_HANDLE() and platform data can be removed.Signed-off-by: Jarkko Nikula
Signed-off-by: Marcel Holtmann -
There is no need to call acpi_match_device() in driver's probe path and
verify does it find a match to given ACPI _HIDs in .acpi_match_table as
driver/platform/acpi core code has found the match prior calling the probe.Signed-off-by: Jarkko Nikula
Signed-off-by: Marcel Holtmann -
Driver doesn't handle possible error from acpi_dev_get_resources(). Test it
and return the error code in case of error.Signed-off-by: Jarkko Nikula
Signed-off-by: Marcel Holtmann -
Caller of acpi_dev_get_resources() should free the constructed resource
list by calling the acpi_dev_free_resource_list() in order to avoid memory
leak.Signed-off-by: Jarkko Nikula
Signed-off-by: Marcel Holtmann -
There is some unneeded code in "hci_intel" probing. First
acpi_match_device() call is needless as driver/platform/acpi core code has
already done the matching before calling the probe and the driver does not
use the returned pointer to matching _HID other than checking is it NULL.Then tree wide grep for "hci_intel" doesn't reveal that there is any code
registering this platform device so it looks this device is always backed
with ACPI companion so also ACPI_HANDLE() test can be removed.Signed-off-by: Jarkko Nikula
Signed-off-by: Marcel Holtmann
30 Sep, 2015
7 commits
-
This patch fixes checkpatch warnings:
- Comparison to NULL could be re-written
- no space required after a castSigned-off-by: Prasanna Karthik
Signed-off-by: Marcel Holtmann -
Use instead of , fixes checkpatch
Warning;Signed-off-by: Prasanna Karthik
Signed-off-by: Marcel Holtmann -
This patch adds support for increment transmit and receive stats. The
meaning of these stats are IPv6 based, which shows the stats after
running the 6lowpan adaptation layer (uncompression/compression,
fragmentation handling) on receive and before the adaptation layer
when transmit.Signed-off-by: Alexander Aring
Signed-off-by: Marcel Holtmann -
This patch fixes the data frame sequence numer (dsn) while 6lowpan
fragmentation for frag1. Currently we create one 802.15.4 header at
first, then check if it's match into one frame and at the end construct
many fragments and calling wpan_dev_hard_header for each of them,
inclusive for the first fragment. This will make the first generated
header to garbage, instead we copying this header for frag1 instead of
generate a new one which skips one dsn.Signed-off-by: Alexander Aring
Signed-off-by: Marcel Holtmann -
This patch changes datagram size variable from u16 type to unsigned int.
The reason is that an IPv6 header has an MAX_UIN16 payload length, but
the datagram size is payload + IPv6 header length. This avoids overflows
at some places.Signed-off-by: Alexander Aring
Signed-off-by: Marcel Holtmann -
This patch change the length check to len instead of mac_len for
checking if the frame control field is available to dereference.
We need to change it because I saw issues with af_packet raw sockets
and the mrf24j40 which calls this functionality. The raw socket
functionality doesn't set the mac_len but resets the skb_mac_header to
skb->data which is still correct. The issue occur at mrf24j40 only,
because the driver need to evaluate the fc fields.Signed-off-by: Alexander Aring
Signed-off-by: Marcel Holtmann -
This patch changes the mtu size of 802.15.4 interfaces. The current
setting is the meaning of the maximum transport unit with mac header,
which is 127 bytes according 802.15.4. The linux meaning of the mtu size
field is the maximum payload of a mac frame. Like in ethernet, which is
1500 bytes.We have dynamic length of mac frames in 802.15.4, this is why we assume
the minimum header length which is hard_header_len. This contains fc and
sequence fields. These can evaluated by driver layer without additional
checks. We currently don't support to set the FCS from userspace, so we
need to subtract this from mtu size as well.Signed-off-by: Alexander Aring
Signed-off-by: Marcel Holtmann