Commit graph

18968 commits

Author SHA1 Message Date
Johan Hedberg ac1360f0a7 Bluetooth: Mesh: Convert to new net_buf_simple APIs
Convert the mesh code to use the new net_buf_siple APIs. This has the
benefit of saving 4 bytes off the stack due to the not needed pointer.
Also update the publication context helpers to map to the new
net_buf_simple API in an intuitive way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 14:00:08 +02:00
Ravi kumar Veeramally 18422de8da net: tcp: Provide local address in TCP reset message preparation
If context is bound to IPv6 unspecified addresss and some port
number, then unspecified address is passed in TCP reset packet
message preparation. Eventually packet dropped at the peer.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-13 13:37:20 +02:00
Ravi kumar Veeramally 1f20111ef3 net: tcp: Do not handle packet re-transmission in TCP ACK
Zephyr doesn't have luxury to create re-transmit timer per packet. So
it has different methods to handle packets in queue. But re-sending
packets on valid ack messages causing issues.

E.g. A TCP node sent two packets (packet-1, packet-2). Peer replied
two ACKs (ACK-1 and ACK-2), and these two ACK's are at rx_thread
queue. Now ACK-1 is handled and reference of packet-1 is freed
from sent list. Then if condiftion (valid ACK and connection
state is ESTABLISHED) notices that, sent list is not empty.
Restart the timer, modify sent flag and resend packets in a
list. Here packet-2 is sent again, even though ACK-2 is already
received. Situation is worse if there are more packets in the
list.

So only start the re-transmit timer in-case queue is not empty. It
allows rx_thread to handle all incoming packets (in this e.g ACKs).
When the re-trasmit timer expires, it sends the packets which
are left in queue.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-13 13:37:20 +02:00
Ravi kumar Veeramally e059e8b379 net: context: Handle failure case of tcp backlog entry
In case of failed to get source address from the net packet,
release the assgined tcp backlog entry. Otherwise it will
never be freed.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-13 13:37:20 +02:00
Ravi kumar Veeramally 7dc72c3ca6 net: context: Remove duplicate call
k_delayed_work_cancel(&context->tcp->fin_timer) called twice
immediately one after other.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-02-13 13:37:20 +02:00
Luiz Augusto von Dentz 800bfaf9a7 Bluetooth: UUID: Remove macros defining 16 bit values
Application should normally declare a bt_uuid with proper type and then
use bt_uuid_cmp.

Fixes #5162

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 13:33:48 +02:00
Robert Chou 6f466cd7e5 net: coap: retransmission for four times
RFC 7252, sec 4.8 [https://tools.ietf.org/html/rfc7252#section-4.8]
The default MAX_RETRANSMIT is 4, current implementation only
retry 3 times. Update next_timeout() to return one more retry.

Also, add a TODO for random generated initial ACK timeout

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2018-02-13 13:06:15 +02:00
David B. Kinder 8cdd9bed6c doc: fix duplicate sample doc titles
Two docs listed in the Samples an Demos TOC had the same title displayed
in the board-specific samples section, "Power Management Demo".  Give
both sample docs a more specific title.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-12 21:59:54 -05:00
Paul Sokolovsky ede25c12a3 net: sockets: getaddrinfo() buffer overflow, etc. fixes
The existing implementation assumed DNS resolv callback will be
called just once, but that's not always the case (apparently,
for multi-homes hosts or something). So, apply array bounds
checking (and do pointer arithmetic only after it, as the C
standard otherwise warns of "undefined behavior"). In such a case,
the port number wasn't set in each entry too, so rework how it's
done.

The issues discovered while resolving archive.ubuntu.com.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-12 20:17:26 -05:00
Andrew Boie ce6c8f347b dma: add system calls for dma_start/dma_stop
As per current policy of requiring supervisor mode to register
callbacks, dma_config() is omitted.

