Commit graph

19237 commits

Author SHA1 Message Date
Tomasz Bursztyka
aca91938c5 net: Kconfig: Refactor Kconfig menus for better clarity
This helps also to split uIP and native stacks properly.
Next thing that should be done will be to isolate debug
options for native stack out of uIP tree.

Change-Id: I4ff856b5a4bb57f3773e1852f84f658baf26858f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
57ab8e0899 net: Make IPv6 ND optional
It is possible to turn of IPv6 neighbor discovery if it is
not used in order to save some memory.

Change-Id: I20159dd452b7bac6962532a91e844c33f3da2dfb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
eca55e103e net: Initial router advertisement support
Change-Id: I842a5aeff870da71eeabdc29c8ea730c541eddd0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
66f87c9542 net: Initial router solicitation support
Change-Id: Ic3aee9999656ab435e0965456d94fd5540b4e220
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
9b3d8378e5 net: Initial IPv6 neighbor discovery support
Change-Id: I76dc7471c56085a61bbdd9f75ecb49aeb0874dbb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
a7e75ba81b slip: Setup fragments properly if MTU is bigger than frag size
If the MTU is bigger than fragment size, we must leave the
fragment link layer header empty so that the received data
count does not get wrong.

Change-Id: I0ed562f39bfbfb559885baa6d774c0383b2228b2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
eca54f0cd7 slip: Do not try to unref a null pointer
There is no harm for doing so but debug prints will look
weird in this case.

Change-Id: I48b6953d07a58bc952fe961cf1db846740dadc50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
ffb0bcd3d7 net: Start the network stack after device drivers
We should start to send data only after network device
drivers are up and running.

Change-Id: I03a2fa21d1bed4badb521f2041e4642111efc078
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
c06c5b8dcb slip: Network stack needs to be up before sending data to it
There will be a crash if network device sends data to network
stack before it is ready to receive such data.

Change-Id: I1a32485faba2972909262c4305fb465b6cb87f07
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:11 +02:00
Jukka Rissanen
0b29c950f4 net: Remove extra debug print in ethernet L2 driver
Change-Id: I6200112c2d4766e4c8fb73cc9a58370ba95969d8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
976fb9d988 net: Set multicast dst address in ethernet if missing
If ethernet destination address is not set, then check if
IPv6 packet is multicast one and set the ethernet destination
address using multicast MAC address prefix.

Change-Id: Iade43e9ebcd0939346d89422f74ee547d6908866
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Ravi kumar Veeramally
a01fed5642 net: Add a utility to hexdump all fragments
Change-Id: I4eaa640d629d9abcd4a4d73f147cca9249df21ce
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
d0401ca317 net: Pointer to a ethernet header was incorrectly set
Change-Id: Id96f574b3f9cc0c161bd365b9e7705ee5ffd862f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
9818cc7b1d net: ARP unit test needs to be run from fiber
The ARP unit test is not able to pass packets between fiber
and task. Because of this the test is run from fiber.

Change-Id: I1825a0abdc1b04a78de76d58425f4d2a2ce26ab7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
53caa13652 net: Refactored ARP packet header handling
The ARP packet header contained ethernet header. This is very
confusing so separate the link layer header. Fixed also the
unit tests to run properly.

Change-Id: I8b00bde280ad9f49494766370acb2a8e9cade033
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
aab6665f2f net: Add more checks when allocating nbuf
It is possible that net_buf_get() will return NULL
as the allocator can be called in ISR context.
In this case we much return and not overwrite kernel
memory.

Change-Id: Id2fdcad2ef0878d93c5364ffb81cd6a0932d908e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
ffcafd0d9e net: Ethernet L2 TX side needs to setup fragments
We need to build the ethernet header when sending data
fragments so that this does not need to be done in
ethernet device driver.

Change-Id: I0347b1abf0c124978fae3fa4b80bb4ee0d544e41
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
cbfa6ec5f3 net: Add more debug print in ethernet RX side
Change-Id: I4df82990fb3be2358c94e480c52fc490bee4a3f7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
23d6a85c62 net: Add debug checks when sending data in TX fiber
Change-Id: I2d01afd53378739a0fd437f2c0664a1eb5670e0b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
1e2de0febc net: Reserve eth ll header len in L2 ethernet driver
Change-Id: I2ec51033f4e778518e6f860c0d37eea39aa61169
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
145a1e2c6f net: IPv4 protocol type was not set to sent ARP packet
Change-Id: I2b7f3cd62da5deaa058d42bd60cbe3435a95c812
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
0dc1aea3de net: Add more debugging to arp.c
Change-Id: I5bd321bb30d43009ceb101f524564a783123d9c9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
17263b099b net: Both TX and RX fibers allow other fibers to run
If the machine is heavily loaded with network data, it is
a good idea to let the other fibers to run after each packet
received or sent. Otherwise the system might overflow the
kserver command stack due to e.g. unprocessed tick events
there.

Change-Id: I5edef2459195d3d9cfcfc38b99c54c66d17334b6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
b4b296b888 net: Add utility func to return eth broadcast addr
As the broadcast address is needed in both arp.c and ethernet.c
it is useful to create a utility function for returning that.

