Commit graph

41120 commits

Author SHA1 Message Date
Ulf Magnusson
047868f84a log: net: Fix CONFIG_LOG_IMMEDIATE typo in comment
CONFIG_LOG_IMMEDIATE_MODE doesn't exist, only CONFIG_LOG_IMMEDIATE.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:45:20 -05:00
Loic Poulain
d9be3f21f4 ext: hal: nxp: mcux: csi: Fix double buffering capture
In case of double buffering (two capture buffers), the CSI is
frequently starved because of a lack of buffer in the active pool.

You can find below an example of double buffering scenario:

                FREE_BUF  ACTIVE_BUF
start:              0          2
frame0_complete:    0          1  (no buffer to load in active)
resubmit_frame0:    1          1
frame1_complete:    1          0  (CSI stopped, active buf = 0)
resubmit_frame1:    2          0
                    0    ->    2  (CSI restarted)

This patch solves this issue by loading buffer to active at submit
time.

                FREE_BUF  ACTIVE_BUF
start:              0          2
frame0_complete:    0          1
resubmit_frame0:    1          1
                    0    ->    2  (Direct load to active)
frame1_complete:    0          1
resubmit_frame1:    1          1
                    0    ->    2
...

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-03-26 07:44:55 -05:00
Loic Poulain
27fe618076 api: counter: Fix build issue with C++
When compiling with CPP, compiler complains about multiple implicit
type convertion:

error: invalid conversion from ‘const void*’ to ‘const counter_config_info*’
...

Let's fix that using explicit casting.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-03-26 07:44:01 -05:00
Robert Lubos
1e0c7e4811 net: tls: Add credential type documentation
Add a brief description of available credential types.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-03-26 07:30:57 -05:00
Paul Sokolovsky
946836577b samples: sockets: Add e1000 and stellaris ethernet drivers overlays
Add qemu ethernet driver overlays for big_http_download and
dumb_http_server samples, which are default integration samples/
tests for TCP stack. This change follows up after similar addition
of such overlays to other samples (and smsc911x overlay addition
to these samples).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-26 07:29:40 -05:00
Jukka Rissanen
079a2919cb tests: socket: tcp: Increase the buf count
With default buf count, we ran out of bufs in connect() in
test_v6_sendto_recvfrom().

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-26 07:29:26 -05:00
Jukka Rissanen
9cd547f53b net: tcp: Fix ref counting for the net_pkt
The network packet ref count was not properly increased when
the TCP was retried. This meant that the second time the packet
was sent, the device driver managed to release the TCP frame even
if we had not got ACK to it.

Somewhat long debug log follows:

The net_pkt 0x08072d5c is created, we write 1K data into it, initial ref
count is 1.

net_pkt_write: pkt 0x08072d5c data 0x08075d40 length 1024
net_tcp_queue_data: Queue 0x08072d5c len 1024
net_tcp_trace: pkt 0x08072d5c src 5001 dst 5001
net_tcp_trace:    seq 0x15d2aa09 (366127625) ack 0x7f67d918
net_tcp_trace:    flags uAPrsf
net_tcp_trace:    win 1280 chk 0x0bea
net_tcp_queue_pkt: pkt 0x08072d5c new ref 2 (net_tcp_queue_pkt:850)

At this point, the ref is 2. Then the packet is sent as you see below.

net_pkt_ref_debug: TX [13] pkt 0x08072d5c ref 2 net_tcp_queue_pkt():850
net_tcp_send_data: Sending pkt 0x08072d5c (1084 bytes)
net_pkt_unref_debug: TX [13] pkt 0x08072d5c ref 1 (ethernet_send():597)

Ref is still correct, packet is still alive. We have not received ACK,
so the packet is resent.

tcp_retry_expired: ref pkt 0x08072d5c new ref 2 (tcp_retry_expired:233)
net_pkt_ref_debug: TX [10] pkt 0x08072d5c ref 2 tcp_retry_expired():233
net_pkt_unref_debug: TX [10] pkt 0x08072d5c ref 1 ... (net_if_tx():173)
net_pkt_unref_debug: TX [10] pkt 0x08072d5c ref 0 ... (net_if_tx():173)

Reference count is now wrong, it should have been 1. This is because we
did not increase the ref count when packet was placed first time into
sent list in tcp.c:tcp_retry_expired().

