Commit Graph

13897 Commits

Author SHA1 Message Date
Gil Pitney a3e8a850f7 MAINTAINERS: Update maintainer for TI CC3220SF LaunchXL board
This replaces the cc3220s_launchxl board with the cc3220sf_launchxl
board directory.

Jira: ZEP-1958

Change-Id: I550061319d458d6ba694dbf26082f14666dd150e
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:41 -05:00
Gil Pitney 70040f0e11 boards: Add support for the CC3220SF_LAUNCHXL board
CC3220SF_LAUNCHXL effectively replaces the CC3200_LAUNCHXL,
with support for the CC3220SF SoC, which is an update for
the CC3200 SoC.

This is supported by the Texas Instruments CC3220 SDK.

Jira: ZEP-1958

Change-Id: I2484d3ee87b7f909c783597d95128f2b45db36f2
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:41 -05:00
Gil Pitney c73a1eb806 cc3220sf: Add support for the TI CC3220SF SoC
The CC3220SF is a replacement for the CC3200 SoC, comprising
a network coprocessor and Cortex-M4 MPU.

This leverages the CC3220 SDK driver peripheral library in ROM,
and some files built from ext/hal/ti/.

Jira: ZEP-1958

Change-Id: I892b212c178e05d84ff1d716dde593ced653ae6d
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:41 -05:00
Erwan Gouriou 9bd2a42d60 dts: Align uart "baud-rate" property to device tree spec "current-speed"
Devicetree.org specifies that serial devices property used to set
baud rate is "current-speed", while zephyr uses "baud-rate".
Align property name in order to keep zephyr dts files compatible
with device tree specification and could be re-used from/to
Linux for instance.  We also cleanup a few SoCs that set "baud-rate" in
the SoC dts and not the board.

Jira: ZEP-2048

Change-Id: I097e7439ee46fe77c628b56531772950382fafcc
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 15:06:40 -05:00
Gil Pitney de20a6558a cc3200: Make use of mem.h file in soc dtsi file.
This in preparation for adding a cc3220sf DTS file, which
has a different address for sram0 than the cc3200.

Also moved baud-rate out of soc dtsi file to board dts.

Jira: JEP-1958

Change-Id: I641452c0a8a6d1ad4424e132d6ef2de71d8545b4
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:40 -05:00
Erwan Gouriou af6ca469e8 ext: stm32cube: update stm32f1xx cube version
Update Cube version for STM32F1XX family
from version: V1.14.0
to version: V1.15.0

Add support for Low Level API on stm32f1 family

Change-Id: I8cb5fe2fd94be3a320e863c7b5ed59e4c2312e87
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-04-28 15:06:40 -05:00
Christer Weinigel cc93aceb83 usb: cdc_acm: Use 2 instead of 4 for IN BULK endpoint
The highest endpoint number supported by the STM32F4xx USB device
controller is 3.  Change the cdc_acm driver to use endpoint 2
instead of endpoint 4 so that it will work with this platform.

Change-Id: I4a3cd08f546a7fe01558528de0990156f642d93b
Signed-off-by: Christer Weinigel <christer@weinigel.se>
2017-04-28 18:48:58 +00:00
David B. Kinder f338a16dee doc: fix broken link in nordic-segger board doc
Change-Id: If39d1b015bc0313b37fcfd00be0489ee259126ef
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-28 16:00:47 +00:00
Mazen NEIFER 51eb081311 xtensa port: Fixed crash on interrupt handlers when logger is enabled.
This fixes ZEP-1955. The issue was that the interrupt stack frame only
allocates 4 registers. This means that if any window overflow happens,
only 4 registers can be saved. This implies that the interrupt handler
can not call functions other than using call4. If this rule is not
honored, then it will result in the registers being overwriting other
context information and thus a stack corruption.

The fix consists on using call4 for calling even t logger function,
which is by the way more optimal as the interrupt handler does not need
to save more than 4 registers when these functions are called.

Issue: ZEP-1955

