Commit graph

18576 commits

Author SHA1 Message Date
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
Jukka Rissanen
0ddb10f155 net: rpl: User can configure used objective function
User needs to be able to configure used OF as all RPL nodes
in DODAG need to use the same OF. Default OF is MRHOF RFC 6719.
Other alternative is OF0 RFC 6552.

Change-Id: I6d135a6a2c6880a919993e29b0985d4c686b8a9d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:25 -05:00
Arkadiusz Lichwa
c52cae5366 Bluetooth: GATT: Fix differentiate errors on write ccc
Refines errors check when attempting to write over the boundary
of attribute room.

Change-Id: Ia27b86ce380a178b8e7834adf6da4009a6d60233
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra
5438f7b96b Bluetooth: tester: Handle Set Connectable command
This patch is needed to be able to test zephyr against tests
which require Zephyr to be non-connectable.

This adds handler for the opcode 0x06 - Set Connectable command.
Based on connectable flag in current settings, the corresponding
advertising type is set after issuing Start Advertising command.
If connectable, Connectable undirected advertising type is set,
if non-connectable Non connectable undirected advertising type
is set.

Change-Id: I77865b67c4b717548095ac5e398a873d1b739d6a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra
926e65fe3b Bluetooth: tester: Handle disconnect command
This feature is needed to pass some tests which require termination
of ACL link.

Change-Id: Idab03c569172ea6deb3bc5cf6744e5e73bd5de3e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra
8505cc9b37 Bluetooth: tester: Fix Start/Stop Advertising responses
According to new tester API in case of success Current_settings
shall be returned.

Change-Id: I1caf05180bff4756b8e7271098611d23200af8ee
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
1dedbd28e6 net: contiki: Remove unused variable declaration
The etimer.c does not need to know about ctimer_process so
remove the extra variable.

Change-Id: I761a9d79c09876c5270e294dd008a8821705e9a2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
2734af4742 net: rpl: Free received net_buf in case of error
The code did not mark net_buf to be freed in a case of error
when receiving data. This caused the system run out of network
buffers very fast. It is necessary to set uip_len variable to 0 so
that the upper stack can free the buffer in this case.

Change-Id: Id5e009affcb2ce916f21fcf60060efb1c6d1ec0c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
5ca530c5cb net: rpl: Fix the net_buf handling
Allocate a net_buf when a network packet is about to be sent.
Earlier one statistically allocated buffer was used for sending
RPL packets but this did not work well enough and it cluttered
the RPL APIs with redundant net_buf parameter.

Change-Id: Ib4160167f8deac83c30852af2346acdf6c6f711b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
62b67666d8 net: contiki: etimer should call proper handler
When the timer is set, the caller needs to specify the function
that is called when timer expires.

Change-Id: Iae69986c6f32b789d708247b187d143e45d73828
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
9b18a6d0bb net: Increse the size of timer stack to 1K
The RPL support needs bigger stack than 600 bytes.

Change-Id: If61fb2b4874d32d6e02c8e510cccd45246332da5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
a9c39988ed net: rpl: Print RPL statistics if enabled
Print RPL statistics in the general IP statistics printing
function if CONFIG_RPL_STATS is defined.

Change-Id: Iefc3a1e5186b052e91b17309a6e9fdeb2fa70886
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
aa73046f24 net: rpl: Fix compilation error if debugging is enabled
Need to use pointer when printing link address.

Change-Id: Ied7fcbefc02034e0ddbe714716b883de33d1e724
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Jukka Rissanen
ae97505279 net: contiki: If we do not have 802.15.4 then use nullrdc driver
For RDC (Radio Duty Cycling) we activate nullrdc driver
if 802.15.4 is not used.

Change-Id: I793b84ee8e81cdbc8315758f1b83f7ad3bd7555a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra
fa48de9e9a Bluetooth: Add connect/disconnect commands to BTP spec
These commands are necessary to pass some of the GAP tests.

Change-Id: Ia599e7dc3dd06aa5ac4130e0d878fcddad7b37dd
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra
85c6194670 Bluetooth: shell: Replace xtoi with strtoul from libc
Change-Id: Ibb6356f5d2dc041b5637abfdfcf5e3dc1a00ea77
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Szymon Janc
68382388ce Bluetooth: Disable parts of public API if not configured
Depending on selected Kconfig options some parts of public API
are disabled with #ifdefs. This should make it easy for user to
figure out which options should be enabled to specific API.

Change-Id: I4ae1bfd7bf535ea45869772c429ccd3d3d4c214e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:24 -05:00
Szymon Janc
c0650518d6 Bluetooth: Make BT buffers connection support optional
This allows to reduce BT buffers used if connection
support is disabled.

Sample beacon application size reduced from 15212 to 14956 bytes.

Change-Id: I431ea5087706a06eaea76d572839c3afebfb963e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:24 -05:00