Commit graph

41120 commits

Author SHA1 Message Date
Jukka Rissanen
d7e2897370 net: 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-12-02 12:40:03 +02:00
Jukka Rissanen
5729d1c461 net: 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-12-02 12:40:03 +02:00
Jukka Rissanen
26cc76f976 net: 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-12-02 12:40:03 +02:00
Jukka Rissanen
4e82923814 net: 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-12-02 12:40:03 +02:00
Jukka Rissanen
6e803a9c6d net: 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-12-02 12:40:03 +02:00
Jukka Rissanen
6e8fdd34fe net: 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-12-02 12:40:03 +02:00
Jukka Rissanen
d24f673248 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
262a02fe67 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
e467c009e5 net: tests: Add more IPv6 address getters unit tests
Change-Id: I0ab22af76073c02c93eb205686472f69b58a1107
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen
93f129060d net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
7851aecc1c 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-12-02 12:40:02 +02:00
Jukka Rissanen
cf5c1db262 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
c3deb96dd7 net: tests: Add IPv6 address manipulation unit tests
Change-Id: Ide3bce35dcfd3ec31bfe3cd842a87ca3b639ba4f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen
09d317ccd0 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
f49de47f42 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
6646597a86 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
cce1854b58 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
c44c229660 net: 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-12-02 12:40:02 +02:00
Jukka Rissanen
2ade6ddb60 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-12-02 12:40:02 +02:00
Jukka Rissanen
a6d9255647 net: Add debug function to print IP address
Change-Id: I4464f1da6d602b1abba0f385e5afa92d2cb4afc8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen
fa7ed053bf net: Add debug function to print MAC address
Change-Id: I32ca7a4f005d73be7c8d4d28a7a6fbd19c01dd2e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:02 +02:00
Jukka Rissanen
875ea297d4 net: 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-12-02 12:40:01 +02:00
Jukka Rissanen
7047e00f85 net: 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-12-02 12:40:01 +02:00
Jukka Rissanen
8c8052497d net: 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-12-02 12:40:01 +02:00
Jukka Rissanen
9821cb6eb4 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-12-02 12:40:01 +02:00
Jukka Rissanen
df1c331c96 net: Enable compilation of net_if.c
Change-Id: Icae9d7222b7b41539ff6e4e7d3c8916c5a3ec5f5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
9ad626e8f7 net: 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-12-02 12:40:01 +02:00
Jukka Rissanen
f75d8a86bb net: Start to use logging macros from sys_log.h
Instead of directly calling printk/printf, the network printing
macros will use syslog macros defined in sys_log.h

Change-Id: I3f12f81557f50b24ca47a43f345162f9ffbd574c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
71f2a78316 net: Add send() to net_if API
The send() function is called from IP stack and it is used
when the network packet needs to be send via a specific
network interface.

Change-Id: Id6ce86b1748915fee73b62366dee13fcb7cf11a1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
073c41c824 net: Add Kconfig option for compiling IPv4 support
The native stack uses CONFIG_NET_IPV4 to compile IPv4 support.

Change-Id: Ia4a579591d6d2050e168c35e68546281043d53a8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
b33d8d6591 net: Add net_if_get_by_link_addr() util function
This will return the network interface that has some specific
link address.

Change-Id: Iaebcf6e769d4f91f3cda6d3a0779324f89603b54
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
33f56ce99b net: Execute net_init() automatically
User does not need to call net_init() as it is automatically
called when system is brought up.

Change-Id: I2cb10f4402088a0ca4feff226b65341f337194ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
5698d7e4d4 net: Add Kconfig option for compiling IPv6 support
The native stack uses CONFIG_NET_IPV6 to compile IPv6 support.

Change-Id: I25c3b2d6775ed610fca43960a569ddab0ec470aa
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
3e1aef117a net: Add net_analyze_stack() macro
This macro can be used to check stack usage. It should only
be used when debugging is activated.

Change-Id: I99fe6f9db1f3e955152a91f3a18d031126172cfd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
14cdced965 net: Fix compilation error in net_if.h
The NET_IF_INIT() macro used parameter pasting incorrectly.

Change-Id: I40a988ffb06ce135731cd69f18931b7507cd71cc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:01 +02:00
Jukka Rissanen
2ddb7ce42e slip: Add driver for host to qemu connectivity
The SLIP driver is using UART pipe driver to communicate with
host when Zephyr is running in Qemu. Currently this is only
used by networking sub-system when testing the networking
stack.

Change-Id: I432b4136670766a7fc190f146057924c266f9bea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
69b8c675a6 net: Add nbuf buffer API
User should use the net_nbuf API that is supporting a concept
of RX, TX and DATA buffers, instead of using directly the net_buf
low level API.

Change-Id: I3b8f5f13cd37d42d2322a58b35573e117d520c54
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
81298abfb4 net: Compile IPv6 and IPv4 address conditionally
Save 12 bytes per IP address if IPv4 is active and IPv6 is not.

Change-Id: Ia01d2feb83e6ba80b2775f9eed3065c956932632
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
920a5f5e38 net: Add function that feeds data to RX fifo
Network drivers should call this when new data has been
received from network.

Change-Id: Ife78fa0683b8c410c38358300a6a18e9325f0ef8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
47a0d8d6ab net: Refactored RX fiber init
Change-Id: I2f8a43ac63162844d0df0c1b69dc93837479a91d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
e0e682eb66 net: Add TX fifo to network interface
Network packets to be sent are placed to correct fifo that
is allocated to certain network interface.

Change-Id: Idd5eded42758c5bed2c18769122c38d9d03dc419
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
510ebe255d net: Add IPv6 prefixes to network interface
Change-Id: I34c75eec6068abbd6af1eac2e178e42ce382b128
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
ad848dcfbf net: Add multicast address to network interface
Change-Id: Ifc09d2e1d3ac44ab0f5980ee17299119fbe2a867
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
ac479e19b8 net: Add network address information to interface
Change-Id: I14b9257362a1e6f4144900c7acde6a125ecf6a02
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
e6d92ecdcf net: apps: Create a skeleton echo-server for new IP stack
This echo-server does not yet do anything useful.

Change-Id: I317051b3a2bfb0a80584ad385c2f308978a243cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Tomasz Bursztyka
2fa38c18f0 net: Add generic network interface header
This will be used by the new network stack to relate a device to actual
network context, and used in the different layers (mac, ip ...).

Change-Id: I30c08fa975314544c36b71636fd9653d562891b3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
9e47250e1f net: Compile new stack if enabled
Change-Id: Ifb9c1b49e253af0428187898c6c3e6aa7f4851cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
2ecd663b2b net: Use same prefix in new IP stack Kconfig
Use CONFIG_NET_... prefix for Kconfig options.

Change-Id: I3e882845e7c09ba910f108179208fcaf33360f21
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
b9289f176c net: Add ntohl() and related macros
Change-Id: Ia329a63644eab8ca1ce6debb8f7e7b97b8de711d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00
Jukka Rissanen
9c5a6d17e2 net: Add defines for various IP protocol header lengths
Change-Id: I05dcb7a26f50cd0c8d544c5d829e1154ed3f8119
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:00 +02:00