Skip to content

Bluetooth: Audio: Update BT_BAP_SCAN_DELEGATOR dependency to GATT_DYN… #79360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Bluetooth: Audio: Update BT_BAP_SCAN_DELEGATOR dependency to GATT_DYN… #79360

merged 1 commit into from
Oct 23, 2024

Conversation

babrsn
Copy link
Collaborator

@babrsn babrsn commented Oct 3, 2024

…AMIC_DB

Changed dependency of the BT_BAP_SCAN_DELEGATOR to GATT_DYNAMIC_DB from 'select' to 'depends on' and solved all loop dependencies caused by this change.

Fixes #79108

@PavelVPV
Copy link
Collaborator

PavelVPV commented Oct 7, 2024

I guess mesh changed by coincidence?

@@ -41,6 +41,7 @@ CONFIG_BT_ISO_TX_BUF_COUNT=4
CONFIG_BT_BAP_BROADCAST_ASSISTANT=y

# Broadcast Sink
CONFIG_BT_GATT_DYNAMIC_DB=y
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is already set in prj.conf

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok.

@omkar3141
Copy link
Collaborator

omkar3141 commented Oct 7, 2024

I guess mesh changed by coincidence?

I believe this is very relevant for mesh since we change services at run-time after provisioning (removal of Mesh Provisioning Service and exposing Mesh Proxy Service).

I also compiled 'light' sample on NCSv2.6.0 and I see CONFIG_BT_GATT_DYNAMIC_DB=y in generated .config file. Same observed for Zephyr 'mesh' sample on corresponding zephyr revision.

omkar3141
omkar3141 previously approved these changes Oct 7, 2024
Copy link
Collaborator

@omkar3141 omkar3141 left a comment

Choose a reason for hiding this comment

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

Looks good for mesh.

@PavelVPV
Copy link
Collaborator

PavelVPV commented Oct 7, 2024

I guess mesh changed by coincidence?

I believe this is very relevant for mesh since we change services at run-time after provisioning (removal of Mesh Provisioning Service and exposing Mesh Proxy Service).

I also compiled 'light' sample on NCSv2.6.0 and I see CONFIG_BT_GATT_DYNAMIC_DB=y in generated .config file. Same observed for Zephyr 'mesh' sample on corresponding zephyr revision.

No need for explicit selection of Kconfig options that have been enabled by default for ages:

config BT_MESH_GATT_SERVER
bool
select BT_MESH_GATT
select BT_GATT_DYNAMIC_DB

@PavelVPV
Copy link
Collaborator

PavelVPV commented Oct 7, 2024

The fact that LE audio cannot use depends on (and thus also no other application) with Mesh enabled is evidence, IMO, that it was not working fine before.

From what I see this doesn't depend on whether mesh enabled or not:

Ok, to describe it in more detail, assume I just change the dependency of ´BT_BAP_SCAN_DELEGATOR´ from ´select´ to ´depends on´ in ´subsys/bluetooth/audio/Kconfig.bap´ (as intended by this issue). Then, for instance, when I build ´bap_broadcast_sink´, I get the dependency loop error (see the attachment file).

This should be explained in the issue more clearly.

@babrsn
Copy link
Collaborator Author

babrsn commented Oct 7, 2024

Why do you want to change select BT_GATT_DYNAMIC_DB to depends on BT_GATT_DYNAMIC_DB for BT_BAP_SCAN_DELEGATOR?

Besides being semantically better when dealing with dependencies, our Kconfig page also mentions that depends on is usually better than select for a handful of reason (including these circular dependencies that we have...): https://docs.zephyrproject.org/latest/build/kconfig/tips.html#alternatives-to-select

Since it was working fine before even being semantically not perfect, I'd really like to know what is actually wrong (not worse/better) before approving because now all users will have to explicitly enable BT_GATT_DYNAMIC_DB in their project files.

Since it was working fine before

The fact that LE audio cannot use depends on (and thus also no other application) with Mesh enabled is evidence, IMO, that it was not working fine before. The current usage of select is effectively forcing others to also using select rather than depends on.

@babrsn It would be interesting to see how the changes are if Mesh wasn't changed. You mentioned that the circular dependency could be fixed in another way, without affecting Mesh?

At the moment, I don’t have a ready-to-submit alternative solution. However, I believe there should be more alternatives for this issue. I think the current solution here is the simplest because I have mostly changed the configs which select BT_GATT_DYNAMIC_DB. I suspect that alternative solutions will affect more parameters in more places. If it would be beneficial, I can investigate to see if I can find another good solution that doesn’t affect 'Mesh'. I could do this tomorrow or the day after...

@Thalley
Copy link
Collaborator

Thalley commented Oct 7, 2024

At the moment, I don’t have a ready-to-submit alternative solution. However, I believe there should be more alternatives for this issue. I think the current solution here is the simplest because I have mostly changed the configs which select BT_GATT_DYNAMIC_DB. I suspect that alternative solutions will affect more parameters in more places. If it would be beneficial, I can investigate to see if I can find another good solution that doesn’t affect 'Mesh'. I could do this tomorrow or the day after...

I think it's worth investigating alternative solutions that doesn't affect mesh (and preferably nothing else besides the LE Audio stack). If you do get something else working, please submit that as a separate commit, either in this PR or another for comparison

@PavelVPV
Copy link
Collaborator

PavelVPV commented Oct 9, 2024

Perhaps you want something like this: 39eb100 ?

All audio and mesh upstream samples compile with this change.

But as you see now you (and all who use audio) need explicitly enable BT_GATT_DYNAMIC_DB and some other Bluetooth options.

