Commit graph

21541 commits

Author SHA1 Message Date
Andrzej Kaczmarek
e2cd879539 Bluetooth: Controller: Store parent lll struct in aux context
We use 1st node enqueued in aux context to retrieve lll scan/sync
struct, but that only works if we buffer PDUs in aux context. It's
better to store parent lll struct as explicit member in aux context
as this also works if we skip buffering.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-08-27 11:46:31 -04:00
Andrzej Kaczmarek
17a2e3a4ba Bluetooth: Controller: Add chain scanning for per adv
This adds complete support for scanning for periodic advertising trains.

AUX_SYNC_IND is always scheduled from ULL as usual, then code for aux
scanning is reused to allow for AUX_CHAIN_IND scanning scheduled from
both ULL and LLL, depending on AuxPtr.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-08-27 11:46:31 -04:00
Andrzej Kaczmarek
103bdb43ef Bluetooth: Controller: Simplify aux flush
aux->rx_last cannot be NULL since it's always set after acquire to a
valid node so the flow in flush() can be simplified.

rx parameter is only used to update PDU chain, then it's overwritten,
so we can instead update PDU chain in caller since there's only one
place when this should happen.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-08-27 11:46:31 -04:00
Andrzej Kaczmarek
ee0f93a9c3 Bluetooth: Controller: Fix aux scanning with mixed ULL/LLL sched
We should decide on flush immediately vs. from disabled_cb based on
ull_hdr reference count instead of last rxd node - if ull_hdr has
non-zero ref, then done event is still pending and we should flush
from there.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-08-27 11:46:31 -04:00
Andrzej Kaczmarek
a80f5b2081 Bluetooth: Controller: Set default HCI event size with per adv
Periodic advertising reports can have 255 bytes of payload so need to
use that value by default if periodic advertising is enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-08-27 11:46:31 -04:00
Emil Gydesen
8490508b59 Bluetooth: ISO: Make ISO/ACL bt_conn pointers clear in ISO API
Update the name of the bt_conn pointers to make it clear
whether the connection pointers are ACL or ISO connections.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-27 11:46:07 -04:00
Emil Gydesen
ecb265be36 Bluetooth: ISO: Clear up ACL/ISO bt_conn pointer names
Make the name of the internal bt_conn pointers explicit as to
whether they point to an ACL or ISO bt_conn.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-27 11:46:07 -04:00
Emil Gydesen
d8d8d82f0e Bluetooth: ISO: Add ISO limits as #defines and use them
Add #define's for ISO HCI limits and use them to validate
input parameters.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-27 09:34:43 -04:00
Vinayak Kariappa Chettimada
50280c67cf Bluetooth: Controller: Ignore PDU with RFU field set
Ignore received Extended Advertising PDU with RFU field set
in the Common Extended Advertising Payload Format of the
PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
41ed5b2173 Bluetooth: Controller: Use defines to access hdr_data fields
Use defines to access hdr_data fields used by interfaces to
populate the Common Extended Advertising Payload Format in
the PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
e976a146d2 Bluetooth: Controller: Use define for channel map size
Use a defined for channel map size of 5 octets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
cf3b04534e Bluetooth: Controller: Periodic Adv Review Rework
Changes addressing Periodic Advertising and Synchronization
Channel Map Update Indication feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
e5d93d5757 Bluetooth: Controller: Use helper function to check instant past
Use a helper function to check at instant or past to apply
the channelMapNew.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
bb51848b93 Bluetooth: Controller: Use defined for event instant and latency max
Use defines for event instant and event instant latency
maximum values of 65536 and 32767 respectively.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
b76070d57a Bluetooth: Controller: Periodic Sync with Chan Map Update Indication
Added implementation in Periodic Advertising Synchronization
to support Channel Map Update Indications present in the
ACAD fields of the AUX_SYNC_IND PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
fbc7cafaf5 Bluetooth: Controller: Periodic Advertising Chan Map Update Indication
Added implementation to perform Periodic Advertising Channel
Map Update Indication as a Broadcaster.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 09:34:16 -04:00
Vinayak Kariappa Chettimada
c5e077c48f Bluetooth: Controller: Make node rx release code conditionally reusable
Make the block of code that is used to release node rx with
type NODE_RX_TYPE_RELEASE to be conditionally available for
other Kconfig selectable features like Extended Scanning.

Previously it was only available for CONFIG_BT_CONN, but now
Extended Scanning with LLL scheduling releases node rx when
radio event is closed due to failure to receive an auxiliary
PDU.

