Commit graph

19237 commits

Author SHA1 Message Date
Jukka Rissanen
b20279dbfd net: rpl: Increase the RX stack usage
RPL requires 300 bytes more stack in RX path.

Change-Id: I7ebe5ec6470f6766997f8b5eb199fc55b059513a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Jukka Rissanen
888e6b997d net: Move stack related Kconfig options to Kconfig.stack
This way we see all the stack related Kconfig options in
one place.

Change-Id: I01dd566525823c96ee8c000435e27619fc8699c4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Jukka Rissanen
720be1a3b8 net: shell: Add command to print stack usage info
The "net stacks" command will print information about
stack usage in the networking sub-system.

Change-Id: I568445e99158972b13dc10a1bb720ba9650b7ab4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Jukka Rissanen
8e84e36f14 net: Declare a macro to define stacks used by networking
The macro defines the stack as usual, but if user has
enabled net shell (CONFIG_NET_SHELL), then additional
information about the stack is stored in net_shell
linker section. The information in the net_shell linker
section is then used to print information about the
stacks in the networking sub-system.

Change-Id: Ic6e9f16a73a192b9a59d32a6d0070322382f98bd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Jukka Rissanen
0f8be63d8e ethernet: ksdk: Use unified kernel API
Dropping legacy API.

Change-Id: Id3d0b3e4ac7834e78a4d70ee5c99c6998958921e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:14 +02:00
Mahavir Jain
eefd912fed samples: net: Use unified kernel interface for sem/queue declaration
Change-Id: I2519a7a35f83d2542f333ca6791a6f22944a42c4
Signed-off-by: Mahavir Jain <mjain@marvell.com>
2016-12-02 12:41:14 +02:00
Vinicius Costa Gomes
8a11cf696d samples/leds-demo: Listen on the ANY address
If we want to receive packets to multiple addresses, the solution is to
listen on the ANY address, and add the address to the interface in
question (already done).

Change-Id: I383cc1401f1236ee05bdb010252a9f9909aa15bd
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:14 +02:00
Vinicius Costa Gomes
9cd6bd9961 samples/leds-demo: Fix not using the LED correctly
Before using the LED we must set the direction of the GPIO pin to
output, and the LED will turn on when that GPIO pin is 'low'. So, for
our purposes, the LED is active low.

Change-Id: If8e6ce05ff2f3ddb7b17a87b172a91f7276194a4
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:13 +02:00
Vinicius Costa Gomes
4723d29e32 samples/leds-demo: Fix missing include file
'board.h' includes the definition of LED0_GPIO_PORT and LED0_GPIO_PIN,
without this include the fallback was used, as if the board in question
didn't have any LEDs.

Change-Id: I78ebdb2e2ffc41dff5011dcf9e33e09d70950e81
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:13 +02:00
Vinicius Costa Gomes
e27c7c02b2 samples/leds_demo: Add config for using 802.15.4
This adds a configuration profile allowing this example to run on a
Quark SE C1000 devboard.

Change-Id: Ic04fd30a91ed0a1fc8c3a3b3a6e397f0722f50b1
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:13 +02:00
Jukka Rissanen
7502824598 net: Use alignment macros when copying IP address
The original version can fail in ARM like this

***** USAGE FAULT *****
  Executing thread ID (thread): 0x200027a8
  Faulting instruction address:  0x00008080
  Unaligned memory access
Fatal fault in thread 0x200027a8! Aborting.

so use UNALIGNED_PUT() and UNALIGNED_GET() instead.

This failure was seen when IPv6 address was
copied to neighbor cache in ipv6.c:nbr_new().

Change-Id: I638424b9a95c451e13314ca9182c39ab8aa71830
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:13 +02:00
Jukka Rissanen
40b91b05c4 net: Fix unknown func call when getting stack vars
If CONFIG_INIT_STACKS is not enabled but CONFIG_NET_SHELL is,
then net_analyze_stack_get_values() was not properly compiled
out which caused unknown function call.

Change-Id: I18de5ec0b5d6ab7876e801c83b82c9dd5bf22093
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:13 +02:00
Luiz Augusto von Dentz
1997b24e88 net: bt: Remove comments about nbuf extra references
This no longer apply as there is no longer a extra reference needed.