Change-Id: Iacea626443d1d61d95a52253ac8ff15fc3722d2c
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-04-28 15:49:01 +00:00
Jessica Wagantall 2bbaa13533 doc: Updating installation instructions
The installation instructions for Ubuntu 16.04
needed to be updated to use the correct packages
rt:40021

Change-Id: Ia6bfb66b7d24dda2556b76a495988eea20037607
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
2017-04-28 15:32:44 +00:00
Anas Nashif 8dd2a35c30 Merge "Merge net branch into master" 2017-04-28 14:54:10 +00:00
Anas Nashif da871298b4 checkpatch: per coding style, we do not allow c++ style comments
Change-Id: I933f317f2117917bf6413fa0514342f6df4c1e90
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-28 13:03:33 +00:00
Michael Scott 841a59cb0c slist/dlist: container node can't be NULL in *_PEEK_NEXT_CONTAINER
Using MPU enabled HW it was evident that a NULL access
(with offset) was happening in the TCP stack due to the
following message:
***** MPU FAULT *****
  Executing thread ID (thread): 0x20009b0c
  Faulting instruction address:  0x8034496
  Data Access Violation
  Address: 0x34
Fatal fault in essential thread! Spinning...

Turns out we are referencing a potentially de-referenced
NULL pointer in the SYS_SLIST_PEEK_NEXT_CONTAINER macro.

Let's avoid this by checking the container node for NULL.

Also fix dlist.h SYS_DLIST_PEEK_NEXT_CONTAINER with the same
issue.

Change-Id: I2e765b9af7bcaf8fb13f7c9b7e081f9e6d4928f2
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28 12:36:40 +00:00
Jukka Rissanen 943d28c51e Merge net branch into master
Main changes:

- Add IEEE 802.15.4 XCVR driver for KW41Z.
- Freedom board mcux eth driver RX fixes.
- Atmel SAM e70 Xplained driver support for MAC EEPROM.
- Network architecture documentation fixes.
- Make net-shell function available for other components.
- Slip fixes for escaping special chars.
- Added support for clearing ARP cache when needed.
- net_pkt_append() refactoring.
- BT TX packet leak fix.
- DNS fixes.
- MQTT fixes.
- RPL fixes.
- ZoAP fixes.

----------------------------------------------------------------
Andrei Emeltchenko (1):
      net: security: Use sys_put_be32() relevantly

Bogdan Davidoaia (5):
      ext: mcux: import XCVR driver for KW41Z
      ext: mcux: add OSAbstraction layer for Zephyr
      ext: mcux: add Makefiles for building the XCVR driver
      net: ieee802154: add native IEEE 802.15.4 driver for KW41Z
      samples: net: ieee802154: add KW41Z config file

Jukka Rissanen (6):
      net: tcp: Fix TCP trace value debug
      net: rpl: Do not crash if DIO message contains garbage
      drivers/eth/mcux: Fix the fragment ordering in RX
      samples/dns: Add config file for Arduino-101 and FRDM-K64F
      dns: Remove unused fields from dns_addrinfo struct
      doc: net: Fix IP stack architecture data flow pictures

Luiz Augusto von Dentz (1):
      net: bt: Fix leaking TX packets

Marti Bolivar (1):
      net/mqtt: fix race condition in mqtt_init()

Michael Scott (4):
      net/mqtt: combine mqtt_parser for PUBLISHER and SUBSCRIBER
      net/mqtt: use rlen to calculate # of QoS items in SUBACK packet
      net/mqtt: cleanup TX function unref handling
      net/mqtt: return error codes from net_context_send

Paul Sokolovsky (4):
      net: net_pkt_append: Refactor to return length of data actually added
      net: Switch to common values for SOCK_STREAM, SOCK_DGRAM
      samples: net: dns_resolve: Clarify that DNS queries aren't immediate
      net: shell: Make shell commands non-static to allow reuse.

