Commit graph

42559 commits

Author SHA1 Message Date
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
Patrik Flykt
78f518db52 net: Use network driver when sending IP packets
Set the uIP output function in order to call the send function in the
registered driver. Do driver initialization and checking cleanups.

Change-Id: I18c9b551320d15fa2619a077d1224f5e521c53ed
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
29a61aff9c net: Add function to receive an IP packet from the driver
After an IP packet has been (reassembled and) received, the driver
submits the IP packet to the IP stack.

Change-Id: Icbd1e7740ce59db16bc1d61002420e86ab101d2d
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
5d3685f85f net: Add separate buffers for MAC layer
We do not need large 1280 bytes long buffers in lower IP stack
layers. After long packet has been fragmented to smaller chunks
it depends on the radio technology how long buffers we need
to use. For 802.15.4 we can use 128 bytes long buffers.

Change-Id: I8cd6085944d78fa26a4aa1a93c58fc436856541b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
6e33b6b7af net: csma: Init the queuebuf before use
Change-Id: I1463ccd43e2ba0e683a9fefc4e4afce81037d451
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
05c97c195e net: uip: Return correct packet discard status to caller
Fixed the compiler warning about not returning correct value to
caller. Now we return correct value if neighbor solicitation was
sent properly.

Change-Id: Ie28a2ee417bcdf3eb9b24ab91a49c688992e7420
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
fad23cb025 net: Check the return value when sending packet
If the return value of the sender is 0, then packet is/was
discarded and we release the net_buf. If the value is 1, then
packet was sent properly and the driver has already freed
the net_buf.

Change-Id: Icd93602225e14f7210fe9ef33603a7451d834a80
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
9ee16aa2df net: uip: Print link local address byte without length modifier
The system library does not know how to print length with %x
modifier.

Change-Id: I9a2b0ec138a8da4a001379fe818cd8694cc78bc8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
b4dcd72245 net: 6lowmac: Add more debug prints
Helps to monitor what is going on in the stack.

Change-Id: I1707ea07c09082e4f74b1d6c4fa78a9e646485d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
fd9e55762d net: 6lowmac: Release net_buf if the packet is discarded
Important to release the net_buf if we discard the packet.
In the future it might be easier if input() would return
status and caller could discard the net_buf if needed.

Change-Id: I533a37ef7f2e80d99ad62301562228189a5e0308
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
620fb7eb6c net: 6lowpan: Enabled 6lowpan support
Created a kconf variable that is used to enable/disable 6LoWPAN
support.

Change-Id: Iaccfe01696ec7226d9a114924c1162fa35959ff9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
df85375e56 net: Dummy implementation for watchdog_periodic()
This needs proper implementation later.

Change-Id: I4e7db17bd87be3f6490c3a8ca89c089d79aa3d59
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
2f5b1d1570 net: Add a way to see who is trying to alloc/dealloc a net_buf
Change-Id: Ib7813bc5809f85f27aa4fe06583b64461741466a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Mariusz Skamra
606c3701ab Bluetooth: Fix bt_conn_lookup_addr_le and bt_conn_lookup_handle
bt_conn_lookup_addr_le shouldn't look for the state of the connection.
bt_conn_lookup_handle should return bt_conn only if there is a handle
so if connection is in state BT_CONN_CONNECTED or BT_CONN_DISCONNECT.

Change-Id: Id88361990913d17bdaffc686e5aa3edaeaaecc0a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:29 -05:00
Arkadiusz Lichwa
5e79bfb662 Bluetooth: Refactor internal bt_conn_add() API
Delegates connection object to new connection when there exists
in pool of available connections an object with zeroed destination
LE address.
When there's no reference to the active connection object resets its
peer LE address member.
Replaces routine's input connection handle parameter with LE address.
Moves to the caller setting connection state, connection handle and
call to bt_l2cap_update_conn_param() since connection handle needs
to be valid when such update going to be made.

Change-Id: I81743a915da6cb008f9593dd1940c186a357be6b
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
c73aeba521 net: Fixing the net_receive() function
Now we properly register UDP listener and specify callback to be
called when UDP packet is received.

Change-Id: Ia9fded780d53ba2fbfad6a34927dcbd92e42a9e8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
844a888e99 net: context: Add helper function for checking socket registration
We need to know if we have registered a socket listener, otherwise
we try to register UDP handler too many times.

