Wait for MAC operations to complete when transmitting. Unconfirmed
messages still open receive windows and can cause error conditions,
which are currently dropped.
It is also possible for a second send to be requested before the first
one has finished processing, which results in `LORAMAC_STATUS_BUSY`.
Empty frames (due to insufficient payload space) now also block until
the MAC layer is ready to accept new commands.
This change means the application no longer needs to guess-and-check
when it is possible to send unconfirmed messages.
Fixes#33456.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
If the telnet client operates in a character mode, it may send
individual characters in packets. Such packets were dropped in the
telnet shell backend instead of being process by the shell engine.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Added implementation of log_msg2 which is creating log messages
using cbprintf packaging and storing them in circular ring buffer
(mpsg_pbuf).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Logging v2 is using _Generic keyword for detecting type of
log message arguments. Apparently, it does not support handling
of pointers to forward declared structures. Added casting to void *.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Logging v2 is using _Generic keyword for detecting type of
log message arguments. Apparently, it does not support handling
of pointers to forward declared structures. Added casting to void *.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fix a missing encryption procedure state check which allowed
out of order receive of START_ENC_RSP PDU, which made the
controller to believe its already in an encryption procedure
in progress state.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Do not make the first object added to the object transfer server the
current (=selected object). This leads to the server having no
current object until one is selected by the client.
This solves a startup issue where the selected callback is not called
by the server if the first object selected by the client happens to be
the same object as the object that was first added to the server. In
that case, the user of the OTS does not know which object is selected,
and therefore may not be able to supply the correct data later.
Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
Avoid using sizeof to access ULL and LLL struct members.
Based on the alignment requirements of structures, due to
padding between structure members, use of sizeof of previous
struct member to access next struct member is incorrect.
Continue to use explicitly stored parent pointer to access
ULL context. Combine event header and ULL header so that
the parent pointer point directly to the combined ULL
struct.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing initialization of reference count in
ull_hdr_init function.
This has not caused issues so far, but when the ref member
of the struct ull_hdr if placed in the beginning of a
context that is allocated using mem_acquire function then
first few bytes used would make the ref member to have
uninitialized value when such context is allocated by
mem_acquire. First few bytes are the next pointer and free
count stored by the mem module.
The issue was discovered in subsequent commits that
restructure the ULL context structures.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the auxiliary scan context release to be performed in
the disabled_cb callback after the ULL reference count is
decremented.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix conn_cleanup to be performed in the event done. The
regression was introduced in
commit 5412f61ac6 ("Bluetooth: controller: Introduce
separate done memq").
Now that done event is handled asynchronously outside the
handling of the terminate node rx type, it is necessary that
terminate node rx type is generated after the done event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Consolidate Kconfigs for ISO roles to make compilation guards more
concise. Just introduces aliases, does not change functionality.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
The previous implementation assumed that the dst pointer was always
aligned to a 4-byte boundary in platforms that require alignment for
storage of 32-bit integers. Since this is required for certain platforms
(eg. Arm Cortex-M0), use memcpy() instead, which always takes
alignment into account.
Fixes#33969.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Moves the beacon_enabled check in the beacon work handler to check the
beacon flag before sending anything, in case a cancel call fails.
Split out from #33782.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Ignore peer keypress notifications as a responder, allowing the pairing
procedure to continue instead of being aborted.
The Bluetooth LE specification does not specify a behavior, the
implementation has the choice of ignoring or aborting.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The Transport layer implements some checks surrounding the
lpn_msg_received call, with an accompanying comment that explains the
logic. Move this inside the msg_received call instead.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Switch to the new delayed work API. Puts the scheduling for the next
poll in the response_received function instead of cancelling it, then
optionally scheduling it again later.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Made the LwM2M engine checks for pmin and pmax optional to adhere to
the LwM2M specificattion. We now first check that pmin and pmax are
actually set. Also changed the default CONFIG values for the attributes
pmin and pmax to 0 to indicate that they are not active by default.
Fixes#34329.
Signed-off-by: Maik Vermeulen <maik.vermeulen@innotractor.com>
Changes lpn_timeout_get behavior in the config server to report the
configured LPN timeout, instead of the currently remaining timeout time.
According to the Bluetooth Mesh Profile specification, section 4.2.21,
the PollTimeout list is a list of the PollTimeout timer values, and
according to table 4.32 in this section, values 1-9 are prohibited.
Although this is not explicitly stated, this indicates that the
PollTimeout value is the configured poll timeout time - not the time
remaining until the timeout value expires. This patch changes the
implementation to reflect this.
Split out from #33782.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Removing CONFIG_TRACING_CPU_STATS in favor of
CONFIG_THREAD_RUNTIME_STATS which provides per thread stats. The same
functionality is also available when Thread analyzer is enabled with the
runtime stats enabled.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The Transport layer would previously rely on the access layer to check
whether there's room for the full message and a MIC in the available
buffer space, and its own checks would ignore the MIC. This should be
handled by the Transport layer checks, so the access layer doesn't have
to.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Periodic publication would previously build and send the first
publication inside the bt_mesh_model_pub() function, before cancelling
and rescheduling the next publication. The timer handler would only
handle retransmissions, and would abandon the rest of the publication
event if one of the packets failed to send.
This design has three issues:
- If the initial timer cancel fails, the publication would interfer with
the periodic publication management, which might skip an event or
send too many packets.
- If any of the messages fail to publish, the full publication event
would be abandoned. This is not predictable or expected from the API.
- bt_mesh_model_pub() required 384 bytes of stack to build the message,
which has to be factored into all calling threads.
This patch moves all transmission into the publication timer by
replacing k_work_cancel with a single k_work_reschedule(K_NO_WAIT). It
also changes the error recovery behavior to attempt to finish the full
publication event even if some of the transmissions fail.
Split out from #33782.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Replace all existing deprecated API with the recommended alternative.
Be aware that this does not address architectural errors in the use
of the work API.
Fixes#34092
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If `CONFIG_NET_ICMPV4_ACCEPT_BROADCAST` is enabled ICMPv4 should reply
to request packets sent to the broadcast address of an interface with
the unicast address of that interface from the same subnet.
Previously the code blindly copied the ICMP source address which meant
it would reply to broadcast packets with a broadcast source address.
Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
The `init_string` array could have been used uninitialized, fix this
by initializing it as an empty string, which is a desired content in
case it's not overwritten.
CID: 220302
Fixes#33839
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
First design towards ISO adaptation layer, this PR introduces
data-structures and framework for Rx unframed PDUs (BT RX ingress).
Two callbacks are defined for the SDU production (BT RX egress), one for
SDU allocation as well as a callback for emitting a reassembled SDU.
Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
Add numeric http status code to the response struct to allow for
easier processing by the caller. Textual status already exists.
Signed-off-by: Justin Morton <justin.morton@nordicsemi.no>
This commit puts the radio in sleep mode when the diagnostics are
stopped.
This fixes an assert on MAC code when `ot diag stop` command is
issued while `ot diag send` is still ongoing.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Replace all existing deprecated API with the recommended alternative.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
chan_send does restore buffer state in case of an error which is
different than how bt_l2cap_send_cb works as it does always unref in
case of an error.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes a regression introduced by
10841b9a14 as it did remove a call to
net_buf_ref which was used not only to keep a reference for resending
but also to prevent bt_l2cap_send_cb to unref the buffer in case it
fails.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In the time between a NODE_RX_TYPE_CONNECTION node is sent from LLL and
demuxed in ULL, an ADV role disable may be executed.
This makes the LLL data referenced in the node NULL/invald, and
ull_conn_setup would operate on invalid data.
This commit introduces a check in ADV disable to disallow the operation
(including conn invalidation), if a connection has been initiated.
To prevent pipeline-queued prepares from advertising after disable has
been initiated, set 'cancelled' flag for immediate signalling to LLL.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Zephyr socket subsystem has come a long way since initial experimental
alternative to internal Zephyr networking API. Its configuration also
mirrors the usual conservative approach, where a user needs to
explicitly enable options to get "more" features. And as an
experimental API, socket subsystem was initially developed as
namespaced API, where all functions/structures are prefixed with
"zsock_", and to get standard names, CONFIG_NET_SOCKETS_POSIX_NAMES
needs to be set (or alternatively, CONFIG_POSIX_API needs to be, which
enabled full POSIX subsys overall).
However, a few years later, sockets are the standard networking API,
and in majority of cases its used under the standard POSIX names.
Necessity to explicitly set an option to achieve this effects, and
confusion which results from it - are just unneeded chores for users.
So, switch CONFIG_NET_SOCKETS_POSIX_NAMES to be on by default (unless
CONFIG_POSIX_API is already defined). It still can be explicitly
disabled if needed (but usecases for that would be peculiar and rare).
Addresses #34165
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit fixes the build error: "error implementation of
timestamp_serialize() not provided for your CPU target" for
fvp_baser_aemv8r tests.
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This option enables BT_TICKER_SLOT_AGNOSTIC which eliminates
priorities and collision resolving in the ticker.
Event scheduling states are stored in the lll_hdr, and event priority
is passed from LLL implementation, and runtime priority calculated.
LLL implementation decides whether to program radio, start preemption
timer, and/or queue prepare in the prepare pipeline.
Event arbitration is made possible via the common LLL, but not yet
implemented in Nordic LLL.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Priority in the legacy stack has been unused and "work in progress" for
some time. With this commit, the priority passing/handling is cleaned
up, preparing for the new JIT scheduling priority handling.
Signed-off-by: Morten Priess <mtpr@oticon.com>