Piotr Mienkowski (4):
      drivers: eth_sam_gmac: clean up after net_nbuf to net_pkt change
      drivers: eth_sam_gmac: support reading MAC from I2C EEPROM
      boards: sam_e70_xplained: read MAC from I2C EEPROM by default
      samples: net: remove redundant Kconfig options for sam_e70_xplained

Ravi kumar Veeramally (9):
      net: zoap: Add timeout while requesting packets
      net: zoap: Remove magic number
      net: zoap: Minor comment style fixes
      net: zoap: Remove unused struct definition
      net: zoap: Add block wise support for well-known response
      net: ipv6: Use correct API to remove router
      net: rpl: Fix router when it's timer expires
      net: rpl: Fix invalid usage of router addition api
      net: samples: Use correct API to get net pkt length

Ruslan Mstoi (1):
      drivers: slip: escape SLIP special characters in headers too

june li (1):
      net: l2: Clear arp cache when disable interface.

 boards/arm/sam_e70_xplained/Kconfig.defconfig      |   42 +
 .../networking/ip-stack-architecture.rst           |    5 +-
 doc/subsystems/networking/ip-stack-data-flow.dia   |  Bin 3735 -> 3184 bytes
 doc/subsystems/networking/ip-stack-data-flow.png   |  Bin 47931 -> 39217 bytes
 doc/subsystems/networking/ip-stack-data-flow.svg   |  117 +-
 drivers/console/telnet_console.c                   |    4 +-
 drivers/ethernet/Kconfig.sam_gmac                  |   63 +-
 drivers/ethernet/eth_mcux.c                        |   11 +-
 drivers/ethernet/eth_sam_gmac.c                    |   66 +-
 drivers/ethernet/eth_sam_gmac_priv.h               |    2 +-
 drivers/ieee802154/Kconfig                         |    2 +
 drivers/ieee802154/Kconfig.kw41z                   |   26 +
 drivers/ieee802154/Makefile                        |    1 +
 drivers/ieee802154/ieee802154_kw41z.c              |  604 +++++++
 drivers/slip/slip.c                                |   57 +-
 ext/hal/nxp/mcux/Makefile                          |   10 +
 ext/hal/nxp/mcux/middleware/Makefile               |    7 +
 ext/hal/nxp/mcux/middleware/wireless/Makefile      |    7 +
 .../framework_5.3.2/Common/EmbeddedTypes.h         |  214 +++
 .../middleware/wireless/framework_5.3.2/Makefile   |   23 +
 .../OSAbstraction/Interface/fsl_os_abstraction.h   |  598 +++++++
 .../Interface/fsl_os_abstraction_config.h          |   63 +
 .../Source/fsl_os_abstraction_zephyr.c             |   29 +
 .../XCVR/MKW41Z4/XCVR_Test/xcvr_test_fsk.c         |  210 +++
 .../XCVR/MKW41Z4/XCVR_Test/xcvr_test_fsk.h         |  149 ++
 .../framework_5.3.2/XCVR/MKW41Z4/dbg_ram_capture.c |  149 ++
 .../framework_5.3.2/XCVR/MKW41Z4/dbg_ram_capture.h |  109 ++
 .../framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr.c        | 1642 ++++++++++++++++++++
 .../framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr.h        |  981 ++++++++++++
 .../XCVR/MKW41Z4/fsl_xcvr_ant_config.c             |  200 +++
 .../XCVR/MKW41Z4/fsl_xcvr_ble_config.c             |  197 +++
 .../XCVR/MKW41Z4/fsl_xcvr_common_config.c          |  586 +++++++
 .../MKW41Z4/fsl_xcvr_gfsk_bt_0p3_h_0p5_config.c    |  353 +++++
 .../MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_0p32_config.c   |  340 ++++
 .../MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_0p5_config.c    |  357 +++++
 .../MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_0p7_config.c    |  341 ++++
 .../MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_1p0_config.c    |  343 ++++
 .../MKW41Z4/fsl_xcvr_gfsk_bt_0p7_h_0p5_config.c    |  353 +++++
 .../XCVR/MKW41Z4/fsl_xcvr_mode_datarate_config.c   |  206 +++
 .../XCVR/MKW41Z4/fsl_xcvr_msk_config.c             |  345 ++++
 .../framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_trim.c   |  494 ++++++
 .../framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_trim.h   |  134 ++
 .../XCVR/MKW41Z4/fsl_xcvr_zgbe_config.c            |  244 +++
 .../framework_5.3.2/XCVR/MKW41Z4/ifr_radio.c       |  349 +++++
 .../framework_5.3.2/XCVR/MKW41Z4/ifr_radio.h       |  185 +++
 include/net/arp.h                                  |    2 +
 include/net/dns_resolve.h                          |    7 +-
 include/net/net_ip.h                               |    4 +-
 include/net/net_pkt.h                              |   48 +-
 samples/net/coaps_client/src/udp.c                 |    4 +-
 samples/net/coaps_server/src/udp.c                 |    4 +-
 samples/net/dns_resolve/prj_arduino_101.conf       |   58 +
 samples/net/dns_resolve/prj_frdm_k64f.conf         |   46 +
 samples/net/dns_resolve/src/main.c                 |    5 +-
 samples/net/echo_client/prj_sam_e70_xplained.conf  |    7 -
 samples/net/echo_client/src/echo-client.c          |    2 +-
 samples/net/echo_server/prj_sam_e70_xplained.conf  |    6 -
 samples/net/http_client/src/http_client_rcv.c      |    2 +-
 samples/net/http_server/src/ssl_utils.c            |    8 +-
 samples/net/ieee802154/hw/prj_kw41z.conf           |   50 +
 samples/net/irc_bot/src/irc-bot.c                  |    2 +-
 samples/net/mbedtls_dtlsclient/src/udp.c           |    2 +-
 samples/net/mbedtls_dtlsserver/src/udp.c           |    2 +-
 samples/net/mbedtls_sslclient/src/tcp.c            |    8 +-
 samples/net/nats/src/nats.c                        |    3 +-
 samples/net/zperf/src/zperf_tcp_uploader.c         |    2 +-
 samples/net/zperf/src/zperf_udp_uploader.c         |    4 +-
 subsys/net/ip/dhcpv4.c                             |    6 +-
 subsys/net/ip/ipv6.c                               |   12 +-
 subsys/net/ip/l2/arp.c                             |   15 +-
 subsys/net/ip/l2/bluetooth.c                       |    9 +-
 subsys/net/ip/l2/ethernet.c                        |   14 +-
 subsys/net/ip/l2/ieee802154/ieee802154_security.c  |    5 +-
 subsys/net/ip/net_pkt.c                            |   17 +-
 subsys/net/ip/net_shell.c                          |   50 +-
 subsys/net/ip/net_shell.h                          |   13 +
 subsys/net/ip/rpl.c                                |   40 +-
 subsys/net/ip/tcp.c                                |    6 +-
 subsys/net/lib/dns/resolve.c                       |    2 +-
 subsys/net/lib/http/http_client.c                  |   18 +-
 subsys/net/lib/http/http_server.c                  |    9 +-
 subsys/net/lib/mqtt/mqtt.c                         |  152 +-
 subsys/net/lib/mqtt/mqtt_pkt.c                     |    2 +-
 subsys/net/lib/zoap/Kconfig                        |   21 +
 subsys/net/lib/zoap/zoap.c                         |    6 -
 subsys/net/lib/zoap/zoap_link_format.c             |  551 +++++--
 tests/net/iface/src/main.c                         |    2 +-
 tests/net/mld/src/main.c                           |    2 +-
 tests/net/net_pkt/src/main.c                       |   12 +-
 89 files changed, 10939 insertions(+), 519 deletions(-)
 create mode 100644 drivers/ieee802154/Kconfig.kw41z
 create mode 100644 drivers/ieee802154/ieee802154_kw41z.c
 create mode 100644 ext/hal/nxp/mcux/middleware/Makefile
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/Makefile
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/Common/EmbeddedTypes.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/Makefile
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/OSAbstraction/Interface/fsl_os_abstraction.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/OSAbstraction/Interface/fsl_os_abstraction_config.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/OSAbstraction/Source/fsl_os_abstraction_zephyr.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/XCVR_Test/xcvr_test_fsk.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/XCVR_Test/xcvr_test_fsk.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/dbg_ram_capture.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/dbg_ram_capture.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_ant_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_ble_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_common_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_gfsk_bt_0p3_h_0p5_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_0p32_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_0p5_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_0p7_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_gfsk_bt_0p5_h_1p0_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_gfsk_bt_0p7_h_0p5_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_mode_datarate_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_msk_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_trim.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_trim.h
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/fsl_xcvr_zgbe_config.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/ifr_radio.c
 create mode 100644 ext/hal/nxp/mcux/middleware/wireless/framework_5.3.2/XCVR/MKW41Z4/ifr_radio.h
 create mode 100644 samples/net/dns_resolve/prj_arduino_101.conf
 create mode 100644 samples/net/dns_resolve/prj_frdm_k64f.conf
 create mode 100644 samples/net/ieee802154/hw/prj_kw41z.conf