The fix is quite simple as you can see from this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-26 07:29:26 -05:00
Erwan Gouriou
25d04049ce samples/drivers/counter: alarm: fix printk usage
When displaying int and u32_t, use %u instead of %d.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-26 07:29:08 -05:00
Erwan Gouriou
a5cb920227 driver/counter: rtc_stm32: Incorrect time_t offset
When converted to time_t, RTC init date was missing 100 years
offset, as time_t starts in 1900 while RTC starts in 2000.
Besides, tm_mon calculation was wrong by 1 month as allowed range
is 0-11 and provided in range 1-12.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-26 07:29:08 -05:00
Benjamin Valentin
c9907b438a drivers: spi: sam/sam0: Don't access uninitialized data
Set data->ctx.config before calling a function that operates on it.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-03-26 07:28:52 -05:00
Benjamin Valentin
388e9a6223 drivers: spi: sam/sam0: Don't claim support for async transfers
Asyc transceive is currently not implemented for this driver,
so don't claim support.

spi_context_lock() is already being called in spi_sam_transceive()
so calling it in the wrapper function will cause a deadlock.

This reverts eae05d928e

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-03-26 07:28:52 -05:00
Filip Kubicz
521d046fdc USB: Fix warning in DFU class
Move unused variable to scope where it is used.

Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
2019-03-26 11:21:23 +01:00
Erwan Gouriou
7d81a099e6 Bluetooth: Mesh: Increase advertising thread stack size
With BT_HOST_CRYPTO, advertising stack size could be overflowed,
increase size to 1024 when BT_HOST_CRYPTO is enabled.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-25 22:51:18 -04:00
Ravi kumar Veeramally
2f941d2630 tests: net: ipv6: Add one more test case
Test case added for IPv6 neighbors. This will add more than
CONFIG_NET_IPV6_MAX_NEIGHBORS neighbors. Network stack should
remove oldest neighbor which is in STALE state and it should
add new neighbor. So call to net_ipv6_nbr_add() should succeed.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-25 22:49:52 -04:00
Ravi kumar Veeramally
f361859fde net: ipv6: Fix IPv6 neighbor table
This patch fixes following issues.

  * If IPv6 neighbor table is full, stack can not add any new
    neighbors. So stale counter is introduced. Whenever neighbor
    enters into STALE state, stale counter will be incremented
    by one. When table is full and if stack wants to add new
    neighbor, oldest neighbor in STALE state will be removed
    and new neighbor will be added.

  * When neighbor is in PROBE state and when it exceeds max
    number of PROBEs, only neighbor with router is removed.
    As per RFC 4861 Appendix C, entry can be discarded. Now
    neighbor will be removed from the table.

  * Reachability timer has an issue. e.g. if a first entry timer
    is 10 seconds, after 3 seconds, a new entry added with
    only 3 seconds. But current implementation does not check
    whether remaining time of current left over timeout is more
    than new entry timeout or not. In this example, when new entry
    timeout is 3 seconds, left over timeout from first etnry is
    still 7 seconds. If k_delayed_work_remaining_get() returns
    some value then new entry time out was not considered.
    Which is bad. It fixed now.

  * nbr_free is used sometimes to remove the neighbor. Which does
    not remove route if that particulat neighbor is route to some
    other neighbor. net_ipv6_nbr_rm() should be used in such places.

  * Trivial changes which does not affect functionality.

Fixes #14063

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-25 22:49:52 -04:00
Jukka Rissanen
059a14e166 samples: net: zperf: Update the README file
Clarify what iPerf version was used when testing this sample
application. It was iPerf 2.0.9 which worked ok, for example
iPerf 2.0.13 did not work properly with UDP uploader (client)
mode.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 22:48:32 -04:00
Jukka Rissanen
24de2f7e01 samples: net: zperf: Fix TCP uploader
Try to construct a proper iperf client header to the payload
as the server expects that. It is not sure if this is needed
or correct as there is no proper documentation for the iPerf2
protocol.

