Zbus currently does only support default heap sizes.
The configuration option allows to decrease rom-footprint for embedded
applications. Adding the option to ZBus improves its flexibility and
while not increasing its complexity.
Add default of 0 value to compensate for previous cases where
HEAP_MEM_POOL_ADD_SIZE_ZBUS was defined as "".
Consistent naming 'Zbus'/'zbus' to 'ZBus'
Signed-off-by: Matthias Plöger <matthias.ploeger@phoenixcontact.com>
Adds a I2C+GPIO Target device binding for MCTP communication over I2C.
The binding requires an i2c bus and gpio pin, along with a specified I2C
and endpoint address pair. These are then used to create an MCTP binding
which can be used to communicate in a peer to peer manner among other
MCTP endpoints.
Each message transmit signals to the bus controller using a GPIO logical
high and is unset on transmission completion. Pending transmitters are
queued using a semaphore avoiding memcpy being needed to asynchronously
transmit mctp pktbufs.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds a custom MCTP binding for an I2C bus controller using GPIO signaling
for write requests rather than mode switching.
This binding operates a lot like the I3C binding specification DMTF has
for MCTP. The controller expects to receive interrupts (from GPIO pins)
and upon getting an interrupt read a message from the I2C target device.
The macro does a lot of the heavy lifting to setup all the state needed
for capturing GPIOs, being able to do asynchronous reads/writes, and
such. The entire controller works using state machines driven by
interrupts leading to low latency and clear ram costs.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Unfortunately libc malloc/free are wrapped with a sys_mutex which is
troublesome for mctp as we likely want to allocate from interrupts in many
cases.
Supply mctp with a dedicated heap initialized and assigned at boot
saving applications a step. The default size is quite small and works
well so long as messages are small.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Now in other mode rather than basic mode, configuration parameters
include MTU, Flush Time and QoS have been checked.
But in basic mode, they also need to be checked, so the code about this
should not be controlled by macro CONFIG_BT_L2CAP_RET_FC.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
Added bt_le_set_default_phy in hci. This handles
the HCI_LE_Set_Default_PHY HCI command.
Added call to bt_conn_le_set_default_phy in central_gatt_write and
peripheral_gatt_write samples.
Signed-off-by: Ravinder Singh <ravinder.singh2@infineon.com>
Add settings_its backend in order for a non-secure
Bluetooth application to be able to save Bluetooth
settings to persistent storage.
Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
- Add a new callback to support the situation when a unit info command is
received, and add an API to respond to the unit info command.
Signed-off-by: Make Shi <make.shi@nxp.com>
- Only AVRCP connect and disconnect api for AVRCP common functions.
- Added _ct prefixes to all CT callback functions and feature APIs.
- Updated shell demo code for AVRCP API changes.
Signed-off-by: Make Shi <make.shi@nxp.com>
It is not possible to build anymore in that mode, so we do not
need to support it in this driver cmake files.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
It is not possible to build anymore in that mode, so we do not
need to support it in this driver cmake files.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Coverity (CID 516253) reported that the return value of
initialize_tx_with_sid_disabled() was set but not used, leading to
potential silent failures.
Check if the return value is negative and propagate the error through the
existing cleanup path.
Fixes: CID 516253
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Offloaded socket implementations need to create the socket operations
vtable, therefore need access to struct socket_op_vtable. So far this
has been defined in a private header, so implementations needed to add
the header location to the include path in CMake.
Therefore, move struct socket_op_vtable definition to the internal part
of the public socket header, so it's no longer needed to include a
private header. This is also more consistent with the rest of the public
header content, as for example macros needed to register a socket
implementation are already there.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
for DEVICE_PM and DEVICE_PM_RUNTIME, ztest need
hold status like CONFIG_PM, otherwise the following
flash will be blocked for some SOC
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Both bt_le_adv_stop() and bt_le_adv_resume() were logging same
error message. Add aditional context to it so that logs are
distinguishable.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Correct not resetting compression extension,
when checking for an uncompressed file,
in case if compression is enabled, but no compressed file found.
Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
According to CoAP RFC (7252, ch. 4.2), Reset cannot be sent in a
response for an ACK reply, rejected ACKs should be silently ignored
instead. Therefore, in case an unrecognized response is received, verify
the response type before sending Reset.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The ieee802154_radio_send() function does not decrease reference counter
of the net_pkt, it's instead done one layer above in ieee802154_send().
This commit updates the mgmt functions using ieee802154_radio_send() to
always free the used net_pkt afterward.
Signed-off-by: Simon Piriou <spiriou31@gmail.com>
When received the valid S frame, the retransmission timer should not
be restarted if unacknowledged I-frames have been sent but the
retransmission timer has not elapsed.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix Tx Ack FIFO's first index being advanced beyond a
recorded ack_last value in a node_rx when under race
between ll_rx_get() being pre-empted while executing the
`tx_cmplt_get()` and a call to `ll_rx_put()` in an
interrupt service routine.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Bump the argc check from 3 to 4 as the shell scan command has 3 required
parameters, the last being the scan duration:
- argv[0]
- passive|active
- channels
- per-channel duration in ms
Signed-off-by: Simon Piriou <spiriou31@gmail.com>
Based on a discussion around P4WQ limitations for our application, it
was determined that the RTIO workqueue required the ability to use
additional threads from the pool in spite of work items blocked.
Since this is not covered, nor desired for the P4WQ, then remove this
dependency and re-implement it in a way that covers also this use-case.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
When the returned buffer is a `NULL` of the pull function, it means
there is not any data needs to be sent. However maybe there is any
frame pending on other L2CAP channel needs to be sent over the same
ACL connection.
Re-trigger the TX processor. It will call the pull function again
and the pending buffer will be pulled from following L2CAP.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The current logic will result in rsp always being accept because LOSC
added is 0. and according to the spec, LOSC should not be added to the
Set Configuration Reject response.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
It wasn't taken into account that bt_le_scan_set_enable()
has a return value. It's not likely that the controller
rejects the command when BT_DEV_SCANNING is set, however.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
Attempting this would fail (assuming the controller is implemented
correctly) because when using legacy commands it is not allowed to
change the device address while scanning.
It also did not make sense. If we have configured the scanner to use
the identity address as own_addr, because the advertiser and scanner
addresses are shared when using legacy commands, setting the adv NRPA
here would overwrite the identity address used by the scanner, which
I assume is not the intention.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
In 25c993e5b7 a new case was introduced
where own_addr_type is not set by bt_id_set_scan_own_addr properly.
This led to issues for users where increasing their zephyr version
led to failures to start scanning after advertising in the case where
CONFIG_BT_SCAN_WITH_IDENTITY=n and legacy advertising commands are used.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
When peer monitor and retransmission timeout are zero, set them to the
default values. This ensures that the monitor timeout is always a valid
value to avoid the L2CAP BR timer work queue hang.
Signed-off-by: Make Shi <make.shi@nxp.com>
HTTP 1.1 server has two ways of indicating the message body length -
either by providing the Content Length header, or by closing the
connection when the entire body has been transmitted.
The second method didn't work with Zephyr's HTTP client implementation,
as EOF on a socket was treated as an error condition. Therefore, if no
Content Length was provided by the server, such transfers would always
end up with ECONNRESET error.
In order to fix this, we need to notify the parser about the EOF on a
socket when connection is closed. It is the parser role to determine
whether the EOF was expected in current state (by marking end of message
flag) or not (by setting an error).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Remove duplicated check for 'ep->stream == NULL' to clean up conditionals
and avoid unnecessary repeated evaluations.
This cleans up the code and avoids unnecessary repeated condition
evaluation.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Update the socket_service_thread function signature to match the expected
k_thread_entry_t type:
typedef void (*k_thread_entry_t)(void *p1, void *p2, void *p3);
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Fix a bug in zbus_chan_rm_obs() where removing the first observer in a
channel's observer list would cause undefined behavior due to accessing
a member of a NULL pointer.
The issue occurred when prev_obs_nd was NULL (indicating the first node
in the list) and the code attempted to pass &prev_obs_nd->node to
sys_slist_remove(). This resulted in accessing the 'node' member of a
NULL pointer, which is undefined behavior even when taking its address.
The sys_slist_remove() function is designed to handle a NULL prev_node
parameter correctly for removing the first element in a list. The fix
ensures we pass NULL directly instead of attempting to compute the
address of a member within a NULL pointer.
This was detected by Undefined Behavior Sanitizer as "member access
within null pointer".
Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
In coap_well_known_core_get(), move the null check for 'resource' before
applying pointer arithmetic ('resource + 1') to avoid undefined behavior
when 'resource == NULL'.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Socket dispatcher (and offloaded implementations in tests) register
fd as ZVFS_MODE_IFSOCK therefore they should register a close2(
function instead of close().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
socketpair fd regsiters ZVFS_MODE_IFSOCK therefore it should register a
close2() function instead of close().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case address mode in a packet is none, the address pointer within mhr
struct will not be set. Therefore, the pointer should not be used before
address mode is verified inside ieee802154_check_dst_addr().
This was reported by UBSAN:
subsys/net/l2/ieee802154ieee802154.c:296:41: runtime error: member
access within null pointer of type 'struct ieee802154_address_field'
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Cast uint8_t variable to uint32_t explicitly to avoid implicit cast to
int, and thus potentially undefined behavior, reported by UBSAN:
net_pkt.c:1946:17: runtime error: left shift of 239 by 24 places
cannot be represented in type 'int'
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In order to avoid alignment issues when casting void pointers to
in(6)_addr structures, create a properly aligned copy of the ip(v6)
address on stack.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In order to prevent an overflow warning from UBSAN when bitshifting,
cast to uint64_t first before shifting, and then back to uint32_t.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As struct sockaddr have now alignment of 4 bytes, net_ipaddr_copy()
gives the following error if used for sockaddr:
error: alignment 1 of ‘struct <anonymous>’ is less than 4
[-Werror=packed-not-aligned]
Just use memcpy() instead, net_ipaddr_copy() was intended to use with IP
addresses, not socket related structs.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Rework the IPv4-related code to avoid casting. Use raw variants of
IPv4-related functions whenever possible (especially on the critical
data path).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To address the misaligned access issues reported by UBSAN, introduce raw
variant of certain IPv4 functions used in the critical data path of the
network stack, operating on plain uint8_t buffers in stead of IPv4
address struct.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>