Commit graph

41120 commits

Author SHA1 Message Date
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
Tomasz Bursztyka
bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Andrei Emeltchenko
9bf3ea071a net: shell: Correct print format specifier
Fix warning using incorrect format specifier

Change-Id: Ib6800c40b2cd769612ae6f107e41a941926d8e66
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-04-21 14:19:50 +03:00
june li
504b273b85 net: tcp: Do buf ref when resending a segment
We need to check whether buf_sent was true when resending the TCP
segment, and do a buf ref if needed. If this is not done, the buf
will be unref after send, which will cause unpredictable results.

Change-Id: Ibd4490305de88ac6ffd04ec42bba196e57da5c10
Signed-off-by: june li <junelizh@foxmail.com>
2017-04-21 14:19:50 +03:00
Jukka Rissanen
7ce82fea82 net: ipv6: Make sure not to access null pointer
While very unlikely it might happen that fragment pointer is NULL
when going through fragment list.

Coverity-CID: 167148

Change-Id: Ic3dbed7ee29c7b864d4830d726f65d7f62dcea84
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:49 +03:00
Ravi kumar Veeramally
651a0cb269 net: zoap: Prepare and send error response separately
If error occurs while preparing response to .well-known/core request,
do not send partly filled payload by simply changing code part only.
It's better to unref the partly filled reponse and prepare a new error
response and send.

Change-Id: I28013a4e331cfc6f01de873e80af48f765e49494
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21 14:19:49 +03:00
Ravi kumar Veeramally
a8ac7af37a net: zoap: Remove unused helper function
Commit "net: zoap: Fix memory overflow issue" fixed and implemented
./well-known/core response in a different way, so this api is not needed
anymore.

Change-Id: I8f945fb5842028be50ecfdef95cbe5da3189a538
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21 14:19:49 +03:00
Ravi kumar Veeramally
79ff5ed5fa net: zoap: Fix memory overflow issue
If CoAP .well-known/core services list is bigger than single fragment
then current helper functions overwrites beyond fragment space. Which
corrupted whole stack. Right now sending response in multiple fragments
but preferred way is send response in block by block. This should
overcome packet loss across mesh scenarios. Recommended feature will
be supported with later patches.

Change-Id: I30ca55bde2516d80b3583731241ad295799c6614
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21 14:19:49 +03:00
Ravi kumar Veeramally
09773f5a5f net: zoap: Refactor zoap utilities
Most of the zoap utilities deal with first fragment of buffer chain.
So accessing of buf->frags directly make less usage of stack than
delcaring another variable for frag and its data. Due to code
refactoring couple of lines removed and in between those lines
coverity complained two issues, which is not valid now.

Coverity-CID: 157597
Coverity-CID: 157598

Change-Id: I3035c0625a131d49a4f0250ff0052875d3382544
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21 14:19:49 +03:00
Ravi kumar Veeramally
2f73c324aa net: rpl: Fix rpl header update
When net_ipv6_finalize_raw() inserts RPL(HBH) header after IPv6 header,
it updates IPv6 next header as HBH and HBH next header as original IPv6
next header.

Then net_ipv6_prepare_for_send() will update RPL HBH header if it exists.
But net_rpl_update_header() is comparing HBH option and IPv6 next header,
which is wrong. Wrong comparion does not update RPL instance id and
sender rank. Peer nodes drops all the packets due to invalid instance
ID and sender rank.

Change-Id: I91c1870a09c60f8e1ebc73e434dcc208caf6299a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21 14:19:49 +03:00
Mitul Shah
d27ca378b6 net: context: Fixing bug in net context put flow
Following flow does not work:
net_context_get
net_context_bind
..
..
net_context_put
net_context_get
net_context_bind

At instance of call to net_context_bind, conn_handler
is not NULL and returns with EISCONN.

This patch sets conn_handler to NULL in net_context_unref

Change-Id: I56a50839101b22161644b3cd7c5f510fa1abae3e
Signed-off-by: Mitul Shah <mitul.a.shah@intel.com>
2017-04-21 14:19:49 +03:00
Paul Sokolovsky
52e3e5c68d net: shell: conn: Dump local/remote ports for contexts.
Without port numbers, information printed by net shell's "conn" command
is unclear and non-differentiating. Also, improve handling of unknown
address families - don't abort early, still pring context address, iface
address, etc.

Example of "conn" output with these changes from echo_server sample:

net> conn
     Context   	Iface         Flags Local           	Remote
[ 1] 0x001126e0	0x001121a0    6DU   [::]:4242	[::]:0
[ 2] 0x00112738	0x001121a0    4DU   0.0.0.0:4242	0.0.0.0:0
[ 3] 0x00112790	0x001121a0    6ST   [::]:4242	[::]:0
[ 4] 0x001127e8	0x001121a0    4ST   0.0.0.0:4242	0.0.0.0:0

TCP        Src port  Dst port   Send-Seq   Send-Ack  MSS    State
0x00112b00     4242         0  497073352          0  1280
0x00112b98     4242         0  497543793          0  1460

Change-Id: I2f03efd933979b5571f608c28a7a7a4bd7f5346a
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-21 14:19:49 +03:00
Leandro Pereira
99a7168b08 misc: Support left-justification in printk()
This is supported by printf(), and is an important formatting feature
to print out some complex, nicely-formatted information.  This is
accomplished by using a negative padding in the formatting string.

The following code:

      printk("none:         |%u| |%x|\n", 12345, 12345);
      printk("zero_before:  |%08u| |%08x|\n", 12345, 12345);
      printk("space_before: |%8u| |%8x|\n", 12345, 12345);
      printk("space_after:  |%-8u| |%-8x|\n", 12345, 12345);

Will produce the following output:

      none:         |12345| |3039|
      zero_before:  |00012345| |0000000000003039|
      space_before: |   12345| |            3039|
      space_after:  |12345   | |3039            |

Change-Id: I9c2d85a1790087d53b52b7713854adaf99282f09
Jira: ZEP-1599
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-21 11:06:16 +00:00
Mazen NEIFER
37352c809e xtensa port: Added documentation for xt-sim board.
Issue: ZEP-1899

Change-Id: I4cf2878468e8c1c9703a2af13d9c2b3ac6f78042
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-04-20 21:07:15 +00:00
Kumar Gala
d0eb235510 Bluetooth: 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: I8f57a17f78e674aca5400f005db8975c9f9e150e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 13:25:23 -05:00
Kumar Gala
bf50c245ec misc: 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: Ia38862a5d408f4b4512cd2840ee46e686ae342e3
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 11:56:00 -05:00
Kumar Gala
7352c4681d boards: 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: I27d51c316144251939b20cfa6787ff7ab8035fe6
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 11:56:00 -05:00
Kumar Gala
9a74ee1730 lib: 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: I74bc6384c4090f4ae322e3aa151874f583a5fe73
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 11:56:00 -05:00