Relates to commit 2feffaf719 ("Bluetooth: Controller:
Release LLL scheduling aux on incomplete data").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:47:42 -04:00
Vinayak Kariappa Chettimada
fa02dc4d02 Bluetooth: Controller: Fix missing reset of connection handle
Fix missing reset of connection handle in the LLL context.
During a central connection, if LL reset is called, then
disabled connection context's handle has to be reset
otherwise new connection creation will fail by detecting
that there exists a connection to same peer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:47:21 -04:00
Vinayak Kariappa Chettimada
19099fc980 Bluetooth: Controller: Use define for invalid LLL context handle
Use a define for invalid LLL context handle instead of
0xFFFF magic value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:47:21 -04:00
Vinayak Kariappa Chettimada
631cc825da Bluetooth: Controller: Add same peer connection check to initiator
Add implementation to initiator to check and reject
connection requests to already connected peer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:47:21 -04:00
Vinayak Kariappa Chettimada
1c564e750b Bluetooth: Controller: Use id addr type to check same peer connection
Store and check device identity addr type of public or
random.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:47:21 -04:00
Vinayak Kariappa Chettimada
22a48e502e Bluetooth: Controller: Minor rename of disabled callback functions
Minor rename of Connection ISO disabled callback function
names.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:46:55 -04:00
Vinayak Kariappa Chettimada
f06ac2be2c Bluetooth: Controller: Fix LLL events pending check from ULL Low
ULL reference count is checked in ULL_LOW context to decide
if LLL events are pending, but the reference count can be
decremented by the ULL HIGH execution context which can
prevent the set `disabled_cb` function not being called due
to no pending event to produce the done events.

Fixed by checking the reference count in the ULL HIGH
execution context using a mayfly to schedule the check.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:46:55 -04:00
Vinayak Kariappa Chettimada
d2be89d725 Bluetooth: Controller: Use consistent naming for ticker op callbacks
Use consistent naming for ticker operation callback
functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-27 06:46:55 -04:00
Carlo Caione
0c2dabb4b9 ipc: rpmsg_multi_instance: Rework instance tracking
This patch is the first step to make the rpmsg_multi_instance usable in
a multi-core scenario.

The current driver is using a local driver variable (instance) to track
the number of allocated instances. This counter is practically used to
allocate to the instance the correct portion of the shared memory.

This is fundamentally wrong because this is assuming that it does exist
only one single shared memory region to split amongs all the allocated
instances.  When the platform has more than one core this is obviously
not the case since each couple of cores are communicating using a
different memory region.

To solve this issue we introduce a new struct rpmsg_mi_ctx_shm_cfg that
is doing two things: (1) it's carrying the information about the shared
memory and (2) it's carrying an internal variable used to track the
instances allocated in that region. The same struct should be used every
time a new instance is allocated in the same shared memory region.

We also fix a problem with the current code where there is a race
between threads when accessing the instance variable, so this patch is
adding a serializing mutex.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-08-27 06:44:08 -04:00
Carlo Caione
66fb1bc2bc ipc: rpmsg_multi_instance: Use only rpsmg_mi_ctx_cfg for configuration
For the instance configuration the rpmsg_multi_instance code is
currently using a set of configuration info coming from two different
sources: the rpsmg_mi_ctx_cfg struct and Kconfig.

This is not only confusing but it's preventing to configure the
instances using information not coming from Kconfig (for example if we
want to configure the instance using DT).

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-08-27 06:44:08 -04:00
Daniel Leung
c3abd7a383 demand_paging: add a flash-based backing store for qemu_x86_tiny
This adds a flash-based backing store for qemu_x86_tiny board for
testing demand paging. This allows us to test code execution where
.text section is not in physical memory at boot.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Pavel Vasilyev
cd294c12c3 tests: Bluetooth: Mesh: Verify that all stored mesh entries removed
This ensures that all mesh settings were removed from persistent storage
after node reset.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-08-26 14:04:38 -04:00
Joakim Andersson
334369ab44 Bluetooth: host: Fix dereference before null check
Fix dereference before null check in att.c

Fixes: #37947

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-26 13:57:16 -04:00
Vinayak Kariappa Chettimada
2e9f6d0201 Bluetooth: Controller: Remove unused PDU size defines
Remove unused legacy PDU size extra defines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-26 13:42:41 -04:00
Vinayak Kariappa Chettimada
af41a508d6 Bluetooth: Controller: Fix radio packet size for Extended Scanning
Fix maximum radio packet size configuration to use 255 bytes
for Extended Scanning and Periodic Synchronization.

Add a Kconfig option so that application can reduce RAM
usage if a specific user scenario can live with smaller PDU
receptions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-26 13:42:41 -04:00
Vinayak Kariappa Chettimada
d3bda1dc06 Bluetooth: Controller: Minor rearrange rx packet set after radio config
Minor rearrange of rx packet set statements after radio
configuration function calls.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-26 13:42:41 -04:00
Piotr Pryga
2897870fa5 Bluetooth: controller: Fix aux ptr offset calculation for S2 Coded PHY
In the calculation of auxiliary PDU offset for periodic advertising
AUX_CHAIN_IND PDUs there were used old macro that was removed.
The code didn't compile.
Also there were no support for S2 Coded PHY in the offset calculation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-08-26 13:14:38 -04:00
Emil Gydesen
4bd326d6c9 Bluetooth: ISO: Remove use of conn->channels for ISO
The channels list were originally meant to be used
for multiple bt_iso_chan per iso connect (bt_conn), but
that is not the case for the current API, and won't be
going forward, so the use of the list has been removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 13:14:22 -04:00
Yuval Peress
ab6e724ab4 emul: espi: Add ACPI Shared Memory functions
Add the bare minimum to set and access the ACPI shared memory via the
eSPI emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-26 13:14:05 -04:00
Emil Gydesen
51f2022f7b Bluetooth: Audio: Add initial server values in bt_vcs_register_param
Add support for setting initial values in bt_vcs_register_param
when registering a VCS service

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 09:13:58 -04:00
Grixa Yrev
6a8abcb225 usb: cdc_acm: trigger TX IRQ when CDC ACM class is ready
Before commit 4f2682bd79
("usb: cdc_acm: avoid spurious interrupt on configured or resume
events") spurious rx-interrupt provided start to read shell tx ring
buffer by CDC ACM UART. Now shell log backend not transmit data,
until CDC ACM UART received data from host.

This PR added invoking interrupt callback if tx interrupt is enable,
when CDC ACM class go to configured state, and flag tx_ready go to true.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2021-08-26 09:13:42 -04:00
Sigvart Hovland
bcbc53015d dfu: boot: Add implementation for multi-image swap type check
Adds multi-image implementations for checking swap type based on image
index.

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
2021-08-26 09:13:13 -04:00
Emil Gydesen
9341a3d50c Bluetooth: ISO: Add NULL check in bt_iso_big_sync
Verify that the ISO channels supplied by the caller
are non-NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 09:12:47 -04:00
Emil Gydesen
581d07e494 Bluetooth: ISO: Add NULL check in bt_iso_big_create
Verify that the ISO channels supplied by the caller
are non-NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 09:12:47 -04:00
Emil Gydesen
06ebe239c1 Bluetooth: ISO: Add NULL check in cleanup_big
In case that creating a BIG fails due to missing
ISO channel, cleanup_big would try to access a
NULL pointer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 09:12:47 -04:00
Luc Viala
19c519eb05 modbus: copy trans_id & proto_id to response header
Copy Transaction and Protocol Identifiers to response header.

Signed-off-by: Luc Viala <luc.viala19@gmail.com>
2021-08-26 06:56:25 -04:00
Vinayak Kariappa Chettimada
2f38c522fd Bluetooth: Controller: Remove ULL header include in LLL
Do not include ULL header in LLL, instead values and fields
required in LLL shall be declared in LLL contexts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-26 06:55:43 -04:00
Markus Fuchs
b852bdd816 fs: fat_fs: Fix fs_statvfs when using variable sector sizes
The fs_statvfs function assumes FatFs is configured for a fixed sector
size and therefore may return wrong sector sizes when it is configured
for variable sector sizes instead. Fix that by returning the ssize
variable given in the file system object structure.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2021-08-26 06:53:57 -04:00
Flavio Ceolin
3c0e7ade99 tracing: Add k_work_queue_init info
Add tracing information for k_work_queue_init

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 22:07:04 -04:00
Flavio Ceolin
4960a9aa7a pm: device_runtime: Fix possible underflow
The runtime API is referenced count and uses a uint32_t.
Avoid underflow when dealing with put requests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 19:40:17 -04:00
Flavio Ceolin
93ae6e930a pm: device_runtime: Fix return values
Return 0 in cases where the request does not trigger a device state
change, only incremented or to decremented the reference count.

Fixes #37821

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 19:40:17 -04:00
Vinayak Kariappa Chettimada
43d8d34dc4 Bluetooth: Controller: Remove memcpy of SCAN_REQ and CONN_REQ PDUs
Removed implementation that used memcpy of received PDUs and
instead using the free Rx buffers; use the scratch PDU for
transmitting scan requests and connection requests.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:07:53 -04:00
Vinayak Kariappa Chettimada
c409b74f0d Bluetooth: Controller: Add lll_prof_reserve profiling function
Add the lll_prof_reserve and lll_prof_reserve_send profiling
functions to use when profiling active scanning and
initiator.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:07:53 -04:00
Vinayak Kariappa Chettimada
7426045a28 Bluetooth: Controller: Define invalid/unassigned node rx handle value
Add a define for invalid/unassigned node rx handle value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-25 18:07:53 -04:00