Commit graph

41120 commits

Author SHA1 Message Date
Jukka Rissanen
30b07ad70a net: yaip: Process received ICMPv4 messages
Call ICMPv4 handler when receiving such a network packet.
Currently only echo-request is handled.

Change-Id: Ib59c65b38f13c484f1842485118dad32fb6a6f36
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:57 +00:00
Jukka Rissanen
b8e0b912c8 net: yaip: Process received ICMPv6 messages
Call ICMPv6 handler when receiving such a network packet.

Change-Id: I2ebe612bd4a4615e8cd1c8b323507c6a03f6008d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:57 +00:00
Jukka Rissanen
663ba2b7f0 net: yaip: Add unit tests for ICMPv6 handler
Change-Id: Ibdbe82ed56f110e2e0c6443700863632ee1ef56b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:56 +00:00
Jukka Rissanen
5cd47edca9 net: yaip: Add ICMPv6 handler
The host will be able to respond to ICMPv6 messages.
An echo-request handler is implemented and it will send
echo-reply when needed.

Change-Id: I08f4703bab5cf3e95d3ae722ebc7a386d22fe17e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:56 +00:00
Jukka Rissanen
441a054a07 net: tests: Unit tests for network utilities
Right now there are tests for IP packet checksum calculation.

Change-Id: I1e9e72d01d4690728269c4484f8628350cf95729
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:55 +00:00
Jukka Rissanen
c324d8a4f9 net: yaip: Add debugging option for network utilities
Various network utility routines can debug print after this.
The Kconfig option is called CONFIG_NETWORK_IP_STACK_DEBUG_UTILS

Change-Id: I8384f974bd3c4965a6ef401bff8060389fab51ad
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:55 +00:00
Jukka Rissanen
5834443a36 net: yaip: Add IP packet checksum calculation utilities
Added function that is used when calculating various IP
protocol checksums. The function works with fragmented
net_buf data.

Change-Id: Icaef707ba15ac2729608929e52e235e6e8a154dc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:54 +00:00
Jukka Rissanen
46f085d363 net: yaip: Add net_hexdump() utility to print network data
Only usable if network debugging is activated.

Change-Id: Id7d70d88b5ddca772603e5d2c567b8df23cf084e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:54 +00:00
Jukka Rissanen
4eb4ee49f5 net: yaip: Network interface needs own TX fiber stack
Each network interface needs its own stack for TX fiber.

Change-Id: I9647c2b945a3d36bc77c00dad11badb0d5f851e5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:53 +00:00
Jukka Rissanen
cada55f5be net: yaip: Add net_send_data() that sends data to network
This function is not meant to be used by applications as it
requires that the IP headers etc. are already in place.

Change-Id: I9099671111a029cdf630d131d7af09b147486f64
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:53 +00:00
Jukka Rissanen
de67431a43 net: yaip: Renamed network data receive function
Renamed net_recv() to net_recv_data() so that the more generic
name can be used by applications. The net_recv_data() is only
meant to be used when L2 layer feeds data into L3 (IP) layer.

Change-Id: Iba155d51f81e3b99964fa916fe87a05a8bf8766a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:52 +00:00
Jukka Rissanen
dbdd1e1d2a net: yaip: Network interface sets default IPv6 hop limit
A default hop limit can be configured via Kconfig.

Change-Id: I5cbd130882e043e24488c4501e86fce0f91d48df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:52 +00:00
Jukka Rissanen
6b2a002d06 net: yaip: Move IP address print funcs to separate file
Making all big IP address print functions inline will increase
the code space too much. So moving the big functions to utils.c
and just leaving the stubs to be inline. These functions are
available only when debugging is activated.

Change-Id: Ib76846d282a821e99885ec1801df4302bb0c9b42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:51 +00:00
Jukka Rissanen
cb2191652e net: yaip: Add ICMP protocol header struct
Add a macro to get and cast the ICMP protocol header.

Change-Id: Ief3f69d1b3dbe9dd55bc0a032b3506c8e0370563
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:51 +00:00
Jukka Rissanen
1b2069c61c net: yaip: Fixed the IP/UDP/ICMP getter macros
The nbuf macros for getting the pointer to start of IP, UDP
and ICMP buffer were incorrect.

Change-Id: I6309bd50cdf2cbf0c6c23b4b349c7c084cfe928d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:51 +00:00
Jukka Rissanen
7150b0035c net: yaip: Added API documentation to IP address check functions
Some API functions that check IP addresses were not documented
properly.

Change-Id: I0e7361447db55037888c62ada6b55e3cf5f410f7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:50 +00:00
Jukka Rissanen
fbb940d9f0 net: yaip: Receive IPv4 packet
Check if we have received IPv4 packet and call a handler
function to process it.