Change-Id: I84f50da7e15f31722cd99b906f9dd987a10ce2dd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:41:13 +02:00
Luiz Augusto von Dentz
d1588dccee net: bt: Print data length for both recv and send
Change-Id: Ibe5c0a17addaa0f7a839691f8eac6128fe95335f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:41:13 +02:00
Mahavir Jain
fa43abc100 net: shell: Fix warning in case CONFIG_NET_IPv6 is not enabled
Change-Id: Ie10aa043c222871c9f9ec8f6f311949b39f7c904
Signed-off-by: Mahavir Jain <mjain@marvell.com>
2016-12-02 12:41:13 +02:00
Leandro Pereira
d45a5330ee net: tcp: Validate state transitions for debugging purposes
If NET_DEBUG is enabled within tcp.c, all state transitions are checked
against the TCP state machine specification.  If an invalid state
transition is found, a debugging message is printed.

Change-Id: I8fe521a74da6c57e8aeee32e99b25c3d350fd4b0
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:13 +02:00
Leandro Pereira
db3bee8bdd net: tcp: No need to #if defined(TCP) inside TCP callback
The whole function is only built if TCP is also built.

Change-Id: I0ed71273fa8db52b3e4c18d4b7b1766593f15f5a
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:13 +02:00
Leandro Pereira
7c0e3f9580 net: tcp: Send a FIN|ACK when transitioning from ESTABLISHED->LAST_ACK
This sends FIN|ACK in one single segment instead of two while closing
a connection.

Change-Id: I80ff3da74deab2caffb69777438a0d13f75b4b32
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:13 +02:00
Leandro Pereira
99e4aa5dd4 net: Fix compile warnings when building with UDP disabled
The sanity checker should check for these as well eventually.

Change-Id: Ia22c8d0e000ee315ee2f582caa5a6b0c721e8b5f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:13 +02:00
Tomasz Bursztyka
d02a9692ff wpan_serial: Minimize debug output by default and set proper nbuf size
Nbuf data size needs to be set to 128 bytes, specifically for wpan
sample.

Debug output kills timing, and thus can generate spurious failures on
reception, so limiting it to errors by default.

Change-Id: Ia0b8c904e0bc66a7922af4f317db623db6c51462
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:13 +02:00
Tomasz Bursztyka
1a22f76364 drivers: ieee802154: Fix cc2520 raw mode
Hack in commit-id 835f93b8250abc0f3edbee9a99463fccac03597c was breaking
raw mode needed for wpan* adaptations.

Change-Id: If1ff96fa8170cc84e356fb0452e487f0ff174da5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:13 +02:00
Mahavir Jain
847432e7dd sample: dhcpv4_client: use unified kernel APIs
Remove legacy kernel APIs and use unified interface

Change-Id: I5ef9a31635aa4862640272353003c0c337509a97
Signed-off-by: Mahavir Jain <mjain@marvell.com>
2016-12-02 12:41:12 +02:00
Andy Ross
65e85f39a3 net: Wire up TCP receive callbacks
packet_received() does most of our work here already.  The appdata
needs to be filled in correctly for TCP packets, which needed the
header size computation to be abstracted out of the ACK code.

Change-Id: Ifeb87c8ddcaa6f4b116214a3b3fb737ab03286f1
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Andy Ross
9211918c56 net: Refactor net_context_recv() to separate UDP and sync handling
More protocols are incoming.  Put the UDP specific stuff (address
wrangling and connection creation) in a separate function, leaving the
synchronous handling in place for other protocols to use.

No behavior changes.

Change-Id: I67fd9f683314ca9b2e671b84c46b9392db9496b2
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Leandro Pereira
120468a858 net: udp: Remove protocol check in (private) net_udp_append()
I believe the original intention was to have code similar to:

	buf = net_ipv6_create(...)
	buf = net_udp_append(...)
	buf = net_tcp_append(...)
	buf = net_ipv6_finalize(...)

