Skip to content

Commit

Permalink
Bluetooth: Controller: Fix Central CIS SN/NESN for skipped events
Browse files Browse the repository at this point in the history
Fix Central CIS SN and NESN for skipped events during CIS
setup. It is possible that CIG event may overlap the ACL or
other events at the CIS create instant, and hence have non
zero lazy value during the CIS setup events until CIS is
established.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak authored and carlescufi committed May 16, 2023
1 parent 3b3d53f commit 9ff23ed
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,19 @@ static int prepare_cb(struct lll_prepare_param *p)
cig_lll->latency_prepare = 0U;

/* Adjust the SN and NESN for skipped CIG events */
/* sn and nesn are 1-bit, only Least Significant bit is needed */
cis_lll->sn += cis_lll->tx.bn * lazy;
cis_lll->nesn += cis_lll->rx.bn * lazy;
if (cis_lll->event_count) {
uint16_t cis_lazy;

if (lazy > cis_lll->event_count) {
cis_lazy = lazy - cis_lll->event_count;
} else {
cis_lazy = lazy;
}

/* sn and nesn are 1-bit, only Least Significant bit is needed */
cis_lll->sn += cis_lll->tx.bn * cis_lazy;
cis_lll->nesn += cis_lll->rx.bn * cis_lazy;
}

se_curr = 1U;
bn_tx = 1U;
Expand Down Expand Up @@ -368,9 +378,19 @@ static int prepare_cb(struct lll_prepare_param *p)
do {
cis_lll = ull_conn_iso_lll_stream_get_by_group(cig_lll, &cis_handle);
if (cis_lll && cis_lll->active) {
/* sn and nesn are 1-bit, only Least Significant bit is needed */
cis_lll->sn += cis_lll->tx.bn * lazy;
cis_lll->nesn += cis_lll->rx.bn * lazy;
if (cis_lll->event_count) {
uint16_t cis_lazy;

if (lazy > cis_lll->event_count) {
cis_lazy = lazy - cis_lll->event_count;
} else {
cis_lazy = lazy;
}

/* sn and nesn are 1-bit, only Least Significant bit is needed */
cis_lll->sn += cis_lll->tx.bn * cis_lazy;
cis_lll->nesn += cis_lll->rx.bn * cis_lazy;
}
}
} while (cis_lll);

Expand Down

0 comments on commit 9ff23ed

Please sign in to comment.