Skip to content

Conversation

@cvinayak
Copy link
Contributor

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

@cvinayak cvinayak requested a review from ppryga-nordic August 25, 2021 16:41
@github-actions github-actions bot added area: API Changes to public APIs area: Bluetooth area: Bluetooth Controller area: Tests Issues related to a particular existing or missing test labels Aug 25, 2021
@cvinayak cvinayak force-pushed the github_per_adv_chm_upd branch 2 times, most recently from 563a97d to ab93c1a Compare August 26, 2021 01:08
@cvinayak cvinayak added this to the v2.7.0 milestone Aug 26, 2021
@cvinayak cvinayak force-pushed the github_per_adv_chm_upd branch from ab93c1a to 63d598c Compare August 26, 2021 10:11
@cvinayak cvinayak force-pushed the github_per_adv_chm_upd branch from 63d598c to a638f67 Compare August 26, 2021 16:18
Copy link
Contributor

@ppryga-nordic ppryga-nordic left a 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).

Copy link
Contributor

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.

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 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).

Copy link
Contributor

@ppryga-nordic ppryga-nordic Aug 27, 2021

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.

@cvinayak cvinayak force-pushed the github_per_adv_chm_upd branch 3 times, most recently from ab56746 to 3cace4d Compare August 27, 2021 08:09
Comment on lines 142 to 145
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 moved to a boolean function?

e,g,

Suggested change
/* 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

@cvinayak cvinayak force-pushed the github_per_adv_chm_upd branch 2 times, most recently from 3404aef to 09ef440 Compare August 27, 2021 10:43
@cvinayak cvinayak requested a review from ppryga-nordic August 27, 2021 10:45
@cvinayak cvinayak requested a review from Thalley August 27, 2021 10:45
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.

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>
@cvinayak cvinayak force-pushed the github_per_adv_chm_upd branch from 09ef440 to 1baa8c2 Compare August 27, 2021 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Changes to public APIs area: Bluetooth Controller area: Bluetooth area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants