Commit graph

19237 commits

Author SHA1 Message Date
Leandro Pereira
678429da3c debug: Add SEGGER SystemView libraries
These libraries allow publishing information to enable system profiling
when using the SEGGER SystemView tool.  This tool provides a way to record
and visualize events such as threads scheduling, interrupts, and can help
find unintended interactions and resource conflicts.  More information can
be obtained from SEGGER website at [1], including downloads for major
platforms.

[1] https://www.segger.com/systemview.html?p=1731

Jira: ZEP-1463
Origin: https://www.segger.com/systemview.html?p=1731
Change-Id: I04f5897690089dc8a8fb4ae60726fe3a022b7a30
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-25 02:16:37 +00:00
Leandro Pereira
ffe74b45fa kernel: Add thread events to kernel event logger
This adds a new event type to the kernel event logger that tracks
thread-related events: being added to the ready queue, pending a
thread, and exiting a thread.

It's the only event type that contains "subevents" and thus has a
non-void parameter in their respective _sys_k_event_logger_*()
function.  Luckily, as isn't the case with other events (such as IRQs
and thread switching), these functions are called from
platform-agnostic places, so there's no need to worry about changing
the assembly guts.

This is the first patch in a series adding support for better real-time
profiling of Zephyr applications.

Jira: ZEP-1463
Change-Id: I6d63607ba347f7a9cac3d016fef8f5a0a830e267
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-25 02:16:36 +00:00
Mazen NEIFER
35a48decfa xtensa port: Fixed compilation error introduced by recent changes.
The error was introduced by
    b8823c4efd

Change-Id: Ibf930107a7a690e0cb0851b7c247d524e3cb89e5
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-04-24 20:41:46 +00:00
Christer Weinigel
89c23e1c72 soc: stm32f4xx: Document the flash latency values
Document the flash latency values by copying the relevant tables
from the reference manuals for each MCU.

Change-Id: Ieb2824ffd7634d917399e3e62146d9243b527f44
Signed-off-by: Christer Weinigel <christer@weinigel.se>
2017-04-24 20:16:29 +00:00
David B. Kinder
3561c73ece spell: Kconfig help typos: /arch
Fix misspellings in Kconfig help text and made spelling of
RX and TX consistent (from reviewer comments)

Change-Id: Ie9d4c3863cd210e7a17b50a85a7e64156b6bf3d7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-24 20:14:53 +00:00
Christer Weinigel
73cf531975 soc: stm32f4xx: Make missing flash latency info a compile error
If the flash latency isn't set most STM32F4xx MCU's won't be able
to run from flash when the CPU frequency is changed.  Make this a
compile time error instead of an assert at runtime.

Change-Id: Ic3421194545f8f83bd6e00f0cd011306c8d1eedd
Signed-off-by: Christer Weinigel <christer@weinigel.se>
2017-04-24 20:14:13 +00:00
Kumar Gala
4f1e304f68 build: only build gen_idt on x86
Change-Id: I0401e2557c69f1e32ddedb79758c1dde781ea69b
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-24 03:17:16 +00:00
Andrew Boie
ca441162a7 tests: add fatal test case
We want to show that if a non-essential thread gets a fatal exception,
that thread gets aborted but the rest of the system works properly.

We also test that k_oops() does the same.

Issue: ZEP-2052
Change-Id: I0f88bcae865bf12bb91bb55e50e8ac9721672434
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Andrew Boie
75caa2b084 arm: exception-assisted kernel panic/oops support
Put the reason code in r0 and make a SVC #2 call, which will be
propagated to _fatal_error_handler as an exception.

The _is_in_isr() implementation had to be tweaked a bit.  User-generated
SVC exception no longer just used for irq_offload(); just because we are
in it does not mean we are in interrupt context.  Instead, have the
irq_offload code set and clear the offload_routine global; it will be
non-NULL only if it's in use. Upcoming changes to support memory
protection (which will require system calls) will need this too.

We free up some small amount of ROM deleting _default_esf struct as it's
no longer needed.

Issue: ZEP-843
Change-Id: Ie82bd708575934cffe41e64f5c128c8704ca4e48
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Andrew Boie
7827b7bf4a x86: exception-assisted panic/oops support
We reserve a specific vector in the IDT to trigger when we want to
enter a fatal exception state from software.

Disabled for drivers/build_all tests as we were up to the ROM limit
on Quark D2000.

Issue: ZEP-843
Change-Id: I4de7f025fba0691d07bcc3b3f0925973834496a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Andrew Boie
cdb94d6425 kernel: add k_panic() and k_oops() APIs
Unlike assertions, these APIs are active at all times. The kernel will
treat these errors in the same way as fatal CPU exceptions. Ultimately,
the policy of what to do with these errors is implemented in
_SysFatalErrorHandler.

If the archtecture supports it, a real CPU exception can be triggered
which will provide a complete register dump and PC value when the
problem occurs. This will provide more helpful information than a fake
exception stack frame (_default_esf) passed to the arch-specific exception
handling code.

Issue: ZEP-843
Change-Id: I8f136905c05bb84772e1c5ed53b8e920d24eb6fd
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Marti Bolivar
dc91536855 printk: add vprintk()
This is needed by application code that wants to print formatted
strings, but only has a fmt and va_list, and lacks memory to spare for
"buf" and something like:

	 vsnprintk(buf, sizeof(buf), fmt, ap);
	 printk("%s", buf);

Change-Id: Ic9cc915ec7e5f8f9492c730667f39788ecae65f6
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-22 14:29:33 +00:00
Marti Bolivar
4a157f3e48 printk: add missing __printf_like attributes
GCC supports __attribute__((format (printf ...))) even when the
variadic arguments are not present. In this case, the attribute
argument specifying the start of the variadic arguments should be
zero.

Use this in printk.h to add __printf_like where it's missing.

Change-Id: I7868439d5791e391aeb07356af9819524e68c771
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-22 14:29:32 +00:00
Andrew Boie
3b662555d1 arm: work around QEMU issue with _IsInIsr
The ICSR RETTOBASE bit is improperly implemented in QEMU (the polarity
is flipped) and the fix for it has not yet made it into a QEMU release,
although it is present in upstream master branch.

The symptom is that if we are not in thread mode, the system always
believes were are in a nested exception state, causing _IsInIsr() to
always return true.

Skip the nested exception check if we are building for QEMU.

This is a workaround until SDK-54 is resolved.

Issue: SDK-54
Change-Id: I06eafcc85fb76a9b23b4ba85ed6e111a08516231
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 01:08:27 +00:00
Andrew Boie
e09a04f068 arm: fix exception handling
For exceptions where we are just going to abort the current thread, we
need to exit handler mode properly so that PendSV can run and perform a
context switch. For ARM architecture this means that the fatal error
handling code path can indeed return if we were 1) in handler mode and
2) only wish to abort the current thread.

Fixes a very long-standing bug where a thread that generates an
exception, and should only abort the thread, instead takes down the
entire system.

Issue: ZEP-2052
Change-Id: Ib356a34a6fda2e0f8aff39c4b3270efceb81e54d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 01:08:07 +00:00
David B. Kinder
61de8f892b spell: Kconfig help typos: /kernel /misc /subsys
Fix misspellings in Kconfig help text

Change-Id: I6eda081c7b6f38287ace8c0a741e65df92d6817b
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-22 01:04:56 +00:00
David B. Kinder
93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Kumar Gala
96ee45df8d kernel: refactor thread_monitor_init into common code
We do the same thing on all arch's right now for thread_monitor_init so
lets put it in a common place.  This also should fix an issue on xtensa
when thread monitor can be enabled (reference to _nanokernel.threads).

Change-Id: If2f26c1578aa1f18565a530de4880ae7bd5a0da2
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 20:34:42 +00:00
Kumar Gala
b8823c4efd kernel: Refactor common _new_thread init code
We do a bit of the same stuff on all the arch's to setup a new thread.
So lets put that code in a common place so we unify it for everyone and
reduce some duplicated code.

Change-Id: Ic04121bfd6846aece16aa7ffd4382bdcdb6136e3
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 20:34:42 +00:00
Kumar Gala
5742a508a2 kernel: cleanup use of naked unsigned in _new_thread
There are a few places that we used an naked unsigned type, lets be
explicit and make it 'unsigned int'.

Change-Id: I33fcbdec4a6a1c0b1a2defb9a5844d282d02d80e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 20:34:41 +00:00
Kumar Gala
a48e8790d3 checkpatch: update checkpatch to warn about C99 type usage
Only in rare cases should we allow C99 types, so lets warn about it to
catch issues.

Change-Id: I2bacdd4ba98f88482e0b7acc0567ff1139e749bf
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 17:24:04 +00:00
Kumar Gala
cc334c7273 Convert remaining code to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.  This handles the remaining includes and kernel, plus
touching up various points that we skipped because of include
dependancies.  We also convert the PRI printf formatters in the arch
code over to normal formatters.