Change-Id: If3c227f05aaf77643a1de0a3a925b7919296f6d1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:03:56 +03:00
Jukka Rissanen f65c06eea5 doc: net: Fix IP stack architecture data flow pictures
The TX side of network data flow was changed so update the
network architecture documentation.

Change-Id: I88680a776dfe87a8dac868cba1b536f2c926c0cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:12 +03:00
Michael Scott 438492843c net/mqtt: return error codes from net_context_send
Instead of returning EIO let's bubble the error from net_context_send
back up to the caller in the following functions:
mqtt_tx_connect()
mqtt_tx_disconnect()
mqtt_tx_pub_msgs()
mqtt_tx_publish()
mqtt_tx_pingreq()
mqtt_tx_subscribe()
mqtt_tx_unsubscribe()

Change-Id: I9bb4396b227b8902ac1195a97bc37eb1959b643e
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28 15:01:12 +03:00
Michael Scott 7bce4af81f net/mqtt: cleanup TX function unref handling
With CONFIG_NET_DEBUG_NET_PKT enabled, the log messages are full of
errors regarding NULL parameters passed into net_pkt_unref in almost
every TX function for handling MQTT messages:
mqtt_tx_connect()
mqtt_tx_disconnect()
mqtt_tx_pub_msgs()
mqtt_tx_publish()
mqtt_tx_pingreq()
mqtt_tx_subscribe()
mqtt_tx_unsubscribe()
mqtt_parser()

