Commit graph

19193 commits

Author SHA1 Message Date
Szymon Janc
89f8453ebe Bluetooth: Don't delay bt_conn connected callback
Delaying only connected callback resulted in races where security
or pairing callback could be called before bt_conn connected.

Currently only procedure that relies on read features is connection
parameters update and that should not conflict with other traffic.

Change-Id: I835535abbff21ea8d86b728f5681f90ef9fd337c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
6dba9310d4 net: Keep track of number of free L2 buffers
Print current number of free MAC buf count when allocating
or freeing mbufs.

Change-Id: I3c434671b28ac4b4d8c8d968899e891391d849d9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
3e5a38d348 net: contiki: Do not try to free null mbuf
If mbuf could not be allocated, then do not try to free it.

Change-Id: Idf48f9f2eda260b8560a5388c920a9d9a3ef8f16
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
44df1a12a2 net: Print local MAC address when setting local addresses
Useful for debugging.

Change-Id: I812ec770e1cdf24f6470c4a0d066c74107ce35df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
dbed256cb0 net: Print stack usage more often for 802.15.4 fibers
The stack usage was not printed often enough when receiving
and sending 802.15.4 packets.

Change-Id: I61a4b6acdc10cb1681e2aeb63cb6af7a35834dff
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
c41ad174fc net: Print stack usage and statistics for every transmitted msg
The TX stack usage data and statistics were only printed
if there was an error. This happened very seldom which was
not very helpful.

Change-Id: I059cf9ee3449e5b39d872ef6026df968d86d0209
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
b14fdb8b5d net: contiki: Print detailed info if packet len is wrong
If IPv6 packet length is incorrect, then print the actual
length values for debugging aid.

Change-Id: I20d4d73efd1e0103f670e8e53ba6417a4795ab80
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
f857815455 net: Print warning if 6lowpan is not used with 802.15.4
If one has 802.15.4 network and tries to compile without
6lowpan, then print warning as that combination is not a
usable network setup. It can be used for testing but not
for real live setup.

Change-Id: I3b540686c8556ed0306723834ca38633aff63165
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
a3c8bf6ce3 net: contiki: Typo in 802.15.4 reassembly debug message
Change-Id: Ib363ff582fe5e3e019055c2f3bf062deb5ba8eba
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
b7d790b4b2 net: contiki: Do not discard non-fragmented packets
If the fragmentation header is missing, then do not discard
the message but pass it to upper layers as is. The fragmentation
header might be missing if the packet fits into 128 bytes.

Change-Id: I39d29e7ad80be5531262a0ac413d8137da0c64f5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
ea0d712ee1 net: Compile 6lowmac layer only if 6lowpan is enabled
No need to compile sicslowmac.c if we do not have 6lowpan.

Change-Id: I8624089f4b360fb12ef1c4a6d7104f0b190f048c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
d0731d5d81 net: Pretty print statistics
Align statistics columns better.

Change-Id: I9e83fbbb744d910cae3512bdddab8a5d0e217ba5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
a8c54384c0 net: Gather statistics about amount of received L2 bytes
This collects received statistics from layer 2 (MAC).

Change-Id: Ie869c1209bd06f0a5ccad5094b0cafe5fe74d787
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
f84e0c1b9b net: Gather statistics about amount of sent L2 bytes
This collects byte counts from layer 2 (MAC).

Change-Id: I16c25f7ae8b9aa485e3c5f1573154cd2270cff93
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
f10641f072 net: contiki: Initialize statistics structure
The statistics counts were not initialized so the numbers were
mostly bogus.

Change-Id: If4c33701fbdc4d4603d708c69950a8a18f8eaeaf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
66f6cfc86f Bluetooth: Cover whole key API under CONFIG_BLUETOOTH_SMP
There is no need to define keys types if SMP is disabled.

Change-Id: If6b653906df4623f440b258afd574722498109d0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
4372347319 Bluetooth: SMP: Move code to reduce number of ifdefs
Gather central and peripheral related code togerther so it can be
placed under single blocks of ifdefs.

Change-Id: Ia5fe45b86173b0e647b582bf2cd96fc7c9cb7feb
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
07805cb9a4 Bluetooth: Move GATT code to reduce number of ifdefs
Gather client related code togerther so it can be placed under
single blocks of ifdefs.

Change-Id: I6f2f5a06c0308b885d01fc6af300b162baec0823
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
888fac8ac8 Bluetooth: Move connection code to reduce number of ifdefs
Gather SMP related code together so that it can be placed under
single blocks of ifdefs.