Change-Id: I060150d01eb149f2a2a6a332d18e0142e5cb7a5e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
210d10b036 net: Release net_buf in a case of error in IPv6 packet processing
Change-Id: Ic29762737d3d71e97a45cbe9bfccfb0dd1c1bb2f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
49410ae20a net: Allow loopback address for packet
This is enabled so that the loopback network test
driver works.

Change-Id: Ib5e1af2c1b064b0ef71c31be919ea88ed62531ff
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:29 -05:00
Jukka Rissanen
9099884162 net: Allow user application to get the packet data length
The uip_len(buf) cannot be used as the Contiki stack zeroes
the buffer len after sending and after processing received packet.

Thus the application can use uip_appdatalen(buf) macro to get
the application data length.

Change-Id: Iaaa508acb96c28919cfc0188ef46bb2b4a693090
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Jukka Rissanen
3d3bb6892e net: More debugging added to uIP driver
Change-Id: I610c6eca7dcf0d803f7da8441dd15bf4e6eb3f99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Jukka Rissanen
431300d8a6 net: init: Fix the sending part of the memory buffer
The buffer is released by the driver or some other lower stack
element.

Change-Id: I0ced57df4d95213bae2bbe591a41da6178f4c272
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Jukka Rissanen
6382e5328a net: packetbuf: Enhanced debugging when printing buf contents
Change-Id: Idf6898e949634d6c4137577875833cf8901fb493
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Jukka Rissanen
87dfd99e0b net: csma: Debug print used memory buffer
Change-Id: If4e508503b822b599040afaa664253f25f022fec
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Jukka Rissanen
800ac8e3af net: Print warning when the packet was discarded because of length
Inform user when packet is too long. Only printed if logging is
enabled in config.

Change-Id: I3feb052de8edc4b68b36c5190f3d7c8073d9a887
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Jukka Rissanen
a00371b4d6 net: Add debugging support to various network components
These are useful to have. The macros are copied from tcpip.c file.

Change-Id: If784fbe449aae6f065af8756c9be6d4ed68a6272
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:28 -05:00
Szymon Janc
fedfb7fa29 Bluetooth: Make cmd_scan_* parameters explicit void
Change-Id: I3b6fb2ecfb0a4572f3583991f2a94667442fd065
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:28 -05:00
Arkadiusz Lichwa
0e8952f4fc Bluetooth: Tweak connection state debug log
Enables more readable debug log during changing connection state.
Available when CONFIG_BLUETOOTH_DEBUG_CONN is on.

Change-Id: I51938f003be1382bdd234d9fc67a628a754a30ca
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:28 -05:00
Arkadiusz Lichwa
83dab3854d Bluetooth: Refactor existing connection states
Applies new bt_conn_set_state() internal API that now participate in
tracking connections. It concerns only connected and disconnected
events from controller.
Remove bt_conn_del() internal API.

Change-Id: Ic8da46785a7b5e19cae2186047e84e1a5a45a78a
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:28 -05:00
Arkadiusz Lichwa
b65e6f3640 Bluetooth: Add new connection states
Adds new possible transitions in tracking connection state.
Reorder available transition value set.

Change-Id: I4f5959c7f98f7a39d8405c23bff9af330e12fcaa
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:28 -05:00
Arkadiusz Lichwa
86001d81f4 Bluetooth: Introduce set connection object state
Typedef so far anonymous enum values allowable connection states
to be set.
Adds interface to allow track connection state.
Update struct bt_conn definition using introduced enum's typedef.

Change-Id: Id91f5a814e4801438f1dcef36fff058faab7beda
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:28 -05:00
Anas Nashif
d9c0bc65ee Zephyr 0.2.0
Change-Id: Ie094e711b96d90dd4bb5c1dfb543e9e4819bf1ff
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:28 -05:00
Javier B Perez Hernandez
e401d0fb87 doc: microkernel fix PIPE API descriptions
Changed PIPE get APIs description to Get data off pipe instead of put data on.

Change-Id: If68b1f15541de1acd43df80cbd9799bb902fda0d
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
2016-02-05 20:14:28 -05:00
Anas Nashif
f3add9bd9b Zephyr 0.2.0-rc2
Change-Id: Iec055acc4cebc1e18add3760e7c9419e1ce2d8f0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:28 -05:00
Dan Kalowsky
8c85f01904 i2c: adding in public i2c header
This header defines the public API for I2C drivers and the I2C
driver interface.

Change-Id: I7ed19c0f2a13a34bbaf35b50b648b73b5570bbd7
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:14:28 -05:00