Let's clean up the unref handling so that our debug log isn't quite
so full of error spam (as opposed to the normal amount of spam from
the net buf log).

Change-Id: Ib49d1192f51abe4329e6dc9da3c51a4a36290082
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28 15:01:12 +03:00
Michael Scott fa5503fb44 net/mqtt: use rlen to calculate # of QoS items in SUBACK packet
The data->len of an inbound netbuf can be larger than a single
MQTT packet.  For instance when a PINGRESP is also included
in the same netbuf.  For this reason we should not be using
the data->len to determine how large the rest of the MQTT data is.

Specific Example: we've seen in testing that PINGRESP packets
can be included with a SUBACK packet in the same netbuf. Under
this case the current code uses the data->len incorrectly and
tries to find 3 QoS elements for the SUBACK packet when there
is only 1 (the rest of the data is for PINGRESP).

NOTE: A larger patch to iterate through the netbuf data parsing
individual MQTT packets will be needed to fix the MQTT subsys.
This patch only corrects the SUBACK parsing.

Change-Id: I7f6cebaaed9570b778d466de84331cf8c5060755
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28 15:01:12 +03:00
Michael Scott e5f1112b07 net/mqtt: combine mqtt_parser for PUBLISHER and SUBSCRIBER
Currently, app type MQTT_APP_PUBLISHER_SUBSCRIBER is not supported.
mqtt_init() will return EINVAL because the context rcv function is
either mqtt_publisher_parser or mqtt_subscriber_parser (not both).