Jira: ZEP-2051

Change-Id: Iecbb12601a3ee4ea936fd7ddea37788a645b08b0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 11:38:23 -05:00
Tomasz Bursztyka
d9a1e367b2 gpio: Align pin parameter type in configure with all other functions
s/uint8_t/uint32_t

For some reason gpio_pin_configure uses a uint8_t though all other
places ask for uint32_t.

Change-Id: I50c113d71fd1d1cfba231fbc98b355b69a78dbec
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:55 +00:00
Tomasz Bursztyka
9f3bdcedf7 arch/arc/soc: If IOAPIC is not enabled, gpio_dw should still compile
Irq flags should be set to 0.

Change-Id: I7c5104c0dc89ba79789a263649422f51a556f218
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:54 +00:00
Tomasz Bursztyka
d2b5853cd9 drivers/gpio: Use ifdef relevantly in DW drivers
Change-Id: I580ca0aeccd7b2c1117fc71571dac9faa5baf8b0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:53 +00:00
Tomasz Bursztyka
e9e78878d0 drivers/spi: Get QMSI shim driver following syntax rules
Even one liner if () should have get { ... }

Change-Id: I7f9d8d74398286e97549bed050e29d4d175e1b02
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 16:34:52 +00:00
Kumar Gala
83a5990185 docs: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I731cc91517436685836023cbda34f894586a54bc
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 16:11:51 +00:00
Kumar Gala
ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Kumar Gala
e547533435 samples: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08c682bfc0b80dfa88de859e90a011bcd2db2762
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:53 -05:00
Kumar Gala
eaaa175b92 tests: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I6c676bc6c5e850a8725785554cd535e32067f33e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:49 -05:00
Kumar Gala
6da829690f subsys: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: Icbf9e542b23208890a3a32358447d44cdc274ef1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:36:22 -05:00
Kumar Gala
a509441210 net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:30:38 -05:00
Jukka Rissanen
7f8d2d198b Merge net branch into master
Main changes:

- Refactoring net_nbuf usage.
- Fix null pointer access in IPv6.
- Fix compiler warnings.
- TCP ACK timer and retransmit fixes.
- Print enhancements in net-shell.
- RPL fixes.
- ZoAP fixes.

----------------------------------------------------------------
Andrei Emeltchenko (1):
      net: shell: Correct print format specifier

Jukka Rissanen (10):
      net: ipv6: Make sure not to access null pointer
      net: tcp: Avoid unused variable compiler warning
      net: pkt: Make the debug print eye friendly
      net: conn: Utility to print connection handlers
      net: Print debug info if packet is loopback back to us
      net: context: Set the local port correctly in accept
      net: tcp: Make sure ACK timer is not run if cancelled
      Bluetooth: ipsp: Fix compile error in sample app
      net: context: Connect callback was set too late
      net: shell: Fix compiler error when printing conn handlers

Mitul Shah (1):
      net: context: Fixing bug in net context put flow

Paul Sokolovsky (1):
      net: shell: conn: Dump local/remote ports for contexts.

Ravi kumar Veeramally (5):
      net: rpl: Fix rpl header update
      net: zoap: Refactor zoap utilities
      net: zoap: Fix memory overflow issue
      net: zoap: Remove unused helper function
      net: zoap: Prepare and send error response separately

Tomasz Bursztyka (7):
      net: Renaming net nbuf API to net pkt API
      net/net_pkt: Fully separate struct net_pkt from struct net_buf
      net_pkt: Removing legacy net_dir
      net_pkt: Externalize ext_bitmap handling
      net_pkt: Reordering the attributes for better alignment
      net: Rename all *_BUF() macros to *_HDR()
      net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_

june li (1):
      net: tcp: Do buf ref when resending a segment

 .../networking/connectivity-example-app.c          |   22 +-
 .../networking/ip-stack-architecture.rst           |    2 +-
 doc/subsystems/networking/l2-and-drivers.rst       |   14 +-
 drivers/console/telnet_console.c                   |   54 +-
 drivers/ethernet/Kconfig.sam_gmac                  |   12 +-
 drivers/ethernet/eth_enc28j60.c                    |   40 +-
 drivers/ethernet/eth_mcux.c                        |   38 +-
 drivers/ethernet/eth_sam_gmac.c                    |  106 +-
 drivers/ethernet/eth_sam_gmac_priv.h               |    6 +-
 drivers/ieee802154/ieee802154_cc2520.c             |   60 +-
 drivers/ieee802154/ieee802154_mcr20a.c             |   46 +-
 drivers/ieee802154/ieee802154_nrf5.c               |   42 +-
 drivers/ieee802154/ieee802154_uart_pipe.c          |   36 +-
 drivers/slip/slip.c                                |   53 +-
 include/net/arp.h                                  |    6 +-
 include/net/buf.h                                  |    5 -
 include/net/ethernet.h                             |    4 +-
 include/net/ieee802154_radio.h                     |   12 +-
 include/net/mqtt.h                                 |    2 +-
 include/net/nbuf.h                                 | 1314 ----------------
 include/net/net_context.h                          |   59 +-
 include/net/net_core.h                             |   11 +-
 include/net/net_if.h                               |   25 +-
 include/net/net_l2.h                               |   10 +-
 include/net/net_offload.h                          |   34 +-
 include/net/net_pkt.h                              | 1297 ++++++++++++++++
 include/net/zoap.h                                 |  124 +-
 samples/bluetooth/ipsp/prj.conf                    |    8 +-
 samples/bluetooth/ipsp/src/main.c                  |   75 +-
 samples/net/coaps_client/prj_qemu_x86.conf         |    8 +-
 samples/net/coaps_client/src/coaps_client.c        |   37 +-
 samples/net/coaps_client/src/udp.c                 |   32 +-
 samples/net/coaps_client/src/udp.h                 |    2 +-
 samples/net/coaps_server/prj_arduino_101.conf      |    8 +-
 samples/net/coaps_server/prj_qemu_x86.conf         |    8 +-
 samples/net/coaps_server/src/coaps_server.c        |   64 +-
 samples/net/coaps_server/src/udp.c                 |   47 +-
 samples/net/coaps_server/src/udp.h                 |    2 +-
 samples/net/dhcpv4_client/prj_arduino_101.conf     |    8 +-
 samples/net/dhcpv4_client/prj_frdm_k64f.conf       |    8 +-
 samples/net/dhcpv4_client/prj_qemu_x86.conf        |    8 +-
 samples/net/dhcpv4_client/src/main.c               |    1 -
 samples/net/dns_resolve/prj_qemu_x86.conf          |   10 +-
 samples/net/echo_client/prj_arduino_101.conf       |    8 +-
 .../net/echo_client/prj_arduino_101_cc2520.conf    |   10 +-
 samples/net/echo_client/prj_bt.conf                |    8 +-
 samples/net/echo_client/prj_cc2520.conf            |   10 +-
 samples/net/echo_client/prj_frdm_k64f.conf         |    8 +-
 samples/net/echo_client/prj_frdm_k64f_cc2520.conf  |   10 +-
 samples/net/echo_client/prj_frdm_k64f_mcr20a.conf  |   10 +-
 samples/net/echo_client/prj_nrf5.conf              |   10 +-
 samples/net/echo_client/prj_qemu_802154.conf       |   10 +-
 samples/net/echo_client/prj_qemu_cortex_m3.conf    |    8 +-
 samples/net/echo_client/prj_qemu_x86.conf          |    8 +-
 samples/net/echo_client/prj_sam_e70_xplained.conf  |    8 +-
 samples/net/echo_client/src/echo-client.c          |  131 +-
 samples/net/echo_server/prj_arduino_101.conf       |    8 +-
 .../net/echo_server/prj_arduino_101_cc2520.conf    |   10 +-
 samples/net/echo_server/prj_bt.conf                |    8 +-
 samples/net/echo_server/prj_cc2520.conf            |   10 +-
 samples/net/echo_server/prj_frdm_k64f.conf         |    8 +-
 samples/net/echo_server/prj_frdm_k64f_cc2520.conf  |   10 +-
 samples/net/echo_server/prj_frdm_k64f_mcr20a.conf  |   10 +-
 samples/net/echo_server/prj_nrf5.conf              |   10 +-
 samples/net/echo_server/prj_qemu_802154.conf       |   10 +-
 samples/net/echo_server/prj_qemu_cortex_m3.conf    |    8 +-
 samples/net/echo_server/prj_qemu_x86.conf          |    8 +-
 samples/net/echo_server/prj_sam_e70_xplained.conf  |    8 +-
 samples/net/echo_server/src/echo-server.c          |  111 +-
 samples/net/http_client/prj_frdm_k64f.conf         |   10 +-
 samples/net/http_client/prj_qemu_x86.conf          |    8 +-
 samples/net/http_client/src/config.h               |    6 +-
 samples/net/http_client/src/http_client.c          |    1 -
 samples/net/http_client/src/http_client_rcv.c      |   34 +-
 samples/net/http_client/src/http_client_rcv.h      |    2 +-
 samples/net/http_client/src/tcp_client.c           |   10 +-
 samples/net/http_client/src/tcp_client.h           |    2 +-
 samples/net/http_server/README.rst                 |    2 +-
 samples/net/http_server/prj_arduino_101.conf       |    8 +-
 samples/net/http_server/prj_bt.conf                |    8 +-
 samples/net/http_server/prj_frdm_k64f.conf         |    8 +-
 samples/net/http_server/prj_qemu_x86.conf          |    8 +-
 samples/net/http_server/src/http_server.c          |   14 +-
 samples/net/http_server/src/http_server.h          |    4 +-
 samples/net/http_server/src/http_write_utils.c     |    1 -
 samples/net/http_server/src/ssl_utils.c            |   30 +-
 samples/net/http_server/src/ssl_utils.h            |    2 +-
 samples/net/ieee802154/hw/prj_cc2520_1.conf        |   10 +-
 samples/net/ieee802154/hw/prj_cc2520_2.conf        |   10 +-
 samples/net/ieee802154/hw/prj_mcr20a.conf          |   10 +-
 samples/net/ieee802154/hw/prj_nrf5.conf            |   10 +-
 samples/net/ieee802154/qemu/prj.conf               |   10 +-
 samples/net/ieee802154/qemu/prj_client.conf        |   10 +-
 samples/net/ieee802154/qemu/prj_server.conf        |   10 +-
 samples/net/irc_bot/prj_frdm_k64f.conf             |    8 +-
 samples/net/irc_bot/prj_qemu_x86.conf              |    8 +-
 samples/net/irc_bot/src/irc-bot.c                  |   28 +-
 samples/net/leds_demo/src/leds-demo.c              |   86 +-
 .../net/mbedtls_dtlsclient/prj_arduino_101.conf    |    8 +-
 samples/net/mbedtls_dtlsclient/src/udp.c           |   38 +-
 samples/net/mbedtls_dtlsclient/src/udp.h           |    2 +-
 samples/net/mbedtls_dtlsserver/src/udp.c           |   32 +-
 samples/net/mbedtls_dtlsserver/src/udp.h           |    2 +-
 samples/net/mbedtls_sslclient/prj_arduino_101.conf |    8 +-
 samples/net/mbedtls_sslclient/src/tcp.c            |   36 +-
 samples/net/mbedtls_sslclient/src/tcp.h            |    4 +-
 samples/net/mqtt_publisher/prj_96b_nitrogen.conf   |   10 +-
 samples/net/mqtt_publisher/prj_frdm_k64f.conf      |   12 +-
 samples/net/mqtt_publisher/prj_qemu_x86.conf       |   10 +-
 samples/net/mqtt_publisher/src/main.c              |    1 -
 samples/net/nats/prj_qemu_x86.conf                 |    5 +-
 samples/net/nats/src/main.c                        |    1 -
 samples/net/nats/src/nats.c                        |   36 +-
 samples/net/telnet/prj_frdm_k64f.conf              |    8 +-
 samples/net/telnet/prj_qemu_x86.conf               |    8 +-
 samples/net/telnet/prj_qemu_x86_iamcu.conf         |    8 +-
 samples/net/wpan_serial/prj.conf                   |    6 +-
 samples/net/wpan_serial/src/main.c                 |   77 +-
 samples/net/wpanusb/prj.conf                       |    4 +-
 samples/net/wpanusb/src/wpanusb.c                  |   52 +-
 samples/net/zoap_client/src/zoap-client.c          |   37 +-
 samples/net/zoap_server/src/zoap-server.c          |  188 +--
 samples/net/zperf/prj_bt.conf                      |   10 +-
 samples/net/zperf/prj_frdm_k64f.conf               |   10 +-
 samples/net/zperf/prj_frdm_k64f_prof.conf          |   10 +-
 samples/net/zperf/prj_qemu_x86.conf                |   10 +-
 samples/net/zperf/prj_quark_se_c1000_devboard.conf |    8 +-
 samples/net/zperf/src/zperf_session.c              |   28 +-
 samples/net/zperf/src/zperf_session.h              |    2 +-
 samples/net/zperf/src/zperf_tcp_receiver.c         |   16 +-
 samples/net/zperf/src/zperf_tcp_uploader.c         |   27 +-
 samples/net/zperf/src/zperf_udp_receiver.c         |  109 +-
 samples/net/zperf/src/zperf_udp_uploader.c         |  104 +-
 subsys/net/Makefile                                |    2 +-
 subsys/net/ip/6lo.c                                |  196 ++-
 subsys/net/ip/6lo.h                                |   12 +-
 subsys/net/ip/6lo_private.h                        |    4 +-
 subsys/net/ip/Kconfig                              |   34 +-
 subsys/net/ip/Kconfig.debug                        |   16 +-
 subsys/net/ip/Makefile                             |    2 +-
 subsys/net/ip/connection.c                         |  113 +-
 subsys/net/ip/connection.h                         |   29 +-
 subsys/net/ip/dhcpv4.c                             |  173 ++-
 subsys/net/ip/icmpv4.c                             |  176 +--
 subsys/net/ip/icmpv4.h                             |   16 +-
 subsys/net/ip/icmpv6.c                             |  255 +--
 subsys/net/ip/icmpv6.h                             |   32 +-
 subsys/net/ip/ipv4.c                               |   92 +-
 subsys/net/ip/ipv4.h                               |   28 +-
 subsys/net/ip/ipv6.c                               | 1271 +++++++--------
 subsys/net/ip/ipv6.h                               |   71 +-
 subsys/net/ip/l2/arp.c                             |  197 +--
 subsys/net/ip/l2/bluetooth.c                       |   50 +-
 subsys/net/ip/l2/dummy.c                           |   20 +-
 subsys/net/ip/l2/ethernet.c                        |  146 +-
 subsys/net/ip/l2/ieee802154/ieee802154.c           |  117 +-
 subsys/net/ip/l2/ieee802154/ieee802154_fragment.c  |  150 +-
 subsys/net/ip/l2/ieee802154/ieee802154_fragment.h  |   10 +-
 subsys/net/ip/l2/ieee802154/ieee802154_frame.c     |   43 +-
 subsys/net/ip/l2/ieee802154/ieee802154_frame.h     |   16 +-
 subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c      |   42 +-
 .../net/ip/l2/ieee802154/ieee802154_radio_aloha.c  |   16 +-
 .../ip/l2/ieee802154/ieee802154_radio_csma_ca.c    |   16 +-
 .../net/ip/l2/ieee802154/ieee802154_radio_utils.h  |   20 +-
 subsys/net/ip/nbuf.c                               | 1611 -------------------
 subsys/net/ip/net_context.c                        |  358 +++--
 subsys/net/ip/net_core.c                           |  127 +-
 subsys/net/ip/net_if.c                             |   58 +-
 subsys/net/ip/net_pkt.c                            | 1627 ++++++++++++++++++++
 subsys/net/ip/net_private.h                        |   42 +-
 subsys/net/ip/net_shell.c                          |  258 +++-
 subsys/net/ip/route.c                              |   24 +-
 subsys/net/ip/route.h                              |    4 +-
 subsys/net/ip/rpl-mrhof.c                          |    1 -
 subsys/net/ip/rpl-of0.c                            |    1 -
 subsys/net/ip/rpl.c                                |  688 ++++-----
 subsys/net/ip/rpl.h                                |   16 +-
 subsys/net/ip/tcp.c                                |  223 +--
 subsys/net/ip/tcp.h                                |   31 +-
 subsys/net/ip/udp.h                                |   42 +-
 subsys/net/ip/utils.c                              |   41 +-
 subsys/net/lib/dns/resolve.c                       |   32 +-
 subsys/net/lib/http/http_client.c                  |   54 +-
 subsys/net/lib/http/http_server.c                  |   23 +-
 subsys/net/lib/mqtt/mqtt.c                         |  118 +-
 subsys/net/lib/zoap/zoap.c                         |  280 ++--
 subsys/net/lib/zoap/zoap_link_format.c             |  105 +-
 tests/net/6lo/prj.conf                             |   13 +-
 tests/net/6lo/src/main.c                           |   83 +-
 tests/net/arp/prj.conf                             |   10 +-
 tests/net/arp/src/main.c                           |  232 +--
 tests/net/context/prj.conf                         |   10 +-
 tests/net/context/src/main.c                       |  116 +-
 tests/net/dhcpv4/prj.conf                          |    8 +-
 tests/net/dhcpv4/src/main.c                        |  134 +-
 tests/net/icmpv6/prj.conf                          |    8 +-
 tests/net/icmpv6/src/main.c                        |   41 +-
 tests/net/ieee802154/crypto/prj.conf               |    7 +-
 tests/net/ieee802154/fragment/prj.conf             |   10 +-
 tests/net/ieee802154/fragment/src/main.c           |   86 +-
 tests/net/ieee802154/l2/prj.conf                   |    8 +-
 .../net/ieee802154/l2/src/ieee802154_fake_driver.c |   24 +-
 tests/net/ieee802154/l2/src/ieee802154_test.c      |   47 +-
 tests/net/iface/prj.conf                           |    8 +-
 tests/net/iface/src/main.c                         |   22 +-
 tests/net/ip-addr/prj.conf                         |    8 +-
 tests/net/ip-addr/src/main.c                       |    6 +-
 tests/net/ipv6/prj.conf                            |   10 +-
 tests/net/ipv6/src/main.c                          |  119 +-
 tests/net/lib/dns_resolve/src/main.c               |   10 +-
 .../net/lib/mqtt_publisher/src/test_mqtt_publish.c |    2 +-
 .../lib/mqtt_subscriber/src/test_mqtt_subscribe.c  |    2 +-
 tests/net/lib/zoap/prj.conf                        |    4 +-
 tests/net/lib/zoap/src/main.c                      |  318 ++--
 tests/net/mgmt/prj.conf                            |    8 +-
 tests/net/mgmt/src/mgmt.c                          |    6 +-
 tests/net/mld/prj.conf                             |    6 +-
 tests/net/mld/src/main.c                           |   66 +-
 tests/net/neighbor/prj.conf                        |   10 +-
 tests/net/neighbor/src/main.c                      |    1 -
 tests/net/{nbuf => net_pkt}/Makefile               |    0
 tests/net/{nbuf => net_pkt}/prj.conf               |   17 +-
 tests/net/{nbuf => net_pkt}/src/Makefile           |    0
 tests/net/{nbuf => net_pkt}/src/main.c             |  663 ++++----
 tests/net/{nbuf => net_pkt}/testcase.ini           |    0
 tests/net/route/prj.conf                           |    8 +-
 tests/net/route/src/main.c                         |   61 +-
 tests/net/rpl/prj.conf                             |   10 +-
 tests/net/rpl/src/main.c                           |   49 +-
 tests/net/tcp/prj.conf                             |   10 +-
 tests/net/tcp/src/main.c                           |  314 ++--
 tests/net/trickle/prj.conf                         |    8 +-
 tests/net/udp/prj.conf                             |   10 +-
 tests/net/udp/src/main.c                           |  106 +-
 tests/net/utils/prj.conf                           |    8 +-
 tests/net/utils/src/main.c                         |  139 +-
 236 files changed, 8793 insertions(+), 8685 deletions(-)
 delete mode 100644 include/net/nbuf.h
 create mode 100644 include/net/net_pkt.h
 delete mode 100644 subsys/net/ip/nbuf.c
 create mode 100644 subsys/net/ip/net_pkt.c
 rename tests/net/{nbuf => net_pkt}/Makefile (100%)
 rename tests/net/{nbuf => net_pkt}/prj.conf (53%)
 rename tests/net/{nbuf => net_pkt}/src/Makefile (100%)
 rename tests/net/{nbuf => net_pkt}/src/main.c (61%)
 rename tests/net/{nbuf => net_pkt}/testcase.ini (100%)