Change-Id: I9f9e5f0888d2c3b91401c98f4925647ddce09962
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:50 +00:00
Jukka Rissanen
efd3f9ee63 net: yaip: Network interface code compiles ok for IPv4 and IPv6
Make sure that the net_if.c compiles correctly when IPv6 and IPv4
are activated in config file.

Change-Id: Icaeba2c2ac7003ffaba516afd476991bf150165d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:50 +00:00
Jukka Rissanen
cedd655cdb net: tests: Add more IPv6 address getters unit tests
Change-Id: I0ab22af76073c02c93eb205686472f69b58a1107
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:49 +00:00
Jukka Rissanen
d85fa3fe2d net: yaip: IPv6 address utility funcs for network interface
Added more functions to get proper IPv6 address from
a given network interface.

Change-Id: I5aecdb35eb549a0781949134ab4821dcb8ce9e7b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:49 +00:00
Jukka Rissanen
03294c3f75 net: tests: Add IPv4 address unit tests
These tests will check that caller is able to set IPv4 address
to a network interface and check if an address is one of the
assigned to a network interface.

Change-Id: I8aa748c40fbc02eef50ccf76d10a0057ef29021b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:48 +00:00
Jukka Rissanen
272c8a62a1 net: yaip: Add IPv4 addresses to network interface
Allow user to assign IPv4 addresses to a network interface.

Change-Id: I77be4ed5eb0231eb12b4ad47cb6076c8f4238124
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:48 +00:00
Jukka Rissanen
eb87a36e44 net: tests: Add IPv6 address manipulation unit tests
Change-Id: Ide3bce35dcfd3ec31bfe3cd842a87ca3b639ba4f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:47 +00:00
Jukka Rissanen
208d558f68 net: yaip: Utilities to set and lookup interface IPv6 addresses
The caller is able to add and lookup network interface IPv6
addresses.

Change-Id: I7f43e18bd1fa69c7dcd2f6b46ad33043c28b92e9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:47 +00:00
Jukka Rissanen
a08376cc32 net: yaip: Add utility functions to check IPv6 addresses
IPv6 utility functions that check if a given IPv6 address
belongs to one of host network interfaces, and whether
the address is a given type.

Change-Id: If251534ae0af41963d45e305e7ba505a940d2fdc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:47 +00:00
Jukka Rissanen
644dc3ba81 net: yaip: Add utility func to return IP address type as a string
This is only used in debugging.

Change-Id: Ie8b1d2540813527131ff489e49975a826b84311c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:46 +00:00
Jukka Rissanen
3308e95b97 net: yaip: Add extension header and bitmap fields to nbuf
These are needed when parsing IPv6 packet.

Change-Id: I56ab93d45727c57f2d9db47baeb5b5a3725a0c46
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:46 +00:00
Jukka Rissanen
e54c565337 net: yaip: Drop received source mcast IPv6 packets
If the source address is multicast, then drop the IPv6 packet.

Change-Id: Ibe733161d67f047469a25a5955c41c335e472945
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:45 +00:00
Jukka Rissanen
d9c3552e00 net: yaip: Receive IPv6 packet
Check if we have received IPv6 packet and call a handler
function to process it.

Change-Id: I1226729685ae2a805128b587e2a37e0016d53ecc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:45 +00:00
Jukka Rissanen
cf673cf585 net: tests: Add unit test for IP and MAC address printing
Change-Id: Ida0901fa9687814932119d006459de12e6a229d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:45 +00:00
Jukka Rissanen
044f40b76c net: yaip: Add debug function to print IP address
Change-Id: I4464f1da6d602b1abba0f385e5afa92d2cb4afc8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:44 +00:00
Jukka Rissanen
abda6faa65 net: yaip: Add debug function to print MAC address
Change-Id: I32ca7a4f005d73be7c8d4d28a7a6fbd19c01dd2e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:44 +00:00
Jukka Rissanen
27dcfc3efd net: yaip: Add statistics gathering support
Collect network statistics if CONFIG_NET_STATISTICS is
defined.

Change-Id: Id217daa3e19142c95396dc391ba2dc4123b18b22
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:43 +00:00
Jukka Rissanen
c43212d63c net: yaip: Add net_context to compilation
Network context defines network endpoints a.k.a sockets.

Change-Id: Ib1fab03f0862b298a441a79a4f4173f18a8260cb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:43 +00:00
Jukka Rissanen
5a3834915d net: yaip: Start to receive network packets
Currently all received packets are dropped as this is just
the initial patch enabling the receive support.