Let's combine these functions into mqtt_parser and remove the app
type check from mqtt_init().

Change-Id: I60460e011395864706e293c997e9f8a65681b368
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28 15:01:12 +03:00
Marti Bolivar 5fab97c9d0 net/mqtt: fix race condition in mqtt_init()
We need to set the mqtt context recv function prior to calling
net_context_recv which installs the mqtt_recv callback.
If not, we risk a race condition where an unprotected reference
to mqtt->rcv(mqtt, buf) is made in mqtt_recv().

Change-Id: If90ee58f4ea6f7879ef7c12b969ba27647426acc
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-28 15:01:12 +03:00
Paul Sokolovsky ff3b019054 net: shell: Make shell commands non-static to allow reuse.
Some applications may want to reuse implementations of these
commands for debugging/diagnostics purpose even if they don't
use net shell per se, or implement an alternative shell.

Jira: ZEP-2064

Change-Id: I48cb66ccc41bd41a75a4eb8eb3c366316ec5a096
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:12 +03:00
Paul Sokolovsky ddf23f3167 samples: net: dns_resolve: Clarify that DNS queries aren't immediate
The sample in its default configuration waits for DNS server
configuration via IPv4 or IPv6 specific means. Until this
information is receives, DNS querying won't even start. Make
diagnostic messages explicit of this fact, because if user
doesn't have required services available in the network, the
sample will appear to just hang.

Jira: ZEP-2061

Change-Id: I56a5b7354a2d1239a35d8334ed95a15ebd19254f
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:12 +03:00
Ravi kumar Veeramally e4d8900cc6 net: samples: Use correct API to get net pkt length
net_pkt_get_len() is the correct API to get network packet
length.

Jira: ZEP-2076

Change-Id: Ifff6f3d5df28b3684cc8bb3758f9e8bccd5d4534
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally ead481a041 net: rpl: Fix invalid usage of router addition api
net_if_ipv6_router_add() will return router pointer on success.
This information must be cached in RPL instance, otherwise RPL
instance doesn't know about default route.

Change-Id: Ic6d80ebfa95c9a64df9adf2621ae2631d9bdb990
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally 5edf55f771 net: rpl: Fix router when it's timer expires
When router or default router timer expired, interface will remove
router from the list. In this case RPL does not know about this.
When RPL node receives DIO messages it only verifies whether parent
exists or not. This extra checks will verify whether router really
in "used" state or not.

Jira: ZEP-2080

Change-Id: I4b36b3a2d495e76a38caddd058451daff08fab0c
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally d9bde9a5ab net: ipv6: Use correct API to remove router
net_if_ipv6_router_rm() is the correct API to remove IPv6 router
from the interface as it also cancels the timer and raises a mgmt
event. The net_if_router_rm() only sets router as unused and
nothing else.

Change-Id: I55114288c9ae748520b67b206edcd4f5e420b1af
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally d787ccb40a net: zoap: Add block wise support for well-known response
If the ./well-known/core response is bigger than L2 MTU then
response will be sent in multiple fragments. In mesh kind of networks
getting response from farthest node might loose packets. So better to
send response in a block wise fashion. Block size is configurable.

Change-Id: Id421c66597fe448c12a7215f04f63f4a284c14ab
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally 0cdfd75c7f net: zoap: Remove unused struct definition
Change-Id: I1b57972386b0def02eb125b6ae4825f11268f6ce
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally 9d0a484690 net: zoap: Minor comment style fixes
Change-Id: I8f63781a39263e110aec2e6f1e14d72650ce4e30
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally 6740e691e8 net: zoap: Remove magic number
Value 0xFF represents End Of Options marker in CoAP message.
Use #define than magic numbers in code.

