Commit graph

19193 commits

Author SHA1 Message Date
Szymon Janc
aef53f9cde Bluetooth: SMP: Send confirm on pairing response
When piaring response is received move on to sending confirmation.

Change-Id: Ifae84f7ea6f5a9fe26ca2a5e5b1e1cdde0d388ed
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
b3d94667a2 Bluetooth: SMP: Add initial support for sending pairing request
This allows to send pairing request and receive pairing response.

Change-Id: Ic7ad120a2d32896c4edd20b0020c5727bcc30f37
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Szymon Janc
f59ed9e729 Bluetooth: SMP: Pass ia and ra based on connection role
This make confirm and random use proper addresses depending based on
connection role.

Change-Id: I7b2117b330a6f9cc5c2c781e9c736fadcd52df31
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Arkadiusz Lichwa
e57984e3be Bluetooth: Make ref on connection object atomic
This makes it possible to perform these operations without
locking once per-conn locking is added in the future.

Change-Id: I342d55856116d9c87daeda4088b65e78e8ef0768
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:31 -05:00
Jukka Rissanen
ca2c662fc0 net: apps: Set the mac address in the stack
This way the stack will generate a proper IPv6 link local
address.

Change-Id: I149d82cf5623f3073b9edc64fe4e426460eb793b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:31 -05:00
Jukka Rissanen
ba40f4ff31 net: apps: Set the mac address in listener app
The mac address length needs to be 6 bytes because this
test app has no 802.15.4 support. The uIP stack checks
this and expects only 6 bytes mac address in this case.

Change-Id: I1edd340491b4690b5a2cf285c63f90950bbc3ff3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:31 -05:00
Jukka Rissanen
4eb70872fc net: Fix the loopback driver function parameters
Wrong number of parameters in net_driver.send registration.

Change-Id: I39eda44f0dbc9a5a1d980da3a625ef36946aef19
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:31 -05:00
Ravi kumar Veeramally
89c83d0162 net: 6lowpan: Adapt compression functions to net_mbuf buffers
6lowpan HC06 and HC01 compression/uncompression functions are
adapted to net_mbuf buffers. HC06 compression and uncompression
works properly. HC01 adapted to net_mbuf but functionality is
failing due to inproper IPv6 link local addresses. buf pointers
from net_mbuf and couple of net_mbuf calls are removed (which
are not used at the moment and saves memory from net_mbuf).

Change-Id: I2711b71b1b8df2eaac67d69275baf4b62b03f9f6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
540980e243 net: ip: Makefile re-structuring
Set the compiled files unambiguously so that we are always able
to see what object files are compiled from networking sub-system.

Change-Id: Ia763778e954195502281d63438b7e756adadd8a5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
e0509c5e6f net: rpl: Fix compile errors
This fixes RPL compile errors if CONFIG_NETWORKING_WITH_RPL is
enabled. The end result is not tested atm so RPL might not yet
work as expected.

Change-Id: I458c20f8f8c7c750cc17f24acf425f244399699d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
5d11691aa6 net: Add source mac address to net_buf
This is needed for enabling RPL and 6lowpan support.

Change-Id: I87f95a08db2cc874bbe841d9b1456803ab16d75d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
19fe2ff93d net: uip: Avoid unused label compile warning
The process: label is only used if we are a router so add
ifdef guard.

Change-Id: Ib88d4e4d70b049541480a6e9dd9d68911543ff50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
6869b1ace6 net: Make 6lowpan config depend on 802.15.4 config
As we do not have Bluetooth IPSP support yet, then assume
that user needs 802.15.4 if 6lowpan needs to be activated
in Kconfig. This needs tweaking later.

Change-Id: I02ab6ebea51fdcacf8d23960e4ca70e777c0da88
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
1af5132250 net: Do not compile slip if UART support is missing
Saves some memory if unnecessary slip functions are not
compiled into kernel.

Change-Id: If2316909b36b12cb4d163a5ca966e2e54f4e1159
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
015b52f55c net: 15.4: Make it possible to disable 802.15.4 networking
It is now possible to fully remove 802.15.4 radio support
from generated kernel.

Change-Id: Ib7cf8f4bb400ae7e298bdc62e3b50b787a2ef06d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
cae2483f18 net: 15.4: Tweak the stack size of Rx and Tx fibers
One kb for Rx is enough, Tx needs bigger stack (4 kb) as it
needs to fragment bigger messages and needs more buffers.

Change-Id: Ib0a77dbd627bb3bd2806fa13a24a5869c64b31b2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
0e8524ca2e net: Tweak the stack size of Rx and Tx fibers
One kb seems to be enough for the stack.

Change-Id: Ib1e3a7e97bf7d69ddd4b3028fe7dd6413a0098d4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
904c5a0cf0 net: Tweak the number of network buffers to use
Use correct number of network buffers when sending and receiving
maximum size IPv6 frames (1280 bytes).

Change-Id: Iec4978fc97fb16f279a409f4f04d8a679d7cadc7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
46b534009d net: conf: Set the max number of internal buffers
The queuebuf count defines how many fragments we are able to
receive. Value 13 means that we can receive full IPv6 data
(1280 bytes), we need also some extra buffers for temp use.