If you want to proceed with this, I'd recommend go through audio Kconfigs and replace "select BT_" to "depends on BT_" for all upper Bluetooth Kconfig options.

@omkar3141
Copy link
Collaborator

If you want to proceed with this, I'd recommend go through audio Kconfigs and replace "select BT_" to "depends on BT_" for all upper Bluetooth Kconfig options.

It is not a bad idea, though it will make all "prj.conf" look quite big and littered with many KConfig options.

Then I think, may be it is worth to not introduce this change everywhere and do it only at a place where it actually creates a problem (like proposed in this PR). This could be middle ground even though it is not so pure and pious.

@Thalley
Copy link
Collaborator

Thalley commented Oct 9, 2024

Perhaps you want something like this: 39eb100 ?

All audio and mesh upstream samples compile with this change.

But as you see now you (and all who use audio) need explicitly enable BT_GATT_DYNAMIC_DB and some other Bluetooth options.

If you want to proceed with this, I'd recommend go through audio Kconfigs and replace "select BT_" to "depends on BT_" for all upper Bluetooth Kconfig options.

That's closer to the result I had expected from fixing the issue as well. Ideally we want to replace all select with depends on in LE audio in the future

It is not a bad idea, though it will make all "prj.conf" look quite big and littered with many KConfig options.

Then I think, may be it is worth to not introduce this change everywhere and do it only at a place where it actually creates a problem (like proposed in this PR). This could be middle ground even though it is not so pure and pious.

I think this is a subjective matter.
Besides depends on being suggested by Zephyr over select, forcing applications to enable things explicitly does indeed make the .conf files larger, but also clearer in terms of what is enabled.

For example enabling CONFIG_FOO should in many cases perhaps not enable 10s of other Kconfigs what the knowledge of the user. See https://docs.zephyrproject.org/latest/build/kconfig/tips.html#select-pitfalls for reasons why select should not be overused.

@kruithofa kruithofa removed their request for review October 9, 2024 12:05
@babrsn
Copy link
Collaborator Author

babrsn commented Oct 9, 2024

Perhaps you want something like this: 39eb100 ?

All audio and mesh upstream samples compile with this change.

But as you see now you (and all who use audio) need explicitly enable BT_GATT_DYNAMIC_DB and some other Bluetooth options.

If you want to proceed with this, I'd recommend go through audio Kconfigs and replace "select BT_" to "depends on BT_" for all upper Bluetooth Kconfig options.

Thanks. Although it involves a considerable number of changes in the config symbols within the Kconfig files, I think it could be a good solution since it only affects the BT_Audio area. As I still haven’t had time to investigate it and possibly find a better solution, I can cherry-pick it and push an update to this PR...

@Thalley
Copy link
Collaborator

Thalley commented Oct 9, 2024

Thanks. Although it involves a considerable number of changes in the config symbols within the Kconfig files

As mentioned earlier, these changes are likely ones we want in the future anyways. We should be able to replace all select by depends on in LE Audio.

@babrsn
Copy link
Collaborator Author

babrsn commented Oct 9, 2024

Thanks. Although it involves a considerable number of changes in the config symbols within the Kconfig files

As mentioned earlier, these changes are likely ones we want in the future anyways. We should be able to replace all select by depends on in LE Audio.

Indeed

@zephyrbot zephyrbot added the area: Bluetooth ISO Bluetooth LE Isochronous Channels label Oct 10, 2024
Thalley
Thalley previously approved these changes Oct 10, 2024
@Thalley
Copy link
Collaborator

Thalley commented Oct 17, 2024

@babrsn needs a rebase for the CCID changes I believe :)

Changed dependency of the BT_BAP_SCAN_DELEGATOR to GATT_DYNAMIC_DB
from 'select' to 'depends on' and solved all loop dependencies
caused by this change.

Fixes #79108

Signed-off-by: Babak Arisian <bbaa@demant.com>
@Thalley Thalley requested review from omkar3141 and sjanc October 22, 2024 06:35
@carlescufi carlescufi merged commit 7f820d5 into zephyrproject-rtos:main Oct 23, 2024
26 checks passed
@babrsn babrsn deleted the dependency_scan_deligator branch October 24, 2024 07:18
dkalowsk pushed a commit that referenced this pull request Oct 28, 2024
I have contributed the following PRs:
#80000
#79360
#78846
#78751
#74950
#74946
#73845
#72849

and am attending the weekly LE Audio Zephyr meetings.

Signed-off-by: Babak Arisian <bbaa@demant.com>
coreboot-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Oct 31, 2024
I have contributed the following PRs:
zephyrproject-rtos/zephyr#80000
zephyrproject-rtos/zephyr#79360
zephyrproject-rtos/zephyr#78846
zephyrproject-rtos/zephyr#78751
zephyrproject-rtos/zephyr#74950
zephyrproject-rtos/zephyr#74946
zephyrproject-rtos/zephyr#73845
zephyrproject-rtos/zephyr#72849

and am attending the weekly LE Audio Zephyr meetings.

(cherry picked from commit c903013)

Original-Signed-off-by: Babak Arisian <bbaa@demant.com>
GitOrigin-RevId: c903013
Cr-Build-Id: 8732568629207591185
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8732568629207591185
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: Iab40058a1cc005e6454c07b4156fc271c0b84fca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5982745
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Audio area: Bluetooth Controller area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth ISO Bluetooth LE Isochronous Channels area: Bluetooth Qualification Bluetooth Qualification -related issues and pull requests area: Bluetooth area: Samples Samples platform: nRF Nordic nRFx
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Bluetooth: Audio: Change dependency of BT_BAP_SCAN_DELEGATOR to GATT_DYNAMIC_DB from 'select' to 'depends on'
8 participants