Change-Id: I3bef21ea827987f7c2e670447ee20574cb6288ae
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:11 +03:00
Ravi kumar Veeramally 38503f8c76 net: zoap: Add timeout while requesting packets
Add timeout for packet and buffer requests. If there are no
buffers available gracefully drop the request.

Change-Id: I56fe2b606556149c83751aadc1c5eee7828a84a8
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28 15:01:10 +03:00
Luiz Augusto von Dentz 86a72e1ed4 net: bt: Fix leaking TX packets
Bluetooth only cares about the actual payload so net_pkt can be unref
as soon as the data fragments are detached.

Jira: ZEP-2070
Change-Id: Id528d5440f42903378883f5e696b3f663bbfa313
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-28 15:01:10 +03:00
Bogdan Davidoaia efc3ba6b98 samples: net: ieee802154: add KW41Z config file
Add config file to be used for testing KW41Z's IEEE 802.15.4 driver.

Jira: ZEP-2026
Change-Id: I7042c57ad33ff72b35d24fbf28085b99b2301726
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00
Bogdan Davidoaia 90e0665190 net: ieee802154: add native IEEE 802.15.4 driver for KW41Z
The driver uses KW41Z's IEEE 802.15.4 hardware registers (ZLL).

Origin: Original

Jira: ZEP-2026
Change-Id: I8eb82a7c16c8ca3e3003f8318f74a3651eb24f68
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00
Bogdan Davidoaia 4dabe7d50e ext: mcux: add Makefiles for building the XCVR driver
Jira: ZEP-2026
Change-Id: Iec6d133309b96b89bcd066e3f9254180ad0f7fb8
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00
Bogdan Davidoaia 7dbfc0121d ext: mcux: add OSAbstraction layer for Zephyr
Implement just the OSA_InterruptEnable and OSA_InterruptDisable functions
as only these two are needed to build the XCVR driver.

Jira: ZEP-2026
Change-Id: I49e0cedd3a2553a59b667a2b9945db6b8d0be0d2
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00
Bogdan Davidoaia 6ff81ab857 ext: mcux: import XCVR driver for KW41Z
Import the XCVR driver from Kinetis SDK, which is needed to setup the radio
on the FRDM-KW41Z board. Also import EmbeddedTypes.h and the OSAbstraction
interface, as they are needed to build the XCVR driver.

Origin: https://www.nxp.com/webapp/sps/download/license.jsp?colCode=KW41Z-CONNECTIVITY-SOFTWARE-LIN
Maintained-by: External

Jira: ZEP-2026
Change-Id: Iee0acb2320f7bec887d8d2342772dde18b11b12f
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-04-28 15:01:10 +03:00
Paul Sokolovsky e813091f0a net: Switch to common values for SOCK_STREAM, SOCK_DGRAM
Many OSes use values SOCK_STREAM = 1, SOCK_DGRAM = 2, apparently
inherited from the original BSD Unix, which introduced Sockets API.
These values are exposed as numbers in many places, e.g. with a
debugger, when printing just as numbers, etc., so use the above
common values to avoid possible confusion.

Jira: ZEP-2066

Change-Id: I0477abc79e2b43ef83f9fb11a66092f2b41f75fa
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:10 +03:00
Jukka Rissanen 1f5d7bae9f dns: Remove unused fields from dns_addrinfo struct
The ai_flags, ai_socktype and ai_protocol fields are removed as there
is currently no use for them. These can be added back later if really
needed.
Reordering the fields at the same time which caused 4 bytes to be saved
in storage space.

Jira: ZEP-2065

Change-Id: Ida1dcfb6afed73733d3db9cf4d07e771d31ee314
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:10 +03:00
Jukka Rissanen f7d291ea90 samples/dns: Add config file for Arduino-101 and FRDM-K64F
The dns_resolve sample application did not had project file for
two boards that the README file is talking about, so adding them here.

Jira: ZEP-2040