Fixes #14665

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 22:48:32 -04:00
Jukka Rissanen
cbeeb510c0 samples: net: zperf: Fix UDP uploader
Try to construct a proper iperf client header to the payload
as the server expects that. It is not sure if this is proper
way to do the iperf header as there is no documentation about
iPerf protocol anyway (except the iPerf source code).

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 22:48:32 -04:00
Marti Bolivar
2785bee30e west: require version 0.5.6
Set the revision to the v0.5.6 tag in west.yml and update the minimum
version. Barring any (more) major undiscovered issues, this will be the
version used with Zephyr v1.14.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-03-25 22:46:56 -04:00
Krzysztof Chruscinski
e2de07b2f1 shell: Fix compile error when shell enabled and log disabled
Shell was selecting logger option which lead to define
CONFIG_LOG_RUNTIME_FILTERING generation even though log
was disabled. That messed up logger and lead to compilation
failure.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-25 22:45:08 -04:00
Krzysztof Chruscinski
808cc7c436 logging: Fix LOG_LEVEL_SET() not compiling when log disabled
When log is disabled then input parameter to LOG_LEVEL_SET(level)
is not defined. It was still used, leading to compilation failure.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-25 22:45:08 -04:00
Jukka Rissanen
a8b1dadac5 net: connection: Allow same port number for dest and source
Fix regression and allow incoming packet when source and
destination port numbers are the same.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 22:44:43 -04:00
Anas Nashif
cb8fb2d705 modules: remove tinycbor from ext/ and use west module feature
Use tinycbor from the tinycbor repo directly and drop the library from
ext/.

Add entry to west.yml and update SHA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-25 22:41:01 -04:00
Tomasz Bursztyka
c0de64fc59 net/ipv6: Take iface's MTU into account to decide fragmenting or not
In case of Ethernet for instance, the MTU is larger than the minimal
IPv6 MTU, so it is not required to fragment a packet that fits in
Ethernet MTU.

Fixes #14659

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-25 22:33:41 -04:00
Ioannis Glaropoulos
3bc0f88653 doc: kernel: float: fix ARM-specific content
This commit updates the documentation as follows:
- stresses that the lazy stacking preservation is disabled
  by default and not supported in ARM Cortex-M builds,
- corrects the figure of extra stack requirement when
  floating point services are enabled in ARM builds.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-25 22:32:00 -04:00
Ioannis Glaropoulos
fd3c26a9f9 doc: kernel: float: several content fixes
This commit provides the following fixes:
- Corrects the note regarding which ARM MCUs may support
  floating point services
- Rewords the text stressing the undefined behavior when
  multiple threads access the floating point registers.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-25 22:32:00 -04:00
Erwan Gouriou
87cd5e7050 boards: stm32: Enable CCM and update yaml
Following fix SRAM size to take into account CCM,
enable CCM and update yaml files in boards including fixed soc
dtsi definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-25 22:31:08 -04:00
Erwan Gouriou
d098c6005a dts: stm32: Fix erroneous RAM sizes when CCM is available
On various stm32 soc packages CCM is available and SRAM size
mentionned in datasheet include CCM.
Though, actual SRAM size defined in dtsi files should not
include CCM sizes.
Fix this on impacted dtsi files.

Fixes #14779

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-25 22:31:08 -04:00
Ioannis Glaropoulos
2d43d181bf arch: arm: no special case for MPUs with power-of-2-align requirement
Field stack_info.size is supposed to hold the actual writable
thread stack area, above what is pointed to by stack_info.start.
Therefore, in all MPU architectures we can program the Thread
Stack MPU region as starting from thread->stack_obj and with
size equal to stack_info.size plus the (possible) difference
between stack_obj and stack_info.start.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-25 15:58:42 -04:00
Andrew Boie
6a764c1879 ARM: fix wrong stack bounds stored in thread
Consider a stack buffer at address 0x10000 with size 1024.
If a thread is created with this stack object, the resulting
fields in thread.stack_info ended up being a base address of
0x10020 with size 1024. The guard size needed to be subtracted
from the size in order for the bounds to be correct.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-25 15:58:42 -04:00
Aurelien Jarno
bf59fcb78c drivers: hwinfo: add driver support for Atmel SAM device ID
Add driver support for Atmel SAM device ID, which is 16-bytes long. On
this SoC family, the device ID is part of the flash controller and
complex to read. Therefore the driver reads it once at boot time and
then just returned the copy saved in RAM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-03-25 15:55:48 -04:00
Tedd Ho-Jeong An
2d8ac0cf5e tests: net: mld: Check return after updating packet
This patch checks the return value after updating the packet.