Change-Id: Ie16d37ae61e15ded4355b5f54136722fc6317022
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
19983ee89f net: apps: Send always the max data size to test the stack
Stress test the IP stack by always sending max number of bytes.

Change-Id: I830a92cca4efbc2aa00dd1bec75972884359621c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
442554615f net: 15.4: Add code to analyze stack usage
To make it easy to periodically verify that we have sane stack sizes
it's helpful to have some code to evaluate how much of the stacks are
used. There's already a CONFIG_INIT_STACKS option which pre-fills the
stacks with 0xaa bytes, so we make use of it and in case the option is
enabled run the extra code to evaluate how much of each stack was
used. The trigger for the evaluation is a disconnection event.

Copied from Bluetooth sub-system.

Change-Id: I5539156d98abd361254088f775765f7a72890ed5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
e4505927a3 net: 15.4: Rename rx and tx fibers
Easier to debug the beast if the IP fibers are not called
the same as 15.4 fibers.

Change-Id: Iaa15b5e359c7dc2fd9af298445d6abe59a26ddd0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
29d0e5b74a net: 6lowpan: Free net_buf if receiving wrong fragments
If we receive wrong fragments, then we start all over. In this
case we also need to release the net_buf that is used to collect
the earlier fragments.

Change-Id: I121d6a4031a375a0208441e110ebede58320c153
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
95fb81a3ae net: 6lowpan: Clear net_buf pointer after sending or dropping it
The net_buf is used to collect the received data. We clear the
buf pointer after all the data has been received or if we dropped
the packet. This way we know if the buf pointer was used or not.

Change-Id: I5d41b61fbc468262e8097719ddbc85ca90a73b98
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
63512ac2f3 net: udp: Do not mark the packet to be dropped if received ok
If the udp packet was successfully delivered to the application,
and if the application did not want to send anything back to
sender, then then uip_slen(buf) will be 0.
In this case we MUST NOT set uip_len(buf) to 0 as that would
cause the net_buf to be released by RX fiber. In this case it is
application responsibility to release the buffer.

Change-Id: I43cf9b147a45294288dc3c631908b034e1a4ab6a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
3be36754db net: UDP socket registration must only done once
We must make sure that the UDP socket can be registered only once.

Change-Id: I90e0dac2b1b234fd7f899a0e41442c13f0c8bdd7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
914bb3f3f5 net: apps: Add support for microkernel in 802.15.4 test app
The test_15_4 test application now works with microkernel also.

Change-Id: I041a917be599936089af9ffaba9c27b9aeb5a481
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Ravi kumar Veeramally
56ccfb3785 net: 15.4: Add 802.15.4 driver and 802.15.4 loopback radio driver
Enable 802.15.4 driver that receives the IPv6 packet, does header
compression on it and writes it to the 15.4 stack Tx FIFO.
The 15.4 Tx fiber will pick up the header compressed IPv6
6LoWPAN packet and fragment it into suitable chunks ready
to be sent to the 15.4 hw driver. The 15.4 stack Rx fiber picks
15.4 frames from 15.4 Rx FIFO (which are fed by 15.4 driver)
and reassembles the all fragmented packets and uncompress the
header and writes to the IP Rx FIFO.

The 15.4 loopback radio driver receives the 15.4 frames and
put it back to 15.4 Rx Fifo.

Change-Id: I68d1c7ff6de0e8770616e574206c2091c69a28e6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Patrik Flykt
231572a1c6 net: Set loopback address in the loopback driver
Set the loopback IPv6 address and an all-zero MAC address as the
loopback device really does not have a defined MAC address.

Clean up the code so that the loopback driver's IPv6 addresses are
not reused in other parts by mistake.

Change-Id: I07cc8bc5ad3a2ec5997bb313dd0ecaca4d9742f7
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
e4a6a07f40 net: rpl: Enable RPL Kconfig option
RPL (ripple) is IPv6 routing protocol for low power and lossy
networks. See RFC 6550 for details.

Change-Id: I60ca9e66be46741ebcc173ca3b581afd6876e9dc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
0b54f984b8 net: apps: Simple listener application that just receives packets
Change-Id: I91457d364742928743be9040c0db64a1f052c093
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
43593bcbf4 net: Use simple UART driver for handling slip (serial line IP) traffic
This commit uses the simple UART driver to pass slip data between
qemu and host.

User needs to create a network device (tun) in host that is
connected to qemu via slip protocol. The tunslip6 process
acts as a gateway and passes packets between qemu and host.
See net/ip/contiki/tools/README file for details how to use and
configure the slip in host.

This is meant for testing the uIP stack.

Change-Id: I82bb87a76485a07ddf5de9ae91fe3d49a0e20658
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Luiz Augusto von Dentz
016f6e7d6a Bluetooth: Replace peer address with conn in GATT API
Now that bt_conn is public using it directly is much more convenient
and in some cases save a lookup by address.

Change-Id: Ia489948634984fe4f1a430da553f8a2a740fb531
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:30 -05:00
Arkadiusz Lichwa
03d040d832 Bluetooth: Make hci_le_create_conn() sync
Enables in sync call get feedback from controller about status command
that HCI create LE link command transaction reach the controller stack.  
 