Change-Id: I68e825854a171b09d56df91ab80ce5d9349733f6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:09 +03:00
Jukka Rissanen 7b3148e780 drivers/eth/mcux: Fix the fragment ordering in RX
The data fragments were stored in reversed order when the RX
data was saved into network buffers. This was caused by net_pkt
changes in commit "net/net_pkt: Fully separate struct net_pkt
from struct net_buf".

Change-Id: I8ad2cfc23b2cb90896b0548eab168895b0d7421d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:09 +03:00
Paul Sokolovsky 25307d5331 net: net_pkt_append: Refactor to return length of data actually added
For stream-based protocols (TCP), adding less data than requested
("short write") is generally not a problem - the rest of data can
be sent in the next packet. So, make net_pkt_append() return length
of written data instead of just bool flag, which makes it closer
to the behavior of POSIX send()/write() calls.

There're many users of older net_pkt_append() in the codebase
however, so net_pkt_append_all() convenience function is added which
keeps returning a boolean flag. All current users were converted to
this function, except for two:

samples/net/http_server/src/ssl_utils.c
samples/net/mbedtls_sslclient/src/tcp.c

Both are related to TLS and implement mbedTLS "tx callback", which
follows POSIX short-write semantics. Both cases also had a code to
workaround previous boolean-only behavior of net_pkt_append() - after
calling it, they measured length of the actual data added (but only
in case of successful return of net_pkt_append(), so that didn't
really help). So, these 2 cases are already improved.

Jira: ZEP-1984

Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:09 +03:00
Jukka Rissanen 3051fc2035 net: rpl: Do not crash if DIO message contains garbage
Instead of just plain assert, check that the packet we receive
is ok before passing it to processing function.

Jira: ZEP-2057

Change-Id: I5754c82d16e1522d8fcee561eea280eadeec31ee
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:09 +03:00
Jukka Rissanen 52d0589c1f net: tcp: Fix TCP trace value debug
The TCP trace values were not printed because of incorrect
config option used. Print also seq and ack values in decimal
in order to make it easier to correlate the values in other
prints in tcp.c.

Change-Id: I44d1535a84dcba8c6c937d348516ba801193ca23
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28 15:01:09 +03:00
Andrei Emeltchenko 65c002b8ce net: security: Use sys_put_be32() relevantly
Use ready-made utility function which can take care of endianness

Change-Id: I1edd0b2ce1a086dd637e97308145f9b434e48a1f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-04-28 15:01:09 +03:00
Piotr Mienkowski f9a85815c2 samples: net: remove redundant Kconfig options for sam_e70_xplained
- Manual MAC address settings
- Default ETH driver initialization priority

Change-Id: I6294e2f66623087dfdc131344a94d0e9f2edc6b4
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-28 15:01:09 +03:00
Piotr Mienkowski 8d779ec8cb boards: sam_e70_xplained: read MAC from I2C EEPROM by default
Change-Id: Ic7619c8c02f2b82cc662d2a492149d3720b3e34b
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-28 15:01:09 +03:00
Piotr Mienkowski 65d5e8b2ad drivers: eth_sam_gmac: support reading MAC from I2C EEPROM
This patch adds support for reading MAC address from I2C EEPROM.
Only chips with 7-bit I2C device address are supported.

Change-Id: Ibedc33e54e33bdb901840e104063e2f4752b9123
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-28 15:01:08 +03:00
Piotr Mienkowski b996517b5e drivers: eth_sam_gmac: clean up after net_nbuf to net_pkt change
Change-Id: If3aa621b2cc98df4e379dddec6307cbdfb1ed355
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-28 15:01:08 +03:00
Ruslan Mstoi dfffe4b963 drivers: slip: escape SLIP special characters in headers too
Otherwise they are send as is and stripped by tunslip6, resulting in
malformed packets.

Jira: ZEP-2037

Change-Id: I1267b9ac956f3cd7aa3456ce20447ef97281d7a8
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2017-04-28 15:01:08 +03:00