Change-Id: I3c2e71243b694e9984ae8e88025a6ead7969e020
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
5deb2667dd Bluetooth: Fix connecting to devices that use RPA
This fix a regression that cause identity address to be passed to
LE Create Connection HCI command. This was affecting connecting to
iPhone. Regression was introduced in beaf30fda7de1476c742a
(Bluetooth: Simplify check_pending_conn function).

check_pending_conn now takes two addresses: ID and real address.
ID is used to find connection object and real is used in LE Create
Connection HCI command. If no IRK is present both addresses have
same value. This is to avoid double lookup of ID address for every
advertising report.

Change-Id: I6b86a698087889c4e6c2a1cbc9a688a804cfeb84
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
eb8dfd116e Bluetooth: Refactor handling of identity address lookup
This reduces number of idefs cuts and make code much easier to read.
In case of SMP not supported (or connection support since SMP depends
on it) find_id_addr is simplified and will most likely be inlined by
compiler resulting in no-op.

Change-Id: Ib16d1508c5664fcb58f619b090a5d62b2ecfe8c5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
18a375d487 net: tools: echo-client can send data forever
Added -e option to echo-client and it will not quit but just
send data forever to the echo-server.

Change-Id: I9085220844b5bc45b2b7fffc46fb1b9e93235307
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
2456300976 net: 802.15.4: Ignore too long network packets in dummy radio
If we receive too long message in dummy radio driver,
then we need to discard the packet as we cannot handle
it anyway.

Change-Id: Ibed0ac5f1568dd791dec3e780c7f6c71914d02cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
05d8a096e1 net: apps: test_15_4 fixes when running in one qemu
Made the test_15_4 application to run much faster when it is
running inside qemu (started with make qemu0).

Change-Id: I4455eca4f0426e8acc8b87d93eb80f4d179a1b48
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
b8fb7ebd02 net: apps: Fix the 802.15.4 monitor application
The 802.15.4 monitor application had issues with connecting
pipes together and making sure the first byte from qemu is
not lost. Before starting real data connection we send five
null bytes and the discard them in receiving side.

Change-Id: I376ae4f79aaa1ea742640999ec5b3d9c57a1279a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
83dd828d58 net: apps: Add readme file describing various IP stack examples
Change-Id: I22cd281ae3157f0638c773e2c251289b51da78a9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
9368afd336 net: apps: Connect echo-server and echo-client tests together
It is now possible to loop echo-server and echo-client test
applications together when they are running in qemu.

Start echo-server with "make server" and echo-client using
"make client" in the corresponding samples directory.

Change-Id: Ic852735f7bebc93e42873e98427e282902b3ca03
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
40638b3ad4 net: Additional checks for length of the data to be sent
Dummy 802.15.4 has now some additional check to verify that we
are really sending correct amount of bytes.

Change-Id: I4d223c02e2628966e3b1a3cdcf7b560043d7d788
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
03e0d10ab3 net: contiki: Remember original data length when sending
If the stack is sending network packets by itself, like when
sending router or neighbor solicitation messages, then remember
the original length of the message. This is important because
uIP stack will clear the length of the sent message after it
is sent.
After this change, the lower level drivers can use
the net_buf_datalen() to get the original length of the
buffer. The issue is seen because uIP stack is running in
different fiber than the network device driver.

Change-Id: I6078c5d716bba455a93be9be122e97cd24b8dc0e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
ddab4c11af net: contiki: Print debug information about fragment length
Print information about how much data we are losing if
null fragmentation is used.

Change-Id: I2f18d180a4c75768534de851c7cc27c3e70ca310
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
d9e0f0494a net: User can select the desired 6LoWPAN compression method
Adding selection of 6LoWPAN compression method to Kconfig.
Possible values are:
* no compression
* IP header compression

Change-Id: I8721fa683f7488ec9ad0bf37f6637fa264c2038f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
c890edc687 net: 802.15.4: Allow user to set the PAN id
User can set the desired network id from Kconfig.

Change-Id: Iac9de1deb2b01bcfcb3382849d451dce1a05077a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
3c1f69dcbc net: 802.15.4: Fix the sent network buffer length
When 802.15.4 code is receiving the network buffer, the uIP
stack might have zeroed the buf->len value. Restore it back
here so that other parts of the stack will get sane value.