However, each protocol has different ways of creating packets and
checking invariants.  Thus, the code now does something similar to:

	if (proto == UDP) {
		// original UDP code
	} else if (proto == TCP) {
		// TCP code, which creates the IP header as well
	} else {
		// unknown protocol
	}

Which negates the need of such check in net_udp_append().

Change-Id: I7f05b7d556462b0db35aaecdf060539f8c246e8c
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Leandro Pereira
c4937e85ed net: tcp: Disallow sending messages to unconnected contexts
The call would eventually return -EDESTADDRREQ, however -ENOTCONN is
the sane error value in this case.

Change-Id: I6c24bf9bf2ecc4bff6a615567547390e6f5b7d77
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Leandro Pereira
2543b2f6ee samples: net: Finish TCP support in echo server
This adds the required code to echo server so that it works with TCP as
well.

Change-Id: Ib45dd91a52a60ddb4d8f0ae11175ceb52199c398
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Leandro Pereira
6a8dcce179 net: tcp: Allow sending packets using send() and sendto()
Adds support to send TCP packets using net_context_send() and
net_context_sendto() functions.

There's one behavior change: net_udp_append() will only append UDP
headers+payload if the context protocol matches.  This would allow
sending only IP packets from Zephyr.  Proper support for raw packets
should be added later if required, so the new behavior is to return
-EPROTONOSUPPORT if trying to send a packet through an
-unknown/unsupported protocol.

Note that sending packets outbound from Zephyr is still WIP; this is
just a step in the general direction of making it work.

Change-Id: Idcf26ad3820e85f1495e7029aed94f3b7abf25ed
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Leandro Pereira
287111d236 net: Implement net_context_send() in function of net_context_sendto()
Both functions perform the same logic, except that the sendto() variant
expects two more parameters to specify the destination address.

Just obtain that from the context in the send() case and forward the
information to the sendto() variant.

Reduces code slightly, while also making it easier to add more
protocols later.

Change-Id: I48da621d8788d5ba2cddaf2982324d3e896c13c3
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:12 +02:00
Vinicius Costa Gomes
b3dc2f8ecd samples/zoap_server: Using unified kernel API
Dropping legacy API.

Change-Id: If01eb40b7dfd9fac322ab8c001b7ebe37c0fed43
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:12 +02:00
Vinicius Costa Gomes
19087b8eca samples/zoap_client: Using unified kernel API
Dropping legacy API.

Change-Id: I8df78bc33550467b8558f8e58a6c390ce84f3b12
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:12 +02:00
Vinicius Costa Gomes
b1749afbc2 iot/zoap: Increase the range of timeouts
To avoid the risk of overflowing when dealing with retransmission
timeouts, increase the size of their representation to 32-bits.

Change-Id: I7c9c1e00c41f5ba75e19b0fd4527f273852eb85f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:12 +02:00
Vinicius Costa Gomes
f1822a0252 net: Fix compilation when DEBUG is enabled
When debugging is enabled, compilation fails with an error, similar to
this:

... net/yaip/net_mgmt.c:155:35:
error: 'struct k_sem' has no member named 'sem'
     k_sem_count_get(&network_event.sem));
                                   ^

As 'network_event' is a k_sem, there is no '.sem' field.

Change-Id: I09fb46ec02b62c30b9a12972abcaea8a36b84610
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:12 +02:00
Andrei Emeltchenko
b0aee95eda wpanusb: Log INF about upper layer start/stop
Change-Id: Ibb841afb94150ccc73b5e80a41a2ca9c949a25c8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:12 +02:00
Andrei Emeltchenko
88b41debd8 drivers: ieee802154: cc2520: Log errors when starting/stopping cc2520
Change-Id: I55efbfcd91da48b98654a5d1dfcbf02b2d76cf75
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:12 +02:00
Andrei Emeltchenko
75844e7847 drivers: ieee802154: cc2520: Flush RX fifo earlier when stopping
flush_rxfifo() leaves fifop interrupts enabled.

Change-Id: I76d5e270982e2cd8f958417f310c1d3547bc061d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:11 +02:00
Andrei Emeltchenko
17b6c45e79 wpanusb: Include shell to the sample
Including shell allows to execute some kernel commands and make sure
system is not crashed.

