-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Bluetooth: Controller: Periodic Advertising Chan Map Update Indication #37934
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: Controller: Periodic Advertising Chan Map Update Indication #37934
Conversation
563a97d to
ab93c1a
Compare
ab93c1a to
63d598c
Compare
63d598c to
a638f67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request to add missing information in header of function ull_adv_sync_pdu_set_clear.
Other things may be followed up in separate PR (but still provide your feedback).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple places in the controller where traverse by extended advertising header is done. If the structure of the extended advertising header is changed it will be difficult to find all of them to update. It would be good to have common implementation for that.
Lack of check in this place if cte_info is available was a source of very strange error in evaluation of radio wakeup time.
Common implementation should save us from such errors in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple places in the controller where traverse by extended advertising header is done.
Not all of the fields are needed to be traversed in the code where the traversal is repeated in the controller implementation. CTE info flag was added in BT v5.1 which was not present in BT v5.0, and the flag was added before ADI and Aux Ptr fields. There are two places the traversal of flags in received PDU is used, in lll_scan_aux.c and ull_scan_aux.c, both have different requirement of handling the fields, a common implementation will only increase complexity of such an interface.
As there is no explicit ACAD len in the PDU, it is not possible to validate based on the PDU length.
What can be done, check if reserved flag is set then regard the complete PDU as invalid. Future features will still need update to all places where traversal is present, which is what we are doing now with CTE field (between v5.0 and v5.1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well my point is to get "golden mean" between copying the code and re-use of code. E.g. if there is a number of places we get aux_ptr then it should be implemented once and re-used. If there is a need to get access to ACAD, that is a bit more complicated than just traversal ext. header, in multiple places it should also be implemented once.
Having single implementation would save time for updating.
Also when the code is a function that has single responsibility it may be unit tested. Then we are sure if updates does not break already used functionality.
ab56746 to
3cace4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be moved to a boolean function?
e,g,
| /* At or past the instant, use channelMapNew */ | |
| instant_latency = (event_counter - lll->chm_instant) & | |
| UINT16_MAX; | |
| if (instant_latency <= INT16_MAX) { | |
| static bool is_past_instant(uint16_t event_counter, uint16_t chm_instant) | |
| { | |
| uint16_t instant_latency; | |
| instant_latency = event_counter - chm_instant | |
| return instant_latency >= INT16_MAX; | |
| } | |
| ... | |
| if (is_past_instant(event_counter, lll->chm_instant) { | |
| ... | |
| } |
As this specific calculation is done multiple places
3404aef to
09ef440
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my comments have been addressed.
Add Channel Map Update Indication AD Data Type. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added implementation to perform Periodic Advertising Channel Map Update Indication as a Broadcaster. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
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>
Include Periodic Advertising Channel Map Update Indication in the BabbleSim test. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
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>
Use a helper function to check at instant or past to apply the channelMapNew. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Changes addressing Periodic Advertising and Synchronization Channel Map Update Indication feature. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use a defined for channel map size of 5 octets. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
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>
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>
09ef440 to
1baa8c2
Compare
Added implementation to perform Periodic Advertising Channel
Map Update Indication as a Broadcaster.
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