Change-Id: I8fb3c1d3a3c9b0f41f3915d0f31d78afeccf68b6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
af98cbc1b6 Bluetooth: Move HCI core code to reduce number of ifdefs
Gather connection and SMP related code togerther to that those can
be places under single blocks of ifdefs.

Change-Id: Ief418536e0e0f389fdde3bb3ac8b85bcfce9ac79
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
ca9d755073 Bluetooth: Enable stack analysis in tester application
This allows for compile test if analysis code builds.

Change-Id: I500d727a06ef065fc65465140062ec47d31e79fa
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
68d7688aff Bluetooth: SMP: Add timeout fiber stack analysis
This allows to monitor stack usage in timeout fiber. Since timeout
fiber migth not be even started (eg when there was no SMP command
sent or receive) analysis is done only when timeout fiber is stopped.

Change-Id: I0ff6c081b9077f8f8294386306a3fe0ed77099a8
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
eb42877662 Bluetooth: Use common code for stack usage analysis in HCI code
Change-Id: I5844b9de73391308ab1e4b928a524f1eb4d13813
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
edf9cc3065 Bluetooth: Add new code for stack usage analysis
This introduces simple API for analysing stack usage. Stack growth
direction is determined on build instead of runtime.

Change-Id: Iacb160d088cc0af57e2e9dedc72cbc5e31fd22f4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra
01bec178dc Bluetooth: Handle read supported gatt server commands
This will be used to poll Zephyr to send it's supported commmands.

Change-Id: I12cb93a238cd14589123d88e9d9ba4d580dd6d71
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra
b75915e366 Bluetooth: Add read characteristic value callback
This is used to respond to the read request of characteristic
value.

Change-Id: Ia0518fae0d70e712621578a7938009345dbfaab4
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra
865a087e76 Bluetooth: Handle Set Characteristic/descriptor value
This adds support to handle set attribute value.

Change-Id: I2631cc8744210cfd76add1be3d30e5a0f54b3a7e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra
cc3949fec4 Bluetooth: Handle Add Characteristic command
This adds support for adding characteristic declaration and characteristic
value to the tester defined database of GATT attributes.

Change-Id: I108fc5a9bc5c7491fc354c71457d452baaedd868
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra
9624fe8732 Bluetooth: Add support for GATT Server to tester application
This adds support for tester application to cover GATT Server
automated tests. BTP ptotocol commands are used do drive stack to
build attributes database specified by the external tester.

Two commands: to add a service and to start the GATT server are
implemented.

Change-Id: I236c3e4d8636e97926514b2099779cb4334e95cd
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra
7bb885198d Bluetooth: Extend BTP Specification to cover GATT Server
This adds protocol specification for GATT Server.

Change-Id: I2f6083b15c483fb1348f6c108fd54f890d45b83d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
10c56223c9 Bluetooth: SMP: Add support for SMP timeout
Add support for timing out SMP commands. Timer is restarted on sending
any SMP PDU and if reached 30 seconds pairing procedure shall be
considered to have failed.

This was affecting TC_PROT_BV_01_C and TC_PROT_BV_02_C SMP
qualification tests.

Stack size used by timeout fiber is based on observation:
smp timeout (real size 128):    unused 16       usage 80 / 96 (83 %)

Change-Id: I87a16cc51046b6a2487a0a1a736035d64b011d09
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Johan Hedberg
02b06acf8d Bluetooth: Fix reported name for RX prio fiber
Change-Id: Id2e5bfe42658f4b579258ac2855a384a558d27a0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
1ffed52c45 Bluetooth: SMP: Don't start pairing if it is already in progress
Change-Id: Ie720e4facb00de3c2fe8b8635a84b4b96a1bee53
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Szymon Janc
e8bcb6afc0 Bluetooth: SMP: Track if pairing is in progress
This patch adds additional flag that is used for tracking if pairing
is in progress.

Change-Id: Ie21b8d9440ea4bc64dd552d49eaebfd4b569f176
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
c8830c8a14 net: rpl: Fix compile error when debugging is activated
Parent link metric was incorrectly printed.

Change-Id: I479820f850d8e9a5459667d58bc35c8174a77559
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Jukka Rissanen
c295cd5b62 net: rpl: User can enable RPL probing support
When enabled, probes will be sent periodically to keep
parent link estimates up to date.

Change-Id: Ia7f1fe7cd28bb487c64a41159fffdf3665e9e1df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00