Skip to content

Commit ad6c051

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: Controller: Fix CIS payload count under skipped events
Fix CIS payload count calculation under skipped events that caused CIS disconnection with reason MIC failure. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 3399e06 commit ad6c051

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,10 @@ static void payload_count_lazy_update(struct lll_conn_iso_stream *cis_lll, uint1
12531253
u = cis_lll->nse - ((cis_lll->nse / cis_lll->tx.bn) *
12541254
(cis_lll->tx.bn - 1U -
12551255
(payload_count % cis_lll->tx.bn)));
1256-
while (((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) <
1257-
(cis_lll->event_count + 1U)) {
1256+
while ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) <
1257+
cis_lll->event_count) ||
1258+
((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) ==
1259+
cis_lll->event_count) && (u <= cis_lll->nse))) {
12581260
/* sn and nesn are 1-bit, only Least Significant bit is needed */
12591261
cis_lll->sn++;
12601262
cis_lll->tx.bn_curr++;
@@ -1281,8 +1283,10 @@ static void payload_count_lazy_update(struct lll_conn_iso_stream *cis_lll, uint1
12811283
u = cis_lll->nse - ((cis_lll->nse / cis_lll->rx.bn) *
12821284
(cis_lll->rx.bn - 1U -
12831285
(payload_count % cis_lll->rx.bn)));
1284-
while (((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) <
1285-
(cis_lll->event_count + 1U)) {
1286+
while ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) <
1287+
cis_lll->event_count) ||
1288+
((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) ==
1289+
cis_lll->event_count) && (u <= cis_lll->nse))) {
12861290
/* sn and nesn are 1-bit, only Least Significant bit is needed */
12871291
cis_lll->nesn++;
12881292
cis_lll->rx.bn_curr++;

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,12 +1359,10 @@ static void payload_count_lazy(struct lll_conn_iso_stream *cis_lll, uint16_t laz
13591359
u = cis_lll->nse - ((cis_lll->nse / cis_lll->tx.bn) *
13601360
(cis_lll->tx.bn - 1U -
13611361
(payload_count % cis_lll->tx.bn)));
1362-
while (((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) <
1363-
(cis_lll->event_count + 1U)) ||
1364-
((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) ==
1365-
(cis_lll->event_count + 1U)) && (u < (cis_lll->nse + 1U)))) &&
1366-
((cis_lll->tx.payload_count / cis_lll->tx.bn) <
1367-
cis_lll->event_count)) {
1362+
while ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) <
1363+
cis_lll->event_count) ||
1364+
((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) ==
1365+
cis_lll->event_count) && (u < cis_lll->nse))) {
13681366
/* sn and nesn are 1-bit, only Least Significant bit is needed */
13691367
cis_lll->sn++;
13701368
cis_lll->tx.bn_curr++;
@@ -1391,12 +1389,10 @@ static void payload_count_lazy(struct lll_conn_iso_stream *cis_lll, uint16_t laz
13911389
u = cis_lll->nse - ((cis_lll->nse / cis_lll->rx.bn) *
13921390
(cis_lll->rx.bn - 1U -
13931391
(payload_count % cis_lll->rx.bn)));
1394-
while (((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) <
1395-
(cis_lll->event_count + 1U)) ||
1396-
((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) ==
1397-
(cis_lll->event_count + 1U)) && (u <= (cis_lll->nse + 1U)))) &&
1398-
((cis_lll->rx.payload_count / cis_lll->rx.bn) <
1399-
cis_lll->event_count)) {
1392+
while ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) <
1393+
cis_lll->event_count) ||
1394+
((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) ==
1395+
cis_lll->event_count) && (u <= cis_lll->nse))) {
14001396
/* sn and nesn are 1-bit, only Least Significant bit is needed */
14011397
cis_lll->nesn++;
14021398
cis_lll->rx.bn_curr++;

0 commit comments

Comments
 (0)