Change-Id: I6157229614655dc7e523f1cf0f84ee7c58d7a717
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:11 +02:00
Ravi kumar Veeramally
72c71e8310 net: ieee802154: Add offset based reassembly feature
Current reassembly of 802.15.4 packets works only if fragments are
in correct order. But as per RFC 6282 reassembly should be based on
offset parameter in fragmentation header.

Change-Id: Icdcb10b9aa8f5837063b0201a64f8eb050c75681
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka
640ba28793 samples: net: No need of full debug output on cc2520 in echo client
Change-Id: I6ffe5e5c9e8f4baa55386c2f5f430c2765e6f6ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka
3ac3fb1f1e net: ieee802154: Add debug output to 6lo fragmentation
Change-Id: I429398b31a4ebf55658376bdc294faae5774edbf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka
1e39eabcb7 drivers: ieee802154: Set a fake MTU of 125 instead of real 127
This is a hack, related to:
commit-id 835f93b8250abc0f3edbee9a99463fccac03597c

Change-Id: I7e305cef9ca908e2a71a011920663e1603ad8d6e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka
aa556f828e net: ieee802154: Fix wrong ifdef statement
Fragments reassembly was never used in l2.

Change-Id: Ia06ccbcd591ff79c43915e81c0b273533c607aa6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka
3312663011 net: Raise TX stack size to 1200 bytes by default
Current value is not enough anymore it seems. (depends however, if some
debug output is enabled or not).

Would be much better if the build system could automatically compute
such size.

Change-Id: I9052616a7923e484664e4f5c7760e6a6e1152c63
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen
f4be98b4bb tests: net: Change the tag of network tests to net
There were different tags defined in testcase.ini files for
networking tests. Unify these and change the tag to "net"
in all networking tests. This makes it easy to execute
all network tests via sanitycheck.

Change-Id: I8ce7ccf8cccca35234602e37f6568db0b986d181
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen
28255628f8 net: rpl: Add RPL option to IPv6 HBHO extension header
See RFC 6553 for details.

Change-Id: I2448f6fa03819e797c4825238ff3e125d2f92bbf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen
314068d924 net: Avoid compiler warning when compiled for Arduino 101 ARC
There is something wrong with Arduino 101 ARC compiler.

Sanitycheck runs ethernet tests for this board basically using
this command:

cd tests/drivers/build_all
make pristine && make CONF_FILE=ethernet.conf BOARD=arduino_101_sss

Which then gives following warning

warning: missing braces around initializer [-Wmissing-braces]

which is then converted to error in sanitycheck.

Change-Id: I822c599cb172825a79b5b8e4a71cb9252757a435
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen
d048b5c9d1 tests: buf: Do not depend on IP stack
The net_buf tests were including net_ip.h which requires some
extra config options to be usable when the new native IP stack
is used. In order to avoid this dependency, define struct in6_addr
locally in the source file.

Change-Id: Iafe0d2b5b507665baaed23f5e2c55a9d9a300d47
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka
7a11439020 net: ieee802154: Fix current stack to completely drop CRC handling
The 802.15.4 frame has a header and in the end after the payload a CRC.
Overall MTU is 127 bytes, but CRC is most likely going to be generated
by the device itself (offloading). Because the limitation of current
nbuf, it's not possible to keep this CRC in the buffer because it
require a user data size of 127 bytes but if we do so, IP stack will
fill in as much as it can as packet data, thus occupying the 2 last
bytes. This generates bugs. A perfect solution would be to generalize a
better handling of MTU and head or tail reserve data into nbuf, but
this will probably be solved in the future.

Change-Id: I1a0fee4d555e2717c1edd5afba399a1f17d9c7a9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:11 +02:00
Andrei Emeltchenko
82ac4f68f7 wpan_serial: Correct file description
Correct leftovers from CDC sample.

Change-Id: I337440a4f9a9016bb0635f49e205c1b6fee56e96
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:10 +02:00
Jukka Rissanen
c4cec90f68 net: shell: Add IPv4 ping support
User is able to send ICMPv4 Echo Request to destination
address.

Change-Id: Ie32d5970e5f3e75e925c283947f97e096e509555
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:10 +02:00