The network packet ref count was not properly increased when
the TCP was retried. This meant that the second time the packet
was sent, the device driver managed to release the TCP frame even
if we had not got ACK to it.
Somewhat long debug log follows:
The net_pkt 0x08072d5c is created, we write 1K data into it, initial ref
count is 1.
net_pkt_write: pkt 0x08072d5c data 0x08075d40 length 1024
net_tcp_queue_data: Queue 0x08072d5c len 1024
net_tcp_trace: pkt 0x08072d5c src 5001 dst 5001
net_tcp_trace: seq 0x15d2aa09 (366127625) ack 0x7f67d918
net_tcp_trace: flags uAPrsf
net_tcp_trace: win 1280 chk 0x0bea
net_tcp_queue_pkt: pkt 0x08072d5c new ref 2 (net_tcp_queue_pkt:850)
At this point, the ref is 2. Then the packet is sent as you see below.
net_pkt_ref_debug: TX [13] pkt 0x08072d5c ref 2 net_tcp_queue_pkt():850
net_tcp_send_data: Sending pkt 0x08072d5c (1084 bytes)
net_pkt_unref_debug: TX [13] pkt 0x08072d5c ref 1 (ethernet_send():597)
Ref is still correct, packet is still alive. We have not received ACK,
so the packet is resent.
tcp_retry_expired: ref pkt 0x08072d5c new ref 2 (tcp_retry_expired:233)
net_pkt_ref_debug: TX [10] pkt 0x08072d5c ref 2 tcp_retry_expired():233
net_pkt_unref_debug: TX [10] pkt 0x08072d5c ref 1 ... (net_if_tx():173)
net_pkt_unref_debug: TX [10] pkt 0x08072d5c ref 0 ... (net_if_tx():173)
Reference count is now wrong, it should have been 1. This is because we
did not increase the ref count when packet was placed first time into
sent list in tcp.c:tcp_retry_expired().
The fix is quite simple as you can see from this commit.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When converted to time_t, RTC init date was missing 100 years
offset, as time_t starts in 1900 while RTC starts in 2000.
Besides, tm_mon calculation was wrong by 1 month as allowed range
is 0-11 and provided in range 1-12.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Asyc transceive is currently not implemented for this driver,
so don't claim support.
spi_context_lock() is already being called in spi_sam_transceive()
so calling it in the wrapper function will cause a deadlock.
This reverts eae05d928e
Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
With BT_HOST_CRYPTO, advertising stack size could be overflowed,
increase size to 1024 when BT_HOST_CRYPTO is enabled.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Test case added for IPv6 neighbors. This will add more than
CONFIG_NET_IPV6_MAX_NEIGHBORS neighbors. Network stack should
remove oldest neighbor which is in STALE state and it should
add new neighbor. So call to net_ipv6_nbr_add() should succeed.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This patch fixes following issues.
* If IPv6 neighbor table is full, stack can not add any new
neighbors. So stale counter is introduced. Whenever neighbor
enters into STALE state, stale counter will be incremented
by one. When table is full and if stack wants to add new
neighbor, oldest neighbor in STALE state will be removed
and new neighbor will be added.
* When neighbor is in PROBE state and when it exceeds max
number of PROBEs, only neighbor with router is removed.
As per RFC 4861 Appendix C, entry can be discarded. Now
neighbor will be removed from the table.
* Reachability timer has an issue. e.g. if a first entry timer
is 10 seconds, after 3 seconds, a new entry added with
only 3 seconds. But current implementation does not check
whether remaining time of current left over timeout is more
than new entry timeout or not. In this example, when new entry
timeout is 3 seconds, left over timeout from first etnry is
still 7 seconds. If k_delayed_work_remaining_get() returns
some value then new entry time out was not considered.
Which is bad. It fixed now.
* nbr_free is used sometimes to remove the neighbor. Which does
not remove route if that particulat neighbor is route to some
other neighbor. net_ipv6_nbr_rm() should be used in such places.
* Trivial changes which does not affect functionality.
Fixes#14063
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Clarify what iPerf version was used when testing this sample
application. It was iPerf 2.0.9 which worked ok, for example
iPerf 2.0.13 did not work properly with UDP uploader (client)
mode.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Try to construct a proper iperf client header to the payload
as the server expects that. It is not sure if this is needed
or correct as there is no proper documentation for the iPerf2
protocol.
Fixes#14665
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Try to construct a proper iperf client header to the payload
as the server expects that. It is not sure if this is proper
way to do the iperf header as there is no documentation about
iPerf protocol anyway (except the iPerf source code).
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Set the revision to the v0.5.6 tag in west.yml and update the minimum
version. Barring any (more) major undiscovered issues, this will be the
version used with Zephyr v1.14.
Signed-off-by: Marti Bolivar <marti@foundries.io>
Shell was selecting logger option which lead to define
CONFIG_LOG_RUNTIME_FILTERING generation even though log
was disabled. That messed up logger and lead to compilation
failure.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
When log is disabled then input parameter to LOG_LEVEL_SET(level)
is not defined. It was still used, leading to compilation failure.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fix regression and allow incoming packet when source and
destination port numbers are the same.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use tinycbor from the tinycbor repo directly and drop the library from
ext/.
Add entry to west.yml and update SHA.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In case of Ethernet for instance, the MTU is larger than the minimal
IPv6 MTU, so it is not required to fragment a packet that fits in
Ethernet MTU.
Fixes#14659
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit updates the documentation as follows:
- stresses that the lazy stacking preservation is disabled
by default and not supported in ARM Cortex-M builds,
- corrects the figure of extra stack requirement when
floating point services are enabled in ARM builds.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit provides the following fixes:
- Corrects the note regarding which ARM MCUs may support
floating point services
- Rewords the text stressing the undefined behavior when
multiple threads access the floating point registers.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Following fix SRAM size to take into account CCM,
enable CCM and update yaml files in boards including fixed soc
dtsi definitions.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
On various stm32 soc packages CCM is available and SRAM size
mentionned in datasheet include CCM.
Though, actual SRAM size defined in dtsi files should not
include CCM sizes.
Fix this on impacted dtsi files.
Fixes#14779
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Field stack_info.size is supposed to hold the actual writable
thread stack area, above what is pointed to by stack_info.start.
Therefore, in all MPU architectures we can program the Thread
Stack MPU region as starting from thread->stack_obj and with
size equal to stack_info.size plus the (possible) difference
between stack_obj and stack_info.start.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Consider a stack buffer at address 0x10000 with size 1024.
If a thread is created with this stack object, the resulting
fields in thread.stack_info ended up being a base address of
0x10020 with size 1024. The guard size needed to be subtracted
from the size in order for the bounds to be correct.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Add driver support for Atmel SAM device ID, which is 16-bytes long. On
this SoC family, the device ID is part of the flash controller and
complex to read. Therefore the driver reads it once at boot time and
then just returned the copy saved in RAM.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This patch checks the return value after updating the packet.
Fix Bugs: #14821
Coverity CID: 196635
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
The command `recheck` was always experimental and should not be part of
the contribution guidelines and flow. It is not working now, so remove
it from the docs.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The earlier removal of _ prefix went and renamed this func
and added z_ prefix. This is useless as the relevant macro
is called GPTP_POW2() so call the helper function as gptp_pow2().
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Command scan fixed in the way that it can take one mandatory parameter
and one optional. Previously it accepted only 2 mandatory parameters.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Removed automatic argument count checking in bt command. Now
it is possible to print a message that extra argument is not
recognized.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Replace "Note:" to actual @details so it appears properly formated in
generated documentation.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Its behavior varies whether overwrite bit is set or not, so detailing
this more carefully.
Fixes#14093
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It is invalid to try to bit shift the same amount of bits as
what is the number of bits in the left expression’s type.
Coverity-CID: 187079
Fixes#8988
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of relying on overlays which requires to write overlay for
every board (100+) define console device name.
Fixes#14698
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
If there are several queued interrupts we can miss some of them. Use
while() loop to catch them all.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Use ringbuf library for handling RX CDC ACM path. Remove old code
artifacts handling specific hardware.
Fixes#14288
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
1. The build paragraph was listed with the run option.
But, we need to pass an argument to the native_posix board,
so "ninja run" alone is not good enough.
Plus, it was not coherent with the rest of the text, as
the paragraph intended to tell people how to build.
2. Added "sudo" to the run line, as the user needs extra
permissions to connect to a host BT controller.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Several public APIs were not checking the BT_DEV_READY flag, which
could lead to hard-to-debug behavior, particularly when the stack
lacks an identity address. Add the appropriate checks to these APIs.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The treatment of the BT_DEV_READY flag was broken when used together
with BT_SETTINGS. The flag would get set even though the stack was
still in a partially initialized state. Even worse, for central role
the stack would potentially try to initiate passive scanning without
having an identity address.
Refactor the code that sets the BT_DEV_READY flag (among other
initialization) into a separate bt_finalize_init() helper function and
call it when the settings have been loaded. Also clarify the warning
message given to the user in case settings_load() needs to be called.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Coverity was complaining that this function was not being checked only
in a specific case.
Coverity CID: 183066
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
%z isn't available in Python, and makes the code raise a ValueError. Use
%d instead. Integers in Python 3 are not sized/signed (though it's
probably a typo from C).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The 14 individual cases that use these four config files are now
passing reliably when SMP is enabled, after the "Mark sleeping threads
suspended" scheduler fix. Turn it back on.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
For obvious performance reasons, scheduler state changes (other than
aborting a thread) do not cause synchronous interrupts on the other
CPU. Doing a k_thread_wakeup() means that the current CPU will run it
synchronously if it's high priority, but if you want to see it run on
the other cores you need to wait for them to reach a scheduling point
on their own.
The test was written to assume that k_thread_wakeup() is synchronous,
but that's not right, and it needs to spin a bit. This bug was always
present in the test, but masked by a bug in the way that k_sleep() was
handled on SMP. See #9506.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
On SMP, there was a bug where the logic that re-adds _current to the
run queue at swap time would accidentally reschedule threads that had
just gone to sleep, because the is_thread_prevented_from_running()
predicate only tests for threads that are "suspended" or "pending" and
not sleeping.
Overload _THREAD_SUSPENDED to indicate "sleeping" also. Simple fix
for an immediate bug, though long term we really want to unify all the
blocked conditions to prevent this kind of state bug.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>