The sync send state machine only releases a queued Sync in SEND_FUP
when its transmit timestamp arrives or when the port is disabled or no
longer asCapable. A timestamp can also be lost during a short link
outage that clears before asCapable does: the packet stays in SEND_FUP
forever, no Follow_Up is sent, and transmission stops even though the
port is still capable. This was observed on a node exchanging gPTP
with an Ethernet switch relay: after the peer was reset, the node's
sync send state machine was left waiting for a timestamp that no
longer existed while the peer kept transmitting.
Release the stalled packet and unregister its timestamp callback when
a fresh MDSync arrives in SEND_FUP, mirroring the port-disable path,
and send the fresh sample on the next pass instead of waiting
indefinitely. ef2580bc50 fixed the same stranding on the port-reset
path; this covers the case where the port stays enabled and capable.
The timestamp callback can still fire between the timestamp check and
the unregister, so also clear md_sync_timestamp_avail, as the
port-disable path does; otherwise the next Sync would get a Follow_Up
carrying the superseded packet's timestamp before it is transmitted.
A Sync whose timestamp is merely late, for example behind a long
transmit queue, is superseded the same way and its Follow_Up is not
sent. This is accepted as the trade-off: it costs one sample, and the
fresh one carries newer synchronization information, whereas waiting
for a timestamp that may never arrive stops Sync transmission entirely.
The state machine is exposed under CONFIG_ZTEST for a native_sim
regression suite that verifies the fresh sample supersedes the stalled
packet, that the packet stays pending when no fresh sample arrives,
and that peer loss still discards both. All three tests pass together
with the existing net.gptp.clock_update suite on native_sim/native/64.
Assisted-by: Oh-My-Pi:gpt-6-astra
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
The group record of an IGMPv3 report is a packed structure, and its
group address was written through a pointer taken straight to the
member. Clang rejects that, as the pointer may be unaligned:
error: taking address of packed member 'address' of class or
structure 'net_ipv4_igmp_v3_group_record' may result in an unaligned
pointer value [-Werror,-Waddress-of-packed-member]
GCC says nothing about this form, and the only build with IGMPv3
enabled was tests/net/igmp, which is limited to qemu_x86 and so never
built with clang.
Use UNALIGNED_MEMBER_ADDR() as the IGMPv2 message a little earlier in
the file already does for its own address field.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
virtiofs_send_receive() ignored the return value of
virtq_add_buffer_chain(). A failed enqueue would never invoke the
receive callback, leaving the caller blocked forever on the completion
semaphore and leaking the bounce buffer.
Check the return value, log the error and release the bounce buffer.
Split the request path into a checked helper that returns the error and
the existing wrapper for callers that validate the response length.
virtiofs_destroy() now uses the checked helper so an enqueue failure is
reported to fs_unmount() instead of being mistaken for a valid empty
FUSE_DESTROY reply.
Fixes#122024
Signed-off-by: Hongquan Li <hongquan.li@processmission.com>
Ignore ATEs that contain invalid data information when mounting the
filesystem.
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Jordan Yates <jordan@embeint.com>
Flatten the `zms_recover_last_ate` loop to reduce nesting in preparation
for additional ATE validation. No functional change.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The NUS TX CCC and RX characteristic accept writes on an unencrypted
link, and a bonded peer's stored subscription lets notifications go out
before encryption.
Add the BT_ZEPHYR_NUS_SECURITY choice to require encryption, or
encryption and authentication, for those writes and for notifications.
Encryption alone still admits a peer paired with Just Works. The
default is no requirements, and the secured options depend on BT_SMP.
Add tests/bluetooth/nus to check the attribute permissions.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
The servo runs the PI controller once per Sync message with the gains
of PRECISION_TIMING_PI_KP and PRECISION_TIMING_PI_KI, whose help says
they suit a Sync interval around one second. With a shorter interval
the loop gets slower and less damped: at the 0.125 s of the AES67 media
profile the loop gains per sample are one eighth of those at 1 s.
Add PTP_SERVO_SCALE_GAINS_BY_SYNC_INTERVAL. When it is set, the gains
are those for a 1 s interval and the servo divides them, through
precision_pi_update_interval(), by the time since its previous update,
measured on the Sync origin timestamps of the time transmitter. Lost
Sync messages and rejected samples then count, so the loop behaves the
same for any interval. The advertised interval is used when there is no
previous sample (first update, after a servo reset or a time transmitter
change) or the elapsed time exceeds 16 intervals. An elapsed time
shorter than 2^-10 s, the shortest Sync interval the port accepts, is
taken as 2^-10 s, so two close samples cannot multiply the gains by a
large factor. The advertised interval is limited to 2^-10 to 2^22 s, the
range the port accepts from Sync messages, because a management SET of
the interval can give any value from 2^-63 to 2^63 s. It is computed
with shifts, so the servo needs no function of <math.h>. The port passes
the interval it learns from the multicast Sync messages of its parent,
and resets it to PTP_SYNC_LOG_INTERVAL when the time transmitter
changes, since a new one may send unicast Sync messages, which do not
advertise it. The option is off by default, so the loop does not change
for existing configurations.
Tested on an i.MX RT1170 EVK locked to a Dante time transmitter with a
0.25 s Sync interval, gains 0.4 and 0.075 for 1 s (1.6 and 0.3 per
Sync), integral limit 150 ppm, output limit 47500 ppm, with the gains
scaled by the advertised interval, which equals the elapsed time while
no Sync is lost: the offset is below 1 us 3.75 s after the initial clock
step (11 s in an earlier run with the default gains), and in steady
state the median |offset| is 158 ns, maximum 704 ns over 3 minutes. The
elapsed-time scaling, the limit of the advertised interval and the reset
on a time transmitter change are covered by tests on native_sim.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
Let the clock servos of PTP and gPTP use the limits of the PI
controller. PRECISION_TIMING_PI_INTEGRAL_LIMIT_PPM bounds the integral
term, which holds the estimate of the oscillator frequency error, so a
limit a little above the oscillator tolerance stops windup.
PRECISION_TIMING_PI_OUTPUT_LIMIT_PPM bounds the rate correction; set
below the largest correction the clock driver accepts, a large offset
gives a correction at the limit instead of a request the driver
rejects, which makes the PTP servo reset.
Both default to 0, no limit, as before.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
The clock servo steps the clock above a fixed offset of 1 s and, while
locked, rejects samples above 100 ms. Both suit a network where any
time transmitter is far off, but an application that cares about its
phase, such as a media clock derived from the PTP time, wants to step
a much smaller offset instead of slewing it for seconds.
Add PTP_SERVO_STEP_THRESHOLD_MS and PTP_SERVO_OUTLIER_THRESHOLD_MS,
with the old values as defaults. The step check comes first for every
sample, so the outlier threshold cannot be set above the step threshold;
its default follows a step threshold below 100 ms.
The help text also says that an outlier threshold below the fixed 10 ms
lock window makes the servo lock, reject and reset in a cycle while it
converges.
Before the servo locks, offsets above 100 ms are stepped as well. That
bound stays fixed: it is an acquisition fast path and does not follow
the outlier threshold, so a lower outlier threshold does not make an
unlocked servo step smaller offsets.
A clock_wakeup scenario with an outlier threshold of 60 ms checks that
an unlocked offset of 80 ms is slewed and not stepped.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
A clock servo applies each output as a rate correction until the next
sample, so the loop gain per sample is the gain times the sample
interval. With fixed gains, the same controller is fast and lightly
damped at a long interval and slow at a short one, and the PTP stack
accepts Sync intervals from 2^-10 s to 2^22 s.
Add precision_pi_update_interval(). The gains are taken for an interval
of 1 and divided by the interval of the sample, so the loop keeps its
stability and damping whatever the sample rate is.
precision_pi_update() is the same with an interval of 1, so existing
users behave as before.
The new test runs a clock loop at a 0.25 s interval with a 66 ppm
oscillator error and a 40 ms initial offset: with both limits set the
offset converges and the integral term ends at the oscillator error
without ever leaving its limit.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
The PI controller accumulates the integral term without bound. When a
clock servo sees a large offset for a while, for example after boot or
after a time transmitter change, the integral term winds up, and the
servo overshoots for a long time or asks the clock for a rate it
rejects.
Add precision_pi_set_limits(). The integral term is held within its
limit. The output is held within its limit, and while it is at the
limit the integral term keeps its value instead of moving further
towards it (conditional integration). Recomputing the integral from
the limited output instead would push it to the opposite sign when
the proportional term alone exceeds the limit, and lose the estimate
of the steady-state output, which for a clock servo is the frequency
error of the local oscillator.
Both limits are 0 after precision_pi_init(), which disables them, so
existing users behave as before. The API version goes to 0.2.0.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
Introduce linux-compatible HBLANK and VBLANK properties for use with Linux
in order to insert extra padding at the end of rows/lines.
Signed-off-by: Josuah Demangeon <me@josuah.net>
struct bt_dev carried the list of connections with something to send in
builds that have neither connections nor ISO, and the legacy advertiser,
or the pointer to the reserved advertising set, in builds without the
broadcaster role. Nothing refers to either there: the code that does is
only built with those features. Leave the members out as well.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The buffers of the HCI RX pool reserve user data for the connection
metadata of received ACL and ISO data. Received ISO data has buffers of
its own whenever the Host can receive it, see bt_iso_get_rx(), and any
other ISO data is dropped before its metadata is written, so only ACL
data needs the metadata here. Builds without connections, an observer
or an ISO broadcaster for instance, only ever receive events in these
buffers, which have no metadata. Give those builds buffers without user
data, which saves four bytes per buffer.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
A build without CONFIG_BT_ISO_RX sets up nothing to receive ISO data,
but a controller can still send it. Such a packet gets a buffer of the
general RX pool from bt_buf_get_rx(), and hci_iso() writes its metadata
into the user data of that buffer right after parsing the header. Drop
the packet instead.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The table of L2CAP channel callbacks that every ATT channel points to
is never written, and the channel refers to it through a pointer to
const, but it was a writable static and so took 40 bytes of RAM.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Every advertising set carries a 48-byte delayable work item whose only
use is to stop advertising that bt_le_adv_start() was given with the
BT_LE_AD_LIMITED flag. Applications that never advertise in limited
discoverable mode pay for it all the same.
Add CONFIG_BT_LIM_ADV, enabled by default, and build the timer only
with it. Without it bt_le_adv_start() refuses advertising data that has
the flag, as nothing would end the mode in time.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
No caller uses the result of cancelling the limited advertising timeout,
so the function no longer returns it and the callers drop their casts.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The network shell currently contains context inspection code that
assumes network contexts are available. This prevents using the shell
when network context support is disabled.
Guard context-dependent connection and UDP shell functionality while
keeping disabled commands available to report how to enable the
missing functionality. Gate ARP shell commands on ARP support instead
of Ethernet L2, and compile per-context packet pool inspection only
when that feature is enabled.
Signed-off-by: Andrei-Edward Popa <andreip@axonne.com>
Ethernet L2 can be used without enabling IPv4 or IPv6. Such
configurations still require the packet infrastructure, but do not
require network contexts.
Introduce NET_CONTEXT as the explicit switch for network context
support and build net_context only when it is enabled. Update TCP,
socket and offload dependencies accordingly.
Build net_pkt independently of net_context. Allow Ethernet L2 as the
highest enabled packet protocol and avoid reserving ICMP header space
when the IP stack is disabled.
Signed-off-by: Andrei-Edward Popa <andreip@axonne.com>
The in-memory backend keeps the dump in RAM so that it can be read
after a warm reboot. With a write-back data cache, the dump or the
cleared canaries can still be in the cache at reset and get lost: a
new dump goes missing, or an erased dump is reported as valid again.
Flush the data cache once the dump is written and when it is erased.
The end canary commits the dump: write back the header and the used
part of the buffer first, then write and flush the canary, so that a
reset during the write-back cannot leave a partial dump marked valid.
-ENOTSUP (no data cache under Zephyr control) and -EAGAIN (data cache
disabled) leave nothing to write back and are not errors. Other flush
errors are logged. A new dump is not written if the old one cannot be
invalidated, and not committed if it cannot be written back. The
erase and invalidate commands return the error.
Tested with the in_memory scenario of tests/subsys/debug/
coredump_backends on qemu_cortex_m3, which has no data cache, also
with the flush forced to fail, and on nrf54h20dk/nrf54h20/cpuapp.
On nrf54h20dk/nrf54h20/cpuapp, a dump written before a pin reset was
found after it 5/5 times, and a dump erased before a pin reset stayed
erased 5/5 times. Without this change, the dump was lost 5/5 times
and an erased dump came back 3/3 times.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Victor Brzeski <vbrzeski@gmail.com>
The plan carries three default channels at 922.1, 922.3 and 922.5 MHz,
DR0 to DR5 on 125 kHz, and RX2 on 921.9 MHz at DR0. DR12 and DR13 arrived
with RP002-1.0.5 and are optional, so they are left out; the band defines
no FSK datarate at all.
Two things set it apart from the region already here. It reaches the
medium by listening before it talks rather than by holding to a duty
cycle, so record_tx() has nothing to remember and neither selector ever
has to make the caller wait. And a channel below 922 MHz is capped at
10 dBm however much power the network asked for, which the network can
reach by adding a channel there. Both go through the callbacks the
previous two commits added.
The band asks for room for 24 channels rather than the 16 EU868 needs,
and its ChMaskCntl splits those into banks rather than addressing one
fixed set, so a LinkADRReq is resolved against the bank or the block of
eight that the control field selects.
RP002 sets no listen-before-talk numbers for this band, saying instead
that it has no default settings of its own, so the threshold and listen
time come from Korean radio regulation.
A CFList of type 1 is not read. The plan is dynamic, so the band has no
use for a channel mask there, and the reference stack ignores that type
for this band as well.
The optional DR12/DR13 pair RP002-1.0.5 adds is absent, so a network
offering either gets the DR0-DR5 behaviour.
Listening is not optional here. Korean regulation allows either a duty
cycle or listen-before-talk, but RP002-1.0.5 3.11.2 says the band
"exclusively uses the LBT channel access rule", so a device that cannot
listen has no channel access rule left at all. The region therefore
depends on those rather than offering itself and failing later.
Signed-off-by: JaeHwan Jin <jaehwan.jin@rakwireless.com>
get_tx_params() maps a datarate and a power index onto a power in dBm,
and never sees which channel the frame is going out on. That is enough
where one EIRP limit covers the whole plan, but not where the limit
changes partway across the band, because the network can add a channel
on either side of the split.
Let a region lower the power for the channel in hand, right before the
frame goes out. EU868 leaves the callback NULL and is unaffected.
Signed-off-by: JaeHwan Jin <jaehwan.jin@rakwireless.com>
The stack keeps the air clear by holding to a duty cycle, which is what
EU868 needs and the only thing the region interface can express. Other
plans listen before they talk instead, and there is nowhere to say so.
Let a region hand back the width to measure, an RSSI threshold and a
listen time for a channel, and say how many further channels to draw when
one is busy. Selection draws at random, so the MAC listens on the channel
it drew and, where the channel is busy, draws again up to that many times
before reporting that it found nowhere to send.
The width is named separately from the channel because the bands that ask
for this measure a slice wider than the channel they are clearing, so the
datarate's own bandwidth is not what the listening is done over.
EU868 leaves the new callback NULL and is unaffected.
Listening needs a GFSK modem and an RSSI read, which not every driver
exposes, so LORA_HAS_GFSK_MODEM and LORA_HAS_RSSI mark the ones that do
and the SX126x driver selects both. A region that reaches the medium this
way depends on them, and so drops out of a build whose radio cannot scan
rather than failing at the first send.
Signed-off-by: JaeHwan Jin <jaehwan.jin@rakwireless.com>
Drop or shorten the comments which are not necessarily needed.
Drop the Doxygen markers from the static symbols of the dump,
which are not part of the API.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Add support for multi-instance players by keeping a table of players
sized by CONFIG_MPIPE_PLAYER_NUM (default 1), one worker stack per slot.
A pipeline that has a player already is refused with -EBUSY, a full table
with -ENOMEM. The single zbus listener is attached to every player's
channel and finds the player through the channel's user data.
A player is named by its pipeline's id. Every shell command takes that
id as an optional argument and acts on every player without one, so a
single-player application types nothing new.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
Stream DSP logs to the host over ACP DMA channel 9. In deferred mode,
wait for channel 9 to go idle on panic before flushing so a mid-transfer
restart cannot drop the dump.
Signed-off-by: DineshKumar Kalva <DineshKumar.Kalva@amd.com>
Enables configurability of CTF timestamp getter to allow synchronization
of different SoCs using shared clock.
Signed-off-by: Andrii Chmutov <achmutov@antmicro.com>
Signed-off-by: Maciej Torhan <mtorhan@antmicro.com>
Use LOG_BACKEND_EVT_PROCESS_THREAD_START/DONE to take the UART device
runtime PM reference once per processing burst instead of calling
pm_device_runtime_get()/pm_device_runtime_put_async() for every
char_out() call. The UART can then be suspended as soon as the log
processing thread has no pending messages.
When the log processing thread is not used (immediate mode or
CONFIG_LOG_PROCESS_THREAD=n) the events are not emitted, so
char_out() keeps taking the reference itself.
Signed-off-by: V Sowbaranic Raj <industriesnic@gmail.com>
Add LOG_BACKEND_EVT_PROCESS_THREAD_START which is emitted by the
log processing thread before it starts processing pending messages.
Each START event is followed by exactly one
LOG_BACKEND_EVT_PROCESS_THREAD_DONE event, so a backend can use the
pair to hold a resource (e.g. a device runtime PM reference) only
while messages are being processed.
DONE was previously not emitted when only one message was processed,
because log_process() returns false after processing the last
pending message. It is now emitted after every processing burst.
Signed-off-by: V Sowbaranic Raj <industriesnic@gmail.com>
The host never writes Connection_Accept_Timeout, so an incoming BR/EDR
connection request that the host does not answer in time is rejected by
the controller after whatever its default happens to be. Program it from
Kconfig in common_init(), once the supported commands have been read.
HCI_Write_Connection_Accept_Timeout is reported by Supported_Commands
octet 7 bit 3, so only write it when the controller claims it and leave
the controller default in place otherwise. A failure of a command the
controller does advertise is treated as fatal, like the other writes in
common_init().
The controller applies the same parameter to LE CIS requests (Core
Specification 6.3, Vol 4, Part E, Section 6.7), but if the application's
accept callback in hci_le_cis_req() has not returned by the time it
expires, the controller rejects the request on its own and the host then
sends its accept for a request that is already gone, so the option is
not offered when BT_ISO_PERIPHERAL is enabled.
The range is the mandatory one from that same section rather than the
full 0x0001-0xb540: a controller need not accept anything below 0x00a0.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Zhijie Zhong <zhongzhijie1@xiaomi.com>
Enables usage of multiple CTF streams. Now each event is packed into a
packet which contains stream ID. This increases number of bytes per event
by 4 (2 bytes for packet size and 2 bytes for stream ID).
Signed-off-by: Mikolaj Klikowicz <mklikowicz@antmicro.com>
Signed-off-by: Maciej Torhan <mtorhan@antmicro.com>
Add validation checks to ensure that L2CAP LE operations are only
performed on LE connections. The changes prevents potential
out-of-bounds access to the `le_cid_index_next` array when using the
ACL connection index in cases where the caller fails to verify that the
ACL connection type is LE.
The validation is added to following two functions, including
`bt_l2cap_ecred_chan_connect()`, and `bt_l2cap_chan_connect()`. Each
check logs a message and returns `-EINVAL` when an invalid conn type
is detected.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Optimize the L2CAP LE dynamic CID allocation by using a per-connection
counter to track the next CID to allocate instead of always starting
from the beginning of the range.
The change introduces a `le_cid_index_next` array that maintains the
position of the next CID index to allocate for each connection. The
allocation now searches from the last allocated position through the
range, wrapping around if needed. This reduces the search time for
available CIDs in scenarios with multiple active channels by avoiding
repeated scans of already-allocated CIDs at the start of the range.
Additionally, this modification has the advantage of delaying the
reassignment of a recently disconnected CID to a new channel. This makes
it less likely that data from the channel disconnection process is sent
to the newly assigned channel. Note that it is not a guarantee: if the
cursor happens to point at the index of a CID whose channel has just
been freed, the next allocation still returns that CID immediately.
The allocation still validates that CIDs are not in use by checking
against `l2cap_le_lookup_rx_cid()` before assignment, maintaining the
same correctness guarantees as the previous implementation.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a server side implementation of the HID Service (HIDS), the GATT
service that the HID Device role of the HID over GATT Profile is built
on.
The GATT attribute table is static: the number of Report characteristics
of each type is build time configuration, and the application supplies
one Report ID per characteristic when it registers the service. Provided
are a configurable Report Map, Input, Output and Feature Reports, HID
Information and the HID Control Point, which are the characteristics
the HID Service makes mandatory for a Device that supports Report
Protocol Mode only.
Properties:
- The HID Service sets no security requirements of its own, so the
security the characteristics require is a build time choice:
CONFIG_BT_HIDS_SECURITY_NONE, _ENCRYPT or _AUTHEN. ENCRYPT, what the
HID over GATT Profile requires, is the default when SMP is enabled.
- The service keeps no per-connection state. A HID Control Point
command is passed to the application with the connection it came
from; an unknown command is rejected.
- The CCC descriptors are left to the GATT core, which refuses the
indication bit for these notify only characteristics. An application
learns whether a Host is subscribed from the return value of
bt_hids_send_report().
- Notifications through bt_gatt_notify_cb() with an optional completion
callback. The API documents every error value it returns.
- The Report Map and the callback structure are referenced, not copied.
- The API is thread safe: a mutex serializes it with the GATT handlers,
and is released before an application callback runs and before a
notification is sent. A rejected registration leaves no state behind.
A GATT handler that waited for the mutex while the service was
unregistered answers Invalid Handle instead of using the cleared
state.
- The service holds the value of every Report and answers a Host read
from it, the way the other GATT services in the tree do, so every
fragment of a read comes from that one value rather than from a
per-read copy that could go stale. The application sets the value
with bt_hids_report_set() and reads it back with bt_hids_report_get(),
and a Host write to a writable Report replaces it as well.
- A Host write longer than CONFIG_BT_HIDS_MAX_REPORT_LEN is rejected,
which makes that option an upper bound in both directions.
- Register time validation of the Report Map length, of the HID
Information flags, of bcdHID being binary coded decimal, and of the
Report IDs: no duplicates within a Report Type, and no Report ID of 0
when the Report Type has more than one Report characteristic. A flag
the service cannot back, such as the one that announces the HID SCI
feature, is rejected rather than exposed to the Host.
Not supported yet: Boot Protocol Mode, that is the Protocol Mode
characteristic and the Boot Keyboard and Boot Mouse Report
characteristics, which the HID Service makes mandatory for a keyboard
and for a mouse, and several HID Service instances for composite
devices.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Adjust spacing and alignment in the status, virtqueue ID and role
macros to satisfy the clang-format compliance check.
Assisted-by: OpenCode:gpt-6-astra
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Num_desc can only take values that are powers of 2 lower or equal to
32768. Therefore it is not necessary to check all numbers of
descriptors.
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Add a Kconfig option for tracking if the architecture has nocache
mempartition support. This option being true the
`K_MEM_PARTITION_*_NOCACHE` defines can be used.
Signed-off-by: Zee Yudenko <zyudenko@internships.antmicro.com>
When a receive times out after copying part of a frame,
websocket_recv_msg() returns the payload bytes but leaves remaining
and message_type unchanged. Callers cannot reliably determine the
frame type or how much data is left.
Update both output parameters before returning a partial payload on
EAGAIN, as already done for a complete frame or a full receive buffer.
Add a regression to the existing websocket tests that splits a masked
frame across two receives. Check metadata and unmasking after the
partial read, and verify the rest of the frame can be received
correctly.
Assisted-by: Codex:gpt-6
Signed-off-by: Dmitrii Sidin <rus084@bk.ru>
z_vrfy_net_addr_ntop() formats the address into a local buffer and
copied MIN(size, sizeof(str)) bytes of that buffer to the caller. This
includes the bytes after the terminator, which the formatting never
initializes, while z_impl_net_addr_ntop() called from kernel mode writes
the string and its terminator only.
Copy the string and its terminator, still bounded by the caller's
buffer size.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Since commit eeef8ad2b1 ("Bluetooth: Host: rotate NRPA"), an
advertiser started with BT_LE_ADV_OPT_USE_NRPA gets a new NRPA at every
RPA timeout when CONFIG_BT_PRIVACY is enabled. This only works with the
extended advertising commands, where adv_enable_rpa() refreshes each set
with its own options. le_update_private_addr() refreshes the legacy
advertiser with bt_id_set_private_addr(), which always creates an RPA,
so from the first timeout on the legacy advertiser used an RPA.
Refresh an enabled legacy advertiser that uses an NRPA with
bt_id_set_adv_private_addr(), as adv_enable_rpa() does. A scanner
running at the same time shares the legacy random address, so it gets
the new NRPA too.
Tested on native_sim with a test HCI driver that logs LE Set Random
Address: the legacy advertiser now gets a new NRPA at each timeout,
and RPA advertising and scanning still rotate RPAs.
Fixes#122891
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
With the legacy advertising commands, the advertiser, the scanner and
the initiator share the random address. With CONFIG_BT_PRIVACY, the
scanner and initiator paths call bt_id_set_private_addr() to set an
RPA there. While an advertiser started with BT_LE_ADV_OPT_USE_NRPA is
enabled, the RPA is not valid, and the controller rejects LE Set Random
Address while legacy advertising is enabled (Core v6.3, Vol 4, Part E,
7.8.4). bt_le_scan_start() and bt_conn_le_create() then fail with
-EACCES.
Store the options in adv_start_legacy() so that this case can be told
apart. A scanner then uses the advertiser's NRPA, which Vol 3, Part C,
10.7.4 allows for active scanning. Connection creation fails with
-EINVAL, since a privacy-enabled Central shall use an RPA as the
initiator's address (10.7.2). The new bt_id_conn_random_addr_check()
rejects it before bt_conn_le_create() can start resolving the peer's
address in the Host, so the error is not reported later from the scan.
bt_le_oob_get_local() also fails with -EINVAL, as it cannot refresh
the RPA in that case.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
The Host drops a periodic advertising report that it cannot reassemble,
one in fragments without CONFIG_BT_PER_ADV_SYNC_BUF_SIZE or one that
does not fit the reassembly buffer, and marks the report truncated until
its last fragment. Only a fragment with the Complete data status ended
the dropped report, but the Controller ends a report with the Incomplete
data status when it fails to receive the rest of it. The Host then took
the next report for the end of the dropped one and dropped it as well.
Without a reassembly buffer, a report with the Incomplete data status on
its own started a dropped report.
End a dropped report on the Incomplete data status as on the Complete
one, and without a reassembly buffer, start one only on the Partial
data status.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
dummy_send() returns the length of the sent packet, and net_if_tx()
adds that length to the interface's sent bytes. Commit 82b43d50ea
("net: l2: dummy: Update sent statistics") made dummy_send() add it as
well, so every interface using the dummy L2, the loopback interface
among them, reports twice the bytes it has sent.
Remove the update from dummy_send() and leave it to net_if_tx(), as
the other L2s do. The net_stats.h include and the include directory
that came with it are no longer needed.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
net_context_packet_received() checks recv_cb under the context lock,
but reads it again after releasing the lock. A concurrent call to
net_context_recv() can clear the callback in between, causing a NULL
function pointer call for a packet already accepted for delivery.
Copy the callback while holding the lock and invoke that copy after
unlocking. Keep the existing unlocked callback invocation and the
user data passed with the packet.
Assisted-by: Codex:gpt-6
Signed-off-by: Dmitrii Sidin <rus084@bk.ru>
The static filesystem handlers built both the file name and the content
type from the whole request target, including the query string. A
request such as "GET /index.html?v=1" was matched to the resource, as
resource lookup already stops at '?', but the handler then looked for a
file named "index.html?v=1" and answered 404. The content type lookup
compared the extension against the end of the query string as well.
Use the path length without the query string in the HTTP/1, HTTP/2 and
HTTP/3 handlers and in the content type lookup. The existing helper
used by resource lookup is made available to the handlers for this.
Add HTTP/1 and HTTP/2 tests that request a static fs file with a query
string. Both fail without this change and pass with it on
native_sim/native/64. The HTTP/3 handler has no static fs test; the h3
test suite builds and passes.
Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@amazeng.com.tr>
The net shell events monitor sizes its own message queue with
CONFIG_NET_MGMT_EVENT_QUEUE_SIZE. Commit c1204affab ("net: ip:
net_mgmt: Support system work queue and synchronous callbacks") made
the option depend on NET_MGMT_EVENT_QUEUE, which
CONFIG_NET_MGMT_EVENT_DIRECT does not enable, so the monitor stopped
building in that mode:
events.c:54:61: error: 'CONFIG_NET_MGMT_EVENT_QUEUE_SIZE' undeclared
Define the option also when the monitor is enabled. Its default of 16
with the monitor and the advice in the monitor help to raise it then
apply in every mode.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
z_log_init() asserts that the number of backends is less than
LOG_FILTERS_MAX_BACKENDS. That macro is the maximum number of backends
supported, so the count should be allowed to equal it. Because of the
off-by-one, an application with the maximum number of backends (9, or
8 with CONFIG_LOG_FRONTEND) fails at boot when CONFIG_ASSERT=y, even
though every backend has a valid runtime filter slot.
The check was correct until commit b819b51fe7 ("logging: Add support
for runtime filtering in frontend"), which switched the limit from
LOG_FILTERS_NUM_OF_SLOTS to LOG_FILTERS_MAX_BACKENDS but kept "<".
The failure is also hard to diagnose. The fatal error handler calls
LOG_PANIC(), which re-enters z_log_init() and hits the same assert, so
the system loops on the assert and never reaches main().
Change "<" to "<=".
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Beningo <jacob@beningo.com>