Commit graph

41120 commits

Author SHA1 Message Date
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
Jukka Rissanen
7bfffc3bc4 net: Use debugging net_buf unref function
Easier to see buffer leaks using this variant.

Change-Id: Ibdc8d73133cab4822451104fcd5742e4f1e20e42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
fa0ff4e20e net: Process ICMPv6 packets only if IPv6 is enabled
Change-Id: I21da9a711f54d0041f1e240266aff6312dcc2044
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
4f193e5baf net: Refactor various network init functions
There is no need to check if the sub-system is initialized
because net_init() is the only place that will call these
functions.

Change-Id: Icd54d2adf2924431cedd7c47124a3410842aeca3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:08 +02:00
Jukka Rissanen
249e99b428 net: Buffer leak if net_if_send_data() returns NET_DROP
If the net_if_send_data() returns NET_DROP then we must handle
that separately as the net_send_data() should return 0 if
everything went ok and <0 if there was an error in which case
the caller should unref the net_buf.

Change-Id: Ibf97aba65641463248e1616a09d050e8a95a0fa6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
5b65e6592d net: No need to do ARP for IPv6 network packet
Change-Id: Ib9acedfdd9a569501a8d63119b7bddefdf846592
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
7a88cee800 net: The IP protocol type needs to be set in L2 layer
The network L2 recv handler needs to set the initial value for
IP protocol type (IPv4 or IPv6). Otherwise the recv data check
in net_core.c:process_data() will not work properly if IPv4
is enabled.

Change-Id: I5684cd10e5d79e13a977406729ea68313e689c9b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
4695e53391 net: tests: Add unit tests for neighbor cache handling
Change-Id: I1518c102232a607a9c0f91bf5fd71e4b3183a419
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
3f64cefc25 net: Add a neighbor cache needed in IPv6
This is the framework that neighbor discovery uses. The ND
is coming in later commits.

Change-Id: Iaaa67c80c0b6b8a3adb9217413b906e0a22d3920
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
fa15fe3de6 net: Add IPv6 address network interface utils
Various utilities for IPv6 address manipulation in network
interface.

Change-Id: I270f0935288abd77d64c0f64f56b549fb6c4feb9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
e42774ce42 net: Add IPv6 utils for address manipulation
Change-Id: Iea5a0c81c5d35080b0206e33b4f279100fd0c80b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
ec689c32f9 net: Changing IPv4 address compare to a function
The IPv4 comparer was a macro but making it now a inline
function.

Change-Id: I315c52d812996e352e9b392627296ba229530ae0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
518eedf1a2 net: Use const for static and pre-defined IPv6 addresses
Change-Id: Ia1ed07e6bd93d2102c6c25ab8cb1ccdc9cf80d17
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
301feea5b4 net: Add struct to store link layer address
Adding a variant for net_linkaddr that can actually store
a link layer address. The normal net_linkaddr struct just
uses pointer to a ll address. The storage version is used
when we have a lladdr cache for neighbors.

Change-Id: I57421047f66090caf09595981c81d386144edce3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
088543fdc8 net: Print available DATA buffers during nbuf alloc
Print more debugging information about available DATA buffers
when allocating and de-allocating a net_buf.

Change-Id: Id4aa4c46b5dc70e683029ccc525abed5b6cfbefb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
9bcb18e6fd net: Make sure that RX is started before TX
The network stack initialization will need to make sure
that RX side is ready before TX side is started. So in
order to do that the TX init is called from RX fiber.

This is needed so that we can start to send network packets
already during the net_init(), like IPv6 neighbor solicitation
messages during duplicate address detection process.

Change-Id: I12fde3d388d9aab41daa93b1edc02f25b8c5511d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Jukka Rissanen
7e99b48f3d net: Moved ARP helper macro to arp.h
The helper macro NET_ARP_BUF() needs to be used from other
files so arp.h is proper place for it.

Change-Id: Ief7bbb385d9c180213ecd7cb08023f13999f5270
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:07 +02:00
Tomasz Bursztyka
b81ece31e4 net: Add comment explaining net_core's verdict values
It is then clear what logic to expect once such verdict has been given.

Change-Id: Id64ff00e65ffe2dad45673d1eca4eb76ae3ae1f6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:07 +02:00