Skip to content

Conversation

@cvinayak
Copy link
Contributor

@cvinayak cvinayak commented Nov 1, 2024

Add implementation for Extended Advertising Auxiliary PDUs
to use ticks slot window feature.

This will allow the periodic scheduling of AUX_ADV_IND PDUs
to drift upto its next interval when overlapping with other
states/roles that cannot be moved around, to avoid skipping
them.

Having an active Extended Advertising simultaneously with
an ISO Synchronized Receiver or Connected ISO connection
will now have less ISO SDU loss.

The feature is a one-line assignment to use, but a conditional
compilation mess! Lets address that when it comes to #65125

@cvinayak cvinayak force-pushed the github_aux_adv_ticks_slot_window branch from 7d2ee3c to 91b65a3 Compare November 6, 2024 19:35
@zephyrbot zephyrbot added the area: Bluetooth HCI Bluetooth HCI Driver label Nov 6, 2024
@cvinayak cvinayak assigned cvinayak and unassigned jhedberg and alwa-nordic Nov 6, 2024
@cvinayak cvinayak force-pushed the github_aux_adv_ticks_slot_window branch from 2b59659 to 3c5222e Compare November 18, 2024 10:03
@hermabe hermabe removed their request for review November 18, 2024 11:04
Thalley
Thalley previously approved these changes Nov 18, 2024
@cvinayak cvinayak force-pushed the github_aux_adv_ticks_slot_window branch from 3c5222e to 214a227 Compare November 19, 2024 05:19
@zephyrbot zephyrbot added the platform: nRF BSIM Nordic Semiconductors, nRF BabbleSim label Nov 19, 2024
Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like a reply on #80733 (comment)

@cvinayak cvinayak force-pushed the github_aux_adv_ticks_slot_window branch from 214a227 to fd23ed0 Compare November 19, 2024 12:00
Thalley
Thalley previously approved these changes Nov 19, 2024
@cvinayak
Copy link
Contributor Author

@Thalley I had to add additional commits to lower the HEAP size allotted and reduce supported Broadcast ISO instance where required to make room for increasing RAM usage in upstream main.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this reduction for mesh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just being consistent with other conf files. I did not have the expertise to validate why we need HEAP at the first place at all. Is it like IPC uses unallocated RAM and this value overlaps such that IPC can function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this reduction for all ISO .confs?

Isn't it only the combined one?
Or is this just done to be consistent for all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just being consistent with other conf files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, do we need this reduction for DF?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just being consistent with other conf files.

Comment on lines +43 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be further explained in a GH issue?

This isn't something I understand as it is written here

Copy link
Contributor Author

@cvinayak cvinayak Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will create a detailed GH issue in the coming days... need to put some effort on simple sample rather that the audio tests to be able to reproduce/demo the issue.

The related code is:

static void hci_ipc_rx(uint8_t *data, size_t len)
{
uint8_t pkt_indicator;
struct net_buf *buf = NULL;
size_t remaining = len;
LOG_HEXDUMP_DBG(data, len, "IPC data:");
pkt_indicator = *data++;
remaining -= sizeof(pkt_indicator);
switch (pkt_indicator) {
case HCI_IPC_CMD:
buf = hci_ipc_cmd_recv(data, remaining);
break;
case HCI_IPC_ACL:
buf = hci_ipc_acl_recv(data, remaining);
break;
case HCI_IPC_ISO:
buf = hci_ipc_iso_recv(data, remaining);
break;
default:
LOG_ERR("Unknown HCI type %u", pkt_indicator);
return;
}
if (buf) {
k_fifo_put(&tx_queue, buf);
LOG_HEXDUMP_DBG(buf->data, buf->len, "Final net buffer:");
}
}

This function can return without call to k_fifo_put(), and there is no resumption/dequeue of Rx when the buffers are available later in time, causing the buffers/stream inside IPC to be stagnate until any next trigger that would call the hci_ipc_rx() again.

The next trigger would be a num complete event (or disconnect or any reports?) going upstream (one side of the Newton's Cradle, say one item strikes), consequently (other side of the Newton's Cradle, one item now strikes) new buffers are enqueued from upstream.

This effect can happen in either direction, I believe.

Comment on lines +1 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in #80733 (comment): This is messy. We shouldn't have overlays/extra conf files that need to be added in a specific order to work, especially when it's not documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is repo wide use of extra_configs in sample.yaml and testcase.yaml files to use overrides of Kconfig values from prj.conf and use of EXTRA_CONF_FILE is better organization wise compared to use of list of Kconfigs under extra_configs.

OVERLAY_CONFIG is deprecated, but it did convey that something was overlay-ed!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OVERLAY_CONFIG is deprecated, but it did convey that something was overlay-ed!