Change-Id: I7ce3d65b6e92d12a2f6536cd41ce1281bcdf9a7a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 16:29:38 +03:00
Jukka Rissanen
af1e3b9d32 net: shell: Fix compiler error when printing conn handlers
There was compiler error if CONFIG_NET_DEBUG_CONN was set.

Change-Id: Ibb6721c55dd2c56cd0097359a53563c6221859ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 15:44:22 +03:00
Jukka Rissanen
d8dd91d7bf net: context: Connect callback was set too late
We need to set the connect_cb for the context before sending SYN packet.
This is required if we have a loopback connection in which case everything
is happening more or less synchronously and the connect_cb would not be
called in this case because its value would still be null.
For remote network connections this patch makes no difference.

Change-Id: Id7f837cd9e81cd79c4666c98cae84f6cb1a77af0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 15:44:22 +03:00
Jukka Rissanen
da6eba463d Bluetooth: ipsp: Fix compile error in sample app
Some incompatible changes were introduced when net and bluetooth
branches were changed at the same time.

Change-Id: Ifa03f85d26a63ade0fcc029377d54850c0e92451
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 15:44:20 +03:00
David B. Kinder
36bb36475f spell: fix Kconfig help typos: /arch
Fix misspellings in Kconfig help text

Change-Id: I2a753b57107f09073eb84ac757ac1e180ae89349
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 12:30:42 +00:00
Kumar Gala
bf53ebf2c8 arch: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.  There are few places we dont convert over to the new
types because of compatiability with ext/HALs or for ease of transition
at this point.  Fixup a few of the PRI formatters so we build with newlib.

Jira: ZEP-2051

Change-Id: I7d2d3697cad04f20aaa8f6e77228f502cd9c8286
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 12:08:12 +00:00
Jukka Rissanen
1bf14853aa net: tcp: Make sure ACK timer is not run if cancelled
We must not let ACK timer to run if we have already cancelled it.
So keep track that the timer is cancelled and refuse to run it
if it was indeed cancelled. The reason why the timer might be run
in this case is because the timer might be scheduled to be triggered
after which one cannot cancel it.

Change-Id: I1c8b8cee72bc7a644e02db154d9d009b8d98ade2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:52 +03:00
Jukka Rissanen
137e4e7256 net: context: Set the local port correctly in accept
The local port was set to 0 for IPv6 when registering
the connection handler. For IPv4, the code was not setting
the port in local_addr struct.

Change-Id: I82f0c08641a94d75d255ac306eca7bec6c332fba
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:52 +03:00
Jukka Rissanen
a1c4f3fbd5 net: Print debug info if packet is loopback back to us
Without this info it is a bit difficult to notice what is going
on in loopback case.

Change-Id: I8f61330c01d025e41f00d663bd26947b8cafb5c0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Jukka Rissanen
a71a9f9ad1 net: conn: Utility to print connection handlers
Add support to print connection handler information in net-shell.
There exists one connection handler for each UDP/TCP port that we
are listening. These prints are only available if CONFIG_NET_DEBUG_CONN
is enabled because the net_context has the same information. Thus the
connection handler info is only printed if debugging is active in order
to verify that handler information is proper.