Change-Id: Ib06735f498a80edb8c9f7c5ec6f536a5ac1d362a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:42 +00:00
Andrew Boie
50131a3d0e altera_max10: support 'make flash' and 'make debug'
For both of these, we send the .elf binary over the JTAG and it gets
written directly into SRAM. The CPU boots the image from the entry
point (__start).

This does not provision the kernel onto device's User Flash Memory
(UFM). Implementation of this is still in progress see ZEP-273.

Change-Id: Iae8188a21e4a3eecfda0f4f0bb220c0607d719cb
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:57 +00:00
Andrew Boie
4eee43d4d4 nios2-qemu: correct system.h
The emulator supports all the integer math instructions and has
the necessary registers for exception debugging.

Change-Id: I55938d9e3a4b9d219f6fee06fe070e860ca71d4b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:55 +00:00
Andrew Boie
0b6c4febf1 nios2: get CPU features from ALT_CPU_* namespace
NIOS2_* namespace is deprecated.

Change-Id: I5a9b07ee33b20aa18509e9d789837f48199ab25d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:53 +00:00
Andrew Boie
865843fe79 qemu_nios2: remove debug options from defconfig
Change-Id: I91f495b5bf12986e4dc16191405e161b1bbc88ba
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:51 +00:00
Andrew Boie
80826decfc nios2: enable XIP by default
Change-Id: I930cbb61cf72de7c68b9a4289554004b4b2f8e21
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:49 +00:00
Andrew Boie
1b6e493bc1 altera_max10: cleanup defconfig
Remove unused defines and turn off debug options.

Change-Id: I21e6b54a81505783396991e165a8087372d4986b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-12 18:09:46 +00:00
Johan Hedberg
08ff2f67a2 net: Fix Kconfig warning
The double include of Kconfig.debug causes the following warning:

scripts/kconfig/conf --silentoldconfig Kconfig
/home/jh/src/zephyr/net/ip/Kconfig.debug:45:warning: choice value used outside its choice group
/home/jh/src/zephyr/net/ip/Kconfig.debug:47:warning: choice value used outside its choice group
/home/jh/src/zephyr/net/ip/Kconfig.debug:49:warning: choice value used outside its choice group

Change-Id: I3f59587eed656b67e1f69e2a8151288f41b50769
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-12 19:26:42 +03:00
Szymon Janc
832b808177 Bluetooth: ATT: Fix using non-ASCII characters
Some non-ASCII characters were used in code comments.

Change-Id: I77f13ca1648f34dc5dbd9ea78ccd2964a73a1712
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-12 15:13:23 +00:00
Johan Hedberg
ce88b0528f net: buf: Add basic documentation for net_buf struct
Change-Id: I93404bcafb72c174a216d3e441c5434a7302c128
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-12 11:39:23 +00:00
Johan Hedberg
40d83b28e6 net: buf: Fix documentation of fragment related API
Ensure that all parameters and return values are properly documented.

Change-Id: I04b19701355e994ba45cbc98167386c01d0f607b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-12 11:35:49 +00:00
Jukka Rissanen
2d7d86bdde net: tests: Temporarily remove nbuf unit test
Tests have issues right now so these will be activated later.

Change-Id: Ib5549f9ed5600a20b2cfddbddcde8e7f7b297eef
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 11:23:04 +00:00
Jaakko Hannikainen
5c657752da net: Yield before sending packets
Using net_receive with long timeouts breaks net_reply. Sending a lot of
packets in a row without yielding causes failures since the network
stack can't send them. Add yield code for both net_reply and net_send.

Jira: ZEP-469
Jira: ZEP-497

Change-Id: Ic59769462e0575da0898d35745d49647f7e43edd
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-07-12 10:48:55 +00:00
Jaakko Hannikainen
8b6be8d773 net: Update ip_buf_len for TCP packets
When handling TCP packets, ip_buf_len is set 4 bytes too big.
Recalculate the value when handling it.

Change-Id: I6502bd58d3860f6318dca668b7b1d6b556d34c2a
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-07-12 10:45:19 +00:00
Jukka Rissanen
26e768cc57 net: yaip: Enable compilation of net_if.c
Change-Id: Icae9d7222b7b41539ff6e4e7d3c8916c5a3ec5f5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:24:13 +00:00
Jukka Rissanen
d7cf956c07 net: yaip: Refactor debug printing in net_if
There is now Kconfig option to enable net_if debugging.
Also use NET_DBG() instead of directly calling syslog macros
so that we can print fiber id automatically.

Change-Id: I150d363006e4be358c38308a93771ba444b0835e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:24:00 +00:00