Skip to content
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

Bluetooth: CSIP: Add support for dynamically setting set size #86826

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Mar 9, 2025

The set size can now be dynamically set and notified. The rank is added as a argument in the case that changing the set size, also affects the device's rank, as ranks in a coordinated set needs to be continuous.

fixes #57470

@Thalley Thalley force-pushed the csip_dyn_set_size branch 4 times, most recently from a46bcc8 to 2e25620 Compare March 12, 2025 12:57
@Thalley Thalley force-pushed the csip_dyn_set_size branch from 2e25620 to 9df9c97 Compare March 13, 2025 10:19
@Thalley
Copy link
Collaborator Author

Thalley commented Mar 13, 2025

#AutoPTS run zephyr nrf53 CSIS/SR/SGGIT/CHA/BV-02-C

@codecoup-tester
Copy link

Scheduled PR #86826 (comment), board: nrf53, estimated start time: 15:34:56, test case count: 1, estimated duration: 0:10:34

Test cases to be runCSIS/SR/SGGIT/CHA/BV-02-C

@codecoup-tester
Copy link

AutoPTS Bot results:
No failed test found.

Successful tests (1)CSIS CSIS/SR/SGGIT/CHA/BV-02-C PASS

@Thalley Thalley requested a review from alexsven March 13, 2025 15:21
@Thalley Thalley force-pushed the csip_dyn_set_size branch 3 times, most recently from 5e3045a to 59a228f Compare March 13, 2025 21:38
Copy link
Collaborator

@alexsven alexsven left a comment

Choose a reason for hiding this comment

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

Didn't review the babblesim and shell parts that thorough

@Thalley Thalley force-pushed the csip_dyn_set_size branch from 59a228f to e3c45d5 Compare March 18, 2025 11:04
@Thalley Thalley requested a review from alexsven March 18, 2025 11:04
@Thalley Thalley force-pushed the csip_dyn_set_size branch from e3c45d5 to f7aaddd Compare March 18, 2025 11:20
Copy link
Collaborator

@asbjornsabo asbjornsabo left a comment

Choose a reason for hiding this comment

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

A couple of minor comments, otherwise LGTM.

@@ -237,6 +238,70 @@ int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
int bt_csip_set_member_get_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new _get_info() gets the SIRK (and other info). Is the _get_sirk() then needed anymore? Should it be deprecated and removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#86991 exists for that :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK

@Thalley Thalley force-pushed the csip_dyn_set_size branch from f7aaddd to 2faf535 Compare March 19, 2025 13:31
@Thalley Thalley requested a review from asbjornsabo March 19, 2025 13:31
asbjornsabo
asbjornsabo previously approved these changes Mar 19, 2025
Copy link
Collaborator

@asbjornsabo asbjornsabo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@fredrikdanebjer fredrikdanebjer left a comment

Choose a reason for hiding this comment

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

I have some general questions about this.

Isn't it strange that the rank is not notifiable when we can change it? I know that the spec. says that it cannot be notifiable - but maybe that should be changed? Is there a behaviour requirement that the service has to be rediscovered when the set size change has been notified?

The other thing is: The set member can now self-change the set size, but there is no guarantee that all set members will successfully update its set size. I did see that you made it very clear in the api description that it's the callers responsibility to ensure that all set members update it - and that is fair enough. However, I think its quite likely that there will be real-life situations where they aren't synced, due to bugs and whatnot. If this happens, can catastrophes happen as a side-effect?

return -ENOEXEC;
}

rank = shell_strtoul(argv[1], 0, &err);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't argv[1] be argv[2]? You are already using argv[1] for size

@Thalley
Copy link
Collaborator Author

Thalley commented Mar 20, 2025

Isn't it strange that the rank is not notifiable when we can change it? I know that the spec. says that it cannot be notifiable - but maybe that should be changed? Is there a behaviour requirement that the service has to be rediscovered when the set size change has been notified?

It is strange IMO, and I'm planning on filing an erratum for this.

The other thing is: The set member can now self-change the set size, but there is no guarantee that all set members will successfully update its set size. I did see that you made it very clear in the api description that it's the callers responsibility to ensure that all set members update it - and that is fair enough. However, I think its quite likely that there will be real-life situations where they aren't synced, due to bugs and whatnot.

That is correct :) However, the same can be said about the calls to bt_csip_set_member_register as well - There is nothing stopping (and no way we can stop) users to provide incorrect data to that function either, since the CSIP set members do not have any inter-communication. Presumably this would be caught by PTS at qualification time.

If this happens, can catastrophes happen as a side-effect?

That really depend on the set coordinators. If a set coordinator connect to 3 devices and 2 of them share the same rank, it's hard to tell what will happen. Ditto if 2 devices claim that the set has 3 device, and the last only claims that there's 2.

The set size can now be dynamically set and notified.
The rank is added as a argument in the case that changing
the set size, also affects the device's rank, as ranks
in a coordinated set needs to be continuous.

The set coordinator implementation has been updated
to support receiving the new set size, and providing
this information to the upper layers.

This commit adds a babblesim test for the new API,
as well as a shell command.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
@Thalley Thalley force-pushed the csip_dyn_set_size branch from 327a895 to c447dae Compare March 20, 2025 09:00
@asbjornsabo asbjornsabo self-requested a review March 20, 2025 09:18
@kartben kartben merged commit d19abff into zephyrproject-rtos:main Mar 20, 2025
23 checks passed
@Thalley Thalley deleted the csip_dyn_set_size branch March 20, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Audio area: Bluetooth platform: nRF BSIM Nordic Semiconductors, nRF BabbleSim Release Notes To be mentioned in the release notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

LE Audio: CSIP optional notification for Set Size
8 participants