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>
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>
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>
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>
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>
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>
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>
Set the proper next protocol type when sending ethernet frame.
Change-Id: Ie042b3fab0741c9ca51453b0b0ecf6189adf2fe7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
Add helper to check Ethernet broadcast and multicast address.
Change-Id: Icfe5508a4d3ab2364209a50150a4f8fe239ebc93
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
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>
Include stdio.h so that the snprintf() and friends are found.
Change-Id: I54935ab3921b2984dd30106e2b35b09feb5d2199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Print statistics with INFO log level.
Change-Id: I333b81a17869398a5e982a431a73141044a50f28
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use SYS_LOG instead of directly printing using printk()
Change-Id: I61cff11cf8424f726f24ea00b447f2f4827f2c9c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
Easier to see buffer leaks using this variant.
Change-Id: Ibdc8d73133cab4822451104fcd5742e4f1e20e42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
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>
Various utilities for IPv6 address manipulation in network
interface.
Change-Id: I270f0935288abd77d64c0f64f56b549fb6c4feb9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
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>
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>
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>
Instead of runtime checks, let's use NET_ASSERT() to verify that net if
API is properly set.
Change-Id: I8e5c769b8383aa9aec5a5e9600c07e05ca96d517
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>