Change-Id: I26e75e325f7ee6dcd703a92b3349bd8d388e157e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:10 +02:00
Jukka Rissanen
7bb273f8f2 net: Add debug support to ethernet L2 driver
Change-Id: I53f35dcb1be25aed1a15ebf9322938bd75263047
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
4352795436 net: Calling net_buf_put() instead of nano_fifo_put()
Because of commit 7720f6ed1c ("net: buf: Introduce support
for fragmentation") the net_buf should be placed into queue by
calling net_buf_put() when using fragmented data.

Change-Id: I5c3dae92596e9cb0d0ba166bc3de2da9f4fc24b7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
84697715e8 net: ARP reply did not set the address family
Change-Id: If716622b71d391fda3a78ab0877c96d4a7ec16ac
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
34a6987e03 net: Initializing the ll src and dst addresses
Because these are not used in dummy driver, just clear the
values so that upper IP stack will not use them.

Change-Id: I8f2919191cfefe54c47eea3f2b8e6e343e7844e2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
79fc041407 net: Add link layer reserve information to l2 driver
Caller can figure out what is the link layer header size
for a given link layer. There is a callback that can return
a dynamic header size if needed.

Change-Id: I59ea2319eb6cb53a0ba5c6aa9e7eecc4b38c94d3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
33a23332b8 slip: Fix the debug print
The code was using NET_DBG() which is not really available
for the slip/tap driver.

Change-Id: I64cedd5fbfb54fdb80d606cf3199312c8871246f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
682b303a47 net: Write ethernet header in pdu when using slip and tap
Change-Id: Ic5901b97356528589a7e244da8e366afaa1db6f6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
82ba457dbc net: Make sure ethernet l2 sets src and dst addresses
We need to set the ethernet source and destination addresses
correctly when sending packet.

Change-Id: Ica1e3fac6299612f0ad1baea7da79143e8944d15
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
63d941bb08 net: Set IP protocol type when sending ethernet packet
Set the proper next protocol type when sending ethernet frame.

Change-Id: Ie042b3fab0741c9ca51453b0b0ecf6189adf2fe7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
59c2d0c0d7 net: Set the ll src and dst addresses in ethernet l2 driver
When packet is received, we set the pointers to ethernet
source and destination addresses.

Change-Id: Ia8795849d8be30e8230e27b1a8d95dd7f334427a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
60752bd08d net: Set the l2 src/dst addresses in nbuf
We need to know where the L2 protocol source and destination
addresses are so save that information in nbuf.

Change-Id: I08677a0421effb0c997c6a68cfc02ccfa67e7e1e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
068f0bf092 net: Add ethernet address helpers
Add helper to check Ethernet broadcast and multicast address.

Change-Id: Icfe5508a4d3ab2364209a50150a4f8fe239ebc93
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
2d575de085 net: Re-send ARP when needed
If we have a pending ARP request and a new request needs to be
send, try to re-send it instead of giving up.

Change-Id: I47a3978fd9c595a419df9485ea35be4d417f987a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:09 +02:00
Ravi kumar Veeramally
5a15b9070c net: Add utility to remove ipv4 address from iface
Change-Id: Ic1366f575ac476b25a240be99df3b82594df2891
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:09 +02:00
Jukka Rissanen
5e0827a985 net: Change how the L2 header space is reserved in net_buf
Instead of calling net_buf_get() with reserve_head > 0, we now
call it with reserve_head = 0. The reason for this is that the
reserve space is not meant for protocol data. So instead the
ll header space is allocated using net_buf_add() followed by
net_buf_pull() which will have the same effect and set the
buf->data pointer to point to start of the L3 layer.

Change-Id: Ia07c599e4d5aa95262f30605861f6a0a92b36d71
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
6a78d66f32 net: Make sure that either IPv4 or IPv6 gets selected
Change-Id: I1d19a4b142e2d699e631c3fba89ef8e6c7530606
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
e04639cb66 net: tests: Fix unit test for IP utils
Change-Id: I7e14ec17656fdcc985000dba6fb67e90a053dfde
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
21a491c065 net: tests: Fix unit test for IP addresses
Change-Id: Ia0b3b2846078a18b9b342c3aa99ea201d06d1642
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
cd8752181f net: Changed the IP and ll address debug prints
The IP and ll address are now declared const. This will
avoid warnings and is anyway right thing to do.

Change-Id: Ieb2aa4ae89f158dddd6a4a1f5fe5e3b253002be8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
f1532fe647 net: tests: Fix unit test for ARP
Change-Id: I962c00500c57f0f49314d10765b821976679e39b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
c13ffd3433 net: Fix arp.h so that net_arp_init() is found
The net_arp_init() was not properly declared if IPv4 was
not active.

Change-Id: I479b93f67c4536bcf9a081c36a6bc82dc5605c4c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
3f089f7377 net: Depending on debug flags the stdio.h is not included
Include stdio.h so that the snprintf() and friends are found.

Change-Id: I54935ab3921b2984dd30106e2b35b09feb5d2199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
e730ddf7e7 net: Print statistics using SYS_LOG
Print statistics with INFO log level.

Change-Id: I333b81a17869398a5e982a431a73141044a50f28
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
01423a8467 net: Network stack analyzer uses now the SYS_LOG sub-system
Use SYS_LOG instead of directly printing using printk()

Change-Id: I61cff11cf8424f726f24ea00b447f2f4827f2c9c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
41f584ee51 net: Do not overwrite SYS_LOG_DOMAIN
The net_core.h accidentally overwrote SYS_LOG_DOMAIN with "net".
This must be done only for network related log domain.

Change-Id: I1050e430e8b649126e527f28c61d191ff34bbf2f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
45afd1b0a7 net: The NET_DEBUG must not be set in header file
Setting NET_DEBUG in nbuf.h will confuse the net_core.h
so it should not be done here. The NET_DEBUG can only be
set in .c file.

Change-Id: Ia95996147bf119c4ddf9f45a9fd635f8d2b405cb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00