A note added about checking the channel ID for start/stop, current
implementations already do this but best make it explicitly
documented.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-02-12 19:24:25 -05:00
Carles Cufi 980c0cf4ac build: win: Add a new zephyr-env.cmd file
Add a new zephyr-env.cmd that mirrors the functionality of zephyr-env.sh
but on Windows platforms. It sets ZEPHYR_BASE to the location of the
script.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-12 19:22:22 -05:00
Michael Scott 7a9b688526 x86: fix build warning
During compile of lwm2m_client using qemu_x86, the following build
warning was noticed:
zephyr/arch/x86/core/excstub.S:132:2: warning: "/*" within comment [-Wcomment]
  /*

In commit ff42bdd0a0 ("debug: remove option GDB_INFO"), the comment tag
was omitted.  Fix the comment end tag.

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
2018-02-12 19:21:06 -05:00
Anas Nashif 11a9625eaf debug: remove DEBUG_INFO option
This feature is X86 only and is not used or being tested. It is legacy
feature and no one can prove it actually works. Remove it until we have
proper documentation and samples and multi architecture support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-12 13:58:28 -08:00
Anas Nashif ff42bdd0a0 debug: remove option GDB_INFO
This feature is X86 only and is not used or being tested. It is legacy
feature and no one can prove it actually works. Remove it until we have
proper documentation and samples and multi architecture support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-12 13:58:28 -08:00
Carles Cufi d0c2be7c8a doc: getting_started: Windows build doc fixes
Correct 2 items in the Windows Getting Started doc:

 * dtc-msys2 is now an upstream Chocolatey package
 * Add instructions to clone and build Ninja for MSYS2

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-12 13:47:42 -05:00
Andy Gross ff22490d56 doc: Update security feature information
This patch updates information pertaining to userspace related security
features.  Some of these have been added to releases and this needs to
be shown in the document.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-12 13:47:19 -05:00
Yannis Damigos 6973d134bd dts/arm/st: fix dts inclusion for stm32f334
stm32f334 is not an expansion of stm32f303, since
stm32f303 has more I2C, SPI ports than stm32f303.

Fix this by including stm32f3.dtsi in stm32f334.dtsi.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-12 09:17:37 -06:00
Yannis Damigos 9dacb3a02d dts/arm: Move i2c2 node inside stm32fxxx dtsi file
SoC stm32f334x8 doesn't support I2C2 port. This
patch moves i2c2 node inside stm32f303 and
stm32f373 dtsi files.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-12 09:17:37 -06:00
Anas Nashif bd2838bb78 sanitycheck: asserts are now enabled by default
sanitycheck now runs with asserts enabled, so no need for this option
anymore.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-12 08:24:23 -05:00
Sebastian Bøe 0e6689d559 sanitycheck: Default to using Ninja
It is important that it is easy to reproduce CI issues locally. Using
the same sanitycheck options locally and in CI helps in this
regard. Specifically, Ninja and Make can produce different results and
therefore the default generator should be the same for sanitycheck and
shippable.

This patch makes four changes:

The sanitycheck option '--make' is introduced to allow specifying Make
as a generator.

CI no longer passes the option '--ninja' to sanitycheck.

Sanitycheck defaults to using Ninja.

Sanitycheck documents the --ninja option as deprecated.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-02-12 08:24:23 -05:00
Vinayak Kariappa Chettimada 4eedb5067f Bluetooth: mesh: Account for scan window delaying adv events
New advertising started while scanning is already enabled
would delay the first advertisement event until the end of
the current overlapping scan window in the Zephyr native BLE
controller implementation. Hence, consider this scan window
duration when calculating the advertising stop.

Relates to: #6083

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-12 12:13:38 +02:00
Vinayak Kariappa Chettimada af13d6d581 Bluetooth: controller: Fix soft latencies in periodic ticker
Fix, add the missing code for the removal of any accumulated
soft latencies or negative drift ticks when scheduling next
interval expiry with added laziness.

Typically a first interval would accumulate soft latencies
and this has to be removed if the interval is rescheduled
with any added laziness (scheduled to the next soft real
time interval).

Example, scan windows block any new scheduling until the end
of the window, adding latencies to any soft real time ticker
expiry which should try to execute as early as possible after
the scan window.

Fixes: #6083

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-12 12:13:38 +02:00
Vinayak Kariappa Chettimada 57e49b1f03 Bluetooth: controller: Refactor BT_CTLR_ADV_INDICATION feature
Refactor BT_CTLR_ADV_INDICATION feature by moving the
implementation closer to the implementation that is closing
the advertisement event so that in the future new members
can be added as necessary (example, advertised channels).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-12 12:13:38 +02:00
Vinayak Kariappa Chettimada baf05409f8 Bluetooth: controller: Fix BT_CTLR_XTAL_ADVANCED cond. compilation
Fix compile warnings when BT_CTLR_XTAL_ADVANCED Kconfig
option is disabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-12 12:13:38 +02:00
Johan Hedberg 5ded8d8d49 Bluetooth: Remove useless BT_L2CAP_TX_USER_DATA_SIZE Kconfig variable
No one was setting this to any other value than its default, which
happens to be the same as BT_BUF_USER_DATA_MIN.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-12 09:48:32 +02:00
Johan Hedberg c14c2692e2 net: buf: Set default user data size to 4
Since all in-tree users are good with 4 bytes of user data, reduce the
default to 4. Also fix the default and rage values where apparently
'0' and '8' had been swapped.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-12 09:48:32 +02:00
Johan Hedberg 0ad6dbd80d Bluetooth: Move HCI command buffer user data into separate array
The HCI command buffers are the only ones with more than 4 bytes of
required user data. Move the user data into a separate array and do
the mapping with the help of net_buf_id(). After this, it will be
possible to reduce the default net_buf user data size from 8 to 4.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-12 09:48:32 +02:00
Johan Hedberg a7518ba30f Bluetooth: Mesh: Fix coverity warning with unchecked error return
This fixes Coverity CID 182769.

Fixes #6102

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-11 21:38:02 +02:00
Vinayak Kariappa Chettimada a152109eb1 Bluetooth: controller: Fix nRF52840 radio timings for Coded PHY
Fix incorrect radio timing for Tx chain delay for S2 and S8
coding. Regression introduced  in commit 55d3ce111c
("Bluetooth: controller: Refactoring nRF5 radio driver").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-11 20:33:02 +01:00
Johan Hedberg d5f27b70cc Bluetooth: Remove bogus return statements for BR/EDR connections
Having these in the beginning of a switch statement without any case
statement makes no sense.

Fixes #6135

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-11 18:29:57 +02:00
Alberto Escolar Piedras bc101c5b25 sanitycheck: better coverage report generation
When generating coverage report:
* Also generate branch coverage
* If the report is properly generated tell user where to find it
* Handle case in which no ztests are run (it would crash before)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-11 11:09:42 -05:00
Paul Sokolovsky bc1a82acc7 samples: net: sockets: Clean up/improve socket samples
With 323e8cf069 applied and printf() working out of the box,
CONFIG_NET_BUF_LOG=y workarounds can be removed from configs of
all samples.

Also, print an intro message at the start of each server sample,
to give a user hint that the app didn't just hang and what to do
next. (The port waiting for connection is printed. We can't (easily)
print host address, because the samples should run on both Zephyr
and POSIX systems, and finding out local host address would require
hairy #ifdef's undermining the purpose of these samples (that is,
showing that the *same* code can be used on both types of systems)).

Fixes: #5379

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-11 09:49:31 -05:00
Johan Hedberg 7aeb1fa136 net: buf: Remove incorrect dependency for NET_BUF_POOL_USAGE
NET_BUF_POOL_USAGE was never supposed to depend on NET_BUF_LOG.

Fixes #6127

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-11 13:37:09 +02:00
Johan Hedberg 9da02caff2 net: buf: Make net_buf_simple_init() forward compatible
Make it safe to call net_buf_simple_init() even if the buffer was
created using the new macros. This is possible to detect since with
the new macros buf->__buf will be non-NULL and with the old
NET_BUF_SIMPLE() macro it will be NULL.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-11 10:40:57 +02:00
Daniel Wagenknecht 5361963224 boards: stm32f072b_disco: add supported features
Add gpio, i2c and spi as supported feaures.

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-10 22:42:38 -05:00
Henrik Brix Andersen bc5b39551c doc: remove spurious console code block from arduino_zero doc.
Remove spurious console code block to fix formatting of the following
zephyr-app-commands directive. While I am here, fix the indentation of
the two zephyr-app-commands directives.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-02-10 18:21:34 -05:00
Anas Nashif b3b31ade11 doc: add initial microbit documentation
Add a basic description of the platform and some placeholders, this will
need to be refined.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-10 15:27:36 -05:00
Alberto Escolar Piedras 25e0636c84 doc: Sanitycheck command line options fixup
Aligned sanitycheck command line options in doc
with the actual ones.
+
Minor fix in --coverage description.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-10 13:22:06 -05:00
Anas Nashif ce74393267 toolchain: gcc/common: add header guard
Added guards to the toolchain/gcc.h and toolchain/common.h

Those files should never be included directly, but a guard is useful
regardless.

Fixes #5130

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-10 11:14:32 -05:00
Johan Hedberg 4637620a66 tests: net/buf: Update to new API
Update the net_buf unit test to test the features from the new API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 5008ec7a06 net: buf: Introduce variable data length allocators
Introduce two new "standard" data allocators to net_buf. There are now
three in total:

NET_BUF_POOL_FIXED_DEFINE: This is the closes to the old
implementation, i.e. fixed size chunks.  It's also what the old
NET_BUF_POOL_DEFINE macro maps to.

NET_BUF_POOL_HEAP_DEFINE: uses the OS heap

NET_BUF_POOL_VAR_DEFINE: defines a variable sized allocator using
k_mem_pool (this is all that there was in my first draft of this
feature)

Currently the variable length allocators (HEAP & VAR) support
reference counted data payloads, i.e. cheap cloning. The FIXED
allocator does not currentlty support this to allow for the simplest
possible implementation, but the support can be added later if
desired.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg dd09cbc1c4 net: buf: Redesigned API with split data and meta-data
Redesign of the net_buf_simple and net_buf structs, where the data
payload portion is split to a separately allocated chunk of memory. In
practice this means that buf->__buf becomes a pointer from having just
been a marker (empty array) for where the payload begins right after
the meta-data.

Fixes #3283

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 09dcbcc579 tests: net: mgmt: Increase mgmt event stack
This stack seems to be overflowing on xtensa.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg bd989a79ba tests: Remove broken net_buf unit tests
The net_buf unit tests were doing some pretty hacky stuff with
defining a dummy _net_buf_pool_list variable to fulfil the linker
magic that happens with a real build. Until now the code got lucky in
that the simple net_buf_alloc() tests didn't depend on
_net_buf_pool_list being valid, however with the coming redesign even
net_buf_alloc will require proper setup of this.

Since the unit tests were extremely minimal, and not testing anything
beyond what tests/net/buf already tests, just remove them for now.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 1d131338bc net: samples: zperf: Reduce quark_se_c1000_devboard buffer counts
This gives a bit more margin to the available RAM.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 5856540c90 net: samples: throughput_server: Decrease buffer count
Decrease the buffer count in order to give a reasonable margin to the
available RAM.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
David B. Kinder 23c6095ebf doc: update CONTRIBUTING guidelines
Commit messages now require a body summary (before it could be blank for
"trivial" changes).

Add mention of uncrustify to help format code to project standards.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-09 22:48:56 -05:00
Anas Nashif f03d789cca doc: add qemu_riscv32 brief documentation
Very brief documentation of the board as a placeholder, more info on
supported features will follow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-09 18:03:12 -05:00
Anas Nashif abd613d063 board: zedboard_pulpino: move docs
Move README to doc/ and convert it to RST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-09 18:03:12 -05:00
Carles Cufi 6bb98cc4fb kconfig: Sort the glob results
Sort the glob results when Kconfig sources do 'source
"/path/*/Kconfig"' to ensure that the resulting dotconfig file is the
same for all platforms.

This fixes #5743

Credit goes to @ulfalizer.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-09 10:31:26 -05:00