Change-Id: I0be39a5adb89b2cdbd85524c5d943e4a562b0fde
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Jukka Rissanen
f498a90b77 net: pkt: Make the debug print eye friendly
Print "pkt" instead of "Pkt" when printing network packet
pointer value.

Change-Id: Id4225be9c55807def3d892d372cdfc5c79c871fc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Jukka Rissanen
52339cdf5a net: tcp: Avoid unused variable compiler warning
If TCP debugging is enabled but if the loglevel is set to lower
than 4, then compiler prints warning about unused flags variable
in net_tcp_trace().

Change-Id: I2e663644b50fe97b75088202e21b286aa010953e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka
f3ff4f7bd3 net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_
Only 2 attributes lacked this prefix, which makes sense to have, so
applying it accordingly and changing the helpers as well.

Change-Id: I095b2729f977f8fb1624eff8801a4a4e21416693
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka
e5896906f6 net: Rename all *_BUF() macros to *_HDR()
Most of these macros are not exactly exposing a buffer, but a specific
header pointer (ipv6, ivp4, ethernet and so on), so it relevant to
rename them accordingly.

Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka
02cb7e6e71 net_pkt: Reordering the attributes for better alignment
Instead of using a bool, let's just use a bit in a bifield, shared among
various attribute. This saves space.

Make ext_len attribute enabled only on IPv6 (ipv6, icmpv6 and rpl are
the only code setting it) and reordering the helpers functions
accordingly.

Change-Id: Ifd3295d778959308ead7db9b2a59396e50f8e18c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka
c18016b69b net_pkt: Externalize ext_bitmap handling
IPv6 next headers are processed in a way so it is not required to store
which header has been already seen in the net_pkt, as the processing loop
can store internally which one it has seen already.

Change-Id: I266ba8a3a0081a162318cdafb474a0fc44a3185e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka
2e331de690 net_pkt: Removing legacy net_dir
This is actually useless as there is only 1 RX memory slab, and thus can
be removed to reduce net_pkt structure size.

Change-Id: I62d716515120e7356ee1e2d75bbe1ec32e22c35d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka
db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00