Since the new packet flow came in, payload comes at the end so udp
length for instance is known only when we "finalize" the packet.
However such finalization was still under the condition of chksum
offload, like it used to be in the former flow (udp headers were
inserted). This is obviously wrong but that was not caught with
existing driver in master as none of these drivers offloading
chksum calculation.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
A few more test cases that are measurably unreliable when run in SMP.
For the most part these work most of the time (though the semaphore
one was pretty borderline -- I measured about 25% failures), but are
measurably unstable against the backdrop of known qemu instability.
Something is clearly going on and we need to come back to these to fix
threadsafety issues.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
`CONFIG_NET_L2_BT` no longer forces required BT configuration, but
depends on a user to set a valid configuration instead. Hence, we
need to select a proper configuration in the overlay config file.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This patch adds the overlay when the echo-server is running on Linux and
echo-client is running on Qemu.
Fix: #14654
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
An external project extending the Zephyr RTOS and its drivers may have
subsystems that must use its own specific driver(s) when active. One
example is the nRF5x NVMC that must be scheduled in between radio
operations. A subsystem may also be dependent on its own drivers for
security, real-time and/or because of hardware constrains.
In order to not introduce non-Zephyr specific code into the Zephyr tree,
an option is added to disable the in-tree drivers in Zephyr. Because
Kconfig does not support a good way of de-selecting other symbols, a
variable on the form `<DRIVER>_FORCE_ALT` is added as a
dependency for each `<DRIVER>`. For example, the out-of-tree subsystem
will select `FLASH_NRF_FORCE_ALT` to disable the in-tree driver. A
solution for issue #8181 would open up for a more general solution,
however #8181 requires significant effort.
Support for out-of-tree drivers is added to Nordic drivers for
clock_control, entropy and flash.
A generic solution for this is desired. Issue #14527 is tracking that
progress.
Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
Commit fc27a81ed2 ("net: context: Select proper network interface
when binding") moved the bind_default() call to after the remote
address was set for the net_context.
This and a later net_pkt API refactor broke net_offload() handling
so that context->iface wasn't set and context->flags didn't have
NET_CONTEXT_REMOTE_ADDR_SET correctly.
Let's fix this by relocating the net_offload handling to after
these have happened.
Signed-off-by: Michael Scott <mike@foundries.io>
This reduces net_pkt structure size.
Moving sent_list attribute for better alignment.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Some places were still using the old allocator. Using the new one does
not change any behavior. This will help to remove the useless data_len
attribute in net_pkt which legacy allocator was still setting.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
net_offload API is left untouched, so it still takes a net_pkt as input
for the buffer. This is under-optimized since offload drivers will copy
the data from that net_pkt back into contiguous buffer again.
Let's tackle this issue another time.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This parameter was removed from net_context already thus applying the
change also on net_offload API.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This attribute, in case CONFIG_NET_STATISTICS is enabled, made sense
when L2's send() function did not return the length of the sent packet.
But now, it's a superflous optimization as is it used only to set the
stats on recv or send, where net_pkt_get_len() can be used directly.
This helps to save 2 bytes from struct net_pkt.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
And also to the relevant callbacks.
That parameter is not used anywhere so it is useless.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Seems like a useless attribute. Since net_context is not being used by
the user directly (socket is the unique interface now) and since no core
parts uses the token parameter of net_context API: let's remove the
attribute.
This helps to save 4 bytes from struct net_pkt.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
That function was responsible for allocating new buffer element, but it
is now unused and can be removed safely. Buffer allocation is now done
via net_pkt_alloc_buffer().
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that legacy functions are removew, let's rename the new functions by
removing the _new suffix.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
There is no need for these anymore: all is dictated by the position of
the net_pkt's cursor now
- actual cursor position is like the former appdata attribute
- net_pkt_remaining_data() is like the former appdatalen attribute
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Former net_context_send/sendto and net_context_create_ipv4/ipv6 are now
unused and can be removed.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
In case of corrupted key in settings, error message is shown. However,
the key name is lost by logger if it is not explicitly copied.
Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
Daniel Leung caught a good one: In the (SMP) case where we were
aborting a thread that was not currently scheduled, we were flagging
the DEAD state on _current and not the thread we were aborting! This
wasn't as fatal as it seems, as the thread that called z_sched_abort()
would effectively go on living (as a zombie?) in a state where it
would always be preempted, but would otherwise remain scheduleable.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Do not perform early level usage check. This can lead to situation
where block is seen as available on level when it was taken from
the other context.
Fixes: #14504
Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
Log RTT backed is using mutex for locking access to RTT data.
RTT console (which by default is used by printk) writes to
RTT data directly and it cannot use mutex because it can be
called from any context (including interrupt). If both
modules access RTT buffer 0, data can be corrupted.
This patch forces LOG_PRINTK option if RTT backend is used to
ensure single point of access to RTT buffer 0 data.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
BT_WARN() should only be used for log messages that may indicate a
problem. However, the controller HCI code was using it for messages
that were of a pure debugging/informational nature. Convert these to
BT_DBG() instead - this should hopefully also help avoid unnecessary
user questions of seemingly alarming log messages.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Introduce API for get driver structure belongs to the flash_area.
Some more complex operation on flash areas might want to be done using
driver directly. It not make sense to wrap every possible flash related
operation by flash_map API.
For instance mcuboot will require this patch.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Disable the data cache before writing to Flash, in order to workaround
silicon errata 2.2.3: "Data cache might be corrupted during Flash memory
read-while-write operation". The data cache is conditionally re-enabled
once the write is completed.
This silicon bug has been encountered while stress testing the
implementation. Here are the events leading to the fault:
- Code is executing from Flash bank 1
- A write to Flash bank 2 is initiated
- The Cortex SysTick interrupt fires while waiting for Flash write
completion
In that case, the Flash controller will perform a read-while-write
operation in order to execute the ISR code. As the data cache is enabled
by default after reset, a corruption occurs due to the silicon bug,
leading to bizarre data bus faults or unaligned access faults inside
_timer_int_handler() or one of the functions called by the ISR.
Applying the workaround devised by ST fixes the problem.
Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
Instead of aborting on RSSI poll error, let's continue on and
reschedule the next RSSI poll.
This fixes an issue where RSSI polling would stop if for any reason
the modem doesn't fulfill an RSSI poll on time.
Signed-off-by: Michael Scott <mike@foundries.io>
Changes in commit 854045c14d ("drivers/modem: Switch wncm14a2a
driver to new net_pkt API") moved WNC-M14A2A modem driver to new
net_pkt APIs. As part of these changes, the values for source and
destination passed into net_ipv6_create() were reversed.
Let's correct them.
Signed-off-by: Michael Scott <mike@foundries.io>
Fix the type of struct field index to int, to avoid
loss of precision, in case the variable holds the value
-EINVAL (in the case of errors in MPU configuration).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
In arm_core_mpu_mem_partition_config_update() we must fix the
index value of the start of the for loop, to address the case
when dynamic MPU regions are programmed in index values lower
than static_regions_num. (This might occur in ARMv8-M MPU,
depending on the order of programming the map of the
dynamic regions in run-time). We introduce function
_get_dyn_region_min_index(), and provide the implementation in
arm_mpu_v8_internal.h and arm_mpu_v7_internal.h (trivial).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
The 2M and Coded PHY bit should not be set when the
PHY update procedure is not supported.
Fixes#14658
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
IPv6 next header might be something else (here NET_IPV6_NEXTHDR_HBHO)
but when finalizing it is mandatory to give the actual last header
protocol type. In this case IPPROTO_ICMPV6, so the checksum can be
computed properly then by net_icmpv6_finalize() called from
net_ipv6_finalize().
Fixes#14663
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This sample is often the first one used as reference for Bluetooth
Mesh, so it should have a good configuration as a starting point.
Comment out the LPN options to eliminate Kconfig warnings, since the
LOW_POWER option they depend on is not enabled. Also disable
INIT_STACKS since that's only needed for fine-tuning the app
configuration, and otherwise only causes unnecessary spam in the
console.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>