Fix Bugs: #14821
Coverity CID: 196635

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-25 15:53:13 -04:00
Anas Nashif
54ffd7cf18 doc: remove note about calling recheck in CI
The command `recheck` was always experimental and should not be part of
the contribution guidelines and flow. It is not working now, so remove
it from the docs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-25 15:46:49 -04:00
Jukka Rissanen
295dc41c61 net: gptp: Rename z_gptp_pow2() to gptp_pow2()
The earlier removal of _ prefix went and renamed this func
and added z_ prefix. This is useless as the relevant macro
is called GPTP_POW2() so call the helper function as gptp_pow2().

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 14:43:23 -04:00
Jakub Rzeszutko
41ad9b716c shell: fix command bt scan
Command scan fixed in the way that it can take one mandatory parameter
and one optional. Previously it accepted only 2 mandatory parameters.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-03-25 20:38:35 +02:00
Jakub Rzeszutko
4557b6b2d1 shell: removed dead code in bt command
Removed automatic argument count checking in bt command. Now
it is possible to print a message that extra argument is not
recognized.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-03-25 20:38:35 +02:00
Jakub Rzeszutko
b6fc1af6ba shell: unify bt commands return value
Repleaced magic number 1 with define SHELL_CMD_HELP_PRINTED

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-03-25 20:38:35 +02:00
Tomasz Bursztyka
a10df124ba doc/networking: Add documentation on struct net_pkt and its API
Memory managment and operations.

Fixes #13114

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-25 13:50:55 -04:00
Tomasz Bursztyka
a96d066038 net/pkt: Switch function internal notes to doxygen details
Replace "Note:" to actual @details so it appears properly formated in
generated documentation.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-25 13:50:55 -04:00
Tomasz Bursztyka
632e3fb1ae net/pkt: Improve net_pkt_skip documentation.
Its behavior varies whether overwrite bit is set or not, so detailing
this more carefully.

Fixes #14093

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-25 13:50:55 -04:00
Tomasz Bursztyka
874b164df5 net/context: Fix net_context_send_cb documentation
status parameter documentation was outdated.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-25 13:50:55 -04:00
Jukka Rissanen
ac4db1b329 net: gptp: Fix bit shifting in time interval
It is invalid to try to bit shift the same amount of bits as
what is the number of bits in the left expression’s type.

Coverity-CID: 187079
Fixes #8988

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 13:38:38 -04:00
Andrei Emeltchenko
972221423c samples: usb: console: Select console device name
Instead of relying on overlays which requires to write overlay for
every board (100+) define console device name.

Fixes #14698

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-25 12:03:15 +01:00
Andrei Emeltchenko
de17b27886 usb: cdc_acm: Make ring buffer size configurable
Add new configuration parameter USB_CDC_ACM_RINGBUF_SIZE, default to
1024.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-25 12:03:15 +01:00
Andrei Emeltchenko
7ecd8d2ff3 samples: usb: cdc_acm_composite: Fix missing irq handling
If there are several queued interrupts we can miss some of them. Use
while() loop to catch them all.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-25 12:03:15 +01:00
Andrei Emeltchenko
cd95560cce usb: cdc_acm: Use ringbuf for RX path
Use ringbuf library for handling RX CDC ACM path. Remove old code
artifacts handling specific hardware.

Fixes #14288

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-25 12:03:15 +01:00
Andrei Emeltchenko
57b92e90fe usb: cdc_acm: Make parameters boolean
Remove 'U' after every assignment and make code more logical.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-25 12:03:15 +01:00
Alberto Escolar Piedras
6dce703c37 doc: Bluetooth: Correct how to run native_posix
1. The build paragraph was listed with the run option.
   But, we need to pass an argument to the native_posix board,
   so "ninja run" alone is not good enough.
   Plus, it was not coherent with the rest of the text, as
   the paragraph intended to tell people how to build.
2. Added "sudo" to the run line, as the user needs extra
   permissions to connect to a host BT controller.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-03-25 09:21:08 +01:00
Johan Hedberg
f811e5446a Bluetooth: Fix missing checks for the BT_DEV_READY flag
Several public APIs were not checking the BT_DEV_READY flag, which
could lead to hard-to-debug behavior, particularly when the stack
lacks an identity address. Add the appropriate checks to these APIs.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-25 10:04:45 +02:00
Johan Hedberg
12a413779d Bluetooth: Fix init procedure handling with BT_SETTINGS
The treatment of the BT_DEV_READY flag was broken when used together
with BT_SETTINGS. The flag would get set even though the stack was
still in a partially initialized state. Even worse, for central role
the stack would potentially try to initiate passive scanning without
having an identity address.

Refactor the code that sets the BT_DEV_READY flag (among other
initialization) into a separate bt_finalize_init() helper function and
call it when the settings have been loaded. Also clarify the warning
message given to the user in case settings_load() needs to be called.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-25 10:04:45 +02:00