Change-Id: I9755f6911971a5d82898bb0e13a50060a30fd86b
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:30 -05:00
Luiz Augusto von Dentz
207402006a Bluetooth: Reorder GATT struct members to avoid padding
This makes sure the bigger members are always list first in non-packed
struct to minimize the use of padding for alignment by the compiler.

Change-Id: I64419e9b27f4e7d3abb4eeb0ef2a88beda5b22e3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:30 -05:00
Patrik Flykt
6d54615e7c net: Look up the local address if none is given
Look up the local IPv6 address if none is given by the application.
If no address is present, return a NULL context.

Change-Id: I7d4ef306944f65bc40799865dc6520b977636f6b
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
b2685703b9 net: context: Add our local address to address list
Add the user specified local address to the list of addresses
that the uIP stack knows.

Change-Id: I53dede27fa1717119a8bad6d7eee574ad3e924f1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
e71e01a588 net: uip: Debug print the added IPv6 address
Change-Id: Ib20723c1d85558cedb54f67b9159253b9e6d7911
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:30 -05:00
Jukka Rissanen
ad409a8964 net: init: Allow the network stack to be initialized only once
Change-Id: I06745962523b3774e0f5b830ec65a996d38ec9e6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
6fe17bb7a5 net: Check error when pushing packet into stack
Make tcpip_input() to return 0 if there is an error when
processing the packet. Value != 0 indicates a successfull
packet processing and in this case the application will
free the packet.

Change-Id: I4aaeb5f0039cfbe25f7238a144964e31a8204148
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Patrik Flykt
fa87944a08 net: Check that net context is unset based on IP protocol
Rather than checking whether the remote port is zero, use the IP protocol
field. The remote port might be zero if all incoming connections will be
accepted.

Change-Id: Ia1f24ae94fab27c561267c7bbc0f709fe98ee7e8
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Patrik Flykt
b993277436 net: Assign local UDP port number
Assign local UDP port number if not explicitely set by the caller. Use
the timer as a source of uniqueness as there is no random function
available.

If the local UDP port number has been set, verify that it is available
and not already assigned.

Change-Id: I18baac0cbec300cc2a5b7a62dff830d9fafcf2c9
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Patrik Flykt
586f3adf6e net: Handle IPv6 packet reception
When read from the Rx FIFO, pass the network buffer to the uIP IPv6
stack using the tcpip_input() function. As the event is handled, not
all cases where the buffer is to be discarded can be detected.
Thus, if ICMPv6 errors will not be sent, indicate that the packet is
to be dropped by setting its length to zero.

Change-Id: I49f69011685e39759ba25ebb07670308382a5ca8
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
eec46f1a88 net: Add code to analyze stack usage
To make it easy to periodically verify that we have sane stack sizes
it's helpful to have some code to evaluate how much of the stacks are
used. There's already a CONFIG_INIT_STACKS option which pre-fills the
stacks with 0xaa bytes, so we make use of it and in case the option is
enabled run the extra code to evaluate how much of each stack was
used. The trigger for the evaluation is a disconnection event.

Copied from Bluetooth sub-system.

Change-Id: Ic04ff83f682dc9b57afb69e164b972ffd9b860ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
3ce38be09d net: Declare fiber stacks as __noinit
No need to waste CPU cycles initializing the stack variables.

Change-Id: I0c517125ef37f7d0de4fd0040c4b4700536cd7c7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Ravi kumar Veeramally
9431109cde net: Add separated compression and fragmentation files.
Change-Id: If639164d32dbebb0e23075b433739c56bf70163c
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Ravi kumar Veeramally
575c89eacb net: Update 802.15.4 stack with net_mbuf and split sicslowpan
Move packetbuf from net_buf to net_mbuf, update 802.15.4 stack
with net_mbuf (which is smaller in size, and mostly wrapper for
packetbuf) and split sicslowpan(ipv6/sicslowpan.c|h) functionality
to compression and fragmentataion. This patch contains
null_compression and null_fragmentation which is exactly what
uip_driver.c|h does.

Change-Id: Ifee359e20aa57a50fb00c9ce049d9476b2ac67e3
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Johan Hedberg
c574d6de3e Bluetooth: Fix cmd_status handling for status == 0
For commands that generate an intermediate zero status (e.g.
HCI_LE_Create_Connection) we should allow for successful
bt_cmd_send_sync() completion at this point. Since the code treats a
NULL return buffer as failure we must provide an actual buffer to
indicate success. There's not really any useful information in the buf
for a cmd_status but passing it to the caller lets us notify of the
successful completion.

Change-Id: I38c70bfce95a1cc5383dfa0a49903731705772d1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:29 -05:00
Patrik Flykt
5d443c6136 net: apps: Add a sample app using the loopback driver
Change-Id: Iced27c5a151286a38f41484cfcc987a7a3a432ea
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Patrik Flykt
e26167cd4a net: Add loopback driver
Change-Id: If8ee848ed8519719b4ec3ad2e74167e0558709ef
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00