Right :D I should stop calling them overlays

There is repo wide use of extra_configs in sample.yaml and testcase.yaml files to use overrides of Kconfig values from prj.conf and use of EXTRA_CONF_FILE is better organization wise compared to use of list of Kconfigs under extra_configs.

If we have several places where we use multiple extra configs that needs to be specific in a specific order, that's not a good reason to do it here either. IMO that just show that we have this other places too.

A file called testcase.yaml does/should not be used as documentation. If these values are required for this specific board to work, then that needs to be documented and/or applied automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is documented in the snippets section that the processing order of the snippets, .conf and .overlay files are "in the order they are listed".

Processing order
****************
Snippets are processed in the order they are listed in the :makevar:`SNIPPET`
variable, or in the order of the ``-S`` arguments if using west.
To apply ``bar`` after ``foo``:
.. code-block:: console
cmake -Sapp -Bbuild -DSNIPPET="foo;bar" [...]
cmake --build build
The same can be achieved with west as follows:
.. code-block:: console
west build -S foo -S bar [...] app
When multiple snippets set the same configuration, the configuration value set
by the last processed snippet ends up in the final configurations.
For instance, if ``foo`` sets ``CONFIG_FOO=1`` and ``bar`` sets
``CONFIG_FOO=2`` in the above example, the resulting final configuration will
be ``CONFIG_FOO=2`` because ``bar`` is processed after ``foo``.
This principle applies to both Kconfig fragments (``.conf`` files) and
devicetree overlays (``.overlay`` files).

Comment on lines 1 to 16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an overlay, what's the purpose or overlaying these values when they are already provided by the "main" conf file?

Shouldn't the overlay only contain values that are different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are Bluetooth Common and Host Kconfigs that have references (inheritance of values/counts) in the Controller Kconfig options, hence relisting them explicitly to ensure the dependencies are consistent when this overlay file is included in the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hence relisting them explicitly to ensure the dependencies are consistent when this overlay file is included in the build.

But in the case that e.g. CONFIG_BT_PERIPHERAL=n in the "main" file, we don't want to enable it in the overlay.

I think this will make it harder to maintain as it is effectively code duplication, and any changes has to be done to both files to keep the nRF52 and nRF53 build similar.

I'm not sure I see the advantage of duplicating them

Copy link
Contributor Author

@cvinayak cvinayak Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the commit that makes the nrf52 same as nrf53... will address that in a separate PR, may be having different Kconfig for nRF52 and nRF53 could be better in long run to discover bugs.

I will explore use of snippets, say "bt-ll-sw-split-experimental" that hopefully can be common across supported platforms.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we really need a better solution for this :)

Fix to reschedule before overlap and be collision resolved
in the next periodic interval for tickers using slot window
yield.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce ticker reschedule with drift so that role like
AUX_ADV_IND can start after overlapping states and roles
using time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add implementation for Extended Advertising Auxiliary PDUs
to use ticks slot window feature.

This will allow the periodic scheduling of AUX_ADV_IND PDUs
to drift upto 10 ms advertising delay minus the ticks_slot
time reservation of the AUX_ADV_IND PDU when overlapping
with other states/roles that cannot be moved around, to
avoid skipping them.

Having an active Extended Advertising simultaneously with
an ISO Synchronized Receiver or Connected ISO connection
will now have less ISO SDU loss when using 10 ms ISO
intervals.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix some test simulation length be greater than wait time.
These tests completed within 12 seconds, 15 second wait
time is a good value with included margin and a 20 second
simulation time.

These tests failed on this PR CI.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The required ISO Tx buffers have to match the Read Buffer
Size values, otherwise the difference in the value cause a
similar amount of buffers to be stalled in the IPC driver.

Use reduced HEAP size to make room for increase in RAM
usage.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@cvinayak cvinayak force-pushed the github_aux_adv_ticks_slot_window branch from 642c8b4 to f01f803 Compare November 22, 2024 05:15
@cvinayak
Copy link
Contributor Author

#AutoPTS run zephyr nrf53 BAP/UCL/STR/BV-523-C

1 similar comment
@Thalley
Copy link
Contributor

Thalley commented Nov 22, 2024

#AutoPTS run zephyr nrf53 BAP/UCL/STR/BV-523-C

@codecoup-tester
Copy link

Scheduled PR #80733 (comment), board: nrf53, estimated start time: 14:15:41, test case count: 1, estimated duration: 0:01:30

Test cases to be runBAP/UCL/STR/BV-523-C

@codecoup-tester
Copy link

AutoPTS Bot results:
No failed test found.

Successful tests (1)BAP BAP/UCL/STR/BV-523-C PASS (2)

@kartben kartben merged commit 398b915 into zephyrproject-rtos:main Nov 22, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants